/* [CC:FILE] assets/app.css — All styles: theme variables (light / dark), layout, cards, animations
   Tags in this file (search for the tag text to jump there):
     [CC:CSS-THEME]  Theme variables (colours) — light
     [CC:CSS-DARK]  Dark theme variables
     [CC:CSS-TOPBAR]  Top bar
     [CC:CSS-CONTROLS]  Buttons, inputs, segmented controls
     [CC:CSS-CARDS]  Location groups and unit cards
     [CC:CSS-TABLES]  Panels and tables
     [CC:CSS-SETTINGS]  Settings pages
     [CC:CSS-MODAL]  Modal windows and toasts
     [CC:CSS-BRANDING]  Branding and dashboard layout
     [CC:CSS-ANIM]  Alarm / warning / error animations
     [CC:CSS-METERS]  Liquids & electricity: tank, meter cards, switch badges
   [CC:END-INDEX] */
/* ==== [CC:CSS-THEME] Theme variables (colours) — light ==== */
:root {
  --bg: #f3f5f8; --panel: #ffffff; --panel-2: #f8fafc; --line: #e2e7ee; --line-2: #cfd7e2;
  --ink: #0f1b2a; --ink-2: #4a5a70; --ink-3: #7b8a9e;
  --accent: #0e5a8a; --accent-ink: #ffffff; --accent-soft: #e3eef7; --info: #0e5a8a; --info-soft: #e3eef7;
  --ok: #157a46; --ok-soft: #e4f4ea; --warn: #b45f06; --warn-soft: #fdf1e1;
  --alarm: #c0262d; --alarm-soft: #fde8e8; --off: #6b7685; --off-soft: #eceff3;
  --frz: #2a62c9; --frz-soft: #e5edfb; --cool: #0f7f86; --cool-soft: #e1f3f3;
  --radius: 12px; --shadow: 0 1px 2px rgba(15,27,42,.06), 0 2px 8px rgba(15,27,42,.04);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
/* ==== [CC:CSS-DARK] Dark theme variables ==== */
/* dark theme: follows the system unless the user picked Light / Dark (data-theme on <html>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d131b; --panel: #151d28; --panel-2: #111923; --line: #243041; --line-2: #31405a;
    --ink: #e8eef6; --ink-2: #a6b3c4; --ink-3: #74839a;
    --accent: #5aa9e0; --accent-ink: #06121d; --accent-soft: #15314a; --info: #5aa9e0; --info-soft: #15314a;
    --ok: #4cc283; --ok-soft: #12301f; --warn: #f0a548; --warn-soft: #3a2810;
    --alarm: #ff6b6b; --alarm-soft: #3d1517; --off: #8d99a8; --off-soft: #222c38;
    --frz: #7aa6f5; --frz-soft: #182a48; --cool: #4cc4c9; --cool-soft: #0f3134;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d131b; --panel: #151d28; --panel-2: #111923; --line: #243041; --line-2: #31405a;
  --ink: #e8eef6; --ink-2: #a6b3c4; --ink-3: #74839a;
  --accent: #5aa9e0; --accent-ink: #06121d; --accent-soft: #15314a; --info: #5aa9e0; --info-soft: #15314a;
  --ok: #4cc283; --ok-soft: #12301f; --warn: #f0a548; --warn-soft: #3a2810;
  --alarm: #ff6b6b; --alarm-soft: #3d1517; --off: #8d99a8; --off-soft: #222c38;
  --frz: #7aa6f5; --frz-soft: #182a48; --cool: #4cc4c9; --cool-soft: #0f3134;
  --shadow: none; color-scheme: dark;
}
.theme-btn { min-width: 34px; justify-content: center; font-size: 15px; line-height: 1; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* ==== [CC:CSS-TOPBAR] Top bar ==== */
.top { position: sticky; top: 0; z-index: 20; background: var(--panel); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1440px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); }
.nav { display: flex; gap: 2px; overflow-x: auto; min-width: 0; flex: 1; }
.nav a { padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 550; white-space: nowrap; position: relative; }
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a.on { color: var(--accent); background: var(--accent-soft); }
.nav .badge { position: absolute; top: 2px; right: 0; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pollinfo { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.dot.bad { background: var(--alarm); }
.badge { background: var(--alarm); color: #fff; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 0 6px; line-height: 17px; min-width: 18px; text-align: center; }

main { max-width: 1440px; margin: 0 auto; padding: 20px; }
h1 { font-size: 20px; margin: 0; letter-spacing: -.015em; }
h2 { font-size: 15px; margin: 0; }

/* ==== [CC:CSS-CONTROLS] Buttons, inputs, segmented controls ==== */
.btn { border: 1px solid var(--line-2); background: var(--panel); border-radius: 8px; padding: 7px 13px; cursor: pointer; font-weight: 550; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--alarm); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
select.sm { padding: 4px 8px; font-size: 12.5px; height: auto; width: auto; }
.btn:disabled { opacity: .55; cursor: default; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], input[type=email], select, textarea {
  border: 1px solid var(--line-2); background: var(--panel); border-radius: 8px; padding: 7px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { width: 100%; min-height: 80px; font-family: var(--mono); font-size: 12.5px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: transparent; padding: 7px 12px; cursor: pointer; font-weight: 550; color: var(--ink-2); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent-soft); color: var(--accent); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0; }
.toolbar .grow { flex: 1; }
.search { min-width: 200px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); cursor: pointer; text-align: left; }
.kpi.on { outline: 2px solid var(--accent); }
.kpi .k-l { font-size: 12px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 6px; }
.kpi .k-v { font-size: 28px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; }
.kpi.alarm .k-v { color: var(--alarm); } .kpi.warning .k-v { color: var(--warn); } .kpi.offline .k-v { color: var(--off); } .kpi.ok .k-v { color: var(--ok); }

/* ==== [CC:CSS-CARDS] Location groups and unit cards ==== */
.loc { margin-top: 26px; }
.loc-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.loc-h h2 { font-size: 16px; }
.loc-h .chips { margin-left: auto; display: flex; gap: 6px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px 12px; cursor: pointer; position: relative; overflow: hidden; transition: border-color .15s; }
.card:hover { border-color: var(--line-2); }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ok); }
.card.s-alarm::before { background: var(--alarm); } .card.s-warning::before { background: var(--warn); }
.card.s-offline::before, .card.s-nodata::before, .card.s-unassigned::before, .card.s-muted::before { background: var(--off); }
.card.s-alarm { background: linear-gradient(var(--alarm-soft), var(--panel) 70%); }
.c-top { display: flex; align-items: center; gap: 8px; }
.c-name { font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { font-size: 11px; font-weight: 650; padding: 1px 8px; border-radius: 10px; white-space: nowrap; letter-spacing: .02em; }
.chip.freezer { background: var(--frz-soft); color: var(--frz); } .chip.cooler { background: var(--cool-soft); color: var(--cool); } .chip.other { background: var(--off-soft); color: var(--off); }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.alarm { background: var(--alarm-soft); color: var(--alarm); }
.chip.warning { background: var(--warn-soft); color: var(--warn); } .chip.offline, .chip.nodata, .chip.unassigned, .chip.resolved, .chip.muted { background: var(--off-soft); color: var(--off); }
.chip.active { background: var(--alarm-soft); color: var(--alarm); }
.c-top .chip.st { margin-left: auto; }
.c-mid { display: flex; align-items: flex-end; gap: 14px; margin-top: 8px; }
.c-temp { font-size: 38px; font-weight: 650; letter-spacing: -.03em; line-height: 1; }
.c-temp small { font-size: 16px; font-weight: 550; color: var(--ink-3); margin-left: 2px; letter-spacing: 0; }
.s-alarm .c-temp { color: var(--alarm); } .s-warning .c-temp { color: var(--warn); } .s-offline .c-temp, .s-nodata .c-temp { color: var(--off); }
.c-side { font-size: 12.5px; color: var(--ink-2); display: grid; gap: 1px; padding-bottom: 2px; min-width: 0; }
.c-side span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-foot span:last-child { white-space: nowrap; }
.c-rep.late { color: var(--warn); font-weight: 600; }   /* sensor silent for much longer than usual */
.c-spark { margin-top: 10px; height: 40px; width: 100%; display: block; }
.c-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.live { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; color: var(--ok); margin-right: 6px; }
#live-ago.late { color: var(--warn, #b7791f); font-weight: 600; }
.dot.pulse { animation: pulse 2s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(21,122,70,.55); } 70% { box-shadow: 0 0 0 7px rgba(21,122,70,0); } 100% { box-shadow: 0 0 0 0 rgba(21,122,70,0); } }
.card.flash .c-temp { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { background: var(--accent-soft); border-radius: 6px; } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .dot.pulse, .card.flash .c-temp { animation: none; } }
.empty { padding: 40px; text-align: center; color: var(--ink-3); background: var(--panel); border: 1px dashed var(--line-2); border-radius: var(--radius); }

