/* dashboard.css — shared design system for the IRL dashboard.
 * One source of truth so every page (dashboard, network monitor, settings,
 * Director Mini controls) share the same dark, card-based look. */

:root{
  --bg:#0a0e14; --panel:#0f151d; --card:#131a24; --card2:#182231;
  --line:#243040; --line2:#31435a;
  --txt:#e8eef6; --dim:#8aa0b8; --dim2:#8197b0;
  --l1:#ef4444; --l2:#f97316; --l3:#eab308; --l4:#22c55e; --l5:#10b981; --l0:#3a4a5c;
  --accent:#3b82f6; --accent2:#60a5fa;
  --radius:12px; --radius-sm:8px;
  color-scheme: dark;
}
*{box-sizing:border-box}
html,body{margin:0;min-width:0}
body{
  background:var(--bg); color:var(--txt);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  -webkit-font-smoothing:antialiased; -webkit-text-size-adjust:100%;line-height:1.5;
}
a{color:var(--accent2);text-decoration:none}
a:hover{text-decoration:underline}
button,input,select,textarea{font-family:inherit}
:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible{
  outline:2px solid var(--accent2) !important;outline-offset:3px;
}
input::placeholder,textarea::placeholder{color:var(--dim2);opacity:1}
input:disabled,select:disabled,textarea:disabled{cursor:not-allowed;opacity:.6}
input[type=checkbox],input[type=radio],input[type=range]{accent-color:var(--accent)}
img,video,canvas{max-width:100%;height:auto}
.hint,.help,.sub,.meta,.dest-host,code{overflow-wrap:anywhere}
.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.muted{color:var(--dim)}
.mono{font-variant-numeric:tabular-nums;font-feature-settings:"tnum"}
h1,h2,h3{margin:0}

