/* Get Based Dashboard - Professional Medical Dashboard */
:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #222635;
  --bg-hover: #2a2e3d;
  --border: #2e3348;
  --text-primary: #e8eaf0;
  --text-secondary: #8b90a0;
  --text-muted: #5a5f73;
  --accent: #4f8cff;
  --accent-light: #6ba0ff;
  --accent-gradient: linear-gradient(135deg, #4f8cff 0%, #6366f1 100%);
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, 0.15);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.15);
  --yellow: #fbbf24;
  --yellow-bg: rgba(251, 191, 36, 0.15);
  --ref-band: rgba(79, 140, 255, 0.08);
  --ref-border: rgba(79, 140, 255, 0.25);
  --chart-grid: rgba(46,51,72,0.5);
  --chart-tooltip-bg: rgba(34, 38, 53, 0.95);
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.35);
  --shadow-glow: 0 0 0 1px var(--accent), 0 4px 12px rgba(79, 140, 255, 0.1);
  --orange: #fb923c;
  --orange-bg: rgba(251,146,60,0.1);
  --purple: #a78bfa;
  --purple-light: rgba(167,139,250,0.15);
  --cyan: rgba(56, 189, 248, 0.6);
  --radius: 12px;
  --radius-sm: 8px;
  --font-display: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}
