/* CloudReel Encoder — light theme aligned with the Videograph console. No build step; every page shares this file. */
:root {
  --bg: #f6f7f9; --card: #fff; --card-2: #fafafa; --line: #e5e7eb; --line-2: #d1d5db;
  --text: #111827; --muted: #6b7280;
  --blue: #2563eb; --blue-2: #1d4ed8; --blue-bg: #eff6ff;
  --green: #16a34a; --green-2: #15803d; --green-bg: #ecfdf5;
  --red: #dc2626; --red-2: #b91c1c; --red-bg: #fef2f2; --red-line: #fca5a5;
  --amber: #d97706; --amber-bg: #fffbeb; --amber-line: #fde68a; --amber-text: #92400e;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px; --radius-s: 8px;
  --shadow: 0 1px 2px rgba(16,24,40,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, Inter, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--blue); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 4px; } h2 { font-size: 16px; margin: 0 0 .5rem; } h3 { font-size: 14px; margin: 0 0 .4rem; } h4 { font-size: 13px; margin: 14px 0 6px; color: var(--text); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- shell ---- */
.topbar { display: flex; align-items: center; gap: 24px; height: 56px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { color: var(--text); font-weight: 700; font-size: 16px; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 14px; height: 14px; border-radius: 4px; background: linear-gradient(135deg, var(--blue), #60a5fa); display: inline-block; }
.topbar nav { display: flex; gap: 18px; align-items: center; flex: 1; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); } .topbar nav a:hover { color: var(--text); text-decoration: none; }
.topbar nav a.on { color: var(--text); font-weight: 600; }
.topbar nav form.inline { margin-left: auto; }
.topbar .me { color: var(--muted); }
.container { max-width: 1280px; margin: 0 auto; padding: 24px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 32px 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.narrow { max-width: 440px; margin: 48px auto; }
.card.empty { text-align: center; padding: 48px 20px; }
.card.empty h2 { font-size: 18px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-sub { margin: 0; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(560px, 1fr)); gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
@media (max-width: 1200px) { .grid { grid-template-columns: 1fr; } }

/* ---- forms ---- */
label { display: block; margin: 10px 0; font-size: 13px; color: var(--muted); }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
label.check { display: flex; align-items: center; gap: 8px; } label.check input { width: auto; margin: 0; }
label.grow { flex: 1; margin: 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; background: #fff; color: var(--text);
  border: 1px solid var(--line-2); border-radius: var(--radius-s); font: inherit; min-height: 36px;
}
textarea { resize: vertical; line-height: 1.4; }
label.inline input { display: inline-block; width: auto; margin: 0; }
input.short { width: 6.5rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: transparent; }
select option:disabled, select optgroup option:disabled { color: #9ca3af; }
.btn { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-s); border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer; font: inherit; font-weight: 500; line-height: 1.3; min-height: 36px; transition: background .12s, border-color .12s, opacity .12s; white-space: nowrap; }
.btn:hover { background: #f9fafb; border-color: #9ca3af; text-decoration: none; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; } .btn.primary:hover { background: var(--blue-2); border-color: var(--blue-2); }
.btn.primary.outline { background: #fff; color: var(--blue); } .btn.primary.outline:hover { background: var(--blue-bg); }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; } .btn.success:hover { background: var(--green-2); border-color: var(--green-2); }
.btn.danger { background: #fff; border-color: var(--red-line); color: var(--red); font-weight: 600; } .btn.danger:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); } .btn.ghost:hover { color: var(--text); background: #f3f4f6; border-color: var(--line); }
.btn.tiny { padding: 3px 9px; font-size: 12px; min-height: 26px; }
.btn[disabled], .btn.is-busy { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn.is-busy { opacity: .85; }
.btn.is-applied { border-color: var(--green); color: var(--green); }
.btn.success.is-applied, .btn.primary.is-applied { color: #fff; }
.btn .spinner { display: none; }
.btn.is-busy .spinner { display: inline-block; }
.btn.is-busy .ico, .btn.is-live .ico { display: none; }
/* steady "Live" state: pulsing dot, no rotating spinner (spinner = something is still in progress) */
.btn.is-live .spinner { display: inline-block; border: 0; background: currentColor; width: .6em; height: .6em; animation: pulse 1.2s infinite; }
.settings.is-locked .form { opacity: .6; }
button.linklike { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; } button.linklike:hover { color: var(--text); }
form.inline { display: inline; } .inline-form { display: flex; gap: 8px; align-items: center; margin: 8px 0 16px; flex-wrap: wrap; } .inline-form input, .inline-form select { margin: 0; width: auto; }
.inline-form.compact { margin: 0; gap: 6px; } .inline-form.compact select { min-height: 28px; padding: 2px 6px; font-size: 12px; max-width: 12rem; }
.alert { padding: 10px 14px; border-radius: var(--radius-s); margin: 12px 0; border: 1px solid var(--line); background: #fff; }
.alert.error { border-color: var(--red-line); background: var(--red-bg); color: var(--red-2); }
.alert.ok { border-color: #86efac; background: var(--green-bg); color: var(--green-2); }
.alert.warn { border-color: var(--amber-line); background: var(--amber-bg); color: var(--amber-text); }
.alert.small { font-size: 13px; }
.note { background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--amber-text); border-radius: var(--radius-s); padding: 10px 12px; font-size: 13px; margin: 0 0 14px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .mono { font-family: var(--mono); font-size: .93em; } .big { font-size: 1.4rem; letter-spacing: .12em; } .wrap { word-break: break-all; } .nowrap { white-space: nowrap; }
.text-danger { color: var(--red); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 6px 0 14px; font-size: 13px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; vertical-align: middle; margin-right: 6px; } .dot.on { background: var(--green); } .dot.off { background: var(--red); }

/* ---- spinner ---- */
.spinner { width: .85em; height: .85em; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; flex: none; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 1.6s; } .pill.live .dot, .pill.enc-live .dot { animation: none !important; } }

/* ---- pills / badges ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; line-height: 1.3; }
.pill .dot { margin: 0; width: 7px; height: 7px; }
.pill.small { font-size: 11px; padding: 1px 8px; }
.pill.ok, .pill-ok { color: var(--green); background: var(--green-bg); }
.pill.off, .pill-muted { color: var(--muted); background: #f3f4f6; }
.pill-danger { color: var(--red); background: var(--red-bg); }
.pill-accent { color: var(--blue); background: var(--blue-bg); }
.pill.kind-mobile { color: var(--blue); background: var(--blue-bg); vertical-align: 2px; margin-left: 4px; }
.pill.kind-guest { color: #6d28d9; background: #f5f3ff; vertical-align: 2px; margin-left: 4px; }
.api-key-form { align-items: center; gap: 8px; margin: 8px 0 12px; flex-wrap: wrap; } .api-key-form select, .api-key-form input[type=text] { min-width: 200px; }
.pill.warn, .pill.starting, .pill.stopping { color: var(--amber); background: var(--amber-bg); }
.pill.err { color: var(--red); background: var(--red-bg); }
.pill.live { color: #fff; background: var(--red); } .pill.live .dot { background: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
/* encoder pill (row + detail) */
.pill.enc .spinner { display: none; }
.pill.enc-idle { color: var(--muted); background: #f3f4f6; } .pill.enc-idle .dot { display: none; }
.pill.enc-live { color: #fff; background: var(--red); text-transform: none; } .pill.enc-live .dot { background: #fff; animation: pulse 1.2s infinite; }
.pill.enc-starting, .pill.enc-stopping { color: var(--amber); background: var(--amber-bg); } .pill.enc-starting .dot, .pill.enc-stopping .dot { display: none; } .pill.enc-starting .spinner, .pill.enc-stopping .spinner { display: inline-block; }
.pill.enc-error { color: var(--red); background: var(--red-bg); } .pill.enc-error .dot { display: none; }
/* legacy names still used by the stream page */
.pill-enc.pill-enc-live { color: #fff; background: var(--red); }
.badge { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: #fff; white-space: nowrap; }
.badge.online.on { border-color: #86efac; color: var(--green); background: var(--green-bg); } .badge.online.off { border-color: var(--red-line); color: var(--red); background: var(--red-bg); }
.badge.streaming.on { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }

/* ---- Encoders page: toolbar + table (ported from design/dashboard-mockup.html) ---- */
.toolbar { display: flex; gap: 10px; align-items: center; margin: 16px 0 12px; flex-wrap: wrap; }
.toolbar .sp { flex: 1; }
.toolbar select, .toolbar input { margin: 0; width: auto; min-height: 36px; border-color: var(--line); }
.toolbar input[type=search] { width: 260px; max-width: 100%; }
.tablewrap { min-width: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .02em; font-weight: 600; }
td.actions { white-space: nowrap; } td.actions form { margin-right: 4px; }

/* Fixed layout: the first row's widths decide the columns, so the table can never grow wider than the page. Text that
   can grow (device name/meta, firmware, last seen) is clipped with an ellipsis; link chips wrap inside their cell. */
table.devices { table-layout: fixed; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.devices th { padding: 12px 12px; background: var(--card-2); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.devices td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; min-width: 0; }
table.devices tbody tr:last-child td { border-bottom: 0; }
table.devices .col-chev { width: 28px; padding-left: 12px; padding-right: 0; }
table.devices .col-dev { width: 18%; }
table.devices .col-status { width: 96px; }
table.devices .col-enc { width: 156px; }
table.devices .col-temp { width: 92px; }
table.devices .col-fw { width: 180px; }
table.devices .col-seen { width: 112px; }
table.devices .col-act { width: 156px; text-align: right; white-space: nowrap; overflow: visible; padding-right: 12px; }
td.col-act .row-actions { display: inline-flex; flex-wrap: nowrap; justify-content: flex-end; gap: 6px; }
td.col-act .btn { flex: 0 0 auto; padding: 7px 12px; min-height: 34px; }
td.col-act .btn.ghost { padding: 7px 8px; }
tr.row { cursor: pointer; }
tr.row:hover td { background: #fafbff; }
tr.row.open td { background: var(--blue-bg); border-bottom-color: transparent; }
tr.row:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
td.chev { color: var(--muted); } .chevron { display: inline-block; transition: transform .15s; } tr.row.open .chevron { transform: rotate(90deg); }
td.dev { overflow: hidden; }
td.dev b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
td.dev small { display: block; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
td.dev small .pill.small { vertical-align: 1px; }
td.dev .dev-session { margin-top: 2px; }
td.col-status, td.col-enc { overflow: hidden; }
td.links { overflow: hidden; }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; font-size: 12px; margin: 2px 4px 2px 0; background: #fff; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.chip .d { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex: none; } .chip.is-off .d { background: var(--line-2); }
.chip.is-off { color: var(--muted); }
.chip-name { overflow: hidden; text-overflow: ellipsis; }
.chip-tx { flex: none; } .chip-tx b { font-weight: 600; font-variant-numeric: tabular-nums; }
td.temp, td.col-fw, td.col-seen { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
td.col-fw { font-size: 12.5px; }
td.temp.hot, .temp.hot { color: var(--amber); font-weight: 600; }
td.act { white-space: nowrap; text-align: right; overflow: hidden; }
td.act .btn { vertical-align: middle; }
.btn-start, .btn-stop { min-width: 92px; }
.icon { border: 0; background: none; font-size: 18px; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 6px; line-height: 1; vertical-align: middle; }
.icon:hover { background: #f3f4f6; color: var(--text); }
.menu { position: relative; display: inline-block; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); min-width: 180px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-s); box-shadow: 0 8px 24px rgba(16,24,40,.12); padding: 6px; z-index: 30; text-align: left; white-space: nowrap; }
.menu-list button, .menu-list a { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; font: inherit; color: var(--text); cursor: pointer; }
.menu-list button:hover, .menu-list a:hover { background: #f3f4f6; text-decoration: none; }
.menu-list button[disabled] { color: var(--line-2); cursor: not-allowed; }

/* ---- expanded detail: left = preview + stats + controls, right = tabs (mockup .panel) ---- */
tr.detail td { overflow: visible; padding: 0; background: #fff; border-bottom: 1px solid var(--line); overflow: visible; }
tr.detail td, tr.detail td .panel { white-space: normal; text-align: left; }
.panel { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 0; border-top: 1px solid var(--line); width: 100%; min-width: 0; }
.preview { padding: 18px; border-right: 1px solid var(--line); background: var(--card-2); min-width: 0; }
.player { aspect-ratio: 16 / 9; background: #0b0f19; border-radius: var(--radius-s); position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #9ca3af; }
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.player .poster { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 13px; color: #9ca3af; pointer-events: none; }
.player .poster-icon { font-size: 28px; opacity: .5; }
.player[data-connected="1"] .poster { display: none; }
.player .badge { position: absolute; top: 10px; left: 10px; text-transform: none; letter-spacing: 0; }
.player .ctl { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 6px; }
.player .ctl button { background: rgba(0,0,0,.55); color: #fff; border: 0; border-radius: 6px; padding: 4px 8px; font-size: 12px; cursor: pointer; }
.player .ctl button:hover { background: rgba(0,0,0,.8); }
.player:not([data-connected="1"]) .ctl { display: none; }
.player:fullscreen { border-radius: 0; }
.stats { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 10px; margin-top: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; min-width: 0; display: flex; flex-direction: column; }
.stat small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.stat b { font-size: 18px; display: block; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.35; }
.stat b .unit { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat .small { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spark { display: block; width: 100%; height: 28px; margin-top: 4px; overflow: visible; }
.spark.is-empty .spark-dot { display: none; }
.spark-line { fill: none; stroke: var(--blue); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-dot { fill: var(--blue); }
tr.row[data-phase=live] + tr.detail .spark-dot { fill: var(--red); }
.dev-alert { display: flex; align-items: flex-start; gap: 8px; margin: 14px 0 0; padding: 9px 12px; border-radius: var(--radius-s); border: 1px solid var(--red-line); background: var(--red-bg); color: var(--red-2); font-size: 13px; }
.dev-alert-icon { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 800; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.dev-alert-text { flex: 1; word-break: break-word; }
.dev-alert-close { background: none; border: 0; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; opacity: .7; } .dev-alert-close:hover { opacity: 1; }
.dev-alert.is-warn { border-color: var(--amber-line); background: var(--amber-bg); color: var(--amber-text); } .dev-alert.is-warn .dev-alert-icon { background: var(--amber); }
.preview .note { margin: 14px 0 0; }
.ctrl { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; overflow: visible; }
.ctrl .btn { padding: 10px 18px; font-size: 15px; }
.ctrl .btn-start, .ctrl .btn-stop { min-width: 0; }
.ctrl .sp { flex: 1; }
.ctrl .btn-reboot { font-size: 14px; padding: 8px 14px; }
.bit { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.bit label { margin: 0; white-space: nowrap; font-size: 13px; }
.bit input[type=range] { flex: 1; min-width: 60px; margin: 0; accent-color: var(--blue); }
.bit input[type=number] { width: 84px; flex: none; margin: 0; min-height: 34px; padding: 6px 8px; border-color: var(--line); border-radius: 6px; }
.bit .btn { flex: none; }
.tabs-pane { min-width: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 18px; overflow-x: auto; }
.tabs [role=tab] { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 12px 12px; color: var(--muted); font: inherit; cursor: pointer; white-space: nowrap; }
.tabs [role=tab]:hover { color: var(--text); }
.tabs [role=tab].on { color: var(--blue); border-color: var(--blue); font-weight: 600; }
.tabbody { padding: 18px 22px; min-width: 0; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; }
.form label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 5px; font-weight: 600; }
.form select, .form input { width: 100%; margin: 0; padding: 9px 10px; border-color: var(--line); }
.form .full { grid-column: 1 / -1; }
.formfoot { display: flex; gap: 8px; margin-top: 16px; align-items: center; flex-wrap: wrap; }
.formfoot .hint { margin: 0; }
.formfoot .ok { color: var(--green); font-size: 13px; }
.formfoot .apply-note { margin-left: auto; font-size: 12px; text-align: right; }
table.sub { width: 100%; }
table.sub th { padding: 8px 10px; font-size: 11px; }
table.sub td { padding: 9px 10px; vertical-align: middle; }
.link-row .link-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 8px; box-shadow: 0 0 0 3px var(--green-bg); }
.link-row.is-off .link-dot { background: var(--line-2); box-shadow: none; }
.link-row.is-off .link-name, .link-row.is-off .link-tx { color: var(--muted); }
.link-tx b { font-weight: 600; font-variant-numeric: tabular-nums; }
.toggle { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; cursor: pointer; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; }
.toggle-track { width: 32px; height: 18px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.toggle-knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle[aria-checked=true] .toggle-track { background: var(--green); } .toggle[aria-checked=true] .toggle-knob { left: 16px; }
.toggle[aria-checked=true] { color: var(--green); }
.toggle.is-busy { opacity: .5; pointer-events: none; }
.urls { display: flex; flex-direction: column; gap: 6px; }
.url { display: flex; align-items: center; gap: 8px; min-width: 0; }
.url .lbl { width: 56px; flex: none; color: var(--muted); font-size: 12px; font-weight: 600; }
.url code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; background: var(--card-2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url .btn { flex: none; }
.btn.is-copied { border-color: var(--green); color: var(--green); }
.viewer-keys { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.viewer-keys li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card-2); }
.viewer-keys li b { font-weight: 600; }
.viewer-key-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.viewer-key-form input, .viewer-key-form select { margin: 0; width: auto; }
.viewer-key-form input[type=text] { flex: 1; min-width: 160px; }
.viewer-key-form input[type=number] { width: 120px; }
.cmdlog { margin: 0; max-height: 16rem; overflow: auto; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; color: var(--text); background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; min-height: 3rem; }

/* ---- admin tables ---- */
tr.drawer-row td { padding: 0 8px 6px; border-bottom: 1px solid var(--line-2); }
tr.row-dim { opacity: .6; }
details.drawer summary { cursor: pointer; color: var(--muted); font-size: 12.5px; padding: 4px 0; }
details.drawer summary:hover { color: var(--text); }
pre.raw { margin: 6px 0 8px; padding: 10px 12px; background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-s); font-family: var(--mono); font-size: 12px; max-height: 22rem; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.custom-table td { vertical-align: top; }
.profiles-table td b { font-weight: 600; }
.secret { cursor: pointer; } .secret:hover { color: var(--blue); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 16px; }

/* accounts / entitlements */
.nav-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--amber); color: #fff; font-size: 11px; font-weight: 700; text-align: center; vertical-align: middle; line-height: 18px; }
.badge.benched { border-color: var(--amber-line); color: var(--amber); background: var(--amber-bg); }
.badge.approval.pending { border-color: var(--amber-line); color: var(--amber); background: var(--amber-bg); }
.badge.approval.approved { border-color: #86efac; color: var(--green); background: var(--green-bg); }
.badge.approval.rejected { border-color: var(--red-line); color: var(--red); background: var(--red-bg); }
.ent { display: inline-block; min-width: 2.2rem; text-align: center; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); }
.ent.on { border-color: #86efac; color: var(--green); background: var(--green-bg); }
.actions-wrap { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.plan-form { display: inline-flex; gap: 4px; align-items: center; }
.plan-form input { width: 6rem; margin: 0; }
.audit td { vertical-align: top; }

/* ---- responsive: columns drop out instead of the table growing; the page never scrolls sideways ---- */
@media (max-width: 1199px) {
  table.devices .col-temp, table.devices .col-fw { display: none; }
}
@media (max-width: 900px) {
  .container { padding: 16px; }
  .topbar { padding: 0 16px; gap: 16px; }
  table.devices .col-links, table.devices .col-seen { display: none; }
  table.devices .col-dev { width: auto; }
  table.devices .col-act { width: 120px; }
  .panel { grid-template-columns: 1fr; }
  .preview { border-right: 0; border-bottom: 1px solid var(--line); }
  .form { grid-template-columns: 1fr; }
  .ctrl { flex-wrap: wrap; } .ctrl .btn-start, .ctrl .btn-stop { flex: 1 1 40%; min-height: 44px; } .ctrl .sp { display: none; } .ctrl .btn-reboot { flex: 1 1 100%; }
  .bit { flex-wrap: wrap; } .bit input[type=range] { flex-basis: 100%; order: 5; }
  td.act .btn-start, td.act .btn-stop { min-width: 0; padding: 6px 10px; }
  td.act .btn .label { display: none; } td.act .btn .ico { display: inline; }
  .toolbar input[type=search] { width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dt { margin-top: 6px; }
  .url { flex-wrap: wrap; } .url code { flex-basis: 100%; }
  .formfoot .apply-note { margin-left: 0; flex-basis: 100%; text-align: left; }
}
@media (max-width: 600px) {
  table.devices th, table.devices td { padding: 10px 8px; }
  table.devices .col-chev { width: 22px; padding-left: 8px; }
  table.devices .col-status { display: none; }
  table.devices .col-enc { width: 140px; }
  table.devices .col-act { width: 100px; }
  .topbar { height: auto; min-height: 56px; flex-wrap: wrap; padding: 8px 16px; gap: 8px 16px; } .topbar nav { flex-basis: 100%; }
  /* the Status column is gone: an online dot in front of the name carries it */
  td.dev b::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); margin-right: 6px; vertical-align: 1px; }
  tr.row[data-online="1"] td.dev b::before { background: var(--green); }
  td.dev small:not(.dev-session) { display: none; } /* model / serial live in the Device tab */
  .preview, .tabbody { padding: 14px; }
  .tabs { padding: 0 8px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .topbar nav { gap: 12px; font-size: 13px; }
}

/* ---- USB modems (Network tab) ---- */
.subhead { margin: 18px 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sig { display: inline-flex; align-items: center; gap: 8px; }
.sigbar { position: relative; width: 64px; height: 8px; border-radius: 4px; background: #e5e7eb; overflow: hidden; }
.sigbar i { position: absolute; inset: 0; width: var(--sig, 0%); background: var(--green); border-radius: 4px; }
.sig b { font-weight: 600; font-variant-numeric: tabular-nums; }
.chip.modem .d { background: var(--amber); }

/* ---- admin pages: same table as the Encoders page (table.devices) + a few admin-only bits ---- */
.fleet-card .fleet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.fleet-card .fleet-head h2 { margin: 0 0 4px; }
.fleet-stats { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); }
.fleet-stats .stat { display: inline-flex; align-items: center; gap: 4px; }
.fleet-stats .stat.live { color: var(--red); font-weight: 600; }
.fleet-stats .stat.warn { color: var(--amber-text); }
.fleet-toggle { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; cursor: pointer; margin-top: 6px; }
.fleet-toggle input { margin: 0; }
.tablewrap { overflow-x: visible; }
table.devices tr.row-static td { vertical-align: top; }
table.devices tr.row-static td.dev b { white-space: normal; }
table.devices tr.row-static small.dev-meta { display: block; margin-top: 2px; }
table.devices tr.row-static .pill + small.dev-meta { margin-top: 5px; }
table.devices tr.row-static td.col-status .pill.small, table.devices tr.row-static td.col-enc .pill.small { margin-top: 4px; }
table.devices.admin-fleet .col-dev { width: 26%; } table.devices.admin-fleet .col-status { width: 14%; } table.devices.admin-fleet .col-enc { width: 20%; } table.devices.admin-fleet .col-fw { width: 16%; } table.devices.admin-fleet .col-seen { width: 10%; } table.devices.admin-fleet .col-act { width: 14%; }
table.devices.admin-accounts .col-dev { width: 27%; } table.devices.admin-accounts .col-status { width: 14%; } table.devices.admin-accounts .col-ent { width: 16%; } table.devices.admin-accounts .col-plan { width: 22%; } table.devices.admin-accounts .col-n { width: 7%; } table.devices.admin-accounts .col-act { width: 14%; }
table.devices tr.is-retired, table.devices tr.drawer-row.is-retired { display: none; }
.fleet-card:has(#show-retired:checked) table.devices tr.is-retired { display: table-row; }
table.devices tr.is-suspended td { background: var(--red-bg); }
table.devices tr.drawer-row td { padding: 0 12px 8px; background: #fff; }
table.devices tr.drawer-row td details.drawer summary { font-size: 12px; }
td.act form.inline { display: inline-block; vertical-align: middle; margin: 0 2px 0 0; }
td.act .menu { vertical-align: middle; }
.menu-list.menu-wide { min-width: 300px; }
.menu-list form { margin: 0; display: block; }
.menu-list button .mi-label { display: block; font-weight: 600; font-size: 13px; }
.menu-list button .mi-hint { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.menu-list button.danger .mi-label { color: var(--red); } .menu-list button.danger:hover { background: var(--red-bg); }
.menu-list button.warn .mi-label { color: var(--amber-text); } .menu-list button.warn:hover { background: var(--amber-bg); }
.menu-list button.ok .mi-label { color: var(--green-2); }
.ent-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--text); margin: 0 0 4px; }
.ent-toggle:hover { border-color: var(--line-2); background: #f9fafb; }
.ent-toggle.off { color: var(--muted); }
td.col-ent form { display: block; margin: 0; }
td.col-plan .plan-form { display: inline-flex; gap: 6px; align-items: center; }
td.col-plan .plan-form select { min-height: 32px; padding: 3px 8px; font-size: 12.5px; width: auto; margin: 0; }
td.col-plan .plan-form .btn { min-height: 32px; padding: 4px 10px; }
td.col-plan .plan-hint { margin-top: 4px; line-height: 1.35; white-space: normal; }
details.legend { margin-top: 14px; }
details.legend summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details.legend summary:hover { color: var(--text); }
.legend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px 20px; margin: 10px 0 4px; }
.legend-grid div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-s); }
.legend-grid b { font-size: 13px; }
.legend-grid span { color: var(--muted); line-height: 1.45; }
@media (max-width: 900px) { table.devices.admin-fleet .col-fw, table.devices.admin-fleet .col-seen { display: none; } .menu-list.menu-wide { min-width: 240px; } }

/* ---- Wi-Fi (Network tab) ---- */
.wifi-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.wifi-scan { margin: 8px 0 12px; }
.wifi-scan table.sub td { padding: 6px 10px; }
.wifi-join, .wifi-hotspot { margin: 6px 0 12px; }
.wifi-join input[type=text], .wifi-hotspot input[type=text] { min-width: 14rem; }
.wifi-join input[type=password], .wifi-hotspot input[type=password] { min-width: 12rem; }
.wifi-msg { margin: 6px 0 10px; font-size: 13px; }
.hotspot-creds { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0 8px; font-size: 13px; }
.hotspot-creds .secret { cursor: pointer; letter-spacing: .05em; }
.hotspot-creds .secret:hover { color: var(--blue); }