/* ==== [CC:CSS-TABLES] Panels and tables ==== */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-b { padding: 16px; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 650; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel-2); position: sticky; top: 0; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--panel-2); }
.tbl tr.bad td { background: var(--alarm-soft); }
.bar { height: 6px; border-radius: 3px; background: var(--off-soft); overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--ok); }
.bar.mid > i { background: var(--warn); } .bar.low > i { background: var(--alarm); }

/* ---------- detail ---------- */
.detail-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.back { color: var(--ink-2); font-weight: 550; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 16px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.stat .l { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.stat .v { font-size: 20px; font-weight: 650; margin-top: 2px; }
.chart-box { position: relative; height: 360px; }
.zoom-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.zoom-bar .seg button { padding: 3px 11px; font-size: 13px; min-width: 32px; }
#u-chart { cursor: crosshair; touch-action: pan-y; }
.layout-2 { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }

/* ==== [CC:CSS-SETTINGS] Settings pages ==== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); font-weight: 580; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; font-weight: 650; color: var(--ink-2); margin-bottom: 4px; }
.field input:not([type=checkbox]), .field select, .field textarea { width: 100%; }
.field .hint { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; padding-top: 4px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; color: var(--ink); }
.section-t { grid-column: 1 / -1; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
code, .code { font-family: var(--mono); font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.codes { display: flex; flex-wrap: wrap; gap: 4px; }
.notice { padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); margin-bottom: 14px; font-size: 13px; }
.notice.err { background: var(--alarm-soft); color: var(--alarm); }
.notice.info { background: var(--info-soft); color: var(--info); }

/* ==== [CC:CSS-MODAL] Modal windows and toasts ==== */
.modal-bg { position: fixed; inset: 0; background: rgba(8,14,22,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border-radius: 14px; width: min(720px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-h { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-h h2 { font-size: 16px; }
.modal-h .x { margin-left: auto; }
.modal-b { padding: 18px; overflow: auto; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; }
#toast div { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 550; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
#toast div.err { background: var(--alarm); color: #fff; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.login .brand { justify-content: center; font-size: 18px; margin-bottom: 4px; }
.login input { width: 100%; }

/* ---------- report charts ---------- */
.rep-charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 12px; margin-top: 16px; }
.rep-chart { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; break-inside: avoid; }
.rep-chart h3 { margin: 0 0 6px; font-size: 13.5px; display: flex; gap: 8px; align-items: center; }
.rep-chart .cb { height: 190px; position: relative; }
.print-head { display: none; }

@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .layout-2 { grid-template-columns: 1fr; }
  .pollinfo span.t { display: none; }
}
@media (max-width: 640px) {
  .top-in { padding: 0 12px; gap: 10px; }
  .brand span { display: none; }
  main { padding: 14px 16px; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px 12px; } .kpi .k-v { font-size: 22px; } .kpi .k-l { font-size: 10.5px; letter-spacing: .02em; }
  .pollinfo, .uname { display: none !important; }
  .nav a { padding: 8px 9px; }
  .form { grid-template-columns: 1fr; }
  .rep-charts { grid-template-columns: 1fr; }
  .chart-box { height: 280px; }
  .z-hint { display: none; }
  .search { min-width: 0; width: 100%; }
}
@media print {
  :root { --bg: #fff; --panel: #fff; --shadow: none; }
  .top, .toolbar, .no-print, .btn { display: none !important; }
  main { padding: 0; max-width: none; }
  .print-head { display: block; margin-bottom: 12px; }
  .panel, .rep-chart { border-color: #ccc; }
  .tbl th { position: static; }
  .rep-charts { grid-template-columns: 1fr 1fr; }
  body { font-size: 11px; }
}

/* ==== [CC:CSS-BRANDING] Branding and dashboard layout ==== */
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.top a.brand { color: inherit; text-decoration: none; }
.brand-logo { height: 30px; max-width: 160px; object-fit: contain; display: block; }
.login .brand-logo { height: 44px; max-width: 220px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-txt small { font-size: 11px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.login .brand { flex-direction: column; gap: 8px; text-align: center; }
.login .brand-txt { align-items: center; }
.login-text { text-align: center; color: var(--ink-2); font-size: 13px; margin: 0 0 6px; white-space: pre-line; }
.app-foot { text-align: center; color: var(--ink-3); font-size: 12px; padding: 18px 16px 26px; }
.dash-h { margin: 2px 0 14px; } .dash-h h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; } .dash-h .muted { margin-top: 2px; }
.dash-banner { font-size: 14px; white-space: pre-line; }
.preview-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; border-radius: 10px;
  border: 1px dashed var(--accent); background: var(--accent-soft); color: var(--ink); position: sticky; top: 62px; z-index: 5; }
.grid.size-compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.size-compact .card { padding: 10px 12px 9px; } .grid.size-compact .c-temp { font-size: 30px; } .grid.size-compact .c-spark { height: 30px; }
.grid.size-large { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.grid.size-large .card { padding: 20px 22px 16px; } .grid.size-large .c-temp { font-size: 64px; } .grid.size-large .c-temp small { font-size: 24px; }
.grid.size-large .c-name { font-size: 18px; } .grid.size-large .c-side { font-size: 15px; } .grid.size-large .c-spark { height: 56px; }
.brand-grid { grid-template-columns: 1fr 1fr; }
.brand-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; position: sticky; bottom: 0; padding: 12px 0; background: var(--bg); }
.logo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo-prev { min-width: 44px; height: 44px; display: grid; place-items: center; padding: 4px 8px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--panel-2); }
.swatches { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; padding: 0; }
.sw.on { box-shadow: 0 0 0 2px var(--ink); }
.swatches input[type=color] { width: 40px; height: 30px; padding: 0 2px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); cursor: pointer; }
@media (max-width: 900px) { .brand-grid { grid-template-columns: 1fr; } .grid.size-large { grid-template-columns: 1fr; } }
@media print { .preview-bar, .app-foot { display: none; } }

/* ---------- several dashboards ---------- */
.dash-tabs { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; border-bottom: 1px solid var(--line); }
.dash-tabs a { padding: 8px 14px; border-radius: 8px 8px 0 0; color: var(--ink-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.dash-tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.dash-tabs a:hover { background: var(--panel-2); }
.dash-tabs .dash-edit { margin-left: auto; font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.c-loc { font-size: 12px; color: var(--ink-3); margin: -2px 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid.size-large .c-loc { font-size: 14px; }

/* ---------- message wording ---------- */
.msg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.msg-prev { border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); padding: 12px 14px; }
.msg-prev .mp-subj { font-weight: 650; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.msg-prev pre { margin: 0; white-space: pre-wrap; font: 13px/1.5 "Segoe UI", system-ui, sans-serif; color: var(--ink); }
.chips-ins { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chip-ins { font: 11.5px var(--mono); padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--panel); color: var(--accent); cursor: pointer; }
.chip-ins:hover { background: var(--accent-soft); }
@media (max-width: 900px) { .msg-grid { grid-template-columns: 1fr; } }

/* ==== [CC:CSS-ANIM] Alarm / warning / error animations ==== */
@keyframes ccAlarmGlow { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--alarm) 55%, transparent), var(--shadow); border-color: var(--alarm); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--alarm) 0%, transparent), 0 0 22px color-mix(in srgb, var(--alarm) 35%, transparent); border-color: color-mix(in srgb, var(--alarm) 60%, var(--line)); } }
@keyframes ccWarnGlow { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warn) 45%, transparent), var(--shadow); border-color: var(--warn); }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--warn) 0%, transparent); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); } }
@keyframes ccBlink { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes ccShake { 0%, 100% { transform: translateX(0); } 15% { transform: translateX(-6px) rotate(-.6deg); } 30% { transform: translateX(5px) rotate(.5deg); }
  45% { transform: translateX(-4px); } 60% { transform: translateX(3px); } 75% { transform: translateX(-2px); } }
@keyframes ccPop { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes ccStripes { from { background-position: 0 0; } to { background-position: 28px 0; } }
.anim .card.s-alarm { animation: ccAlarmGlow 1.4s ease-in-out infinite; }
.anim .card.s-alarm .chip.st { animation: ccBlink 1.4s ease-in-out infinite; }
.anim .card.s-warning { animation: ccWarnGlow 2.4s ease-in-out infinite; }
.anim .card.s-offline::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; pointer-events: none;
  background: repeating-linear-gradient(90deg, var(--off) 0 10px, transparent 10px 14px); background-size: 28px 3px; animation: ccStripes 1.2s linear infinite; opacity: .7; }
.anim .card.just-bad { animation: ccShake .6s ease-in-out 2, ccAlarmGlow 1.4s ease-in-out 1.2s infinite; }
.anim .card.s-warning.just-bad { animation: ccShake .6s ease-in-out 2, ccWarnGlow 2.4s ease-in-out 1.2s infinite; }
.anim .card.s-offline.just-bad { animation: ccShake .6s ease-in-out 2; }
.anim .kpi.alarm.hot .k-v { animation: ccBlink 1.4s ease-in-out infinite; }
.anim .kpi.alarm.hot { border-color: var(--alarm); }
.anim .kpi.warning.hot .k-v { animation: ccPop 2.4s ease-in-out infinite; display: inline-block; }
.anim .notice.sync-err { animation: ccShake .6s ease-in-out 1; border-left: 4px solid var(--alarm); }
.anim .dash-banner.err { animation: ccBlink 2.2s ease-in-out infinite; }
.notice.sync-err .dot { display: inline-block; vertical-align: middle; margin-right: 4px; }
#nav-badge:not(.hidden) { animation: ccPop 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .anim .card, .anim .card .chip.st, .anim .kpi .k-v, .anim .notice, .anim .dash-banner, #nav-badge, .anim .card.s-offline::after { animation: none !important; }
}
@media print { .anim .card { animation: none !important; box-shadow: none !important; } .dash-tabs { display: none; } }