[data-theme="light"] {
  --bg-primary: #f5f6fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f0f1f5;
  --border: #e2e4ea;
  --text-primary: #1a1d27;
  --text-secondary: #5a5f73;
  --text-muted: #8b90a0;
  --accent: #3b7cf5;
  --accent-light: #2b6ce5;
  --accent-gradient: linear-gradient(135deg, #3b7cf5 0%, #5b5bf6 100%);
  --green: #059669;
  --green-bg: rgba(5,150,105,0.12);
  --red: #dc2626;
  --red-bg: rgba(220,38,38,0.1);
  --yellow: #d97706;
  --yellow-bg: rgba(217,119,6,0.1);
  --ref-band: rgba(59,124,245,0.06);
  --ref-border: rgba(59,124,245,0.2);
  --chart-grid: rgba(0,0,0,0.08);
  --chart-tooltip-bg: rgba(255,255,255,0.95);
  --orange: #ea580c;
  --orange-bg: rgba(234,88,12,0.1);
  --purple: #7c3aed;
  --purple-light: rgba(124,58,237,0.12);
  --cyan: rgba(14, 165, 233, 0.6);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-glow: 0 0 0 1px var(--accent), 0 4px 12px rgba(59, 124, 245, 0.08);
}
.skip-link {
  position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden;
  z-index: 1000; padding: 8px 16px; background: var(--accent); color: #fff; border-radius: var(--radius-sm);
  font-size: 14px; text-decoration: none;
}
.skip-link:focus { left: 16px; top: 16px; width: auto; height: auto; overflow: visible; }
[data-theme="light"] .dob-input input[type="date"] { color-scheme: light; }
[data-theme="light"] .dob-input input[type="date"]::-webkit-calendar-picker-indicator { filter: none; }
[data-theme="light"] .chart-card,
[data-theme="light"] .context-card,
[data-theme="light"] .focus-card,
[data-theme="light"] .lens-section,
[data-theme="light"] .trend-alert-card,
[data-theme="light"] .supp-timeline,
[data-theme="light"] .alert-card { box-shadow: var(--shadow); border-color: transparent; }
[data-theme="light"] .header { box-shadow: 0 1px 4px rgba(0,0,0,0.06); border-bottom-color: transparent; }
[data-theme="light"] .sidebar { box-shadow: 1px 0 4px rgba(0,0,0,0.04); border-right-color: transparent; }
* { margin: 0; padding: 0; box-sizing: border-box; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header h1 { font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.header h1 span { color: var(--accent); }
.header-info { display: flex; gap: 24px; font-size: 13px; color: var(--text-secondary); align-items: center; flex-wrap: wrap; }
.header-info .label { color: var(--text-muted); margin-right: 4px; }
.layout { display: flex; min-height: calc(100vh - 57px); }
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  flex-shrink: 0;
  overflow-y: auto;
  position: sticky;
  top: 57px;
  height: calc(100vh - 57px);
}
.sidebar-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted); padding: 8px 20px; margin-top: 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 20px;
  cursor: pointer; font-size: 14px; color: var(--text-secondary);
  transition: all 0.15s; border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: rgba(79, 140, 255, 0.12); color: var(--accent);
  border-left-color: var(--accent); font-weight: 500;
}
.nav-item .icon { font-size: 16px; width: 24px; text-align: center; }
.nav-item .count {
  margin-left: auto; font-size: 11px; background: var(--bg-card);
  padding: 1px 7px; border-radius: 10px; color: var(--text-muted);
}
.nav-item .flag-count {
  margin-left: auto; font-family: var(--font-mono); font-size: 11px; background: var(--red-bg);
  padding: 1px 7px; border-radius: 10px; color: var(--red); font-weight: 600;
  box-shadow: 0 0 6px rgba(248, 113, 113, 0.15);
}
.main { flex: 1; padding: 24px 32px; max-width: calc(100vw - 260px); }
.category-header { margin-bottom: 24px; }
.category-header h2 {
  font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.3px;
  display: flex; align-items: center; gap: 10px;
}
.category-header p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.view-toggle {
  display: flex; gap: 4px; background: var(--bg-secondary); padding: 3px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  margin-bottom: 20px; width: fit-content;
}
.view-btn {
  padding: 6px 16px; border-radius: 6px; border: none; background: transparent;
  color: var(--text-secondary); font-size: 13px; cursor: pointer;
  font-weight: 500; transition: all 0.15s;
}
.view-btn.active { background: var(--accent-gradient); color: white; }
.view-btn:hover:not(.active) { background: var(--bg-hover); }
.alerts-section { margin-bottom: 32px; }
.alerts-title {
  font-family: var(--font-display); font-size: 16px; font-weight: 600; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.alert-card {
  background: var(--bg-card); border-radius: var(--radius-sm);
  border: 1px solid var(--border); padding: 14px 18px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 12px; cursor: pointer; transition: all 0.15s;
}
.alert-card:hover { border-color: var(--accent); }
.alert-card.alert-high { border-left: 3px solid var(--red); }
.alert-card.alert-low { border-left: 3px solid var(--yellow); }
.alert-indicator {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px; white-space: nowrap; flex-shrink: 0;
}
.alert-high .alert-indicator { background: var(--red-bg); color: var(--red); }
.alert-low .alert-indicator { background: var(--yellow-bg); color: var(--yellow); }
.alert-name { font-size: 14px; font-weight: 500; flex: 1; }
.alert-value { font-family: var(--font-mono); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.alert-ref { font-size: 12px; color: var(--text-muted); width: 120px; text-align: right; }
.charts-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(440px, 100%), 1fr)); gap: 20px;
}
.charts-grid-4col { grid-template-columns: repeat(4, 1fr); }
.chart-card {
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 20px; transition: all 0.2s; cursor: pointer;
  min-width: 0; overflow: hidden;
}
.chart-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.chart-card-header {
  display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; gap: 8px;
}
.chart-card-header > div:last-child {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0; white-space: nowrap;
}
.chart-card-title { font-size: 14px; font-weight: 600; }
.chart-card-unit { font-size: 12px; color: var(--text-muted); }
.chart-card-status {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 20px;
}
.status-normal { background: var(--green-bg); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.2); }
.status-high { background: var(--red-bg); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.2); animation: statusPulse 0.6s ease 0.3s; }
.status-low { background: var(--yellow-bg); color: var(--yellow); border: 1px solid rgba(251, 191, 36, 0.2); animation: statusPulse 0.6s ease 0.3s; }
.status-missing { background: var(--bg-hover); color: var(--text-muted); }
@keyframes statusPulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }
.chart-container { position: relative; height: 200px; min-height: 160px; overflow: hidden; }
.chart-values {
  display: flex; justify-content: space-around; margin-top: 12px;
  padding-top: 12px; border-top: 1px solid var(--border);
  overflow: hidden; flex-wrap: wrap; gap: 4px;
}
.chart-value-item { text-align: center; }
.chart-value-date { font-size: 11px; color: var(--text-muted); }
.chart-value-num { font-family: var(--font-mono); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-value-num.val-normal { color: var(--green); }
.chart-value-num.val-high { color: var(--red); }
.chart-value-num.val-high::before { content: "\25B2 "; font-size: 0.65em; }
.chart-value-num.val-low { color: var(--yellow); }
.chart-value-num.val-low::before { content: "\25BC "; font-size: 0.65em; }
.chart-value-num.val-missing { color: var(--text-muted); }
.chart-ref-range { font-size: 11px; color: var(--text-muted); margin-top: 8px; text-align: center; }
.data-table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead th {
  background: var(--bg-secondary); padding: 12px 16px; text-align: left;
  font-weight: 600; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted);
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
}
.data-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table td { padding: 12px 16px; font-variant-numeric: tabular-nums; }
.data-table .marker-name { font-weight: 500; }
.data-table .unit-col { color: var(--text-muted); font-size: 12px; }
.data-table .ref-col { color: var(--text-secondary); font-size: 13px; }
.data-table .value-cell { font-family: var(--font-mono); font-weight: 600; }
.data-table .value-cell.val-normal { color: var(--green); }
.data-table .value-cell.val-high { color: var(--red); }
.data-table .value-cell.val-high::before { content: "\25B2 "; font-size: 0.7em; }
.data-table .value-cell.val-low { color: var(--yellow); }
.data-table .value-cell.val-low::before { content: "\25BC "; font-size: 0.7em; }
.data-table .value-cell.val-missing { color: var(--text-muted); font-weight: 400; }
.trend-arrow { font-size: 12px; margin-left: 4px; display: inline-block; }
.trend-up { color: var(--red); animation: trendUp 0.4s ease 0.2s both; }
.trend-down { color: var(--green); animation: trendDown 0.4s ease 0.2s both; }
.trend-stable { color: var(--text-muted); }
@keyframes trendUp { from { transform: translateY(3px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes trendDown { from { transform: translateY(-3px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.range-bar {
  width: 120px; height: 8px; background: var(--bg-primary);
  border-radius: 4px; position: relative; overflow: visible; margin: 4px 0;
}
.range-bar-fill {
  position: absolute; height: 100%; border-radius: 4px; background: var(--ref-border);
}
.range-bar-marker {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  top: -1px; transform: translateX(-50%); border: 2px solid var(--bg-card);
}
.range-bar-marker.marker-normal { background: var(--green); box-shadow: 0 0 6px rgba(52, 211, 153, 0.5); }
.range-bar-marker.marker-high { background: var(--red); box-shadow: 0 0 6px rgba(248, 113, 113, 0.5); }
.range-bar-marker.marker-low { background: var(--yellow); box-shadow: 0 0 6px rgba(251, 191, 36, 0.5); }
.fa-bar-chart-container { height: 400px; }
@media (max-width: 480px) { .fa-bar-chart-container { height: 280px; } }
.fatty-acids-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px;
}
.fa-card {
  background: var(--bg-card); border-radius: var(--radius-sm);
  border: 1px solid var(--border); padding: 16px;
}
.fa-card-name { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.fa-card-value { font-family: var(--font-mono); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fa-card-ref { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0); z-index: 275; display: none;
  align-items: center; justify-content: center; cursor: pointer;
  transition: background 0.25s ease;
}
.modal-overlay.show { display: flex; background: rgba(0,0,0,0.7); }
.modal {
  position: relative; cursor: default;
  background: var(--bg-secondary); border-radius: var(--radius);
  border: 1px solid var(--border); width: 90%; max-width: 700px;
  max-height: 85vh; overflow-y: auto; overflow-x: hidden; padding: 32px;
  transform: scale(0.96) translateY(8px); opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.modal-overlay.show .modal { transform: scale(1) translateY(0); opacity: 1; }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; color: var(--text-muted);
  font-size: 24px; cursor: pointer; padding: 0 4px;
}
.modal-close:hover { color: var(--text-primary); }
.modal h3 { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.modal .modal-unit { color: var(--text-muted); font-size: 14px; margin-bottom: 8px; }
.marker-description {
  font-size: 13px; color: var(--text-secondary); line-height: 1.4;
  margin-bottom: 16px; display: none;
}
.marker-description.loaded { display: block; }
.marker-description.loading {
  display: block; height: 16px; width: 60%;
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%; border-radius: 4px;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.modal .modal-chart { height: 250px; margin-bottom: 24px; }
.modal-values-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px;
}
.modal-value-card {
  background: var(--bg-card); border-radius: var(--radius-sm); padding: 14px; text-align: center;
  position: relative;
}
.mv-delete {
  position: absolute; top: 4px; right: 4px; background: none; border: none;
  color: var(--text-muted); font-size: 16px; cursor: pointer; padding: 0 4px;
  line-height: 1; opacity: 0; transition: opacity 0.15s;
}
.modal-value-card:hover .mv-delete { opacity: 1; }
.mv-delete:hover { color: var(--red); }
.modal-value-card .mv-date { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.modal-value-card .mv-value {
  font-family: var(--font-mono); font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.modal-value-card .mv-status { font-size: 11px; font-weight: 600; margin-top: 4px; }
.modal-value-card .mv-phase { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.modal-ref-info {
  background: var(--bg-card); border-radius: var(--radius-sm);
  padding: 14px 18px; font-size: 13px; color: var(--text-secondary);
}
.modal-ref-info strong { color: var(--text-primary); }
@media (min-width: 1800px) {
  .chart-container { height: 240px; }
}
@media (min-width: 2400px) {
  .chart-container { height: 320px; }
  .charts-grid { gap: 24px; }
}
@media (max-width: 1024px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; position: static; height: auto;
    display: flex; flex-wrap: wrap; padding: 8px; gap: 4px;
  }
  .sidebar-title { display: none; }
  .nav-item { padding: 8px 12px; font-size: 12px; border-left: none; border-radius: var(--radius-sm); }
  .nav-item.active { border-left: none; background: var(--accent); color: white; }
  .main { max-width: 100%; padding: 20px; }
  .charts-grid { grid-template-columns: 1fr; }
  .charts-grid-4col { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .charts-grid-4col { grid-template-columns: 1fr; }
  .header { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .header-info { gap: 10px; }
  .modal-values-grid { grid-template-columns: 1fr; }
}
/* Sex Toggle */
.sex-toggle { display: flex; align-items: center; gap: 4px; }
.sex-toggle-btn {
  padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary); font-size: 14px;
  cursor: pointer; font-weight: 500; transition: all 0.15s; font-family: inherit;
  line-height: 1;
}
.sex-toggle-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.sex-toggle-btn:hover:not(.active) { background: var(--bg-hover); }
/* DOB Input */
.dob-input { display: flex; align-items: center; gap: 6px; }
.dob-input label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.dob-input input[type="date"] {
  padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary); font-size: 12px;
  font-family: inherit; cursor: pointer; transition: all 0.15s;
  color-scheme: dark;
}
.dob-input input[type="date"]:focus { border-color: var(--accent); color: var(--text-primary); }
.dob-input input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.6); cursor: pointer; }
/* Unit Toggle */
.unit-toggle { display: flex; align-items: center; gap: 4px; }
.unit-toggle-btn {
  padding: 4px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary); font-size: 12px;
  cursor: pointer; font-weight: 500; transition: all 0.15s; font-family: inherit;
}
.unit-toggle-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.unit-toggle-btn:hover:not(.active) { background: var(--bg-hover); }
/* Time Format Toggle */
.time-toggle-btn {
  padding: 4px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary); font-size: 12px;
  cursor: pointer; transition: all 0.15s;
}
.time-toggle-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.time-toggle-btn:hover:not(.active) { background: var(--bg-hover); }
/* Range Mode Toggle */
.range-toggle { display: flex; align-items: center; gap: 4px; }
.range-toggle-btn {
  padding: 4px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary); font-size: 12px;
  cursor: pointer; font-weight: 500; transition: all 0.15s; font-family: inherit;
}
.range-toggle-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.range-toggle-btn:hover:not(.active) { background: var(--bg-hover); }
/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 32px; text-align: center; cursor: pointer;
  transition: all 0.25s ease; margin-bottom: 24px; background: var(--bg-card);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent); background: rgba(79,140,255,0.05);
  transform: scale(1.01); box-shadow: 0 0 0 4px rgba(79, 140, 255, 0.06);
}
.drop-zone-icon { font-size: 28px; margin-bottom: 6px; animation: dropBounce 2s ease-in-out infinite; }
@keyframes dropBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.drop-zone:hover .drop-zone-icon { animation: dropBounce 1s ease-in-out infinite; }
.drop-zone-text { font-size: 14px; color: var(--text-secondary); }
.drop-zone-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
/* Import Progress */
.import-progress { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; margin: 0 auto; width: fit-content; }
.progress-step {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--text-muted); transition: color 0.2s;
}
.progress-step .step-icon {
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.progress-step.active { color: var(--text-primary); font-weight: 500; }
.progress-step.done { color: var(--green); }
.progress-step.done .step-icon { color: var(--green); }
.progress-spinner {
  display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: progressSpin 0.8s linear infinite;
}
@keyframes progressSpin { to { transform: rotate(360deg); } }
.import-progress-filename {
  font-size: 12px; color: var(--text-muted); margin-top: 4px;
  align-self: center;
}
/* Notification Toast */
.notification-container {
  position: fixed; top: 72px; right: 24px; z-index: 350;
  display: flex; flex-direction: column; gap: 8px;
  max-width: calc(100vw - 48px);
}
.notification-toast {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 20px;
  font-size: 13px; color: var(--text-primary); min-width: 280px;
  box-shadow: var(--shadow-lg); animation: toastIn 0.3s ease;
  display: flex; align-items: center; gap: 8px;
  position: relative; overflow: hidden;
}
.notification-toast::after {
  content: ''; position: absolute; bottom: 0; left: 0; height: 2px; width: 100%;
  animation: toastProgress 3s linear forwards;
}
.notification-toast.success { border-left: 3px solid var(--green); }
.notification-toast.success::after { background: var(--green); }
.notification-toast.error { border-left: 3px solid var(--red); }
.notification-toast.error::after { background: var(--red); }
.notification-toast.info { border-left: 3px solid var(--accent); }
.notification-toast.info::after { background: var(--accent); }
@keyframes toastIn { from { transform: translateX(100%); opacity:0; } to { transform:translateX(0); opacity:1; } }
@keyframes toastProgress { from { width: 100%; } to { width: 0%; } }
/* Import Preview */
.import-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 16px 0; }
.import-table th {
  background: var(--bg-card); padding: 8px 12px; text-align: left;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
}
.import-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.import-table .matched { color: var(--green); }
.import-table .unmatched { color: var(--yellow); }
.import-table .new-marker { color: var(--accent); font-weight: 500; }
.import-table .skipped { color: var(--text-muted); }
.import-btn {
  padding: 8px 24px; border-radius: 6px; border: none;
  font-size: 14px; font-weight: 500; cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.import-btn-primary { background: var(--accent-gradient); color: white; }
.import-btn-primary:hover { box-shadow: 0 2px 12px rgba(79, 140, 255, 0.2); }
.import-btn-secondary { background: var(--bg-card); color: var(--text-secondary); border: 1px solid var(--border); }
.import-btn-secondary:hover { background: var(--bg-hover); }
/* Correlation View */
.correlation-controls {
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 20px; margin-bottom: 20px;
}
.correlation-controls h3 { font-size: 16px; margin-bottom: 12px; }
.corr-select-row { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.corr-dropdown { position: relative; flex: 1; min-width: min(250px, 100%); }
.corr-search {
  width: 100%; padding: 8px 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-primary);
  color: var(--text-primary); font-size: 13px; font-family: inherit;
}
.corr-search:focus { border-color: var(--accent); }
.corr-options {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 0 0 6px 6px; max-height: 250px; overflow-y: auto; display: none;
}
.corr-options.show { display: block; }
.corr-option {
  padding: 8px 12px; cursor: pointer; font-size: 13px;
  color: var(--text-secondary); transition: background 0.1s;
}
.corr-option:hover { background: var(--bg-hover); color: var(--text-primary); }
.corr-option.selected { color: var(--accent); }
.corr-option .opt-cat { font-size: 11px; color: var(--text-muted); margin-left: 6px; }
.corr-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.corr-chip {
  display: flex; align-items: center; gap: 4px; padding: 4px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 500; border: 1px solid;
}
.corr-chip .chip-remove { cursor: pointer; font-size: 14px; margin-left: 2px; opacity: 0.7; }
.corr-chip .chip-remove:hover { opacity: 1; }
.corr-presets { margin-top: 12px; }
.corr-presets-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.corr-preset-btn {
  display: inline-block; padding: 4px 10px; border-radius: 4px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); font-size: 12px; cursor: pointer;
  font-family: inherit; margin: 2px; transition: all 0.15s;
}
.corr-preset-btn:hover { border-color: var(--accent); color: var(--accent); }
.corr-chart-container {
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 20px;
}
.corr-chart-container h3 { font-size: 16px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
.corr-ask-ai-btn {
  padding: 5px 14px; border-radius: 6px; border: 1px solid var(--accent);
  background: transparent; color: var(--accent); font-size: 12px;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.corr-ask-ai-btn:hover { background: var(--accent); color: #fff; }
.corr-chart { height: 400px; }
.imported-entries { margin-bottom: 20px; }
.imported-entry {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 6px; font-size: 13px;
}
.imported-entry .ie-info { color: var(--text-secondary); }
.imported-entry .ie-date { color: var(--text-primary); font-weight: 500; }
.imported-entry .ie-count { color: var(--text-muted); margin-left: 8px; }
.imported-entry .ie-actions { display: flex; align-items: center; gap: 4px; }
.imported-entry .ie-remove {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 12px; padding: 4px 10px; border-radius: 4px; transition: all 0.15s; font-family: inherit;
}
.imported-entry .ie-remove:hover { color: var(--red); background: var(--red-bg); }
/* Standalone note row */
.note-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--bg-card); border: 1px solid var(--border);
  border-left: 3px solid var(--yellow); border-radius: var(--radius-sm);
  margin-bottom: 6px; font-size: 13px; cursor: pointer; transition: all 0.15s;
}
.note-row:hover { border-color: var(--accent); border-left-color: var(--yellow); background: var(--bg-hover); }
.note-row-icon { font-size: 14px; flex-shrink: 0; }
.note-row-date { color: var(--text-primary); font-weight: 500; white-space: nowrap; }
.note-row-text { color: var(--text-muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: italic; }
.note-row-actions { flex-shrink: 0; }
.note-row-actions .ie-remove {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 12px; padding: 4px 10px; border-radius: 4px; transition: all 0.15s; font-family: inherit;
}
.note-row-actions .ie-remove:hover { color: var(--red); background: var(--red-bg); }
/* Add Note button */
.add-note-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; border-radius: 6px; border: 1px dashed var(--border);
  background: transparent; color: var(--text-secondary); font-size: 13px;
  cursor: pointer; font-family: inherit; transition: all 0.15s; margin-bottom: 10px;
}
.add-note-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(79,140,255,0.05); }
/* Note Editor */
.note-editor {
  width: 100%; min-height: 120px; padding: 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-primary);
  color: var(--text-primary); font-size: 13px; font-family: inherit;
  resize: vertical; line-height: 1.5; margin: 16px 0;
}
.note-editor:focus { border-color: var(--accent); }
.note-editor-actions { display: flex; gap: 8px; align-items: center; }
/* Note icon in detail modal */
.mv-note {
  display: inline; font-size: 12px; margin-left: 4px;
  cursor: pointer;
}
.mv-note:hover { opacity: 0.7; }
.mv-note-text {
  display: none; font-size: 11px; color: var(--yellow);
  margin-top: 6px; padding: 6px 8px; line-height: 1.4;
  background: rgba(251, 191, 36, 0.08); border-radius: 4px;
  text-align: left; word-break: break-word;
}
.mv-note-text.show { display: block; }
/* Dashboard Section Titles */
.context-section-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin-bottom: 10px;
}
.profile-context-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px;
}
@media (max-width: 1200px) {
  .profile-context-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .profile-context-cards { grid-template-columns: 1fr; }
}
/* Context Cards (fixed height, uniform grid) */
.context-card {
  background: var(--bg-card); border-radius: var(--radius-sm);
  border: 1px solid var(--border); padding: 12px 16px;
  cursor: pointer; transition: all 0.15s;
  min-height: 90px; display: flex; flex-direction: column; overflow: hidden; min-width: 0;
}
.context-card:hover { border-color: var(--accent); }
.context-card-header {
  display: flex; align-items: center; gap: 6px; margin-bottom: 4px; flex-shrink: 0;
}
.context-card-label { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.diagnoses-edit-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  font-size: 12px; padding: 2px 10px; border-radius: 4px; cursor: pointer;
  font-family: inherit; transition: all 0.15s; margin-left: auto; flex-shrink: 0;
}
.diagnoses-edit-btn:hover { color: var(--accent); border-color: var(--accent); }
.context-card-body {
  font-size: 12px; color: var(--text-secondary); line-height: 1.4;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; flex: 1; min-height: 0;
}
.context-card-placeholder {
  font-size: 12px; color: var(--text-muted); font-style: italic;
}
/* Empty context cards are visually hollow */
.context-card:has(.context-card-placeholder) {
  border-style: dashed; opacity: 0.75;
}
.context-card:has(.context-card-placeholder):hover { opacity: 1; }
/* Health status dots */
.ctx-health-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  display: inline-block; transition: background 0.3s, box-shadow 0.3s;
}
.ctx-health-dot-gray { background: var(--text-muted); opacity: 0.4; }
.ctx-health-dot-green { background: var(--green); box-shadow: 0 0 6px rgba(52, 211, 153, 0.5); }
.ctx-health-dot-yellow { background: var(--yellow); box-shadow: 0 0 6px rgba(251, 191, 36, 0.5); }
.ctx-health-dot-red { background: var(--red); box-shadow: 0 0 6px rgba(248, 113, 113, 0.5); }
.ctx-health-dot-shimmer {
  background: linear-gradient(90deg, var(--text-muted) 25%, var(--border) 50%, var(--text-muted) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
}
/* AI card summary */
.ctx-ai-summary {
  font-size: 11px; line-height: 1.3; color: var(--text-muted); font-style: italic;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  max-height: 0; opacity: 0; transition: max-height 0.2s, opacity 0.2s;
  border-top: 1px solid transparent; padding-top: 0; margin-top: 0;
}
.ctx-ai-summary-visible {
  max-height: 20px; opacity: 1;
  border-top: 1px solid var(--border); padding-top: 4px; margin-top: 4px;
}
.ctx-ai-summary-green { color: var(--green); }
.ctx-ai-summary-yellow { color: var(--yellow); }
.ctx-ai-summary-red { color: var(--red); }
/* Context editor field groups */
.ctx-field-group { margin-bottom: 16px; }
.ctx-field-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin-bottom: 8px; display: block;
}
/* Button-group selector (replaces native <select>) */
.ctx-btn-group { display: flex; flex-wrap: wrap; gap: 6px; }
.ctx-btn-option {
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary); font-size: 12px;
  cursor: pointer; font-family: inherit; transition: all 0.15s; white-space: nowrap;
}
.ctx-btn-option:hover { border-color: var(--accent); color: var(--accent); }
.ctx-btn-option.active {
  background: var(--accent-gradient); border-color: transparent; color: white; font-weight: 600;
}
/* Toggle tag buttons for multi-select */
.ctx-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ctx-tag {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary);
  font-size: 12px; padding: 6px 14px; border-radius: 20px; cursor: pointer;
  font-family: inherit; transition: all 0.15s; white-space: nowrap;
}
.ctx-tag:hover { border-color: var(--accent); color: var(--accent); }
.ctx-tag.active {
  background: rgba(79, 140, 255, 0.15); border-color: var(--accent); color: var(--accent); font-weight: 600;
}
/* Autocomplete suggestions */
.ctx-autocomplete-wrapper { position: relative; flex: 1; }
.ctx-suggestions {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm);
  max-height: 200px; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.ctx-suggestion-item {
  padding: 8px 14px; font-size: 13px; color: var(--text-secondary); cursor: pointer;
  transition: all 0.1s;
}
.ctx-suggestion-item:hover { background: var(--bg-hover); color: var(--text-primary); }
/* Condition list in editor */
.ctx-conditions-list { margin-bottom: 16px; }
.ctx-condition-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 6px; font-size: 13px; transition: border-color 0.15s;
}
.ctx-condition-item:hover { border-color: var(--text-muted); }
.ctx-condition-name { color: var(--text-primary); flex: 1; min-width: 0; font-weight: 500; }
.ctx-condition-since { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.ctx-add-condition {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px;
}
.ctx-add-condition .supp-form-field { flex: 1; min-width: 120px; }
/* Context editor note input */
.ctx-note-input {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-primary);
  color: var(--text-primary); font-size: 13px; font-family: inherit;
  transition: border-color 0.15s;
}
.ctx-note-input:focus { border-color: var(--accent); outline: none; }
.ctx-note-input::placeholder { color: var(--text-muted); }
/* Location inputs */
.loc-inputs { display: flex; gap: 8px; }
.loc-inputs .ctx-note-input { flex: 1; }
.loc-zip-input { flex: 0 0 150px !important; }
@media (max-width: 480px) {
  .loc-inputs { flex-direction: column; }
  .loc-zip-input { flex: 1 !important; }
}
/* Meal row: time + description side by side */
.ctx-meal-row { display: flex; gap: 8px; align-items: center; }
.ctx-meal-time {
  width: 90px; flex-shrink: 0; padding: 10px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-primary);
  color: var(--text-primary); font-size: 13px; font-family: var(--font-mono);
  transition: border-color 0.15s; box-sizing: border-box; text-align: center;
}
.ctx-meal-time::placeholder { color: var(--text-muted); font-family: inherit; font-size: 11px; }
.ctx-meal-time:focus { border-color: var(--accent); outline: none; }
.ctx-meal-input { flex: 1; min-width: 0; }
@media (max-width: 480px) {
  .ctx-meal-row { flex-direction: column; gap: 4px; }
  .ctx-meal-time { width: 100%; }
  .ctx-meal-input { width: 100%; }
}
/* Context editor action bar */
.ctx-editor-actions {
  display: flex; gap: 8px; align-items: center; margin-top: 20px;
  padding-top: 16px; border-top: 1px solid var(--border);
}
/* Context editor modal section divider */
.ctx-editor-divider {
  height: 1px; background: var(--border); margin: 16px 0;
}
/* Additional Notes textarea */
.ctx-notes-section { margin-top: 8px; margin-bottom: 16px; }
.ctx-notes-textarea {
  width: 100%; min-height: 48px; max-height: 120px; resize: vertical;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 12px; padding: 10px 14px;
  font-family: inherit; line-height: 1.5; transition: border-color 0.15s;
  box-sizing: border-box;
}
.ctx-notes-textarea:focus { border-color: var(--accent); outline: none; }
.ctx-notes-textarea::placeholder { color: var(--text-muted); }
.context-info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; font-size: 10px; font-weight: 700;
  color: var(--text-muted); border: 1px solid var(--border); cursor: help;
  flex-shrink: 0; position: relative; font-style: normal; line-height: 1;
}
.context-info-icon:hover { color: var(--accent); border-color: var(--accent); }
.context-info-icon .context-tooltip {
  display: none; position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%); background: var(--bg-card); color: var(--text-secondary);
  font-size: 12px; font-weight: 400; line-height: 1.5; padding: 10px 12px;
  border-radius: 6px; border: 1px solid var(--border); width: max-content;
  max-width: 260px; z-index: 100; pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.context-info-icon:hover .context-tooltip { display: block; }
