/* ───────────────────────────── tokens ───────────────────────────── */
:root {
  color-scheme: light;
  --page: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f7f7f5;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #898781;
  --line: #e1e0d9;
  --line-2: #c3c2b7;
  --accent: #1f2937;          /* UI の操作色。データ色（車両色）とは分けて中立にする */
  --accent-ink: #ffffff;
  --cta: #4a3aa7;             /* 主操作（配車計画を作成）。車両色・状態色のどれとも被らない紫 */
  --cta-hover: #3b2d8f;
  --focus: #2a78d6;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --good-bg: #edf8ed;
  --warning-bg: #fff6e0;
  --critical-bg: #fdeeee;
  --wait: #d9d8d2;            /* 待機（中立） */
  --break: #52514e;           /* 休憩（中立・ハッチ） */
  --shadow: 0 1px 2px rgba(11, 11, 11, .06), 0 4px 12px rgba(11, 11, 11, .06);
  --radius: 10px;
  --radius-s: 6px;
  --header-h: 56px;
  --panel-w: 420px;
  --timeline-h: 200px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--page); color: var(--ink); font-size: 13px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ───────────────────────────── layout ───────────────────────────── */
.app { display: grid; grid-template-rows: var(--header-h) 1fr; height: 100vh; }
.header { display: flex; align-items: center; gap: 16px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 20; }
.brand { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.brand h1 { font-size: 16px; font-weight: 700; }
.brand .tag { font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.header .spacer { flex: 1; }
.header .links { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); }
.header .links a { text-decoration: none; }
.header .links a:hover { text-decoration: underline; }

.body { display: grid; grid-template-columns: var(--panel-w) minmax(0, 1fr); min-height: 0; min-width: 0; }
.panel { display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); min-height: 0; min-width: 0; }
.stage { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; min-width: 0; position: relative; }
.map-wrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; }

