/* ZeroCheck — zero consumption field checks, supervisor dashboard */
:root {
  color-scheme: light;
  --navy: #0f3d3e; --amber: #f5a524; --amber-d: #c77f00; --red: #d92d20; --red-bg: #fef3f2; --green-bg: #ecfdf3;
  --page: #f4f6f9; --surface: #fcfcfb; --card: #ffffff;
  --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --line: #dde3ea; --ring: rgba(11,11,11,.10);
  --good: #0ca30c; --good-ink: #006300; --warn: #fab219; --crit: #d03b3b;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
  --other: #9a9890;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --card: #161615;
    --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --line: #2c2c2a; --ring: rgba(255,255,255,.10);
    --good-ink: #0ca30c;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --other: #6d6b65;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --card: #161615;
  --ink: #ffffff; --ink-2: #c3c2b7; --grid: #2c2c2a; --axis: #383835; --line: #2c2c2a; --ring: rgba(255,255,255,.10);
  --good-ink: #0ca30c;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --other: #6d6b65;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--page); color: var(--ink); font-size: 14px; line-height: 1.45; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; }
h2 { font-size: 15px; }
.sub { color: var(--ink-2); font-size: 13px; }
code { font-family: ui-monospace, Consolas, monospace; background: var(--page); padding: 2px 6px; border-radius: 6px; }

.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; padding: 8px 14px; cursor: pointer; }
.btn:hover { border-color: var(--axis); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #1d1300; }
.btn.primary:hover { background: var(--amber-d); border-color: var(--amber-d); }
.btn.ghost { background: transparent; }
.btn.small { padding: 3px 9px; font-size: 13px; }
.btn.danger { color: var(--crit); }
input, select { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
input:focus, select:focus { outline: 2px solid var(--s1); outline-offset: 1px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--navy); padding: 16px; }
.login-card { background: var(--card); border-radius: 18px; padding: 28px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-logo { width: 64px; height: 64px; margin: 0 auto; }
.login-card h1 { font-size: 22px; letter-spacing: 2px; }
.login-card h1 span { display: block; font-size: 11px; letter-spacing: 1.6px; color: var(--amber-d); }
.login-card p { margin: 0; color: var(--ink-2); }
.login-card label { text-align: left; display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.err { color: var(--crit); min-height: 1.2em; font-size: 13px; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 800; display: flex; align-items: center; gap: 18px; padding: 10px 20px; background: var(--navy); color: #fff; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 38px; height: 38px; }
.brand b { display: block; letter-spacing: 2px; font-size: 18px; line-height: 1.05; }
.brand span { font-size: 11px; color: var(--amber); letter-spacing: 1px; font-weight: 700; }
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tabs button { font: inherit; font-weight: 600; background: none; border: 0; color: #b7d3d3; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.tabs button.on { background: rgba(255,255,255,.12); color: #fff; }
.top .btn.ghost { color: #fff; border-color: rgba(255,255,255,.3); }

.filters { display: flex; gap: 10px 16px; align-items: flex-end; flex-wrap: wrap; padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 58px; z-index: 700; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { font: inherit; background: none; border: 0; padding: 7px 11px; cursor: pointer; color: var(--ink-2); border-right: 1px solid var(--line); white-space: nowrap; flex: none; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--navy); color: #fff; font-weight: 600; }
.f { display: flex; flex-direction: column; font-size: 12px; color: var(--ink-2); gap: 2px; }
.refresh { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.live { background: var(--good); }

main { padding: 16px 20px 40px; max-width: 1500px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 0 0 16px; }
.card.narrow { max-width: 720px; }
.card > h2 + .sub, .card > h2 + p { margin-top: 4px; }
figure.card { margin: 0 0 16px; }
figcaption { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
figcaption .btn { margin-left: auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); gap: 16px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } .filters { position: static; } }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.tile .l { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.tile .v { font-size: 32px; font-weight: 700; line-height: 1.15; margin-top: 2px; }
.tile .d { font-size: 12px; color: var(--muted); }
.tile.hero { background: var(--navy); border-color: var(--navy); color: #fff; }
.tile.hero .l, .tile.hero .d { color: #b7d3d3; }
.tile.hero .v { color: var(--amber); font-size: 40px; }
.status { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.status.warn::before { content: "⚠"; color: var(--warn); }
.status.ok::before { content: "✓"; color: var(--good); }

/* ---------- charts ---------- */
.chart-body { position: relative; width: 100%; }
.chart-body svg { display: block; width: 100%; overflow: visible; }
.chart-body text { font: 12px system-ui, -apple-system, "Segoe UI", sans-serif; fill: var(--ink-2); }
.chart-body .val { fill: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-body .axis { stroke: var(--axis); }
.chart-body .gridl { stroke: var(--grid); }
.chart-body .mark { stroke: var(--surface); stroke-width: 2; }
.chart-body .hit { fill: transparent; cursor: pointer; }
.chart-body .hit:hover + .mark, .chart-body .mark.hl { filter: brightness(1.08); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 8px; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.empty { color: var(--muted); padding: 28px 8px; text-align: center; }
.tooltip { position: fixed; z-index: 2000; pointer-events: none; background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0,0,0,.15); border-radius: 8px; padding: 7px 10px; font-size: 12px; max-width: 260px; }
.tooltip b { font-variant-numeric: tabular-nums; }
.map { height: 360px; border-radius: 10px; overflow: hidden; background: var(--page); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--axis); padding: 7px 8px; white-space: nowrap; }
td { border-bottom: 1px solid var(--line); padding: 7px 8px; vertical-align: top; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; border-top: 1px solid var(--axis); }
tr.del td { color: var(--muted); text-decoration: line-through; }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--page); color: var(--ink-2); }
.tag.bad { color: var(--crit); }
.tag.ok { color: var(--good-ink); }

.rec-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.rec-tools input[type=search] { min-width: 300px; flex: 0 1 380px; }
.grow { flex: 1; }
.check { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 10px; color: var(--ink-2); }

.inline { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.inline input { flex: 1; min-width: 200px; }
.stack { display: flex; flex-direction: column; gap: 10px; max-width: 360px; margin-top: 10px; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 10px 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }
.big-code { font-size: 20px; letter-spacing: 3px; font-weight: 700; }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 3000; background: var(--ink); color: var(--card); padding: 10px 16px; border-radius: 10px; font-weight: 600; }
.toast.bad { background: var(--crit); color: #fff; }
.leaflet-container { font: inherit; }

/* ---------- detail views */
.me { color: #b7d3d3; font-size: 12px; }
.tag.red { background: var(--red-bg); color: var(--red); }
.desk h2 { font-size: 18px; }
.desk .inline input { font-size: 16px; padding: 10px 12px; }
.verdict { border-radius: 14px; padding: 14px 18px; margin: 0 0 12px; border: 1.5px solid; }
.verdict b { font-size: 20px; display: block; }
.verdict.hit { background: var(--red-bg); border-color: #fda29b; color: #912018; }
.verdict.clear { background: var(--green-bg); border-color: #75e0a7; color: #085d3a; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .verdict.hit { background: #3a1512; color: #fda29b; }
  :root:where(:not([data-theme="light"])) .verdict.clear { background: #0f2a1d; color: #75e0a7; }
}
.group { margin-bottom: 26px; }
.group > h3 { font-size: 15px; margin: 0 0 8px; }
.cust { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 6px 18px; }
.cust div span { display: block; font-size: 12px; color: var(--ink-2); }
.hist { display: grid; gap: 10px; }
.hist .item { border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: 10px; padding: 10px 12px; background: var(--card); cursor: pointer; }
.hist .item.reg { border-left-color: var(--s1); cursor: default; }
.hist .item.del { opacity: .6; }
.hist .item b { font-size: 14px; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.thumbs img, .thumbs .vid { width: 74px; height: 74px; object-fit: cover; border-radius: 8px; background: #111; }
.thumbs .vid { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--page); }

.modal { position: fixed; inset: 0; z-index: 2500; background: rgba(0,0,0,.5); display: flex; align-items: flex-start; justify-content: center; padding: 30px 12px; overflow-y: auto; }
.modal-box { background: var(--card); color: var(--ink); border-radius: 16px; width: 100%; max-width: 920px; padding: 20px 22px; }
.modal-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.modal-head > div { flex: 1; }
.modal-head h2 { font-size: 20px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 8px; }
.gallery figure { margin: 0; }
.gallery img, .gallery video { width: 100%; border-radius: 10px; background: #111; display: block; max-height: 420px; object-fit: contain; }
.gallery figcaption { display: block; font-size: 12px; color: var(--ink-2); margin-top: 4px; word-break: break-all; }
.kv.two { grid-template-columns: max-content 1fr max-content 1fr; }
@media (max-width: 640px) { .kv.two { grid-template-columns: max-content 1fr; } }@media (max-width: 760px) {
  .top { gap: 8px 12px; padding: 10px 12px; }
  .top .tabs { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .top .tabs button { white-space: nowrap; flex: none; }
  .me { display: none; }
  .top .btn.ghost { margin-left: auto; }
}

/* one header line: tabs scroll sideways instead of wrapping */
.top { flex-wrap: nowrap; }
.top .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.top .tabs::-webkit-scrollbar { display: none; }
.top .tabs button { white-space: nowrap; flex: none; padding: 8px 10px; }
.top .brand, .top .btn, .me { flex: none; }
@media (max-width: 760px) { .top { flex-wrap: wrap; } }
.top a.btn { text-decoration: none; }

/* ---------- ZeroCheck */
.map.big { height: calc(100vh - 290px); min-height: 420px; }
.pbar { display: inline-block; width: 90px; height: 8px; border-radius: 8px; background: var(--grid); vertical-align: middle; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--good); }
table.grid td:nth-child(2) { min-width: 240px; }
table.grid td.tot { font-weight: 700; background: #fff4d6; color: #1d1300; }
table.grid tr.lead td { font-weight: 700; }
.hist .item { border-left-color: var(--navy); }
.cust div { overflow-wrap: anywhere; }
td.pc { white-space: nowrap; }
.pbar { width: 60px; }
.tiles { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
.top .tabs button { padding: 8px 8px; font-size: 13.5px; }
@media (max-width: 1500px) { .brand span { display: none; } }

/* ---------- v1.5: actions & resolution, field lists, contractors, payments, users */
.tag.blue { color: #175cd3; background: #eff8ff; }
.tag.amber { color: #b54708; background: #fffaeb; }
a.tag { text-decoration: none; }
tr.hl td { background: #fffaeb; }
.bad { color: var(--crit); }
.nowrap { white-space: nowrap; }
.req { color: var(--crit); }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.stack.wide { max-width: 560px; }
.stack textarea, .stack select, .stack input { font: inherit; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stations { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 12px; margin: 6px 0; }
.routes { max-height: 460px; overflow-y: auto; }
.modal-box.wide { max-width: 1400px; }
.entry { max-height: 68vh; overflow-y: auto; }
.entry td { padding: 3px 6px; vertical-align: top; }
.entry input, .entry select { font: inherit; font-size: 13px; padding: 3px 5px; max-width: 100%; }
.entry select { max-width: 210px; }
.entry tr.entered td { background: #f0fdf4; }
.entry tr.routeband td { background: var(--page); font-weight: 700; color: var(--ink-2); padding: 7px 8px; }
@media (max-width: 700px) { .two { grid-template-columns: 1fr; } }
/* v1.5: more tabs — they get their own full-width row under the brand, wrapping if needed */
.top .tabs { order: 10; flex: 1 1 100%; flex-wrap: wrap; overflow: visible; margin: 2px -4px 0; }
.top .tabs button { padding: 6px 10px; }
.top .me { margin-left: auto; }
.stations label.check, .stack label.check { flex-direction: row; align-items: center; font-weight: 400; }
/* training demo */
.demo-bar { background: #f5a524; color: #1d1300; text-align: center; font-weight: 600; font-size: 13px; padding: 6px 12px; }
.demo-hint { background: #fffaeb; border: 1px solid #fec84b; color: #93370d; border-radius: 10px; padding: 10px 12px; font-size: 13px; text-align: left; line-height: 1.7; }

/* ===================================================================================================
   v1.5.2 layout — work first: slim light top bar, grouped side menu (PC, can fold to icons) or a drawer
   behind ☰ (phones / tablets), soft pastel colours per group.
   =================================================================================================== */
:root {
  --bar: #ffffff; --bar-ink: #16323a; --side: #fbfcfd; --hero-bg: #e8f5f2; --hero-ink: #0f5b54; --hero-v: #0e7a6f;
  --g1: #e0efff; --g1-ink: #1d5fa8; --g2: #dff6e8; --g2-ink: #1d7a45; --g3: #fff1d6; --g3-ink: #a35f00; --g4: #eee9ff; --g4-ink: #5b3fb8;
  --accent: #14a38b;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --bar: #151a1d; --bar-ink: #e6eef0; --side: #12171a; --hero-bg: #12302c; --hero-ink: #a7e3d8; --hero-v: #5fd4c0;
    --g1: #16283d; --g1-ink: #8cc2ff; --g2: #15301f; --g2-ink: #8fe0ad; --g3: #33270f; --g3-ink: #f2c46b; --g4: #251f3d; --g4-ink: #c3b2ff;
  }
}
:root[data-theme="dark"] {
  --bar: #151a1d; --bar-ink: #e6eef0; --side: #12171a; --hero-bg: #12302c; --hero-ink: #a7e3d8; --hero-v: #5fd4c0;
  --g1: #16283d; --g1-ink: #8cc2ff; --g2: #15301f; --g2-ink: #8fe0ad; --g3: #33270f; --g3-ink: #f2c46b; --g4: #251f3d; --g4-ink: #c3b2ff;
}
/* top bar */
.top { position: sticky; top: 0; z-index: 900; height: 52px; display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--bar); color: var(--bar-ink); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(20, 163, 139, .25); }
.top .brand { gap: 8px; flex: none; }
.top .brand b { font-size: 15px; letter-spacing: 2px; color: var(--bar-ink); }
.top .logo { width: 28px; height: 28px; }
.page-title { font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 12px; border-left: 1px solid var(--line); }
.top .me { color: var(--ink-2); font-size: 13px; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.top .btn.ghost { color: var(--bar-ink); border-color: var(--line); }
.top .btn.ghost:hover { background: var(--page); }
.menu-btn { flex: none; width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--bar-ink); cursor: pointer; display: grid; place-items: center; }
.menu-btn:hover { background: var(--page); }
.menu-btn svg, .side svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* page layout */
.shell { display: flex; align-items: flex-start; }
.work { flex: 1; min-width: 0; }
main { max-width: 1600px; padding: 14px 18px 40px; }
.side { position: sticky; top: 52px; flex: none; width: 214px; height: calc(100vh - 52px); overflow-y: auto; background: var(--side);
  border-right: 1px solid var(--line); padding: 10px 8px 12px; display: flex; flex-direction: column; transition: width .18s; scrollbar-width: thin; }
#tabs { display: block; flex: 1; }
.grp { margin-bottom: 10px; }
.gl { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); padding: 6px 10px 4px; white-space: nowrap; }
#tabs button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left; font: inherit; font-weight: 500;
  color: var(--ink); padding: 7px 10px; border-radius: 9px; cursor: pointer; white-space: nowrap; position: relative; }
#tabs button i { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
#tabs button i svg { width: 17px; height: 17px; }
#tabs button span { overflow: hidden; text-overflow: ellipsis; }
.g1 i { background: var(--g1); color: var(--g1-ink); } .g2 i { background: var(--g2); color: var(--g2-ink); }
.g3 i { background: var(--g3); color: var(--g3-ink); } .g4 i { background: var(--g4); color: var(--g4-ink); }
#tabs button:hover { background: var(--page); }
.g1 button.on { background: var(--g1); color: var(--g1-ink); } .g2 button.on { background: var(--g2); color: var(--g2-ink); }
.g3 button.on { background: var(--g3); color: var(--g3-ink); } .g4 button.on { background: var(--g4); color: var(--g4-ink); }
#tabs button.on { font-weight: 700; }
#tabs button.on i { background: var(--card); }
.side-fold { display: flex; align-items: center; gap: 10px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; padding: 8px 10px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.side-fold:hover { background: var(--page); color: var(--ink); }
.side-fold svg { transition: transform .18s; }
/* folded (PC): icons only */
body.side-mini .side { width: 62px; }
body.side-mini .gl { visibility: hidden; height: 10px; padding: 0; }
body.side-mini #tabs button span, body.side-mini .side-fold span { display: none; }
body.side-mini #tabs button { justify-content: center; padding: 6px 0; }
body.side-mini .side-fold { justify-content: center; }
body.side-mini .side-fold svg { transform: rotate(180deg); }
/* filters: compact, sticky under the top bar */
.filters { position: sticky; top: 52px; z-index: 800; padding: 8px 18px; gap: 8px 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.flt-more { display: none; }
/* softer tiles: the hero tile is light, each tile has a coloured top edge */
.tile { border-top: 3px solid var(--line); }
.tiles .tile:nth-child(6n+2) { border-top-color: #8cc2ff; } .tiles .tile:nth-child(6n+3) { border-top-color: #f5a3a3; }
.tiles .tile:nth-child(6n+4) { border-top-color: #c3b2ff; } .tiles .tile:nth-child(6n+5) { border-top-color: #f2c46b; }
.tiles .tile:nth-child(6n) { border-top-color: #8fe0ad; } .tiles .tile:nth-child(6n+1) { border-top-color: #7fd6c7; }
.tile.hero { background: var(--hero-bg); border-color: transparent; border-top: 3px solid var(--accent); color: var(--hero-ink); }
.tile.hero .l, .tile.hero .d { color: var(--hero-ink); }
.tile.hero .v { color: var(--hero-v); }
/* login: light */
.login { background: linear-gradient(160deg, #e8f5f2 0%, #eef4ff 55%, #fdf4e3 100%); }
/* phones and tablets: the menu is a drawer behind ☰ */
@media (max-width: 1023px) {
  .side { position: fixed; top: 52px; left: 0; z-index: 950; width: 260px; transform: translateX(-105%); transition: transform .2s; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
  body.nav-open .side { transform: none; }
  body.side-mini .side { width: 260px; }
  body.side-mini .gl { visibility: visible; height: auto; padding: 6px 10px 4px; }
  body.side-mini #tabs button span, body.side-mini .side-fold span { display: inline; }
  body.side-mini #tabs button { justify-content: flex-start; padding: 7px 10px; }
  .side-fold { display: none; }
  .scrim { position: fixed; inset: 52px 0 0 0; z-index: 940; background: rgba(15, 30, 35, .28); }
}
@media (max-width: 760px) {
  .top { gap: 6px; padding: 0 8px; }
  .top .brand b, .top .me, .top .wide { display: none; }
  .page-title { border-left: 0; padding-left: 0; font-size: 15px; color: var(--bar-ink); }
  main { padding: 10px 10px 30px; }
  .filters { padding: 6px 10px; }
  .flt-more { display: inline-block; }
  .filters .f { display: none; }
  .filters.open .f { display: flex; width: calc(50% - 7px); }
  .filters .refresh { margin-left: auto; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .tile { padding: 10px 12px; }
  .tile .v { font-size: 24px; } .tile.hero .v { font-size: 30px; }
}
/* drawer from the very top (above the bar), whatever is above the bar (e.g. the demo notice) */
@media (max-width: 1023px) {
  .side { top: 0; height: 100vh; height: 100dvh; z-index: 1000; padding-top: 14px; }
  .scrim { inset: 0; z-index: 990; }
}
@media (max-width: 760px) { .demo-bar .wide { display: none; } .demo-bar { padding: 4px 10px; font-size: 12px; } }

/* ---------------------------------------------------------------- v1.6: offline smart meters group, Locate & route map */
:root { --g5: #ffe4e8; --g5-ink: #b42346; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --g5: #3a1a22; --g5-ink: #ff9fb2; } }
:root[data-theme="dark"] { --g5: #3a1a22; --g5-ink: #ff9fb2; }
.g5 i { background: var(--g5); color: var(--g5-ink); }
.g5 button.on { background: var(--g5); color: var(--g5-ink); }
#lmap.picking { cursor: crosshair; }
#lmap.picking .leaflet-interactive { cursor: crosshair; }
.loc-tools .seg button, #locMode button { white-space: nowrap; }
.btn.on { outline: 2px solid var(--g1-ink, #1d5fa8); }
label.rad { display: inline-flex; align-items: center; gap: 8px; }
label.rad input[type=range] { width: 180px; }
#locQ { min-width: 260px; }
#olGrid table th.n { white-space: normal; min-width: 64px; font-size: 11px; }
#olGrid td:nth-child(2) { min-width: 240px; }
@media (max-width: 760px) {
  label.rad input[type=range] { width: 120px; }
  #locQ { min-width: 0; width: 100%; }
  #locForm { width: 100%; }
}
#olGrid td:last-child { min-width: 230px; font-size: 12px; }
#olGrid td, #olGrid th { padding-top: 6px; padding-bottom: 6px; }

/* v1.7: NEDCo group, Area picker */
:root { --g6: #e3f4f4; --g6-ink: #0b6b6b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --g6: #12302f; --g6-ink: #7fe0dc; } }
:root[data-theme="dark"] { --g6: #12302f; --g6-ink: #7fe0dc; }
.g6 i { background: var(--g6); color: var(--g6-ink); }
.g6 button.on { background: var(--g6); color: var(--g6-ink); }
.area-pick { margin-left: 10px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line, #d0d5dd); font-weight: 600; max-width: 200px; }
.area-tag { margin-left: 10px; padding: 3px 10px; border-radius: 12px; background: var(--g6); color: var(--g6-ink); font-weight: 600; font-size: 12px; white-space: nowrap; }
pre.buildlog { background: #f6f7f9; border-radius: 8px; padding: 10px; font-size: 12px; white-space: pre-wrap; max-height: 180px; overflow: auto; }
@media (max-width: 760px) { .area-pick { max-width: 120px; } .area-tag { display: none; } }

/* v1.8: Supervision group, Loss Control link, the Activity & Supervision report */
:root { --g7: #fdf0e1; --g7-ink: #9a4f05; --g8: #fde8e8; --g8-ink: #9b1c1c; --green: #067647; --green-bg: #dcfae6; --amber: #93370d; --amber-bg: #fef0c7; --red: #b42318; --red-bg: #fee4e2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --g7: #3a2610; --g7-ink: #f5c08a; --g8: #3a1616; --g8-ink: #f8a9a9; --green-bg: #0f3a25; --green: #75e0a7; --amber-bg: #3d2a0a; --amber: #fec84b; --red-bg: #42140f; --red: #fda29b; } }
:root[data-theme="dark"] { --g7: #3a2610; --g7-ink: #f5c08a; --g8: #3a1616; --g8-ink: #f8a9a9; --green-bg: #0f3a25; --green: #75e0a7; --amber-bg: #3d2a0a; --amber: #fec84b; --red-bg: #42140f; --red: #fda29b; }
.g7 i { background: var(--g7); color: var(--g7-ink); } .g7 button.on { background: var(--g7); color: var(--g7-ink); }
.g8 i { background: var(--g8); color: var(--g8-ink); }
#tabs a.navlink { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; padding: 7px 10px; border-radius: 9px; font-weight: 600; white-space: nowrap; }
#tabs a.navlink:hover { background: var(--page); }
#tabs a.navlink i { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
#tabs a.navlink i svg { width: 17px; height: 17px; }
body.side-mini #tabs a.navlink span { display: none; }
body.side-mini #tabs a.navlink { justify-content: center; padding: 6px 0; }
.rag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.rag.GREEN { background: var(--green-bg); color: var(--green); } .rag.AMBER { background: var(--amber-bg); color: var(--amber); } .rag.RED { background: var(--red-bg); color: var(--red); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--card); border-radius: 12px; padding: 12px 14px; border-left: 5px solid transparent; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.kpi.GREEN { border-left-color: var(--green); } .kpi.AMBER { border-left-color: #f79009; } .kpi.RED { border-left-color: var(--red); }
.kpi .v { font-size: 26px; font-weight: 800; line-height: 1.15; } .kpi .l { font-weight: 600; } .kpi .s { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.attn { display: grid; gap: 6px; } .attn button { text-align: left; border: 0; background: var(--red-bg); color: var(--red); padding: 8px 12px; border-radius: 9px; font: inherit; cursor: pointer; }
.attn button b { margin-right: 6px; font-size: 16px; }
.rep-sec { margin-top: 16px; } .rep-sec > h2 { display: flex; align-items: center; gap: 8px; } .rep-sec h2 .n { color: var(--muted); font-weight: 500; font-size: 14px; }
.rep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.rep-kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; font-size: 14px; } .rep-kv b { text-align: right; }
details.exc { background: var(--card); border-radius: 10px; margin: 6px 0; padding: 8px 12px; } details.exc summary { cursor: pointer; font-weight: 600; }
details.exc summary .n { display: inline-block; min-width: 34px; text-align: center; border-radius: 10px; padding: 0 6px; margin-right: 8px; background: var(--page); }
details.exc[data-n="0"] { opacity: .65; }
.instr-row { border-left: 4px solid var(--line, #d0d5dd); padding: 8px 12px; margin: 8px 0; background: var(--card); border-radius: 8px; }
.instr-row.OPEN { border-left-color: #f79009; } .instr-row.ANSWERED { border-left-color: #2a78d6; } .instr-row.DONE { border-left-color: var(--green); } .instr-row.over { border-left-color: var(--red); }
.sum-text { white-space: pre-wrap; font: 13.5px/1.45 inherit; background: var(--page); border-radius: 8px; padding: 10px 12px; margin: 6px 0; }
@media print {
  body.print-report .top, body.print-report .side, body.print-report .filters, body.print-report .rep-tools, body.print-report .demo-bar, body.print-report .toast { display: none !important; }
  body.print-report .shell, body.print-report .work, body.print-report main { display: block !important; margin: 0 !important; padding: 0 !important; }
  body.print-report .view:not(#v-activity) { display: none !important; }
  body.print-report details.exc { break-inside: avoid; } body.print-report details.exc > * { display: block; }
  body.print-report .card, body.print-report .kpi { box-shadow: none; border: 1px solid #ddd; }
}