/* Health Goals List */
.goals-list { margin-bottom: 16px; }
.goals-list-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 6px; font-size: 13px;
}
.goals-severity-badge {
  font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 4px;
  white-space: nowrap; flex-shrink: 0; text-transform: uppercase; letter-spacing: 0.3px;
}
.severity-major { background: var(--red-bg); color: var(--red); }
.severity-mild { background: var(--yellow-bg); color: var(--yellow); }
.severity-minor { background: var(--green-bg); color: var(--green); }
.goals-list-item .goals-text { flex: 1; color: var(--text-primary); min-width: 0; }
.goals-delete-btn {
  background: none; border: none; color: var(--text-muted); font-size: 16px;
  cursor: pointer; padding: 0 4px; line-height: 1; flex-shrink: 0; transition: color 0.15s;
}
.goals-delete-btn:hover { color: var(--red); }
.goals-add-row {
  display: flex; gap: 8px; align-items: flex-end; margin-top: 16px;
}
.goals-text-input {
  flex: 1; padding: 8px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-primary);
  color: var(--text-primary); font-size: 13px; font-family: inherit;
}
.goals-text-input:focus { border-color: var(--accent); }
@media (max-width: 600px) {
  .goals-add-row { flex-wrap: wrap; }
  .goals-text-input { min-width: 100%; }
}
/* Supplements & Medications Timeline */
.supp-timeline-section { margin-bottom: 16px; }
.supp-timeline-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.supp-timeline-header .context-section-title { margin-bottom: 0; }
.supp-add-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 6px; border: 1px dashed var(--border);
  background: transparent; color: var(--text-secondary); font-size: 12px;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.supp-add-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(79,140,255,0.05); }
