/* Matribhumi ICS - Platform V1 UI
   Tokens: mineral-white canvas, forest ink, one teal accent; ember is reserved for fire (stove ON
   and runtime) so heat always reads as heat. IBM Plex Sans + Plex Sans Devanagari, so Nepali
   household names render in the same family. No third-party CSS, no inline styles (strict CSP). */
@font-face { font-family: "Plex"; src: url("fonts/plex-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fonts/plex-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fonts/plex-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fonts/plex-sans-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Plex Deva"; src: url("fonts/plex-deva-400.woff2") format("woff2"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Plex Deva"; src: url("fonts/plex-deva-600.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }

:root {
  /* (0.3.4) Matribhumi green: restrained forest / clean-air palette (token names kept so every screen follows) */
  --canvas: #F4F7F2; --surface: #FFFFFF; --sunken: #E9EFE7;
  --ink: #142119; --ink-2: #485A4E; --ink-3: #7A897E; --line: #DCE4DA; --line-2: #C8D3C6;
  --teal: #1F7A4D; --teal-deep: #124D33; --teal-tint: #E2F1E7; --teal-soft: #A6D3B5;
  --ember: #DD7424; --ember-deep: #A9531A; --ember-tint: #FBEADB;
  --ok: #1E8449; --ok-tint: #E2F2E8; --warn: #A86A10; --warn-tint: #FBF0DA;
  --alert: #BF3A2B; --alert-tint: #FAE3DF; --info: #3A6896; --info-tint: #E3ECF5; --nodata: #8C9894; --nodata-tint: #ECEFEE;
  --radius-s: 6px; --radius: 10px; --radius-l: 14px;
  --shadow: 0 1px 2px rgba(19, 33, 29, 0.06), 0 4px 14px rgba(19, 33, 29, 0.05);
  --font: "Plex", "Plex Deva", "Segoe UI", system-ui, sans-serif;
  --side: 236px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 400 15px/1.5 var(--font);
  font-feature-settings: "tnum" 1; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--teal-deep); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--teal-deep); color: #E8F3F0; display: flex;
  flex-direction: column; padding: 22px 16px 18px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 6px 22px; }
.brand .logo { flex: none; }
.brand b { display: block; font-weight: 600; font-size: 16px; letter-spacing: 0.01em; }
.brand span { display: block; font-size: 12.5px; color: #A9CFC7; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: #D4E8E3;
  text-decoration: none; font-weight: 500; font-size: 14.5px; }
