/* Lahan EV CMS — matches the "Lahan EV CMS Preview" design canvas */
:root {
  --bg: #F3F2EE;
  --card: #FFFFFF;
  --line: #E2E0D8;
  --line-soft: #EFEDE7;
  --line-strong: #D5D2C8;
  --ink: #16212B;
  --ink-2: #3E4A55;
  --muted: #56626D;
  --nav: #13202B;
  --nav-2: #1A2B38;
  --nav-active: #22384A;
  --nav-ink: #D6DEE5;
  --nav-muted: #9FB0BE;
  --green: #0B7A5E;
  --green-ink: #0B6B52;
  --green-dark: #08513E;
  --green-soft: #E3F2EC;
  --green-track: #DCE9E3;
  --green-card: #F7FBF9;
  --green-line: #CFE6DC;
  --blue-soft: #E6EEF8;
  --blue-ink: #1B4F8C;
  --amber-soft: #FDF0E1;
  --amber-ink: #8A4A0B;
  --amber-card: #FFFBF5;
  --amber-line: #F1D9B8;
  --red: #B42318;
  --red-ink: #9B1C12;
  --red-card: #FFF8F7;
  --red-line: #F3C9C4;
  --gray-soft: #ECEBE6;
  --panel: #F6F5F1;
  --head: Archivo, 'Segoe UI', system-ui, sans-serif;
  --body: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', Consolas, 'Courier New', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 14px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
a { color: var(--green-ink); }
a:hover { color: var(--green-dark); }
button, input, select, textarea { font-family: inherit; font-size: 14px; color: inherit; }
h1, h2, h3 { font-family: var(--head); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.boot { padding: 40px; color: var(--muted); }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.nav { width: 232px; flex-shrink: 0; background: var(--nav); color: var(--nav-ink); padding: 24px 16px; display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-name { font-family: var(--head); font-weight: 800; font-size: 17px; color: #fff; }
.brand-sub { font-size: 12px; color: var(--nav-muted); }
.nav-links { display: flex; flex-direction: column; gap: 2px; }
.nav-links a { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 8px; color: var(--nav-ink); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav-links a:hover { background: var(--nav-2); color: #fff; }
.nav-links a[aria-current="page"] { background: var(--nav-active); color: #fff; font-weight: 600; }
.nav-links .badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: #F5A524; color: #13202B; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.nav-user { margin-top: auto; padding: 12px; border-radius: 8px; background: var(--nav-2); display: flex; flex-direction: column; gap: 4px; }
.nav-user .who { font-size: 14px; font-weight: 600; color: #fff; }
.nav-user button { margin-top: 6px; background: none; border: 1px solid #33495B; color: var(--nav-ink); border-radius: 6px; height: 34px; cursor: pointer; }
.nav-user button:hover { background: var(--nav-active); }
.conn-dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; background: #3CC99A; margin-right: 6px; }
.conn-dot.off { background: #E5484D; }

.topbar { display: none; }
.main { flex: 1; min-width: 0; padding: 26px 32px 40px; display: flex; flex-direction: column; gap: 18px; }
#main-view > .view { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ---------- common blocks ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head .sub { font-size: 14px; color: var(--muted); margin-top: 4px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { font-weight: 600; }
.head-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; min-width: 0; }
.card.pad-lg { padding: 22px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head .meta { font-size: 13px; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; }
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .value { font-family: var(--head); font-size: 30px; font-weight: 700; line-height: 1.1; }
.kpi .value .unit { font-size: 16px; color: var(--muted); font-weight: 600; }
.kpi .foot { font-size: 13px; color: var(--muted); }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-val { font-family: var(--mono); font-size: 22px; font-weight: 500; }
.stat-val.sm { font-size: 18px; }
.tile { padding: 12px; border-radius: 8px; background: var(--panel); }
.tile .stat-label { font-size: 12px; }

.pill { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill.sm { height: 22px; padding: 0 8px; font-size: 11px; }
.st-Charging { background: var(--green); color: #fff; }
.st-Available { background: var(--blue-soft); color: var(--blue-ink); }
.st-Preparing, .st-SuspendedEV, .st-SuspendedEVSE, .st-Finishing, .st-Reserved, .st-unbilled, .st-unpaid { background: var(--amber-soft); color: var(--amber-ink); }
.st-Faulted { background: var(--red); color: #fff; }
.st-Unavailable, .st-Offline, .st-void, .st-unknown { background: var(--gray-soft); color: var(--muted); }
.st-paid, .st-online { background: var(--green-soft); color: var(--green-ink); }
.st-credit { background: var(--blue-soft); color: var(--blue-ink); }
.st-active { background: var(--green); color: #fff; }

.online-pill { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--green-soft); color: var(--green-ink); font-size: 13px; font-weight: 600; }
.online-pill .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--green); }
.online-pill.off { background: #FBE9E7; color: var(--red-ink); }
.online-pill.off .dot { background: var(--red); }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--panel); color: var(--ink); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-ink); color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover { background: var(--red-ink); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--green-ink); padding: 0 8px; }
.btn.ghost:hover { background: var(--green-soft); }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 52px; font-size: 15px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg { display: grid; gap: 8px; }
.seg button { height: 52px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { border: 2px solid var(--green); background: var(--green-soft); color: var(--green-ink); font-weight: 700; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; min-width: 0; }
.field input, .field select, .field textarea, input.inp, select.inp {
  height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink); font-size: 15px; width: 100%; min-width: 0;
}
.field textarea { height: auto; min-height: 80px; padding: 10px 12px; }
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus { outline: 2px solid var(--green); outline-offset: -1px; border-color: var(--green); }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.toolbar .field { min-width: 140px; }
.toolbar .grow { flex: 1; min-width: 200px; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.tbl tbody tr.link { cursor: pointer; }
.tbl tbody tr.link:hover td { background: #FAFAF7; }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line-strong); padding-top: 10px; }
.empty { padding: 28px 10px; text-align: center; color: var(--muted); }

/* ---------- live dashboard ---------- */
.live-main { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.gun-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.gun { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; color: var(--ink); text-decoration: none; min-width: 0; min-height: 150px; }
a.gun:hover { color: var(--ink); border-color: var(--green); }
.gun.charging { border-color: var(--green-line); background: var(--green-card); }
.gun.warn { border-color: var(--amber-line); background: var(--amber-card); }
.gun.fault { border-color: var(--red-line); background: var(--red-card); }
.gun.off { background: #F7F6F2; }
.gun-top { display: flex; justify-content: space-between; align-items: center; gap: 4px 6px; flex-wrap: wrap; }
.gun-top > div:first-child { flex-shrink: 0; max-width: 100%; }
.gun-name { font-family: var(--head); font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gun-type { font-size: 11px; color: var(--muted); font-weight: 500; }
.gun-edit { border: none; background: transparent; color: var(--muted); width: 28px; height: 28px; margin-left: 2px; border-radius: 6px; cursor: pointer; vertical-align: middle; display: inline-flex; align-items: center; justify-content: center; }
.gun-edit:hover { background: rgba(19,32,43,.08); color: var(--ink); }
.gun-name { display: flex; align-items: center; min-width: 0; }
.gun-name .gn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.gun-soc { display: flex; align-items: baseline; gap: 6px; }
.gun-soc b { font-family: var(--head); font-size: 24px; font-weight: 700; }
.bar { height: 6px; border-radius: 999px; background: var(--green-track); overflow: hidden; }
.bar > div { height: 6px; border-radius: 999px; background: var(--green); }
.gun-meta { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; color: var(--ink-2); gap: 6px; }
.gun-msg { flex-grow: 1; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.gun .btn { height: 40px; font-size: 13px; margin-top: auto; }
.feed { background: var(--nav); color: var(--nav-ink); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.feed h2 { color: #fff; }
.feed-list { display: flex; flex-direction: column; gap: 9px; font-family: var(--mono); font-size: 12px; line-height: 1.35; overflow: hidden; max-height: 330px; }
.feed-row { display: flex; gap: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-row .t { color: #8193A2; }
.feed-row .a { color: #fff; min-width: 108px; }
.feed-row .ok { color: #8FE0C4; }
.feed-row .bad { color: #FFB4AB; }
.feed a { color: #8FE0C4; font-weight: 600; font-size: 13px; margin-top: auto; }
.feed-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #8FE0C4; }
.feed-status .d { width: 7px; height: 7px; border-radius: 999px; background: #3CC99A; }
.feed-status.off { color: #FFB4AB; }
.feed-status.off .d { background: #E5484D; }

/* ---------- session ---------- */
.sess-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ring-wrap { display: flex; gap: 28px; align-items: center; }
.ring { position: relative; width: 176px; height: 176px; flex-shrink: 0; }
.ring .inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ring .soc-up { display: flex; align-items: center; gap: 2px; margin-top: 2px; font-family: var(--head); font-weight: 700; font-size: 16px; color: var(--green); }
.ring .pct { font-family: var(--head); font-weight: 800; font-size: 40px; }
.metrics { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 16px; }
.metrics > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; }
.kv > :nth-child(odd) { color: var(--muted); }
.kv > :nth-child(even) { text-align: right; font-family: var(--mono); overflow-wrap: anywhere; }
.plate-box { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 8px; background: var(--panel); gap: 8px; }
.chart-box { width: 100%; }
.chart-box svg { width: 100%; height: 200px; display: block; }

/* ---------- session graphs ---------- */
.sc-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.sc-range { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.sc-range button { height: 36px; padding: 0 12px; border: none; border-right: 1px solid var(--line-strong); background: #fff; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.sc-range button:last-child { border-right: none; }
.sc-range button[aria-pressed="true"] { background: var(--green-soft); color: var(--green-ink); }
.sc-readout { font-size: 12px; color: var(--muted); }
.sc-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.sc-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 4px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; cursor: pointer; font-size: 13px; color: var(--muted); }
.sc-chip .sc-swatch { width: 14px; height: 4px; border-radius: 2px; background: var(--c); opacity: .35; }
.sc-chip .sc-name { font-weight: 600; }
.sc-chip .sc-val { font-size: 13px; color: var(--muted); }
.sc-chip[aria-pressed="true"] { border-color: var(--c); color: var(--ink); background: #fff; box-shadow: inset 0 0 0 1px var(--c); }
.sc-chip[aria-pressed="true"] .sc-swatch { opacity: 1; }
.sc-chip[aria-pressed="true"] .sc-val { color: var(--ink); font-weight: 500; }
.sc-chip[aria-pressed="false"] { text-decoration: none; opacity: .75; }
.sc-plot { position: relative; }
.sc-svg { width: 100%; height: 220px; display: block; touch-action: pan-y; cursor: crosshair; }
.sc-pt { position: absolute; width: 9px; height: 9px; border-radius: 999px; border: 2px solid #fff; transform: translate(-50%, -50%); pointer-events: none; display: none; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.sc-axis { position: relative; height: 18px; font-size: 11px; color: var(--muted); }
.sc-axis span { position: absolute; top: 4px; transform: translateX(-50%); white-space: nowrap; }
.sc-axis span:first-child { transform: none; }
.sc-axis span:last-child { transform: translateX(-100%); }
@media (max-width: 520px) {
  .sc-svg { height: 190px; }
  .sc-chip { padding: 4px 10px; font-size: 12px; }
}

/* ---------- billing ---------- */
.bill-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.lines { display: flex; flex-direction: column; font-size: 14px; }
.lines .ln { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); align-items: center; }
.lines .ln .v { font-family: var(--mono); white-space: nowrap; }
.lines .ln.muted { color: var(--muted); border-bottom: none; }
.lines .ln.sep { border-bottom: 1px solid var(--line-strong); }
.lines .total { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 0 0; }
.lines .total .v { font-family: var(--head); font-weight: 800; font-size: 32px; }
.qr-zone { border: 2px dashed #CFCBC0; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center; min-height: 260px; }
.qr-zone img { width: 200px; height: 200px; object-fit: contain; border-radius: 8px; background: #fff; }
.qr-ph { width: 180px; height: 180px; border-radius: 8px; background: var(--panel); display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--muted); padding: 10px; }
.warn-box { padding: 10px 12px; border-radius: 8px; background: var(--amber-soft); color: var(--amber-ink); font-size: 13px; }
.err-box { padding: 10px 12px; border-radius: 8px; background: #FBE9E7; color: var(--red-ink); font-size: 13px; }
.ok-box { padding: 10px 12px; border-radius: 8px; background: var(--green-soft); color: var(--green-ink); font-size: 13px; }
.inline-inp { width: 80px; height: 34px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; font-family: var(--mono); text-align: right; }

/* ---------- receipt ---------- */
.receipt { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 18px 16px; font-family: var(--mono); font-size: 12px; line-height: 1.55; display: flex; flex-direction: column; gap: 6px; color: #000; }
.receipt .c { text-align: center; }
.receipt .r { display: flex; justify-content: space-between; gap: 8px; }
.receipt .r span:last-child { text-align: right; }
.receipt .hr { border-top: 1px dashed #9A968B; margin: 2px 0; }
.receipt .big { font-weight: 600; font-size: 14px; }
#print-root { display: none; }

/* ---------- log ---------- */
.log-row td { font-family: var(--mono); font-size: 12px; }
.log-row .dir-in { color: var(--blue-ink); font-weight: 600; }
.log-row .dir-out { color: var(--green-ink); font-weight: 600; }
.log-row .dir-sys { color: var(--muted); }
.log-payload { max-width: 520px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
pre.json { background: var(--nav); color: #D6DEE5; padding: 12px; border-radius: 8px; overflow: auto; font-size: 12px; max-height: 420px; margin: 0; white-space: pre-wrap; word-break: break-all; }

/* ---------- reports chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 8px; }
.bars .b { flex: 1; background: var(--green); border-radius: 3px 3px 0 0; min-width: 4px; position: relative; }
.bars .b:hover { background: var(--green-ink); }
.bars-x { display: flex; gap: 4px; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.bars-x span { flex: 1; text-align: center; overflow: hidden; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { height: 42px; padding: 0 14px; border: none; background: none; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--green); }

/* ---------- modal & toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(19, 32, 43, .55); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; padding: 22px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-head .x { width: 40px; height: 40px; border: none; background: var(--panel); border-radius: 8px; cursor: pointer; font-size: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: calc(100vw - 32px); }
.toast { background: var(--nav); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 420px; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }

/* ---------- search picker ---------- */
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.12); max-height: 260px; overflow-y: auto; z-index: 5; }
.picker-list button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: none; background: none; cursor: pointer; border-bottom: 1px solid var(--line-soft); }
.picker-list button:hover, .picker-list button:focus { background: var(--green-soft); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--nav); }
.login { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .bill-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .bill-grid > :last-child { grid-column: 1 / -1; max-width: 340px; }
}
@media (max-width: 1100px) {
  .live-main, .sess-grid { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .nav { position: fixed; left: 0; top: 0; bottom: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; height: 100%; }
  .nav.open { transform: none; box-shadow: 0 0 0 100vmax rgba(19,32,43,.5); }
  .topbar { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px; background: var(--nav); color: #fff; position: sticky; top: 0; z-index: 30; }
  .topbar button { width: 44px; height: 44px; border: none; background: var(--nav-2); color: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
  .topbar .t { font-family: var(--head); font-weight: 800; font-size: 16px; }
  .main { padding: 16px 16px 40px; }
  h1 { font-size: 23px; }
  .gun-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g2, .g3, .bill-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .bill-grid > :last-child { max-width: none; }
  .ring-wrap { flex-direction: column; align-items: stretch; }
  .ring { align-self: center; }
  .kpi .value { font-size: 24px; }
}
@media (max-width: 420px) {
  .g4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .kpi { padding: 12px; }
  .metrics { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 10px; }
}


/* ---------- desk: banners, attention list, counter, QR, day sheet ---------- */
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; border: 1px solid; font-size: 14px; }
.banner > svg { flex-shrink: 0; }
.banner > div { flex: 1; min-width: 0; }
.banner .small { margin-top: 2px; }
.banner .btn { flex-shrink: 0; }
.banner.red { background: var(--red-card); border-color: var(--red-line); color: var(--red-ink); }
.banner.amber { background: var(--amber-card); border-color: var(--amber-line); color: var(--amber-ink); }
.banner.green { background: var(--green-card); border-color: var(--green-line); color: var(--green-ink); }
.banner a { font-weight: 600; }
.attn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.attn { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line-soft); }
.attn:last-child { border-bottom: none; }
.attn-dot { width: 10px; height: 10px; border-radius: 999px; flex-shrink: 0; background: var(--line-strong); }
.attn.p1 .attn-dot { background: var(--red); box-shadow: 0 0 0 4px #FBE9E7; }
.attn.p2 .attn-dot { background: #E07B1A; }
.attn.p3 .attn-dot { background: #E9B949; }
.attn.p4 .attn-dot { background: #B9C2CA; }
.attn-main { flex: 1; min-width: 0; }
.attn-title { font-weight: 600; font-size: 14px; }
.attn.p1 .attn-title { color: var(--red-ink); }
.attn-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.attn-act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.attn-act .btn { height: 34px; }
.attn-clear { display: flex; align-items: center; gap: 8px; color: var(--green-ink); font-weight: 600; font-size: 14px; padding: 6px 2px; }
.attn-list.compact .attn { padding: 8px 2px; }
.tel { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; text-decoration: none; white-space: nowrap; }
a.btn.tel { color: var(--green-ink); }
.gun-flag { color: var(--red); display: inline-flex; margin-left: 2px; }
.gun.attn-amber { border-color: var(--amber-line); background: var(--amber-card); }
.top-unsettled { display: none; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.prob-row { padding: 8px 0; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 4px; align-items: flex-start; font-size: 13px; }
.prob-row:last-child { border-bottom: none; }
.det { display: flex; flex-direction: column; gap: 14px; }
.kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 12px; }

.counter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tile-gun { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 14px; display: flex; flex-direction: column; gap: 6px; min-height: 150px; }
.tile-gun.charging { border-color: var(--green-line); background: var(--green-card); }
.tile-gun.amber { border-color: var(--amber-line); background: var(--amber-card); }
.tile-gun.red { border-color: var(--red-line); background: var(--red-card); }
.tile-gun.off { background: #F7F6F2; color: var(--muted); }
.tg-head { display: flex; align-items: center; gap: 6px; }
.tg-name { font-family: var(--head); font-weight: 800; font-size: 20px; }
.tg-type { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 600; }
.tile-flag { color: var(--red); display: inline-flex; }
.tg-line { font-weight: 600; font-size: 15px; }
.tg-sub { font-size: 13px; color: var(--ink-2); min-height: 18px; }
.tg-act { margin-top: auto; display: flex; }
.tg-act .btn { flex: 1; height: 48px; font-size: 15px; }

.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.qr-card { border: 2px dashed var(--line-strong); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; break-inside: avoid; }
.qr-svg { width: 180px; height: 180px; }
.qr-svg svg { width: 100%; height: 100%; display: block; }
.qr-gun { font-family: var(--head); font-weight: 800; font-size: 28px; }
.qr-say { font-size: 13px; }
.qr-url { font-size: 10px; color: var(--muted); overflow-wrap: anywhere; }

.a4 { font-size: 12px; color: #000; }
.a4-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.a4-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 14px; margin-bottom: 10px; }
.a4-kpis b { font-size: 16px; font-family: var(--mono); font-weight: 500; }
.a4-tbl { font-size: 12px; }
.a4-tbl td, .a4-tbl th { padding: 5px 4px; }
.a4-tbl tr.bad td { background: #FDECEA; }
.a4-sign { display: flex; justify-content: space-between; margin-top: 28px; gap: 20px; flex-wrap: wrap; }
.receipt-big .receipt { font-size: 15px; max-width: 420px; margin: 0 auto; }

@media (max-width: 860px) {
  .top-unsettled { display: inline-flex; align-items: center; gap: 4px; color: #fff; text-decoration: none; margin-left: 8px; }
  .top-unsettled .unsettled-count { background: #F5A524; color: #13202B; border-radius: 999px; font-size: 12px; font-weight: 700; padding: 1px 7px; }
  .attn { flex-wrap: wrap; }
  .attn-act { width: 100%; justify-content: flex-start; padding-left: 22px; }
  .a4-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .banner { flex-wrap: wrap; }
  .counter-grid { grid-template-columns: minmax(0, 1fr); }
}

.bill-checks ul { margin: 6px 0; padding-left: 18px; }
.bill-checks li { margin: 2px 0; }
.day-checks td { vertical-align: top; }

.ledger .tbl td { vertical-align: top; }
.ledger tr.tot td { border-top: 2px solid var(--ink); }

.period { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-end; }
.period button { height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); font: 600 13px var(--body); cursor: pointer; }
.period button[aria-pressed="true"] { border: 2px solid var(--green); background: var(--green-soft); color: var(--green-ink); }
.period-note { font-size: 12px; color: var(--muted); margin-top: 6px; }

.attn-hide { width: 30px; height: 30px; border: none; background: transparent; color: var(--muted); border-radius: 6px; cursor: pointer; font-size: 14px; flex-shrink: 0; }
.attn-hide:hover { background: var(--gray-soft); color: var(--ink); }
.attn-hidden-link { margin-top: 6px; }

/* ---------- A5 tax invoice ---------- */
.a5inv { width: 136mm; max-width: 100%; box-sizing: border-box; background: #fff; color: #000; font: 9pt Arial, Helvetica, sans-serif; line-height: 1.3; padding: 6mm; border: 1px solid var(--line); position: relative; }
.a5inv.void::after { content: 'VOID'; position: absolute; inset: 40% 0 auto; text-align: center; font: 700 60pt Arial; color: rgba(180, 35, 24, .18); transform: rotate(-20deg); pointer-events: none; }
.a5-head { text-align: center; line-height: 1.35; }
.a5-name { font-size: 14pt; font-weight: 700; }
.a5-panrow { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 3px; }
.a5-pan { display: flex; align-items: center; gap: 0; }
.a5-pan b { margin-right: 6px; }
.a5-pan span { display: inline-block; min-width: 4.2mm; text-align: center; border: 1px solid #000; border-left: none; padding: 1px 0; font-weight: 700; }
.a5-pan span:first-of-type { border-left: 1px solid #000; }
.a5-box { border: 1px solid #000; }
.a5-title { text-align: center; font-weight: 700; border-bottom: 1px solid #000; padding: 2px; }
.a5-parties { display: grid; grid-template-columns: 1.25fr 1fr; border-bottom: 1px solid #000; }
.a5-parties .a5-kv:first-child { border-right: 1px solid #000; }
.a5-kv { width: 100%; border-collapse: collapse; }
.a5-kv td { padding: 1px 4px; vertical-align: top; }
.a5-parties .a5-kv:last-child td:last-child { white-space: nowrap; }
.a5-kv td:first-child { white-space: nowrap; width: 1%; }
.a5-loc { display: grid; grid-template-columns: 1.25fr 1fr; border-bottom: 1px solid #000; }
.a5-loc > div { padding: 2px 4px; }
.a5-loc > div:first-child { border-right: 1px solid #000; }
.a5-items { width: 100%; border-collapse: collapse; }
.a5-items th { text-align: left; font-weight: 700; border-bottom: 1px solid #000; padding: 2px 3px; }
.a5-items th, .a5-items td { border-right: 1px solid #000; }
.a5-items th:last-child, .a5-items td:last-child { border-right: none; }
.a5-items td { padding: 3px; vertical-align: top; }
.a5-items .n { text-align: right; }
.a5-items .d { width: 42%; }
.a5-sub { font-size: 8pt; color: #333; margin-top: 1px; }
.a5-items tr.a5-fill td { height: 48mm; }
.a5-foot { display: grid; grid-template-columns: 1fr 52mm; border-top: 1px solid #000; }
.a5-left { border-right: 1px solid #000; display: flex; flex-direction: column; }
.a5-qty { text-align: right; padding: 2px 4px; border-bottom: 1px solid #000; }
.a5-words { padding: 3px 4px; border-bottom: 1px solid #000; line-height: 1.4; }
.a5-remarks { padding: 3px 4px; font-size: 8.5pt; line-height: 1.35; }
.a5-tot { width: 100%; border-collapse: collapse; align-self: start; }
.a5-tot td { padding: 2px 4px; }
.a5-tot .n { text-align: right; }
.a5-tot tr.sep td, .a5-tot tr.net td { border-top: 1px solid #000; }
.a5-tot tr.net td { padding: 6px 4px; font-size: 10.5pt; }
.a5-for { text-align: right; font-weight: 700; margin: 4px 0 14px; }
.a5-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8mm; text-align: center; }
.a5-who { border-bottom: 1px solid #000; min-height: 16px; text-align: left; padding-left: 6mm; }
.a5-sign span { display: block; margin-top: 4px; }
.a5-footer { text-align: center; margin-top: 6px; font-weight: 700; letter-spacing: .5px; }
.inv-preview { overflow-x: auto; }
.a5-mini { overflow: hidden; }
.a5-mini .a5inv { zoom: .56; }
.inv-preview .a5inv { transform-origin: top left; }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); font: 600 13px var(--body); cursor: pointer; }
.tag-chip[aria-pressed="true"] { border: 2px solid var(--green); background: var(--green-soft); color: var(--green-ink); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--gray-soft); color: var(--ink-2); font: 600 12px var(--body); text-decoration: none; }
.thread { display: flex; flex-direction: column; gap: 10px; }
.th-item { padding: 10px 12px; border-radius: 10px; background: var(--panel); }
.th-item.first { background: #fff; border: 1px solid var(--line); }
.th-item.question { background: var(--amber-card); border: 1px solid var(--amber-line); }
.th-item.solved { background: var(--green-card); border: 1px solid var(--green-line); }
.th-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* ---------- floating estimator ---------- */
.est-fab { position: fixed; right: 14px; bottom: 14px; z-index: 45; height: 44px; width: 44px; padding: 0; border: none; border-radius: 999px; background: var(--green); color: #fff; font: 600 15px var(--body); display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 12px rgba(11, 122, 94, .25); cursor: pointer; opacity: .55; transition: opacity .15s, width .15s, padding .15s; overflow: hidden; white-space: nowrap; }
/* small, see-through round button; the word shows when the mouse is on it or it is open. The page gets room at the bottom so nothing stays hidden under it */
.est-fab span { display: none; }
.est-fab:hover, .est-fab:focus-visible, .est-fab[aria-expanded="true"] { opacity: 1; width: auto; padding: 0 18px 0 14px; }
.est-fab:hover span, .est-fab:focus-visible span, .est-fab[aria-expanded="true"] span { display: inline; }
body.est-on #main-view { padding-bottom: 72px; }
.est-fab:hover { background: var(--green-ink); }
.est-fab[aria-expanded="true"] { background: var(--green-dark); }
body.est-on #toasts { bottom: 70px; }
.est { position: fixed; right: 20px; bottom: 88px; z-index: 46; width: min(440px, calc(100vw - 16px)); max-height: calc(100vh - 104px); background: #fff; border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: 0 20px 60px rgba(19, 32, 43, .25); display: flex; flex-direction: column; overflow: hidden; font-family: var(--body); color: var(--ink); }
.est.moved { right: auto; bottom: auto; }
.est.dragging { box-shadow: 0 28px 80px rgba(19, 32, 43, .38); }
.est-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; background: var(--nav); color: #fff; cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; flex-shrink: 0; }
.est.dragging .est-head { cursor: grabbing; }
.est-head-l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.est-grip { color: #6F8496; flex-shrink: 0; }
.est-head h2 { margin: 0; font: 700 18px var(--head); }
.est-sub { font-size: 12px; color: var(--nav-muted); }
.est-x { width: 36px; height: 36px; border: none; border-radius: 8px; background: var(--nav-2); color: #fff; font-size: 18px; cursor: pointer; flex-shrink: 0; }
.est-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; overscroll-behavior: contain; }
.est-seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.est-seg button, .est-chip { height: 44px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink); font: 600 14px var(--body); cursor: pointer; }
.est-seg button.on, .est-chip.on { border: 2px solid var(--green); background: var(--green-soft); color: var(--green-ink); }
.est-car { display: flex; flex-direction: column; gap: 8px; }
.est-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.est-chip { height: 36px; padding: 0 12px; border-radius: 999px; font-size: 13px; }
.est-carbox { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--panel); font-size: 13px; }
.est-carbox:empty { display: none; }
.est-carbox b { color: var(--ink); }
.est-socfix { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 8px; background: var(--amber-card); border: 1px solid var(--amber-line); }
.est-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.est-f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.est-f input { height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; font: 16px var(--mono); color: var(--ink); background: #fff; width: 100%; }
.est-row { display: flex; flex-direction: column; gap: 6px; }
.est-sep { padding-top: 12px; border-top: 1px solid var(--line-soft); }
.est-l3, .est-g3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.est-l3 { font-size: 13px; color: var(--muted); font-weight: 500; align-items: end; }
.est-box { display: flex; align-items: center; gap: 4px; height: 56px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 14px; color: var(--muted); background: #fff; min-width: 0; }
.est-box input { border: none; width: 100%; min-width: 0; height: 48px; font: 600 20px var(--mono); color: var(--ink); background: transparent; outline: none; padding: 0; }
.est-box:focus-within { outline: 2px solid var(--green); outline-offset: -1px; }
.est-box b { font-size: 18px; color: var(--ink); }
.est-target, .est-strong { border: 2px solid var(--green); }
.est-target input { font-size: 22px; }
.est-target.bad { border-color: var(--red); }
.est-out { display: flex; align-items: center; justify-content: flex-end; gap: 4px; height: 56px; padding: 0 10px; border-radius: 8px; font: 800 22px var(--head); min-width: 0; white-space: nowrap; overflow: hidden; }
.est-out.green { background: var(--green-soft); color: var(--green-ink); }
.est-out.blue { background: var(--blue-soft); color: var(--blue-ink); }
.est-out.plain { justify-content: flex-start; background: var(--panel); color: var(--ink); font: 600 17px var(--mono); }
.est-err { font-size: 13px; font-weight: 600; color: var(--red-ink); }
.est-formula { font: 13px var(--mono); color: var(--muted); }
.est-compare { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 10px; background: var(--nav); color: #fff; }
.est-compare-t { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: 600; }
.est-compare-t b { font: 800 20px var(--head); white-space: nowrap; }
.est-compare-s { font-size: 13px; color: var(--nav-muted); }
.est-adv { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.est-adv button { height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--green); background: var(--green); color: #fff; font: 600 13px var(--body); cursor: pointer; }
.est-match { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 10px; border: 1px dashed var(--green); background: var(--green-card); }
.est-match-t { font-weight: 600; font-size: 14px; color: var(--green-ink); }
.est-match-p, .est-match-k { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.est-match button { height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--green); background: #fff; color: var(--green-ink); font: 600 13px var(--body); cursor: pointer; flex-shrink: 0; }
@media (max-width: 520px) {
  .est-fab { right: 10px; bottom: 10px; height: 44px; }
  .est:not(.moved) { right: 8px; bottom: 74px; max-height: calc(100vh - 90px); }
  body.est-on #toasts { bottom: 64px; }
  .est-out { font-size: 18px; }
  .est-box input, .est-target input { font-size: 17px; }
}

/* ---------- print (80 mm thermal receipt) ---------- */
@media print {
  @page { size: 80mm auto; margin: 3mm; }
  body { background: #fff; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; width: 74mm; }
  #print-root .receipt { border: none; padding: 0; font-size: 11.5px; }
  /* day sheet and QR stickers print on A4 */
  @page a4 { size: A4; margin: 10mm; }
  #print-root .a4 { page: a4; width: auto; }
  #print-root:has(.a4) { width: auto; }
  #print-root .qr-card { border-color: #999; }
  #print-root .noprint { display: none !important; }
  /* A5 tax invoice */
  @page a5 { size: A5; margin: 6mm; }
  #print-root .a5inv { page: a5; width: auto; border: none; padding: 0; box-shadow: none; }
  #print-root:has(.a5inv) { width: auto; }
}

/* ---------- report graphs (charts.js) */
.c2-leg { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.c2-chip { font: inherit; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card); color: var(--ink); cursor: pointer; }
.c2-chip[aria-pressed="false"] { opacity: .5; }
.c2-chip[aria-pressed="false"] .c2-sw { background: transparent !important; outline: 1.5px solid var(--line-strong); }
.c2-sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.c2-box { position: relative; width: 100%; }
.c2-svg { display: block; width: 100%; touch-action: pan-y; }
.c2-tip { position: absolute; z-index: 5; max-width: 300px; background: var(--ink); color: #fff; font-size: 12.5px; line-height: 1.45; padding: 7px 10px; border-radius: 8px; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.c2-tip .c2-tt { font-weight: 600; margin-bottom: 2px; }
.c2-tip .c2-tf { margin-top: 4px; color: #D6DEE5; }
.c2-help { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.5; }
.c2-top { margin: 0 0 8px; }
.c2-tools .btn { padding: 4px 9px; }
.rep-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.rep-tabs a { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.rep-tabs a[aria-current] { background: var(--nav); color: #fff; border-color: var(--nav); }
.rep-notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rep-notes li { font-size: 14.5px; line-height: 1.5; padding: 8px 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); }
.rep-notes li.red { border-color: var(--red-line); background: var(--red-card); }
.rep-notes li.amber { border-color: var(--amber-line); background: var(--amber-card); }
.rep-notes li.orange { border-color: #f0a46e; background: #fff1e6; }
.rep-notes li.green { border-color: var(--green-line); background: var(--green-card); }
.now-box { border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; margin: 8px 0; background: var(--card); }
.now-box .vals { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); margin: 3px 0 5px; }
.now-box .vals b { color: var(--ink); }
.now-box p { margin: 0; font-size: 15px; line-height: 1.55; }
.six-lab { font-size: 13px; color: var(--muted); margin: 10px 0 2px; display: flex; align-items: center; gap: 6px; }
.perm-tbl td, .perm-tbl th { vertical-align: middle; }
.perm-tbl input { width: 20px; height: 20px; }
@media print {
  #print-root .c2-print { width: auto; font-family: 'IBM Plex Sans', Arial, sans-serif; color: #16212B; }
  #print-root .c2-ph { display: flex; justify-content: space-between; border-bottom: 2px solid #16212B; padding-bottom: 6px; margin-bottom: 10px; }
  #print-root .c2-pblock { break-inside: avoid; margin: 0 0 14px; }
  #print-root .c2-pblock h3 { font-size: 14px; margin: 0 0 4px; }
  #print-root .c2-psvg svg { width: 100%; height: auto; }
  #print-root .c2-phelp { font-size: 11px; color: #3E4A55; margin-top: 3px; }
  #print-root .c2-pnotes { font-size: 12px; margin-bottom: 10px; }
  #print-root .c2-pnotes li { margin: 2px 0; }
}
@media print { #print-root .c2-pnotes ul { list-style: none; padding-left: 0; margin: 0; } }

/* ---------------------------------------------------------------- safety (v2.0) */
#main-view { display: flex; flex-direction: column; min-width: 0; }
.sf-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 8px; font-size: 14.5px; }
.sf-banner > div:nth-child(2) { flex: 1; min-width: 0; }
.sf-banner.red { background: #b42318; border-color: #8f1c13; color: #fff; }
.sf-banner.red .btn { background: #fff; color: #b42318; border-color: #fff; }
.sf-banner.drill { background: #fff1e6; border-color: #f0a46e; color: #8a3b0b; }
.sf-banner.amber { background: var(--amber-card); border-color: var(--amber-line); color: var(--amber-ink); }
.sf-chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: #ECEBE6; color: var(--muted); white-space: normal; line-height: 1.4; }
.sf-chip.sf-r { background: #fde7e5; color: #b42318; } .sf-chip.sf-o { background: #fff1e6; color: #a8480d; } .sf-chip.sf-y { background: #fff7db; color: #8a6100; } .sf-chip.ok { background: #e3f2ec; color: #0b7a5e; }
.sf-guns { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.sf-gun { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; background: var(--card); }
.sf-gun.closed { border-color: var(--red-line); background: var(--red-card); }
.sf-read { display: flex; gap: 10px; flex-wrap: wrap; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.sf-temp { font-weight: 700; color: var(--ink); padding: 0 6px; border-radius: 6px; }
.sf-temp.sf-y { background: #fff7db; color: #8a6100; } .sf-temp.sf-o { background: #fff1e6; color: #a8480d; } .sf-temp.sf-r { background: #b42318; color: #fff; }
.sf-evs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sf-ev { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); border-left-width: 5px; }
.sf-ev.sf-r { border-left-color: #d03b3b; background: var(--red-card); } .sf-ev.sf-o { border-left-color: #eb6834; background: #fff8f2; } .sf-ev.sf-y { border-left-color: #eda100; background: var(--amber-card); }
.sf-ev-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sf-dues { display: flex; flex-direction: column; gap: 6px; }
.sf-due { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; color: inherit; font-size: 14px; }
.sf-due span { color: var(--muted); font-size: 13px; }
.sf-due.sf-r { border-color: var(--red-line); background: var(--red-card); } .sf-due.sf-y { border-color: var(--amber-line); background: var(--amber-card); }
.sf-contacts { display: flex; flex-direction: column; gap: 6px; }
.sf-contacts > div { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 14.5px; border-bottom: 1px dashed var(--line); padding-bottom: 5px; }
.sf-emerg { border-color: #8f1c13; background: #b42318; color: #fff; } .sf-emerg h2 { color: #fff; } .sf-emerg.drill { background: #fff1e6; color: #8a3b0b; border-color: #f0a46e; } .sf-emerg.drill h2 { color: #8a3b0b; }
.sf-warn { background: var(--amber-card); border: 1px solid var(--amber-line); color: var(--amber-ink); padding: 10px 12px; border-radius: 10px; }
.sf-check { display: flex; flex-direction: column; gap: 8px; }
.sf-ci { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sf-ci .sf-note { grid-column: 1 / -1; height: 38px; border: 1px solid var(--red-line); border-radius: 8px; padding: 0 10px; font: inherit; }
.sf-eq tr.sf-r td { background: var(--red-card); } .sf-eq tr.sf-o td { background: #fff8f2; }
.tbl tr.sf-y td { background: var(--amber-card); }
.sf-y-card { border-color: var(--amber-line); background: var(--amber-card); }
.sf-steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.sf-step h2 { font-size: 17px; } .sf-step ol { margin: 8px 0; padding-left: 22px; line-height: 1.55; font-size: 14.5px; }
.sf-no { background: var(--red-card); border: 1px solid var(--red-line); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; } .sf-no ul { margin: 4px 0 0; padding-left: 18px; }
.sf-crow, .sf-frow { display: grid; gap: 6px; margin-bottom: 6px; }
.sf-crow { grid-template-columns: 1fr 1fr 140px auto; } .sf-frow { grid-template-columns: 150px 1fr 90px 1.4fr 1.4fr auto; }
.sf-crow input, .sf-frow input, .sf-frow select { height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font: inherit; min-width: 0; }
.arrival { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.arr-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; }
.arr-row .seg button { height: 34px; }
.sf-print h1 { font-size: 20px; } .sf-pcard { break-inside: avoid; border: 1px solid #999; border-radius: 6px; padding: 6px 10px; margin: 6px 0; font-size: 11.5px; } .sf-pcard h2 { font-size: 14px; margin: 0; } .sf-pcard ol { margin: 4px 0; padding-left: 18px; }
@media (max-width: 700px) { .sf-crow, .sf-frow { grid-template-columns: 1fr; } .sf-banner { flex-wrap: wrap; } .arr-row { flex-direction: column; align-items: flex-start; } }

/* ---------------------------------------------------------------- board (all guns at a glance) */
.bd-st { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.bd-m { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bd-m > span { font-size: 12.5px; color: var(--muted); } .bd-m > b { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bd-terms { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.bd-tr-row { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; }
.bd-tn { display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.bd-gs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.bd-g { display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; color: inherit; text-decoration: none; min-width: 0; font-size: 13.5px; }
a.bd-g, a.bd-g:visited { color: var(--ink); } a.bd-g:hover { border-color: var(--green-line, #9fd3c0); color: var(--ink); }
.bd-g.bd-red { border-color: var(--red-line); background: var(--red-card); } .bd-g.bd-amb { border-color: var(--amber-line); background: var(--amber-card); } .bd-g.bd-off { opacity: .75; }
.bd-h { display: flex; align-items: center; gap: 8px; } .bd-h b { font-size: 16px; } .bd-type { font-size: 12px; color: var(--muted); }
.bd-pill { margin-left: auto; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.bd-pill.pc { background: #e3f2ec; color: #0b7a5e; } .bd-pill.pf { background: #ECEBE6; color: var(--muted); } .bd-pill.pw { background: #fff7db; color: #8a6100; } .bd-pill.pd { background: #fde7e5; color: #b42318; }
.bd-car { font-family: var(--mono); font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-bar { position: relative; height: 7px; background: #ECEBE6; border-radius: 4px; overflow: hidden; margin-top: 2px; } .bd-bar i { display: block; height: 100%; background: var(--green, #0b7a5e); }
.bd-bar em { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); }
.bd-soc { font-size: 14px; } .bd-s { font-size: 12.5px; color: var(--muted); } .bd-n { font-weight: 600; }
.bd-kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 10px; margin-top: 4px; font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.bd-kv > div { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .bd-kv span { display: block; font-family: var(--sans, inherit); font-size: 11.5px; color: var(--muted); }
.bd-big { font-size: 17px; }
.bd-ty { background: #fff7db; color: #8a6100; padding: 0 4px; border-radius: 4px; } .bd-to { background: #fff1e6; color: #a8480d; padding: 0 4px; border-radius: 4px; } .bd-tr { background: #b42318; color: #fff; padding: 0 4px; border-radius: 4px; }
.bd-note { font-size: 12.5px; padding: 3px 8px; border-radius: 6px; background: #F4F3EE; color: var(--muted); }
.bd-n-y, .bd-n-o { background: #fff7db; color: #8a6100; } .bd-n-r { background: #fde7e5; color: #b42318; }
.bd-tvhead { display: flex; align-items: baseline; gap: 14px; font-size: 20px; margin-bottom: 4px; } .bd-tvhead span { font-family: var(--mono); color: var(--muted); } .bd-tvhead a { margin-left: auto; }
body.board-tv .topbar, body.board-tv .nav { display: none !important; }
body.board-tv .main { padding: 14px 18px; }
body.board-tv .bd-g { font-size: 15px; } body.board-tv .bd-kv { font-size: 15px; } body.board-tv .bd-big { font-size: 21px; } body.board-tv .bd-m > b { font-size: 30px; } body.board-tv .bd-h b { font-size: 19px; }
@media (max-width: 760px) { .bd-gs { grid-template-columns: 1fr; } .bd-tr-row { grid-template-columns: 1fr; } .bd-tn { justify-content: flex-start; padding: 4px 12px; } .bd-kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.jn-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin-top: 6px; cursor: pointer; }
.jn-row input { margin-top: 4px; } .jn-row:has(input:checked) { border-color: var(--green, #0b7a5e); background: #f2faf6; }

/* ---------------------------------------------------------------- customer accounts (bill payment, statement) */
.acct-box { display: flex; flex-direction: column; gap: 10px; }
.pay-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pay-grid input { font-family: var(--mono); }
.pay-grid input[readonly] { background: #F4F3EE; color: var(--muted); }
.pay-ref { display: flex; gap: 10px; align-items: flex-end; }
.pay-sum { padding: 10px 12px; border-radius: 10px; font-size: 14px; line-height: 1.55; border: 1px solid var(--line); }
.pay-sum.ok { background: #EEF7F2; border-color: #BFE1CF; } .pay-sum.due { background: var(--amber-card); border-color: var(--amber-line); color: var(--amber-ink); } .pay-sum.over { background: #EEF4FB; border-color: #C3D7EE; }
.stmt td.n, .stmt th.n { text-align: right; font-family: var(--mono); white-space: nowrap; }
.stmt tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.stmt .in { color: var(--green-ink); } .stmt .out { color: var(--red-ink); }
.bal-pos { color: var(--green-ink); } .bal-neg { color: var(--red-ink); }
@media (max-width: 700px) { .pay-grid { grid-template-columns: 1fr 1fr; } }

/* v2.4 electricity (NEA bills) */
.nea-tbl td, .nea-tbl th { padding: 6px 8px; }
.nea-tbl .inp { width: 120px; height: 36px; text-align: right; }
.nea-tbl tr.sum td { font-weight: 600; border-top: 1px solid var(--line, #ddd); }
.nea-sum { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 8px; background: var(--panel, #f4f3ef); font-size: 14px; }
.bad-ink { color: var(--red-ink); }
.ok-ink { color: var(--green-ink); }
.tbl tr.hl td { background: var(--amber-bg, #fdf3dd); font-weight: 600; }
.nea-what .grid { margin-top: 10px; }

/* v2.4 new replies on problems */
.reply-pill { background: #d8ecff; color: #0c447c; font-weight: 600; }
.attn.attn-new { background: #eef6ff; box-shadow: inset 3px 0 0 #2a78d6; }
.attn-reply { display: block; width: 100%; text-align: left; margin-top: 4px; padding: 5px 8px; border: 1px solid var(--line, #e2e0d8); border-radius: 6px; background: var(--panel, #f7f6f2); font: inherit; font-size: 13px; color: inherit; cursor: pointer; }
.attn-reply svg { vertical-align: -2px; margin-right: 4px; }
.attn-reply.new { border-color: #85b7eb; background: #fff; }
.badge.reply-count { background: #2a78d6; color: #fff; }
.toast.reply-toast { display: block; text-align: left; cursor: pointer; border: 0; font: inherit; max-width: 360px; background: #0c447c; color: #fff; }
.toast.reply-toast div { margin-top: 3px; opacity: .92; }

.tbl .sno { width: 44px; color: var(--muted, #6b7680); }

/* v2.4 gun left in the car */
.gunin-box { border: 1px solid #e8b04b; background: #fdf3dd; color: #633806; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.gunin-box svg { vertical-align: -3px; }
.gunin-note { color: var(--red-ink); font-weight: 600; font-size: 13px; }