.supp-timeline {
  background: var(--bg-card); border-radius: var(--radius-sm);
  border: 1px solid var(--border); padding: 14px 18px;
}
.supp-timeline-axis {
  display: flex; justify-content: space-between; font-size: 11px;
  color: var(--text-muted); margin-bottom: 10px; padding: 0 2px;
}
.supp-bar-row {
  display: flex; align-items: center; gap: 10px; padding: 5px 0;
  cursor: pointer; transition: background 0.1s; border-radius: 4px;
}
.supp-bar-row:hover { background: var(--bg-hover); }
.supp-bar-label {
  width: 140px; flex-shrink: 0; font-size: 13px; font-weight: 500;
  color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.supp-bar-dosage {
  font-size: 11px; color: var(--text-muted); font-weight: 400; margin-left: 2px;
}
.supp-bar-track {
  flex: 1; height: 14px; background: var(--bg-primary);
  border-radius: 7px; position: relative; overflow: hidden;
}
.supp-bar {
  position: absolute; height: 100%; border-radius: 7px; min-width: 4px;
}
.supp-bar-supplement { background: var(--cyan); }
.supp-bar-medication { background: var(--purple-light); }
.supp-bar-ongoing {
  -webkit-mask-image: linear-gradient(to right, black 70%, transparent 100%);
  mask-image: linear-gradient(to right, black 70%, transparent 100%);
}
.supp-empty {
  font-size: 12px; color: var(--text-muted); font-style: italic; text-align: center;
  padding: 8px 0;
}
/* Supplement Editor */
.supp-list { margin-bottom: 16px; }
.supp-list-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 6px; font-size: 13px;
}
.supp-list-icon { font-size: 14px; flex-shrink: 0; }
.supp-list-info { flex: 1; min-width: 0; }
.supp-list-name { font-weight: 500; color: var(--text-primary); }
.supp-list-meta { font-size: 11px; color: var(--text-muted); }
.supp-list-actions { display: flex; gap: 4px; flex-shrink: 0; }
.supp-list-actions button {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  font-size: 11px; padding: 2px 8px; border-radius: 4px; cursor: pointer;
  font-family: inherit; transition: all 0.15s;
}
.supp-list-actions button:hover { color: var(--accent); border-color: var(--accent); }
.supp-list-actions button.delete:hover { color: var(--red); border-color: var(--red); }
.supp-form { border-top: 1px solid var(--border); padding-top: 16px; }
.supp-form-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.supp-form-row { display: flex; gap: 12px; margin-bottom: 10px; }
.supp-form-field { flex: 1; min-width: 0; }
.supp-form-field label {
  display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500;
}
.supp-form-field input,
.supp-form-field select {
  width: 100%; padding: 8px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-primary);
  color: var(--text-primary); font-size: 13px; font-family: inherit;
}
.supp-form-field input:focus,
.supp-form-field select:focus { border-color: var(--accent); }
.supp-form-field select { cursor: pointer; }
.supp-form-field select option { background: var(--bg-secondary); }
@media (max-width: 768px) {
  .supp-bar-label { width: 100px; font-size: 12px; }
  .supp-form-row { flex-direction: column; gap: 8px; }
}
/* Empty State */
.empty-state {
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 48px 32px;
  text-align: center; margin-bottom: 24px;
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); font-size: 14px; margin-bottom: 16px; }
.empty-state ul {
  list-style: none; padding: 0; color: var(--text-secondary); font-size: 13px;
}
.empty-state ul li { padding: 4px 0; }
.empty-state ul li::before { content: "\2022"; color: var(--accent); margin-right: 8px; }
/* Profile Dropdown */
.profile-dropdown { position: relative; }
.profile-dropdown-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text-primary); font-size: 13px;
  cursor: pointer; font-weight: 500; transition: all 0.15s; font-family: inherit;
}
.profile-dropdown-btn:hover { background: var(--bg-hover); border-color: var(--accent); }
.profile-dropdown-btn .profile-arrow { font-size: 10px; color: var(--text-muted); transition: transform 0.15s; }
.profile-dropdown-btn.open .profile-arrow { transform: rotate(180deg); }
.profile-menu {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 220px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); z-index: 150;
  display: none; overflow: hidden;
}
.profile-menu.show { display: block; }
.profile-menu-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  cursor: pointer; font-size: 13px; color: var(--text-secondary); transition: background 0.1s;
}
.profile-menu-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.profile-menu-item.active {
  color: var(--accent); border-left: 3px solid var(--accent); padding-left: 11px;
}
.profile-menu-item .profile-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu-actions {
  display: none; gap: 2px; margin-left: auto;
}
.profile-menu-item:hover .profile-menu-actions { display: flex; }
.profile-menu-action {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 11px; padding: 2px 5px; border-radius: 3px; font-family: inherit; transition: all 0.1s;
}
.profile-menu-action:hover { color: var(--text-primary); background: var(--bg-card); }
.profile-menu-action.delete:hover { color: var(--red); }
.profile-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }
.profile-menu-new {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px;
  cursor: pointer; font-size: 13px; color: var(--accent); transition: background 0.1s;
}
.profile-menu-new:hover { background: var(--bg-hover); }
@media (max-width: 1024px) {
  .profile-dropdown-btn .profile-label { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
/* Settings Button */
.settings-btn {
  background: none; border: 1px solid var(--border); color: var(--text-secondary);
  font-size: 16px; cursor: pointer; padding: 4px 10px; border-radius: 6px;
  transition: all 0.15s; font-family: inherit; line-height: 1;
}
.settings-btn:hover { background: var(--bg-hover); border-color: var(--accent); color: var(--text-primary); }
/* API Key Settings */
.api-key-input {
  width: 100%; padding: 10px 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-primary);
  color: var(--text-primary); font-size: 13px; font-family: monospace;
  margin-top: 8px;
}
.api-key-input:focus { border-color: var(--accent); }
.api-key-status { font-size: 13px; margin-bottom: 4px; }
.api-key-notice {
  font-size: 11px; color: var(--text-muted); margin-top: 12px;
  padding: 10px; background: var(--bg-card); border-radius: var(--radius-sm);
  border: 1px solid var(--border); line-height: 1.5;
}
/* Settings Sections */
.settings-section { margin-top: 16px; }
.settings-label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 8px; color: var(--text-secondary); }
.settings-group-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); margin-top: 24px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
/* Settings Tabs */
.settings-tabs-bar {
  display: flex; gap: 2px; margin: 16px 0 0;
  border-bottom: 1px solid var(--border);
  position: sticky; top: -32px; z-index: 2;
  background: var(--bg-secondary); padding-top: 4px;
}
.settings-tab-btn {
  position: relative; padding: 10px 18px; border: none; background: none;
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  font-family: var(--font-display); cursor: pointer;
  transition: color 0.2s; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.settings-tab-btn::after {
  content: ''; position: absolute; bottom: -1px; left: 8px; right: 8px;
  height: 2px; border-radius: 2px 2px 0 0; background: transparent;
  transition: background 0.2s, box-shadow 0.2s;
}
.settings-tab-btn:hover { color: var(--text-secondary); }
.settings-tab-btn.active { color: var(--accent); font-weight: 600; }
.settings-tab-btn.active::after {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(79, 140, 255, 0.3);
}
.settings-tab-btn svg { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.6; }
.settings-tab-btn.active svg { opacity: 1; }
.settings-tab-panel { display: none; padding-top: 6px; }
.settings-tab-panel.active {
  display: block;
  animation: settingsTabFadeIn 0.2s ease;
}
@keyframes settingsTabFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.settings-tab-panel .settings-section:first-child { margin-top: 8px; }
.settings-tab-panel .settings-group-title:first-child { margin-top: 12px; }
@media (max-width: 500px) {
  .settings-tab-btn { padding: 8px 10px; font-size: 12px; gap: 4px; }
  .settings-tab-btn svg { width: 12px; height: 12px; }
}
/* AI Provider Toggle */
.ai-provider-toggle { display: flex; align-items: center; gap: 4px; }
.ai-provider-btn {
  padding: 6px 16px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary); font-size: 13px;
  cursor: pointer; font-weight: 500; transition: all 0.15s; font-family: inherit;
  display: inline-flex; align-items: center; gap: 5px;
}
.ai-provider-logo { width: 14px; height: 14px; flex-shrink: 0; }
.ai-provider-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.ai-provider-btn:hover:not(.active) { background: var(--bg-hover); }
.ai-provider-panel { margin-top: 12px; }
.ai-provider-desc {
  font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-bottom: 10px;
}
.settings-theme-toggle { display: flex; align-items: center; gap: 4px; }
.settings-theme-btn {
  padding: 4px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary); font-size: 12px;
  cursor: pointer; font-weight: 500; transition: all 0.15s; font-family: inherit;
}
.settings-theme-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.settings-theme-btn:hover:not(.active) { background: var(--bg-hover); }
/* Chat Toggle Button */
.chat-toggle-btn {
  padding: 5px 16px; border-radius: 20px; border: none;
  background: var(--accent-gradient); color: white; font-size: 12px;
  cursor: pointer; font-weight: 600; transition: all 0.2s; font-family: inherit;
}
.chat-toggle-btn:hover { transform: translateY(-1px); box-shadow: 0 2px 12px rgba(79, 140, 255, 0.3); }
/* Chat Panel */
.chat-backdrop {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); z-index: 250; display: none;
}
.chat-backdrop.open { display: block; }
.chat-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 560px;
  background: var(--bg-secondary); border-left: 1px solid var(--border);
  z-index: 260; display: flex; flex-direction: row;
  transform: translateX(100%); transition: transform 0.3s ease;
  box-shadow: -4px 0 24px rgba(0,0,0,0.4); will-change: transform;
}
.chat-panel.open { transform: translateX(0); }
.chat-panel-conversation {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
}
/* Thread Rail */
.chat-thread-rail {
  width: 0; overflow: hidden; display: flex; flex-direction: column;
  border-right: 1px solid var(--border); background: var(--bg-primary);
  transition: width 0.25s ease; flex-shrink: 0;
}
.chat-thread-rail.open { width: 220px; }
.chat-thread-rail-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 10px; flex-shrink: 0;
}
.chat-thread-rail-title {
  font-family: var(--font-display); font-size: 13px; font-weight: 600;
  color: var(--text-primary); white-space: nowrap;
}
.chat-rail-back {
  display: none; background: none; border: none; color: var(--text-muted);
  font-size: 18px; cursor: pointer; padding: 0; line-height: 1; flex-shrink: 0;
  transition: color 0.15s;
}
.chat-rail-back:hover { color: var(--text-primary); }
@media (max-width: 768px) {
  .chat-rail-back { display: block; }
}
.chat-thread-new-btn {
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border);
  background: none; color: var(--text-muted); font-size: 16px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.chat-thread-new-btn:hover { background: var(--bg-hover); color: var(--accent); border-color: var(--accent); }
