/* 慢病健康管理综合运营平台 —— 政府淡色主题 */
:root {
  --brand-50: #eff6ff;
  --brand-100: #dbeafe;
  --brand-200: #bfdbfe;
  --brand-300: #93c5fd;
  --brand-400: #60a5fa;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-800: #1e40af;
  --accent-teal: #0891b2;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --bg-page: #f6f8fc;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --border: #e5e7eb;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Source Han Sans CN', Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

/* ============ 侧边栏 ============ */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  padding: 0;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.logo-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700;
}
.logo-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}
.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.menu {
  padding: 10px 8px 24px;
}
.menu-group-title {
  padding: 14px 14px 6px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  font-weight: 600;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  margin: 2px 4px;
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  transition: all 0.15s ease;
}
.menu-item i {
  width: 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
.menu-item:hover {
  background: var(--brand-50);
  color: var(--brand-700);
}
.menu-item:hover i { color: var(--brand-600); }
.menu-item.active {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
}
.menu-item.active i { color: var(--brand-600); }
.menu-item.active::before {
  content: '';
  width: 3px;
  height: 16px;
  background: var(--brand-600);
  border-radius: 2px;
  position: absolute;
  margin-left: -14px;
}

/* ============ 顶部栏 ============ */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.breadcrumb {
  color: var(--text-secondary);
  font-size: 13px;
}
.breadcrumb .sep { margin: 0 6px; color: var(--text-muted); }
.breadcrumb .current { color: var(--text-primary); font-weight: 500; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.topbar-action {
  color: var(--text-secondary);
  font-size: 16px;
  position: relative;
  cursor: pointer;
}
.topbar-action .badge {
  position: absolute;
  top: -4px; right: -6px;
  background: var(--accent-red);
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 8px;
  line-height: 1.2;
}
.user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 20px;
  background: #f1f5f9;
}
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa, #818cf8);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 600;
}
.user-name { font-size: 13px; color: var(--text-primary); }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ============ 主内容 ============ */
.main { display: flex; flex-direction: column; min-width: 0; }
.content { padding: 20px 24px 40px; }
.page-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--text-primary);
}
.page-desc {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 18px;
}

/* ============ 卡片 ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.card-title .hint {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 8px;
}
.card-actions a, .card-actions button {
  font-size: 12.5px;
  color: var(--brand-600);
  text-decoration: none;
  margin-left: 12px;
  cursor: pointer;
  background: none;
  border: none;
}
.card-actions a:hover { text-decoration: underline; }

/* ============ KPI 卡 ============ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--brand-500);
}
.kpi.green::before { background: var(--accent-green); }
.kpi.orange::before { background: var(--accent-orange); }
.kpi.red::before { background: var(--accent-red); }
.kpi.teal::before { background: var(--accent-teal); }
.kpi .label {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kpi .label i { color: var(--text-muted); font-size: 15px; }
.kpi .value {
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.kpi .value .unit {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}
.kpi .delta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.kpi .delta.up { color: var(--accent-green); }
.kpi .delta.down { color: var(--accent-red); }

/* ============ 表格 ============ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  padding: 10px 12px;
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.table td {
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-primary);
}
.table tr:hover td { background: #f8fafc; }
.table a.link {
  color: var(--brand-600);
  text-decoration: none;
}
.table a.link:hover { text-decoration: underline; }

/* ============ 标签/徽章 ============ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #f1f5f9;
  color: var(--text-secondary);
}
.tag.brand { background: var(--brand-50); color: var(--brand-700); }
.tag.green { background: #ecfdf5; color: #047857; }
.tag.orange { background: #fff7ed; color: #c2410c; }
.tag.red { background: #fef2f2; color: #b91c1c; }
.tag.teal { background: #ecfeff; color: #0e7490; }
.tag.purple { background: #f5f3ff; color: #6d28d9; }
.tag.gray { background: #f1f5f9; color: #475569; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; vertical-align: middle; }
.dot.green { background: var(--accent-green); }
.dot.orange { background: var(--accent-orange); }
.dot.red { background: var(--accent-red); }
.dot.gray { background: #cbd5e1; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-primary { background: var(--brand-600); color: #fff; }
.btn-primary:hover { background: var(--brand-700); }
.btn-ghost { background: #fff; color: var(--text-primary); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--brand-300); color: var(--brand-700); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }

/* ============ 筛选条 ============ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  background: #fff;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filter-bar label { font-size: 12.5px; color: var(--text-secondary); margin-right: 4px; }
.filter-bar select, .filter-bar input {
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text-primary);
  outline: none;
  min-width: 120px;
}
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--brand-400); }

/* ============ 网格 / 分栏 ============ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 14px; }

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* ============ Tabs ============ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  padding: 9px 16px;
  font-size: 13.5px;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.tab.active {
  color: var(--brand-700);
  font-weight: 600;
  border-bottom-color: var(--brand-600);
}
.tab:hover { color: var(--brand-700); }

/* ============ 进度条 ============ */
.bar {
  height: 6px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--brand-500);
  border-radius: 4px;
}
.bar.green > span { background: var(--accent-green); }
.bar.orange > span { background: var(--accent-orange); }
.bar.red > span { background: var(--accent-red); }

/* ============ 时间线 ============ */
.timeline { position: relative; padding-left: 20px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 5px; top: 4px; bottom: 4px;
  width: 2px;
  background: #e2e8f0;
}
.timeline-item { position: relative; margin-bottom: 14px; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px; top: 6px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand-500);
}
.timeline-item.warn::before { border-color: var(--accent-orange); }
.timeline-item.danger::before { border-color: var(--accent-red); }
.timeline-time { font-size: 12px; color: var(--text-muted); }
.timeline-title { font-size: 13.5px; color: var(--text-primary); font-weight: 500; margin: 2px 0; }
.timeline-desc { font-size: 12.5px; color: var(--text-secondary); }

/* ============ 登录页 ============ */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: #f6f8fc;
}
.login-hero {
  background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
  color: #fff;
  padding: 60px 72px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-hero::after {
  content: '';
  position: absolute;
  right: -100px; bottom: -100px;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.login-hero h1 { font-size: 28px; margin: 0 0 16px; font-weight: 600; }
.login-hero p { font-size: 15px; opacity: 0.9; line-height: 1.8; max-width: 480px; }
.login-hero ul { list-style: none; padding: 0; margin: 28px 0 0; }
.login-hero ul li { padding: 6px 0; font-size: 14px; opacity: 0.92; }
.login-hero ul li i { margin-right: 10px; }

.login-form-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.login-form {
  width: 100%; max-width: 380px;
}
.login-form h2 { font-size: 22px; margin: 0 0 6px; }
.login-form .sub { color: var(--text-secondary); font-size: 13px; margin-bottom: 28px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}
.field input:focus { border-color: var(--brand-500); }
.btn-login {
  width: 100%;
  padding: 11px;
  font-size: 15px;
  background: var(--brand-600);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 6px;
}
.btn-login:hover { background: var(--brand-700); }

/* ============ 杂项 ============ */
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* Map 风格区域块 */
.chart { width: 100%; height: 300px; }
.chart-sm { width: 100%; height: 220px; }
.chart-lg { width: 100%; height: 380px; }

.avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #a5b4fc, #818cf8);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  margin-right: 8px;
  vertical-align: middle;
}
