:root {
  color-scheme: light;
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f8f9fa; --border: #e4e6ea; --track: #eceef1;
  --text: #0f1115; --text-2: #52555c; --text-3: #8a8d94;
  --accent: #2a78d6; --accent-ink: #ffffff; --accent-soft: #e8f1fc;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --up: #0b8a0b; --down: #c93434;
  --b1: #2a78d6; --b2: #6da7ec; --b3: #b7d3f6; --b4: #dde3ea; --b5: #eceef1;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --radius: 12px;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110; --surface: #1a1a19; --surface-2: #222220; --border: #2e2e2b; --track: #2a2a28;
    --text: #f0efec; --text-2: #c3c2b7; --text-3: #8d8c84;
    --accent: #3987e5; --accent-soft: #1d2b3d;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --up: #3fbf3f; --down: #ef6b6b;
    --b1: #3987e5; --b2: #256abf; --b3: #184f95; --b4: #383835; --b5: #2a2a28;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110; --surface: #1a1a19; --surface-2: #222220; --border: #2e2e2b; --track: #2a2a28;
  --text: #f0efec; --text-2: #c3c2b7; --text-3: #8d8c84;
  --accent: #3987e5; --accent-soft: #1d2b3d;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --up: #3fbf3f; --down: #ef6b6b;
  --b1: #3987e5; --b2: #256abf; --b3: #184f95; --b4: #383835; --b5: #2a2a28;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 Inter, system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
small, .muted { color: var(--text-3); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }

/* layout */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 12px; color: var(--text); }
.brand b { display: block; font-size: 15px; } .brand small { display: block; font-size: 11px; margin-top: -2px; }
nav { padding: 4px 10px; display: flex; flex-direction: column; gap: 1px; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 14px 10px 4px; }
nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
nav a:hover { background: var(--surface-2); color: var(--text); }
nav a.active { background: var(--accent-soft); color: var(--accent); }
.ico { width: 18px; text-align: center; opacity: .85; }
.sidebar-foot { margin-top: auto; padding: 14px 18px; font-size: 12px; color: var(--text-3); border-top: 1px solid var(--border); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.crumbs { font-weight: 500; color: var(--text-2); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs b { color: var(--text); }
.topbar-right { display: flex; gap: 10px; align-items: center; }
.view { padding: 24px 28px 60px; max-width: 1440px; width: 100%; }
.mobile-only { display: none; }

/* primitives */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--text-2); max-width: 760px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-3); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .mt { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--critical); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 16px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; outline: none; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; width: 100%; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; color: var(--text-2); }
label.field small { font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge.live { background: color-mix(in srgb, var(--good) 14%, var(--surface)); color: var(--up); border-color: color-mix(in srgb, var(--good) 35%, var(--border)); }
.badge.demo { background: color-mix(in srgb, var(--warning) 18%, var(--surface)); color: #8a5a00; border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
:root[data-theme="dark"] .badge.demo { color: var(--warning); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.demo { color: var(--warning); } }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.credits-pill { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.chip { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); margin-right: 3px; }
.tag { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }

/* KPI tiles */
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .label { font-size: 12.5px; color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 28px; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12.5px; color: var(--text-3); }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.up { color: var(--up); } .delta.down { color: var(--down); } .delta.flat { color: var(--text-3); }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; cursor: default; user-select: none; }
th.sortable { cursor: pointer; } th.sortable:hover { color: var(--text); }
th.num, td.num { text-align: right; }
td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
tr.clickable { cursor: pointer; }
.kw { font-weight: 500; }
.url { color: var(--text-3); font-size: 12px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.pos { display: inline-flex; min-width: 34px; justify-content: center; padding: 2px 7px; border-radius: 6px; font-weight: 650; background: var(--surface-2); }
.pos.t3 { background: color-mix(in srgb, var(--good) 18%, var(--surface)); color: var(--up); }
.pos.t10 { background: var(--accent-soft); color: var(--accent); }
.pos.nr { color: var(--text-3); font-weight: 500; }
.kd { display: inline-flex; align-items: center; gap: 6px; }
.kd i { width: 34px; height: 5px; border-radius: 3px; background: var(--track); position: relative; overflow: hidden; }
.kd i b { position: absolute; inset: 0 auto 0 0; background: var(--text-2); border-radius: 3px; }
.own { background: var(--accent-soft) !important; }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.grid line { stroke: var(--border); stroke-width: 1; }
.axis { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.crosshair { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip { position: absolute; display: none; pointer-events: none; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 6px 20px rgba(0,0,0,.12); border-radius: 8px; padding: 8px 10px; font-size: 12px; min-width: 150px; z-index: 3; }
.tip-h { font-weight: 600; margin-bottom: 4px; color: var(--text); }
.tip-row { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.tip-row i, .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.tip-row b { margin-left: auto; color: var(--text); padding-left: 10px; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.spark { display: block; }
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 64px; gap: 10px; align-items: center; font-size: 13px; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-label small { display: block; font-size: 11.5px; }
.hbar-track { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 4px; }
.hbar-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.gauge-num { font-size: 30px; font-weight: 700; fill: var(--text); }
.gauge-lbl { font-size: 12px; fill: var(--text-3); }

/* project cards */
.proj-card { display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: border-color .15s; }
.proj-card:hover { border-color: var(--accent); }
.proj-top { display: flex; align-items: center; gap: 10px; }
.proj-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.proj-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.proj-stats div { font-size: 12px; color: var(--text-3); }
.proj-stats b { display: block; font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }

/* tabs & segmented */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 9px 14px; font: inherit; font-weight: 500; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--accent); border-color: var(--accent); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 6px; font: inherit; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* drawer / modal / toast */
.drawer-backdrop, .modal-backdrop { position: fixed; inset: 0; background: rgba(10, 12, 16, .35); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
.drawer-backdrop.open, .modal-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(640px, 100vw); background: var(--surface); border-left: 1px solid var(--border); z-index: 21; transform: translateX(100%); transition: transform .25s ease; overflow-y: auto; padding: 22px; }
.drawer.open { transform: none; }
.modal-backdrop { display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: min(620px, 100%); max-height: 90vh; overflow-y: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 40; }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 380px; animation: pop .2s ease; }
.toast.err { background: var(--critical); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

.empty { text-align: center; padding: 48px 16px; color: var(--text-3); }
.empty.small { padding: 24px 8px; font-size: 13px; }
.notice { display: block; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--text); font-size: 13.5px; border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border)); }
.notice.warn { background: color-mix(in srgb, var(--warning) 14%, var(--surface)); border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); }
.cost-hint { font-size: 12px; color: var(--text-3); }
.progress { height: 6px; background: var(--track); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width .3s; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--track); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--track), var(--surface-2), var(--track)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; min-height: 120px; }
@keyframes sk { to { background-position: -200% 0; } }
pre.json { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow: auto; max-height: 420px; font: 12px/1.5 var(--mono); margin: 0; white-space: pre-wrap; word-break: break-word; }
details.raw summary { cursor: pointer; font-size: 12.5px; color: var(--text-3); margin-top: 12px; }

