:root {
  color-scheme: light;
  --page: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #6f6d67;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --series-opt: #2a78d6;   /* loaded / optimized */
  --series-2: #eb6834;     /* empty / uncovered */
  --series-3: #1baf7a;     /* hauling */
  --series-base: #a9a79f;  /* naive dispatch (neutral) */
  --g-dock: #1baf7a;
  --g-wait: #eda100;
  --g-rest: #c9c7bf;
  --good: #0ca30c;
  --good-ink: #006300;
  --bad: #d03b3b;
  --warn: #fab219;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --ink-3: #9a988f;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --shadow: none;
    --accent: #3987e5;
    --series-opt: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-base: #6b6a64;
    --g-dock: #199e70;
    --g-wait: #c98500;
    --g-rest: #4a4945;
    --good-ink: #0ca30c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --ink-3: #9a988f;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --shadow: none;
  --accent: #3987e5;
  --series-opt: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-base: #6b6a64;
  --g-dock: #199e70;
  --g-wait: #c98500;
  --g-rest: #4a4945;
  --good-ink: #0ca30c;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 18px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; margin-top: 18px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.hint { color: var(--ink-3); font-size: 12.5px; margin: 2px 0 10px; }
button, input, select { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------- top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 1200;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 34px; height: 34px; padding: 6px; border-radius: 9px; background: var(--accent); color: #fff; flex: none; }
.sub { margin: 0; color: var(--ink-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 9px; padding: 8px 14px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 550; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.ghost { background: transparent; }
.icon-btn { padding: 8px; }
.status-pill { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }

/* ------------------------------------------------------------- KPIs */
.kpis {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
  padding: 18px 24px 6px;
}
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); min-width: 0;
}
.kpi.hero { grid-column: span 2; background: linear-gradient(135deg, var(--surface) 55%, color-mix(in srgb, var(--accent) 10%, var(--surface))); }
.kpi .label { color: var(--ink-2); font-size: 12.5px; font-weight: 550; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 26px; font-weight: 680; margin-top: 4px; letter-spacing: -0.02em; }
.kpi.hero .value { font-size: 36px; }
.kpi .cmp { font-size: 12px; color: var(--ink-3); margin-top: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kpi .help { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.delta { font-weight: 650; display: inline-flex; align-items: center; gap: 3px; }
.delta.good { color: var(--good-ink); }
.delta.bad { color: var(--bad); }
.check { color: var(--good-ink); font-weight: 700; }

/* ------------------------------------------------------------- tabs */
.tabs {
  display: flex; gap: 4px; padding: 10px 24px 0; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--border);
}
.tab {
  border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--ink-2); font-weight: 560;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab .count { font-size: 11px; background: var(--surface-2); padding: 1px 7px; border-radius: 99px; margin-left: 4px; color: var(--ink-2); }

main { padding: 18px 24px 40px; }
.panel-view { display: none; }
.panel-view.active { display: block; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); min-width: 0;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }

/* ------------------------------------------------------------- overview */
.overview-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 14px; }
.overview-grid > .card:nth-child(3), .overview-grid > .card:nth-child(4) { grid-column: span 1; }
.side-charts { display: flex; flex-direction: column; gap: 14px; }
.side-charts .card { flex: 1; }
.map-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.map-card .card-head { padding: 16px 16px 6px; }
.map-wrap { position: relative; flex: 1; min-height: 520px; }
.map { position: absolute; inset: 0; background: var(--surface-2); }
.map-legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 500; display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border);
  padding: 8px 12px; border-radius: 10px; font-size: 12.5px; backdrop-filter: blur(6px); max-width: calc(100% - 24px);
}
.map-legend label, .map-legend span { display: inline-flex; align-items: center; gap: 6px; cursor: default; }
.map-legend label { cursor: pointer; }
.legend-note { color: var(--ink-3); }
.sw { display: inline-block; width: 18px; height: 4px; border-radius: 2px; vertical-align: middle; }
.sw.loaded { background: var(--series-opt); }
.sw.empty { background: repeating-linear-gradient(90deg, var(--series-2) 0 5px, transparent 5px 8px); }
.sw.dashed { height: 0; border-top: 2px dashed; background: none; }
.sw.hatch { height: 10px; background: repeating-linear-gradient(135deg, var(--g-rest) 0 3px, transparent 3px 6px); border: 1px solid var(--g-rest); }
.legend-inline { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.legend-inline .sw { width: 12px; height: 12px; border-radius: 3px; }
.legend-inline .sw.dashed { width: 16px; height: 0; border-radius: 0; }
.chart-box { position: relative; height: 230px; }
.chart-box.tall { height: 470px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; }
.seg-btn { border: 0; background: none; padding: 6px 12px; border-radius: 7px; cursor: pointer; font-weight: 550; color: var(--ink-2); font-size: 13px; }
.seg-btn.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

/* leaflet tweaks */
.leaflet-container { font: inherit; background: var(--surface-2); }
.stop-marker, .home-marker {
  display: grid; place-items: center; border-radius: 50%; font-weight: 700; font-size: 11px;
  border: 2px solid var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}
.stop-marker { background: var(--ink); color: var(--surface); }
.home-marker { background: var(--accent); color: #fff; border-radius: 7px; font-size: 14px; }
.home-dot, .stop-dot {
  display: inline-grid; place-items: center; width: 18px; height: 18px; font-size: 10px; font-weight: 700;
  border-radius: 50%; background: var(--ink); color: var(--surface);
}
.home-dot { background: var(--accent); color: #fff; border-radius: 5px; font-size: 12px; }

/* ------------------------------------------------------------- trucks */
.trucks-grid { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 14px; align-items: start; }
.truck-list-card { padding: 0; display: flex; flex-direction: column; height: calc(100vh - 300px); min-height: 560px; position: sticky; top: 80px; }
.filters { padding: 14px 14px 4px; border-bottom: 1px solid var(--border); }
.filters input[type=search], .filter-row select, .filter-row input {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2);
}
.filter-row { display: flex; gap: 8px; margin-top: 8px; }
.filter-row.wide { margin: 14px 0 10px; flex-wrap: wrap; }
.filter-row.wide input { flex: 2 1 220px; }
.filter-row.wide select { flex: 1 1 140px; width: auto; }
.truck-list { overflow-y: auto; flex: 1; padding: 6px; }
.truck-row {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent;
}
.truck-row:hover { background: var(--surface-2); }
.truck-row.selected { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.truck-row .tid { font-weight: 650; }
.truck-row .meta { color: var(--ink-3); font-size: 12px; grid-column: 1 / -1; }
.truck-row .loads { font-size: 12px; color: var(--ink-2); text-align: right; }
.mini-bar { grid-column: 1 / -1; display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--surface-2); margin-top: 4px; gap: 2px; }
.mini-bar .l { background: var(--series-opt); }
.mini-bar .e { background: var(--series-2); }
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px;
  background: var(--surface-2); color: var(--ink-2);
}
.badge.good { color: var(--good-ink); background: color-mix(in srgb, var(--good) 14%, transparent); }
.badge.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.badge.crit { color: var(--bad); }
.badge.cap { text-transform: capitalize; }
.truck-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.truck-main .map-wrap { min-height: 380px; }
.empty-state { color: var(--ink-3); padding: 30px; text-align: center; }
.detail-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.detail-head h2 { font-size: 20px; }
.detail-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 14px 0; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.stat .k { font-size: 12px; color: var(--ink-3); }
.stat .v { font-size: 18px; font-weight: 650; }

/* gantt */
.gantt { margin-top: 6px; }
.gantt svg { width: 100%; display: block; stroke: none; }
.gantt .day-label { fill: var(--ink-2); font-size: 11px; font-weight: 600; }
.gantt .tick { fill: var(--ink-3); font-size: 10px; font-variant-numeric: tabular-nums; }
.gantt .gridline { stroke: var(--grid); stroke-width: 1; }
.gantt .lane-bg { fill: var(--surface-2); }
.gantt rect.ev { cursor: default; }
.gantt rect.ev:hover { opacity: .8; }

/* tables */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.data-table td { padding: 9px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tr:hover td { background: var(--surface-2); }
.lane { white-space: nowrap; }
.lane .arrow { color: var(--ink-3); margin: 0 4px; }
.sub-line { color: var(--ink-3); font-size: 12px; }
.why { max-width: 420px; color: var(--ink-2); }

.reason-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 10px; }
.reason { text-align: left; background: var(--surface-2); border: 1px solid transparent; border-radius: 10px; padding: 12px 14px; cursor: pointer; }
.reason:hover { border-color: var(--border); }
.reason.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.reason .n { font-size: 22px; font-weight: 680; }
.reason .t { font-weight: 600; }
.reason .d { font-size: 12px; color: var(--ink-3); }

/* how it works */
.how-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.prose { font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.prose h2 { color: var(--ink); margin-bottom: 6px; }
.prose b, .prose strong { color: var(--ink); }
.checks { list-style: none; padding: 0; }
.checks li { padding-left: 26px; position: relative; margin: 8px 0; }
.checks li::before { content: "✓"; position: absolute; left: 4px; color: var(--good-ink); font-weight: 700; }
.steps { padding-left: 20px; }
.steps li { margin: 8px 0; }
.legend-list { display: flex; flex-direction: column; gap: 8px; }
.legend-list span { display: flex; align-items: center; gap: 10px; }
.legend-list .sw { width: 26px; height: 10px; }

/* drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 1500; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: var(--surface); z-index: 1600;
  border-left: 1px solid var(--border); padding: 20px; overflow-y: auto; transform: translateX(105%); transition: transform .22s ease;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.field { margin: 18px 0; }
.field label { display: flex; justify-content: space-between; font-weight: 600; gap: 10px; }
.field output { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.field input[type=range] { width: 100%; margin-top: 8px; accent-color: var(--accent); }
.field.toggle label { justify-content: flex-start; gap: 8px; font-weight: 550; cursor: pointer; }
.field.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.field .hint { margin-top: 4px; }
.drawer-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; position: sticky; bottom: -20px; background: var(--surface); padding: 12px 0; }

/* progress */
.progress-toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 1700; width: min(460px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .2);
}
.progress-text { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 8px; }
.progress-text span { color: var(--ink-3); }
.bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar .fill { height: 100%; width: 0; background: var(--accent); transition: width .4s ease; }

.tooltip {
  position: fixed; z-index: 2000; pointer-events: none; background: var(--ink); color: var(--surface);
  font-size: 12px; padding: 6px 9px; border-radius: 7px; max-width: 280px; line-height: 1.4;
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .overview-grid { grid-template-columns: 1fr; }
  .chart-box.tall { height: 420px; }
  .how-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .topbar { padding: 12px 16px; flex-wrap: wrap; position: static; }
  .kpis { padding: 14px 16px 4px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi.hero { grid-column: span 2; }
  .kpi .value { font-size: 22px; }
  .kpi.hero .value { font-size: 30px; }
  .tabs { padding: 8px 16px 0; }
  main { padding: 14px 16px 32px; }
  .trucks-grid { grid-template-columns: 1fr; }
  .truck-list-card { position: static; height: 420px; min-height: 0; }
  .map-wrap { min-height: 400px; }
}
@media (max-width: 480px) {
  .btn.primary { padding: 8px 10px; }
  .kpi .help { display: none; }
}

/* ------------------------------------------------------------- data assistant */
.chat-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 1400; display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 12px 18px; background: var(--accent); color: #fff; font-weight: 600;
  cursor: pointer; box-shadow: 0 6px 24px rgba(0, 0, 0, .22);
}
.chat-fab svg { width: 18px; height: 18px; }
.chat-fab:hover { filter: brightness(1.08); }
.chat-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 1450; width: min(430px, calc(100vw - 32px));
  height: min(680px, calc(100vh - 110px)); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .25); opacity: 0; transform: translateY(16px) scale(.98);
  pointer-events: none; transition: opacity .18s ease, transform .18s ease;
}
.chat-panel.open { opacity: 1; transform: none; pointer-events: auto; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border); }
.chat-title { font-weight: 650; font-size: 15px; }
.chat-sub { font-size: 12px; color: var(--ink-3); }
.chat-actions { display: flex; gap: 2px; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.msg { max-width: 92%; font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: var(--surface-2); padding: 10px 13px; border-radius: 14px 14px 14px 4px; max-width: 100%; }
.msg.bot .body > :first-child { margin-top: 0; }
.msg.bot .body > :last-child { margin-bottom: 0; }
.msg.bot p { margin: 0 0 8px; }
.msg.bot ul, .msg.bot ol { margin: 4px 0 8px; padding-left: 20px; }
.msg.bot li { margin: 2px 0; }
.msg.bot h1, .msg.bot h2, .msg.bot h3, .msg.bot h4 { font-size: 13.5px; margin: 10px 0 4px; text-transform: none; letter-spacing: 0; color: var(--ink); }
.msg.bot table { border-collapse: collapse; margin: 6px 0 10px; font-size: 12.5px; display: block; overflow-x: auto; max-width: 100%; }
.msg.bot th, .msg.bot td { border-bottom: 1px solid var(--grid); padding: 4px 8px; text-align: left; white-space: nowrap; }
.msg.bot th { color: var(--ink-3); font-weight: 600; }
.msg.bot code { font-size: 12px; background: var(--surface); padding: 1px 4px; border-radius: 4px; }
.msg.bot a.ent { color: var(--accent); font-weight: 600; text-decoration: none; border-bottom: 1px dashed currentColor; }
.msg.bot a.ent:hover { border-bottom-style: solid; }
.steps { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.steps:empty { display: none; }
.step { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.step::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; animation: pulse 1s ease-in-out infinite; }
.steps.done .step::before { animation: none; background: var(--good); }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: pulse 1.2s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .step::before, .typing i { animation: none; } .chat-panel { transition: none; } }
.chat-welcome { padding: 6px 2px; }
.chat-welcome-title { font-weight: 650; font-size: 15px; margin-bottom: 4px; }
.chat-welcome p { color: var(--ink-2); font-size: 13px; margin: 0 0 12px; }
.chips { display: flex; flex-direction: column; gap: 6px; }
.chip {
  text-align: left; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px;
  padding: 8px 11px; font-size: 13px; cursor: pointer; color: var(--ink);
}
.chip:hover { border-color: var(--accent); }
.chat-setup { background: var(--surface-2); border-radius: 12px; padding: 14px; font-size: 13px; color: var(--ink-2); }
.chat-setup b { color: var(--ink); }
.chat-setup pre { background: var(--surface); border: 1px solid var(--border); padding: 8px 10px; border-radius: 8px; font-size: 12px; overflow-x: auto; }
.chat-setup code { font-size: 12px; }
.chat-notice { align-self: center; font-size: 11.5px; color: var(--ink-3); text-align: center; padding: 2px 10px; }
.chat-error { color: var(--bad); margin: 0; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 4px; border-top: 1px solid var(--border); }
.chat-form textarea {
  flex: 1; resize: none; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px;
  padding: 9px 11px; font: inherit; font-size: 13.5px; line-height: 1.4; max-height: 140px; color: var(--ink);
}
.chat-form textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; }
.chat-form .btn { padding: 9px; border-radius: 10px; }
.chat-foot { margin: 0; padding: 4px 14px 10px; font-size: 11px; color: var(--ink-3); }
@media (max-width: 820px) {
  .chat-fab { right: 16px; bottom: 16px; }
  .chat-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; }
}

[hidden] { display: none !important; }
