:root{--bg:#f4f6f9;--fg:#1c2733;--muted:#6b7a8a;--card:#fff;--line:#d9e0e8;--accent:#1f77b4;
--ok:#2e9e4f;--warn:#e69a00;--err:#d6333f;--row:#f8fafc}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--bg:#10161d;--fg:#e6edf3;--muted:#93a1b0;--card:#18212b;
--line:#2b3744;--accent:#58a6ff;--row:#141c25}}
:root[data-theme="dark"]{--bg:#10161d;--fg:#e6edf3;--muted:#93a1b0;--card:#18212b;
--line:#2b3744;--accent:#58a6ff;--row:#141c25}

/* the hidden attribute must win over any display rule below (.gate/.setrow/.split set display and would otherwise override it) */
[hidden]{display:none !important}
*{box-sizing:border-box}
body{margin:0;font:14px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,"Noto Sans Khmer",sans-serif;
color:var(--fg);background:var(--bg)}
.muted{color:var(--muted)}
.err{color:var(--err)}
/* login */
.gate{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px}
.gate .card{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:26px;
width:340px;box-shadow:0 6px 24px #0002}
.gate h1{margin:0 0 6px;font-size:18px}
.gate p{margin:0 0 14px;font-size:13px}
.gate input{width:100%;font:inherit;padding:9px 11px;border:1px solid var(--line);border-radius:7px;
background:var(--bg);color:var(--fg);margin-bottom:10px}
.gate button{width:100%;padding:9px;border:0;border-radius:7px;background:var(--accent);color:#fff;
font:inherit;cursor:pointer}
/* chrome */
header{display:flex;align-items:center;gap:16px;padding:0 16px;height:52px;background:var(--card);
border-bottom:1px solid var(--line);position:sticky;top:0;z-index:10;flex-wrap:wrap}
header nav{display:flex;gap:4px}
header nav button{border:0;background:none;color:var(--muted);font:inherit;padding:6px 12px;
border-radius:7px;cursor:pointer}
header nav button.on{background:var(--accent);color:#fff}
header .right{margin-left:auto;display:flex;align-items:center;gap:12px}
header a{color:var(--accent);font-size:13px;text-decoration:none}
#logout{border:1px solid var(--line);background:var(--card);color:var(--fg);border-radius:7px;
padding:5px 11px;font:inherit;cursor:pointer}
.statbar{display:flex;gap:18px;flex-wrap:wrap;padding:10px 16px;background:var(--card);
border-bottom:1px solid var(--line);font-size:12px;color:var(--muted)}
.statbar b{color:var(--fg)}
main{padding:16px}
.toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:10px}
.toolbar input[type=text],.toolbar input:not([type]),#q{flex:1;min-width:200px;max-width:380px;
font:inherit;padding:7px 10px;border:1px solid var(--line);border-radius:7px;background:var(--card);color:var(--fg)}
select,input[type=text],input[type=number]{font:inherit;padding:6px 9px;border:1px solid var(--line);
border-radius:6px;background:var(--card);color:var(--fg)}
.chk{display:flex;align-items:center;gap:5px;color:var(--muted);font-size:13px}
/* tables */
/* border-collapse:separate, not collapse: a collapsed table drops the borders of a sticky <th>
   as soon as it detaches, which is what made the header look misaligned with the rows. */
table{width:100%;border-collapse:separate;border-spacing:0;background:var(--card);
border:1px solid var(--line);border-radius:9px;font-size:13px}
th,td{padding:6px 10px;text-align:left;border-bottom:1px solid var(--line);vertical-align:middle}
th{background:var(--row);color:var(--muted);font-weight:500;font-size:12px;position:sticky;top:0;
z-index:2;box-shadow:inset 0 -1px 0 var(--line)}
/* Every full-width table scrolls in its own box so the header freezes against that box instead of
   sliding under the sticky page header. */
.tablewrap{max-height:calc(100vh - 190px);overflow:auto;border-radius:9px}
.tablewrap table{border-radius:0;border:0}
tbody tr:hover{background:var(--row)}
tbody tr.sel{background:#1f77b422}
td.num,th.num{text-align:right;font-variant-numeric:tabular-nums}
/* split layout */
.split{display:grid;grid-template-columns:minmax(320px,1fr) minmax(380px,1.2fr);gap:14px;align-items:start}
.list{max-height:calc(100vh - 210px);overflow:auto;border-radius:9px}
.list table{border-radius:0}
.list tbody tr{cursor:pointer}
tr.grouphead{cursor:pointer;background:var(--row)}
tr.grouphead:hover{background:var(--line)}
tr.grouphead td{font-size:13px;padding:7px 10px}
.grouptoggle{background:none;border:0;cursor:pointer;color:inherit;font-size:12px;width:16px;
display:inline-block;text-align:center;padding:0;margin-right:2px}
.panel{background:var(--card);border:1px solid var(--line);border-radius:9px;padding:16px;
max-height:calc(100vh - 210px);overflow:auto}
.panel h2{margin:0 0 2px;font-size:16px}
.panel h3{margin:18px 0 8px;font-size:13px;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.fld{display:flex;flex-direction:column;gap:3px;margin-bottom:8px}
.fld label{font-size:12px;color:var(--muted)}
/* "suggested — please confirm" / "could not be translated" next to a field label */
.hint{font-style:normal;font-size:11px;margin-left:6px}
.hint.ok{color:var(--ok)}
.hint.warn{color:var(--warn)}
.fld input,.fld textarea{font:inherit;padding:6px 9px;border:1px solid var(--line);border-radius:6px;
background:var(--bg);color:var(--fg)}
.fld textarea{min-height:56px;resize:vertical}
.ro{background:var(--row);border-radius:7px;padding:9px;font-size:12px;color:var(--muted)}
.ro div{display:flex;justify-content:space-between;gap:12px;padding:2px 0}
.ro b{color:var(--fg);font-weight:600;font-variant-numeric:tabular-nums}
.btn{border:0;border-radius:7px;background:var(--accent);color:#fff;padding:8px 14px;font:inherit;cursor:pointer}
.btn.ghost{background:var(--card);color:var(--fg);border:1px solid var(--line)}
.btn.danger{background:var(--card);color:var(--err);border:1px solid var(--line)}
.btn[disabled]{opacity:.5;cursor:default}
.actions{display:flex;gap:8px;margin-top:12px;flex-wrap:wrap}
.pill{display:inline-block;border-radius:9px;padding:1px 8px;font-size:11px;color:#fff}
.pill.ok{background:var(--ok)}.pill.warn{background:var(--warn)}.pill.off{background:var(--muted)}
.pill.err{background:var(--err)}
.sens input[type=number],.sens input[type=text]{width:100%;padding:4px 6px;font-size:12px}
.sens td{padding:5px 6px}
.sens .w{width:74px}
.toast{position:fixed;bottom:18px;left:50%;transform:translateX(-50%);background:#1c2733;color:#fff;
padding:10px 18px;border-radius:8px;font-size:13px;box-shadow:0 4px 16px #0004;z-index:50}
.toast.bad{background:var(--err)}
@media (max-width:900px){.split{grid-template-columns:1fr}.panel,.list{max-height:none}}

.setrow{display:flex;gap:10px;align-items:flex-start;padding:10px;border:1px solid var(--line);
border-radius:8px;margin-bottom:8px;cursor:pointer}
.setrow:hover{background:var(--row)}
.setrow input{margin-top:3px}
.setrow b{font-weight:600;font-size:13px}
.setrow small{font-size:12px}
.setrow em{font-style:normal;color:var(--accent)}

/* RBAC: role badge + disabled write controls for read-only viewers */
.rolebadge{display:inline-block;border-radius:9px;padding:1px 8px;font-size:11px;color:#fff;margin-left:6px}
.rolebadge.viewer{background:#7f8a97}.rolebadge.operator{background:#1f77b4}.rolebadge.admin{background:#9e2a2a}
[disabled]{opacity:.55;cursor:not-allowed}
.readonly-note{font-size:12px;color:var(--muted);padding:10px;background:var(--row);border-radius:8px;margin-bottom:10px}

/* theme switcher */
.theme{display:inline-flex;border:1px solid var(--line);border-radius:6px;overflow:hidden}
.theme button{border:0;background:var(--card);color:var(--muted);font:inherit;font-size:12px;
padding:5px 9px;cursor:pointer;line-height:1}
.theme button.on{background:var(--accent);color:#fff}
.theme button+button{border-left:1px solid var(--line)}

/* system health rows */
.chk-row{display:flex;gap:9px;align-items:flex-start;padding:6px 0;
border-bottom:1px solid var(--line)}
.chk-row:last-child{border-bottom:0}
.chk-row .pill{flex:none;margin-top:1px;min-width:46px;text-align:center}
.chk-row b{font-size:13px}
.chk-row span{font-size:13px}
.chk-row small{display:block;color:var(--muted);font-size:11px}
.chk-row small.fix{color:var(--accent)}
#v-system h3{margin:14px 0 6px;font-size:12px;color:var(--muted);text-transform:uppercase;
letter-spacing:.05em}
#sysOverall{font-size:13px;display:flex;align-items:center;gap:8px}

/* a Khmer name that came from the lookup table, not from an admin */
.sug{font-size:10px;font-style:italic}

/* a settings row that needs no card: label, control, button, message on one line */
.oneline{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:12px;
padding:8px 12px;background:var(--card);border:1px solid var(--line);border-radius:9px}
.oneline label{color:var(--muted);font-size:13px}
.oneline .btn{padding:6px 14px}
.oneline span{font-size:12px}

/* ---- custom prediction ---- */
.pdwide{max-height:none;margin-bottom:14px;overflow:visible}
.pdsub{font-size:12px;margin:2px 0 12px}
.pdbanner{margin:0 0 12px;padding:9px 12px;border-radius:8px;background:#e69a0020;
border:1px solid var(--warn);font-size:13px}
.pdrain{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:8px;margin-bottom:12px}
.pdrain div{background:var(--row);border-radius:8px;padding:8px 10px}
.pdrain small{display:block;color:var(--muted);font-size:11px}
.pdrain b{font-size:17px;font-weight:700}
.pdrain i{display:block;font-style:normal;font-size:11px;color:var(--muted)}
#pdTable td small,#pdTable th small{display:block;color:var(--muted);font-size:11px;font-weight:400}
#pdTable td.pc{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
#pdTable td.pc b{font-size:15px}
#pdTable td.pc.now b{font-size:16px}
#pdTable td.sk{min-width:210px}
#pdTable td.sk .pill{margin-right:6px}
#pdTable tbody tr{cursor:pointer}
#pdTable tbody tr.sel{background:#1f77b422}
.warnt{color:var(--warn)!important}
.pdkey{font-size:12px;color:var(--muted);margin:10px 0 4px;line-height:1.5}
.pdnotes{margin:6px 0 0;padding-left:18px;font-size:12px;color:var(--muted)}
.pdnotes li{margin:2px 0}

/* chart tokens: the validated categorical slots 1-3, stepped separately for each surface */
.viz-root{--s-obs:#2a78d6;--s-custom:#eb6834;--s-raw:#1baf7a;--viz-surface:#fcfcfb;
--viz-ink:#0b0b0b;--viz-ink2:#52514e;--viz-muted:#898781;--viz-grid:#e1e0d9;--viz-axis:#c3c2b7;
background:var(--viz-surface);color:var(--viz-ink)}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .viz-root{--s-obs:#3987e5;
--s-custom:#d95926;--s-raw:#199e70;--viz-surface:#1a1a19;--viz-ink:#f0efec;--viz-ink2:#c3c2b7;
--viz-muted:#898781;--viz-grid:#2c2c2a;--viz-axis:#383835}}
:root[data-theme="dark"] .viz-root{--s-obs:#3987e5;--s-custom:#d95926;--s-raw:#199e70;
--viz-surface:#1a1a19;--viz-ink:#f0efec;--viz-ink2:#c3c2b7;--viz-muted:#898781;
--viz-grid:#2c2c2a;--viz-axis:#383835}
.pdvhead{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-bottom:8px}
.pdvhead h2{margin:0;font-size:15px;color:var(--viz-ink)}
.pdlegend{display:flex;gap:14px;flex-wrap:wrap;font-size:12px;color:var(--viz-ink2);flex:1}
.pdlegend span{display:inline-flex;align-items:center;gap:6px}
.pdsw{display:inline-block;width:18px;height:0;border-top:2px solid}
.pdsw.obs{border-color:var(--s-obs)}
.pdsw.custom{border-color:var(--s-custom)}
.pdsw.raw{border-color:var(--s-raw);border-top-style:dashed}
.pdtoggle{display:inline-flex;border:1px solid var(--viz-axis);border-radius:6px;overflow:hidden}
.pdtoggle button{border:0;background:var(--viz-surface);color:var(--viz-ink2);font:inherit;
font-size:12px;padding:4px 11px;cursor:pointer}
.pdtoggle button+button{border-left:1px solid var(--viz-axis)}
.pdtoggle button.on{background:var(--accent);color:#fff}
.pdchartbox{position:relative;height:360px}
.pdtwin{max-height:360px!important}
.pdrainmodel h3{margin:16px 0 6px;font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.05em}
.pdrainmodel p{font-size:12px;line-height:1.5;margin:6px 0}
.pdsmall{max-width:520px;font-size:12px}
@media (max-width:700px){
  #pdTable td.sk{min-width:150px}
  .pdchartbox{height:300px}
}

/* Admin header on a phone or small tablet. The nine tabs add up to ~740px, wider than the
   screen, and as one unbreakable row they pushed the whole page sideways. They now scroll
   inside their own strip and the right-hand controls wrap beneath instead. */
@media (max-width:820px){
  header{height:auto;min-height:52px;padding:8px 12px;row-gap:6px}
  header nav{order:3;flex:1 1 100%;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  header nav::-webkit-scrollbar{display:none}
  header nav button{flex:0 0 auto;white-space:nowrap}
  header .right{flex-wrap:wrap;gap:8px;margin-left:0;width:100%}
  main{padding:12px}
}

/* page title and one-line description at the top of the Custom Prediction page */
.pdpagehead{margin:0 0 12px}
.pdpagehead h1{margin:0;font-size:20px;line-height:1.25}
.pdpagehead p{margin:2px 0 0;font-size:13px}

/* Visitors: settings on the left, the map filling the space beside it */
.vgrid{display:grid;grid-template-columns:minmax(320px,560px) 1fr;gap:14px;align-items:start;margin-bottom:14px}
.vgrid>.panel{max-height:none;overflow:visible}
.vmhead{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:6px}
.vmhead h2{margin:0;font-size:16px;flex:1;min-width:160px;color:var(--viz-ink)}
.vmnote{font-size:12px;margin:2px 0 8px;line-height:1.45}
/* isolation keeps Leaflet's high z-index panes underneath the sticky admin header */
.vismap{height:440px;border-radius:8px;border:1px solid var(--viz-axis);position:relative;z-index:0;isolation:isolate}
.vmlegend{display:flex;gap:16px;flex-wrap:wrap;align-items:center;font-size:12px;color:var(--viz-ink2);margin-top:8px}
.vmlegend span{display:inline-flex;align-items:center;gap:6px}
.vmlegend i{display:inline-block;border-radius:50%;background:var(--s-obs);opacity:.65;border:2px solid var(--viz-surface)}
@media (max-width:1000px){.vgrid{grid-template-columns:1fr}.vismap{height:340px}}

/* sub-tabs inside a page (Settings, Users) */
.subtabs{display:flex;gap:2px;margin:0 0 14px;border-bottom:1px solid var(--line);overflow-x:auto;
scrollbar-width:none;-webkit-overflow-scrolling:touch}
.subtabs::-webkit-scrollbar{display:none}
.subtabs button{flex:0 0 auto;border:0;background:none;color:var(--muted);font:inherit;
padding:8px 14px;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-1px;white-space:nowrap}
.subtabs button:hover{color:var(--fg)}
.subtabs button.on{color:var(--fg);font-weight:600;border-bottom-color:var(--accent)}
/* settings panes: forms read better at a measured width, and long ones should not scroll inside a box */
.stpane>.panel{max-height:none;overflow:visible;max-width:760px}
#st-backups>.panel{max-width:960px}
#st-system .panel{max-width:none}
.panel .oneline{border:0;padding:0;margin:0;background:none}

.pdlinks{font-size:12px;margin:2px 0 10px}
.pdlinks a{color:var(--accent)}

/* Khmer: a face with proper Khmer shaping, and more line height because the script has tall marks */
body.km{font-family:"Noto Sans Khmer","Khmer UI","Leelawadee UI","Khmer OS System",system-ui,sans-serif;line-height:1.7}
body.km th,body.km td,body.km button,body.km label{line-height:1.6}
body.km nav#tabs button,body.km .subtabs button{white-space:nowrap}

/* weather model comparison */
.mcchecks{display:inline-flex;gap:6px 14px;flex-wrap:wrap}
.mcchk{display:inline-flex;align-items:center;gap:5px;font-size:13px;cursor:pointer}
.mcchk small{color:var(--muted);font-size:11px;border:1px solid var(--line);border-radius:8px;padding:0 5px}
.mcchk.off{opacity:.5;cursor:not-allowed}
.mctable td.num,.mctable th.num{text-align:right;white-space:nowrap}
.mctable tr.mcmean td{color:var(--muted)}
.mcbest{font-size:11px;background:var(--accent);color:#fff;border-radius:8px;padding:1px 7px;margin-left:4px}
.mcwin{font-weight:700}
.mcchartbox{position:relative;height:220px;margin:12px 0}
.mch3{font-size:14px;margin:14px 0 6px}
.mcformula h3{font-size:14px;margin:8px 0 4px}
.mcformula p{font-size:13px;margin:6px 0}
.mcformula pre,.mdformula{background:var(--hover,rgba(127,127,127,.1));border-radius:6px;padding:8px 10px;
  font:12px/1.5 ui-monospace,Consolas,monospace;overflow-x:auto;white-space:pre;margin:6px 0}
.mcdetails summary{cursor:pointer;color:var(--accent);font-size:13px;margin-top:6px}
.mdhow{min-width:340px;font-size:13px}
tr.mdoff td{opacity:.6}

.legend{font-size:12px;color:var(--muted);margin:12px 0 0;line-height:1.55}
.legend ul{margin:4px 0 0;padding-left:18px}.legend li{margin:3px 0}
.legend .pill{margin-right:4px}

.pdsection{font-size:12px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);margin:0 0 6px}

.mcrefs ol{font-size:13px;padding-left:20px;margin:4px 0}.mcrefs li{margin:5px 0}.mcrefs a{color:var(--accent)}
.mckinds{margin-bottom:10px}

.mcfull{font-weight:400;font-size:12px;color:var(--muted)}

/* public /education page: the admin's Custom Prediction page, with a slim bar of its own */
.edubar{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:8px 16px;
background:var(--card);border-bottom:1px solid var(--line)}
.edubrand{flex:1;min-width:180px;font-size:14px}
.edubarr{display:flex;align-items:center;gap:10px}
.eduhead{padding-bottom:0}
.eduhead h1{margin:6px 0 8px;font-size:22px;line-height:1.3}
.eduhead .edunote{border-left:3px solid var(--accent);padding:6px 10px;background:rgba(127,127,127,.08);
border-radius:0 6px 6px 0;font-size:13px;margin:0 0 6px}
body.eduview main{display:block}

body.eduview .btn:disabled,body.eduview select:disabled,body.eduview button:disabled{opacity:.55;cursor:not-allowed}

#eduTabs button{white-space:normal;text-align:left}

/* Custom Prediction / Education & Research: one long page, scrolled by the browser alone.
   No box inside it scrolls up and down on its own; a wide table may still slide sideways on a phone. */
#v-predict .panel,#v-predict .list,#v-predict .pdtwin{max-height:none!important;overflow:visible!important}
#v-predict .tablewrap{max-height:none!important;overflow-x:auto!important;overflow-y:visible!important}

.limits{border-collapse:collapse;margin:10px 0 0;font-size:12px;width:100%;max-width:460px}
.limits th,.limits td{border-bottom:1px solid var(--line);padding:4px 8px;text-align:left}
.limits th.num,.limits td.num{text-align:right;white-space:nowrap}

.mcverdict{border:1px solid var(--line);border-left:4px solid var(--accent);border-radius:8px;padding:10px 14px;margin:8px 0 12px;font-size:15px}
.mcverdict .mck{color:var(--muted);font-size:12px;text-transform:uppercase;letter-spacing:.05em;display:block}
.mcverdict b{font-size:18px}
.mcverdict .muted{font-size:13px;margin-top:2px}
.mctable small.edugrey{display:block;color:var(--muted);font-size:11px;font-weight:400}

.limits.audit{max-width:760px;margin-top:14px}
.limits.audit td:nth-child(2){font-family:ui-monospace,Consolas,monospace;font-size:11px}

.hsbar{height:8px;background:var(--line);border-radius:4px;overflow:hidden;margin:6px 0 12px}
.hsbar i{display:block;height:100%;width:0;background:var(--accent);transition:width .4s}

.hsrun{border:1px solid var(--line);border-left:4px solid var(--muted);border-radius:6px;padding:7px 12px;margin:8px 0;font-size:13px}
.hsrun.on{border-left-color:#1baf7a}
.hsrun.off b{color:var(--muted)}

.gcbar{display:inline-flex;width:140px;height:8px;background:var(--line);border-radius:4px;overflow:hidden;vertical-align:middle}
.gcbar i{display:block;height:100%}
.gcbar i.st{background:#1baf7a}
.gcbar i.fl{background:#eb6834}
.statgrp{display:flex;align-items:baseline;gap:6px 16px;flex-wrap:wrap;padding-right:18px;margin-right:2px;border-right:1px solid var(--line)}
.statgrp:last-child{border-right:0}
.statgrp h4{margin:0;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}

/* Health panel's donut rings -- one per gauge, SVG stroke-dasharray driven by percent, no library */
.gaugerow{display:flex;flex-wrap:wrap;gap:18px 10px;margin:4px 0 14px;justify-content:space-between}
.gauge{display:flex;flex-direction:column;align-items:center;width:112px;text-align:center}
.gauge svg{transform:rotate(-90deg)}
.gauge .gtrack{fill:none;stroke:var(--line);stroke-width:9}
.gauge .gval{fill:none;stroke-width:9;stroke-linecap:round;transition:stroke-dashoffset .6s ease,stroke .6s ease}
.gauge .gnum{font-size:17px;font-weight:700;fill:var(--fg)}
.gauge .glabel{margin-top:6px;font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--muted)}
.gauge .gdetail{font-size:10px;color:var(--muted);min-height:13px}
.gauge.g-overall .glabel{color:var(--accent)}

/* admin: satellite reading demo (static/sat-demo.js) */
.sdwrap{display:grid;grid-template-columns:minmax(0,720px) minmax(260px,1fr);gap:16px;align-items:start}
@media (max-width:1000px){.sdwrap{grid-template-columns:1fr}}
.sdtools{display:flex;flex-wrap:wrap;gap:4px 14px;margin:0 0 8px;font-size:12px;align-items:center}
.sdtools label{display:inline-flex;align-items:center;gap:4px;white-space:nowrap}
.sdcanvas{width:100%;max-width:704px;height:auto;border:1px solid var(--line,#ccd);border-radius:6px;background:#0d141b;cursor:crosshair;display:block;image-rendering:pixelated}
.sdinspect{margin-top:10px;font-size:12px}
.sdrule{border-left:3px solid var(--line,#ccd);padding:2px 0 2px 10px;margin:0 0 10px;opacity:.65}
.sdrule.on{border-color:#1e6fe0;opacity:1}
.sdrule h4{margin:0 0 2px;font-size:13px}
.sdrule p{margin:0;font-size:12px;line-height:1.45}
.sdcode summary{cursor:pointer;font-size:12px;color:var(--accent,#1e6fe0);margin-bottom:6px}
.sdcode pre{font-size:11px;line-height:1.4;background:rgba(0,0,0,.05);padding:8px;border-radius:6px;overflow-x:auto;margin:0}

.sdqa{border:1px solid var(--line,#ccd);border-radius:8px;padding:8px 12px;margin:0 0 12px;background:rgba(30,111,224,.05)}
.sdqa summary{cursor:pointer;font-weight:600;font-size:13px}
.sdqabody{font-size:12.5px;line-height:1.5;margin-top:8px}
.sdqabody h4{margin:12px 0 4px;font-size:13px}
.sdqabody ol{margin:0;padding-left:20px}
.sdqabody li{margin:2px 0}
.sdsay{background:var(--card,#fff);border-left:3px solid #1e6fe0;padding:8px 12px;margin:0;border-radius:4px}
.sdpat td:first-child{white-space:nowrap}

.sdsource{padding:6px 8px;background:rgba(0,0,0,.04);border-radius:6px}
.sdsw{display:inline-block;width:12px;height:12px;border:1px solid rgba(0,0,0,.4);margin-right:6px;vertical-align:-2px}
.sdflow th{text-align:left;white-space:nowrap;vertical-align:top;font-weight:600}
.sdflow td{vertical-align:top;font-size:11.5px;line-height:1.4}
.sdflow code{font-size:10.5px;word-break:break-all}

.sdscale{font-size:12px;line-height:1.5;margin:0 0 8px;padding:8px 10px;border-left:3px solid #1e6fe0;background:rgba(30,111,224,.06);border-radius:4px}

/* Header on a desktop too narrow for every tab and control on one row (more tabs since 18 October 2026): it grows to two
   rows instead of a fixed 52 px whose second row spilled over the status bar underneath. */
@media (min-width:821px){
  header{height:auto;min-height:52px;padding:6px 16px;row-gap:6px}
  header nav{flex-wrap:wrap;row-gap:4px}
  header .right{flex-wrap:wrap;justify-content:flex-end;row-gap:6px}
}

/* Settings -> Learning agent: a grid of cards, the weather agent's left and the usage agent's right, row by row; one column on a narrow screen */
.agentgrid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:14px;align-items:stretch}
.agentgrid .panel{max-height:none;overflow:visible}
@media (max-width:1100px){.agentgrid{grid-template-columns:minmax(0,1fr)}}
/* Settings > Access: the add-a-place row (block visitors by place) */
.gbadd{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.gbadd select,.gbadd input{max-width:260px}
#gbRules td .btn{padding:3px 9px;font-size:12px}
#gb_block,#gb_allow{width:100%;font-family:ui-monospace,Consolas,monospace;font-size:12.5px}

/* the language switch shows only the other language (24 October 2026) */
button[data-lang].on{display:none!important}
/* thin, rounded scroll bars (24 October 2026) */
@supports (-moz-appearance:none){*{scrollbar-width:thin;scrollbar-color:rgba(128,128,128,.45) transparent}}
::-webkit-scrollbar{width:4px;height:4px;background:transparent}::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:rgba(128,128,128,.45);border-radius:6px}::-webkit-scrollbar-button{display:none;width:0;height:0}

/* ===== Layout pass (the owner, 25 October 2026: "make it look nice and not overlap each other") =====
   Cards never scroll inside themselves (only the stations/registry split lists do, on a desktop), never spill
   past their edge, and every tab is a clean grid of cards: one column on a phone, one or two on a desktop. */
.panel{max-height:none;overflow:visible;min-width:0;overflow-wrap:anywhere}
@media (min-width:901px){.split>.panel{max-height:calc(100vh - 210px);overflow:auto}}
.panel table,.panel pre{overflow-wrap:normal}
.panel h2{line-height:1.3}
.grid2>*,.fld,.fld>*{min-width:0}
.fld input,.fld textarea,.fld select{width:100%;max-width:100%}
.panel>div[style*="overflow"],.panel .tablewrap{max-width:100%}
.btn{white-space:nowrap;line-height:1.3}
.btn.sm{padding:4px 10px;font-size:12px}
/* tables inside a card slide sideways inside the card, never over its neighbour */
.panel table.pdsmall{max-width:100%}
.panel>table,.panel>.pdsmall{display:block;overflow-x:auto}

/* Settings: each pane is a grid of compact cards; a card holding a table spans the full width */
.stpane:not([hidden]){display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,620px),1fr));gap:12px;align-items:start}
.stpane>*{grid-column:1/-1;margin:0!important}
.stpane>.panel{grid-column:auto;max-width:none}
.stpane>.panel.wide,.stpane>.panel.histcov,.stpane>.panel:has(#mdTable,#hsTable,#gcTable,#gfTable,#auditTable,#userTable,#stoTable,#f2bTable),#st-models>.panel{grid-column:1/-1}
#st-backups>.panel{max-width:none}
.stpane .panel{padding:12px 14px}
.stpane .panel>h2{font-size:15px!important;margin:0 0 4px!important}
.stpane .panel>p.muted{margin:0 0 8px!important;line-height:1.45}
.stpane .fld{margin-bottom:6px}
.stpane .actions{margin-top:8px}
.stpane .setrow{padding:8px 10px;margin-bottom:6px}
.agentgrid{gap:12px}

/* Site name and icons: name fields and their Save on one row, each icon's controls on one tidy row */
.brandrow{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;gap:8px 10px;align-items:end}
.brandrow .fld{margin:0}
.brandicons{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));gap:8px 14px;margin-top:10px}
.brandicons .fld{margin:0}
.iconrow{display:flex;gap:8px;align-items:center;min-width:0}
.iconprev{flex:none;width:32px;height:32px;object-fit:contain;border:1px solid var(--line);border-radius:6px;background:#fff}
.iconprev.logo{background:#2a5bb8}
.iconrow input[type=file]{flex:1 1 auto;min-width:0;width:auto!important;font-size:12px;padding:3px 4px!important}
.iconrow input[type=file]::file-selector-button{font:inherit;font-size:12px;padding:2px 8px;margin-right:6px;border:1px solid var(--line);
border-radius:5px;background:var(--card);color:var(--fg);cursor:pointer}
.iconrow .btn{flex:none}
#b_msg:empty{display:none}
@media (max-width:560px){.brandrow{grid-template-columns:1fr}.brandrow .btn{justify-self:start}}

/* Weather models: name on one line, the provider below in small type; "How it works" wraps, the formula wraps */
#mdTable td{vertical-align:top}
#mdTable td.mdname b{display:block;white-space:nowrap}
#mdTable td.mdname small{display:block;color:var(--muted);font-size:11px;line-height:1.35;min-width:160px}
#mdTable .mdhow{min-width:300px}
#mdTable .mdformula{white-space:pre-wrap;overflow-wrap:anywhere;max-width:100%}
@media (max-width:760px){
  #mdTable thead{display:none}
  #mdTable,#mdTable tbody,#mdTable tr,#mdTable td{display:block;width:100%}
  #mdTable tr{border-bottom:1px solid var(--line);padding:8px 0}
  #mdTable td{border:0;padding:3px 10px;text-align:left!important}
  #mdTable td[data-th]::before{content:attr(data-th);display:block;font-size:11px;color:var(--muted)}
  #mdTable td.mdname::before{display:none}
  #mdTable .mdhow{min-width:0}
}

/* phones: single column everywhere, no row of fields wider than the screen */
@media (max-width:700px){
  .grid2{grid-template-columns:minmax(0,1fr)}
  main{padding:10px}
  .panel{padding:12px}
  .toolbar input[type=text],.toolbar input:not([type]),#q{min-width:0;max-width:none;width:100%}
  .oneline select{max-width:100%}
}

/* every table fills its card (the owner, 25 October 2026: "no table narrower than its card") */
.panel table,.panel table.pdsmall{width:100%;max-width:none}
.tscroll{overflow-x:auto;max-width:100%}
td.nw,th.nw,td.when{white-space:nowrap}
.agentgrid>.panel.wide{grid-column:1/-1}
/* Suggestions: Applied and Kept stack full width below 1600 px, side by side only when there is room */
#st-suggest .agentgrid{grid-template-columns:minmax(0,1fr)}
@media (min-width:1600px){#st-suggest .agentgrid{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}}
.sugtable td.agent{white-space:nowrap;width:1%}
.sugtable td.why{font-size:12px}
.sugtable th:nth-child(3){width:35%}
/* "Inputs tested" as small chips on one or two lines */
td.chips{min-width:260px}
td.chips span{display:inline-block;white-space:nowrap;font-size:11.5px;border:1px solid var(--line);border-radius:10px;
padding:0 7px;margin:1px 3px 1px 0;background:var(--row)}
/* station history and audit: summary first, a search always visible, 10 rows at a time */
.hssum{margin:6px 0 8px;font-size:13px}
.hssum:empty{display:none}
.hssrc{margin-bottom:10px}
.hsdetails h3{margin:12px 0 6px!important}
.hsfilter input[type=search],.auditfilter input[type=search],.listbar input[type=search]{flex:1;min-width:180px;max-width:360px;font:inherit;
padding:6px 9px;border:1px solid var(--line);border-radius:6px;background:var(--card);color:var(--fg)}
.auditfilter input[type=date]{font:inherit;font-size:12px;padding:4px 6px;border:1px solid var(--line);border-radius:6px;background:var(--card);color:var(--fg)}
#hsTable th[data-k]{cursor:pointer;user-select:none}
#hsTable th.sorted{color:var(--fg)}
#auditTable tbody tr{cursor:pointer}
#auditTable td.audetail{max-width:0;width:40%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#auditTable tr.open td.audetail{white-space:normal;overflow-wrap:anywhere;font-size:12px}
#auditTable td.autarget{overflow-wrap:anywhere}
.listbar{margin:4px 0 6px}
@media (max-width:700px){.hsfilter input[type=search],.auditfilter input[type=search],.listbar input[type=search]{max-width:none}}
/* Alerts: Data alerts on the left, the two Telegram cards on the right (no empty half page on a wide screen) */
#alertList td:nth-child(2),#alertList td:nth-child(3),#alertList td:nth-child(4){white-space:nowrap}
select{max-width:100%}
@media (max-width:700px){.panel table.pdsmall,.panel table.limits{display:block;overflow-x:auto}}
/* Stations: the list gets ~70 % of a wide screen, the edit panel ~30 % and more once a station is picked;
   each row one or two lines (the owner, 25 October 2026: "make it wider") */
.stsplit{grid-template-columns:minmax(0,7fr) minmax(280px,3fr)}
.stsplit.editing{grid-template-columns:minmax(0,3fr) minmax(400px,2fr)}
@media (max-width:1100px){.stsplit,.stsplit.editing{grid-template-columns:minmax(0,1fr)}}
#stTable td{vertical-align:middle}
#stTable td.stname,#stTable td.stkm,#stTable td.stsrc{white-space:nowrap}
#stTable td.stname{max-width:340px;overflow:hidden;text-overflow:ellipsis}
#stTable td.stkm{max-width:220px;overflow:hidden;text-overflow:ellipsis}
#stTable td.ststate{white-space:nowrap}
#stTable td.stact{width:1%;text-align:right}
.iconbtn{padding:2px 7px!important;font-size:13px;line-height:1.2}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.stsplit.editing #stTable td.stname{max-width:200px}
.stsplit.editing #stTable td.stkm,.stsplit.editing #stTable th:nth-child(3),.stsplit.editing #stTable td.stsrc,.stsplit.editing #stTable th:nth-child(4){display:none}
@media (max-width:700px){#stTable td.stkm,#stTable th:nth-child(3),#stTable td.stsrc,#stTable th:nth-child(4){display:none}
#stTable td.ststate{white-space:normal}#stTable td.stname{white-space:normal;max-width:none}}

/* ===== Organise pass (the owner, 25 October 2026: "move both of this to the right", "make it close to each other",
   "make it look organize"): Settings panes are two independent column stacks (no row gaps beside a long card),
   12 px between every card, 14 px inside, one heading size, one button size per role. ===== */
.stpane:not([hidden]){display:block;columns:2 520px;column-gap:12px}
.stpane>*{break-inside:avoid;margin:0 0 12px!important;width:100%}
.stpane>:not(.panel),.stpane>.panel.wide,.stpane>.panel.histcov,
.stpane>.panel:has(#mdTable,#hsTable,#gcTable,#gfTable,#auditTable,#userTable,#stoTable,#f2bTable){column-span:all}
.agentgrid{display:block;columns:2 520px;column-gap:12px}
.agentgrid>.panel{break-inside:avoid;margin:0 0 12px!important}
.agentgrid>.panel.wide,.agentgrid>.panel[style*="grid-column"]{column-span:all}
#st-suggest .agentgrid{columns:1}
@media (min-width:1600px){#st-suggest .agentgrid{columns:2}}
.panel{padding:14px}
main .panel>h2,main .panel>.vmhead>h2{font-size:15px!important;margin:0 0 4px!important;font-weight:650}
main>section>.panel,main>section>div>.panel,.vgrid{margin-bottom:12px!important}
.vgrid,.split,.sdwrap{gap:12px}
.btn{padding:7px 14px;font-size:13px}
.btn.sm,.btn.iconbtn{padding:3px 9px;font-size:12px}
.fld label,.oneline label{font-size:12px}
th{font-size:12px;font-weight:600;color:var(--muted);background:var(--row)}