/* ---- App bar / header (shared across pages) ---- */
.appbar{
  display:flex;align-items:center;gap:12px;flex-wrap:wrap;
  padding:9px 14px;margin:0 0 12px;
  background:linear-gradient(180deg,#0d141d 0%,#0a0e14 100%);
  border-bottom:1px solid var(--line);
}
.appbar .brand{display:flex;align-items:center;gap:9px;font-weight:800;font-size:1.02rem;letter-spacing:.3px;white-space:nowrap}
.appbar .brand .logo{font-size:1.15rem;filter:saturate(1.2)}
.appbar .brand small{font-weight:600;color:var(--dim);font-size:.72rem;letter-spacing:.4px}
.appbar .spacer{flex:1 1 auto}
.appbar .actions{display:flex;align-items:center;gap:8px}
/* No chips chosen: the bar collapses to nothing so the tab strip sits at the very top.
   Not display:none — the compact-mode alert is a child of this bar and still has to be
   able to appear, at which point the padding comes back with it. */
.appbar.hdrempty{padding:0;border-bottom:0;margin:0}
.appbar.hdrempty > .hdrgroup, .appbar.hdrempty > .spacer{display:none}
.appbar.hdrempty > .compact-mode-alert{margin:9px 14px}
.appbar.hdrempty + .nav-tabs{margin-top:0 !important}

/* live status chips row */
.chips{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.chip{
  display:inline-flex;align-items:center;gap:6px;
  padding:5px 11px;border-radius:999px;font-size:.82rem;font-weight:600;line-height:1;
  background:var(--card);border:1px solid var(--line);color:var(--txt);white-space:nowrap;
}
.chip .dot{width:8px;height:8px;border-radius:50%;background:var(--l0);flex:none}
.chip small{color:var(--dim);font-weight:600;font-size:.72rem;text-transform:uppercase;letter-spacing:.4px}
/* A control living inside a chip (the overlay hide/restore eye). Matches .gfxeye so the
   Director Mini chip and the Overlays chip do not look like two different ideas. */
.chip .chipbtn{margin-left:8px;padding:3px 7px;border:0;border-radius:5px;cursor:pointer;
  background:rgba(255,255,255,.10);color:inherit;font-size:.86em;line-height:1;vertical-align:middle}
.chip .chipbtn:hover{background:rgba(255,255,255,.20)}
.chip .chipbtn:focus-visible{outline:2px solid var(--accent2,#60a5fa);outline-offset:1px}
.chip .chipbtn[disabled]{opacity:.5;cursor:default}
/* Working: the spinner has to read as "on it", not as a greyed-out dead control. */
.chip .chipbtn.busy{opacity:1;cursor:progress;background:rgba(96,165,250,.28)}
.chip .chipbtn.fail{background:rgba(234,179,8,.30);color:#fde68a}
.chip b{font-weight:800}
.chip.ok{border-color:rgba(34,197,94,.45);background:rgba(34,197,94,.10)}
.chip.ok .dot{background:var(--l4)}
.chip.warn{border-color:rgba(234,179,8,.45);background:rgba(234,179,8,.10)}
.chip.warn .dot{background:var(--l3)}
.chip.bad{border-color:rgba(239,68,68,.5);background:rgba(239,68,68,.12)}
.chip.bad .dot{background:var(--l1)}
/* A far-end reading the router could not refresh (no internet of its own, just back,
   or still finding out): the last good value, deliberately calm. Dashed and slate so
   it cannot be mistaken for either healthy green or a fault (HEADER-CHIPS.md §15). */
.chip.stale{border:1px dashed rgba(148,163,184,.65);background:rgba(100,116,139,.14);color:#cbd5e1}
.chip.stale b{font-weight:700;color:#cbd5e1}
.chip.stale .dot{background:#94a3b8}
/* The camera talkback (HEADER-CHIPS.md §12): a message, not a reading, so it is
   allowed to be long and it is meant to be noticed. */
.chip.talkchip{white-space:normal;max-width:min(92vw,560px);line-height:1.25;font-size:.95rem;
  border-color:rgba(245,158,11,.8);background:rgba(245,158,11,.18);animation:talkchipIn 1.2s ease-out 2}
.chip.talkchip b{font-weight:700}
@keyframes talkchipIn{0%{box-shadow:0 0 0 0 rgba(245,158,11,.7)}100%{box-shadow:0 0 0 10px rgba(245,158,11,0)}}
.chip.info{border-color:rgba(59,130,246,.45);background:rgba(59,130,246,.10)}
.chip.info .dot{background:var(--accent)}
.chip.plain{background:transparent}
.chip.clickable{cursor:pointer}
.chip.clickable:hover{border-color:var(--line2)}
/* A device's WiFi link (wifi-link.js): a second, quieter row under a tab's status
   chips, and one line under each phone on the Companion tab. */
.linkrow{display:flex;gap:6px;flex-wrap:wrap;align-items:center;margin:-4px 0 10px}
.linkrow .chip{font-size:.76rem;padding:4px 9px;white-space:normal;line-height:1.25;max-width:100%}
.linkrow .chip b{font-weight:700}
.linkline{font-size:.76rem;color:var(--dim);line-height:1.5;margin-top:3px}

/* ---- Layout ---- */
.wrap{max-width:1100px;margin:0 auto;padding:0 12px 60px}
.grid{display:grid;gap:10px}
.g2{grid-template-columns:repeat(2,minmax(0,1fr))}
.g3{grid-template-columns:repeat(3,minmax(0,1fr))}
.g4{grid-template-columns:repeat(4,minmax(0,1fr))}
.grid>*,.cb>*,.pv-row>*,fieldset{min-width:0}
@media(max-width:820px){.g4{grid-template-columns:repeat(2,1fr)}.g3{grid-template-columns:1fr}}
@media(max-width:540px){.g2{grid-template-columns:1fr}}
.sec{margin:16px 0 8px;display:flex;align-items:center;gap:10px}
.sec h2{font-size:.82rem;text-transform:uppercase;letter-spacing:.7px;color:var(--dim);font-weight:700}
.sec .line{flex:1;height:1px;background:var(--line)}
/* A <details> reusing .sec must NOT inherit the flex row above. As a flex
   container, an open <details> lays its <summary> and its body out as columns
   side by side: the heading ends up stranded in a narrow strip down the left
   with the content beside it. Sections are stacked, so force block. */
details.sec{display:block;margin:12px 0 0}
details.sec>summary{cursor:pointer;list-style:none;display:flex;align-items:center;gap:8px;min-height:32px;overflow-wrap:anywhere}
details.sec>summary::-webkit-details-marker{display:none}
details.sec>summary:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:6px}
/* An open section needs breathing room between its heading and its body. The
   heading carried margin-bottom as a .k div; as a <summary> it no longer can,
   because a closed section would then sit with a gap under nothing. */
details.sec[open]>summary{margin-bottom:8px}
/* Anything pushed to the right of a section heading: a status pill, a count, the
   chevron. margin-left:auto on the group keeps them together against the edge. */
details.sec>summary .secright{margin-left:auto;display:flex;align-items:center;gap:10px;flex:0 0 auto}
/* The only thing saying a panel folds used to be the .chev glyph in --dim, at
   .8rem, pinned to the far right of a heading whose text sits at the far left —
   nearly a thousand pixels away on a desktop row. Nobody connected the two, so
   the panels read as fixed furniture and collapsing that already worked was
   reported missing.

   The disclosure marker now leads the heading, where every OS and browser puts
   one, drawn as a plain Unicode triangle so it never depends on the Font
   Awesome webfont loading. The trailing .chev is hidden: two markers pointing
   the same way on one row is noise, and the right-hand slot is wanted for
   status pills. The whole row is the hit target either way. */
details.sec>summary::before{content:"\25B8";color:var(--accent2);font-size:.95rem;line-height:1;width:22px;height:22px;flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--line2);border-radius:6px;background:var(--card2);transition:transform .15s,color .15s,border-color .15s,background .15s}
details.sec[open]>summary::before{transform:rotate(90deg)}
details.sec>summary:hover::before,details.sec>summary:focus-visible::before{color:var(--txt);border-color:var(--accent);background:var(--accent)}
details.sec>summary:hover{color:var(--txt)}
details.sec>summary:hover h2{color:var(--txt)}
details.sec>summary .chev{display:none}
/* "when you need it" hints belong on a closed section only - once it is open the
   content says it better than the label can. */
details.sec>summary .secwhen{font-size:.72rem;color:var(--dim);font-weight:600}
details.sec[open]>summary .secwhen{display:none}
/* Status in the heading, the Router tab's convention made shared: a .sub pill in
   .secright carries the glanceable number or state so a folded section still
   answers "is it fine". It takes a color only when something needs a hand —
   amber (.warn) for attention, red (.bad) for failed, green (.ok) reserved for
   the few places where "live" is the whole point. Pages that compute the state
   in JS may set style.color to the same variables instead; both read the same.
   The card border follows the pill so the flag survives a glance that skips the
   text: details.sec.warn / .bad tint the frame. No section wears one of these
   colors permanently - the DJI "compact" frame used to, and a standing amber
   border reads as a fault that never clears. */
details.sec>summary .secright .sub.warn{color:var(--l3)}
details.sec>summary .secright .sub.bad{color:var(--l1)}
details.sec>summary .secright .sub.ok{color:var(--l4)}
details.sec.warn{border-color:rgba(234,179,8,.55)}
details.sec.bad{border-color:rgba(239,68,68,.6)}

/* ---- Words that explain themselves (dash-terms.js) ----
   A dotted underline says "tap me for what this means". cursor:pointer is not
   just a hint: iOS sends no click for a tap on plain text without it. The bubble
   hangs off <body>, so it takes none of the styling of where the word sits (a
   table heading's capitals, a hint's dim color). */
.term{border-bottom:1px dotted currentColor;cursor:pointer;-webkit-tap-highlight-color:transparent}
.term:hover,.term[aria-expanded="true"]{color:var(--accent2);border-bottom-style:solid}
.term:focus-visible{outline-offset:1px !important;border-radius:3px}
.termpop{position:absolute;z-index:1000;box-sizing:border-box;max-width:320px;padding:9px 12px;border-radius:10px;
  background:#0d1621;border:1px solid var(--line2);box-shadow:0 10px 28px rgba(0,0,0,.5);color:var(--txt);
  font-size:.8rem;line-height:1.5;font-weight:400;text-align:left;text-transform:none;letter-spacing:normal;white-space:normal}
.termpop b{display:block;font-size:.84rem;margin-bottom:3px}
.termpop[hidden]{display:none}
.termlist{margin:4px 0 0;font-size:.82rem;line-height:1.5}
.termlist dt{font-weight:700;margin-top:9px}
.termlist dd{margin:1px 0 0;color:var(--dim)}

/* ---- The same chrome, two more places it lives ----
   1. A settings group inside a builder grid (.cb > details.sec, summary.grp): the
      overlay builders' Show / Style / Background / Border boxes and their Live
      preview. The grid supplies the gaps, so the section's own margins go; the
      .grp heading keeps its icon and rule line and gains the disclosure marker.
      A folded cell stops stretching to the row so it reads as a closed lid, not an
      empty box.
   2. A folded note (details.sec.notefold): a paragraph of explanation whose first
      line is the summary, so the gist stays on screen and the rest is a tap away.
      Sized for .8rem prose rather than for a card heading. */
.cb>details.sec,.pv-row>details.sec{margin:0}
.cb>details.sec:not([open]),.pv-row>details.sec:not([open]){align-self:start}
details.sec>summary.grp{margin:0}
details.sec[open]>summary.grp{margin-bottom:8px}
details.sec.notefold{margin:8px 0 0}
details.sec.notefold>summary{font-size:.8rem;color:var(--dim);line-height:1.45;gap:7px}
details.sec.notefold>summary::before{width:18px;height:18px;font-size:.8rem}
details.sec.notefold>summary>i:first-of-type{color:var(--accent2)}
details.sec.notefold[open]>summary{margin-bottom:4px;color:var(--txt)}
details.sec.notefold>.note,details.sec.notefold>.hint{margin-top:0}

/* The .secgroup variant — a divider heading with a rule that folded a whole group
   of cards — is gone. It only ever had four users, all of them on the Router tab,
   and mixing it with ordinary .card sections there was the problem: half the tab
   collapsed into a bordered box and half into a bare line, so at a glance you
   could not tell which panels were still open. Everything is a card section now.
   If a future page wants a non-collapsing divider, plain .sec above still does it. */

/* ---- Cards ---- */
.card{min-width:0;background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:12px 14px}
.card .k{font-size:.72rem;text-transform:uppercase;letter-spacing:.6px;color:var(--dim)}
.card.pad0{padding:0;overflow:hidden}
.big{font-size:1.35rem;font-weight:800}
.sub{font-size:.75rem;color:var(--dim)}
.rows{display:grid;grid-template-columns:auto 1fr;gap:5px 14px;font-size:.9rem}
.rows .l{color:var(--dim)}
.rows .v{text-align:right;font-weight:600}
.offline{opacity:.5}

/* ---- Buttons ---- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:7px;
  padding:9px 15px;font-size:.9rem;font-weight:700;line-height:1;cursor:pointer;
  border-radius:var(--radius-sm);border:1px solid var(--line2);
  background:var(--card2);color:var(--txt);transition:filter .15s,border-color .15s,background .15s;
  text-decoration:none;
}
.btn:hover{filter:brightness(1.15);text-decoration:none}
.btn:active{filter:brightness(.9)}
.btn:disabled{opacity:.45;cursor:not-allowed;filter:none}
.btn-sm{padding:7px 11px;font-size:.82rem}
.btn-lg{padding:12px 20px;font-size:1rem}
.btn-block{width:100%}
.btn-primary{background:var(--accent);border-color:var(--accent);color:#fff}
.btn-ok{background:#16a34a;border-color:#16a34a;color:#fff}
.btn-warn{background:#b45309;border-color:#b45309;color:#fff}
.btn-danger{background:#b91c1c;border-color:#b91c1c;color:#fff}
.btn-ghost{background:transparent;border-color:var(--line2);color:var(--txt)}
.btn-secondary{background:var(--card2);border-color:var(--line2);color:var(--txt)}
.btn-group{display:flex;flex-wrap:wrap;gap:8px}
.dash-frame-status{padding:14px;color:var(--dim);font-size:.88rem;border:1px solid var(--line);border-radius:var(--radius-sm);background:var(--panel)}
.dash-frame-status[hidden]{display:none}
@keyframes flashGreen{0%{background:#16a34a}50%{background:#22ff88;color:#04210f}100%{background:#16a34a}}
.flash-success{animation:flashGreen 1s ease-in-out infinite;border-color:#22ff88 !important;color:#fff}

/* ---- Link out to a written walkthrough (sh_btn in links.php) ----
   A button, not a sentence. These guides are the links people need most and
   click least, because a blue phrase inside an amber warning box reads as part
   of the warning and the eye skims the whole box as one object. Full width and
   left-aligned so it looks like a thing to press rather than a caption, and it
   still reads as a row of text at 320px. */
.sh-guide{
  display:flex;align-items:center;gap:12px;width:100%;
  margin:10px 0 0;padding:12px 14px;
  border:1px solid var(--accent);border-radius:var(--radius-sm);
  background:rgba(59,130,246,.13);color:var(--txt);
  text-align:left;font-size:.9rem;line-height:1.35;
  transition:background .15s,border-color .15s;
}
.sh-guide:hover{background:rgba(59,130,246,.26);border-color:var(--accent2);
  color:var(--txt);text-decoration:none}
.sh-guide:focus-visible{outline:2px solid var(--accent2);outline-offset:2px}
.sh-guide .ico{color:var(--accent2);font-size:1.15rem;width:22px;text-align:center;flex:none}
.sh-guide .tx{min-width:0;flex:1}
.sh-guide .t{display:block;font-weight:700}
.sh-guide .s{display:block;margin-top:2px;font-weight:400;font-size:.82rem;color:var(--dim)}
.sh-guide .go{color:var(--dim2);font-size:.8rem;flex:none}
.sh-guide:hover .go{color:var(--accent2)}
/* Inside an amber warning box the blue-on-amber is muddy, so borrow the amber. */
.warnbox .sh-guide{border-color:var(--l3);background:rgba(234,179,8,.12)}
.warnbox .sh-guide:hover{background:rgba(234,179,8,.22);border-color:#facc15}
.warnbox .sh-guide .ico{color:var(--l3)}

/* ---- "The Companion app is handling this" (companion-note.php) ----
   Sits on top of any card that explains where to send video or which URL to
   paste somewhere, when the Companion director does that job by itself. Blue,
   not amber: nothing is wrong, the details underneath are just optional. */
.companion-note{display:flex;gap:10px;align-items:flex-start;
  margin:0 0 10px;padding:10px 12px;border-radius:var(--radius-sm);
  background:rgba(59,130,246,.12);border:1px solid rgba(59,130,246,.4);
  color:var(--txt);font-size:.86rem;line-height:1.45}
.companion-note>i{color:var(--accent2);font-size:1.1rem;margin-top:1px;flex:none}
.companion-note a{color:var(--accent2);white-space:nowrap}

/* ---- Bootstrap nav-tabs override (main dashboard) ---- */
.nav-tabs{border-bottom:1px solid var(--line) !important;gap:4px}
.nav-tabs .nav-link{
  display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;
  color:var(--dim) !important;background:transparent !important;border:1px solid transparent !important;
  border-radius:var(--radius-sm) !important;padding:8px 14px !important;font-weight:600;
}
.nav-tabs .nav-link:hover{color:var(--txt) !important;background:var(--card) !important}
.nav-tabs .nav-link:focus-visible{outline:3px solid var(--accent2);outline-offset:-3px}
/* The selected tab is simply an outlined button: the same radius on all four corners
   and the same border color the whole way round. The classic tab shape — square
   bottom corners and a bottom border painted out to merge into the pane — only reads
   correctly when the pane is directly below and the same width. Here the panes are
   iframes of their own, and on a phone the strip scrolls sideways, so the notch
   pointed at nothing and just looked broken. */
.nav-tabs .nav-link.active{
  color:#fff !important;background:var(--card) !important;
  border-color:var(--line2) !important;
}
.nav-tabs .nav-utility{margin-left:auto}
.nav-tabs .tabstat{font-size:.72rem;font-weight:700;margin-left:6px;font-variant-numeric:tabular-nums;color:var(--dim)}
.nav-tabs .tabstat:empty{display:none}

/* ---- Steady live numbers ----------------------------------------------
 * Anything that refreshes on a timer sits in a fixed-width slot. Tabular
 * figures alone are not enough: 9 becoming 10 adds a whole character, the
 * chip grows, and every chip after it slides sideways. Reserving the width
 * up front means the digits change and nothing else moves.
 *
 * .res    a slot sized by --w, holding its width even while empty
 * .num    an inline number that keeps its box (use --w for the width)
 * Both show a faint bar until the first value lands, so the layout is
 * already settled before any data arrives.
 */
.nav-tabs .tabstat.res{display:inline-block;min-width:var(--w,4ch);text-align:center}
/* A stat that has reported at least once keeps its slot forever, so later
   updates cannot resize the row. One that has never reported (a camera that
   is not connected, say) collapses rather than showing an empty box. */
.nav-tabs .tabstat.res.has:empty{display:inline-block}
.nav-tabs .tabstat.res:not(.has):empty{display:none}
.nav-tabs .tabstat.res.has:empty::before,
.num:empty::before{
  content:"";display:inline-block;width:calc(var(--w, 4ch) - .8ch);height:.62em;
  border-radius:3px;background:currentColor;opacity:.18;vertical-align:middle;
}
.num{
  display:inline-block;min-width:var(--w,3ch);text-align:right;
  font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1;
}

/* ---- Director Mini control workspace ---- */
.dm-workspace{max-width:1100px;margin:0 auto;display:grid;gap:14px}
.dm-panel{border:1px solid var(--line);border-radius:var(--radius);background:var(--panel)}
.dm-weblink{display:flex;justify-content:center;padding:4px 0 2px}
.dm-overview-copy h2,.dm-panel h3{display:flex;align-items:center;gap:8px;font-size:1rem;font-weight:800;letter-spacing:-.01em}
.dm-overview-copy h2 i,.dm-panel h3 i{color:var(--accent2)}
.dm-overview-copy p,.dm-panel-note{margin:4px 0 0;color:var(--dim);font-size:.82rem}
/* Dismissible tip. Sits under the controls it describes, because it is a footnote
   to them, not an introduction — and once you have read it once it is only noise. */
.dm-panel-note.dm-note-x{display:flex;align-items:flex-start;gap:8px;margin-top:10px;padding-top:9px;border-top:1px dashed var(--line)}
.dm-panel-note.dm-note-x>span{flex:1;min-width:0}
.dm-note-close{flex:0 0 auto;background:none;border:0;color:var(--dim);font-size:1.05rem;line-height:1;padding:0 2px;cursor:pointer;opacity:.6}
.dm-note-close:hover{opacity:1;color:var(--txt)}
.dm-note-close:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px}
.dm-primary-grid,.dm-control-grid,.dm-setup-grid{display:grid;gap:14px}
.dm-primary-grid{grid-template-columns:minmax(0,1.3fr) minmax(300px,.9fr)}
.dm-control-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.dm-display-panel{grid-column:1/-1}
.dm-setup-grid{grid-template-columns:minmax(0,1.5fr) minmax(280px,.8fr)}
.dm-panel{padding:15px}
.dm-panel h3{margin:0 0 7px;font-size:.9rem}
/* Director Mini panels fold too. Unlike every other tab these are grid items, so
   the shared details.sec top margin has to be canceled: a 12px offset on one
   panel drops it below its row neighbor, and the grid gap already spaces them.
   The heading used to be an <h3>; as a <summary> it needs the same type treatment,
   minus the bottom margin - details.sec[open]>summary supplies that, and a closed
   panel must not sit with a gap under nothing. */
details.dm-panel.sec{margin:0}
.dm-panel>summary{margin:0;font-size:.9rem;font-weight:800;letter-spacing:-.01em}
/* Only the leading icon takes the accent. The chevron is inside .secright, so it
   is not a direct child and keeps its dim color. */
.dm-panel>summary>i:first-child{color:var(--accent2)}
/* A collapsed panel has to actually shrink. Grid items stretch to the row height,
   so folding one of a two-column pair would leave a full-height empty box beside
   its open neighbor - hiding the content while saving none of the space. Open
   panels keep stretching, which is what keeps a row's bottoms level. */
details.dm-panel.sec:not([open]){align-self:start}
.dm-button-grid{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.dm-button-grid .btn,#gfxButtonsContainer .btn,#sceneButtonsContainer .btn,#streamButtonsContainer .btn{margin:0 !important}
.dm-disconnect{margin-top:12px}
.dm-field-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:12px 0}
.dm-field-grid label{margin:0;font-size:.8rem}
.dm-field-grid select{margin-top:5px}
.dm-config-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.dm-config-grid>div,.dm-setup-grid .fld{min-height:48px;padding:10px;border:1px solid var(--line);border-radius:var(--radius-sm);background:var(--card)}
.dm-config-grid h4{margin:0 0 7px;color:var(--dim);font-size:.76rem;font-weight:800}
.dm-config-grid>div>div,.dm-setup-grid .fld{display:flex;flex-wrap:wrap;gap:7px}
.dm-save-row{display:flex;align-items:center;gap:10px;margin-top:12px}
/* Live figures elsewhere (chips, tiles, readouts) — same digit width, so a
 * value ticking over never nudges its neighbors. */
.chip b, .chip small, .mono, .val, .v, .big{font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1}

/* ---- Signal meter (shared; was inline in director-mini.php) ---- */
.signal-meter{display:inline-flex;gap:3px;align-items:flex-end;height:14px;vertical-align:middle;margin-left:.3rem}
.signal-meter .b{width:4px;background:var(--l0);border-radius:2px;opacity:.6}
.signal-meter .b.on{opacity:1}
.signal-meter[data-level="1"] .b.on{background:var(--l1)}
.signal-meter[data-level="2"] .b.on{background:var(--l2)}
.signal-meter[data-level="3"] .b.on{background:var(--l3)}
.signal-meter[data-level="4"] .b.on{background:var(--l4)}
.signal-meter[data-level="5"] .b.on{background:var(--l5)}

/* ---- Forms (settings) ---- */
fieldset{border:1px solid var(--line);border-radius:var(--radius);background:var(--card);padding:16px 18px 20px;margin:0 0 16px}
legend{padding:0 8px;font-weight:700;font-size:.95rem;color:var(--txt)}
label{display:block;font-size:.85rem;color:var(--dim);margin:14px 0 5px}
label:first-of-type{margin-top:4px}
input[type=text],input[type=password],input[type=number],input[type=url],input[type=email],
input[type=search],input[type=tel],input[type=date],input[type=time],input[type=datetime-local],textarea,select{
  width:100%;padding:11px;font-size:16px;border-radius:var(--radius-sm);
  border:1px solid var(--line2);background:var(--panel);color:var(--txt);
}
input:focus,textarea:focus,select:focus{outline:none;border-color:var(--accent)}
input:focus-visible,textarea:focus-visible,select:focus-visible{outline:2px solid var(--accent2);outline-offset:2px}
textarea{min-height:120px;font-family:ui-monospace,'Courier New',monospace;font-size:14px;resize:vertical}
.help{color:var(--dim2);font-size:.8rem;margin:5px 0 0}
.row{position:relative}
.peek{position:absolute;right:8px;top:34px;background:var(--card2);border:1px solid var(--line2);
  color:var(--dim);font-size:.72rem;padding:4px 8px;border-radius:6px;cursor:pointer}
.savebar{position:sticky;bottom:0;background:var(--bg);padding:14px 0;border-top:1px solid var(--line);
  display:flex;gap:10px;align-items:center}
.checkrow{display:flex;align-items:center;gap:11px;margin:8px 0 2px;cursor:pointer;color:var(--txt);font-size:.95rem}
.checkrow input{appearance:none;-webkit-appearance:none;width:44px;height:25px;border-radius:999px;background:var(--panel);
  border:1px solid var(--line2);position:relative;cursor:pointer;transition:background .2s;flex:none}
.checkrow input::after{content:"";position:absolute;top:2px;left:2px;width:19px;height:19px;border-radius:50%;
  background:var(--dim);transition:transform .2s,background .2s}
.checkrow input:checked{background:rgba(34,197,94,.30);border-color:var(--l4)}
.checkrow input:checked::after{transform:translateX(19px);background:var(--l4)}

/* ---- Flash / alert banners ---- */
.flash{padding:12px 16px;border-radius:0 8px 8px 0;margin-bottom:16px;font-size:.92rem}
.flash.ok{background:rgba(34,197,94,.14);border-left:4px solid var(--l4)}
.flash.err{background:rgba(239,68,68,.14);border-left:4px solid var(--l1)}
.flash.warn{background:rgba(234,179,8,.12);border-left:4px solid var(--l3)}

code{background:var(--panel);border:1px solid var(--line);border-radius:5px;padding:1px 5px;font-size:.85em}
.prose-more{display:none}
@media(prefers-reduced-motion:reduce){
  .btn,.checkrow input,.checkrow input::after,details.sec>summary::before{transition:none}
  .flash-success,.nav-tabs .nav-link.chat-unread>i,.tabdot,.compact-mode-alert{animation:none !important}
}

/* ---- Small screens -------------------------------------------------------
 * Keep controls touchable and content inside the viewport. Individual pages
 * can still opt into denser layouts above these breakpoints. */
@media(max-width:700px){
  body{overflow-x:hidden}
  .wrap{padding:0 10px 42px}
  .appbar{gap:8px;padding:8px 10px;margin-bottom:8px}
  .appbar .brand{flex:1 1 100%;font-size:.96rem;min-width:0}
  .appbar .brand small{font-size:.65rem}
  .appbar .actions{width:100%;flex-wrap:wrap}
  .appbar .actions .btn{flex:1 1 auto}
  .chips{gap:6px}
  .chip{max-width:100%;padding:6px 9px;font-size:.78rem}
  .appbar .hdrgroup .chips{width:100%;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;
                            overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .appbar .hdrgroup .chips::-webkit-scrollbar{display:none}
  .appbar .hdrgroup .chip{flex:none}
  .nav-tabs{display:flex;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;
             -webkit-overflow-scrolling:touch;scrollbar-width:none;scroll-snap-type:x proximity;padding:0 6px}
  .nav-tabs::-webkit-scrollbar{display:none}
  .nav-tabs .nav-item{flex:0 0 auto;scroll-snap-align:start}
  .nav-tabs .nav-link{min-width:44px;min-height:44px;padding:10px !important;font-size:1rem}
  /* Mobile navigation stays a compact, tap-sized icon rail. The live figures
     remain in their panels; connection dots remain visible here. */
  .nav-tabs .tabstat{display:none !important}
  .nav-tabs .tabdot{margin-left:2px}
  .nav-tabs .nav-utility{margin-left:0}
  .dm-primary-grid,.dm-control-grid,.dm-setup-grid{grid-template-columns:1fr}
  .dm-display-panel{grid-column:auto}
  .dm-field-grid,.dm-config-grid{grid-template-columns:1fr}
  .dm-panel{padding:13px}
  .dm-button-grid .btn{flex:1 1 140px}
  .dm-config-grid>div,.dm-setup-grid .fld{padding:9px}
  .tab-content{padding:8px !important;margin-bottom:12px !important}
  .card{padding:11px 12px}
  .flash{padding:10px 12px;font-size:.88rem}
  fieldset{padding:13px 12px 16px}
  .btn{min-height:40px}
  .btn-sm{min-height:36px}
  .btn-group,.savebar{width:100%}
  .savebar{flex-wrap:wrap}
  .savebar .btn{flex:1 1 180px}
  /* A chip's text is allowed to wrap on a phone instead of running off the edge. */
  .chip{white-space:normal;line-height:1.25;text-align:left}
  /* Long explanatory prose folds to two lines with a "more" tail; tap to read it
     (dash-sections.js adds the class). The controls stay where the thumb is. */
  .prose-clamp{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;cursor:pointer;position:relative;padding-right:0 !important}
  .prose-clamp.open{display:block;-webkit-line-clamp:unset;overflow:visible}
  .prose-clamp .dis{display:none}
  .prose-more{display:block;font-size:.78rem;color:var(--accent2);cursor:pointer;margin-top:2px;
    padding:4px 0;min-height:32px;background:none;border:0;text-align:left;user-select:none}
  /* Fingers, not cursors: tiny close/delete glyph buttons get a real hit area. */
  .flash .dis,button.del,.pbtn{min-width:36px;min-height:36px}
  .flash .dis{font-size:1.15rem}
  /* Section headers: title keeps the first line; the status pill drops below it
     instead of squeezing the title into a 2-3 line column. */
  details.sec>summary{flex-wrap:wrap;row-gap:4px}
  details.sec>summary .secright{flex:1 1 100%;margin-left:30px;justify-content:flex-start;flex-wrap:wrap;gap:6px 10px;min-width:0}
  details.sec>summary .secright:empty{display:none}
  details.sec>summary .secright>*{min-width:0;overflow:hidden;text-overflow:ellipsis}
}
@media(max-width:480px){
  body{font-size:15px}
  .wrap{padding-left:8px;padding-right:8px}
  .appbar .brand small{display:none}
  .g4,.g3,.g2{grid-template-columns:1fr}
  .rows{grid-template-columns:1fr;gap:2px 0}
  .rows .v{text-align:left}
  .savebar{position:static;flex-direction:column;align-items:stretch}
  .savebar .btn{width:100%;flex:auto}
}

[hidden]:not([hidden="until-found"]){display:none !important}