.nav a svg { opacity: 0.85; }
.nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav a[aria-current="page"] { background: #E8F3F0; color: var(--teal-deep); }
.nav a[aria-current="page"] svg { opacity: 1; }
.nav .group { margin: 18px 10px 6px; font-size: 12.5px; color: #8FBDB4; }
/* (Stage 1b) Admin-only notification bell + issues / people screens */
.nav a.bell { margin-bottom: 8px; border: 1px solid rgba(255, 255, 255, 0.14); }
.bellnum { margin-left: auto; min-width: 24px; text-align: center; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.14);
  font-size: 12.5px; color: #fff; }
.bellnum.hot { background: var(--alert); }
.nav a.bell[aria-current="page"] .bellnum { background: var(--teal-deep); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 10px; border: 1px solid var(--line-2); border-radius: 999px;
  font-size: 13px; background: var(--surface); }
.chip button { border: 0; background: none; cursor: pointer; color: var(--ink-3); padding: 0 6px; font-size: 14px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px 0; font-size: 13.5px; color: var(--ink-2); }
.lightbox > .panel.dlg { max-width: 760px; width: 100%; margin: 4vh auto; max-height: 90vh; overflow: auto; align-self: start; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row-between.wrap { flex-wrap: wrap; align-items: flex-start; }
.row-gap { display: flex; gap: 6px; }
.row-gap input { flex: 1; min-width: 0; }
.seg.tabs { margin-bottom: 14px; display: inline-flex; }
input.upper { text-transform: uppercase; }
textarea.ids { min-height: 90px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.side .who { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255, 255, 255, 0.12); font-size: 13px; }
.side .who b { display: block; font-weight: 600; color: #fff; }
.side .who span { color: #A9CFC7; }
.side .who button { margin-top: 10px; background: none; border: 1px solid rgba(255, 255, 255, 0.28); color: #E8F3F0;
  border-radius: 7px; padding: 5px 12px; cursor: pointer; }
.main { min-width: 0; padding: 26px 32px 60px; }
.wrap { max-width: 1320px; margin: 0 auto; }

/* ---------- page head ---------- */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.head h1 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 600; letter-spacing: -0.01em; }
.head .sub { margin-top: 4px; color: var(--ink-2); font-size: 14px; }
.head .tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumb { font-size: 13.5px; margin-bottom: 8px; }
.crumb a { text-decoration: none; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-2); background: var(--surface);
  border-radius: 8px; padding: 7px 13px; cursor: pointer; font-weight: 500; font-size: 14px; color: var(--ink); text-decoration: none; }
.btn:hover { border-color: var(--teal); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-deep); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--teal-deep); }
.btn.danger { color: var(--alert); }
.btn:disabled { opacity: 0.5; cursor: default; }
.seg { display: inline-flex; background: var(--sunken); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; cursor: pointer; font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
select, input[type="text"], input[type="search"], input[type="date"], input[type="number"], input[type="password"], textarea {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: 8px; padding: 7px 10px; min-height: 36px; font-size: 14px; }
textarea { min-height: 84px; width: 100%; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
label.f input, label.f select, label.f textarea { color: var(--ink); font-weight: 400; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }

/* ---------- filter bar ---------- */
.filters { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px;
  margin: 0 -12px 18px; background: rgba(243, 246, 245, 0.92); backdrop-filter: blur(6px); border-bottom: 1px solid transparent; }
.filters.stuck { border-bottom-color: var(--line); }
.filters select, .filters input { min-height: 34px; font-size: 13.5px; }
.filters .grow { flex: 1; }
.filters .count { font-size: 13px; color: var(--ink-2); }
.filters .more { display: none; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow); }
.panel > header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 16px 18px 4px; }
.panel > header h2 { margin: 0; font-size: 16px; font-weight: 600; }
.panel > header p { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); }
.panel .body { padding: 10px 18px 18px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.mt { margin-top: 16px; }

/* ---------- KPI strip (one instrument panel, not six cards) ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); padding: 6px 0; }
.kpi { padding: 14px 18px 16px; border-left: 1px solid var(--line); position: relative; text-decoration: none; color: inherit; }
.kpi:first-child { border-left: 0; }
.kpi:hover { background: #FAFCFB; }
.kpi .lab { font-size: 13.5px; color: var(--ink-2); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.kpi .num { font-size: 38px; line-height: 1.1; font-weight: 600; margin-top: 6px; letter-spacing: -0.02em; }
.kpi .knote { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.kpi.fire .num { color: var(--ember-deep); }
.kpi.alert .num { color: var(--alert); }
.kpi .flame { width: 14px; height: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.alert { background: var(--alert); }
.dot.info { background: var(--info); } .dot.nodata { background: var(--nodata); } .dot.fire { background: var(--ember); }
.pulse { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(221, 116, 36, 0.45); } 50% { box-shadow: 0 0 0 5px rgba(221, 116, 36, 0); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

.metrics { display: flex; flex-wrap: wrap; gap: 0; border-top: 1px solid var(--line); }
.metric { flex: 1 1 140px; padding: 11px 18px; border-left: 1px solid var(--line); }
.metric:first-child { border-left: 0; }
.metric b { font-size: 19px; font-weight: 600; display: block; }
.metric span { font-size: 12.5px; color: var(--ink-2); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 9px; font-size: 12.5px; font-weight: 500;
  white-space: nowrap; border: 1px solid transparent; }
.badge.on { background: var(--ember-tint); color: var(--ember-deep); border-color: #F2C9A3; }
.badge.off { background: var(--sunken); color: var(--ink-2); }
.badge.error, .badge.red { background: var(--alert-tint); color: var(--alert); }
.badge.fresh, .badge.ok { background: var(--ok-tint); color: var(--ok); }
.badge.stale, .badge.amber { background: var(--warn-tint); color: var(--warn); }
.badge.offline { background: var(--alert-tint); color: var(--alert); }
.badge.nodata, .badge.info { background: var(--nodata-tint); color: #5D6A66; }
.badge.blue { background: var(--info-tint); color: var(--info); }
.badge.regular { background: var(--ok-tint); color: var(--ok); }
.badge.low { background: var(--warn-tint); color: var(--warn); }
.badge.nouse { background: var(--alert-tint); color: var(--alert); }

/* ---------- table ---------- */
.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 500; color: var(--ink-2); font-size: 13px; padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: #FAFCFB; position: sticky; top: 0; }
table.t th button { background: none; border: 0; padding: 0; color: inherit; font-weight: inherit; cursor: pointer; }
table.t th button[aria-sort="descending"]::after { content: " \2193"; } table.t th button[aria-sort="ascending"]::after { content: " \2191"; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr.row { cursor: pointer; }
table.t tr.row:hover td { background: #F7FAF9; }
table.t td.num, table.t th.num { text-align: right; white-space: nowrap; }
.cellmain { font-weight: 600; }
.cellsub { font-size: 12.5px; color: var(--ink-2); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; font-size: 13.5px; color: var(--ink-2); }

/* ---------- charts ---------- */
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text { font-size: 11.5px; fill: var(--ink-3); }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12.5px; padding: 7px 9px;
  border-radius: 7px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); z-index: 3; }
.chart .tip b { font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.split { display: flex; height: 16px; border-radius: 6px; overflow: hidden; background: var(--sunken); }
.split > span { display: block; height: 100%; }
.split-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; margin-top: 14px; }
.split-legend div b { display: block; font-size: 24px; font-weight: 600; }
.split-legend div span { font-size: 13px; color: var(--ink-2); }
.bars .row { display: grid; grid-template-columns: 150px 1fr 70px; gap: 10px; align-items: center; padding: 6px 0; font-size: 13.5px; }
.bars .track { height: 12px; background: var(--sunken); border-radius: 4px; overflow: hidden; display: flex; }
.bars .track span { height: 100%; }
.bars .v { text-align: right; color: var(--ink-2); }
.empty { padding: 26px 8px; text-align: center; color: var(--ink-2); font-size: 14px; }
.empty b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }

/* ---------- device page ---------- */
.devhead { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.fact { padding: 12px 18px; border-left: 1px solid var(--line); }
.fact:first-child { border-left: 0; }
.fact span { display: block; font-size: 12.5px; color: var(--ink-2); }
.fact b { font-size: 20px; font-weight: 600; }
.temp-now { font-size: 54px; font-weight: 600; line-height: 1; letter-spacing: -0.03em; }
.temp-now small { font-size: 22px; color: var(--ink-2); font-weight: 500; }
.temp-now.hot { color: var(--ember-deep); }
.hearth { height: 22px; border-radius: 6px; background: var(--sunken); position: relative; overflow: hidden; }
.hearth span { position: absolute; top: 0; bottom: 0; }
.hearth .on { background: linear-gradient(180deg, #F0954A, var(--ember)); }
.hearth .err { background: repeating-linear-gradient(135deg, var(--alert) 0 4px, #E07A6C 4px 8px); }
.hearth .gap { background: repeating-linear-gradient(135deg, #D3DBD8 0 3px, transparent 3px 7px); }
.hearth-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }
.fh-item { border-top: 1px solid var(--line, #E2E8E6); padding: 12px 0; }
.fh-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.fh-test { background: var(--warn-tint); padding: 12px; border-radius: 8px; border-top: 0; margin-bottom: 8px; }
@media (max-width: 560px) { .fh-item .kv { grid-template-columns: 1fr; gap: 2px; } .fh-item .kv dd { margin-bottom: 8px; } }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
.timeline .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.ic.on { background: var(--ember-tint); color: var(--ember-deep); } .ic.off { background: var(--sunken); color: var(--ink-2); }
.ic.err { background: var(--alert-tint); color: var(--alert); } .ic.net { background: var(--info-tint); color: var(--info); }
.ic.mnt { background: var(--teal-tint); color: var(--teal-deep); }

/* ---------- photos ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 12px; }
.ph { border: 0; padding: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; cursor: zoom-in; text-align: left;
  box-shadow: var(--shadow); border: 1px solid var(--line); }
.ph img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--sunken); }
/* (0.3.33) Admin photo approval */
.phcard { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.phcard .ph { border-radius: 0; }
.phctl { padding: 0 10px 10px; font-size: 12.5px; align-items: center; }
.gallery > .full { grid-column: 1 / -1; align-items: center; }
.ph div { padding: 8px 10px 10px; font-size: 12.5px; color: var(--ink-2); }
.ph div b { color: var(--ink); font-size: 13.5px; font-weight: 600; display: block; }
.lightbox { position: fixed; inset: 0; background: rgba(9, 20, 17, 0.88); z-index: 50; display: grid; grid-template-rows: 1fr auto;
  place-items: center; padding: 24px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 140px); border-radius: 8px; user-select: none; -webkit-user-drag: none; }
.lightbox .cap { color: #E8F3F0; font-size: 14px; text-align: center; padding-top: 12px; }
.lightbox .close { position: absolute; top: 16px; right: 20px; background: rgba(255, 255, 255, 0.12); border: 0; color: #fff;
  border-radius: 8px; padding: 8px 12px; cursor: pointer; }

/* ---------- forms (technician) ---------- */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form .full { grid-column: 1 / -1; }
.form h3 { grid-column: 1 / -1; margin: 10px 0 0; font-size: 15px; font-weight: 600; padding-top: 12px; border-top: 1px solid var(--line); }
.form h3:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.gps { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px; background: var(--teal-tint); border-radius: var(--radius); }
.gps b { font-size: 15px; }
.photo-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pick { border: 1.5px dashed var(--line-2); border-radius: var(--radius); padding: 12px; text-align: center; font-size: 13px; color: var(--ink-2); position: relative; }
.pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pick img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }
.pick.done { border-style: solid; border-color: var(--teal-soft); }
.jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.job { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.job .top { display: flex; justify-content: space-between; align-items: center; }
.job .top b { font-size: 16px; }
.job .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* ---------- messages ---------- */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px;
  border-radius: 9px; font-size: 14px; z-index: 60; max-width: calc(100vw - 32px); }
.toast.err { background: var(--alert); }
.note { padding: 10px 14px; border-radius: var(--radius); background: var(--info-tint); color: #2B4E72; font-size: 13.5px; }
.note.warn { background: var(--warn-tint); color: #7A4E0C; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 12.5px; }
.skeleton { background: linear-gradient(90deg, var(--sunken), #F4F7F6, var(--sunken)); background-size: 200% 100%;
  animation: sk 1.3s linear infinite; border-radius: 8px; min-height: 120px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .art { background: var(--teal-deep); color: #E8F3F0; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login .art h1 { font-size: 40px; line-height: 1.12; font-weight: 600; margin: 0 0 14px; max-width: 14ch; letter-spacing: -0.015em; }
.login .art p { max-width: 46ch; color: #BCDCD5; font-size: 16px; }
.login .art .fine { font-size: 13px; color: #8FBDB4; }
.login form { align-self: center; justify-self: center; width: min(380px, 100% - 48px); display: flex; flex-direction: column; gap: 14px; }
.login form h2 { margin: 0 0 6px; font-size: 24px; font-weight: 600; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(4) { border-left: 0; }
  .kpi:nth-child(n+4) { border-top: 1px solid var(--line); }
  .grid3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 8px;
    z-index: 20; overflow-x: auto; }
  .brand, .nav .group, .side .who { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav a { flex-direction: column; gap: 2px; font-size: 11.5px; padding: 6px 10px; }
  .main { padding: 18px 16px 96px; }
  .filters .more { display: inline-flex; }
  .filters .adv { display: none; }
  .filters.open .adv { display: block; flex: 1 1 45%; }
  .filters input[type="search"] { flex: 1 1 140px; }
  .grid2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-left: 1px solid var(--line) !important; border-top: 1px solid var(--line); }
  .kpi:nth-child(odd) { border-left: 0 !important; }
  .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi .num { font-size: 30px; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .form { grid-template-columns: 1fr; }
  .devhead { grid-template-columns: 1fr; }
  .head h1 { font-size: 23px; }
  .login { grid-template-columns: 1fr; }
  .login .art { padding: 28px 24px; }
  .login .art h1 { font-size: 28px; }
  .bars .row { grid-template-columns: 110px 1fr 56px; }
  table.t.cards thead { display: none; }
  table.t.cards tr.row { display: grid; grid-template-columns: 1fr auto; padding: 10px 4px; border-bottom: 1px solid var(--line); }
  table.t.cards td { border: 0; padding: 2px 8px; }
  table.t.cards td.hide-s { display: none; }
}

/* (0.3.2) official logo: original image, aspect ratio kept, on its own white background */
.logo { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  background: #FFFFFF; border-radius: 9px; overflow: hidden; }
.logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.logo.big { width: 64px; height: 64px; border-radius: 12px; }
.mtop { display: none; }
@media (max-width: 860px) {
  .mtop { display: flex; align-items: center; gap: 10px; margin: -6px 0 14px; }
  .mtop b { font-size: 16px; font-weight: 600; }
  .mtop span { margin-left: auto; font-size: 12px; color: var(--ink-3); }
  .mtop .logo { width: 36px; height: 36px; border: 1px solid var(--line); }
}
/* (0.3.2) map */
.map-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 12px; font-size: 13.5px; color: var(--ink-2); }
.map-stats b { color: var(--ink); }
.map-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; box-shadow: var(--shadow); }
.map-canvas { height: calc(100vh - 220px); min-height: 360px; width: 100%; background: var(--sunken); }
.mp { font: 13px/1.35 var(--font); color: var(--ink); }
.mp-h { margin-bottom: 6px; } .mp-h b { font-size: 14px; } .mp-h span { display: block; color: var(--ink-3); font-size: 12px; }
.mp-row { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; border-top: 1px solid var(--line); }
.mp-row span { color: var(--ink-3); } .mp-row b { font-weight: 600; text-align: right; }
.mp-note { margin-top: 6px; font-size: 12px; color: var(--warn); }
.mp .btn { margin-top: 8px; width: 100%; justify-content: center; }
.pinmap { height: 320px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 4px 0 8px; }
.pin-ic { background: var(--ember); border: 3px solid #FFFFFF; border-radius: 50%; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }
@media (max-width: 860px) {
  .map-canvas { height: calc(100vh - 250px); min-height: 300px; }
}
/* (0.3.2) mobile: grid children may shrink (no horizontal page scroll); bilingual bottom-menu labels wrap */
.shell > * { min-width: 0; }
.main { min-width: 0; }
@media (max-width: 860px) {
  .map-stats { font-size: 12.5px; gap: 4px 12px; }
  .map-stats span { min-width: 0; overflow-wrap: anywhere; }
  .mtop span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
  .nav a { flex: 1 0 auto; white-space: normal; text-align: center; line-height: 1.15; max-width: 96px; font-size: 11px; }
  .head h1 { overflow-wrap: anywhere; }
}
/* (0.3.2) bilingual option texts are long: form controls shrink to their grid cell instead of widening the page */
.form > *, .form .f { min-width: 0; }
.form select, .form input, .form textarea { max-width: 100%; min-width: 0; box-sizing: border-box; }
.form .gps { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* (0.3.2) the login page keeps its logo on narrow screens (the sidebar brand is hidden there, the login brand is not) */
@media (max-width: 860px) {
  .login .art .brand { display: flex; padding: 0 0 18px; }
}
/* (0.3.2) public surface without its service identity: message, never a login form */
.pubdown { max-width: 520px; margin: 18vh auto 0; padding: 0 20px; text-align: center; color: var(--ink-2); }
.pubdown h1 { color: var(--ink); font-size: 24px; margin: 14px 0 8px; }
/* (0.3.2) Overview: embedded Nepal map - a prominent dashboard section */
.ov-map-panel > header { align-items: center; flex-wrap: wrap; }
.ov-map-panel .body { padding-top: 6px; }
.ov-map-wrap { position: relative; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ov-map { height: clamp(380px, 58vh, 620px); width: 100%; background: var(--sunken); }
.ov-map-none { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 500; max-width: 90%;
  background: rgba(255, 255, 255, 0.95); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px;
  font-size: 13px; color: var(--ink-2); text-align: center; }
@media (max-width: 860px) {
  .ov-map { height: clamp(300px, 55vh, 460px); }
  .ov-map-panel > header .btn { margin-top: 4px; }
}
.panel > .metrics:first-child { border-top: 0; }
/* (0.3.2) phones / tablets: the map comes first (immediately visible), then the KPI cards */
@media (max-width: 860px) {
  .ov-content { display: flex; flex-direction: column; gap: 16px; }
  .ov-content > * { margin-top: 0; }
  .ov-content > .ov-map-panel { order: -1; }
  .ov-map-panel > header p { display: none; }
}
/* (0.3.2) Leaflet panes stay inside the map box: never above the fixed menus / headers */
.ov-map-wrap, .map-wrap, .pinmap { isolation: isolate; }

/* (0.3.3) drafted offline command: wrap, never widen the page */
pre.mono { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; margin: 6px 0; }

/* ---------- (0.3.4) company pages, content manager, messages ---------- */
.langbtn { background: none; border: 1px solid rgba(255, 255, 255, 0.28); color: #E8F3F0; border-radius: 7px; padding: 5px 12px; cursor: pointer; }
.mtop .langbtn { margin-left: auto; border-color: var(--line-2); color: var(--teal-deep); background: var(--surface); }
.side .who .row-gap { flex-wrap: wrap; margin-top: 10px; }
.side .who .row-gap button { margin-top: 0; }
.hero { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center; padding: 30px 32px; margin-bottom: 18px;
  border-radius: var(--radius-l); color: #F2F8F3; background: linear-gradient(135deg, #124D33 0%, #1F7A4D 62%, #3E8F5C 100%); }
.hero h1 { margin: 4px 0 8px; font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
.hero .eyebrow { margin: 0; font-size: 13px; color: #BFE0CB; letter-spacing: 0.02em; }
.hero .lead { margin: 0 0 18px; font-size: 16.5px; max-width: 62ch; color: #E4F2E8; }
.hero .btn { border-color: rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.08); color: #fff; }
.hero .btn.primary { background: #fff; color: var(--teal-deep); border-color: #fff; }
.hero-logo img { width: 132px; height: auto; border-radius: 18px; background: #fff; padding: 8px; display: block; }
.live-strip { margin-bottom: 18px; }
.live-strip .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }   /* (0.3.30) 6 tiles = 2 rows of 3 */
.live-strip .kpi:nth-child(3n+1) { border-left: 0; }
.lead { font-size: 16px; color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 14px; background: linear-gradient(180deg, var(--teal-tint), var(--surface) 70%); }
.stat b { display: block; font-size: 28px; font-weight: 600; color: var(--teal-deep); line-height: 1.15; }
.stat .stat-lab { display: block; margin-top: 4px; font-weight: 500; }
.stat small { display: block; margin-top: 6px; color: var(--ink-2); font-size: 12.5px; }
.basis { margin-top: 8px; font-size: 12px; color: var(--ink-3); }
.basis::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--warn); vertical-align: 1px; }
.basis-design_intent::before { background: var(--info); }
.basis-independently_verified::before { background: var(--ok); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none;
  color: var(--ink); background: var(--surface); }
.tile svg { color: var(--teal); }
.tile span { color: var(--ink-3); font-size: 13px; }
.tile:hover { border-color: var(--teal-soft); background: var(--teal-tint); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden;
  text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: border-color 0.15s; }
.card:hover { border-color: var(--teal-soft); }
.card-img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; background: var(--sunken); }
.ph-empty { display: grid; place-items: center; color: var(--teal-soft); }
.card-body { padding: 14px 16px 16px; }
.card-body h3 { margin: 6px 0 4px; font-size: 16.5px; font-weight: 600; }
.card-body p { margin: 0; color: var(--ink-2); font-size: 14px; }
.card-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-height: 22px; }
.chip-s { display: inline-block; padding: 1px 9px; border-radius: 999px; background: var(--teal-tint); color: var(--teal-deep); font-size: 12px; font-weight: 500; }
.progress-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.progress { flex: 1; height: 8px; background: var(--sunken); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--teal); border-radius: 999px; }
.progress-row b { font-size: 13px; min-width: 38px; text-align: right; }
.article { overflow: hidden; }
.article .cover, .panel .cover { width: 100%; max-height: 460px; object-fit: cover; display: block; border-radius: var(--radius); margin-bottom: 14px; }
.article > .cover { border-radius: 0; margin: 0; }
.article h1 { margin: 8px 0 10px; font-size: 26px; line-height: 1.25; font-weight: 600; }
.facts-row { display: flex; flex-wrap: wrap; margin: 4px 0 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.facts-row .fact { padding: 8px 14px; border-left: 1px solid var(--line); }
.facts-row .fact:first-child { border-left: 0; }
.rich { max-width: 76ch; font-size: 15.5px; line-height: 1.7; }
.rich p { margin: 0 0 12px; }
.rich ul { margin: 0 0 12px; padding-left: 20px; }
.rich li { margin: 3px 0; }
.updates { list-style: none; margin: 0; padding: 0; }
.updates li { position: relative; padding: 0 0 22px 22px; border-left: 2px solid var(--teal-tint); margin-left: 6px; }
.updates li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--teal); }
.updates .when { font-size: 12.5px; color: var(--ink-3); }
.updates h3 { margin: 2px 0 6px; font-size: 16px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.media { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.media-open { display: block; width: 100%; border: 0; padding: 0; background: var(--sunken); cursor: zoom-in; }
.media img, .media video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #0d1a13; }
.media figcaption { padding: 8px 10px 10px; font-size: 13px; color: var(--ink-2); }
.media figcaption b { display: block; color: var(--ink); font-weight: 600; }
.vfacade { position: relative; aspect-ratio: 4 / 3; background: linear-gradient(135deg, #124D33, #1F7A4D); display: grid; place-items: center; }
.vfacade img { position: absolute; inset: 0; height: 100%; }
.vfacade iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vplay { position: relative; width: 64px; height: 64px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.92); color: var(--teal-deep);
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25); }
.vplay:hover { background: #fff; }
.vfacade .btn { position: relative; background: #fff; }
.contact-list { display: flex; flex-direction: column; }
.contact-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.contact-row:first-child { border-top: 0; }
.contact-row b { display: block; font-size: 16px; word-break: break-word; }
.contact-row .row-gap { flex-wrap: wrap; }
.contact-form { display: flex; flex-direction: column; gap: 4px; }
.contact-form textarea { min-height: 130px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.sent h2 { margin: 6px 0; color: var(--teal-deep); }
.cta { background: linear-gradient(90deg, var(--teal-tint), var(--surface)); }
.cta h2 { margin: 0 0 4px; font-size: 18px; }
.cta p { margin: 0; }
.notice .body { color: var(--ink-2); }
.foot { max-width: 1320px; margin: 36px auto 0; padding: 18px 2px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between;
  gap: 12px 24px; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); }
.foot b { font-weight: 500; color: var(--ink-2); margin-right: 14px; }
.foot .credit { color: var(--ink-3); }
.lightbox > .panel.dlg.wide { max-width: 980px; }
.cms-form { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.cms-form .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cms-form textarea { min-height: 70px; }
.cms-form textarea[name^="body"] { min-height: 190px; }
.cms-thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--sunken); display: block; }
.cms-thumb.vid { display: grid; place-items: center; color: var(--teal-deep); font-size: 11px; width: 100%; height: auto; aspect-ratio: 4 / 3; }
.cms-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.cms-media { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cms-media > img.cms-thumb { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 0; }
.cms-media-body { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.cms-media-body .row-gap { flex-wrap: wrap; }
.cms-preview { max-width: 100%; max-height: 260px; border-radius: 8px; display: block; margin: 6px 0; }
.seg.tabs { flex-wrap: wrap; max-width: 100%; }
.cms-form input[type=file], .panel input[type=file] { max-width: 100%; }
.panel .row-gap { flex-wrap: wrap; }
.cms-prev .cms-preview { max-height: 420px; }
.cms-prev-text { white-space: pre-line; }
.msg-list { display: flex; flex-direction: column; gap: 8px; }
.msg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.msg-head { display: grid; grid-template-columns: 130px 180px 1fr auto; gap: 12px; align-items: center; width: 100%; padding: 12px 14px; border: 0;
  background: none; text-align: left; cursor: pointer; }
.msg-head.unread { background: var(--teal-tint); }
.msg-head.unread b { font-weight: 700; }
.msg-when { font-size: 12.5px; color: var(--ink-3); }
.msg-subj { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-body { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); }
.msg-text { white-space: pre-wrap; word-break: break-word; font: inherit; margin: 8px 0 0; }
.msgnum { margin-left: auto; min-width: 24px; text-align: center; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.14);
  font-size: 12.5px; color: #fff; }
.msgnum.hot { background: var(--ember); }
.nav a[aria-current="page"] .msgnum { background: var(--teal-deep); }
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 22px 18px; }
  .hero h1 { font-size: 24px; }
  .hero-logo { display: none; }
  .live-strip .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cms-form .pair { grid-template-columns: 1fr; }
  .msg-head { grid-template-columns: 1fr auto; }
  .msg-head .msg-when { grid-column: 1 / -1; }
  .msg-head .msg-subj { grid-column: 1 / -1; }
  .foot { margin-bottom: 8px; }
}

/* ---------- (0.3.5) device setup ---------- */
.setup-form { display: flex; flex-direction: column; gap: 12px; }
.setup-form fieldset.wifi { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; margin: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.setup-form fieldset.wifi legend { font-weight: 600; padding: 0 6px; }
.setup-form fieldset.wifi p { grid-column: 1 / -1; margin: 0 0 4px; }
.setup-form details.owner { border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 10px 14px; }
.setup-form details summary { cursor: pointer; font-weight: 500; }
.setup-form .row-gap.wrap { flex-wrap: wrap; }
.filebtn { cursor: pointer; }
.provlog { margin: 0; padding-left: 20px; font-size: 13px; color: var(--ink-2); }
.provlog:empty { display: none; }
.provlog li.ok { color: var(--ok); }
.provlog li.bad { color: var(--alert); }
@media (max-width: 860px) {
  .setup-form fieldset.wifi { grid-template-columns: 1fr; }
}

/* ---------- (0.3.6) visual polish: clean-energy theme (same tokens, same layout; no new dependency) ---------- */
:root { --leaf: #3E8F5C; --gold: #9A6B12; --gold-tint: #FBF3DF; --gold-line: #EAD39A;
  --shadow-2: 0 1px 2px rgba(19, 33, 29, 0.05), 0 10px 28px rgba(18, 77, 51, 0.09); }
body { background:
  radial-gradient(1100px 520px at 105% -8%, rgba(31, 122, 77, 0.10), transparent 62%),
  radial-gradient(900px 480px at -12% 108%, rgba(62, 143, 92, 0.08), transparent 60%), var(--canvas);
  background-attachment: fixed; }
.side { background: linear-gradient(180deg, #0E3B27 0%, #124D33 48%, #185A3B 100%); box-shadow: 1px 0 0 rgba(255, 255, 255, 0.04) inset; }
.nav a { transition: background 0.15s, color 0.15s; }
.nav a[aria-current="page"] { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12); }
.head h1 { color: #10291C; }
.panel { border-color: #DDE6DB; transition: box-shadow 0.2s; }
.panel > header { border-bottom: 1px solid transparent; }
.panel > header h2 { letter-spacing: 0.005em; }
.btn { transition: border-color 0.15s, background 0.15s, box-shadow 0.15s; }
.btn.primary { box-shadow: 0 1px 2px rgba(18, 77, 51, 0.25); }
.btn.primary:hover { box-shadow: 0 4px 12px rgba(18, 77, 51, 0.22); }
/* KPI strip: clearer hierarchy, state accents */
.kpi { transition: background 0.15s; }
.kpi::before { content: ""; position: absolute; left: 18px; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--teal-soft); }
.kpi.fire::before { background: var(--ember); }
.kpi.alert::before { background: var(--alert); }
.kpi:hover { background: linear-gradient(180deg, var(--teal-tint), transparent 85%); }
.kpi .num { color: #10291C; }
.kpi.fire .num { color: var(--ember-deep); }
.kpi.alert .num { color: var(--alert); }
.metric b { color: #10291C; }
.metric span, .fact span { text-transform: none; letter-spacing: 0.01em; }
.facts .fact b { color: #10291C; }
.chart .grid line { stroke: #E6ECE4; }
table.t th { background: #F6F9F5; }
/* company pages */
.hero { position: relative; overflow: hidden; box-shadow: var(--shadow-2);
  background: radial-gradient(600px 260px at 88% 0%, rgba(255, 255, 255, 0.13), transparent 70%),
              linear-gradient(135deg, #0F4430 0%, #1F7A4D 60%, #3E8F5C 100%); }
.hero::after { content: ""; position: absolute; right: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%;
  border: 38px solid rgba(255, 255, 255, 0.05); pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.tile { transition: border-color 0.15s, background 0.15s, transform 0.15s; }
.tile:hover { transform: translateY(-1px); }
.card { transition: border-color 0.15s, box-shadow 0.2s, transform 0.2s; }
.card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.stat { position: relative; transition: box-shadow 0.2s; }
.stat.verified { border-color: var(--teal-soft); background: linear-gradient(180deg, #DDF0E3, var(--surface) 75%); }
.stat .ev-badge { margin-bottom: 8px; }
.stat-ev { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); text-decoration: none; color: var(--teal-deep); font-size: 13px; font-weight: 500; }
.stat-ev:hover { border-color: var(--teal-soft); }
.stat-ev small { display: block; color: var(--ink-3); font-weight: 400; font-size: 11.5px; margin-top: 1px; }
.stat-ev-img { width: 44px; height: 34px; object-fit: cover; border-radius: 4px; background: var(--sunken); flex: none; }
.sec-h { margin: 18px 0 8px; font-size: 17px; font-weight: 600; color: #10291C; }
.stove-sec.specs .rich { background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; max-width: none; }
.stove-sec.specs .rich p:last-child, .stove-sec.specs .rich ul:last-child { margin-bottom: 0; }
/* evidence: certificates, tested results, awards */
.ev-legend { margin-bottom: 4px; background: var(--teal-tint); color: #164A31; }
.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 16px; }
.ev-card { display: grid; grid-template-columns: 150px 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l);
  overflow: hidden; box-shadow: var(--shadow); border-top: 4px solid var(--teal); transition: box-shadow 0.2s; }
.ev-card.award { border-top-color: var(--gold); }
.ev-card:hover { box-shadow: var(--shadow-2); }
.ev-media { display: block; background: #F3F5F0; border-right: 1px solid var(--line); }
.ev-img { width: 100%; height: 100%; min-height: 190px; object-fit: contain; display: block; padding: 8px; background: #F3F5F0; }
.ev-ph { height: 100%; min-height: 190px; display: grid; place-items: center; color: var(--teal-soft); }
.ev-card.award .ev-ph { color: var(--gold-line); }
.ev-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ev-body h3 { margin: 2px 0 0; font-size: 16px; line-height: 1.3; font-weight: 600; }
.ev-body h3 a { color: var(--ink); text-decoration: none; }
.ev-body h3 a:hover { color: var(--teal-deep); text-decoration: underline; }
.ev-issuer { font-size: 13px; color: var(--ink-2); }
.ev-meta { font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.ev-badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 999px; font-size: 12px;
  font-weight: 600; background: var(--ok-tint); color: var(--teal-deep); border: 1px solid var(--teal-soft); }
.award .ev-badge, .ev-article.award .ev-badge { background: var(--gold-tint); color: var(--gold); border-color: var(--gold-line); }
.ev-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 4px; }
.ev-result { padding: 10px 12px; border-radius: var(--radius); background: linear-gradient(180deg, var(--teal-tint), #F4FAF6); border: 1px solid #CFE6D7; }
.award .ev-result { background: linear-gradient(180deg, var(--gold-tint), #FFFCF5); border-color: var(--gold-line); }
.ev-result b { display: block; font-size: 22px; line-height: 1.15; font-weight: 700; color: var(--teal-deep); letter-spacing: -0.01em; }
.award .ev-result b { color: var(--gold); }
.ev-result b small { font-size: 13px; font-weight: 600; letter-spacing: 0; }
.ev-result span { display: block; margin-top: 3px; font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.ev-result > small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-3); }
.ev-results.big { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.ev-results.big .ev-result { padding: 14px 16px; }
.ev-results.big .ev-result b { font-size: 30px; }
.ev-note { margin: 4px 0 0; font-size: 12px; color: var(--ink-3); font-style: italic; }
.ev-article { border-top: 4px solid var(--teal); }
.ev-article.award { border-top-color: var(--gold); }
.article > .cover.cert { object-fit: contain; max-height: 640px; background: #F3F5F0; padding: 16px; }
.ev-doc { margin-top: 14px; }
.ev-cta { background: linear-gradient(90deg, #DDF0E3, var(--surface)); }
@media (max-width: 860px) {
  body { background-attachment: scroll; }
  .ev-card { grid-template-columns: 1fr; }
  .ev-media { border-right: 0; border-bottom: 1px solid var(--line); }
  .ev-img, .ev-ph { min-height: 0; height: 200px; }
  .ev-results.big .ev-result b { font-size: 24px; }
  .kpi::before { left: 14px; }
}
@media (prefers-reduced-motion: reduce) { .card, .tile, .card:hover, .tile:hover { transition: none; transform: none; } }

/* (0.3.14) sidebar: scrolls on its own when the menu is taller than the screen; the green background fills the whole
   bar at every scroll position (background painted on the fixed-height bar, not on the menu content) */
.side { height: 100vh; height: 100dvh; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
  background-color: #124D33; -webkit-overflow-scrolling: touch; }
.side::-webkit-scrollbar { width: 8px; }
.side::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.24); border-radius: 8px; }
.side::-webkit-scrollbar-track { background: transparent; }
.side .nav { flex: none; }
.side .who { flex: none; }
.nav a { -webkit-tap-highlight-color: transparent; }
.nav a:focus-visible { outline: 2px solid #E8F3F0; outline-offset: 1px; }
.nav a[aria-current="page"] { background: #E8F3F0; color: var(--teal-deep); font-weight: 600; }
@media (max-width: 860px) {
  .side { height: auto; overflow-y: hidden; overflow-x: auto; background: linear-gradient(90deg, #0E3B27, #185A3B); }
}

/* (0.3.14) field forms: one column on phones, large touch targets, device search list, photo buttons, numbered steps */
input[type="tel"] { font: inherit; }
label.f input[type="tel"], label.f input[type="search"] { width: 100%; }
.devsearch input[type="search"] { width: 100%; }
.dev-results { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-height: 260px; overflow-y: auto; }
.dev-opt { text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-s, 6px); background: var(--surface); cursor: pointer; }
.dev-opt:hover, .dev-opt:focus-visible { border-color: var(--teal); background: var(--teal-tint); }
.small.ok { color: var(--teal-deep); font-weight: 600; }
.small.warn { color: #9A5B00; font-weight: 600; }
.stepno { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 8px; border-radius: 50%;
  background: var(--teal); color: #fff; font-size: 13px; }
.wifi-guide .steps { margin: 0 0 8px; padding-left: 20px; line-height: 1.5; }
.wifi-guide .steps li { margin-bottom: 4px; }
.pick { display: flex; flex-direction: column; gap: 8px; }
.pick-prev { display: flex; flex-direction: column; gap: 6px; }
.pick-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.btn.big { padding: 14px 20px; font-size: 16px; width: 100%; }
@media (max-width: 860px) {
  .form { grid-template-columns: 1fr; }
  .form .grid2, .grid2 { grid-template-columns: 1fr; }
  .form input, .form select, .form textarea { font-size: 16px; min-height: 44px; }   /* 16px: no iOS zoom on focus */
  .form .btn, .pick-acts .btn { min-height: 44px; }
  .gps { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
  .photo-picks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pick-acts .btn { flex: 1 1 100%; }
}

/* (0.3.17) three Wi-Fi profile cards + device status */
.wificard { margin: 0 0 12px; }
.wificard legend { font-weight: 600; }
.statuskv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 12px; margin: 8px 0 0; }
.statuskv dt { color: var(--ink-3); } .statuskv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 860px) { .statuskv { grid-template-columns: 1fr; } .statuskv dd { margin-bottom: 6px; font-weight: 600; } }

/* (0.3.19) Device step (scan QR / search, server check) + Device ID QR labels */
.devstep { display: flex; flex-direction: column; gap: 10px; }
.devcheck.ok b { display: block; font-size: 16px; }
.printsheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 10px; }
.qrlabel { border: 1px dashed #999; border-radius: 8px; padding: 10px; text-align: center; background: #fff; color: #000; break-inside: avoid; }
.qrl-brand { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; margin-bottom: 4px; }
.qrl-brand img { width: 22px; height: 22px; object-fit: contain; }
.qrl-id { font-size: 15px; font-weight: 700; letter-spacing: 0.02em; margin-top: 4px; }
@media print {
  body.printing > *:not(.printwrap) { display: none !important; }
  body.printing .printwrap { position: static; background: none; display: block; }
  body.printing .printwrap .panel { box-shadow: none; border: 0; max-width: none; margin: 0; max-height: none; overflow: visible; }
  body.printing .noprint { display: none !important; }
  .printsheet { grid-template-columns: repeat(3, 1fr); }
}
/* (0.3.27) live auto-refresh indicator; warn = the last refresh failed, values shown are older */
.live-ind { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.live-ind.warn { color: #A86A10; white-space: normal; font-weight: 600; }
/* (0.3.28/0.3.29) Website + Facebook cards: side by side, one column below 860 px (.grid2); green palette */
.social-card { position: relative; overflow: hidden; border-top: 4px solid var(--teal); }
.social-card[data-card="facebook"] { border-top-color: #1877F2; }
.social-head { display: flex; align-items: center; gap: 14px; padding: 18px 18px 6px; }
.social-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.social-head p { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); }
.social-head > div { flex: 1; min-width: 0; }
.social-mark { flex: none; display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 12px;
  background: var(--teal-tint); color: var(--teal-deep); }
.social-mark.facebook { background: #1877F2; color: #fff; }
.social-pill { flex: none; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.social-pill.soon { background: var(--warn-tint); color: var(--warn); }
.social-pill.live { background: var(--ok-tint); color: var(--ok); }
.social-card .body { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding-top: 6px; }
.social-card .body p { margin: 0; }
.social-url { font-weight: 600; color: var(--teal-deep); overflow-wrap: anywhere; }
.social-card .btn[disabled] { opacity: 1; color: var(--ink-3); background: var(--sunken); border-color: var(--line); }
.social-frame { width: 100%; max-width: 500px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.social-iframe { display: block; width: 100%; max-width: 500px; border: 0; border-radius: var(--radius-l); background: var(--surface); }
.social-slot:empty { display: none; }
@media (max-width: 860px) { .social-pill { white-space: normal; } }
/* (0.3.30) registered-device row: 4 tiles, kept separate from the installed-household KPIs */
.fleet-row { margin-bottom: 16px; }
.fleet-row[hidden] { display: none; }
.fleet-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .fleet-kpis .kpi:nth-child(4) { border-left: 1px solid var(--line); } }
@media (max-width: 860px) { .fleet-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* (0.3.30) phones: a panel header's range selector (e.g. Temperature Live/Today/24 h/7/30 days) moves under the title
   instead of widening the page (0.3.29: 409 px page on a 390 px screen); buttons never break their label */
.seg button { white-space: nowrap; }
@media (max-width: 860px) {
  .panel > header { flex-wrap: wrap; }
  .panel > header .seg { max-width: 100%; overflow-x: auto; }
}

/* (0.3.32) Fleet operations */
.fleet-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.fleet-tools input { flex: 1 1 220px; min-width: 0; }
.fleet-tools select { flex: 0 1 200px; min-width: 0; }
.fleet-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 10px; background: var(--sunken); border-radius: var(--radius-s); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--teal-deep); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; overflow-wrap: anywhere; text-align: left; }
.dlg h3 { margin: 14px 0 4px; font-size: 14px; }
.fleet-sha { overflow-wrap: anywhere; }
/* (0.3.32) a device table also matches the site's .cards grid, which put the header and the rows in different columns on desktop */
@media (min-width: 861px) { table.t.cards { display: table; } }

/* (0.3.49) Pending Household Approvals card */
.pending-kpi { grid-template-columns: minmax(0, 1fr); }
.pending-kpi .kpi { border-left: 0; }
@media (min-width: 861px) { .pending-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- (0.3.58) data-download requests: public form + status, Admin inbox ---------- */
.dr { max-width: 860px; }
.dr-form h2 { font-size: 16px; margin: 22px 0 8px; }
.dr-form h2:first-child { margin-top: 0; }
.fld { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.fld > span { color: var(--ink-2); }
.fld input, .fld textarea, .dr-form textarea, .dr-form select, .panel textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line, #cfd8d3); border-radius: 8px; background: var(--surface, #fff); }
.dr-checks { display: grid; gap: 8px; }
.dr-check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line, #dfe6e2); border-radius: 10px; background: var(--surface, #fff); cursor: pointer; }
.dr-check input { margin-top: 4px; flex: none; }
.dr-check span { display: flex; flex-direction: column; min-width: 0; }
.dr-check small { color: var(--ink-2); font-size: 12.5px; }
.dr-check.sens { border-color: #c0392b66; background: #fdf3f1; }
.dr-consent { margin-top: 14px; }
.dr-area { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 8px 0 12px; }
.dr-honey { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.dr-hide { display: none; }
.dr-h { margin: 0; }
.dr-ref { margin: 12px 0; padding: 10px 12px; border-radius: 10px; background: rgba(127, 127, 127, 0.1); font-size: 13px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.dr-ref code { word-break: break-all; font-size: 12px; user-select: all; }
.dr-approved { margin: 10px 0; }
.dr-events { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.dr-status .row-gap, .dr-form .row-gap { margin-top: 12px; flex-wrap: wrap; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } .dr-form, .dr-status { padding: 14px; } }
