/* Hydro line v2.5: single-screen engineering workspace with Element Library modal & Supply/Return controls. */
:root{--paper:#efeae2;--surface:#f7f4ee;--surface-2:#fffdf8;--ink:#1b2421;--ink-muted:#5c675f;--ink-faint:#8a938c;--border:#d9d3c7;--border-soft:#e7e1d6;--grid:#e4ddd0;--accent:#0f6e6b;--accent-strong:#0a5553;--accent-soft:#e5f3f1;--series-1:#c2410c;--good:#157a45;--good-soft:#e7f6ec;--warning:#b45309;--warn-soft:#fbf0dc;--danger:#9f2d2d;--danger-soft:#fdecec;--shadow:0 1px 2px #2820140d,0 10px 28px #2820140f;--sans:"Segoe UI","Noto Sans","Liberation Sans","DejaVu Sans",system-ui,sans-serif;--mono:"DejaVu Sans Mono","Liberation Mono",ui-monospace,monospace;color-scheme:light}
:root[data-theme=dark]{--paper:#12161c;--surface:#1a2028;--surface-2:#222a33;--ink:#e7e4dc;--ink-muted:#a8b0a8;--ink-faint:#7d867f;--border:#313a44;--border-soft:#283038;--grid:#2a333c;--accent:#3dbeb6;--accent-strong:#8ed9d2;--accent-soft:#163431;--series-1:#e08a62;--good:#7dcea5;--good-soft:#163228;--warning:#e0a15a;--warn-soft:#33270f;--danger:#f0a0a0;--danger-soft:#3a1e1e;--shadow:0 1px 2px #0000004d,0 12px 32px #00000047;color-scheme:dark}
*,:after,:before{box-sizing:border-box;margin:0;padding:0}
html,body,#root{height:100%}
body{overflow:hidden;background:var(--paper);color:var(--ink);font-family:var(--sans);font-size:13.5px;line-height:1.45;-webkit-tap-highlight-color:transparent}
button,input,select{font:inherit;color:inherit}
button{cursor:pointer}
input[type=text],input[type=number],select{background:var(--surface-2);border:1px solid var(--border);border-radius:7px;padding:5px 8px;min-height:30px;min-width:0;width:100%}
input:focus-visible,select:focus-visible,button:focus-visible,summary:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
input[type=checkbox]{width:17px;height:17px;accent-color:var(--accent)}
.btn{border:1px solid var(--border);background:var(--surface-2);border-radius:8px;padding:0 10px;height:30px;font-size:13px;font-weight:600;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.btn:hover:not(:disabled){border-color:var(--accent);color:var(--accent-strong)}
.btn.primary{background:var(--accent);border-color:var(--accent);color:#f4fffe}
:root[data-theme=dark] .btn.primary{color:#06211f}
.btn.primary:hover:not(:disabled){color:#fff;filter:brightness(1.08)}
.btn.danger{border-color:var(--border);color:var(--danger)}
.btn:disabled{opacity:.45;cursor:default}
.btn.hx-ico{width:30px;padding:0;justify-content:center;font-size:15px}
.seg{background:var(--surface);border:1px solid var(--border);border-radius:8px;padding:2px;display:flex;gap:2px;margin:2px 6px 6px}
.seg button{flex:1;color:var(--ink-muted);background:0 0;border:0;border-radius:6px;padding:4px 9px;font-size:12.5px;font-weight:600}
.seg button[aria-pressed=true]{background:var(--accent);color:#f7fffe}
.hx-pseg{margin:0;height:30px;align-items:center}
.hx-pseg button{padding:2px 8px;font-size:11.5px;white-space:nowrap}
.card{background:var(--surface-2);border:1px solid var(--border);border-radius:10px;padding:10px 12px;margin-bottom:10px}
.card h2{letter-spacing:.08em;text-transform:uppercase;color:var(--ink-muted);margin-bottom:8px;font-size:11px;font-weight:700}

.hx-app{height:100%;display:grid;position:relative;overflow:hidden;grid-template-columns:296px minmax(0,1fr) 342px;grid-template-rows:auto auto minmax(0,1fr);grid-template-areas:"top top top" "kpi kpi kpi" "tree stage insp"}
.hx-grow{flex:1 1 0;min-width:0}
.hx-top{grid-area:top;display:flex;align-items:center;gap:8px;padding:6px 10px;padding-top:calc(6px + env(safe-area-inset-top));background:var(--surface);border-bottom:1px solid var(--border);min-width:0;flex-wrap:wrap}
.hx-brand{font-weight:700;letter-spacing:-.01em;white-space:nowrap;display:inline-flex;align-items:center;gap:7px;font-size:14px}
.hx-brand i{width:16px;height:16px;border-radius:5px 5px 9px 9px;background:var(--accent);display:inline-block}
.hx-fname{font-weight:600;width:22ch!important;border-color:transparent!important;background:0 0!important}
.hx-fname:hover,.hx-fname:focus{border-color:var(--border)!important;background:var(--surface-2)!important}
.hx-dirty{color:var(--series-1);font-size:10px}
.hx-toast{font-size:12px;color:var(--accent-strong);background:var(--accent-soft);border-radius:999px;padding:3px 11px;max-width:46ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hx-menu{position:relative}
.hx-menu>summary{list-style:none;cursor:pointer}
.hx-menu>summary::-webkit-details-marker{display:none}
.hx-pop{position:absolute;z-index:40;top:calc(100% + 4px);left:0;min-width:250px;background:var(--surface-2);border:1px solid var(--border);border-radius:10px;box-shadow:var(--shadow);padding:6px;display:flex;flex-direction:column;gap:2px}
.hx-pop.r{left:auto;right:0}
.hx-pop>button{border:0;background:none;text-align:left;padding:6px 9px;border-radius:7px;display:flex;align-items:center;gap:8px;font-weight:500;width:100%}
.hx-pop>button:hover{background:var(--accent-soft)}
.hx-pop kbd{margin-left:auto;font:11px var(--mono);color:var(--ink-faint)}
.hx-pop hr{border:0;border-top:1px solid var(--border-soft);margin:4px 0}
.hx-poph{font-size:10.5px;letter-spacing:.08em;text-transform:uppercase;color:var(--ink-faint);padding:4px 9px 2px;font-weight:700}
.hx-popr{display:flex;gap:6px;padding:2px 6px 6px}

.hx-kpi{grid-area:kpi;display:flex;align-items:stretch;background:var(--surface-2);border-bottom:1px solid var(--border);min-width:0}
.hx-stats{display:flex;overflow-x:auto;flex:1 1 0;min-width:0;scrollbar-width:thin}
.stat{border-right:1px solid var(--border-soft);padding:4px 12px;flex:none;display:flex;flex-direction:column;justify-content:center}
.stat .k{letter-spacing:.06em;text-transform:uppercase;color:var(--ink-faint);font-size:10px;font-weight:700;white-space:nowrap}
.stat .v{font-family:var(--mono);font-variant-numeric:tabular-nums;letter-spacing:-.02em;font-size:14px;white-space:nowrap}
.stat .v small{font-family:var(--sans);font-size:11px;color:var(--ink-muted);letter-spacing:0}
.hx-chkbtn{border:0;border-left:1px solid var(--border);background:var(--good-soft);color:var(--good);font-weight:700;padding:0 14px;white-space:nowrap;flex:none}
.hx-chkbtn.warn{background:var(--warn-soft);color:var(--warning)}
.hx-chkbtn.red{background:var(--danger-soft);color:var(--danger)}

.hx-tree{grid-area:tree;background:var(--surface);border-right:1px solid var(--border);overflow:auto;padding:10px;min-width:0}
.hx-sys{border:1px solid transparent;border-radius:8px;margin-bottom:4px}
.hx-sys.on{border-color:var(--accent);background:var(--accent-soft)}
.hx-sysmain{display:grid;grid-template-columns:12px minmax(0,1fr);column-gap:8px;align-items:center;width:100%;text-align:left;border:0;background:none;padding:6px 8px}
.hx-sysmain b,.hx-sysmain input{grid-column:2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:700}
.hx-sysmain span{grid-column:2;font-size:11.5px;color:var(--ink-muted)}
.hx-sysact{display:flex;gap:4px;padding:0 8px 8px 28px}
.hx-sysact .btn{height:26px;font-size:12px;padding:0 8px}
.hx-dot{width:10px;height:10px;border-radius:50%;display:inline-block;flex:none}
.hx-lv{width:100%;border-collapse:collapse;margin-bottom:6px}
.hx-lv td{padding:2px 3px 2px 0;font-size:12px;color:var(--ink-muted)}
.hx-note{font-size:11.5px;color:var(--ink-muted);margin:6px 0 2px}
.hx-chk{font-size:10px;font-weight:700;color:var(--warning);background:var(--warn-soft);border-radius:4px;padding:0 5px;text-transform:uppercase;letter-spacing:.04em}
.hx-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,148px);gap:8px;align-items:center;padding:3px 0}
.hx-rl{font-size:12.5px;color:var(--ink-muted)}
.hx-rl i{font-style:normal;color:var(--ink-faint);cursor:help}
.hx-rc{display:flex;align-items:center;gap:6px;justify-content:flex-end;min-width:0}
.hx-rc em{font-style:normal;font-size:11.5px;color:var(--ink-faint);flex:none;min-width:36px}
.hx-lock{display:inline-flex;align-items:center;gap:4px;font-size:12px;color:var(--ink-muted);flex:none;cursor:pointer}
.hx-num{text-align:right;font-family:var(--mono)}

.hx-stage{grid-area:stage;display:grid;grid-template-rows:auto minmax(0,1fr) auto;min-width:0;min-height:0}
.hx-ctb{display:flex;flex-wrap:wrap;align-items:center;gap:5px;padding:6px 10px;background:var(--surface);border-bottom:1px solid var(--border);min-width:0}
.hx-sep{width:1px;height:20px;background:var(--border)}
.hx-hint{font-size:12px;color:var(--ink-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hx-svgwrap{min-width:0;min-height:0;overflow:hidden;position:relative;background:var(--surface-2);touch-action:none;cursor:grab}
.hx-svg{display:block;user-select:none}
.hx-lab text{paint-order:stroke;stroke:var(--surface-2);stroke-width:3.5px;stroke-linejoin:round;font-family:var(--sans)}
.hx-zoom{position:absolute;right:10px;bottom:10px;display:flex;gap:4px}
.hx-cleg{position:absolute;left:10px;bottom:10px;background:var(--surface);border:1px solid var(--border);border-radius:8px;padding:5px 10px;display:flex;gap:10px;flex-wrap:wrap;font-size:11.5px;color:var(--ink-muted);box-shadow:var(--shadow)}
.hx-cleg i{display:inline-block;width:11px;height:11px;border-radius:3px;margin-right:5px;vertical-align:-1px}
.hx-dock{border-top:1px solid var(--border);background:var(--surface);display:grid;grid-template-rows:auto minmax(0,1fr);min-width:0;max-height:44vh}
.hx-app[data-dock="1"] .hx-dock{height:35vh;min-height:170px}
.hx-tabs{display:flex;gap:2px;align-items:flex-end;padding:0 8px;border-bottom:1px solid var(--border);overflow-x:auto;scrollbar-width:none}
.hx-tabs button[role=tab]{border:0;background:none;padding:8px 10px 7px;font-weight:600;color:var(--ink-muted);border-bottom:2px solid transparent;white-space:nowrap;font-size:13px}
.hx-tabs button[aria-selected=true]{color:var(--accent-strong);border-bottom-color:var(--accent)}
.hx-fold{border:0;background:none;color:var(--ink-muted);padding:6px 8px;font-size:14px}
.hx-pane{overflow:auto;padding:0 12px 10px;min-width:0;min-height:0}
.hx-tbar{display:flex;align-items:center;gap:10px;padding:7px 0 4px;flex-wrap:wrap}
.hx-filter{max-width:240px!important;height:28px;font-size:12.5px}
.hx-grid3{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:10px;padding-top:8px}
.sheet{border-collapse:collapse;text-align:right;width:100%;font-size:12.5px}
.sheet th{letter-spacing:.03em;text-transform:uppercase;color:var(--ink-faint);padding:7px 6px 5px;font-size:10.5px;font-weight:700;position:sticky;top:0;background:var(--surface);z-index:1;white-space:nowrap}
.sheet td{border-top:1px solid var(--border-soft);font-family:var(--mono);font-variant-numeric:tabular-nums;padding:4px 6px;white-space:nowrap}
.sheet th:nth-child(-n+2),.sheet td:nth-child(-n+2){text-align:left}
.sheet tr{cursor:pointer}
.sheet .name{font-family:var(--sans);font-weight:650}
.sheet tr.crit td.name{color:var(--series-1)}
.sheet tr.on td{background:var(--accent-soft)}
.sheet td.bad{color:var(--danger);font-weight:700}
.hx-empty{color:var(--ink-muted);padding:14px 4px}
.hx-ok{color:var(--good);font-weight:700;padding:14px 4px}
.hx-warn{list-style:none;padding:8px 0}
.hx-warn li{padding:6px 10px;border-left:3px solid var(--warning);background:var(--warn-soft);border-radius:0 7px 7px 0;margin-bottom:5px;cursor:pointer}
.hx-warn li.red{border-color:var(--danger);background:var(--danger-soft)}
.hx-chart{padding-top:8px}
.hx-leg{display:flex;gap:16px;flex-wrap:wrap;font-size:12px;color:var(--ink-muted);padding:2px 0 0 52px}
.hx-leg i{display:inline-block;width:14px;height:3px;border-radius:2px;margin-right:6px;vertical-align:middle}

.hx-insp{grid-area:insp;background:var(--surface);border-left:1px solid var(--border);display:grid;grid-template-rows:auto minmax(0,1fr);min-width:0;min-height:0}
.hx-ih{padding:8px 12px 4px;display:flex;flex-direction:column}
.hx-ih b{font-size:14px}
.hx-ih span{font-size:12px;color:var(--ink-muted)}
.hx-ib{overflow:auto;padding:6px 10px 16px;min-height:0}
.hx-kv{width:100%;border-collapse:collapse;font-size:12.5px;margin-top:6px}
.hx-kv th{text-align:left;font-weight:500;color:var(--ink-muted);padding:3px 0}
.hx-kv td{text-align:right;font-family:var(--mono);font-variant-numeric:tabular-nums;padding:3px 6px}
.hx-kv td.u{text-align:left;color:var(--ink-faint);font-family:var(--sans);font-size:11.5px;width:50px;padding-right:0}
.hx-kv tr+tr th,.hx-kv tr+tr td{border-top:1px solid var(--border-soft)}
.hx-kv tr.hot td:nth-child(2){color:var(--series-1);font-weight:700}

/* Element Library Modal */
.hx-modal{position:fixed;inset:0;z-index:60;background:#0006;display:grid;place-items:center;padding:16px}
.hx-dialog{background:var(--surface);border:1px solid var(--border);border-radius:14px;box-shadow:var(--shadow);width:min(460px,100%);max-height:92vh;overflow:auto;padding:16px 18px}
.hx-libdlg{width:min(880px,96vw);display:flex;flex-direction:column;max-height:86vh}
.hx-libtabs{display:flex;gap:4px;flex-wrap:wrap;margin-bottom:10px;border-bottom:1px solid var(--border);padding-bottom:8px}
.hx-libtabs button{border:1px solid var(--border);background:var(--surface-2);border-radius:999px;padding:4px 11px;font-size:12px;font-weight:600;color:var(--ink-muted)}
.hx-libtabs button.on{background:var(--accent);border-color:var(--accent);color:#fff}
.hx-libgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(235px,1fr));gap:8px;overflow:auto;padding-right:2px}
.hx-libcard{border:1px solid var(--border);background:var(--surface-2);border-radius:10px;padding:9px 11px;display:flex;align-items:center;gap:10px;text-align:left;transition:border-color .12s,background .12s}
.hx-libcard:hover{border-color:var(--accent);background:var(--accent-soft)}
.hx-libico{width:34px;height:34px;border-radius:8px;background:var(--surface);border:1px solid var(--border-soft);display:inline-flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;color:var(--accent-strong);flex:none}
.hx-libtxt{display:flex;flex-direction:column;min-width:0}
.hx-libtxt b{font-size:12.8px;line-height:1.25;color:var(--ink)}
.hx-libtxt small{font-size:11px;color:var(--ink-muted);margin-top:2px}
.hx-dialog h3{font-size:16px;font-weight:700;margin-bottom:6px}
.hx-dlgact{display:flex;justify-content:flex-end;gap:8px;margin-top:14px}

@media (max-width:1180px){.hx-app{grid-template-columns:262px minmax(0,1fr) 304px}}
.hx-addl{font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--ink-faint);font-weight:700}
.sheet tr.el td{color:var(--ink-muted)}
.sheet td.what{font-family:var(--sans);text-align:left;font-size:12px;max-width:220px;overflow:hidden;text-overflow:ellipsis}
.sheet th:last-child{text-align:left}
.hx-ctb .hx-pop{max-height:62vh;overflow:auto}

/* ---------------- phone */
.hx-app.ph{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr) auto;grid-template-areas:"top" "kpi" "main" "nav"}
.ph .hx-top{flex-wrap:nowrap;gap:6px;padding-left:10px;padding-right:0}
.ph .btn,.ph input[type=text],.ph input[type=number],.ph select{min-height:40px;font-size:15px}
.ph .btn{height:40px;padding:0 12px}.ph .btn.hx-ico{width:40px;padding:0;font-size:18px}
.ph input[type=checkbox]{width:22px;height:22px}
.hx-dot.big{width:12px;height:12px}
.hx-syssel{width:auto!important;max-width:38vw;font-weight:700;border-color:transparent!important;background:0 0!important;padding-left:2px!important}
.ph .hx-chkbtn{align-self:stretch;margin:-6px 0;padding:0 14px;border-left:1px solid var(--border);font-size:15px;min-width:48px}
.ph .stat{padding:5px 12px}.ph .stat .v{font-size:15px}
.hx-main{grid-area:main;min-height:0;min-width:0;position:relative;display:grid}
.hx-dia{position:relative;display:grid;grid-template-rows:minmax(0,1fr) auto;min-height:0}
.hx-dia .hx-svgwrap{grid-row:1}
.hx-dia .hx-zoom{right:10px;top:10px;bottom:auto;flex-direction:column}
.hx-fab{position:absolute;right:16px;bottom:16px;width:58px;height:58px;border-radius:50%;border:0;background:var(--accent);color:#fff;font-size:32px;line-height:1;box-shadow:0 6px 18px #0005;z-index:5}
:root[data-theme=dark] .hx-fab{color:#06211f}
.hx-sheet{grid-row:2;background:var(--surface);border-top:1px solid var(--border);box-shadow:0 -8px 24px #0002;display:grid;grid-template-rows:auto auto minmax(0,1fr);min-height:0;border-radius:14px 14px 0 0;margin-top:-12px;position:relative;z-index:6}
.hx-sheet.full{height:62vh}
.hx-sh{display:flex;align-items:center;gap:8px;padding:6px 8px 4px 12px;position:relative}
.hx-grab{position:absolute;left:50%;top:0;transform:translateX(-50%);border:0;background:none;padding:5px 30px 8px}
.hx-grab i{display:block;width:38px;height:4px;border-radius:2px;background:var(--border)}
.hx-st{flex:1;min-width:0;display:flex;flex-direction:column;padding-top:8px}
.hx-st b{font-size:15.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hx-st span{font-size:12.5px;color:var(--ink-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hx-sa{display:flex;gap:6px;padding:4px 10px 10px;overflow-x:auto;scrollbar-width:none}
.hx-sa .btn{flex:none}
.hx-sb{overflow:auto;padding:4px 10px 18px;min-height:0;overscroll-behavior:contain}
.hx-res{display:grid;grid-template-rows:auto minmax(0,1fr);min-height:0;background:var(--surface)}
.ph .hx-tabs button[role=tab]{padding:12px 12px 10px;font-size:14.5px}
.ph .sheet{font-size:13.5px}.ph .sheet td{padding:9px 7px}
.ph .sheet td:first-child,.ph .sheet th:first-child{position:sticky;left:0;background:var(--surface);z-index:2;box-shadow:1px 0 0 var(--border-soft)}
.ph .sheet tr.on td:first-child{background:var(--accent-soft)}
.hx-scroll{overflow:auto;padding:10px;min-height:0;background:var(--surface)}
.ph .hx-row{grid-template-columns:minmax(0,1fr) minmax(0,172px);padding:4px 0}
.ph .hx-rl{font-size:14px}
.ph .card{padding:12px}
.hx-list{display:flex;flex-direction:column;gap:6px;margin-top:8px}
.hx-list button{border:1px solid var(--border);background:var(--surface);border-radius:9px;padding:12px;text-align:left;font-weight:600;font-size:14.5px}
.hx-nav{grid-area:nav;display:flex;background:var(--surface);border-top:1px solid var(--border);padding-bottom:env(safe-area-inset-bottom)}
.hx-nav button{flex:1;border:0;background:none;padding:7px 2px 8px;font-weight:650;font-size:12px;color:var(--ink-muted);display:flex;flex-direction:column;align-items:center;gap:1px;border-top:2px solid transparent}
.hx-nav button i{font-style:normal;font-size:18px;line-height:1.1}
.hx-nav button[aria-pressed=true]{color:var(--accent-strong);border-top-color:var(--accent)}
.ph .hx-toast{position:fixed;left:10px;right:10px;bottom:74px;z-index:70;max-width:none;white-space:normal;text-align:center;padding:9px 12px;border-radius:10px;box-shadow:var(--shadow);font-size:13.5px}

/* ---------------- Standards & Theory Reference Modal (v2.6) */
.hx-stddlg{width:min(980px,96vw);display:flex;flex-direction:column;max-height:88vh}
.hx-stdbody{overflow:auto;padding-right:4px;display:flex;flex-direction:column;gap:10px;font-size:12.8px;line-height:1.5}
.hx-stdsec{border:1px solid var(--border);background:var(--surface-2);border-radius:10px;padding:11px 14px}
.hx-stdsec h4{margin:0 0 6px;font-size:13.5px;color:var(--accent-strong)}
.hx-stdsec ul{margin:4px 0 0 18px;padding:0;display:flex;flex-direction:column;gap:3px}
.hx-stdsec a{color:var(--accent-strong);text-decoration:underline;font-weight:600}
.hx-fml{font-family:var(--mono);font-size:12px;background:var(--surface);border:1px solid var(--border-soft);border-radius:6px;padding:5px 9px;margin:4px 0;color:var(--ink)}