.chat-thread-search {
  margin: 0 10px 8px; padding: 6px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-secondary);
  color: var(--text-primary); font-size: 12px; font-family: inherit;
  flex-shrink: 0;
}
.chat-thread-search:focus { border-color: var(--accent); outline: none; }
.chat-thread-search::placeholder { color: var(--text-muted); }
.chat-thread-list {
  flex: 1; overflow-y: auto; padding: 0 6px 10px;
}
.chat-thread-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  transition: background 0.15s; position: relative; margin-bottom: 2px;
  border-left: 3px solid transparent;
}
.chat-thread-item:hover { background: var(--bg-hover); }
.chat-thread-item.active { background: rgba(99,102,241,0.10); border-left-color: var(--accent); }
.chat-thread-item-name {
  font-size: 12px; font-weight: 500; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.3;
}
.chat-thread-item-meta {
  font-size: 10px; color: var(--text-muted); display: flex; gap: 6px; align-items: center;
}
.chat-thread-item-actions {
  position: absolute; top: 6px; right: 6px; display: none; gap: 2px;
}
.chat-thread-item:hover .chat-thread-item-actions { display: flex; }
.chat-thread-item-action {
  width: 20px; height: 20px; border: none; background: var(--bg-card);
  border-radius: 4px; font-size: 11px; cursor: pointer; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.chat-thread-item-action:hover { color: var(--text-primary); background: var(--bg-hover); }
.chat-thread-item-action.delete:hover { color: var(--red); }
.chat-rail-toggle {
  background: none; border: none; color: var(--text-muted); font-size: 18px;
  cursor: pointer; padding: 0 4px; line-height: 1; transition: color 0.15s;
  flex-shrink: 0;
}
.chat-rail-toggle:hover { color: var(--text-primary); }
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-header-left { display: flex; align-items: center; gap: 10px; }
.chat-header-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-header-actions { display: flex; gap: 8px; align-items: center; }
.chat-clear-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  font-size: 11px; padding: 3px 10px; border-radius: 4px; cursor: pointer;
  font-family: inherit; transition: all 0.15s;
}
.chat-clear-btn:hover { color: var(--red); border-color: var(--red); }
.chat-close-btn {
  background: none; border: none; color: var(--text-muted); font-size: 22px;
  cursor: pointer; padding: 0 4px; line-height: 1;
}
.chat-close-btn:hover { color: var(--text-primary); }

/* Sources mini toggle */
.chat-sources-toggle-label {
  display: flex; gap: 6px; align-items: center; cursor: pointer;
  font-size: 11px; color: var(--text-muted); user-select: none;
}
#chat-sources-checkbox { display: none; }
.chat-sources-slider {
  position: relative; width: 28px; height: 16px; border-radius: 8px;
  background: var(--border); transition: background 0.2s;
}
.chat-sources-slider::before {
  content: ''; position: absolute; left: 2px; top: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; transition: transform 0.2s;
}
#chat-sources-checkbox:checked + .chat-sources-slider {
  background: var(--accent);
}
#chat-sources-checkbox:checked + .chat-sources-slider::before {
  transform: translateX(12px);
}

