/* SRAC Cache Tracker */
:root {
  color-scheme: light;
  --bg: #eef1f5;
  --panel: #ffffff;
  --panel-2: #f5f7fa;
  --line: #d5dce4;
  --line-2: #e6eaef;
  --ink: #142030;
  --ink-2: #44515e;
  --ink-3: #6b7783;
  --brand: #13335a;
  --brand-2: #1d4a80;
  --brand-ink: #ffffff;
  --accent: #b5892c;
  --focus: #2a78d6;
  --link: #1d5fb0;
  /* statuses (always shown with a label) */
  --st-ok: #23793a;    --st-ok-bg: #e2f3e6;
  --st-dep: #1d5fb0;   --st-dep-bg: #e0ecfa;
  --st-insp: #8a5d00;  --st-insp-bg: #fdf0d2;
  --st-mnt: #9a4a00;   --st-mnt-bg: #fde6d2;
  --st-bad: #b42318;   --st-bad-bg: #fde4e1;
  --st-off: #5f6b77;   --st-off-bg: #e8ebef;
  /* chart series (validated categorical order) */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --grid: #e3e7ec;
  --shadow: 0 12px 40px rgba(16, 28, 45, .18);
  --radius: 8px;
  --side: 224px;
  --top: 56px;
  font-family: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101418; --panel: #181d23; --panel-2: #1f252c; --line: #303841; --line-2: #262d35;
    --ink: #eef2f6; --ink-2: #b9c3cd; --ink-3: #8e99a5; --brand: #0d2441; --brand-2: #1c4878; --link: #7db3f0;
    --st-ok: #6fcf87; --st-ok-bg: #173322; --st-dep: #7db3f0; --st-dep-bg: #15283f; --st-insp: #f0c25a; --st-insp-bg: #3a2c0b;
    --st-mnt: #f4a05a; --st-mnt-bg: #3a2310; --st-bad: #f28b80; --st-bad-bg: #3d1714; --st-off: #a3adb8; --st-off-bg: #262c33;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c; --s7: #9085e9; --s8: #e66767;
    --grid: #2a3139; --shadow: 0 12px 40px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101418; --panel: #181d23; --panel-2: #1f252c; --line: #303841; --line-2: #262d35;
  --ink: #eef2f6; --ink-2: #b9c3cd; --ink-3: #8e99a5; --brand: #0d2441; --brand-2: #1c4878; --link: #7db3f0;
  --st-ok: #6fcf87; --st-ok-bg: #173322; --st-dep: #7db3f0; --st-dep-bg: #15283f; --st-insp: #f0c25a; --st-insp-bg: #3a2c0b;
  --st-mnt: #f4a05a; --st-mnt-bg: #3a2310; --st-bad: #f28b80; --st-bad-bg: #3d1714; --st-off: #a3adb8; --st-off-bg: #262c33;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c; --s7: #9085e9; --s8: #e66767;
  --grid: #2a3139; --shadow: 0 12px 40px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
h1, h2, h3, .cond { font-family: 'Barlow Semi Condensed', 'Barlow', system-ui, sans-serif; font-weight: 600; letter-spacing: .01em; }
h1 { font-size: 24px; margin: 0; line-height: 1.2; }
h2 { font-size: 18px; margin: 0; }
h3 { font-size: 15px; margin: 0; }
a { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hint, small.hint { color: var(--ink-3); font-size: 13px; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 13px; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
[hidden] { display: none !important; }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }

/* ---------- Sign-in ---------- */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, var(--brand) 0%, #0a1c33 100%); }
.signin-card { width: 100%; max-width: 400px; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); padding: 28px 24px; }
.signin-card .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.signin-card .brand img { height: 52px; width: auto; }
.signin-card h1 { font-size: 22px; }
.signin-card p { margin: 0 0 16px; color: var(--ink-2); }

/* ---------- Shell ---------- */
.top { position: sticky; top: 0; z-index: 30; height: var(--top); background: var(--brand); color: var(--brand-ink); display: flex; align-items: center; gap: 12px; padding: 0 16px; padding-top: env(safe-area-inset-top); }
.top .logo { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.top .logo img { height: 34px; width: auto; border-radius: 4px; background: #fff; padding: 2px; }
.top .logo b { font-family: 'Barlow Semi Condensed', sans-serif; font-size: 19px; font-weight: 600; white-space: nowrap; }
.top .logo span { font-size: 12px; opacity: .75; display: block; line-height: 1; }
.top .who { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.top .who .role { background: rgba(255,255,255,.15); border-radius: 99px; padding: 2px 9px; font-weight: 600; text-transform: capitalize; }
.top .tbtn { background: transparent; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 6px; padding: 5px 10px; cursor: pointer; }
.top .tbtn:hover { background: rgba(255,255,255,.1); }
.top .live { width: 8px; height: 8px; border-radius: 50%; background: #6fcf87; box-shadow: 0 0 0 3px rgba(111,207,135,.25); }
.top .live.off { background: #f0c25a; box-shadow: 0 0 0 3px rgba(240,194,90,.25); }
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: calc(100vh - var(--top)); }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow: auto; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a.on { background: var(--brand); color: #fff; }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav .badge { margin-left: auto; background: var(--st-bad); color: #fff; border-radius: 99px; font-size: 12px; padding: 0 7px; font-weight: 600; }
.nav a.on .badge { background: #fff; color: var(--brand); }
.nav hr { border: 0; border-top: 1px solid var(--line-2); margin: 10px 4px; }
.main { min-width: 0; padding: 20px 24px 40px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .sub { color: var(--ink-3); font-size: 14px; margin-top: 2px; }
.crumb { font-size: 13px; color: var(--ink-3); margin-bottom: 4px; }
.crumb a { color: var(--ink-3); }
.bottom-nav { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  html, body { overflow-x: hidden; }
  .side { display: none; }
  .main { padding: 14px 16px calc(84px + env(safe-area-inset-bottom)); }
  .top .who .nm { display: none; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; font-size: 11px; color: var(--ink-3); text-decoration: none; position: relative; }
  .bottom-nav a.on { color: var(--brand-2); font-weight: 600; }
  :root[data-theme="dark"] .bottom-nav a.on { color: var(--link); }
  .bottom-nav svg { width: 22px; height: 22px; }
  .bottom-nav .badge { position: absolute; top: 3px; left: 54%; background: var(--st-bad); color: #fff; border-radius: 99px; font-size: 10px; padding: 0 5px; }
}
@media (max-width: 520px) { .top .logo span { display: none; } h1 { font-size: 21px; } }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 6px; padding: 7px 14px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; min-height: 36px; }
.btn:hover { background: var(--panel-2); border-color: var(--ink-3); }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn.primary:hover { background: var(--brand); }
.btn.danger { color: var(--st-bad); border-color: currentColor; }
.btn.good { background: var(--st-ok); border-color: var(--st-ok); color: #fff; }
:root[data-theme="dark"] .btn.good { color: #08130b; }
.btn.sm { padding: 3px 10px; min-height: 30px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.f > span i { font-weight: 400; font-style: normal; color: var(--ink-3); }
.f input, .f select, .f textarea, .inp { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 8px 10px; min-height: 38px; width: 100%; }
.f textarea { min-height: 76px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus, .inp:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.f.chk { flex-direction: row; align-items: center; gap: 8px; }
.f.chk input { width: 18px; height: 18px; min-height: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
.span2 { grid-column: span 2; } .span3 { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }
.err { color: var(--st-bad); font-size: 14px; min-height: 0; }
.err:empty { display: none; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters .inp, .filters select { width: auto; min-width: 140px; }
.filters .search { flex: 1; min-width: 180px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow-x: auto; max-width: 100%; background: var(--panel); scrollbar-width: none; }
.seg button { flex: none; white-space: nowrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; color: var(--ink-2); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--brand-2); color: #fff; }
.seg .n { opacity: .75; font-size: 12px; margin-left: 4px; }

/* ---------- Cards, KPIs ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card > .hd { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.card > .bd { padding: 14px 16px; }
.card > .bd.flush { padding: 0; }
.cards { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.cols-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.cols-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .cols-2, .cols-even { grid-template-columns: minmax(0, 1fr); } }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: inherit; display: block; }
a.kpi:hover { border-color: var(--ink-3); }
.kpi .l { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.kpi .v { font-family: 'Barlow Semi Condensed', sans-serif; font-size: 34px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 18px; color: var(--ink-3); font-weight: 500; }
.kpi .s { font-size: 13px; color: var(--ink-2); }
.kpi.alert .v { color: var(--st-bad); }
.meter { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; display: flex; gap: 2px; margin-top: 8px; }
.meter i { display: block; height: 100%; }

/* ---------- Status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 1px 9px; font-size: 12.5px; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.st-Available, .st-ok, .st-Approved, .st-Pass, .st-Closed { color: var(--st-ok); background: var(--st-ok-bg); }
.st-Deployed, .st-Out, .st-dep { color: var(--st-dep); background: var(--st-dep-bg); }
.st-Inspection, .st-Pending, .st-soon, .st-Returned { color: var(--st-insp); background: var(--st-insp-bg); }
.st-Maintenance { color: var(--st-mnt); background: var(--st-mnt-bg); }
.st-Out-of-service, .st-overdue, .st-Denied, .st-Fail, .st-Emergency { color: var(--st-bad); background: var(--st-bad-bg); }
.st-Retired, .st-Cancelled, .st-off { color: var(--st-off); background: var(--st-off-bg); }
.tdot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12.5px; color: var(--ink-3); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel); position: sticky; top: 0; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--ink); }
.tbl th .ar { font-size: 10px; margin-left: 3px; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--panel-2); }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl tfoot td { font-weight: 600; border-top: 2px solid var(--line); border-bottom: 0; }
.tbl .id { font-weight: 600; white-space: nowrap; }
.tbl .sub { color: var(--ink-3); font-size: 13px; }
.empty { padding: 24px 16px; color: var(--ink-3); text-align: center; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 16px; border-bottom: 1px solid var(--line-2); }
.list > li:last-child { border-bottom: 0; }
.list > li.click { cursor: pointer; }
.list > li.click:hover { background: var(--panel-2); }
.list .main-t { flex: 1; min-width: 0; }
.list .t { font-weight: 600; }
.list .d { font-size: 13px; color: var(--ink-3); }
.timeline { list-style: none; margin: 0; padding: 0 16px; }
.timeline li { position: relative; padding: 8px 0 8px 22px; border-left: 2px solid var(--line-2); margin-left: 6px; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 13px; width: 12px; height: 12px; border-radius: 50%; background: var(--panel); border: 2px solid var(--ink-3); }
.timeline li.k-out::before { border-color: var(--st-dep); background: var(--st-dep); }
.timeline li.k-in::before { border-color: var(--st-ok); }
.timeline li.k-mnt::before { border-color: var(--st-mnt); background: var(--st-mnt); }
.timeline li.k-bad::before { border-color: var(--st-bad); background: var(--st-bad); }
.timeline .when { font-size: 12.5px; color: var(--ink-3); }

/* ---------- Cache cards ---------- */
.cache-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.cache-card .hd b { font-size: 17px; font-family: 'Barlow Semi Condensed', sans-serif; }
.type-rows { display: grid; gap: 7px; }
.type-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 14px; align-items: center; }
.type-row .bar { grid-column: 1 / -1; height: 6px; display: flex; gap: 2px; border-radius: 99px; overflow: hidden; background: var(--line-2); }
.type-row .bar i { display: block; height: 100%; }

/* ---------- Detail ---------- */
.dl { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.photos .ph { aspect-ratio: 1; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; cursor: pointer; padding: 0; position: relative; }
.photos .ph img { width: 100%; height: 100%; object-fit: cover; }
.photos .ph .x { position: absolute; top: 3px; right: 3px; background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; line-height: 1; }
.docs a { display: block; padding: 4px 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.qr-box { display: flex; gap: 14px; align-items: center; }
.qr-box svg { border: 1px solid var(--line); border-radius: 4px; }
.alert-bar { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.alert-bar.warn { background: var(--st-insp-bg); color: var(--st-insp); }
.alert-bar.bad { background: var(--st-bad-bg); color: var(--st-bad); }
.alert-bar.info { background: var(--st-dep-bg); color: var(--st-dep); }
.check-list { display: grid; gap: 6px; }
.check-list label { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.check-list input { width: 20px; height: 20px; }
.unit-pick { display: grid; gap: 6px; max-height: 340px; overflow: auto; }
.unit-pick label { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.unit-pick label.busy { opacity: .6; }
.unit-pick input { width: 18px; height: 18px; }
.items-ed { display: grid; gap: 8px; }
.items-ed .it { display: grid; grid-template-columns: 1fr 90px 1fr auto; gap: 8px; }
@media (max-width: 640px) { .items-ed .it { grid-template-columns: 1fr 70px; } .items-ed .it select[data-k="cacheId"] { grid-column: 1; } }

/* ---------- Dialog, toast ---------- */
dialog.dlg { border: 0; padding: 0; border-radius: 12px; box-shadow: var(--shadow); background: var(--panel); color: var(--ink); width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 32px); }
dialog.dlg.wide { width: min(920px, calc(100vw - 24px)); }
dialog.dlg::backdrop { background: rgba(10, 18, 30, .55); }
dialog.dlg form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
dialog.dlg header { padding: 16px 20px 10px; border-bottom: 1px solid var(--line-2); }
dialog.dlg header p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
dialog.dlg .d-body { padding: 16px 20px; overflow: auto; display: grid; gap: 12px; }
dialog.dlg footer { padding: 12px 20px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #142030; color: #fff; padding: 10px 18px; border-radius: 8px; box-shadow: var(--shadow); z-index: 100; max-width: calc(100vw - 32px); font-weight: 500; }
.toast.bad { background: var(--st-bad); }
@media (max-width: 860px) { .toast { bottom: calc(80px + env(safe-area-inset-bottom)); } }
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 90; display: grid; place-items: center; padding: 16px; }
.viewer img { max-width: 100%; max-height: 100%; }
.viewer button { position: absolute; top: 14px; right: 14px; }
.loading { padding: 60px 16px; text-align: center; color: var(--ink-3); }
.spin { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--brand-2); border-radius: 50%; animation: sp .8s linear infinite; vertical-align: middle; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- Map ---------- */
.tm { position: relative; overflow: hidden; background: #dfe5ea; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.tm:active { cursor: grabbing; }
.tm-tiles, .tm-labels, .tm-marks { position: absolute; inset: 0; }
.tm-labels, .tm-marks { pointer-events: none; }
.tm-t { position: absolute; left: 0; top: 0; width: 256px; height: 256px; }
:root[data-theme="dark"] .tm:not(.tm-sat) .tm-tiles { filter: brightness(.75) contrast(1.1) saturate(.8); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tm:not(.tm-sat) .tm-tiles { filter: brightness(.75) contrast(1.1) saturate(.8); } }
.tm-m { position: absolute; left: 0; top: 0; pointer-events: auto; border: 0; padding: 0; background: none; cursor: pointer; }
.tm-ctl { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; box-shadow: 0 1px 4px rgba(0,0,0,.3); border-radius: 6px; overflow: hidden; }
.tm-b { width: 34px; height: 34px; border: 0; background: #fff; color: #142030; font-size: 20px; cursor: pointer; border-bottom: 1px solid #d5dce4; }
.tm-b:last-child { border-bottom: 0; }
.tm-base { position: absolute; left: 10px; top: 10px; background: #fff; color: #142030; border: 0; border-radius: 6px; padding: 6px 10px; box-shadow: 0 1px 4px rgba(0,0,0,.3); cursor: pointer; font-weight: 600; font-size: 13px; }
.tm-attr { position: absolute; right: 0; bottom: 0; background: rgba(255,255,255,.8); color: #333; font-size: 10.5px; padding: 1px 6px; }
.pin-cache { transform: translate(-50%, -50%); display: flex; align-items: center; gap: 6px; background: var(--brand); color: #fff; border: 2px solid #fff; border-radius: 8px; padding: 4px 9px 4px 6px; box-shadow: 0 2px 8px rgba(0,0,0,.35); font-weight: 600; font-size: 13px; white-space: nowrap; }
.pin-cache .ic { background: #fff; color: var(--brand); border-radius: 4px; font-size: 11px; padding: 1px 4px; font-weight: 700; }
.tm-low .pin-cache .nm { display: none; }
.pin-cache .ct { font-size: 12px; font-weight: 500; opacity: .9; }
.pin-unit { transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; }
.pin-unit .b { background: var(--pc, #1d5fb0); color: #fff; border: 2px solid #fff; border-radius: 6px; padding: 2px 7px; font-size: 12px; font-weight: 700; box-shadow: 0 2px 8px rgba(0,0,0,.35); white-space: nowrap; }
.pin-unit .b.gps::after { content: ' ●'; color: #9ef0b4; }
.pin-unit .tail { width: 2px; height: 10px; background: #fff; box-shadow: 0 0 2px rgba(0,0,0,.5); }
.pin-req { transform: translate(-50%, -50%); width: 18px; height: 18px; border-radius: 50%; background: var(--st-insp); border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.4); }
.pin-pick { transform: translate(-50%, -100%); font-size: 30px; line-height: 1; color: #d22; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.map-page { display: grid; grid-template-columns: 1fr 340px; gap: 0; height: calc(100vh - var(--top) - 120px); min-height: 460px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.map-page .tm { height: 100%; }
.map-page .mside { border-left: 1px solid var(--line); overflow: auto; }
@media (max-width: 860px) { .map-page { grid-template-columns: 1fr; height: auto; } .map-page .tm { height: 58vh; } .map-page .mside { border-left: 0; border-top: 1px solid var(--line); } }
.map-mini { height: 240px; border-radius: 6px; border: 1px solid var(--line); }
.map-pick { height: 300px; border-radius: 6px; border: 1px solid var(--line); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); padding: 10px 16px; border-bottom: 1px solid var(--line-2); }
.legend span { display: inline-flex; gap: 5px; align-items: center; }

/* ---------- Charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .ax { fill: var(--ink-3); font-size: 11px; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .lbl { fill: var(--ink-2); font-size: 11.5px; }
.chart .val { fill: var(--ink); font-size: 11.5px; font-weight: 600; }
.chart rect.mk:hover, .chart path.mk:hover { opacity: .85; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tip { position: fixed; z-index: 95; pointer-events: none; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 13px; box-shadow: var(--shadow); max-width: 260px; }
.tip b { display: block; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.report-tile { text-align: left; cursor: pointer; padding: 16px; }
.report-tile:hover { border-color: var(--brand-2); }
.report-tile h3 { margin-bottom: 4px; font-size: 16px; }
.report-tile p { margin: 0; color: var(--ink-3); font-size: 13.5px; }
.rpt-section { margin-top: 16px; }
.rpt-section > h3 { margin: 0 0 8px; }
.print-only { display: none; }

/* ---------- Tags (QR labels) ---------- */
.tags { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.tag { border: 1px dashed var(--line); border-radius: 6px; padding: 10px; display: flex; gap: 10px; align-items: center; background: #fff; color: #000; break-inside: avoid; }
.tag .t1 { font-weight: 700; font-size: 17px; font-family: 'Barlow Semi Condensed', sans-serif; }
.tag .t2 { font-size: 12px; }
.tag .t3 { font-size: 10.5px; color: #444; margin-top: 4px; }

/* ---------- Print ---------- */
@media print {
  @page { margin: 12mm; }
  :root { color-scheme: light; --bg: #fff; --panel: #fff; --panel-2: #f5f7fa; --ink: #000; --ink-2: #222; --ink-3: #555; --line: #bbb; --line-2: #ddd; }
  html, body { height: auto !important; overflow: visible !important; }
  body { background: #fff; font-size: 11pt; }
  .shell { min-height: 0; } .crumb { display: none; }
  .tbl-wrap { overflow: visible; }
  .tbl td:first-child { white-space: nowrap; }
  .rpt-section .chart, .kpis { break-inside: avoid; }
  .top, .side, .bottom-nav, .no-print, .filters, .tm-ctl, .tm-base, .toast { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .card { border: 0; break-inside: avoid; }
  .card > .hd { padding: 6px 0; }
  .card > .bd { padding: 6px 0; }
  .print-only { display: block; }
  .tbl th { position: static; }
  .tbl td, .tbl th { padding: 4px 6px; }
  .kpi { border: 1px solid #bbb; }
  .print-head { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid #13335a; padding-bottom: 8px; margin-bottom: 12px; }
  .print-head img { height: 44px; }
  .tags { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .tag { border: 1px solid #999; }
  a { color: inherit; text-decoration: none; }
}
