/* 2P BIOHERBS — pixel-art farm office theme: charcoal / emerald, green-purple glow, gold trim */
:root {
  --bg: #08120e; --bg2: #0c1914; --panel: #0f1e18; --panel2: #13271f; --panel3: #183126;
  --line: #24483a; --line2: #2f5e4b;
  --gold: #c9a04a; --gold2: #f0cf7a; --gold-dim: #7d6330;
  --em: #19b36b; --em2: #33e08b; --glow: #45ffa2; --purple: #a35cff; --purple2: #c89bff;
  --text: #e8f3ea; --muted: #97b0a2; --dim: #6f897b;
  --ok: #3ddc84; --warn: #ffc65c; --bad: #ff6f6f; --info: #72bbff; --demo: #c89bff;
  --px: 3px; --r: 2px;
  --font: "Noto Sans Thai", "Sarabun", "Leelawadee UI", "Thonburi", "Tahoma", system-ui, sans-serif;
  --mono: "JetBrains Mono", "DejaVu Sans Mono", ui-monospace, "Consolas", monospace;
  --shadow: 4px 4px 0 #020604;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; font: 15px/1.6 var(--font); color: var(--text); background-color: var(--bg);
  background-image: radial-gradient(ellipse at 20% -10%, rgba(163, 92, 255, .14), transparent 55%), radial-gradient(ellipse at 90% 0%, rgba(25, 179, 107, .16), transparent 50%),
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: auto, auto, 24px 24px, 24px 24px; background-attachment: fixed; }
body.modal-open { overflow: hidden; }
a { color: var(--em2); }
a:hover { color: var(--glow); }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .5em; }
h1 { font-size: clamp(22px, 3vw, 30px); color: var(--gold2); letter-spacing: .01em; text-shadow: 2px 2px 0 #000; }
h2 { font-size: 18px; color: var(--gold2); }
h3 { font-size: 15.5px; color: var(--text); margin-top: 1.2em; }
p { margin: .4em 0; overflow-wrap: anywhere; }
code, .mono { font-family: var(--mono); font-size: .92em; }
code { background: #04100b; border: 1px solid var(--line); padding: 1px 5px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #050e0a; border: 1px solid var(--line); padding: 10px; max-height: 320px; overflow: auto; }
.pre { white-space: pre-wrap; }
.small { font-size: 13px; } .muted { color: var(--muted); } .big { font-size: 22px; }
.bad-text { color: var(--bad); } .warn-text { color: var(--warn); }
.nodata { color: var(--dim); font-style: italic; font-size: .92em; }
:focus-visible { outline: 3px solid var(--purple2); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; z-index: 99; background: var(--gold); color: #000; padding: 8px 12px; }
.skip:focus { left: 8px; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--gold2); font-size: 18px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 18px; padding: 8px 18px;
  background: linear-gradient(#0b1813, #081310); border-bottom: 3px solid var(--gold-dim); box-shadow: 0 3px 0 #020604, 0 6px 24px rgba(163, 92, 255, .12); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--gold2); }
.brand img { display: block; height: 36px; width: auto; }
.brand b { display: block; font-size: 17px; letter-spacing: .08em; line-height: 1.1; text-shadow: 2px 2px 0 #000; }
.brand small { color: var(--muted); letter-spacing: .3em; font-size: 10px; }
.topnav { display: flex; gap: 4px; }
.topnav a { color: var(--text); text-decoration: none; padding: 8px 12px; border: 2px solid transparent; font-size: 14px; white-space: nowrap; }
.topnav a:hover { border-color: var(--line2); background: var(--panel2); }
.topnav a.on { border-color: var(--gold); background: var(--panel3); color: var(--gold2); box-shadow: inset 0 -3px 0 var(--em); }
.count { display: inline-block; min-width: 20px; padding: 0 5px; background: var(--warn); color: #000; font-size: 12px; text-align: center; line-height: 18px; }
.count.crit { background: var(--bad); }
.top-search { margin-left: auto; }
.top-search input { width: 220px; }
.usermenu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; background: none; border: 2px solid var(--line2); color: var(--text); padding: 4px 10px 4px 4px; cursor: pointer; font: inherit; min-height: 40px; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; background: var(--em); color: #021; font-weight: 700; }
.um-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--panel); border: 2px solid var(--gold); box-shadow: var(--shadow); padding: 10px; z-index: 40; }
.um-pop a, .um-pop button { display: block; width: 100%; text-align: left; padding: 9px 8px; color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; min-height: 40px; }
.um-pop a:hover, .um-pop button:hover { background: var(--panel3); }
.demo-banner { background: repeating-linear-gradient(45deg, #2b1846, #2b1846 12px, #24133b 12px, #24133b 24px); color: var(--purple2); text-align: center; padding: 7px 14px;
  border-bottom: 2px solid var(--purple); font-size: 13.5px; }
main { padding: 22px clamp(12px, 3vw, 34px) 110px; max-width: 1720px; margin: 0 auto; outline: none; }
.bottomnav { display: none; }

/* ---------- controls ---------- */
input, select, textarea { font: inherit; color: var(--text); background: #06110d; border: 2px solid var(--line2); padding: 9px 10px; min-height: 44px; max-width: 100%; border-radius: 0; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--em2); outline: none; box-shadow: 0 0 0 2px rgba(69, 255, 162, .25); }
input[type=checkbox] { min-height: 0; width: 20px; height: 20px; accent-color: var(--em); }
select { cursor: pointer; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 14.5px; cursor: pointer; text-decoration: none;
  color: var(--text); background: var(--panel3); border: 2px solid var(--line2); padding: 9px 16px; min-height: 44px; box-shadow: 3px 3px 0 #020604; white-space: nowrap; }
.btn:hover { border-color: var(--em2); color: var(--glow); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #020604; }
.btn.primary { background: linear-gradient(#1aa864, #12804b); border-color: var(--gold); color: #fff; text-shadow: 1px 1px 0 #053; }
.btn.primary:hover { color: #fff; filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.danger { background: #5b1b1b; border-color: var(--bad); }
.btn.small { min-height: 36px; padding: 5px 11px; font-size: 13.5px; }
.btn.full { width: 100%; }
.btn[disabled] { opacity: .65; cursor: progress; }
.spin { width: 14px; height: 14px; border: 3px solid rgba(255,255,255,.3); border-top-color: #fff; display: inline-block; animation: spin .8s steps(8) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { background: none; border: 2px solid var(--line2); color: var(--text); min-width: 40px; min-height: 40px; cursor: pointer; font-size: 16px; }
.seg { display: inline-flex; border: 2px solid var(--gold-dim); box-shadow: 3px 3px 0 #020604; }
.seg-btn { font: inherit; background: var(--panel); color: var(--muted); border: 0; padding: 8px 14px; min-height: 42px; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 2px solid var(--gold-dim); }
.seg-btn.on { background: var(--panel3); color: var(--gold2); box-shadow: inset 0 -3px 0 var(--em); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; font-size: 12.5px; line-height: 20px; border: 1px solid var(--line2); background: #0a1712; color: var(--text); white-space: nowrap; }
.badge.live { border-color: var(--ok); color: var(--ok); } .badge.warn { border-color: var(--warn); color: var(--warn); }
.badge.bad { border-color: var(--bad); color: var(--bad); } .badge.info { border-color: var(--info); color: var(--info); }
.badge.muted { color: var(--dim); } .badge.demo { border-color: var(--purple); color: var(--purple2); background: #1b0f2d; }
.badge.gold { border-color: var(--gold); color: var(--gold2); }
.dot { width: 8px; height: 8px; background: var(--ok); display: inline-block; box-shadow: 0 0 6px var(--ok); animation: blink 1.6s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; border: 2px solid var(--line2); background: var(--panel); text-decoration: none; color: var(--text); font-size: 13.5px; }
.chip.link:hover, .chip.on { border-color: var(--gold); color: var(--gold2); }

/* ---------- layout pieces ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head p { margin: 2px 0; }
.back { display: inline-block; margin-bottom: 4px; font-size: 14px; }
.card, .panel-body > .card { background: var(--panel); border: 2px solid var(--line2); box-shadow: var(--shadow); padding: 16px; margin: 0 0 16px; position: relative; }
.card > header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.card > header h2 { margin: 0; }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.two-col { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; align-items: start; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.toolbar .search { flex: 1 1 220px; min-width: 0; }
.toolbar .search.big { font-size: 17px; }
.grow { flex: 1 1 auto; }
.note { color: var(--muted); font-size: 13.5px; border-left: 3px solid var(--gold-dim); padding: 4px 10px; margin: 8px 0 12px; background: rgba(201,160,74,.05); }
ul.note { padding-left: 28px; }
.meta-line { color: var(--dim); font-size: 12.5px; margin-top: 8px; }
.empty { padding: 26px; text-align: center; border: 2px dashed var(--line); color: var(--muted); }
.empty.small { padding: 14px; }
.error-box { padding: 14px; border: 2px solid var(--bad); background: #2a0f0f; color: #ffd0d0; }
.loading-row { padding: 18px; color: var(--muted); }
.loading-row::before { content: "▮▮▮ "; color: var(--em); animation: blink 1s steps(2) infinite; }
.flags { border: 2px solid var(--warn); background: rgba(255, 198, 92, .07); padding: 10px 14px; margin: 10px 0 16px; }
.flags ul { margin: 4px 0 0; padding-left: 20px; }
details summary { cursor: pointer; color: var(--gold2); }
details.rules { margin: 14px 0; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 16px; border-bottom: 2px solid var(--line); padding-bottom: 8px; }
.pill { font: inherit; background: var(--panel); color: var(--muted); border: 2px solid var(--line2); padding: 7px 14px; min-height: 42px; cursor: pointer; }
.pill.on { color: var(--gold2); border-color: var(--gold); background: var(--panel3); box-shadow: 3px 3px 0 #020604; }
.sub-pills .pill { min-height: 38px; padding: 5px 12px; font-size: 14px; }
.sub-pills { border-bottom: 0; }

/* ---------- tiles ---------- */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin: 8px 0 14px; }
.tile { display: block; background: linear-gradient(var(--panel2), var(--panel)); border: 2px solid var(--line2); padding: 12px 14px; text-decoration: none; color: var(--text); box-shadow: 3px 3px 0 #020604; position: relative; }
a.tile:hover { border-color: var(--gold); }
.tile::before { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 3px; background: var(--em); opacity: .6; }
.tile.bad::before { background: var(--bad); opacity: 1; } .tile.warn::before { background: var(--warn); opacity: 1; } .tile.ok::before { background: var(--ok); }
.tile-label { font-size: 13px; color: var(--muted); }
.tile-value { margin: 4px 0; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.tile-value .v { font-family: var(--mono); font-size: 25px; font-weight: 700; color: var(--gold2); }
.tile-value .v.small { font-size: 15px; }
.tile-value .u { color: var(--muted); font-size: 13px; }
.tile-sub { font-size: 12.5px; color: var(--warn); }
.tile-src { font-size: 11.5px; color: var(--dim); line-height: 1.4; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 2px solid var(--line); background: var(--bg2); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 9px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { background: #0b1a14; color: var(--gold2); font-weight: 600; position: sticky; top: 0; white-space: nowrap; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td, .tbl tr.clickable:focus td { background: var(--panel2); }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.tbl td.c { text-align: center; }
.mini { border-collapse: collapse; font-size: 12.5px; width: 100%; margin-top: 6px; }
.mini td, .mini th { border: 1px solid var(--line); padding: 3px 6px; overflow-wrap: anywhere; }
.ok-mark { color: var(--ok); font-weight: 700; }
.matrix .tbl th { font-size: 12.5px; }

/* ---------- detail & forms ---------- */
.detail { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 18px; margin: 0 0 12px; }
.detail div { border-bottom: 1px dashed var(--line); padding: 4px 0; }
.detail dt { font-size: 12.5px; color: var(--muted); }
.detail dd { margin: 0; overflow-wrap: anywhere; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.sub { border-top: 2px solid var(--line); margin-top: 14px; padding-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid.compact { gap: 8px 12px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > span, .field legend { font-size: 13.5px; color: var(--muted); }
.field.full, .form-grid > .note.full, .form-grid > .full { grid-column: 1 / -1; }
.field.check, .check { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; color: var(--text); }
.field textarea { grid-column: 1 / -1; }
.form-grid > label.field:has(textarea) { grid-column: 1 / -1; }
.req { color: var(--bad); margin-left: 2px; }
.help { color: var(--dim); font-size: 12px; }
.form-error { grid-column: 1 / -1; padding: 9px 12px; border: 2px solid var(--bad); background: #2a0f0f; color: #ffd0d0; }
.form-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.intro { color: var(--muted); font-size: 13.5px; margin-bottom: 12px; border-left: 3px solid var(--em); padding-left: 10px; }
.inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.inline input { width: 160px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.line-row { display: grid; grid-template-columns: 2fr 1.4fr 1fr 1fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.line-row.recv { grid-template-columns: 2fr 1fr 1.2fr; }
.rule-row { border-bottom: 1px dashed var(--line); padding: 8px 0; }
.upload-btn { cursor: pointer; }
.files { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-direction: column; gap: 6px; }
.files li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.files img { width: 64px; height: 64px; object-fit: cover; border: 2px solid var(--line2); image-rendering: auto; }
.file-ico { font-size: 22px; }
.upload-status { font-size: 13px; color: var(--muted); }
.timeline { list-style: none; padding: 0; margin: 6px 0; }
.timeline li { display: grid; grid-template-columns: 140px 1fr; gap: 10px; border-left: 3px solid var(--line2); padding: 6px 0 6px 12px; font-size: 13.5px; }
.timeline time { color: var(--dim); font-size: 12.5px; }
.comments { list-style: none; padding: 0; } .comments li { border-left: 3px solid var(--em); padding: 4px 10px; margin-bottom: 8px; }
.comment-form { display: flex; gap: 8px; } .comment-form textarea { flex: 1; min-height: 44px; }

/* ---------- tasks ---------- */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task { background: var(--panel); border: 2px solid var(--line2); padding: 10px 12px; cursor: pointer; box-shadow: 3px 3px 0 #020604; }
.task:hover, .task:focus { border-color: var(--em2); }
.task.overdue { border-left: 6px solid var(--bad); }
.task-meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; margin-top: 4px; }
.task-title { font-size: 18px; }

/* ---------- modal & toasts ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(2, 8, 5, .72); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 14px; overflow-y: auto; }
.modal { background: var(--panel); border: 3px solid var(--gold); box-shadow: 6px 6px 0 #000, 0 0 40px rgba(163, 92, 255, .18); width: min(640px, 100%); }
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--panel3); border-bottom: 2px solid var(--gold-dim); position: sticky; top: 0; z-index: 2; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 16px; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: 11px 14px; background: var(--panel3); border: 2px solid var(--ok); box-shadow: var(--shadow); font-size: 14px; transition: opacity .3s; }
.toast-err { border-color: var(--bad); background: #2a1010; }
.toast.out { opacity: 0; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(520px, 100%); background: var(--panel); border: 3px solid var(--gold); box-shadow: 6px 6px 0 #000, 0 0 60px rgba(25, 179, 107, .15); padding: 24px; }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 2px solid var(--line); }
.auth-brand img { height: 72px; width: auto; }
.auth-brand b { display: block; font-size: 22px; letter-spacing: .1em; color: var(--gold2); text-shadow: 2px 2px 0 #000; }
.auth-brand span { color: var(--muted); font-size: 12px; letter-spacing: .12em; }
.auth .form-grid { grid-template-columns: 1fr 1fr; }

/* ---------- office (list view) ---------- */
.group-label { display: flex; align-items: center; gap: 12px; font-size: 14px; letter-spacing: .12em; color: var(--gold2); margin: 18px 0 10px; }
.group-label span { border: 2px solid var(--gold); padding: 3px 14px; background: var(--panel); box-shadow: 0 0 12px rgba(69, 255, 162, .2); }
.group-label::after { content: ""; flex: 1; height: 2px; background: linear-gradient(90deg, var(--em), transparent); }
.desk-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.desk-card { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; background: linear-gradient(var(--panel2), var(--panel));
  border: 2px solid var(--line2); text-decoration: none; color: var(--text); box-shadow: var(--shadow); min-height: 78px; }
.desk-card:hover, .desk-card:focus { border-color: var(--gold); }
.desk-card.st-overdue { border-left: 6px solid var(--bad); } .desk-card.st-unassigned { opacity: .85; }
.desk-ico { font-size: 30px; display: grid; place-items: center; width: 48px; height: 48px; background: #071410; border: 2px solid var(--line2); }
.desk-text b { color: var(--gold2); letter-spacing: .06em; }
.desk-text small { display: block; color: var(--muted); font-size: 12.5px; }
.desk-stat { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; } .desk-stat small { color: var(--dim); font-size: 12px; }

/* ---------- office scene ---------- */
.scene-scroll { overflow-x: auto; border: 3px solid var(--gold-dim); box-shadow: 6px 6px 0 #000; background: #050c09; }
.scene { position: relative; width: 100%; min-width: 980px; aspect-ratio: 1672 / 941; container-type: inline-size; }
.scene-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; }
.ov { position: absolute; display: flex; flex-direction: column; text-decoration: none; color: var(--text); font-size: clamp(9px, .82cqw, 14px); line-height: 1.25; overflow: hidden; }
.ov-hud { flex-direction: row; align-items: center; justify-content: flex-end; gap: .9cqw; padding: 0 1cqw; background: linear-gradient(#0b1813, #08130f); }
.hud-clock { color: var(--muted); margin-right: auto; padding-left: 1cqw; white-space: nowrap; }
.hud-btn { color: var(--text); text-decoration: none; border: 2px solid var(--gold-dim); padding: .35cqw .8cqw; background: #0a1712; white-space: nowrap; }
.hud-btn:hover { border-color: var(--gold); color: var(--gold2); }
.hud-btn b { color: #000; background: var(--warn); padding: 0 .4cqw; }
.ov-int { background: linear-gradient(#0c1b15, #091510); border: .18cqw solid var(--gold); padding: .4cqw .7cqw; gap: .3cqw; align-items: center; }
.ov-title { color: var(--gold2); letter-spacing: .08em; font-weight: 700; white-space: nowrap; }
.ov-chips { display: flex; gap: .6cqw; width: 100%; justify-content: center; }
.ov-chip { flex: 1; display: flex; flex-direction: column; align-items: center; border: .14cqw solid var(--line2); padding: .2cqw .4cqw; background: #06110d; }
.ov-chip b { font-size: 1.1em; } .ov-chip small { font-size: .78em; color: var(--muted); }
.ov-chip.st-connected { border-color: var(--ok); } .ov-chip.st-connected small { color: var(--ok); }
.ov-chip.st-error { border-color: var(--bad); } .ov-chip.st-error small { color: var(--bad); }
.ov-chip.st-delayed { border-color: var(--warn); } .ov-chip.st-delayed small { color: var(--warn); }
.ov-dash { background: linear-gradient(#0d1d16, #08130f); border: .18cqw solid var(--gold); padding: .55cqw .8cqw; gap: .45cqw; }
.ov-dash:hover, .ov-int:hover { box-shadow: 0 0 1.2cqw rgba(69, 255, 162, .35); }
.ov-row { display: flex; align-items: center; gap: .6cqw; }
.ov-badge { border: .12cqw solid var(--line2); padding: .05cqw .5cqw; font-size: .82em; display: inline-flex; align-items: center; gap: .3cqw; white-space: nowrap; }
.ov-badge.st-live { color: var(--ok); border-color: var(--ok); } .ov-badge.st-demo { color: var(--purple2); border-color: var(--purple); }
.ov-badge.st-stale { color: var(--warn); border-color: var(--warn); } .ov-badge.st-alert { color: var(--warn); border-color: var(--warn); margin-left: auto; }
.ov-badge.st-none, .ov-badge.st-manual { color: var(--info); }
.ov-tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: .35cqw; }
.ov-tile { border: .12cqw solid var(--line2); background: #06110d; padding: .25cqw .4cqw; display: flex; flex-direction: column; }
.ov-l { font-size: .75em; color: var(--muted); letter-spacing: .06em; }
.ov-v { font-family: var(--mono); font-weight: 700; font-size: 1.45em; color: var(--gold2); white-space: nowrap; }
.ov-v small { font-size: .55em; color: var(--muted); margin-left: .15em; }
.ov-v.none { color: var(--dim); }
.ov-bottom { flex: 1; min-height: 0; align-items: stretch; }
.ov-spark { flex: 1; min-width: 0; border: .12cqw solid var(--line2); background: #06110d; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ov-spark svg { width: 100%; height: 100%; }
.ov-rooms { display: grid; grid-template-columns: 1fr 1fr; gap: .3cqw; width: 22%; align-content: start; }
.ov-room { border: .12cqw solid var(--line2); text-align: center; padding: .15cqw; font-size: .8em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-room.st-ok { border-color: var(--ok); color: var(--ok); } .ov-room.st-alert, .ov-room.st-stale { border-color: var(--warn); color: var(--warn); } .ov-room.st-none { color: var(--dim); }
.ov-foot { font-size: .72em; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-empty { color: var(--muted); }
.hot { position: absolute; display: block; text-decoration: none; border: .2cqw solid transparent; transition: border-color .12s, box-shadow .12s; }
.hot:hover, .hot:focus-visible { border-color: var(--glow); box-shadow: 0 0 1.4cqw rgba(69, 255, 162, .55), inset 0 0 1.4cqw rgba(163, 92, 255, .25); outline: none; }
.hot-tag { position: absolute; left: 50%; bottom: 3%; transform: translateX(-50%); background: rgba(5, 12, 9, .88); border: .14cqw solid var(--gold); color: var(--gold2);
  padding: .2cqw .7cqw; font-size: clamp(9px, .78cqw, 13px); white-space: nowrap; opacity: 0; transition: opacity .12s; }
.hot:hover .hot-tag, .hot:focus-visible .hot-tag { opacity: 1; }
.desk-badge { position: absolute; left: 3%; top: 3%; display: inline-flex; gap: .35cqw; align-items: center; white-space: nowrap;
  font-size: clamp(9px, .74cqw, 13px); padding: .1cqw .55cqw; background: rgba(5, 12, 9, .92); border: .14cqw solid var(--line2); color: var(--text); box-shadow: .2cqw .2cqw 0 #000; }
.desk-badge b { background: var(--warn); color: #000; padding: 0 .35cqw; }
.desk.st-overdue .desk-badge { border-color: var(--bad); color: #ffd0d0; } .desk.st-overdue .desk-badge b { background: var(--bad); }
.desk.st-working .desk-badge { border-color: var(--info); } .desk.st-idle .desk-badge { border-color: var(--ok); color: var(--ok); }
.desk.st-unassigned .desk-badge { color: var(--dim); border-style: dashed; }
.desk-tip { position: absolute; left: 50%; top: 104%; transform: translateX(-50%); width: max(220px, 16cqw); background: var(--panel); border: .16cqw solid var(--gold); padding: .5cqw .7cqw;
  font-size: clamp(10px, .78cqw, 13px); color: var(--text); z-index: 5; display: none; box-shadow: .3cqw .3cqw 0 #000; }
.desk:hover .desk-tip, .desk:focus-visible .desk-tip { display: block; }

/* ---------- farm dashboard ---------- */
.room-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.metric { border: 2px solid var(--line); background: var(--bg2); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.m-l { font-size: 12.5px; color: var(--muted); }
.m-v { font-family: var(--mono); font-size: 21px; font-weight: 700; color: var(--gold2); }
.m-v small { font-size: 12px; color: var(--muted); }
.m-s { font-size: 11.5px; color: var(--dim); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chart-box { border: 2px solid var(--line); background: #050e0a; padding: 6px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: rgba(255,255,255,.07); } .chart .ax { fill: var(--dim); font-size: 11px; font-family: var(--mono); }
.chart .line { fill: none; stroke: var(--glow); stroke-width: 2; stroke-linejoin: round; filter: drop-shadow(0 0 3px rgba(69,255,162,.5)); }
.chart .pt { fill: var(--glow); } .chart .pt-manual { fill: var(--purple2); stroke: #000; }
.chart .gap { fill: rgba(150, 150, 150, .12); }
.chart .unit { fill: var(--muted); }
.chart-empty { padding: 30px; text-align: center; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 120px; gap: 10px; align-items: center; font-size: 14px; }
.bar-row b { text-align: right; font-family: var(--mono); }
.bar { height: 14px; background: #06110d; border: 1px solid var(--line); } .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--em), var(--purple)); }

/* ---------- alerts & chat ---------- */
.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert-card { background: var(--panel); border: 2px solid var(--line2); border-left: 7px solid var(--warn); padding: 12px 14px; box-shadow: var(--shadow); }
.alert-card.sev-critical { border-left-color: var(--bad); } .alert-card.sev-info { border-left-color: var(--info); }
.alert-card header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alert-card h3 { margin: 6px 0 2px; }
.chat { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.chat .q { align-self: flex-end; background: var(--panel3); border: 2px solid var(--em); padding: 6px 10px; max-width: 90%; }
.chat .a { background: #0a1611; border: 2px solid var(--line2); padding: 8px 10px; }
.ask { display: flex; gap: 8px; } .ask textarea { flex: 1; }
.sources { margin: 4px 0; padding-left: 18px; font-size: 13.5px; }
.results { margin: 0; padding-left: 20px; } .results li { margin: 4px 0; }
.int-card pre { max-height: 180px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .top-search input { width: 150px; } .topnav a { padding: 8px 8px; } }
@media (max-width: 980px) {
  .topnav, .top-search { display: none; }
  .uname { display: none; }
  .topbar { gap: 10px; padding: 8px 12px; }
  .brand { margin-right: auto; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: #08130f; border-top: 3px solid var(--gold-dim);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 18px rgba(0,0,0,.5); }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11.5px; color: var(--muted); text-decoration: none; padding: 5px 2px; min-height: 52px; position: relative; }
  .bottomnav a span { font-size: 19px; }
  .bottomnav a.on { color: var(--gold2); box-shadow: inset 0 3px 0 var(--em); }
  .bottomnav .count { position: absolute; top: 2px; right: calc(50% - 26px); }
  #toasts { bottom: 76px; left: 12px; right: 12px; max-width: none; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  main { padding: 14px 12px 100px; }
  .form-grid, .auth .form-grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile { padding: 10px; } .tile-value .v { font-size: 20px; }
  .page-head { align-items: flex-start; }
  .seg { width: 100%; } .seg-btn { flex: 1; }
  .desk-cards, .cards, .room-grid { grid-template-columns: 1fr; }
  .line-row, .line-row.recv { grid-template-columns: 1fr 1fr; }
  .line-row select { grid-column: 1 / -1; }
  .bar-row { grid-template-columns: 90px 1fr 92px; font-size: 13px; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
  .modal-wrap { padding: 0; }
  .modal, .modal.wide { width: 100%; min-height: 100vh; border-width: 0 0 0 0; box-shadow: none; }
  .modal-body { padding: 14px 12px 40px; }
  .toolbar .btn { flex: 1 1 auto; }
  .inline input { width: 140px; }
  /* tables become stacked cards */
  .table-wrap { border: 0; background: none; overflow: visible; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tbl tr { background: var(--panel); border: 2px solid var(--line2); margin-bottom: 8px; padding: 6px 10px; box-shadow: 3px 3px 0 #020604; }
  .tbl td { border: 0; padding: 4px 0; display: grid; grid-template-columns: 40% 60%; gap: 8px; text-align: left !important; overflow-wrap: anywhere; }
  .tbl td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; font-family: var(--font); }
  .tbl td:empty, .tbl td[data-label=""] { grid-template-columns: 1fr; }
  .tbl td[data-label=""]::before { content: none; }
  .matrix .tbl td { grid-template-columns: 70% 30%; }
}
@media (max-width: 400px) { .tiles { grid-template-columns: 1fr; } .brand small { display: none; } }
@media print {
  .topbar, .bottomnav, .demo-banner, .action-row, .pills, #toasts, .btn, .skip { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  main { padding: 0; } .card, .tile, .table-wrap { box-shadow: none; border-color: #999; background: #fff; color: #000; }
  h1, h2, .tile-value .v { color: #000; text-shadow: none; } .muted, .tile-src, .meta-line { color: #444; }
}
@media (prefers-reduced-motion: reduce) { .dot, .spin, .loading-row::before { animation: none; } * { transition: none !important; } }