/* Personality selector bar */
.chat-personality-bar {
  flex-shrink: 0; border-bottom: 1px solid var(--border);
}
.chat-personality-current {
  display: flex; align-items: center; gap: 8px; padding: 8px 20px;
  cursor: pointer; transition: background 0.15s; user-select: none;
}
.chat-personality-current:hover { background: var(--bg-hover); }
.chat-personality-current-icon { font-size: 14px; }
.chat-personality-current-name { font-size: 12px; color: var(--text-muted); flex: 1; }
.chat-personality-current-arrow {
  font-size: 10px; color: var(--text-muted); transition: transform 0.2s;
}
.chat-personality-bar.open .chat-personality-current-arrow { transform: rotate(180deg); }
.chat-personality-options {
  display: none; padding: 4px 12px 12px;
}
.chat-personality-bar.open .chat-personality-options { display: block; }
.chat-personality-opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: none; background: none; cursor: pointer;
  border-radius: 6px; transition: background 0.15s; text-align: left;
  font-family: inherit;
}
.chat-personality-opt:hover { background: var(--bg-hover); }
.chat-personality-opt.active { background: rgba(99,102,241,0.12); }
.chat-personality-opt-icon { font-size: 18px; flex-shrink: 0; width: 24px; text-align: center; }
.chat-personality-opt-info { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.chat-personality-opt-name { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.chat-personality-opt-desc { font-size: 11px; color: var(--text-muted); }
.chat-personality-opt-check {
  font-size: 13px; color: var(--accent); opacity: 0; flex-shrink: 0;
}
.chat-personality-opt.active .chat-personality-opt-check { opacity: 1; }
.chat-personality-divider {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted); padding: 8px 12px 4px; font-weight: 600;
  border-top: 1px solid var(--border); margin-top: 4px;
}
.chat-personality-custom-area {
  padding: 8px 10px 0;
}
.chat-personality-custom-textarea {
  width: 100%; background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-primary); font-family: inherit;
  font-size: 13px; line-height: 1.6; padding: 10px 12px; resize: none;
  box-sizing: border-box; min-height: 80px; max-height: 300px; overflow-y: auto;
}
.chat-personality-custom-textarea:focus { border-color: var(--accent); outline: none; }
.chat-personality-custom-textarea::placeholder { color: var(--text-muted); }
.chat-personality-custom-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; gap: 8px;
}
.chat-personality-evidence-label {
  display: flex; align-items: center; gap: 5px; font-size: 11px;
  color: var(--text-muted); cursor: pointer; user-select: none;
}
.chat-personality-evidence-label input[type="checkbox"] {
  accent-color: var(--accent); margin: 0; cursor: pointer;
}
.chat-personality-custom-save {
  padding: 4px 14px; font-size: 11px; font-family: inherit;
  background: var(--accent-gradient); color: white; border: none; border-radius: 4px;
  cursor: pointer; transition: all 0.15s; flex-shrink: 0;
}
.chat-personality-custom-save:hover { box-shadow: 0 2px 8px rgba(79, 140, 255, 0.2); }
.chat-personality-custom-save:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
.chat-personality-custom-header {
  display: flex; gap: 6px; margin-bottom: 6px;
}
.chat-personality-custom-name-input {
  flex: 1; background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-primary); font-family: inherit;
  font-size: 12px; padding: 6px 10px; box-sizing: border-box; min-width: 0;
}
.chat-personality-custom-name-input:focus { border-color: var(--accent); outline: none; }
.chat-personality-custom-name-input::placeholder { color: var(--text-muted); }
.chat-personality-generate-btn {
  padding: 6px 12px; font-size: 11px; font-family: inherit;
  background: transparent; color: var(--accent); border: 1px solid var(--accent);
  border-radius: 4px; cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.chat-personality-generate-btn:hover { background: var(--accent); color: white; }
.chat-personality-generate-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-personality-opt-wrapper {
  position: relative;
}
.chat-personality-opt-wrapper:hover .chat-personality-delete { opacity: 1; }
.chat-personality-delete {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 20px; height: 20px; border: none; background: none; cursor: pointer;
  color: var(--text-muted); font-size: 14px; line-height: 1; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s, color 0.15s, background 0.15s;
  z-index: 1;
}
.chat-personality-delete:hover { color: var(--danger, #ef4444); background: rgba(239,68,68,0.1); }
.chat-personality-add-btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  padding: 8px 10px; border: 1px dashed var(--border); background: none;
  border-radius: 6px; cursor: pointer; font-family: inherit; font-size: 12px;
  color: var(--text-muted); transition: all 0.15s; margin-top: 4px;
}
.chat-personality-add-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(99,102,241,0.06); }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.chat-msg {
  max-width: 88%; padding: 12px 16px; border-radius: 12px;
  font-size: 14px; line-height: 1.7; word-wrap: break-word;
  white-space: normal;
}
.chat-msg code { background: var(--bg-hover); padding: 1px 5px; border-radius: 3px; font-size: 12px; }
.chat-msg strong { font-weight: 600; }
.chat-msg.chat-user {
  align-self: flex-end; background: var(--accent-gradient); color: white;
  border-bottom-right-radius: 4px;
}
.chat-msg.chat-ai {
  align-self: flex-start; background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border); border-bottom-left-radius: 4px;
  border-left: 2px solid rgba(79, 140, 255, 0.3);
}
.chat-persona-label {
  align-self: flex-start; font-size: 11px; color: var(--text-muted);
  font-weight: 500; padding: 2px 0; margin-top: 4px;
}
.chat-msg-meta { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
/* Markdown elements in chat messages */
.chat-para { margin: 0 0 10px 0; }
.chat-para:last-child { margin-bottom: 0; }
.chat-h1 { font-size: 1.3em; font-weight: 700; margin: 16px 0 8px; }
.chat-h2 { font-size: 1.15em; font-weight: 600; margin: 14px 0 6px; }
.chat-h3 { font-size: 1.05em; font-weight: 600; margin: 12px 0 4px; color: var(--text-secondary); }
.chat-h1:first-child, .chat-h2:first-child, .chat-h3:first-child { margin-top: 0; }
.chat-list { margin: 0 0 10px 0; padding-left: 20px; }
.chat-list li { margin-bottom: 4px; }
.chat-list li::marker { color: var(--accent); }
.chat-code-block {
  background: var(--bg-primary); border: 1px solid var(--border); border-radius: 6px;
  padding: 12px 14px; margin: 8px 0; overflow-x: auto;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12px; line-height: 1.5; white-space: pre;
}
.chat-hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.chat-msg a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.chat-msg a:hover { text-decoration-thickness: 2px; }
.chat-msg em { font-style: italic; }
.chat-user .chat-para { margin-bottom: 4px; }
.chat-user .chat-list { margin-bottom: 4px; }
.typing-indicator {
  display: inline-flex; gap: 4px; padding: 10px 14px;
  background: var(--bg-card); border-radius: 12px; border: 1px solid var(--border);
  align-self: flex-start;
}
.typing-indicator span {
  width: 6px; height: 6px; background: var(--text-muted); border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}
.chat-input-area {
  display: flex; gap: 10px; padding: 14px 20px;
  border-top: 1px solid var(--border); flex-shrink: 0;
  align-items: flex-end;
}
.chat-input {
  flex: 1; padding: 10px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-primary);
  color: var(--text-primary); font-size: 14px; font-family: inherit;
  resize: none; max-height: 120px; line-height: 1.5;
}
.chat-input:focus { border-color: var(--accent); }
.chat-send-btn {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--accent-gradient); color: white; font-size: 18px;
  cursor: pointer; font-family: inherit;
  transition: all 0.2s; white-space: nowrap;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-send-btn:hover { transform: scale(1.08); box-shadow: 0 2px 12px rgba(79, 140, 255, 0.3); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.chat-send-btn.streaming {
  background: var(--red, #ef4444); font-size: 14px;
}
.chat-send-btn.streaming:hover { box-shadow: 0 2px 12px rgba(239, 68, 68, 0.3); }
.chat-discuss-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-primary); font-size: 16px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.2s;
}
.chat-discuss-btn:hover { border-color: var(--accent); background: var(--bg-hover); transform: scale(1.08); }
.chat-msg-auto {
  font-size: 12px !important; color: var(--text-muted) !important;
  font-style: italic; padding: 6px 12px !important;
  background: transparent !important; border: none !important;
  border-left: none !important; max-width: 100% !important;
  align-self: center !important;
}
.chat-stopped-note {
  font-size: 11px; color: var(--text-muted); font-style: italic; margin-top: 6px;
}
.chat-discuss-continue {
  align-self: stretch; display: flex; flex-direction: column; gap: 8px; padding: 8px 16px;
}
.chat-discuss-steer {
  width: 100%; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-primary); color: var(--text-primary); font-size: 12px;
  font-family: inherit; outline: none;
}
.chat-discuss-steer:focus { border-color: var(--accent); }
.chat-discuss-steer::placeholder { color: var(--text-muted); font-style: italic; }
.chat-discuss-continue-actions {
  display: flex; gap: 8px; justify-content: center;
}
.chat-discuss-continue-btn {
  padding: 6px 14px; border-radius: 16px; border: 1px solid var(--accent);
  background: transparent; color: var(--accent); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
}
.chat-discuss-continue-btn:hover { background: var(--accent); color: white; }
.chat-discuss-done-btn {
  padding: 6px 14px; border-radius: 16px; border: 1px solid var(--border);
  background: transparent; color: var(--text-muted); font-size: 12px;
  cursor: pointer; transition: all 0.2s;
}
.chat-discuss-done-btn:hover { border-color: var(--text-muted); color: var(--text-primary); }
/* Ask AI Button in Marker Detail Modal */
.ask-ai-btn {
  width: 100%; padding: 10px; border-radius: 6px;
  border: 1px solid var(--accent); background: transparent;
  color: var(--accent); font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: inherit; transition: all 0.2s;
  margin-top: 16px;
}
.ask-ai-btn:hover { background: var(--accent-gradient); color: white; border-color: transparent; box-shadow: 0 2px 12px rgba(79, 140, 255, 0.2); }
.chat-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; color: var(--text-muted); font-size: 13px; text-align: center;
  padding: 20px;
}
.chat-empty-icon { font-size: 32px; margin-bottom: 8px; }
@media (max-width: 768px) {
  .chat-panel { width: 100%; }
  .chat-toggle-btn { padding: 4px 10px; font-size: 11px; }
  .chat-thread-rail.open {
    position: absolute; top: 0; left: 0; bottom: 0; width: 100%;
    z-index: 5; border-right: none;
  }
}
/* Responsive chat panel scaling for larger screens */
@media (min-width: 1400px) {
  .chat-panel { width: 640px; }
  .chat-backdrop { background: rgba(0,0,0,0.15); }
  .chat-messages { padding: 22px 28px; gap: 16px; }
  .chat-header { padding: 18px 24px; }
  .chat-input-area { padding: 16px 24px; gap: 12px; }
  .chat-personality-current { padding: 10px 24px; }
  .chat-prompt-btn { padding: 11px 18px; font-size: 13px; }
}
@media (min-width: 1600px) {
  .chat-panel { width: 740px; }
  .chat-messages { padding: 24px 32px; gap: 16px; }
  .chat-msg { font-size: 14.5px; }
  .chat-header { padding: 18px 28px; }
  .chat-header-title { font-size: 16px; }
  .chat-input-area { padding: 16px 28px; }
  .chat-input { font-size: 14.5px; }
  .chat-personality-current { padding: 10px 28px; }
}
@media (min-width: 2000px) {
  .chat-panel { width: 880px; }
  .chat-backdrop { background: rgba(0,0,0,0.08); }
  .chat-messages { padding: 28px 36px; gap: 18px; }
  .chat-msg { font-size: 15px; padding: 14px 20px; }
  .chat-header { padding: 20px 32px; }
  .chat-header-title { font-size: 17px; }
  .chat-input-area { padding: 18px 32px; gap: 14px; }
  .chat-input { font-size: 15px; padding: 12px 16px; }
  .chat-personality-current { padding: 12px 32px; }
  .chat-prompt-btn { padding: 12px 20px; font-size: 14px; }
}
@media (min-width: 3000px) {
  .chat-panel { width: 1060px; }
  .chat-messages { padding: 32px 42px; gap: 20px; }
  .chat-msg { font-size: 16px; padding: 16px 24px; }
  .chat-header { padding: 22px 36px; }
  .chat-header-title { font-size: 18px; }
  .chat-input-area { padding: 20px 36px; gap: 16px; }
  .chat-input { font-size: 16px; padding: 14px 18px; }
  .chat-personality-current { padding: 14px 36px; }
  .chat-prompt-btn { padding: 14px 22px; font-size: 15px; }
}
/* Sidebar Search */
.sidebar-search {
  width: calc(100% - 32px); margin: 4px 16px 8px; padding: 8px 12px;
  border-radius: 6px; border: 1px solid var(--border); background: var(--bg-primary);
  color: var(--text-primary); font-size: 13px; font-family: inherit;
}
.sidebar-search:focus { border-color: var(--accent); }
.sidebar-search::placeholder { color: var(--text-muted); }
@media (max-width: 1024px) {
  .sidebar-search { width: calc(100% - 16px); margin: 4px 8px; }
}
/* Chat Example Prompts */
.chat-prompts { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; width: 100%; }
.chat-prompt-btn {
  padding: 10px 16px; border-radius: 20px; border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary); font-size: 13px;
  cursor: pointer; font-family: inherit; transition: all 0.15s; text-align: left;
}
.chat-prompt-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(79,140,255,0.05); }
/* Trend Badge on Chart Cards */
.chart-card-trend {
  font-size: 11px; font-weight: 600; margin-left: 8px; white-space: nowrap;
}
/* Manual Entry Button & Form */
.manual-entry-btn {
  width: 100%; padding: 10px; border-radius: 6px;
  border: 1px dashed var(--border); background: transparent;
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
  margin-top: 8px;
}
.manual-entry-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(79,140,255,0.05); }
.manual-entry-form { margin-top: 16px; }
.manual-entry-form .me-field { margin-bottom: 12px; }
.manual-entry-form .me-field label {
  display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500;
}
.manual-entry-form .me-field input {
  width: 100%; padding: 8px 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-primary);
  color: var(--text-primary); font-size: 13px; font-family: inherit;
}
.manual-entry-form .me-field input:focus { border-color: var(--accent); }
.manual-entry-form .me-context {
  font-size: 12px; color: var(--text-muted); margin-bottom: 16px;
  padding: 10px; background: var(--bg-card); border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
/* Date Range Filter */
.date-range-filter {
  display: flex; gap: 4px; background: var(--bg-secondary); padding: 3px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  width: fit-content;
}
.range-btn {
  padding: 6px 12px; border-radius: 6px; border: none; background: transparent;
  color: var(--text-secondary); font-size: 12px; cursor: pointer;
  font-weight: 600; transition: all 0.15s; font-family: inherit;
}
.range-btn.active { background: var(--accent-gradient); color: white; }
.range-btn:hover:not(.active) { background: var(--bg-hover); }
/* Heatmap View */
.heatmap-wrapper { overflow-x: auto; }
.heatmap-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.heatmap-table th {
  background: var(--bg-secondary); padding: 10px 12px; text-align: left;
  font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted);
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
  white-space: nowrap;
}
.heatmap-table td {
  padding: 8px 12px; text-align: center; cursor: pointer;
  font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--border); transition: all 0.1s;
  min-width: 70px;
}
.heatmap-table td:first-child {
  text-align: left; font-weight: 500; cursor: default;
  position: sticky; left: 0; background: var(--bg-secondary);
  z-index: 1; min-width: 160px;
}
.heatmap-table td:hover:not(:first-child) { outline: 2px solid var(--accent); outline-offset: -2px; }
.heatmap-normal { background: rgba(52, 211, 153, 0.12); color: var(--green); }
.heatmap-high { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.heatmap-high::before { content: "\25B2 "; font-size: 0.7em; }
.heatmap-low { background: rgba(251, 191, 36, 0.15); color: var(--yellow); }
.heatmap-low::before { content: "\25BC "; font-size: 0.7em; }
.heatmap-missing { background: transparent; color: var(--text-muted); font-weight: 400; }
/* Compare View */
.compare-controls {
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 20px; margin-bottom: 20px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.compare-controls label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.compare-controls select {
  padding: 8px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg-primary); color: var(--text-primary); font-size: 13px;
  font-family: inherit; cursor: pointer; min-width: 160px;
}
.compare-controls select:focus { border-color: var(--accent); }
.compare-controls select option { background: var(--bg-secondary); }
.compare-swap-btn {
  padding: 8px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary); font-size: 16px;
  cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.compare-swap-btn:hover { border-color: var(--accent); color: var(--accent); }
.compare-table-wrapper { overflow-x: auto; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.compare-table th {
  background: var(--bg-secondary); padding: 10px 14px; text-align: left;
  font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.compare-table td {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.compare-table .cat-row td {
  background: var(--bg-secondary); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
  padding: 8px 14px;
}
.compare-improved { color: var(--green); }
.compare-improved::before { content: "\2713 "; }
.compare-worsened { color: var(--red); }
.compare-worsened::before { content: "\26A0 "; }
.compare-neutral { color: var(--text-muted); }
/* Styled Confirmation Dialog */
.confirm-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); z-index: 300; display: none;
  align-items: center; justify-content: center;
}
.confirm-overlay.show { display: flex; }
.confirm-dialog {
  background: var(--bg-secondary); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 28px 32px;
  max-width: 420px; width: 90%; box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.confirm-message {
  font-size: 15px; line-height: 1.6; color: var(--text-primary); margin-bottom: 24px;
}
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
.confirm-btn {
  padding: 8px 20px; border-radius: 6px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all 0.15s;
}
.confirm-btn-cancel {
  background: var(--bg-card); color: var(--text-secondary); border: 1px solid var(--border);
}
.confirm-btn-cancel:hover { background: var(--bg-hover); color: var(--text-primary); }
.confirm-btn-danger { background: var(--red); color: white; }
.confirm-btn-danger:hover { opacity: 0.85; }
/* Trend Alert Cards */
.trend-alert-card {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--bg-card); border-radius: var(--radius-sm);
  border: 1px solid var(--border); cursor: pointer; transition: background 0.15s;
  margin-bottom: 6px;
}
.trend-alert-card:hover { background: var(--bg-hover); }
.trend-alert-danger { border-left: 3px solid var(--red); }
.trend-alert-warning { border-left: 3px solid var(--yellow); }
.trend-alert-sudden { border-left: 3px solid var(--orange); }
.trend-alert-arrow { font-size: 20px; flex-shrink: 0; line-height: 1; width: 24px; text-align: center; overflow: hidden; }
.trend-alert-danger .trend-alert-arrow { color: var(--red); }
.trend-alert-warning .trend-alert-arrow { color: var(--yellow); }
.trend-alert-sudden .trend-alert-arrow { color: var(--orange); }
.trend-alert-info { flex: 1; min-width: 0; }
.trend-alert-name { font-size: 13px; font-weight: 600; }
.trend-alert-cat { font-size: 11px; color: var(--text-muted); font-weight: 400; margin-left: 6px; }
.trend-alert-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.trend-alert-spark {
  font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); white-space: nowrap;
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
@media (max-width: 600px) {
  .trend-alert-spark { display: none; }
}
/* Glossary */
.glossary-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text-secondary);
  padding: 6px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 16px;
  transition: all 0.15s; line-height: 1;
}
.glossary-btn:hover { color: var(--accent); border-color: var(--accent); }
.glossary-modal {
  max-width: 800px; width: 95%; max-height: 85vh; overflow-y: auto;
}
.glossary-search {
  width: 100%; padding: 10px 14px; background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary); font-size: 14px;
  font-family: inherit; margin-bottom: 16px;
}
.glossary-search:focus { border-color: var(--accent); }
.glossary-category { margin-bottom: 8px; }
.glossary-cat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: var(--bg-secondary); border-radius: var(--radius-sm);
  cursor: pointer; font-weight: 600; font-size: 13px; user-select: none;
}
.glossary-cat-header:hover { background: var(--bg-hover); }
.glossary-cat-count {
  background: var(--bg-card); color: var(--text-muted); padding: 2px 8px;
  border-radius: 10px; font-size: 11px; font-weight: 500;
}
.glossary-category.collapsed .glossary-cat-body { display: none; }
.glossary-cat-body { padding: 4px 0; }
.glossary-marker {
  padding: 10px 14px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid transparent; transition: all 0.15s; margin: 2px 0;
}
.glossary-marker:hover { background: var(--bg-hover); border-color: var(--border); }
.glossary-marker-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.glossary-marker-name { font-weight: 600; font-size: 13px; }
.glossary-marker-value { font-family: var(--font-mono); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.glossary-marker-unit { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.glossary-marker-meta {
  display: flex; gap: 12px; margin-top: 4px; font-size: 11px; color: var(--text-muted);
}
.glossary-marker-desc {
  font-size: 12px; color: var(--text-secondary); margin-top: 4px; line-height: 1.4;
  min-height: 16px;
}
/* Batch Import */
.batch-progress-counter {
  text-align: center; color: var(--accent); font-weight: 600; font-size: 14px;
  margin-bottom: 12px;
}
.batch-counter {
  color: var(--accent); font-size: 13px; font-weight: 600; margin-bottom: 8px;
}
/* Menstrual Cycle */
.cycle-section { margin-bottom: 16px; }
.cycle-prompt {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  background: var(--bg-card); border: 1px dashed var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.15s; font-size: 13px; color: var(--text-primary);
}
.cycle-prompt:hover { border-color: var(--accent); background: var(--bg-hover); }
.cycle-prompt-icon { font-size: 20px; flex-shrink: 0; }
.cycle-summary {
  font-size: 13px; color: var(--text-secondary); margin-bottom: 10px;
  padding: 8px 14px; background: var(--bg-card); border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.cycle-draw-date {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px;
  background: var(--ref-band); border: 1px solid var(--ref-border);
  border-radius: var(--radius-sm); margin-bottom: 10px; font-size: 13px;
  color: var(--text-primary);
}
.cycle-draw-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.cycle-draw-explain {
  font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.4;
}
.cycle-draw-phases {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px;
}
.cycle-draw-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-secondary);
  padding: 4px 10px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 6px;
}
.cycle-phase-badge {
  display: inline-block; padding: 1px 7px; border-radius: 4px;
  font-size: 11px; font-weight: 600; text-transform: capitalize;
}
.phase-menstrual { background: rgba(248,113,113,0.15); color: var(--red); }
.phase-follicular { background: rgba(79,140,255,0.15); color: var(--accent); }
.phase-ovulatory { background: rgba(52,211,153,0.15); color: var(--green); }
.phase-luteal { background: var(--purple-light); color: var(--purple); }
.cycle-period-log {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px;
}
.cycle-period-entry {
  font-size: 12px; color: var(--text-secondary);
  padding: 3px 8px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 5px; display: inline-flex; align-items: center; gap: 4px;
}
.cycle-period-note { color: var(--text-muted); font-style: italic; }
.period-symptom-tag {
  display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted); margin-left: 4px;
}
.cycle-alert {
  display: flex; gap: 10px; padding: 10px 14px; border-radius: 8px; margin-top: 8px; border-left: 3px solid;
}
.cycle-alert-icon { font-size: 18px; flex-shrink: 0; }
.cycle-alert strong { font-size: 13px; }
.cycle-alert-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.cycle-alert-perimenopause { background: rgba(245, 158, 11, 0.08); border-color: var(--yellow); }
.cycle-alert-critical { background: rgba(239, 68, 68, 0.08); border-color: var(--red); }
.cycle-alert-warning { background: rgba(245, 158, 11, 0.08); border-color: var(--yellow); }
.cycle-alert-info { background: rgba(59, 130, 246, 0.08); border-color: var(--accent); }
.cycle-editor-form { margin-top: 12px; }
.modal .supp-form-row { flex-wrap: wrap; }
.modal .supp-form-field { min-width: min(140px, 100%); }
.mc-auto-value { padding: 8px 12px; background: var(--bg-hover); border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--text-primary); }
/* Chart Layers Dropdown */
.chart-layers-wrapper { position: relative; }
.chart-layers-trigger { white-space: nowrap; }
.chart-layers-dropdown {
  display: none; position: absolute; top: calc(100% + 4px); right: 0;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); z-index: 50; min-width: 160px; padding: 6px 0;
}
.chart-layers-dropdown.open { display: block; }
.chart-layers-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px;
  font-size: 13px; color: var(--text-secondary); cursor: pointer; white-space: nowrap;
}
.chart-layers-row:hover { background: var(--bg-hover); }
.chart-layers-row input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }
@media (max-width: 768px) {
  .cycle-draw-phases { flex-direction: column; gap: 4px; }
  .cycle-period-log { flex-direction: column; gap: 4px; }
}
/* Focus Card */
.focus-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; margin-top: 16px;
  border-left: 3px solid var(--accent);
  position: relative; overflow: hidden;
}
.focus-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent-gradient);
}
.focus-card-icon { font-size: 20px; flex-shrink: 0; }
.focus-card-body { flex: 1; min-width: 0; font-size: 14px; line-height: 1.5; color: var(--text-primary); }
.focus-card-text { display: block; }
.focus-card-refresh {
  flex-shrink: 0; background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-muted); font-size: 16px; width: 30px; height: 30px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: color 0.15s, border-color 0.15s;
}
.focus-card-refresh:hover { color: var(--accent); border-color: var(--accent); }
.focus-card-shimmer {
  display: block; height: 18px; width: 80%; border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--border) 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