/* severity */
.sev { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; }
.sev::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.sev.error { color: var(--critical); } .sev.warning { color: #b87800; } .sev.notice { color: var(--text-3); }

/* chat */
.chat { display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 460px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 4px 2px 16px; }
.msg { max-width: 860px; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 14px 14px 4px 14px; max-width: 70%; }
.msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); padding: 14px 16px; border-radius: 14px 14px 14px 4px; }
.msg.bot table { margin: 8px 0; font-size: 13px; } .msg.bot td, .msg.bot th { padding: 5px 8px; }
.msg.bot p { margin: 6px 0; } .msg.bot ul { margin: 6px 0; padding-left: 20px; }
.trace { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.trace-item { font: 12px var(--mono); color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; }
.trace-item summary { cursor: pointer; }
.trace-item pre { white-space: pre-wrap; word-break: break-all; margin: 6px 0 0; color: var(--text-3); }
.chat-input { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.chat-input textarea { min-height: 46px; max-height: 160px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
.suggestions button { border: 1px solid var(--border); background: var(--surface); padding: 7px 12px; border-radius: 999px; font: inherit; font-size: 13px; color: var(--text-2); cursor: pointer; }
.suggestions button:hover { border-color: var(--accent); color: var(--accent); }

/* tool explorer */
.tool-list { max-height: 560px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -8px; }
.tool-item { padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.tool-item:hover { background: var(--surface-2); }
.tool-item.active { background: var(--accent-soft); }
.tool-item b { font: 500 12.5px var(--mono); display: block; }
.tool-item small { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snippet { position: relative; }
.snippet button { position: absolute; top: 8px; right: 8px; }

/* compare table */
.compare td:first-child { font-weight: 500; }
.check { color: var(--up); font-weight: 700; } .cross { color: var(--text-3); }
.highlight-col { background: var(--accent-soft); }

/* report (print) */
.report { background: #fff; color: #111; max-width: 900px; margin: 0 auto; padding: 36px; border-radius: 12px; border: 1px solid var(--border); }
.report h1 { font-size: 26px; } .report .muted { color: #666; }
@media print {
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  .app { display: block; } .view { padding: 0; max-width: none; }
  body { background: #fff; }
  .report { border: 0; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

@media (max-width: 1100px) { .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .mobile-only { display: inline-block; }
  .view { padding: 16px 16px 48px; } .topbar { padding: 10px 16px; }
  .g2, .g3, .g4, .g5, .form-grid { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
  .credits-pill { display: none; }
  .msg.user { max-width: 90%; }
}

/* chat layout with history */
.chat-layout { display: grid; grid-template-columns: 270px 1fr; gap: 16px; }
.chat-side { padding: 12px; height: calc(100vh - 200px); min-height: 480px; display: flex; flex-direction: column; }
.conv-list { overflow-y: auto; flex: 1; margin: 0 -6px; }
.conv-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 12px 8px 4px; }
.conv-item { padding: 8px; border-radius: 8px; cursor: pointer; }
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--accent-soft); }
.conv-title { font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item small { font-size: 11.5px; }
.chat { height: calc(100vh - 200px); }
.chat-head { display: flex; align-items: center; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 8px; min-height: 36px; }
.conv-head-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.thinking { font-size: 12.5px; color: var(--text-3); margin-bottom: 8px; border-left: 2px solid var(--border); padding-left: 10px; }
.thinking summary { cursor: pointer; }
.thinking div { white-space: pre-wrap; max-height: 160px; overflow: auto; margin-top: 4px; }
@media (max-width: 900px) { .chat-layout { grid-template-columns: 1fr; } .chat-side { height: auto; min-height: 0; max-height: 260px; } }

/* history panels */
.hist-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.hist-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 12.5px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.hist-chip:hover { border-color: var(--accent); color: var(--accent); }
.hist-chip.active { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); font-weight: 600; }
.snap-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); color: inherit; align-items: center; }
.tl-item:last-child { border-bottom: 0; }
a.tl-item:hover { background: var(--surface-2); }
.tl-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; }
.tl-title { font-weight: 500; }
.tl-sub { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.tl-date { font-size: 12px; color: var(--text-3); white-space: nowrap; text-align: right; }
.tl-day { font-size: 12px; font-weight: 600; color: var(--text-2); padding: 14px 4px 4px; text-transform: capitalize; }
.new-chip { font-size: 10.5px; font-weight: 700; color: var(--up); background: color-mix(in srgb, var(--good) 14%, var(--surface)); padding: 1px 6px; border-radius: 4px; margin-left: 6px; }
.marker-line { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 2 3; }
.marker-flag circle { fill: var(--series-4); stroke: var(--surface); stroke-width: 2; cursor: help; }
.tip-note { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); color: var(--text); max-width: 240px; white-space: normal; }

/* ✦ AI fields */
:root { --ai-1: #6250d6; --ai-2: #2a78d6; --ai-3: #e87ba4; }
.ai-tools { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; margin-left: 4px; }
.ai-star { width: 24px; height: 24px; border-radius: 7px; border: 1px solid color-mix(in srgb, var(--ai-1) 35%, var(--border)); background: linear-gradient(135deg, color-mix(in srgb, var(--ai-1) 14%, var(--surface)), color-mix(in srgb, var(--ai-2) 14%, var(--surface)));
  color: var(--ai-1); display: inline-grid; place-items: center; cursor: pointer; padding: 0; transition: transform .15s, box-shadow .15s; }
:root[data-theme="dark"] .ai-star { color: #a99bff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ai-star { color: #a99bff; } }
.ai-star:hover { transform: scale(1.12) rotate(-8deg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ai-1) 18%, transparent); }
.ai-tools.busy .ai-star { animation: aiSpin 1s linear infinite; pointer-events: none; }
@keyframes aiSpin { to { transform: rotate(360deg); } }
.ai-info { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-3); font: italic 600 11px/1 Georgia, serif; cursor: pointer; padding: 0; display: inline-grid; place-items: center; }
.ai-info:hover { color: var(--ai-1); border-color: var(--ai-1); }
.ai-info[hidden] { display: none; }
.ai-glow { position: relative; animation: aiGlow 1.3s ease-in-out infinite; border-color: var(--ai-1) !important; }
@keyframes aiGlow {
  0%, 100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--ai-1) 45%, transparent), 0 0 14px 2px color-mix(in srgb, var(--ai-2) 35%, transparent); }
  50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ai-3) 50%, transparent), 0 0 26px 6px color-mix(in srgb, var(--ai-1) 40%, transparent); }
}
.ai-card.ai-glow { background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--ai-1) 12%, transparent) 50%, transparent 70%) 0 0 / 200% 100%, var(--surface); animation: aiGlow 1.3s ease-in-out infinite, aiShimmer 1.4s linear infinite; }
.ai-card.ai-glow .ai-slot-empty { opacity: .5; }
@keyframes aiShimmer { to { background-position: -200% 0; } }
.ai-filled { animation: aiDone 1.6s ease-out; border-radius: var(--radius); }
textarea.ai-filled, input.ai-filled { border-radius: 8px; }
@keyframes aiDone { 0% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 55%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.ai-card { border-color: color-mix(in srgb, var(--ai-1) 25%, var(--border)); background: linear-gradient(180deg, color-mix(in srgb, var(--ai-1) 5%, var(--surface)), var(--surface) 60%); }
.ai-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ai-badge { font-size: 11px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--ai-1), var(--ai-2)); padding: 2px 7px; border-radius: 999px; }
.ai-slot { min-height: 34px; padding: 4px 2px; font-size: 13.5px; }
.ai-slot p { margin: 4px 0; } .ai-slot ul { margin: 4px 0; padding-left: 18px; }
.ai-slot-empty { color: var(--text-3); font-size: 13px; }
.ai-pop { position: fixed; z-index: 50; width: 330px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--ai-1) 35%, var(--border)); border-radius: 12px; padding: 12px 14px; box-shadow: 0 14px 40px rgba(0,0,0,.22); font-size: 13px; }
.ai-pop ul { margin: 0 0 8px; padding-left: 18px; }
.ai-pop-meta { font-size: 12px; } .ai-pop-meta td { padding: 2px 8px 2px 0; border: 0; } .ai-pop-meta td:first-child { color: var(--text-3); }
.th-ai { display: inline-flex; align-items: center; }
label.field > span:first-child { display: inline-flex; align-items: center; gap: 4px; }
@media print { .ai-tools, .ai-badge { display: none !important; } .ai-card { border: 0; background: none; padding: 0; } .report-ai .ai-slot-empty { display: none; } }
.ai-pop .row { flex-wrap: nowrap; }