/* ==== [CC:CSS-METERS] Liquids & electricity: tank, meter cards, switch badges ==== */
.seg a { display: inline-block; padding: 7px 12px; font-weight: 550; color: var(--ink-2); border-right: 1px solid var(--line); }
.seg a:last-child { border-right: 0; } .seg a.on { background: var(--accent-soft); color: var(--accent); }
.m-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.m-tank { display: flex; gap: 14px; align-items: center; }
.tank { width: 46px; height: 78px; flex: none; }
.tank-wave { transform-box: fill-box; animation: ccWave 3.2s ease-in-out infinite alternate; }
@keyframes ccWave { from { transform: translateX(-6px); } to { transform: translateX(0); } }
.anim .card.s-alarm .tank-fill { animation: ccBlink 1.4s ease-in-out infinite; }
.m-card .c-temp small { font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .tank-wave, .anim .card.s-alarm .tank-fill { animation: none !important; } }

/* ---------- modules page & device readings ---------- */
.mod-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.mod-card { opacity: .62; transition: opacity .15s, border-color .15s; } .mod-card.on { opacity: 1; border-color: var(--accent); }
.mod-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.mod-ic { font-size: 30px; line-height: 1; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 26px; background: var(--line-2); cursor: pointer; transition: background .15s; }
.switch span::before { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); } .switch input:checked + span::before { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.dev-reads { display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; white-space: nowrap; }
.dev-reads span { color: var(--ink-2); } .dev-reads b { color: var(--ink); font-weight: 600; }
.dev-ic { display: inline-block; width: 22px; }
@media (max-width: 900px) { .mod-grid { grid-template-columns: 1fr; } }
.sw-badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 1px 7px; border-radius: 9px; margin-left: 4px; white-space: nowrap; }
.sw-badge.on { background: var(--ok-soft); color: var(--ok); } .sw-badge.off { background: var(--alarm-soft); color: var(--alarm); }