/* Interpretive Lens Section */
.lens-section {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; margin-top: 10px; cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  border-left: 3px solid var(--purple);
  font-size: 13px; color: var(--text-secondary); line-height: 1.5;
  transition: border-color 0.15s, background 0.15s;
}
.lens-section:hover { border-color: var(--purple); background: var(--bg-hover); }
.lens-section-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.lens-section-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lens-section-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--purple); }
.lens-section-text { white-space: pre-wrap; word-break: break-word; }
.lens-section-edit { font-size: 14px; flex-shrink: 0; color: var(--text-muted); opacity: 0; transition: opacity 0.15s; margin-top: 1px; }
.lens-section:hover .lens-section-edit { opacity: 1; }
.lens-section-empty { border-style: dashed; border-left-style: dashed; border-color: var(--border); opacity: 0.7; }
.lens-section-empty:hover { border-color: var(--purple); opacity: 1; }
.lens-section-empty .lens-section-text { font-style: italic; color: var(--text-muted); }
/* Onboarding */
.onboarding-step1 {
  text-align: center; padding: 32px 20px; margin-top: 16px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
}
.onboarding-step1 h3 { font-family: var(--font-display); font-size: 20px; color: var(--text-primary); margin: 16px 0 6px; }
.onboarding-step1 p { color: var(--text-secondary); font-size: 14px; margin: 0 0 20px; }
.onboarding-import-btn {
  display: inline-block; padding: 10px 28px; font-size: 14px; font-weight: 600;
  background: var(--accent-gradient); color: #fff; border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.2s;
}
.onboarding-import-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(79, 140, 255, 0.25); }
.onboarding-hint { color: var(--text-muted); font-size: 12px; margin-top: 10px; }
.onboarding-divider {
  display: flex; align-items: center; gap: 12px; margin: 20px 0 16px;
}
.onboarding-divider-line { flex: 1; height: 1px; background: var(--border); }
.onboarding-divider-text {
  font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap;
}
.demo-cards { display: flex; gap: 12px; justify-content: center; }
.demo-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 24px; background: var(--bg-hover); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: all 0.2s; min-width: 140px;
}
.demo-card:hover {
  border-color: var(--accent); background: rgba(79, 140, 255, 0.05); transform: translateY(-1px);
}
.demo-card-avatar { font-size: 28px; line-height: 1; }
.demo-card-name { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.demo-card-desc { font-size: 12px; color: var(--text-muted); }
.onboarding-steps {
  display: flex; align-items: center; justify-content: center; gap: 0; margin-bottom: 4px;
}
.onboarding-step {
  width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; border: 2px solid var(--border); color: var(--text-muted); background: none;
  flex-shrink: 0;
}
.onboarding-step.active { border-color: var(--accent); color: var(--accent); background: rgba(79,140,255,0.1); }
.onboarding-step.completed { border-color: var(--green); color: var(--green); background: rgba(52,211,153,0.1); }
.onboarding-step-line { width: 32px; height: 2px; background: var(--border); }
.onboarding-step-labels {
  display: flex; justify-content: center; gap: 32px; margin-bottom: 8px;
}
.onboarding-step-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.onboarding-step-label.active { color: var(--accent); font-weight: 600; }
.onboarding-banner {
  background: var(--bg-card); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 24px; margin-top: 16px; text-align: center;
}
.onboarding-title { font-family: var(--font-display); font-size: 17px; color: var(--text-primary); margin: 12px 0 4px; }
.onboarding-subtitle { color: var(--text-secondary); font-size: 13px; margin: 0 0 18px; }
.onboarding-form {
  display: flex; align-items: flex-end; justify-content: center; gap: 20px; flex-wrap: wrap;
}
.onboarding-field { display: flex; flex-direction: column; gap: 6px; }
.onboarding-label { font-size: 12px; color: var(--text-secondary); text-align: left; }
.onboarding-sex-toggle { display: flex; gap: 0; }
.onboarding-sex-btn {
  padding: 7px 18px; font-size: 13px; font-weight: 500; cursor: pointer;
  background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border);
  transition: all 0.15s;
}
.onboarding-sex-btn:first-child { border-radius: 6px 0 0 6px; }
.onboarding-sex-btn:last-child { border-radius: 0 6px 6px 0; border-left: none; }
.onboarding-sex-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.onboarding-sex-btn.active + .onboarding-sex-btn { border-left-color: var(--accent); }
.onboarding-dob-input {
  padding: 7px 12px; font-size: 13px; background: var(--bg-hover); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 6px; font-family: inherit;
}
[data-theme="light"] .onboarding-dob-input { color-scheme: light; }
.onboarding-actions { display: flex; gap: 10px; align-items: center; }
.onboarding-save-btn {
  padding: 8px 22px; font-size: 13px; font-weight: 600; background: var(--accent-gradient);
  color: #fff; border: none; border-radius: 6px; cursor: pointer; transition: all 0.2s;
}
.onboarding-save-btn:hover { box-shadow: 0 2px 12px rgba(79, 140, 255, 0.25); }
.onboarding-skip-btn {
  padding: 8px 16px; font-size: 13px; background: none; border: none;
  color: var(--text-muted); cursor: pointer; text-decoration: underline;
}
.onboarding-skip-btn:hover { color: var(--text-secondary); }
@media (max-width: 600px) {
  .onboarding-form { flex-direction: column; align-items: stretch; }
  .onboarding-field { align-items: stretch; }
  .onboarding-actions { justify-content: center; }
  .onboarding-step-labels { gap: 20px; }
}

/* ═══ Privacy / PII Obfuscation ═══ */
.privacy-notice {
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px;
  margin-top: 12px; line-height: 1.5;
}
.privacy-notice-success {
  background: rgba(34,197,94,0.08); border: 1px solid rgba(34,197,94,0.25); color: var(--green);
}
.privacy-notice-warning {
  background: rgba(234,179,8,0.08); border: 1px solid rgba(234,179,8,0.25); color: var(--yellow);
}

