/* Verdantix — "clay campus": a porcelain 3D campus with floating white instrument cards.
   One bold element (the campus itself); everything around it stays quiet. */
:root {
  --ground: #e7eee8;      /* map ground, pale sage */
  --surface: #ffffff;
  --surface-2: #f2f6f3;   /* inset areas inside cards */
  --line: #e1e8e2;
  --ink: #0f1d16;         /* near-black green ink */
  --ink-2: #33463b;
  --muted: #6a7b71;
  --forest: #0f2a1f;      /* rail, hero card, primary buttons */
  --forest-2: #183d2d;
  --lime: #a6e36b;        /* accent on dark */
  --accent: #1f9d55;      /* green: selection, links, toggles */
  --accent-soft: #e2f5e7;
  --ok: #22a05a; --ok-soft: #e2f5e7;
  --warn: #e8962b; --warn-soft: #fdf1df;
  --crit: #e5484d; --crit-soft: #fdeaea;
  --r-card: 22px; --r-ctl: 12px; --r-pill: 999px;
  --shadow: 0 1px 2px rgba(15, 42, 31, .06), 0 16px 40px -12px rgba(15, 42, 31, .22);
  --shadow-sm: 0 1px 2px rgba(15, 42, 31, .08), 0 4px 12px -4px rgba(15, 42, 31, .14);
  --font: "Geist", "Segoe UI", system-ui, sans-serif;
  --gap: 12px; --rail-w: 76px; --panel-w: 420px; --right-w: 276px;
  --map-l: calc(var(--gap) * 2 + var(--rail-w) + var(--panel-w) + var(--gap));
  --map-r: calc(var(--right-w) + var(--gap) * 2);
  --map-mid: calc((var(--map-l) + 100vw - var(--map-r)) / 2);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 14px/1.45 var(--font); font-feature-settings: "tnum" 1, "cv11" 1; overflow: hidden; -webkit-font-smoothing: antialiased; }
svg { width: 16px; height: 16px; flex: none; }
button { font: 600 13px var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 8px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background .15s, border-color .15s, color .15s; }
button:hover { border-color: #c9d6cd; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary, button.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
button.primary:hover, button.dark:hover { background: #262b44; }
button.soft { background: var(--surface-2); border-color: transparent; }
button.soft:hover { background: #e8efe9; }
button.icon { padding: 8px; }
button.wide { width: 100%; justify-content: center; }
select, input:not([type=checkbox]):not([type=range]):not([type=file]) { font: 500 13px var(--font); color: var(--ink); background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r-ctl); padding: 9px 11px; min-width: 0; }
select:hover, input:hover { border-color: var(--line); }
input[type=file] { font: 500 12px var(--font); color: var(--muted); }
input[type=checkbox], input[type=range] { accent-color: var(--accent); }
h3 { font: 700 15px var(--font); margin: 22px 0 10px; letter-spacing: -.01em; }
h3 small { font: 500 12px var(--font); color: var(--muted); margin-left: 6px; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.btnlink { color: var(--accent); font-weight: 600; text-decoration: none; }
.btnlink:hover { text-decoration: underline; }
.float { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); }

/* ---------- map ---------- */
#map { position: fixed; inset: 0; }
.maplibregl-ctrl-bottom-right { right: 12px; bottom: 12px; }
.maplibregl-ctrl-group { border-radius: 14px !important; box-shadow: var(--shadow-sm) !important; overflow: hidden; }
.maplibregl-ctrl-group button { border-radius: 0; border: 0; width: 34px; height: 34px; }
.maplibregl-ctrl-attrib { font-size: 10px; background: rgba(255,255,255,.7) !important; border-radius: 8px; }
.maplibregl-popup-content { background: var(--surface); color: var(--ink); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px; font: 13px/1.45 var(--font); }
.maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 16px; padding: 2px 8px; border: 0; background: none; }

/* building score badges: the signature element */
.bmark { display: flex; flex-direction: column-reverse; align-items: center; gap: 4px; cursor: pointer; }
.bmark b { min-width: 30px; height: 30px; padding: 0 7px; border-radius: var(--r-pill); background: var(--ink); color: #fff; font: 700 12px var(--font); display: grid; place-items: center;
  box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 6px 14px rgba(15,42,31,.28); }
.bmark.warn b { background: var(--warn); } .bmark.crit b { background: var(--crit); }
.bmark.sel b { background: var(--accent); box-shadow: 0 0 0 3px #fff, 0 0 0 7px rgba(31,157,85,.28), 0 6px 14px rgba(15,42,31,.28); }
.bmark span { font: 600 11px var(--font); color: var(--ink); background: rgba(255,255,255,.92); padding: 2px 8px; border-radius: var(--r-pill); box-shadow: var(--shadow-sm); white-space: nowrap; opacity: 0; transition: opacity .2s; }
.bmark:hover span, .bmark.sel span, .names .bmark span { opacity: 1; }
.pulse { width: 26px; height: 26px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: var(--shadow-sm); cursor: pointer; }
.pulse::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 0 rgba(229,72,77,.5); animation: ping 1.8s infinite; }
.pulse.crit::after { background: var(--crit); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(229,72,77,.45); } 80% { box-shadow: 0 0 0 12px rgba(229,72,77,0); } 100% { box-shadow: 0 0 0 0 rgba(229,72,77,0); } }

