/* Health App — 全局样式
   设计: 清新健康向, emerald 为主, 数据优先, 移动优先 */

:root {
  --primary: #059669;
  --primary-light: #10b981;
  --primary-bg: #ecfdf5;
  --accent: #f59e0b;
  --danger: #ef4444;
  --warning: #f97316;
  --info: #3b82f6;

  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.08);

  --mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
          'Microsoft YaHei', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { font-family: var(--sans); color: var(--text); background: var(--bg); line-height: 1.6; }

.container { max-width: 720px; margin: 0 auto; padding: 20px 16px 60px; }

/* --- 顶栏 --- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-nav { display: flex; gap: 16px; }
.topbar-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.topbar-nav a:hover, .topbar-nav a.active {
  background: var(--primary-bg);
  color: var(--primary);
}

/* --- Cards --- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: -8px;
  margin-bottom: 14px;
}

/* --- Forms --- */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-bottom: 12px;
}
.form-row.full { grid-template-columns: 1fr; }
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.form-field input, .form-field select, .form-field textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--card);
  transition: border 0.15s;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}
.form-field .hint { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #047857; }
.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* --- KPI grid --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.kpi {
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: left;
}
.kpi-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--primary); margin-top: 4px; }
.kpi-unit { font-size: 12px; color: var(--text-muted); margin-left: 2px; }
.kpi-hint { font-size: 11px; color: var(--text-light); margin-top: 4px; }

/* --- Tables (简易) --- */
.data-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.data-table th, .data-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { font-weight: 600; color: var(--text-muted); font-size: 12px; }
.data-table td.mono { font-family: var(--mono); }

/* --- Risk badges --- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-high { background: #fee2e2; color: #dc2626; }
.badge-medium { background: #fef3c7; color: #d97706; }
.badge-low { background: #dcfce7; color: #16a34a; }

/* --- Alerts --- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
}
.alert-info { background: #dbeafe; color: #1e40af; border-left: 3px solid #3b82f6; }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 3px solid #f59e0b; }
.alert-success { background: #dcfce7; color: #166534; border-left: 3px solid #16a34a; }

/* --- Utility --- */
.muted { color: var(--text-muted); }
.mono { font-family: var(--mono); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mt-2 { margin-top: 16px; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.grow { flex: 1; }

/* --- Gene list --- */
.gene-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
}
.gene-item .gene-name { font-weight: 600; font-size: 14px; }
.gene-item .gene-detail { font-size: 12px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }
.gene-item .gene-actionable { font-size: 12px; color: var(--primary); margin-top: 4px; font-weight: 500; }
.gene-item .gene-meta { font-family: var(--mono); font-size: 11px; color: var(--text-light); }

/* --- Responsive --- */
@media (max-width: 600px) {
  .container { padding: 12px 10px 60px; }
  .card { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