/* icons & alignment polish */
svg.i { flex: none; display: block; }
.btn { line-height: 20px; min-height: 36px; }
.btn.sm { min-height: 30px; line-height: 18px; }
.btn svg.i { margin-left: -2px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; }
.icon-btn svg { width: 18px; height: 18px; }
.ico { width: 20px; height: 20px; display: inline-grid; place-items: center; opacity: .9; }
nav a { gap: 11px; }
.tl-icon { color: var(--text-2); }
.tl-icon svg { width: 16px; height: 16px; }
.seg button { display: inline-flex; align-items: center; gap: 5px; }

@media (min-width: 821px) { .mobile-only { display: none !important; } }
.sub-line { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.kw { display: block; }
.g4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.g5 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); } .g5 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); } }
.notice b { font-weight: 650; }
@media (max-width: 820px) { .g4, .g5 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); } .kpi .value { font-size: 24px; } }

/* improvements (human-approved changes) */
.gen-log { margin-top: 10px; display: flex; flex-direction: column; gap: 3px; max-height: 220px; overflow: auto; }
.gen-step { font-size: 12.5px; color: var(--text-2); }
.gen-step.muted { color: var(--text-3); } .gen-step.good { color: var(--up); } .gen-step.bad { color: var(--down); }
.count-pill { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; vertical-align: middle; }
.prop-list { display: flex; flex-direction: column; gap: 12px; }
.prop { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface); border-left: 3px solid var(--border); }
.prop-warn { border-left-color: var(--warning); } .prop-good { border-left-color: var(--good); } .prop-bad { border-left-color: var(--critical); } .prop-muted { opacity: .75; }
.prop-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); } .status-dot.warn { background: var(--warning); } .status-dot.good { background: var(--good); } .status-dot.bad { background: var(--critical); }
.status-label { font-size: 12px; font-weight: 600; } .status-label.warn { color: #b87800; } .status-label.good { color: var(--up); } .status-label.bad { color: var(--down); } .status-label.muted { color: var(--text-3); }
.impact-hoog { color: var(--up); } .impact-laag { color: var(--text-3); }
.prop-why { margin: 6px 0 10px; color: var(--text-2); font-size: 13.5px; }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.diff-col { border-radius: 10px; padding: 10px 12px; font-size: 13px; min-width: 0; }
.diff-col.before { background: color-mix(in srgb, var(--critical) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--critical) 22%, var(--border)); }
.diff-col.after { background: color-mix(in srgb, var(--good) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--good) 25%, var(--border)); }
.diff-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 6px; }
.diff-body { white-space: pre-wrap; word-break: break-word; }
.diff-field { margin-bottom: 8px; } .diff-field textarea { font-size: 13px; background: var(--surface); }
.prop-call { margin-top: 10px; font-size: 12.5px; color: var(--text-3); } .prop-call summary { cursor: pointer; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.prop-call pre { margin-top: 6px; }
.prop-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.tool-modes { display: flex; flex-wrap: wrap; gap: 5px; }
.chip-write { color: #b87800; border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
.card-head h2 { display: flex; align-items: center; gap: 7px; }
@media (max-width: 820px) { .diff { grid-template-columns: 1fr; } }

/* ---------- visual refresh: soft colour, gradients, depth ---------- */
:root { --glow-a: rgba(98, 80, 214, .10); --glow-b: rgba(27, 175, 122, .08); --glow-c: rgba(42, 120, 214, .08); --card-hi: rgba(255,255,255,.7); }
:root[data-theme="dark"] { --glow-a: rgba(123, 97, 255, .16); --glow-b: rgba(27, 175, 122, .09); --glow-c: rgba(57, 135, 229, .12); --card-hi: rgba(255,255,255,.035); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --glow-a: rgba(123, 97, 255, .16); --glow-b: rgba(27, 175, 122, .09); --glow-c: rgba(57, 135, 229, .12); --card-hi: rgba(255,255,255,.035); } }
body { background:
  radial-gradient(900px 520px at 12% -8%, var(--glow-a), transparent 65%),
  radial-gradient(800px 480px at 100% 0%, var(--glow-c), transparent 60%),
  radial-gradient(700px 600px at 70% 110%, var(--glow-b), transparent 60%),
  var(--bg); background-attachment: fixed; }
.sidebar { background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, #7b61ff 8%), var(--surface) 38%); }
.brand b { letter-spacing: -.01em; }
.brand-accent { background: linear-gradient(90deg, #7b61ff, #2a78d6 55%, #1baf7a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo svg { display: block; filter: drop-shadow(0 4px 10px rgba(98, 80, 214, .35)); }
nav a.active { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 18%, transparent), color-mix(in srgb, #7b61ff 8%, transparent)); color: var(--text); position: relative; }
nav a.active::before { content: ''; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: linear-gradient(180deg, #7b61ff, var(--accent)); }
nav a.active .ico { color: var(--accent); }
.topbar { background: color-mix(in srgb, var(--bg) 72%, transparent); }
.card { background: linear-gradient(180deg, var(--card-hi), transparent 120px), var(--surface); }
.btn.primary { background: linear-gradient(135deg, #2a78d6, #6250d6); border-color: transparent; box-shadow: 0 2px 10px -2px rgba(70, 90, 220, .45); }
.btn.primary:hover { filter: brightness(1.08); }
/* KPI tiles: coloured icon chip + tinted corner */
.kpi { position: relative; overflow: hidden; }
.kpi::after { content: ''; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--tone, var(--accent)) 16%, transparent), transparent); pointer-events: none; }
.kpi-ic { width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, transparent); border: 1px solid color-mix(in srgb, var(--tone) 25%, transparent); margin-right: 2px; }
.kpi .label { gap: 8px; }
/* dashboard hero band */
.page-head.hero { padding: 22px 24px; border-radius: 16px; border: 1px solid var(--border);
  background: linear-gradient(120deg, color-mix(in srgb, #7b61ff 14%, var(--surface)), color-mix(in srgb, #2a78d6 10%, var(--surface)) 45%, color-mix(in srgb, #1baf7a 10%, var(--surface))); }
.page-head.hero h1 { font-size: 26px; }
/* project cards: coloured top edge */
.proj-card { border-top: 3px solid var(--pc, var(--accent)); }
.tabs button.active { background: linear-gradient(180deg, transparent 60%, color-mix(in srgb, var(--accent) 8%, transparent)); }
.diff-kv { margin-bottom: 6px; } .diff-kv span { display: block; font-size: 11.5px; color: var(--text-3); }

.user-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: linear-gradient(135deg, #7b61ff, #2a78d6); }
@media (max-width: 820px) { .user-name { display: none; } }
.once { border: 1px dashed color-mix(in srgb, var(--warning) 60%, var(--border)); background: color-mix(in srgb, var(--warning) 8%, var(--surface)); border-radius: 10px; padding: 12px; }
.steps-list { margin: 6px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--text-2); } .steps-list li { margin: 4px 0; }
.span-all { grid-column: 1 / -1; }

/* bottom-left server status */
.sidebar-foot { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.sf-row { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 12.5px; }
.sf-up { color: var(--text-3); }
.sf-meta { color: var(--text-3); } .sf-meta code { font-size: 11px; background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
.sf-meta a { color: var(--text-2); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); animation: pulse 2s infinite; }
.pulse.off { background: var(--critical); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.sf-update { margin-top: 4px; font-weight: 600; color: var(--accent); }
.loc-select { margin-top: 6px; width: 100%; }