.row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; align-items: center; }
.row label { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.loop { display: flex; gap: 0; list-style: none; margin: 0 0 14px; padding: 0; counter-reset: s; }
.loop li { flex: 1; font: 600 12px var(--font); color: var(--ink-2); padding: 7px 0 7px 10px; background: var(--surface-2); position: relative; }
.loop li:first-child { border-radius: var(--r-pill) 0 0 var(--r-pill); padding-left: 14px; }
.loop li:last-child { border-radius: 0 var(--r-pill) var(--r-pill) 0; }
.loop li + li::before { content: ""; position: absolute; left: -4px; top: 50%; width: 7px; height: 7px; border-top: 1.5px solid #b7bccd; border-right: 1.5px solid #b7bccd; transform: translateY(-50%) rotate(45deg); }

/* cards and lists */
.list { display: grid; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: grid; gap: 5px; position: relative; }
.card::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; }
.card.warn::before { background: var(--warn); } .card.crit::before { background: var(--crit); } .card.ok::before { background: var(--ok); }
.card.clickable { cursor: pointer; } .card.clickable:hover { border-color: #c9d6cd; }
.card.faded { opacity: .55; }
.card .t { font-weight: 650; font-size: 13.5px; }
.card .d { color: var(--muted); font-size: 13px; }
.card .m { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; }
.card img { border-radius: 10px; }
.pill { padding: 2px 8px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); font-weight: 600; }
.pill.src-camera, .pill.src-student, .pill.src-iot { background: var(--accent-soft); color: #146c3c; }
.pill.src-demo-scenario { background: #f1e9ff; color: #6a3fc0; }
.card .act { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.card .act button { padding: 6px 11px; font-size: 12px; }
.card .act button:first-child { background: var(--ink); color: #fff; border-color: var(--ink); }
.list > .m { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--ink-2); padding: 4px 2px; }
.list > .m b { font-weight: 700; color: var(--ink); }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.stats > .sub { grid-column: 1 / -1; margin: 0; }
.stat { background: var(--surface-2); border-radius: 14px; padding: 9px 11px; }
.stat span { font-size: 11.5px; color: var(--muted); display: block; }
.stat b { font: 700 16px var(--font); letter-spacing: -.01em; }
.chartbox { background: var(--surface-2); border-radius: 16px; padding: 10px; margin: 12px 0 4px; }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.room { background: var(--surface-2); border-radius: 12px; padding: 8px; font-size: 11.5px; color: var(--ink-2); line-height: 1.5; border: 1px solid transparent; }
.room.waste { background: var(--crit-soft); border-color: #f6c4c5; }
.room b { font: 700 12px var(--font); display: block; color: var(--ink); }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.bar i.warn { background: var(--warn); } .bar i.crit { background: var(--crit); }
.live-tag { font: 700 10px var(--font); color: #0e7149; background: var(--ok-soft); padding: 2px 7px; border-radius: var(--r-pill); margin-left: 6px; }
.tank { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; }
.tankviz { position: relative; height: 52px; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.tankviz i { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(#8fd0ff, #3e8fe0); transition: height .6s; }
.tankviz.crit { box-shadow: inset 0 0 0 2px var(--crit); }
.tankviz.crit::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(180deg, transparent 0 6px, rgba(255,255,255,.35) 6px 8px); animation: spill 1s linear infinite; }
@keyframes spill { to { background-position: 0 16px; } }

/* vision */
.viewer { position: relative; background: #0d1020; border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 10; margin-bottom: 10px; }
.viewer video, .viewer img, .viewer canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.vout { display: grid; gap: 6px; font-size: 13px; }
.vout .tag { display: inline-block; background: var(--surface-2); padding: 3px 9px; border-radius: var(--r-pill); margin: 2px; font-size: 12px; }

/* copilot */
.chat { display: grid; gap: 10px; margin-bottom: 12px; }
.msg { padding: 10px 13px; border-radius: 16px 16px 16px 6px; background: var(--surface-2); font-size: 13.5px; }
.msg p { margin: 0 0 6px; } .msg p:last-child { margin: 0; } .msg ul { margin: 4px 0; padding-left: 18px; }
.msg.me { background: var(--ink); color: #fff; justify-self: end; max-width: 85%; border-radius: 16px 16px 6px 16px; }
.msg small { display: block; color: var(--muted); font-size: 11px; margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chips button { background: var(--surface); border: 1px solid var(--line); font-weight: 500; font-size: 12.5px; border-radius: var(--r-pill); padding: 6px 11px; text-align: left; }
.ask { display: flex; gap: 6px; position: sticky; bottom: -24px; background: var(--surface); padding: 8px 0; }
.ask input { flex: 1; }
#askLang { width: auto; }
#micBtn.on { background: var(--crit); color: #fff; }

/* what-if */
.slider { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; margin-bottom: 14px; font-size: 13.5px; font-weight: 500; }
.slider b { font-weight: 700; }
.slider input { grid-column: 1 / -1; width: 100%; }
.check { display: flex; gap: 9px; margin-bottom: 9px; font-size: 13.5px; align-items: center; }
.simout { margin-top: 14px; display: grid; gap: 10px; }
.simout .m { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.big { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.big .stat { background: var(--ink); color: #fff; }
.big .stat span { color: #a9aec4; }
.big .stat b { font-size: 20px; }
.big .stat:first-child { background: var(--accent); }
.big .stat:first-child span { color: #d6f3df; }
.payback { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.payback td, .payback th { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.payback td:first-child, .payback th:first-child { text-align: left; }
.payback th { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.payback tr:last-child th { color: var(--ink); font-size: 12.5px; border-bottom: 0; }

/* report, students, tour */
.md { font-size: 13.5px; } .md h2, .md h3 { font: 700 15px var(--font); margin: 16px 0 6px; }
.md table { border-collapse: collapse; width: 100%; font-size: 12px; display: block; overflow-x: auto; }
.md td, .md th { border-bottom: 1px solid var(--line); padding: 6px; text-align: left; }
.repform { display: grid; gap: 8px; }
.repform label { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.repform label select { flex: 1; }
.repform small { color: var(--muted); }
.qrline { display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: center; background: var(--surface-2); border-radius: 16px; padding: 12px; margin-top: 14px; font-size: 13px; }
.qrline small { display: block; color: var(--muted); margin-top: 2px; }
#qrSmall img, #qrSmall canvas, #qrBig img, #qrBig canvas { background: #fff; padding: 6px; border-radius: 10px; display: block; }
.tourframe { position: relative; aspect-ratio: 4 / 5; border-radius: 16px; overflow: hidden; background: var(--surface-2); margin-bottom: 10px; }
.tourframe iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- right column ---------- */

.layers { padding: 14px; display: grid; gap: 10px; }
.layers h4, .board h4 { margin: 0; font: 700 14px var(--font); display: flex; align-items: center; gap: 8px; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: flex; align-items: center; gap: 7px; }
.sw { width: 14px; height: 10px; border-radius: 3px; display: inline-block; box-shadow: inset 0 -3px 0 rgba(0,0,0,.08); }
.sw.ok { background: #f7f8fb; border: 1px solid #d5d8e2; } .sw.warn { background: var(--warn); } .sw.crit { background: var(--crit); } .sw.sel { background: var(--accent); }
.tog { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 500; cursor: pointer; flex-direction: row-reverse; }
.tog input { appearance: none; width: 34px; height: 20px; border-radius: var(--r-pill); background: #d9dce6; position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.tog input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.tog input:checked { background: var(--accent); } .tog input:checked::after { transform: translateX(14px); }
.viewctl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.viewctl button { flex-direction: column; gap: 3px; padding: 8px 4px; font-size: 11.5px; }
.viewctl button.on { background: var(--accent); color: #fff; }
.board { padding: 14px 16px; font-size: 13.5px; }
.board h4 { margin-bottom: 8px; position: sticky; top: -14px; background: var(--surface); padding: 2px 0 6px; z-index: 1; }
.board .r { display: grid; grid-template-columns: 1fr auto 26px; gap: 8px; padding: 5px 0; align-items: center; border-top: 1px solid var(--line); cursor: pointer; }
.board .r:first-of-type { border-top: 0; }
.board .r span:first-child { display: none; }
.board .r:hover span:nth-child(2) { color: var(--accent); }
.grade { font: 700 11px var(--font); text-align: center; border-radius: 7px; padding: 2px 0; }
.grade.A { background: var(--ok-soft); color: #0e7149; } .grade.B { background: #eef6d9; color: #5a7210; }
.grade.C { background: var(--warn-soft); color: #9a5a08; } .grade.D { background: var(--crit-soft); color: #b3261e; }

/* walk-in 360 */
.walk { position: fixed; inset: 0; z-index: 30; background: var(--ground); }
.walk iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.walkbar { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; gap: 8px; align-items: center; pointer-events: none; }
.walkbar > * { pointer-events: auto; }
.walkbar button { border-radius: var(--r-pill); box-shadow: var(--shadow); padding: 10px 16px; }
.walkbar select { background: var(--surface); box-shadow: var(--shadow); border-radius: var(--r-pill); padding: 10px 14px; }
.walksrc { margin-left: auto; font-size: 12px; color: var(--ink-2); background: rgba(255,255,255,.88); padding: 6px 12px; border-radius: var(--r-pill); text-decoration: none; }
.walkhud { position: absolute; left: 14px; bottom: 14px; width: min(340px, calc(100% - 28px)); max-height: calc(100% - 90px); overflow-y: auto; background: rgba(255,255,255,.95); backdrop-filter: blur(10px); border-radius: var(--r-card); padding: 16px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.wh-top { display: flex; align-items: center; gap: 8px; font: 800 18px var(--font); letter-spacing: -.02em; }
.wh-top .grade { margin-left: auto; padding: 3px 8px; }
.walkhud > .m { font-size: 12px; color: var(--muted); }
.wh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.wh-grid div { background: var(--surface-2); border-radius: 12px; padding: 8px 10px; display: grid; }
.wh-grid span { font-size: 11px; color: var(--muted); }
.wh-grid b { font: 700 16px var(--font); }
.wh-grid em { font-style: normal; font-size: 11px; color: var(--muted); } .wh-grid em.bad { color: var(--crit); }
.wh-alert { background: var(--crit-soft); border-radius: 12px; padding: 9px 11px; font-size: 13px; display: grid; gap: 4px; }
.wh-alert.warn { background: var(--warn-soft); }
.wh-alert small { color: var(--ink-2); }
.wh-alert button { justify-self: start; padding: 5px 11px; font-size: 12px; background: var(--ink); color: #fff; border-color: var(--ink); }
.wh-ok { color: #0e7149; font-weight: 600; font-size: 13px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); }
.dot.warn { background: var(--warn); } .dot.crit { background: var(--crit); }

/* dialogs, toast, caption */
dialog { background: var(--surface); color: var(--ink); border: 0; border-radius: var(--r-card); box-shadow: var(--shadow); max-width: 760px; width: calc(100% - 32px); max-height: 86vh; padding: 22px 24px; }
dialog::backdrop { background: rgba(15,42,31,.35); backdrop-filter: blur(3px); }
dialog h2 { font: 800 22px var(--font); letter-spacing: -.02em; margin: 0 0 6px; }
dialog h3 { margin-top: 18px; }
dialog table { border-collapse: collapse; font-size: 13px; width: 100%; }
dialog td, dialog th { border-bottom: 1px solid var(--line); padding: 7px 6px; text-align: left; vertical-align: top; }
dialog th { color: var(--muted); font-weight: 600; font-size: 12px; }
dialog form { margin-top: 16px; display: flex; justify-content: flex-end; }
.qrdlg { text-align: center; max-width: 400px; }
.qrdlg form { justify-content: center; }
#qrBig { display: flex; justify-content: center; margin: 14px 0 8px; }
#qrUrl { font-size: 12px; color: var(--accent); word-break: break-all; margin: 0 0 8px; }
.toast { position: fixed; z-index: 70; top: 80px; left: var(--map-mid); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: var(--r-pill); box-shadow: var(--shadow); max-width: min(560px, 90vw); font-weight: 500; font-size: 13.5px; }
.caption { position: fixed; z-index: 60; left: 50%; bottom: 70px; left: var(--map-mid); transform: translateX(-50%); width: min(600px, calc(100vw - var(--panel-w) - var(--right-w) - 80px)); background: var(--surface); border-radius: var(--r-card); padding: 16px 18px; box-shadow: 0 24px 60px -12px rgba(15,42,31,.35); }
.caption span { font-size: 12px; font-weight: 600; color: var(--accent); }
.caption p { margin: 4px 0 12px; font: 650 18px/1.35 var(--font); letter-spacing: -.01em; }
.caption .row { margin: 0; justify-content: flex-end; }

@media (prefers-reduced-motion: reduce) { .pulse::after, .iot::before, .tankviz.crit::after { animation: none; } }
[hidden] { display: none !important; }
.aid { font-weight: 600; font-size: 11.5px; color: var(--muted); margin-right: 7px; }

.pill.src-student-unverified { background: var(--warn-soft); color: #9a5a08; }
.cctv { display: grid; grid-template-columns: 1fr; gap: 8px; background: var(--accent-soft); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; }
.cctv b { display: block; font-size: 13px; } .cctv small { color: var(--ink-2); font-size: 12px; }
.cctv select { background: var(--surface); width: 100%; }
.cctvres { padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.cctvres.hit { background: var(--crit-soft); }

/* ---- audit round: provenance, priority, timelines, operator ---- */
.provline { grid-column: 1 / -1; margin: 2px 0 0; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; white-space: nowrap; min-width: 0; }
.provline > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.provline a { flex: none; font-weight: 600; text-decoration: none; }
.provline a:hover { text-decoration: underline; }
.provline a { color: var(--accent); }
.fresh { font: 600 12px var(--font); padding: 6px 11px; border-radius: var(--r-pill); background: var(--ok-soft); color: #0e7149; white-space: nowrap; }
.fresh.stale { background: var(--warn-soft); color: #9a5a08; } .fresh.down { background: var(--crit-soft); color: #b3261e; }
.pill.prov { font-weight: 600; font-size: 11px; }
.pill.prov.replay { background: #edf2ee; color: var(--ink-2); } .pill.prov.ai { background: var(--accent-soft); color: #146c3c; }
.pill.prov.manual { background: #f1e9ff; color: #6a3fc0; } .pill.prov.measured { background: var(--ok-soft); color: #0e7149; }
.pill.prov.sim { background: #fdf1df; color: #9a5a08; } .pill.prov.stale { background: var(--crit-soft); color: #b3261e; }
.srcline { grid-column: 1 / -1; font-size: 12px; margin: 2px 0 0; }
.st { font-weight: 650; text-transform: none; }
.st-open, .st-assigned, .st-in_progress, .st-acknowledged, .st-reopened { color: var(--ink); }
.st-resolved, .st-done, .st-closed { color: #0e7149; } .st-rejected, .st-dismissed, .st-cancelled { color: var(--muted); }
.late { color: var(--crit); font-weight: 700; }
.prio { display: grid; gap: 6px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); border-left: 4px solid var(--warn); cursor: pointer; }
.prio.crit { border-left-color: var(--crit); background: var(--crit-soft); }
.prio .t { font-weight: 650; } .prio .m { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--ink-2); }
.prio button { justify-self: start; padding: 7px 12px; font-size: 12.5px; }
.filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.filters select { padding: 8px 8px; font-size: 12.5px; width: 100%; text-overflow: ellipsis; }
.card img { max-width: 100%; }
.tl summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--accent); margin-top: 4px; }
.tl ol { list-style: none; margin: 6px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--line); display: grid; gap: 6px; }
.tl li { font-size: 12px; position: relative; }
.tl li::before { content: ""; position: absolute; left: -17px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.tl li span { color: var(--muted); margin-left: 4px; } .tl li em { display: block; font-style: normal; color: var(--ink-2); }
.fb { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 4px; }
.fb button { padding: 3px 8px; font-size: 11.5px; border-radius: var(--r-pill); }
.savings-kind { font-size: 12.5px; background: var(--warn-soft); color: #6b4106; padding: 9px 11px; border-radius: 12px; }
#opBtn.on { background: var(--ok-soft); color: #0e7149; }
.signin { max-width: 380px; } .signin label.f { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.signin input { width: 100%; } .signin .row { justify-content: flex-end; margin-top: 10px; }
.err { color: var(--crit); font-size: 13px; min-height: 1em; margin: 6px 0 0; }
.walkbar .walksrc + .walksrc { margin-left: 0; }

/* ---- map badges: overlapping ones tuck into a dot instead of piling up ---- */
.bmark b { transition: min-width .18s, height .18s, font-size .18s, padding .18s; }
.bmark.tuck b { min-width: 12px; height: 12px; padding: 0; font-size: 0; box-shadow: 0 0 0 2.5px #fff, 0 3px 8px rgba(15,42,31,.25); }
.bmark.tuck:hover b { min-width: 30px; height: 30px; padding: 0 7px; font-size: 12px; }
.bmark.sel { z-index: 3; } .bmark.crit, .bmark.warn { z-index: 2; }

/* ---- waste types, hotspots, badges (from Clean City) ---- */
.pill.wt { background: #edf2ee; color: var(--ink-2); }
.pill.wt.haz { background: var(--crit-soft); color: #b3261e; }
.pill.pri-high { background: var(--crit-soft); color: #b3261e; } .pill.pri-medium { background: var(--warn-soft); color: #9a5a08; } .pill.pri-low { background: #edf2ee; color: var(--ink-2); }
.card.hot-high::before { background: var(--crit); } .card.hot-medium::before { background: var(--warn); }
.patrol { color: var(--accent); font-weight: 650; }
.badge { font-style: normal; font: 600 10.5px var(--font); background: var(--ok-soft); color: #0e7149; padding: 1px 7px; border-radius: var(--r-pill); margin-left: 4px; white-space: nowrap; }
.lb { flex-wrap: wrap; }
.sub.rules { font-size: 12px; margin-top: 8px; }

/* ---- before/after, route simulator, waste objects, eco advisor ---- */
.ba { width: 100%; border-collapse: collapse; font-size: 13px; margin: 4px 0 12px; }
.ba th { font: 600 11.5px var(--font); color: var(--muted); text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.ba td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.ba td:first-child, .ba th:first-child { text-align: left; } .ba td small { display: block; color: var(--muted); font-size: 11px; }
.ba td.down { color: #0e7149; font-weight: 700; } .ba td.up { color: var(--crit); font-weight: 700; }
.rcmp { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rcol { border-radius: 14px; padding: 10px 12px; background: var(--surface-2); display: grid; gap: 2px; }
.rcol span { font-size: 11.5px; color: var(--muted); } .rcol b { font: 700 19px var(--font); } .rcol small { font-size: 11.5px; color: var(--ink-2); }
.rcol.smart { background: var(--accent-soft); } .rcol.smart b { color: var(--accent); }
.items { display: grid; gap: 6px; }
.item { display: grid; grid-template-columns: 22px 1fr 104px 40px; gap: 8px; align-items: center; font-size: 13px; }
.item i { width: 20px; height: 20px; border-radius: 6px; font: 700 11px/20px var(--font); font-style: normal; text-align: center; color: #0d1020; }
.item select { padding: 5px 7px; font-size: 12px; } .item b { text-align: right; font-size: 12px; color: var(--muted); }
.seg-tips, .adv-seg { display: grid; gap: 6px; margin-top: 10px; font-size: 13px; }
.seg-tips small, .adv-seg small { display: block; color: var(--muted); font-size: 12px; }
.advisor { background: var(--surface-2); border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; }
.adv-head { display: flex; align-items: center; gap: 8px; } .adv-head span { color: var(--muted); font-size: 12px; flex: 1; }
.adv-head button { padding: 5px 10px; font-size: 12px; background: var(--surface); }
.adv { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; counter-reset: a; }
.adv li { background: var(--surface); border-radius: 12px; padding: 8px 10px 8px 34px; position: relative; font-size: 13px; counter-increment: a; border-left: 3px solid var(--line); }
.adv li::before { content: counter(a); position: absolute; left: 10px; top: 8px; font: 700 12px var(--font); color: var(--muted); }
.adv li.crit { border-left-color: var(--crit); } .adv li.warn { border-left-color: var(--warn); } .adv li.info { border-left-color: var(--accent); }
.adv li small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.adv-seg .dotc { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.adv li a { color: var(--ink); text-decoration: none; } .adv li a:hover { color: var(--accent); }



/* =====================================================================
   Layout v2 (green): dark rail · header · KPI row over the map · panel · right column · bottom dock
   ===================================================================== */
.float { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); }

/* rail */
.rail { position: fixed; z-index: 30; top: var(--gap); bottom: var(--gap); left: var(--gap); width: var(--rail-w); background: var(--forest);
  border-radius: 24px; display: flex; flex-direction: column; align-items: center; padding: 12px 8px; gap: 6px; box-shadow: var(--shadow); }
.rail-logo { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; cursor: pointer; margin-bottom: 8px; background: rgba(166,227,107,.12); }
.rail-logo .mark, .mark { width: 30px; height: 30px; border-radius: 10px; background: var(--lime); display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 7px; align-content: end; }
.mark i { display: block; background: var(--forest); border-radius: 2px; }
.mark i:nth-child(1) { height: 9px; } .mark i:nth-child(2) { height: 14px; background: #2f7a50; } .mark i:nth-child(3) { height: 5px; grid-column: 1 / -1; opacity: .7; }
.tabs { display: flex; flex-direction: column; gap: 2px; width: 100%; overflow-y: auto; scrollbar-width: none; flex: 1; min-height: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .rail-btn { position: relative; flex-direction: column; gap: 4px; border: 0; background: transparent; color: rgba(255,255,255,.6);
  border-radius: 14px; padding: 9px 2px 8px; font: 600 11px/1.1 var(--font); white-space: nowrap; justify-content: center; width: 100%; }
.tabs button svg, .rail-btn svg { width: 22px; height: 22px; }
.tabs button:hover, .rail-btn:hover { color: #fff; background: rgba(255,255,255,.07); border: 0; }
.tabs button.on { background: rgba(166,227,107,.16); color: var(--lime); }
.tabs button.on::before { content: ""; position: absolute; left: -8px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--lime); }
.tabs button em { position: absolute; top: 4px; right: 10px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--crit); color: #fff;
  font: 700 10.5px/18px var(--font); font-style: normal; text-align: center; box-shadow: 0 0 0 2px var(--forest); }
.rail-btn { margin-top: auto; }
.rail-btn:focus-visible, .tabs button:focus-visible { outline-color: var(--lime); }

/* header */
.topbar { position: fixed; z-index: 20; top: var(--gap); left: calc(var(--gap) * 2 + var(--rail-w)); right: var(--gap); height: 56px; display: flex; align-items: center; gap: 12px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.ptitle { padding: 0 6px; min-width: 0; }
.ptitle b { display: block; font: 800 20px/1.1 var(--font); letter-spacing: -.03em; }
.ptitle small { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.clock { margin: 0 auto; display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: var(--r-pill); }
.time { font: 700 14px var(--font); padding: 0 10px; white-space: nowrap; min-width: 150px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r-pill); padding: 3px; }
.seg button { border: 0; background: transparent; border-radius: var(--r-pill); padding: 5px 10px; color: var(--muted); }
.seg button.on { background: var(--forest); color: #fff; }
.chip { border-radius: var(--r-pill); background: var(--surface-2); border-color: transparent; padding: 6px 11px; }
.tariff { font: 600 12px var(--font); padding: 6px 11px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.tariff.peak { background: var(--warn-soft); color: #9a5a08; } .tariff.night { background: #e6eefc; color: #2c4a9a; }
.iot { font: 600 12px var(--font); padding: 6px 11px; border-radius: var(--r-pill); background: var(--ok-soft); color: #0e6b3b; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.iot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.actions { display: flex; gap: 8px; }
.actions button { border-radius: var(--r-pill); padding: 11px 16px; box-shadow: var(--shadow-sm); white-space: nowrap; }
.float-btn { background: var(--surface); border-color: transparent; }
button.primary, button.dark { background: var(--forest); color: #fff; border-color: var(--forest); }
button.primary:hover, button.dark:hover { background: var(--forest-2); }
#autoBtn { background: var(--lime); color: var(--forest); border-color: var(--lime); font-weight: 700; }
#autoBtn:hover { background: #b8ec85; }
#opBtn.on { background: var(--ok-soft); color: #0e6b3b; }

/* KPI row floating over the map */
.kpis { position: fixed; z-index: 10; top: 80px; left: var(--map-l); right: var(--map-r); display: grid; grid-template-columns: 1.25fr 1fr 1fr 1fr; gap: 10px; }
.kpi { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 13px 16px; display: grid; align-content: start; gap: 2px; min-width: 0; }
.kpi > span, .kpi div > span { font: 600 12px var(--font); color: var(--muted); }
.kpi .kv { display: block; font: 800 clamp(18px, 1.55vw, 30px)/1.1 var(--font); letter-spacing: -.035em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .kv i, .kpi small i { font-style: normal; } .kpi .kv u { text-decoration: none; font-size: 14px; font-weight: 700; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.kpi small { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.hot.on .kv { color: var(--crit); } .kpi.hot.on small { color: var(--crit); font-weight: 600; }
.kpi.hero { background: var(--forest); color: #fff; grid-template-columns: auto 1fr; align-items: center; gap: 12px; }
.kpi.hero span { color: rgba(255,255,255,.62); } .kpi.hero small { color: rgba(255,255,255,.62); }
.kpi.hero .kv { font-size: clamp(16px, 1.3vw, 22px); } .kpi.hero .kv em { font-style: normal; color: var(--lime); }
.ring { --p: 0; width: 70px; aspect-ratio: 1; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--forest) 78%, transparent 79%), conic-gradient(var(--lime) calc(var(--p) * 1%), rgba(255,255,255,.14) 0); }
.ring b { font: 800 25px/1 var(--font); letter-spacing: -.04em; color: #fff; }
.kpis .provline { grid-column: 1 / -1; justify-self: start; margin: 0; display: flex; align-items: center; gap: 8px; max-width: 100%;
  font-size: 12px; color: var(--ink-2); background: rgba(255,255,255,.82); padding: 4px 6px 4px 4px; border-radius: var(--r-pill); white-space: nowrap; box-shadow: var(--shadow-sm); }
.kpis .provline > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.kpis .provline a { flex: none; font-weight: 600; text-decoration: none; color: var(--accent); padding-right: 6px; }

/* main panel */
.panel { position: fixed; z-index: 10; top: 80px; bottom: var(--gap); left: calc(var(--gap) * 2 + var(--rail-w)); width: var(--panel-w); display: flex; flex-direction: column; overflow: hidden; }
.phead { padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.phead h2 { margin: 0; font: 800 23px/1.15 var(--font); letter-spacing: -.03em; }
.phead p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.pcontent { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tab { display: none; padding: 16px 20px 24px; overflow-y: auto; flex: 1; min-height: 0; scrollbar-width: thin; scrollbar-color: #cfd9d2 transparent; font-size: 14px; }
.tab.on { display: block; }
.tab > select:first-child { width: 100%; margin-bottom: 4px; }
.tab h3 { font-size: 16px; margin: 22px 0 10px; }
.card { border-radius: 18px; padding: 13px 15px; }
.card .t { font-size: 14.5px; } .card .d { font-size: 13.5px; } .card .m { font-size: 12.5px; }
.prio { border-radius: 18px; padding: 14px 16px; } .prio .t { font-size: 14.5px; }
.stat b { font-size: 18px; } .stat span { font-size: 12px; }
.loop li { background: var(--accent-soft); color: #145c35; }

/* right column */
.rightcol { position: fixed; z-index: 10; top: 80px; right: var(--gap); bottom: var(--gap); width: var(--right-w); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.rightcol > * { pointer-events: auto; flex: none; }
.rightcol > .board { flex: 0 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #cfd9d2 transparent; }
.layers { padding: 12px; display: grid; gap: 9px; }
.viewctl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.viewctl button { flex-direction: column; gap: 3px; padding: 8px 2px; font-size: 11.5px; background: var(--surface-2); border-color: transparent; border-radius: 14px; }
.viewctl button.on { background: var(--forest); color: var(--lime); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ink-2); padding: 2px 2px 0; }
.legend span { display: flex; align-items: center; gap: 6px; }
.sw.ok { background: #f8faf8; border: 1px solid #cfd9d2; } .sw.sel { background: #3fb56f; }
.tog { font-size: 13.5px; } .tog input:checked { background: var(--accent); }
.iso { padding: 12px 14px 10px; }
.iso h4, .board h4 { margin: 0; font: 700 14.5px var(--font); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.iso h4 small { font: 500 11.5px var(--font); color: var(--muted); }
.isocal svg { width: 100%; height: auto; display: block; }
.iso-foot { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--muted); gap: 8px; }
.iso-foot b { color: var(--ink); }
.iso-key { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.iso-key i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.iso-key i:nth-child(1) { background: #c6ecbf; } .iso-key i:nth-child(2) { background: #8fd97f; } .iso-key i:nth-child(3) { background: #3fb56f; } .iso-key i:nth-child(4) { background: #14703f; }
.board { padding: 13px 15px; font-size: 13.5px; }
.board h4 { margin-bottom: 6px; position: sticky; top: -13px; background: var(--surface); padding: 2px 0 6px; z-index: 1; }
.board .r { display: grid; grid-template-columns: 1fr auto 26px; gap: 8px; padding: 6px 0; align-items: center; border-top: 1px solid var(--line); cursor: pointer; }
.board .r span:nth-child(3) { font-weight: 700; }

/* bottom dock (simulate) */
.demo { position: fixed; z-index: 10; bottom: var(--gap); left: var(--map-mid); transform: translateX(-50%); white-space: nowrap; display: flex; gap: 4px; align-items: center; padding: 6px; border-radius: var(--r-pill); }
.demo span { font-size: 12px; font-weight: 700; color: var(--muted); padding: 0 8px 0 10px; text-transform: uppercase; letter-spacing: .06em; }
.demo button { border: 0; background: var(--surface-2); border-radius: var(--r-pill); padding: 8px 13px; font-size: 13px; }
.demo button:hover { background: var(--forest); color: var(--lime); }
.demo button.clear { background: transparent; color: var(--muted); }
.maplibregl-ctrl-bottom-right { right: calc(var(--map-r) - var(--gap) + 10px) !important; bottom: 66px !important; }

/* map badges in the green theme; problem buildings get a callout label like the Farm reference */
.bmark b { background: var(--forest); }
.bmark.sel b { background: var(--lime); color: var(--forest); box-shadow: 0 0 0 3px #fff, 0 0 0 7px rgba(166,227,107,.45), 0 6px 14px rgba(15,42,31,.3); }
.bmark span { background: rgba(255,255,255,.9); backdrop-filter: blur(6px); font-size: 11.5px; padding: 3px 9px; }
.bmark.warn span, .bmark.crit span { opacity: 1; }
.bmark.crit span { color: #b3261e; } .bmark.warn span { color: #8a5207; }

/* caption + toast follow the map centre */
.caption { left: var(--map-mid); transform: translateX(-50%); width: min(620px, calc(100vw - var(--map-l) - var(--map-r) - 40px)); bottom: 74px; border-top: 4px solid var(--lime); }
.caption span { color: var(--accent); }
.toast { left: var(--map-mid); top: 186px; background: var(--forest); }

/* sizes */
@media (min-width: 1700px) { :root { --panel-w: 440px; --right-w: 300px; } }
@media (max-width: 1440px) { :root { --panel-w: 384px; --right-w: 256px; } .clock .chip { display: none; }
  .ring { width: 60px; } .ring b { font-size: 21px; } .kpi { padding: 12px 13px; } }
@media (max-width: 1280px) { :root { --panel-w: 360px; --right-w: 236px; } .tariff, .ptitle small, #qrBtn span, #opBtn span { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); } .kpis .kpi:nth-child(n+3) { display: none; } }
@media (max-height: 780px) and (min-width: 1001px) {
  :root { --gap: 10px; }
  .topbar { height: 50px; } .kpis, .panel, .rightcol { top: 70px; }
  .kpi { padding: 10px 13px; } .ring { width: 58px; } .ring b { font-size: 20px; }
  .phead { padding: 14px 18px 10px; } .phead h2 { font-size: 20px; } .tab { padding: 14px 18px 20px; }
  .tabs button, .rail-btn { padding: 7px 2px 6px; } .rail-logo { margin-bottom: 4px; width: 42px; height: 42px; }
  .layers { padding: 10px; gap: 7px; } .viewctl button { padding: 6px 2px; } .iso { padding: 10px 12px 8px; }
  .toast { top: 170px; }
}
@media (max-width: 1000px) {
  :root { --gap: 8px; }
  .rail { top: auto; bottom: 0; left: 0; right: 0; width: auto; height: 64px; border-radius: 18px 18px 0 0; flex-direction: row; padding: 6px 8px; }
  .rail-logo, .rail-btn { display: none; }
  .tabs { flex-direction: row; overflow-x: auto; } .tabs button { min-width: 66px; padding: 6px 4px; font-size: 10.5px; } .tabs button svg { width: 20px; height: 20px; }
  .tabs button.on::before { display: none; }
  .topbar { left: 8px; right: 8px; top: 8px; height: 48px; } .ptitle small, .clock, .actions span { display: none; } .actions { margin-left: auto; } .actions button { padding: 10px; }
  .kpis { top: 62px; left: 8px; right: 8px; grid-template-columns: 1.3fr 1fr; gap: 8px; } .kpis .kpi:nth-child(n+3), .kpis .provline { display: none; }
  .kpi .kv { font-size: 22px; } .ring { width: 52px; } .ring b { font-size: 18px; }
  .panel { top: auto; left: 8px; right: 8px; bottom: 72px; width: auto; height: 48vh; }
  .rightcol { top: 148px; left: auto; right: 8px; bottom: auto; width: auto; } .rightcol .iso, .rightcol .board, .layers .legend, .layers .tog { display: none; }
  .layers { padding: 6px; } .viewctl button { padding: 6px 8px; }
  .demo, .maplibregl-ctrl-bottom-right { display: none; }
  .caption { left: 50%; width: calc(100% - 24px); bottom: calc(48vh + 84px); }
  .toast { left: 50%; top: 150px; }
}

/* ---- cinematic intro (green): the live 3D campus is the hero ---- */
.intro-screen { position: fixed; inset: 0; z-index: 40; display: none; pointer-events: none;
  background: linear-gradient(90deg, var(--forest) 0%, var(--forest) 38%, rgba(15,42,31,.82) 47%, rgba(15,42,31,0) 64%); }
body.intro .intro-screen { display: block; animation: introIn .9s ease both; }
body.intro .topbar, body.intro .panel, body.intro .rightcol, body.intro .demo, body.intro .kpis, body.intro .rail,
body.intro .maplibregl-ctrl-bottom-right, body.intro .toast { opacity: 0; pointer-events: none; }
.topbar, .panel, .rightcol, .demo, .kpis, .rail { transition: opacity .7s ease .4s; }
.intro-copy { pointer-events: auto; position: absolute; left: clamp(28px, 6vw, 100px); top: 50%; transform: translateY(-50%); width: min(560px, 40vw); color: #fff; }
.eyebrow { display: flex; align-items: center; gap: 10px; font: 600 13px var(--font); color: rgba(255,255,255,.7); letter-spacing: .03em; margin: 0 0 24px; }
.eyebrow .mark { width: 28px; height: 28px; padding: 6px; border-radius: 9px; }
.intro-copy h1 { font: 800 clamp(46px, 6.2vw, 96px)/.93 var(--font); letter-spacing: -.05em; margin: 0 0 22px; }
.intro-copy h1 em { font-style: normal; color: var(--lime); }
.lede { font: 450 clamp(15px, 1.2vw, 18px)/1.55 var(--font); color: rgba(255,255,255,.76); margin: 0 0 26px; max-width: 34em; }
.intro-stats { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 6px 26px; margin: 0 0 30px; }
.intro-stats div { border-left: 2px solid rgba(166,227,107,.45); padding-left: 12px; }
.intro-stats dt { font: 600 11px var(--font); color: rgba(255,255,255,.6); text-transform: uppercase; letter-spacing: .07em; white-space: nowrap; }
.intro-stats dd { margin: 3px 0 0; font: 800 30px var(--font); letter-spacing: -.03em; color: var(--lime); }
.intro-cta { display: flex; flex-wrap: wrap; gap: 6px 4px; align-items: center; }
.big-btn { padding: 16px 24px; font-size: 15.5px; border-radius: var(--r-pill); background: var(--lime) !important; color: var(--forest) !important; border-color: var(--lime) !important; font-weight: 750; box-shadow: 0 14px 34px -10px rgba(166,227,107,.55); }
.big-btn:hover { background: #b8ec85 !important; }
.big-btn svg { transform: rotate(180deg); }
.ghost-btn { background: transparent; border: 0; padding: 12px 14px; color: #fff; font-size: 14px; border-radius: var(--r-pill); }
.ghost-btn:hover { background: rgba(255,255,255,.08); border: 0; }
.intro-foot { margin: 34px 0 0; font-size: 12px; color: rgba(255,255,255,.55); max-width: 40em; line-height: 1.5; }
.intro-foot a { color: var(--lime); font-weight: 600; }
.intro-hint { position: absolute; right: 28px; bottom: 22px; margin: 0; font: 600 12px var(--font); color: var(--ink-2); background: rgba(255,255,255,.85); padding: 7px 12px; border-radius: var(--r-pill); }
@keyframes introIn { from { opacity: 0; } to { opacity: 1; } }
@media (max-height: 780px) and (min-width: 1001px) {
  .intro-copy h1 { font-size: clamp(42px, 5.4vw, 74px); margin-bottom: 16px; } .eyebrow { margin-bottom: 16px; }
  .lede { margin-bottom: 18px; } .intro-stats { margin-bottom: 22px; } .intro-stats dd { font-size: 26px; } .intro-foot { margin-top: 20px; }
}
@media (max-width: 1000px) {
  .intro-screen { background: linear-gradient(0deg, var(--forest) 0%, var(--forest) 55%, rgba(15,42,31,.75) 64%, rgba(15,42,31,0) 76%); }
  .intro-copy { top: auto; bottom: 22px; transform: none; left: 18px; right: 18px; width: auto; }
  .intro-copy h1 { font-size: 42px; margin-bottom: 12px; } .lede { font-size: 14.5px; margin-bottom: 16px; }
  .intro-stats { grid-template-columns: repeat(2, auto); gap: 8px 24px; margin-bottom: 18px; } .intro-stats dd { font-size: 22px; }
  .intro-foot { margin-top: 14px; font-size: 11px; } .intro-hint { display: none; } .ghost-btn { padding: 10px 8px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { body.intro .intro-screen { animation: none; } .topbar, .panel, .rightcol, .demo, .kpis, .rail { transition: none; } }

/* =====================================================================
   Layout v3: one clean white panel of spacious cards + a full map with a field-style building card
   (reference: agri-field dashboard). Overrides layout v2.
   ===================================================================== */
:root {
  --ground: #e9ece6; --surface-2: #f5f6f3; --line: #e8ebe5;
  --cta: #f26b1d; --cta-2: #e05d12;
  --rail-w: 64px; --panel-w: 420px; --card-w: 340px;
  --map-l: calc(var(--gap) * 3 + var(--rail-w) + var(--panel-w));
  --map-r: calc(var(--card-w) + var(--gap) * 2);
  --map-mid: calc((var(--map-l) + 100vw - var(--map-r)) / 2);
}
body { background: var(--ground); font-size: 14.5px; }

/* rail: white, icon-only, dark active square, label as tooltip */
.rail { background: var(--surface); width: var(--rail-w); padding: 12px 8px; gap: 4px; border-radius: 20px; }
.rail-logo { background: var(--forest); width: 44px; height: 44px; border-radius: 14px; margin-bottom: 10px; }
.tabs { overflow: visible; }
.tabs button, .rail-btn { color: #7d8a82; width: 46px; height: 46px; padding: 0; margin: 0 auto; border-radius: 14px; }
.tabs button span, .rail-btn span { position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%); background: var(--forest); color: #fff;
  font: 600 12.5px var(--font); padding: 6px 10px; border-radius: 9px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 60; }
.tabs button:hover span, .rail-btn:hover span, .tabs button:focus-visible span { opacity: 1; }
.tabs button:hover, .rail-btn:hover { background: var(--surface-2); color: var(--ink); }
.tabs button.on { background: var(--forest); color: #fff; }
.tabs button.on::before { display: none; }
.tabs button em { top: 2px; right: 0; box-shadow: 0 0 0 2px var(--surface); }
.tabs button svg, .rail-btn svg { width: 21px; height: 21px; }

/* panel */
.panel { top: var(--gap); left: calc(var(--gap) * 2 + var(--rail-w)); width: var(--panel-w); border-radius: 20px; }
.phead { padding: 20px 22px 14px; }
.phead h2 { font-size: 24px; }
.tab { padding: 18px 22px 26px; }
.tab h3 { font-size: 16.5px; margin: 26px 0 12px; }

/* overview cards */
.ov-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; }
.ov-eyebrow { font: 600 11.5px var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.ov-head h3 { margin: 2px 0 2px; font: 800 21px var(--font); letter-spacing: -.02em; }
.ov-head small { color: var(--muted); font-size: 13px; }
.ov-score { display: grid; justify-items: center; gap: 4px; font: 600 12.5px var(--font); color: var(--muted); }
.ov-score em { font-style: normal; color: var(--accent); font-weight: 800; }
.ov-score .ring { width: 68px; background: radial-gradient(closest-side, var(--surface-2) 78%, transparent 79%), conic-gradient(var(--accent) calc(var(--p) * 1%), #dfe5dc 0); }
.ov-score .ring b { color: var(--ink); font-size: 23px; }
.ov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.tile { background: var(--surface-2); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; display: grid; gap: 3px; min-width: 0; }
.tile > span { font: 600 12.5px var(--font); color: var(--muted); }
.tile .kv { display: block; font: 800 30px/1.1 var(--font); letter-spacing: -.035em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .kv i, .tile small i { font-style: normal; } .tile .kv u { text-decoration: none; font-size: 14px; font-weight: 700; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.tile small { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.hot.on .kv { color: var(--crit); } .tile.hot.on small { color: var(--crit); font-weight: 600; }
.ov-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 18px; padding: 15px 17px; margin-bottom: 12px; box-shadow: none; }
.ov-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
.ov-row b { font-weight: 700; } .ov-row span { color: var(--muted); font-size: 13px; }
.gauge { --pos: 50%; position: relative; display: grid; grid-template-columns: repeat(40, 1fr); gap: 2px; height: 30px; margin: 12px 0 10px; }
.gauge i { border-radius: 2px; background: hsl(var(--h) 55% 52%); opacity: .9; }
.gauge b { position: absolute; top: -5px; bottom: -5px; left: var(--pos); width: 4px; margin-left: -2px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 2px #fff; }
.ov-card .provline { margin: 0; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; white-space: nowrap; min-width: 0; }
.ov-card .provline > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.ov-card .provline a { color: var(--accent); font-weight: 600; text-decoration: none; }
.ov-card.iso { padding: 15px 17px 12px; }
.ov-card.iso h4, .ov-card.board h4 { font-size: 15px; }
.ov-card.board { max-height: none; overflow: visible; }
.ov-card.board h4 { position: static; background: none; padding: 0 0 6px; }
.board .r { padding: 8px 0; font-size: 14px; }

/* map top bar: search · clock · actions */
.topbar { left: var(--map-l); right: var(--gap); top: var(--gap); height: 50px; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 46px; width: 300px; border-radius: 14px; color: var(--muted); }
.search input { border: 0 !important; background: transparent !important; padding: 0 !important; flex: 1; font: 500 14px var(--font); outline: none; }
.clock { margin: 0 auto 0 10px; height: 46px; border-radius: 14px; }
.actions button { border-radius: 13px; height: 46px; }
#autoBtn { background: var(--cta); border-color: var(--cta); color: #fff; }
#autoBtn:hover { background: var(--cta-2); }

/* building card on the map */
.bcard { position: fixed; z-index: 12; right: var(--gap); top: 74px; width: var(--card-w); max-height: calc(100vh - 160px); overflow-y: auto; padding: 18px; border-radius: 20px; display: grid; gap: 12px; scrollbar-width: thin; }
.bcard header { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.bcard h3 { margin: 0; font: 800 19px var(--font); letter-spacing: -.02em; }
.bcard header small { color: var(--muted); font-size: 12.5px; }
.bcard .icon { padding: 6px; border: 0; background: var(--surface-2); border-radius: 10px; }
.bc-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bc-dates span, .bc-health span { display: block; font: 600 12px var(--font); color: var(--muted); }
.bc-dates b { font: 800 20px var(--font); letter-spacing: -.02em; }
.bc-health .bar { height: 8px; margin-top: 8px; }
.bc-health b.st-warn { color: #9a5a08; } .bc-health b.st-crit { color: var(--crit); } .bc-health b.st-ok { color: #0e6b3b; }
.bc-sec { border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; }
.bc-sec summary { cursor: pointer; font: 700 14px var(--font); padding: 12px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.bc-sec summary::-webkit-details-marker { display: none; }
.bc-sec summary::after { content: "▾"; color: var(--muted); font-size: 12px; }
.bc-sec[open] summary::after { content: "▴"; }
.bc-sec summary em { font-style: normal; margin-left: auto; margin-right: 8px; background: var(--surface-2); padding: 1px 8px; border-radius: 99px; font-size: 12px; }
.bc-sec dl { margin: 0 0 12px; display: grid; gap: 0; }
.bc-sec dl div { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.bc-sec dt { color: var(--ink-2); } .bc-sec dd { margin: 0; font-weight: 700; } .bc-sec dd.bad { color: var(--crit); }
.bc-issue { display: block; padding: 8px 10px; margin-bottom: 8px; border-radius: 10px; background: var(--warn-soft); color: #7a4706; font-size: 13px; font-weight: 600; text-decoration: none; }
.bc-issue.crit { background: var(--crit-soft); color: #9b1f1b; }
.bc-sec .sub { margin: 0 0 12px; }
.bc-ai { background: var(--forest); color: #fff; border-radius: 14px; padding: 13px 14px; display: grid; grid-template-columns: auto 1fr; gap: 6px 8px; align-items: center; }
.bc-ai .pill { background: var(--lime); color: var(--forest); font: 800 11px var(--font); padding: 2px 7px; }
.bc-ai b { font-size: 13.5px; } .bc-ai p { grid-column: 1 / -1; margin: 0; font-size: 13.5px; line-height: 1.5; color: rgba(255,255,255,.85); }
.bc-act { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bc-act button { justify-content: center; background: var(--surface-2); border-color: transparent; padding: 10px; }

/* map tools: vertical stack bottom-left, layers pop-over */
.maptools { position: fixed; z-index: 11; left: var(--map-l); bottom: var(--gap); padding: 6px; border-radius: 18px; }
.maptools .viewctl { display: grid; grid-template-columns: 1fr; gap: 4px; }
.maptools .viewctl button { width: 58px; padding: 7px 2px; font-size: 11px; background: transparent; border: 0; border-radius: 12px; }
.maptools .viewctl button:hover { background: var(--surface-2); }
.maptools .viewctl button.on { background: var(--forest); color: #fff; }
.layers-pop { position: absolute; left: calc(100% + 10px); bottom: 0; width: 250px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 14px; display: grid; gap: 10px; }
.layers-pop .legend { padding: 0 0 4px; }
.maplibregl-ctrl-bottom-right { right: var(--gap) !important; bottom: var(--gap) !important; }

/* dock, caption, toast */
.demo { left: var(--map-mid); }
.demo span { text-transform: none; letter-spacing: 0; font-size: 13px; }
.toast { top: 74px; left: var(--map-mid); }
.caption { bottom: 74px; left: var(--map-mid); width: min(600px, calc(100vw - var(--map-l) - var(--map-r) - 40px)); border-top-color: var(--cta); }

/* intro hides the new pieces too */
body.intro .maptools, body.intro .bcard { opacity: 0; pointer-events: none; }
.maptools, .bcard { transition: opacity .7s ease .4s; }

/* sizes */
@media (min-width: 1700px) { :root { --panel-w: 460px; --card-w: 370px; } .tile .kv { font-size: 34px; } }
@media (max-width: 1440px) { :root { --panel-w: 390px; --card-w: 320px; } .tile .kv { font-size: 27px; } .search { width: 240px; } }
@media (max-width: 1280px) { :root { --panel-w: 360px; --card-w: 300px; } .search { width: 200px; } .tile .kv { font-size: 24px; } }
@media (max-height: 780px) and (min-width: 1001px) {
  .phead { padding: 16px 20px 12px; } .phead h2 { font-size: 21px; } .tab { padding: 14px 20px 22px; }
  .ov-head { padding: 13px 16px; } .ov-score .ring { width: 58px; } .ov-score .ring b { font-size: 20px; }
  .tile { padding: 12px 14px; } .tile .kv { font-size: 26px; }
  .topbar { height: 46px; } .search, .clock, .actions button { height: 44px; }
  .bcard { top: 66px; padding: 15px; gap: 10px; max-height: calc(100vh - 140px); }
  .tabs button, .rail-btn { width: 42px; height: 42px; }
}
@media (max-width: 1000px) {
  :root { --panel-w: 100%; }
  .rail { width: auto; height: 62px; padding: 6px 8px; border-radius: 18px 18px 0 0; }
  .tabs button { width: auto; min-width: 54px; height: 50px; } .tabs button span { display: none; }
  .panel { left: 8px; right: 8px; top: auto; bottom: 70px; width: auto; height: 50vh; }
  .topbar { left: 8px; right: 8px; } .search { width: auto; flex: 1; } .clock { display: none; }
  .bcard, .maptools { display: none; }
  .tile .kv { font-size: 22px; }
}
/* v3 fixes: compact top bar, tools top-left, card clear of the zoom buttons */
@media (max-width: 1600px) { .clock .chip, .tariff { display: none; } #qrBtn span, #opBtn span { display: none; } #qrBtn, #opBtn { width: 46px; justify-content: center; padding: 0; } }
.maptools { top: 74px; bottom: auto; }
.layers-pop { top: 0; bottom: auto; }
.bcard { max-height: calc(100vh - 74px - 136px); }
@media (max-height: 780px) and (min-width: 1001px) { .maptools { top: 66px; } .bcard { max-height: calc(100vh - 66px - 128px); } .maptools .viewctl button { padding: 5px 2px; } }
.chip, .time { white-space: nowrap; }
@media (max-width: 2100px) { .clock .chip { display: none; } }
@media (max-width: 1800px) { .tariff { display: none; } }
@media (min-width: 1601px) and (max-width: 2100px) { .search { width: 260px; } }
@media (max-width: 1440px) { .search { width: 190px; } .time { min-width: 0; } }
.bcard { max-height: calc(100vh - 74px - 156px); }
@media (max-height: 780px) and (min-width: 1001px) { .bcard { max-height: calc(100vh - 66px - 150px); } }
@media (max-width: 1000px) { .search { min-width: 0; } .actions { flex: none; } #autoBtn span { display: none; } #autoBtn { width: 46px; justify-content: center; padding: 0; } }

.camrow { align-items: center; }
.camstate { font-size: 12.5px; color: var(--muted); flex-basis: 100%; }
.camstate.on { color: #0e6b3b; font-weight: 600; } .camstate.on::before { content: "● "; color: var(--crit); }
.camstate.wait { color: #8a5207; } .camstate.err { color: var(--crit); font-weight: 600; }

.scndlg { max-width: 560px; }
.scndlg h2 { margin: 10px 0 4px; }
.scn-steps { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 10px; }
.scn-steps li::marker { font-weight: 800; color: var(--accent); }
.scn-steps p { margin: 3px 0 0; font-size: 14px; color: var(--ink-2); }
.scn-steps table { margin-top: 4px; }
.scn-act { justify-content: flex-end; margin-top: 16px; }

.co2-big b { display: block; font: 800 26px var(--font); letter-spacing: -.03em; color: var(--ink); }
.co2-big span { font-size: 12.5px; color: var(--muted); }
.co2-row { display: grid; grid-template-columns: 1fr 90px 52px; gap: 8px; align-items: center; margin-top: 8px; font-size: 13px; color: var(--ink); }
.co2-row b { text-align: right; } .co2 details p { font-size: 12.5px; margin: 6px 0 0; }