/* Ollama settings in Settings modal */
.ollama-settings { margin-top: 4px; }
.ollama-status {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
}
.ollama-status-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted);
  flex-shrink: 0;
}
.ollama-status-dot.connected { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.ollama-status-dot.disconnected { background: var(--red); }

/* Privacy status card & collapsible configure */
.privacy-status-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  margin-bottom: 8px; line-height: 1.4;
}
.privacy-status-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.privacy-status-body { flex: 1; min-width: 0; }
.privacy-status-title { font-size: 13px; font-weight: 600; }
.privacy-status-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.privacy-status-enhanced {
  background: rgba(34,197,94,0.08); border: 1px solid rgba(34,197,94,0.25);
}
.privacy-status-enhanced .privacy-status-title { color: var(--green); }
.privacy-status-basic {
  background: rgba(234,179,8,0.08); border: 1px solid rgba(234,179,8,0.25);
}
.privacy-status-basic .privacy-status-title { color: var(--yellow); }
.privacy-configure-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted); cursor: pointer;
  padding: 4px 0; user-select: none;
}
.privacy-configure-toggle:hover { color: var(--text-secondary); }
.privacy-configure-arrow { font-size: 9px; transition: transform 0.15s; }
.privacy-configure-body { padding-top: 8px; }

/* PII overlay (shared by diff viewer) */
.pii-warning-overlay {
  position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s;
}
.pii-warning-overlay.show { opacity: 1; }

/* PII Diff Viewer (debug mode) */
.pii-diff-modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; max-width: 95vw; width: 1200px; max-height: 85vh; overflow: hidden;
  display: flex; flex-direction: column; position: relative;
}
.pii-diff-modal h3 { margin: 0 0 16px; font-size: 16px; }
.pii-diff-viewer {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
  overflow-y: auto; flex: 1; font-family: monospace; font-size: 11px;
  line-height: 1.6; border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.pii-diff-left, .pii-diff-right {
  padding: 8px; overflow-x: auto; white-space: pre;
}
.pii-diff-left { background: rgba(239,68,68,0.03); }
.pii-diff-right { background: rgba(34,197,94,0.03); }
.pii-diff-header {
  font-weight: 700; font-size: 12px; padding-bottom: 8px; margin-bottom: 8px;
  border-bottom: 1px solid var(--border); font-family: var(--font-display);
}
.pii-diff-highlight-removed { background: rgba(239,68,68,0.12); border-radius: 2px; }
.pii-diff-highlight-added { background: rgba(34,197,94,0.12); border-radius: 2px; }
.chat-cost-footnote {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  opacity: 0.6;
}
/* Chat Action Bar */
.chat-action-bar {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.chat-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: inherit;
  transition: color 0.15s, background 0.15s;
}
.chat-action-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
/* Context used toggle + details */
.chat-context-toggle, .chat-sources-toggle {
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0;
  margin-top: 4px;
  user-select: none;
}
.chat-context-toggle:hover, .chat-sources-toggle:hover {
  color: var(--text-secondary);
}
.chat-toggle-arrow {
  display: inline-block;
  width: 12px;
  text-align: center;
  font-size: 10px;
}
.chat-context-details {
  display: none;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 6px 0 2px 14px;
}
.chat-context-item {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}
/* Sources section */
.chat-sources-details {
  display: none;
  padding: 6px 0 2px 14px;
}
.chat-source-item {
  margin-bottom: 8px;
}
.chat-source-title {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  line-height: 1.4;
}
.chat-source-title:hover {
  text-decoration: underline;
}
.chat-source-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}
.chat-sources-loading {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-sources-shimmer {
  display: inline-block;
  width: 80px;
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--border) 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
/* Passphrase / Encryption Modal */
.passphrase-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85); z-index: 400; display: none;
  align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
}
.passphrase-dialog {
  background: var(--bg-secondary); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 36px 32px;
  max-width: 420px; width: 90%; box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  text-align: center;
}
.passphrase-icon { font-size: 48px; margin-bottom: 12px; }
.passphrase-title {
  font-size: 20px; font-weight: 700; color: var(--text-primary);
  font-family: var(--font-display); margin-bottom: 8px;
}
.passphrase-desc {
  font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 20px;
}
.passphrase-input {
  width: 100%; padding: 10px 14px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-primary);
  color: var(--text-primary); font-size: 14px; font-family: inherit;
  margin-bottom: 10px; text-align: center;
}
.passphrase-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(99,102,241,0.2); }
.passphrase-error {
  font-size: 13px; color: var(--red); min-height: 20px; margin-bottom: 8px;
}
.passphrase-btn {
  width: 100%; padding: 10px 20px; border-radius: 6px; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all 0.15s; margin-bottom: 6px;
}
.passphrase-btn-primary {
  background: var(--accent-gradient); color: white;
}
.passphrase-btn-primary:hover { opacity: 0.9; }
.passphrase-btn-primary:disabled { opacity: 0.5; cursor: wait; }
.passphrase-btn-secondary {
  background: var(--bg-card); color: var(--text-secondary);
  border: 1px solid var(--border); flex: 1;
}
.passphrase-btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }
.passphrase-btn-link {
  background: none; color: var(--text-muted); font-size: 12px;
  font-weight: 400; padding: 6px;
}
.passphrase-btn-link:hover { color: var(--text-secondary); }
/* Encryption Status Cards */
.encryption-status-card {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.encryption-status-on { border-left: 3px solid var(--green); }
.encryption-status-off { border-left: 3px solid var(--yellow); }
.encryption-status-icon { font-size: 24px; flex-shrink: 0; line-height: 1; }
.encryption-status-body { flex: 1; min-width: 0; }
.encryption-status-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.encryption-status-detail { font-size: 12px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }
/* Auto-backup snapshot list */
.backup-auto-status {
  font-size: 12px; color: var(--text-muted); margin-top: 12px; margin-bottom: 8px;
}
.backup-snapshots-toggle {
  font-size: 13px; color: var(--text-secondary); cursor: pointer; padding: 4px 0;
  margin-bottom: 6px; user-select: none;
}
.backup-snapshots-toggle:hover { color: var(--text-primary); }
.backup-snapshot-list { display: flex; flex-direction: column; gap: 6px; }
.backup-snapshot-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-card);
}
.backup-snapshot-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.backup-snapshot-date { font-size: 13px; color: var(--text-primary); }
.backup-snapshot-meta { font-size: 11px; color: var(--text-muted); }
/* ═══ Mobile: 480px and below ═══ */
@media (max-width: 480px) {
  .header { padding: 10px 12px; gap: 6px; }
  .header h1 { font-size: 17px; }
  .header-info { gap: 8px; font-size: 12px; }
  #header-dates { display: none; }
  .main { padding: 14px 12px; }
  .category-header h2 { font-size: 20px; }
  .drop-zone { padding: 20px 16px; }
  .drop-zone-icon { font-size: 24px; }
  .modal { padding: 20px 16px; }
  .modal h3 { font-size: 18px; }
  .corr-dropdown { min-width: 100%; }
  .alert-card { flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .alert-ref { width: auto; text-align: left; }
  .supp-bar-label { width: 80px; font-size: 11px; }
  .empty-state { padding: 32px 16px; }
  .onboarding-step1 { padding: 24px 14px; }
  .demo-cards { flex-direction: column; align-items: stretch; }
  .demo-card { min-width: 0; }
  .context-card { min-height: 72px; padding: 10px 12px; }
  .context-card-label { font-size: 12px; }
  .notification-container { right: 8px; left: 8px; }
  .notification-toast { min-width: 0; width: 100%; }
  .confirm-dialog { padding: 22px 18px; }
}
/* ═══ Mobile: 375px and below (smallest phones) ═══ */
@media (max-width: 375px) {
  .header { padding: 8px 10px; }
  .header h1 { font-size: 16px; }
  .header-info { gap: 6px; }
  .main { padding: 10px 8px; }
  .modal { padding: 16px 12px; max-width: 98vw; }
  .chat-messages { padding: 14px 12px; }
  .chat-input-area { padding: 10px 12px; }
  .context-card { min-height: 64px; }
}
/* ═══ Settings tabs: horizontal scroll on narrow screens ═══ */
@media (max-width: 600px) {
  .settings-tabs-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .settings-tabs-bar::-webkit-scrollbar { display: none; }
}
/* ═══ PII diff: stack columns on mobile ═══ */
@media (max-width: 768px) {
  .pii-diff-viewer { grid-template-columns: 1fr; }
  .pii-diff-modal { padding: 16px; }
}
/* ═══ Chat thread rail: back button on mobile overlay ═══ */
@media (max-width: 768px) {
  .chat-thread-rail.open .chat-thread-rail-header { padding-top: 10px; }
}
/* ═══ Touch-friendly: make hover-only elements accessible ═══ */
@media (hover: none) {
  .mv-delete { opacity: 0.7; }
  .profile-menu-actions { display: flex; }
  .chat-thread-item-actions { display: flex; }
  .lens-section-edit { opacity: 0.7; }
  .context-info-icon .context-tooltip { display: none; }
  .context-info-icon { cursor: default; }
}
/* ═══ Touch-friendly: minimum tap targets ═══ */
@media (pointer: coarse) {
  .settings-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .glossary-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .chat-toggle-btn { min-height: 44px; padding: 6px 16px; }
  .range-toggle-btn { min-height: 44px; padding: 8px 12px; }
  .chat-thread-new-btn { width: 36px; height: 36px; }
  .chat-thread-item-action { width: 32px; height: 32px; font-size: 14px; }
  .chat-rail-toggle { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; }
  .supp-list-actions button { min-height: 36px; padding: 6px 12px; }
  .nav-item { min-height: 44px; }
  .chat-close-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .chat-clear-btn { min-height: 36px; padding: 6px 10px; }
  .profile-menu-action { min-width: 32px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; }
  .goals-delete-btn { min-width: 36px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; }
  .ie-remove { min-height: 36px; }
  .modal-close { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
}
/* ═══ Guided Tour ═══ */
#tour-overlay { position: fixed; inset: 0; z-index: 500; pointer-events: auto; }
#tour-spotlight {
  position: fixed; z-index: 501; border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.65);
  transition: all 0.3s ease; pointer-events: none;
}
#tour-tooltip {
  position: fixed; z-index: 502; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; max-width: 340px; width: max-content;
  box-shadow: var(--shadow-lg);
}
#tour-tooltip h4 { margin: 0 0 8px; font-family: var(--font-display); font-size: 16px; }
#tour-tooltip p { margin: 0 0 16px; color: var(--text-secondary); font-size: 14px; line-height: 1.5; }
.tour-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tour-dots { display: flex; gap: 6px; }
.tour-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: background 0.2s; }
.tour-dot.active { background: var(--accent); }
.tour-btns { display: flex; gap: 8px; }
.tour-btn { padding: 6px 16px; border-radius: 6px; border: none; font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit; transition: all 0.15s; }
.tour-btn-primary { background: var(--accent-gradient); color: white; }
.tour-btn-primary:hover { box-shadow: 0 2px 12px rgba(79,140,255,0.2); }
.tour-btn-secondary { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.tour-btn-secondary:hover { background: var(--bg-hover); }
@media (max-width: 480px) {
  #tour-tooltip { max-width: calc(100vw - 32px); }
}
.cycle-tour-btn {
  width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary); font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all 0.15s; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0;
}
.cycle-tour-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(79,140,255,0.05); }
/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