/* ───────────────────────────── controls ───────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: #111827; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; font-weight: 500; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-icon { width: 28px; height: 28px; padding: 0; justify-content: center; border-color: transparent; background: transparent; color: var(--ink-3); border-radius: 50%; }
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }
.btn .spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.btn-cta { height: 42px; padding: 0 20px 0 18px; gap: 8px; font-size: 14px; font-weight: 700; color: #fff; background: var(--cta); border-color: var(--cta); border-radius: 10px; box-shadow: 0 2px 10px rgba(74, 58, 167, .35); transition: transform .1s, box-shadow .15s, background .15s; }
.btn-cta:hover { background: var(--cta-hover); box-shadow: 0 4px 14px rgba(74, 58, 167, .45); transform: translateY(-1px); }
.btn-cta:active { transform: translateY(0); box-shadow: 0 1px 4px rgba(74, 58, 167, .35); }
.btn-cta:disabled { opacity: 1; background: #8a80c9; border-color: #8a80c9; box-shadow: none; transform: none; }
.btn-cta .cta-icon { font-size: 10px; opacity: .9; }
.btn-cta kbd { font: 600 10px/1 system-ui, sans-serif; color: rgba(255,255,255,.75); background: rgba(255,255,255,.16); border-radius: 4px; padding: 3px 5px; margin-left: 2px; }
.btn-cta .spinner { border-color: rgba(255,255,255,.35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11px; color: var(--ink-3); }
.input, select.input, textarea.input { height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); width: 100%; }
.input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(42, 120, 214, .15); }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.45; }
.input-sm { height: 28px; padding: 0 8px; font-size: 12px; }
input[type="time"].input { padding: 0 6px; }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; background: var(--surface); }
.segmented button { height: 32px; padding: 0 10px; border: none; background: transparent; color: var(--ink-2); font-size: 12px; border-left: 1px solid var(--line); }
.segmented button:first-child { border-left: none; }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); cursor: pointer; user-select: none; }
.switch input { accent-color: var(--accent); width: 14px; height: 14px; }

.select-wrap { position: relative; }
.select-wrap select { appearance: none; padding-right: 26px; }
.select-wrap::after { content: ""; position: absolute; right: 10px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: translateY(-70%) rotate(45deg); pointer-events: none; }

/* ───────────────────────────── panel tabs ───────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 8px; }
.tab { position: relative; height: 40px; padding: 0 12px; border: none; background: transparent; color: var(--ink-3); font-weight: 600; }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--ink); border-radius: 2px 2px 0 0; }
.tab .count { display: inline-block; margin-left: 5px; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 11px; font-weight: 600; text-align: center; }
.tab .count:empty { display: none; }
.tab .count.alert { background: var(--critical-bg); color: var(--critical); }
.tabpanel { flex: 1; overflow-y: auto; min-height: 0; }
.tabpanel[hidden] { display: none; }

.section { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.section-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-hd h2 { font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--ink-2); }
.section-hd .actions { display: flex; gap: 6px; }
.hint { font-size: 11px; color: var(--ink-3); }

/* ───────────────────────────── vehicles ───────────────────────────── */
.vehicle { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px 10px; margin-bottom: 8px; background: var(--surface); }
.vehicle .row1 { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 8px; margin-bottom: 4px; }
.vehicle .row2 { display: grid; grid-template-columns: 1fr; gap: 8px; }
.vehicle .row3 { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; margin-top: 6px; }
.chip { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.vehicle .name { font-weight: 700; border: none; background: transparent; padding: 0; height: 24px; }
.vehicle .name:focus { border-bottom: 1px solid var(--focus); outline: none; box-shadow: none; }

/* ───────────────────────────── jobs list ───────────────────────────── */
.jobs { border-top: 1px solid var(--line); }
.job { padding: 6px 0 7px; border-bottom: 1px solid var(--line); }
.job:hover { background: var(--surface-2); }
.job-l1 { display: grid; grid-template-columns: 22px 92px 1fr 28px; gap: 6px; align-items: center; }
.job-l1 .idx { color: var(--ink-3); font-size: 11px; text-align: right; }
.job-l2 { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding-left: 24px; margin-top: 3px; font-size: 11px; color: var(--ink-3); }
.job-l2 label { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.job-l2 .input-sm { height: 24px; padding: 0 4px; font-size: 11px; border-color: transparent; background: transparent; }
.job-l2 .input-sm:hover, .job-l2 .input-sm:focus { border-color: var(--line); background: var(--surface); }
.job-l2 input[type="number"] { width: 44px; text-align: right; }
.job-l2 input[type="time"] { width: 60px; }
.job-l2 input[type="time"]::-webkit-calendar-picker-indicator { display: none; }
.job-l1 .input-sm[data-field="id"] { border-color: transparent; background: transparent; font-weight: 600; }
.job-l1 .input-sm[data-field="location"] { border-color: transparent; background: transparent; color: var(--ink-2); }
.job-l1 .input-sm:hover { border-color: var(--line); }
.job-l1 .input-sm:focus { border-color: var(--focus); background: var(--surface); }
.jobs-toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.empty-inline { padding: 18px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ───────────────────────────── results ───────────────────────────── */
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); font-size: 13px; line-height: 1.55; }
.banner .ic { flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; }
.banner.ok { background: var(--good-bg); color: #145214; }
.banner.ok .ic { background: var(--good); }
.banner.partial { background: var(--warning-bg); color: #6b4a00; }
.banner.partial .ic { background: var(--warning); color: #3d2a00; }
.banner.error { background: var(--critical-bg); color: #7a1f1f; }
.banner.error .ic { background: var(--critical); }
.banner .title { font-weight: 700; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.kpi { background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; }
.kpi .label { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.kpi .value { font-size: 22px; font-weight: 700; line-height: 1.2; margin-top: 2px; }
.kpi .value small { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 2px; }
.kpi.alert .value { color: var(--critical); }

.vcard { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; background: var(--surface); overflow: hidden; transition: box-shadow .15s, border-color .15s; }
.vcard.is-selected { border-color: var(--ink); box-shadow: var(--shadow); }
.vcard.is-dim { opacity: .5; }
.vcard-hd { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: center; padding: 10px 12px; cursor: pointer; }
.vcard-hd:hover { background: var(--surface-2); }
.vcard-hd .name { font-weight: 700; }
.vcard-hd .meta { font-size: 11px; color: var(--ink-2); display: flex; gap: 8px; flex-wrap: wrap; }
.vcard-hd .jobs-n { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.vcard-hd .caret { width: 8px; height: 8px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(45deg); transition: transform .15s; }
.vcard.is-open .vcard-hd .caret { transform: rotate(-135deg); }
.steps { display: none; border-top: 1px solid var(--line); padding: 6px 12px 8px; }
.vcard.is-open .steps { display: block; }
.step { display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; align-items: center; padding: 5px 4px; border-radius: var(--radius-s); font-size: 12px; }
.step:hover, .step.is-hover { background: var(--surface-2); }
.step .no { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; background: var(--ink-3); }
.step .no.job { background: var(--vcolor); }
.step .no.depot { background: var(--ink); border-radius: 4px; }
.step .no.break { background: var(--break); }
.step .what { display: flex; flex-direction: column; }
.step .what .sub { font-size: 11px; color: var(--ink-3); }
.step .time { font-size: 11px; color: var(--ink-2); text-align: right; white-space: nowrap; }
.step .time .wait { color: var(--ink-3); }

.list-item { display: flex; gap: 10px; padding: 8px 10px; border-radius: var(--radius-s); background: var(--surface-2); margin-bottom: 6px; font-size: 12px; }
.list-item .ic { flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; }
.list-item.critical .ic { background: var(--critical); }
.list-item.warning .ic { background: var(--warning); color: #3d2a00; }
.list-item.info .ic { background: var(--ink-3); }
.list-item .t { font-weight: 700; }
.list-item .d { color: var(--ink-2); }
.hintchips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.hintchip { font-size: 11px; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; background: var(--surface); }

.meta-line { font-size: 11px; color: var(--ink-3); display: flex; gap: 10px; flex-wrap: wrap; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-3); }
.empty svg { width: 44px; height: 44px; opacity: .35; margin-bottom: 10px; }
.empty p { font-size: 13px; line-height: 1.6; }

/* ───────────────────────────── developer details ───────────────────────────── */
details.dev { border-top: 1px solid var(--line); }
details.dev summary { list-style: none; cursor: pointer; padding: 10px 16px; font-size: 11px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
details.dev summary::-webkit-details-marker { display: none; }
details.dev summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(-45deg); transition: transform .15s; }
details.dev[open] summary::before { transform: rotate(45deg); }
details.dev summary:hover { color: var(--ink); background: var(--surface-2); }
details.dev .dev-body { padding: 0 16px 14px; }
details.dev .dev-body .hint { margin-bottom: 8px; }
details.dev .dev-body code { font-family: ui-monospace, Menlo, monospace; font-size: 11px; background: var(--surface-2); padding: 1px 4px; border-radius: 3px; }

/* ───────────────────────────── json ───────────────────────────── */
.json-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.code { background: #1f2426; color: #e6e6e1; border-radius: var(--radius); padding: 10px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; line-height: 1.5; overflow: auto; white-space: pre; }
textarea.code { width: 100%; min-height: 260px; resize: vertical; border: 1px solid transparent; }
textarea.code:focus { outline: none; border-color: var(--focus); }

/* ───────────────────────────── map overlays ───────────────────────────── */
.map-tools { position: absolute; top: 10px; right: 10px; z-index: 800; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.map-tools .card { background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: var(--radius-s); box-shadow: var(--shadow); padding: 6px 10px; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.map-tools .card .btn-sm { height: 26px; }
.legend { position: absolute; left: 10px; bottom: 10px; z-index: 800; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: var(--radius-s); box-shadow: var(--shadow); padding: 8px 10px; display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 11px; color: var(--ink-2); max-width: 60%; }
.legend .li { display: inline-flex; align-items: center; gap: 5px; }
.legend .sw { width: 10px; height: 10px; border-radius: 50%; }
.legend .sw.depot { border-radius: 2px; background: var(--ink); }
.legend .sw.unassigned { background: #fff; border: 2px solid var(--critical); }
.legend .sw.brk { background: var(--break); }
.legend .ln { width: 18px; height: 3px; border-radius: 2px; }
.legend .li.is-hidden { opacity: .4; text-decoration: line-through; }
.legend button.li { border: none; background: none; padding: 0; cursor: pointer; font: inherit; color: inherit; }

.mk { display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 11px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); transition: transform .12s; }
.mk.job { width: 26px; height: 26px; border-radius: 50%; }
.mk.depot { width: 26px; height: 26px; border-radius: 6px; background: var(--ink); font-size: 10px; }
.mk.draft { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--ink-2); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.mk.unassigned { width: 26px; height: 26px; border-radius: 50%; background: #fff; color: var(--critical); border: 2px solid var(--critical); }
.mk.brk { width: 18px; height: 18px; border-radius: 50%; background: var(--break); font-size: 9px; }
.mk.is-hover, .mk.is-hover-target { transform: scale(1.35); z-index: 10; }
.mk.is-dim { opacity: .35; }
.leaflet-popup-content { font-size: 12px; line-height: 1.5; margin: 10px 12px; }
.leaflet-popup-content .pt { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.leaflet-popup-content .pr { color: var(--ink-2); }
.leaflet-container { font-family: inherit; }
.leaflet-bar a { color: var(--ink); }

/* ───────────────────────────── timeline ───────────────────────────── */
.timeline { background: var(--surface); border-top: 1px solid var(--line); height: var(--timeline-h); max-height: 42vh; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.timeline.is-collapsed { height: 38px; }
.timeline-hd { display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 12px; flex-shrink: 0; }
.timeline-hd h2 { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.timeline-hd .tl-legend { margin-left: auto; display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
.timeline-hd .tl-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.timeline-hd .tl-legend .note { color: var(--ink-3); padding-right: 6px; border-right: 1px solid var(--line); }
.timeline-hd .tl-legend i { width: 22px; height: 12px; border-radius: 3px; display: inline-block; box-sizing: border-box; }
.timeline-hd .tl-legend i.drive { background: #2a78d6; }
.timeline-hd .tl-legend i.svc { background: rgba(42, 120, 214, .45); border: 1px solid #2a78d6; }
.timeline-hd .tl-legend i.wait { background: var(--wait); }
.timeline-hd .tl-legend i.brk { background: repeating-linear-gradient(135deg, var(--break) 0 2px, #fff 2px 4px); border: 1px solid var(--break); }
.timeline-hd .tl-legend i.tw { width: 22px; height: 8px; border-radius: 0; border-top: 2px solid var(--ink-3); border-left: 2px solid var(--ink-3); border-right: 2px solid var(--ink-3); }
@media (max-width: 1180px) { .timeline-hd .tl-legend .note { display: none; } .timeline-hd .tl-legend { gap: 10px; padding: 4px 10px; } }
.timeline-body { flex: 1; overflow: auto; min-height: 0; }
.timeline.is-collapsed .timeline-body { display: none; }
.tl-svg { display: block; }
.tl-svg text { font-family: inherit; }
.tl-row-label { font-size: 11px; font-weight: 600; fill: var(--ink); }
.tl-tick { font-size: 10px; fill: var(--ink-3); }
.tl-grid { stroke: var(--line); stroke-width: 1; }
.tl-seg { cursor: default; }
.tl-seg.is-hover { stroke: var(--ink); stroke-width: 1.5; }
.tl-row.is-dim { opacity: .35; }
.tl-label { font-size: 10px; fill: #fff; pointer-events: none; }
.tl-label.dark { fill: var(--ink); }
.tl-tw { stroke: var(--ink-3); stroke-width: 2; }
.tl-now { stroke: var(--critical); stroke-width: 1; stroke-dasharray: 3 3; }

.tooltip { position: fixed; z-index: 2000; pointer-events: none; background: var(--ink); color: #fff; padding: 6px 9px; border-radius: 6px; font-size: 11px; line-height: 1.45; box-shadow: var(--shadow); max-width: 260px; display: none; }
.tooltip .t { font-weight: 700; }
.tooltip .d { color: rgba(255,255,255,.75); }

/* ───────────────────────────── progress / toast ───────────────────────────── */
.progress { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 900; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); padding: 8px 16px; display: none; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; }
.progress.is-on { display: inline-flex; }
.progress .bar { width: 80px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.progress .bar i { display: block; width: 40%; height: 100%; background: var(--accent); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

.modal-bg { position: fixed; inset: 0; background: rgba(11,11,11,.35); z-index: 3000; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-bg.is-on { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); width: min(560px, 100%); padding: 18px 20px; }
.modal h3 { font-size: 15px; margin-bottom: 6px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

.footer-note { position: absolute; right: 8px; bottom: 6px; z-index: 800; font-size: 10px; color: var(--ink-3); background: rgba(255,255,255,.85); padding: 2px 6px; border-radius: 4px; }
.footer-note a { color: var(--ink-2); }

/* ───────────────────────────── responsive ───────────────────────────── */
@media (max-width: 960px) {
  .app { height: auto; min-height: 100vh; grid-template-rows: auto 1fr; }
  .header { flex-wrap: wrap; height: auto; padding: 10px 12px; gap: 10px; }
  .header .links { display: none; }
  .btn-cta { width: 100%; justify-content: center; }
  .btn-cta kbd { display: none; }
  .body { grid-template-columns: 1fr; grid-template-rows: auto auto; }
  .stage { order: -1; grid-template-rows: 46vh auto; }
  .panel { border-right: none; border-top: 1px solid var(--line); }
  .tabpanel { overflow: visible; }
  :root { --timeline-h: 170px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .legend { max-width: 70%; }
}
