*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font: 14px/1.45 var(--font); color: var(--text); display: flex; flex-direction: column; overflow: hidden; -webkit-text-size-adjust: 100%; background: var(--bg); font-size: 13px; line-height: 1.4; font-feature-settings: "tnum" 1;
}
h1, h2 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
code {
  font-family: var(--mono); font-size: .92em; background: var(--surface-3); padding: 1px 5px; border-radius: 4px;
}
kbd {
  font-family: var(--mono); border: 1px solid var(--border); border-radius: 4px; color: var(--muted); margin-left: 0; padding: 0 4px; font-size: 10.5px; background: var(--inset); border-color: var(--border); border-bottom-width: 1px;
}
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.spacer { flex: 1 1 auto; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.vr { width: 1px; align-self: stretch; margin: 4px 4px; background: var(--border); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic {
  flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; width: 17px; height: 17px;
}
.ic.sm { width: 15px; height: 15px; }
.ic.xl { width: 44px; height: 44px; stroke-width: 1.4; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 600; letter-spacing: .2px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; box-shadow: none; }
.tabs { display: flex; gap: 4px; margin-left: 10px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; transition: background .15s, color .15s, transform .1s;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.dot { border-radius: 50%; background: var(--faint); flex: none; width: 9px; height: 9px; }
.dot[data-state="checking"] { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
main { flex: 1 1 auto; min-height: 0; display: flex; }
.view {
  flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: auto; padding: 14px 18px; gap: 12px;
}
#view-files, #view-terminal { overflow: hidden; }
.view-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.view-head p { margin: 4px 0 0; }
.view-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.device-card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
}
.device-top { display: flex; gap: 10px; align-items: flex-start; }
.device-sub { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.device-menu { margin-left: auto; display: flex; gap: 2px; align-self: flex-start; }
.chips { display: flex; flex-wrap: wrap; min-height: 24px; align-items: center; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; font-weight: 600; white-space: nowrap; line-height: 1.4; border-radius: 4px; padding: 1px 8px; font-size: 11.5px;
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.chip.plain::before { display: none; }
.device-actions { margin-top: auto; flex-wrap: wrap; }
.empty {
  margin: auto; max-width: 440px; text-align: center; display: grid; gap: 10px; justify-items: center; padding: 40px 10px; color: var(--muted);
}
.empty p { margin: 0; }
.seg { display: inline-flex; gap: 2px; border-radius: 10px; padding: 2px; border: 1px solid var(--border); }
.seg button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 650; cursor: pointer; transition: background .12s, color .12s;
}
.seg button:disabled { opacity: .5; cursor: not-allowed; }
.field-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; }
.field-inline input { width: 82px; }
.notice {
  margin: 0; padding: 6px 12px; color: var(--warn); font-size: 12.5px; border-radius: 9px; border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); border-left-width: 4px;
}
.notice.safe { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.pane-switch { display: none; gap: 4px; padding: 3px; background: var(--surface-3); border-radius: var(--radius-sm); }
.pane-switch button {
  flex: 1; min-height: 34px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font: inherit; font-weight: 650; cursor: pointer;
}
.commander { flex: 1 1 0; min-height: 220px; display: grid; gap: 0; }
.pane {
  display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow); border-radius: var(--radius);
}
.pane.drop { outline: 2px dashed var(--accent); outline-offset: -4px; }
.pane-head {
  display: grid; grid-template-columns: minmax(0, 1fr); border-bottom: 1px solid var(--border); border-radius: 14px 14px 0 0; padding: 6px 8px; gap: 6px; background: var(--surface-2);
}
.pane-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; }
.pathbar { display: flex; align-items: center; gap: 2px; }
.path-input { flex: 1 1 auto; font-family: var(--mono); min-height: 28px; font-size: 12.5px; }
.filterbar { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.filterbar .filter-input { flex: 1; }
.filterbar.compact .filter-input { width: 180px; flex: none; }
.check { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; white-space: nowrap; cursor: pointer; }
.table-wrap { position: relative; flex: 1 1 auto; min-height: 0; overflow: auto; outline: none; }
.table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
table.files { width: 100%; border-collapse: collapse; table-layout: fixed; }
.files th {
  text-align: left; border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; white-space: nowrap; position: sticky; top: 0; z-index: 1; backdrop-filter: blur(6px); padding: 6px 10px; font-size: 11.5px; font-weight: 650; text-transform: none; letter-spacing: 0; color: var(--faint); background: var(--surface-2);
}
.files th:hover { color: var(--text); }
.files th[data-dir="asc"]::after { content: " ▲"; font-size: 9px; }
.files th[data-dir="desc"]::after { content: " ▼"; font-size: 9px; }
.files th:nth-child(1) { width: auto; }
.files th:nth-child(2) { width: 84px; }
.files th:nth-child(3) { width: 138px; }
.files th:nth-child(4) { width: 66px; }
.files td {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; height: 30px; padding: 0 10px; border-bottom: 1px solid transparent;
}
.files .num { text-align: right; font-variant-numeric: tabular-nums; }
.files tr.row { cursor: default; user-select: none; }
.files tr.row.focus td { outline-offset: -1px; }
.files tr.row.dragging { opacity: .5; }
.files td.name { align-items: center; gap: 9px; overflow: hidden; height: 30px; border-bottom: 1px solid transparent; }
.files td.name span { overflow: hidden; text-overflow: ellipsis; }
.files .ic.file-ic { color: var(--faint); }
.files .ic.link-ic { color: var(--accent-ink); }
.files td.mode { font-family: var(--mono); color: var(--muted); }
.files td.muted { color: var(--muted); }
.pane-empty {
  position: absolute; inset: 40px 0 0; display: grid; place-content: center; text-align: center; color: var(--muted); padding: 20px; pointer-events: none;
}
.pane-foot {
  color: var(--muted); border-top: 1px solid var(--border); background: var(--surface-2); padding: 4px 12px; font-size: 12px;
}
.bridge {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 0 4px;
}
.actionbar {
  align-items: center; display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 2px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.hint { color: var(--muted); font-size: 12.5px; }
.only-mobile { display: none; }
.queue {
  --queue-h: 280px; position: relative; flex: 0 0 auto; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); overflow: hidden;
}
.queue:not(.empty):not(.collapsed) { height: auto; max-height: clamp(96px, 24vh, 180px); }
.queue.sized:not(.empty):not(.collapsed) { height: clamp(96px, var(--queue-h), 72vh); max-height: none; }
.queue.dragging-size { user-select: none; }
.queue-resize {
  position: absolute; z-index: 2; left: 0; right: 0; top: -3px; height: 9px; cursor: ns-resize; touch-action: none;
}
.queue-resize::after {
  content: ""; position: absolute; left: 50%; top: 3px; width: 44px; height: 3px; margin-left: -22px; border-radius: 99px; background: var(--border); transition: background .15s;
}
.queue-resize:hover::after, .queue-resize:focus-visible::after, .queue.dragging-size .queue-resize::after { background: var(--accent); }
.queue.empty .queue-resize, .queue.collapsed .queue-resize { display: none; }
.queue-head {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 3px 8px 3px 12px; background: var(--surface-2); min-height: 32px;
}
.transfer-list { flex: 1 1 auto; overflow: auto; min-height: 0; scrollbar-width: thin; overscroll-behavior: contain; }
.transfer[data-pending] .t-dir { background: var(--warn-soft, var(--accent-soft)); color: var(--warn, var(--accent-ink)); }
.transfer .t-tag {
  flex: none; font-size: 11px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--accent-ink); background: var(--accent-soft); border-radius: 99px; padding: 1px 7px;
}
.devicebar {
  display: flex; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px;
}
.devicebar[hidden] { display: none; }
.devicebar .hint { min-width: 0; flex: 1 1 260px; }
body.browser-files .commander { grid-template-columns: minmax(0, 1fr); }
body.browser-files .commander .bridge, body.browser-files #localPane, body.browser-files #paneSwitch, body.browser-files #btnTransferActive { display: none; }
body.browser-files .actionbar .hint { display: none; }
.pane.drop-os { outline: 2px dashed var(--accent); outline-offset: -4px; }
.queue-head h2 { margin: 0; }
.queue-head .muted { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.queue-head .btn.sm { min-height: 26px; padding: 0 9px; }
.queue:not(.empty):not(.collapsed) .queue-head { border-bottom: 1px solid var(--border); }
.queue.empty .transfer-list, .queue.collapsed .transfer-list, .queue.empty #transferClear { display: none; }
.transfer {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0 10px; align-items: center; padding: 5px 10px 5px 12px; border-bottom: 1px solid var(--surface-3);
}
.transfer:last-child { border-bottom: 0; }
.t-dir {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-ink);
}
.transfer[data-state="completed"] .t-dir { background: var(--ok-soft); color: var(--ok); }
.transfer[data-state="failed"] .t-dir, .transfer[data-state="cancelled"] .t-dir { background: var(--bad-soft); color: var(--bad); }
.t-main { min-width: 0; display: grid; gap: 3px; }
.t-top { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.t-name {
  flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.t-meta { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.t-meta.err { color: var(--bad); white-space: normal; flex: 1 1 auto; }
.t-meta.warn { color: var(--warn); white-space: normal; flex: 1 1 auto; }
.transfer[data-state="failed"] .t-top .t-meta { color: var(--bad); }
.bar { height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i {
  display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .25s;
}
.transfer[data-state="completed"] .bar > i { background: var(--ok); }
.transfer[data-state="failed"] .bar > i, .transfer[data-state="cancelled"] .bar > i { background: var(--bad); }
.bar.indeterminate > i { width: 35%; animation: slide 1.1s linear infinite; }
@keyframes slide { from { margin-left: -35%; } to { margin-left: 100%; } }
.t-actions { display: flex; gap: 2px; }
.termtabs { display: flex; align-items: center; gap: 6px; min-width: 0; }
.termtabs-list { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; min-width: 0; padding-bottom: 2px; }
.tt {
  display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 4px 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); cursor: pointer; white-space: nowrap; flex: none; max-width: 240px;
}
.tt:hover { background: var(--surface-2); }
.tt.active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.tt .dot { width: 8px; height: 8px; box-shadow: none !important; }
.tt-label {
  overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 13px; margin: 0 4px 0 6px; border: 0; background: transparent; color: inherit; font-family: inherit; cursor: pointer; padding: 0;
}
.termframe {
  flex: 1 1 0; min-height: 200px; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #0b0e10;
}
.termframe[data-theme="black"] { background: #000000; }
.termframe[data-theme="light"] { background: #fbfcfc; }
.termtools {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 4px 6px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.termtools .mini-select { min-height: 30px; margin-left: 6px; }
.font-size {
  min-width: 24px; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--muted);
}
.screens { position: relative; flex: 1 1 0; min-height: 0; padding: 6px 4px 4px 8px; }
.terminal-screen { position: absolute; inset: 6px 4px 4px 8px; }
.terminal-screen .xterm { height: 100%; padding: 0; }
.terminal-screen .xterm-viewport { background: transparent !important; }
.quickkeys {
  display: none; flex-wrap: wrap; gap: 6px; padding: 6px; background: var(--surface); border-top: 1px solid var(--border);
}
.quickkeys button {
  min-width: 44px; min-height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.termframe:fullscreen { border-radius: 0; }
dialog {
  padding: 0; background: transparent; color: var(--text); width: 100%; max-width: min(540px, calc(100vw - 24px));
}
.dialog-card { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.field { display: grid; gap: 5px; }
.field input, .field select { width: 100%; }
.input-row { display: flex; gap: 4px; align-items: center; }
.input-row input { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.advanced summary { cursor: pointer; font-weight: 650; color: var(--muted); padding: 0; }
.form-error {
  margin: 0; padding: 8px 10px; background: var(--bad-soft); color: var(--bad); font-size: 13px; border-radius: 9px;
}
.ask-message { margin: 0; white-space: pre-wrap; word-break: break-word; color: var(--muted); }
.ask-message:empty { display: none; }
.ask-message code { white-space: pre-wrap; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.badge:empty { display: none; }
#editorDialog { max-width: min(1000px, calc(100vw - 24px)); }
.editor-card { gap: 10px; }
.editor-head { display: flex; align-items: flex-start; gap: 12px; }
.editor-title { min-width: 0; flex: 1; display: grid; gap: 2px; }
.editor-title h2 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.editor-title code { color: var(--muted); font-size: 12.5px; }
.editor-text {
  width: 100%; height: min(62vh, 640px); min-height: 240px; resize: vertical; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-family: var(--mono); font-size: 13.5px; line-height: 1.5; tab-size: 4; white-space: pre; overflow: auto;
}
.editor-text[wrap="soft"] { white-space: pre-wrap; overflow-wrap: anywhere; }
.editor-text:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.editor-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.editor-status { flex: 1; min-width: 120px; }
.editor-status[data-kind="ok"] { color: var(--ok); }
.editor-status[data-kind="error"] { color: var(--bad); }
.editor-cursor { font-family: var(--mono); }
@media (max-width: 640px) {
  #editorDialog { max-width: 100vw; }
  .editor-text { height: 56vh; font-size: 14px; }
}
.menu {
  position: fixed; z-index: 50; min-width: 200px; max-width: 320px; max-height: 70vh; overflow: auto; padding: 5px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); backdrop-filter: blur(10px); animation: dlgIn .14s var(--ease); border-radius: 12px;
}
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 0 10px; border: 0; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; border-radius: 8px;
}
.menu button:hover:not(:disabled), .menu button:focus-visible { background: var(--accent-soft); outline: none; }
.menu button:disabled { opacity: .4; cursor: not-allowed; }
.menu button.danger { color: var(--bad); }
.menu button .sub {
  margin-left: auto; color: var(--muted); font-size: 12px; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
.menu hr { margin: 4px 2px; border: 0; border-top: 1px solid var(--border); }
.menu .label {
  padding: 5px 10px 3px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--faint);
}
.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 80; max-width: min(560px, calc(100vw - 24px)); padding: 10px 16px; transform: translate(-50%, 24px); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; backdrop-filter: blur(10px); display: flex; align-items: center; gap: 10px; border-radius: var(--radius); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 1100px) {
  .hide-sm { display: none; }
  .files th:nth-child(1) { width: auto; }
}
@media (max-width: 900px) {
  .brand-name { display: none; }
  .tab span { display: none; }
  .tab { padding: 0 11px; }
  .pane-switch { display: flex; }
  .commander { grid-template-rows: minmax(0, 1fr); flex: none; height: 68vh; min-height: 360px; }
  .commander .bridge { display: none; }
  .commander[data-active-pane="remote"] #localPane, .commander[data-active-pane="local"] #remotePane { display: none; }
  .only-mobile { display: inline-flex; }
  .actionbar .hint { display: none; }
  .quickkeys { display: flex; }
  .grid2 { grid-template-columns: 1fr; }
  #view-files { overflow: auto; padding: 6px; }
  .queue { flex: none; }
  .queue:not(.empty):not(.collapsed) { height: auto; max-height: clamp(96px, 26vh, 180px); }
  .queue.sized:not(.empty):not(.collapsed) { height: clamp(96px, var(--queue-h), 60vh); max-height: none; }
  .devicebar .btn { flex: 1 1 140px; }
}
@media (max-width: 480px) {
  .files th:nth-child(2) { width: 70px; }
  .filterbar.compact { display: none; }
  .pane-head .check { display: none; }
}
@media (hover: none) {
  .quickkeys { display: flex; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.login-card {
  width: min(400px, 100%); display: grid; gap: 14px; padding: 28px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
}
.login-card h1 { margin: 0; font-size: 20px; }
.login-card p { margin: 0; }
.login-card .btn { justify-content: center; min-height: 40px; }
#scanDialog { max-width: min(620px, calc(100vw - 24px)); }
.scan-card { gap: 10px; }
.scan-card h2, .scan-card p { margin: 0; }
.scan-form { display: flex; gap: 8px; align-items: flex-end; }
.scan-form .field { flex: 1; min-width: 0; }
.scan-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 46vh; overflow: auto; }
.scan-results li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
}
.scan-host { flex: 1; min-width: 0; display: grid; gap: 2px; }
.scan-host b { font-family: var(--mono); font-size: 14px; }
.scan-host small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-tags { display: flex; gap: 4px; flex-wrap: wrap; }
#bouquetDialog { max-width: min(1040px, calc(100vw - 24px)); }
#bqDir { width: 190px; }
.bq-body { display: grid; min-height: 0; grid-template-columns: minmax(200px, 270px) minmax(0, 1fr); gap: 14px; }
.bq-side, .bq-main { display: grid; align-content: start; min-width: 0; gap: 8px; }
.bq-list, .bq-entries {
  list-style: none; margin: 0; padding: 0; border: 1px solid var(--border-strong); height: clamp(260px, 52vh, 620px); overflow: auto; background: var(--surface); border-radius: var(--radius); border-color: var(--border); box-shadow: var(--shadow);
}
.bq-list li { display: flex; gap: 8px; cursor: pointer; user-select: none; transition: background .08s; }
.bq-entries li { display: flex; align-items: center; cursor: pointer; user-select: none; transition: background .08s; }
.bq-list li:hover, .bq-entries li:hover { background: var(--row-hover); }
.bq-list li[aria-selected="true"], .bq-entries li[aria-selected="true"] { background: var(--sel); }
.bq-entries li.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.bq-entries li.drop-after { box-shadow: inset 0 -3px 0 var(--accent); }
.bq-no {
  text-align: right; font-family: var(--mono); font-size: 12px; align-self: start; padding-top: 1px; min-width: 3.2ch; color: var(--faint);
}
.bq-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; flex-direction: column; justify-content: center; line-height: 1.25;
}
.bq-ref {
  color: var(--muted); font-family: var(--mono); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30%;
}
.bq-actions { display: flex; gap: 6px; align-items: center; }
.bq-toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.bq-toolbar input { flex: 1; min-width: 120px; }
.bq-toolbar h2 { font-size: 15px; }
.bq-toolbar code { color: var(--muted); max-width: 100%; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  #bqDir { width: 130px; }
}
#view-screen { overflow: auto; gap: 10px; }
.screen-head { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.screen-head h2 { margin: 0; }
.screen-tools { display: flex; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); }
.screen-tools select { min-height: 32px; }
.screen-stage {
  display: grid; place-items: center; min-height: 220px; background: #05070d; border: 1px solid #000; overflow: hidden; border-radius: 14px; box-shadow: var(--shadow-lg);
}
.screen-stage img {
  display: block; max-width: 100%; max-height: calc(100vh - 290px); min-height: 0; width: auto; height: auto; object-fit: contain;
}
.screen-stage:fullscreen { border-radius: 0; border: 0; }
.screen-stage:fullscreen img { max-height: 100vh; max-width: 100vw; }
.screen-stage p { margin: 0; color: #9aa4b8; }
#screenStats { margin: 0; }
.terminal-screen .xterm-helper-textarea {
  caret-color: transparent !important; color: transparent !important; background: transparent !important; outline: 0 !important; box-shadow: none !important; border: 0 !important; -webkit-text-fill-color: transparent; -webkit-appearance: none; appearance: none; pointer-events: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.terminal-screen .xterm-helper-textarea::selection { background: transparent; }
.terminal-screen .xterm-helper-textarea::-webkit-textfield-decoration-container, .terminal-screen .xterm-helper-textarea::-ms-clear, .terminal-screen .xterm-helper-textarea::-ms-reveal { display: none !important; }
.screen-body { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.screen-main { flex: 1 1 0; min-width: 0; display: grid; gap: 8px; }
.remote, .channels {
  flex: none; position: sticky; top: 0; display: grid; gap: 8px; padding: 8px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden;
}
.remote { width: 212px; order: 0; }
.remote[hidden], .channels[hidden] { display: none; }
.remote-head {
  display: flex; align-items: center; gap: 4px; padding: 6px 8px; margin: -8px -8px 0; border-radius: 9px 9px 0 0; background: var(--surface-2); color: var(--text); border-bottom: 1px solid var(--border);
}
.remote-head h3 { margin: 0; font-size: 14px; }
.remote-top {
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: transparent; cursor: pointer; color: var(--text);
}
.remote-top:disabled { opacity: .5; cursor: progress; }
.remote-top .ic { width: 17px; height: 17px; }
.remote-keys { display: grid; gap: 5px; }
.remote-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 5px; }
.rk {
  display: grid; place-items: center; min-height: 31px; padding: 0 2px; border: 1px solid var(--border-strong); color: var(--text); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; border-radius: 8px; box-shadow: 0 1px 0 rgb(15 23 42 / .12); transition: background .1s, border-color .1s, transform .06s, box-shadow .1s;
}
.rk.sending { transform: translateY(1px); }
.rk.small { min-height: 27px; font-size: 11.5px; }
.rk svg { width: 15px; height: 15px; fill: currentColor; stroke: none; }
.rk.red, .rk.green, .rk.yellow, .rk.blue { border-color: transparent; border-radius: 99px; min-height: 16px; box-shadow: none; }
.rk.red { background: #e02424; }
.rk.green { background: #1a8a2a; }
.rk.yellow { background: #f2e100; }
.rk.blue { background: #1769c9; }
.rk.red:hover, .rk.green:hover, .rk.yellow:hover, .rk.blue:hover { filter: brightness(1.15); border-color: var(--text); }
.remote .form-error { margin: 0; font-size: 12px; }
.nowbar {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 8px 12px 11px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.now-text { min-width: 0; display: grid; gap: 1px; }
.now-ch { font-weight: 700; font-size: 15px; }
.now-ev { color: var(--text); }
.now-next { color: var(--muted); font-size: 12.5px; }
.now-time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowbar.standby { border-color: var(--warn); }
#nowStandby { grid-column: 2 / 4; justify-self: start; margin-top: 4px; }
.now-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--surface-3); }
.now-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .9s linear; }
.picon {
  position: relative; display: grid; place-items: center; flex: none; width: 52px; height: 34px; background: var(--surface-3); overflow: hidden; border-radius: 7px;
}
.picon img { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); object-fit: contain; }
.picon.has-img { background: #fff; }
.picon-letter { font-weight: 700; color: var(--muted); }
.picon.has-img .picon-letter { visibility: hidden; }
.channels {
  width: 290px; order: 2; height: min(calc(100vh - 210px), 820px); min-height: 320px; grid-template-rows: auto auto minmax(0, 1fr) auto;
}
.ch-tools { display: grid; gap: 6px; }
.ch-tools .seg { justify-self: stretch; }
.ch-tools .seg button { flex: 1; }
.ch-tools select { width: 100%; }
.ch-tools .filterbar { display: flex; align-items: center; gap: 6px; }
.ch-tools .filter-input { flex: 1; width: 100%; }
.ch-list {
  display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow: auto; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overscroll-behavior: contain; scrollbar-width: thin;
}
.ch-item {
  display: grid; grid-template-columns: 30px auto minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; min-height: 42px; padding: 3px 8px 3px 4px; border: 1px solid transparent; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; border-radius: 9px; transition: background .1s;
}
.ch-item .picon { width: 46px; height: 30px; }
.ch-item:focus-visible { outline-offset: -2px; }
.ch-item.current { border-color: var(--sel-border); font-weight: 650; }
.ch-item.current .ch-name::before { content: "▶ "; font-size: 10px; color: var(--muted); }
.ch-text { display: grid; gap: 1px; min-width: 0; }
.ch-epg { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.ch-prog {
  display: block; height: 2px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-top: 1px;
}
.ch-prog span { display: block; height: 100%; background: var(--accent); }
.ch-num { text-align: right; color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.ch-marker { padding: 8px 8px 3px; font-size: 11.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.ch-more { margin: 6px auto; }
.ch-empty { margin: 14px 8px; text-align: center; }
.ch-status { margin: 0; min-height: 17px; }
.ch-status.bad { color: var(--bad); }
@media (max-width: 1180px) {
  .screen-body { flex-wrap: wrap; }
  .screen-main { flex: 1 1 100%; order: 0; }
  .remote { order: 2; }
  .channels { order: 1; width: min(100%, 420px); position: static; height: 460px; }
}
@media (max-width: 760px) {
  .screen-body { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 8px; }
  .screen-main { flex: none; order: 0; }
  .remote {
    margin: 0 auto; position: static; order: 1; width: min(100%, 230px); max-width: 230px; gap: 6px; padding: 6px;
  }
  .channels { width: auto; max-width: none; order: 2; }
}
.ra-state { margin: 0; font-weight: 650; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.ra-state[data-state="on"] { color: var(--ok); }
.ra-state[data-state="off"] { color: var(--muted); }
.ra-info {
  display: grid; gap: 6px; padding: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
}
.ra-info ul { margin: 4px 0 0; list-style: none; padding: 0; display: grid; gap: 4px; }
.ra-info p { margin: 0; }
.ra-fp { font-family: ui-monospace, monospace; font-size: 11.5px; overflow-wrap: anywhere; }
.ra-cert { display: grid; gap: 6px; }
.ra-cert p { margin: 0; }
.ra-cert[hidden] { display: none; }
#raDialog select { width: 100%; }
.hist-list {
  display: flex; flex-direction: column; gap: 2px; max-height: 46vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 4px; background: var(--surface-2);
}
.hist-item { display: flex; align-items: center; gap: 4px; }
.hist-cmd {
  flex: 1 1 auto; min-width: 0; text-align: left; padding: 6px 8px; border: 0; background: transparent; color: var(--text); border-radius: 6px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hist-cmd:hover, .hist-cmd:focus-visible { background: var(--accent-soft); }
.hist-item .icon-btn { width: 28px; height: 28px; flex: none; }
.hist-empty { padding: 14px; text-align: center; color: var(--muted); }
#pasteText {
  width: calc(100% - 36px); font-family: ui-monospace, Consolas, monospace; font-size: 13px; resize: vertical; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
}
.tt.dragging { opacity: .5; }
#powerDialog { max-width: min(780px, calc(100vw - 24px)); }
.power-head { display: flex; align-items: center; gap: 10px; }
.power-head h2 { margin: 0; }
.power-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; align-items: start; }
.power-col { display: grid; gap: 8px; align-content: start; }
.power-col h3 { margin: 0 0 2px; font-size: 13px; color: var(--muted); text-align: center; }
.power-slots { display: grid; gap: 8px; }
.power-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-align: center; transition: background .12s, border-color .12s, transform .05s;
}
.slot-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: center; transition: background .12s, border-color .12s, transform .05s; min-height: 38px; font-size: 13.5px; font-weight: 550;
}
.power-btn:hover:not(:disabled), .slot-btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--accent); }
.power-btn:active:not(:disabled), .slot-btn:active:not(:disabled) { transform: translateY(1px); }
.power-btn:disabled, .slot-btn:disabled { opacity: .55; cursor: not-allowed; }
.power-btn.danger { color: var(--bad); }
.power-btn.danger:hover:not(:disabled) { background: var(--bad-soft); border-color: var(--bad); }
.slot-btn[aria-current="true"] { border-color: var(--accent); color: var(--accent-ink); background: var(--surface-2); opacity: 1; }
.slot-btn .ellipsis { overflow: hidden; text-overflow: ellipsis; }
.power-note { margin: 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.power-note:empty { display: none; }
.power-extra { display: grid; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.power-extra h3 { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
.pe-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; }
.pe-row .field-inline select { width: auto; }
.tm-days { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; border: 0; min-width: 0; }
.tm-days legend { padding: 0; margin-bottom: 5px; font-size: 12.5px; font-weight: 650; color: var(--muted); }
@media (max-width: 640px) {
  .power-body { grid-template-columns: 1fr; }
}
.dialog-actions .spacer { flex: 1 1 0; min-width: 0; }
@media (max-width: 520px) {
  .dialog-actions { gap: 8px; }
  .dialog-actions .btn { flex: 1 1 auto; }
  .dialog-actions .spacer { display: none; }
}
.device-info {
  display: grid; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12.5px; border-top-style: dashed;
}
.device-info .info-head { display: flex; align-items: center; gap: 6px; }
.device-info .info-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; margin: 0; }
.device-info dt { color: var(--muted); }
.device-info dd { margin: 0; overflow-wrap: anywhere; }
.info-bars { display: grid; gap: 4px; }
.info-bar { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.info-bar .track { background: var(--surface-3); overflow: hidden; height: 8px; border-radius: 4px; }
.info-bar .track span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.info-bar .track span[data-level="low"] { background: var(--bad); }
.info-bar .track span[data-level="mid"] { background: var(--warn); }
.info-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.info-list .muted { color: var(--muted); }
.tools-body { display: grid; gap: 14px; padding: 4px 2px; max-height: 70vh; overflow: auto; }
.tools-sec { display: grid; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.tools-sec h3 { margin: 0; font-size: 14px; }
.tools-sec p { margin: 0; }
.tools-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tools-row input[type="file"] { flex: 1 1 220px; min-width: 0; }
.tools-progress { display: grid; gap: 4px; }
.tools-bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.tools-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.ch-pc {
  display: none; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 4px; color: var(--muted);
}
.ch-item:hover .ch-pc, .ch-item:focus-visible .ch-pc { display: inline-flex; }
.ch-pc:hover { color: var(--accent-ink); background: var(--surface-3); }
:root {
  --ft-image: #a855f7; --ft-archive: #c2528b; --ft-code: #3b82f6; --ft-box: #22a35a; --ft-video: #ec4899; --ft-audio: #0ea5e9; --ft-gear: #8794a3; --ft-text: #6b7a88; color-scheme: light; --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); --ease: cubic-bezier(.2, .7, .2, 1); --bg: #e8ecf1; --surface: #ffffff; --surface-2: #f3f6f9; --surface-3: #e3e8ee; --inset: #f3f6f9; --border: #d2d6db; --border-strong: #9ba1a8; --text: #10151c; --muted: #424e5b; --faint: #667380; --accent: #0b7285; --accent-strong: #095a69; --accent-ink: #075866; --accent-soft: #dff1f4; --on-accent: #ffffff; --ok: #17803d; --ok-soft: #d9f3e2; --warn: #7d5a00; --warn-soft: #fff6d4; --bad: #c0262d; --bad-soft: #fde4e4; --sel: #e2f1f4; --sel-border: #6dbdc9; --row-hover: #f0f3f6; --shadow: 0 1px 2px rgb(16 24 40 / .06); --shadow-lg: 0 24px 60px rgb(10 14 20 / .35); --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif; --mono: "Cascadia Mono", "JetBrains Mono", "SF Mono", Consolas, Menlo, "Liberation Mono", monospace; --topbar-h: 46px; --rail-w: 68px; --status-h: 28px;
}
::selection { background: color-mix(in srgb, var(--sel-border) 45%, transparent); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: content-box; border: 2px solid transparent; }
.rk:focus-visible { outline-offset: 2px; }
.tab .ic { opacity: .85; transition: transform .2s var(--ease); }
.tab[aria-selected="true"] .ic { opacity: 1; }
.avatar {
  position: relative; display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px;
}
.avatar .ic { width: 22px; height: 22px; }
.avatar .dot {
  position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border: 2px solid var(--surface); box-shadow: none !important;
}
.files .ic.ft-image { color: var(--ft-image); }
.files .ic.ft-archive { color: var(--ft-archive); }
.files .ic.ft-code { color: var(--ft-code); }
.files .ic.ft-box { color: var(--ft-box); }
.files .ic.ft-video { color: var(--ft-video); }
.files .ic.ft-audio { color: var(--ft-audio); }
.files .ic.ft-gear { color: var(--ft-gear); }
.files .ic.ft-text { color: var(--ft-text); }
.files tr.row.up .name span { color: var(--muted); }
.queue, .screen-tools, .nowbar { box-shadow: var(--shadow); }
.rk.nav { background: var(--surface-3); }
.rk.vol { background: color-mix(in srgb, #3b82f6 14%, var(--surface)); }
.rk.ch { background: color-mix(in srgb, #f59e0b 16%, var(--surface)); }
.device-card .avatar { width: 40px; height: 40px; border-radius: 12px; }
.device-name {
  overflow: visible; text-overflow: clip; white-space: normal; letter-spacing: -.01em; font-size: 14.5px; font-weight: 650;
}
.crumbs {
  display: flex; align-items: center; gap: 2px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; padding: 1px 0;
}
.crumbs::-webkit-scrollbar { display: none; }
.crumb {
  display: inline-flex; align-items: center; min-height: 26px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.crumb:hover { background: var(--surface-3); color: var(--text); }
.crumb-sep { color: var(--faint); font-size: 14px; }
.pane-empty.loading::before {
  content: ""; position: absolute; left: 12px; right: 12px; top: 0; height: 120px; border-radius: 8px; opacity: .6; background: repeating-linear-gradient(180deg, var(--surface-3) 0 14px, transparent 14px 34px); -webkit-mask-image: linear-gradient(90deg, #000 20%, transparent 60%, #000 85%); mask-image: linear-gradient(90deg, #000 20%, transparent 60%, #000 85%); animation: shimmer 1.2s ease-in-out infinite;
}
.pane-empty.loading { padding-top: 140px; }
@keyframes shimmer { 50% { opacity: .25; } }
.toast::before {
  content: "✓"; display: grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; font-weight: 800; background: #4ade80; color: #052e16;
}
.toast.error::before { content: "!"; background: #ffb4b8; color: #6b0f16; }
.ch-acts { display: inline-flex; align-items: center; gap: 2px; }
@media (hover: none) {
  .ch-pc { display: inline-flex; }
}
.nowbar .now-text { cursor: pointer; border-radius: 6px; }
.nowbar .now-text:hover .now-ev { color: var(--accent-ink); }
#guideDialog { max-width: min(900px, calc(100vw - 24px)); }
.gd-card { gap: 10px; }
.gd-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gd-head .editor-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.gd-head h2 { margin: 0; white-space: nowrap; flex: none; }
.gd-head .editor-title code { min-width: 0; }
.gd-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gd-tools select { flex: 1 1 170px; min-width: 0; max-width: 300px; min-height: 34px; }
.gd-tools .filterbar { flex: 1 1 200px; }
.gd-tools .filter-input { min-height: 34px; }
.gd-dir { flex: 0 1 auto; max-width: 46%; }
.gd-body:focus { outline: none; }
.gd-body {
  height: min(56vh, 500px); min-height: 240px; overflow: auto; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); overscroll-behavior: contain; scrollbar-width: thin;
}
.gd-day {
  position: sticky; top: -3px; z-index: 1; padding: 7px 10px 4px; background: var(--surface); font-size: 11.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
}
.gd-item {
  display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; align-items: start; gap: 2px 12px; width: 100%; padding: 6px 10px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text); font: inherit; text-align: start; cursor: pointer; transition: background .1s;
}
.gd-item:hover { background: var(--row-hover); }
.gd-item:focus-visible { outline-offset: -2px; }
.gd-item.running { background: var(--sel); border-color: var(--sel-border); box-shadow: inset 3px 0 0 var(--accent); }
.gd-item.dim .gd-title, .gd-item.dim .gd-time { opacity: .6; }
.gd-timer, .gd-movie { cursor: default; }
.gd-time { display: grid; gap: 1px; justify-items: start; align-content: start; font-variant-numeric: tabular-nums; }
.gd-time b { font-size: 14px; }
.gd-time span { color: var(--muted); font-size: 11.5px; }
.gd-time .picon { width: 62px; height: 38px; }
.gd-main { display: grid; gap: 2px; min-width: 0; }
.gd-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-weight: 650; overflow-wrap: anywhere; }
.gd-title.ellipsis { display: block; }
.gd-ch { color: var(--accent-ink); font-size: 12px; font-weight: 650; }
.gd-short { color: var(--muted); font-size: 12.5px; }
.gd-long {
  display: none; margin-top: 4px; color: var(--muted); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.gd-item.open .gd-long { display: block; }
.gd-item.open .gd-short { white-space: normal; }
.gd-main .ch-prog { margin-top: 4px; }
.gd-acts { display: flex; align-items: center; gap: 2px; align-self: center; }
.gd-gap { width: 32px; height: 32px; display: inline-block; }
.gd-kind {
  display: grid; place-items: center; width: 40px; height: 36px; border-radius: 9px; background: color-mix(in srgb, var(--ft-video) 16%, transparent); color: var(--ft-video);
}
.gd-kind.folder { background: color-mix(in srgb, var(--folder) 18%, transparent); color: var(--folder); }
.gd-folder .gd-title { font-weight: 600; }
.gd-empty { margin: 40px 14px; text-align: center; }
.gd-more { display: flex; margin: 8px auto; }
.gd-status { margin: 0; min-height: 17px; }
@media (max-width: 640px) {
  .gd-item { grid-template-columns: 62px minmax(0, 1fr); }
  .gd-item .gd-acts { grid-column: 2; justify-self: start; }
  .gd-folder .gd-acts { display: none; }
  .gd-time .picon { width: 54px; height: 34px; }
  .gd-dir { max-width: 100%; flex-basis: 100%; order: 3; }
  .gd-head { gap: 8px; }
  .gd-head .spacer { display: none; }
  .gd-head .editor-title { order: 1; flex: 1 1 0; }
  .gd-head #guideClose { order: 2; }
  .gd-head .seg { order: 3; flex: 1 1 100%; display: flex; }
  .gd-head .seg button { flex: 1; }
  .gd-tools select { flex: 1 1 40%; max-width: none; }
  .screen-tools { gap: 6px; padding: 8px; }
  .screen-tools .field-inline { display: grid; flex: 1 1 28%; gap: 2px; min-width: 0; font-size: 11.5px; color: var(--muted); }
  .screen-tools .field-inline select { width: 100%; min-width: 0; }
  .screen-tools .spacer { display: none; }
  .screen-tools .btn { flex: 1 1 44px; justify-content: center; gap: 0; font-size: 0; }
  .screen-tools .btn .ic { margin: 0; }
}
#view-signal { overflow: auto; gap: 12px; }
.sig-tools .spacer { flex: 1; }
.sig-body {
  flex: 1 0 auto; min-height: 440px; display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 14px; align-items: stretch;
}
.sig-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow); min-width: 0;
}
.sig-main {
  --sig: var(--faint); display: flex; flex-direction: column; gap: 14px; padding: 18px; position: relative; overflow: hidden;
}
.sig-main::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 160px; pointer-events: none; background: radial-gradient(ellipse 70% 100% at 50% 0, color-mix(in srgb, var(--sig) 22%, transparent), transparent); transition: background .4s;
}
.sig-main > * { position: relative; }
.sig-main[data-level="ok"] { --sig: var(--ok); }
.sig-main[data-level="mid"] { --sig: color-mix(in srgb, var(--warn) 70%, #ffb000); }
.sig-main[data-level="low"] { --sig: var(--bad); }
.sig-channel {
  min-height: 1.4em; text-align: center; font-weight: 650; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sig-meter {
  display: flex; flex: 1 1 auto; flex-direction: column; justify-content: center; align-items: center; gap: 2px; padding: 6px 0 4px;
}
.sig-big {
  display: flex; align-items: baseline; justify-content: center; gap: 6px; font-weight: 780; line-height: 1; color: var(--sig); font-variant-numeric: tabular-nums; transition: color .3s;
}
.sig-big span { font-size: clamp(76px, 14vw, 112px); letter-spacing: -.035em; }
.sig-big small { font-size: 28px; color: var(--muted); font-weight: 650; }
.sig-cap { font-size: 11.5px; font-weight: 750; letter-spacing: .24em; color: var(--faint); }
.sig-trend { margin-top: 10px; min-height: 24px; display: flex; justify-content: center; }
.sig-trend span {
  display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--surface-2); color: var(--muted);
}
.sig-trend span:empty { display: none; }
.sig-trend[data-dir="up"] span { background: var(--ok-soft); color: var(--ok); }
.sig-trend[data-dir="down"] span { background: var(--bad-soft); color: var(--bad); }
.sig-bar-wrap { width: 100%; margin-top: 14px; }
.sig-flags { position: relative; height: 18px; }
.flag-best {
  position: absolute; bottom: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; font-size: 11px; line-height: 1; color: var(--ok); transition: left .3s;
}
.flag-best b { display: none; }
.sig-bar { position: relative; display: flex; gap: 2px; height: 52px; }
.sig-bar > span {
  flex: 1 1 0; border-radius: 3px; background: color-mix(in srgb, var(--c) 13%, var(--surface-3)); transition: background .15s;
}
.sig-bar > span[data-z="bad"] { --c: var(--bad); }
.sig-bar > span[data-z="warn"] { --c: color-mix(in srgb, var(--warn) 70%, #ffb000); }
.sig-bar > span[data-z="ok"] { --c: var(--ok); }
.sig-bar > span.on { background: var(--c); }
.sig-bar .thr {
  position: absolute; top: -5px; bottom: -5px; width: 0; border-left: 2px dashed var(--text); opacity: .5; transform: translateX(-1px); pointer-events: none;
}
.sig-axis {
  display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; font-weight: 650; color: var(--faint); font-variant-numeric: tabular-nums;
}
.sig-state {
  align-self: center; display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 13.5px; color: var(--sig); background: color-mix(in srgb, var(--sig) 14%, transparent); text-align: center;
}
.sig-state i {
  width: 9px; height: 9px; border-radius: 50%; background: var(--sig); flex: none; box-shadow: 0 0 8px var(--sig);
}
.sig-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile {
  display: grid; gap: 2px; padding: 9px 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); min-width: 0;
}
.tile span {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); white-space: nowrap;
}
.tile b {
  font-size: 16px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile.best b { color: var(--ok); }
.tile.worst b { color: var(--bad); }
.tile .mini {
  display: block; height: 4px; margin-top: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden;
}
.tile .mini u {
  display: block; height: 100%; width: 0; background: var(--accent); text-decoration: none; transition: width .3s;
}
.sig-graph { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.sig-graph-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sig-graph-head strong { margin-right: auto; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.legend i { width: 18px; height: 3px; border-radius: 2px; }
.l-snr { background: var(--accent); }
.l-agc { background: var(--faint); }
.l-best { background: var(--ok); }
.sig-plot { position: relative; flex: 1 1 auto; min-height: 240px; }
.sig-plot canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sig-tip {
  margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); font-size: 13px;
}
.sig-body:fullscreen { background: var(--bg); padding: 16px; min-height: 0; overflow: auto; }
@media (max-width: 900px) {
  .sig-body { grid-template-columns: 1fr; min-height: 0; }
  .sig-plot { flex: none; height: 220px; min-height: 0; }
  .sig-tools .spacer { display: none; }
  .sig-tools .btn { flex: 1 1 calc(50% - 8px); }
  .sig-tools .field-inline { flex: 1 1 calc(50% - 8px); justify-content: space-between; }
  .sig-tools .field-inline select { flex: 1; }
  .screen-tools.sig-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .screen-tools.sig-tools .btn {
    min-width: 0; width: 100%; flex: none; justify-content: center; gap: 6px; font-size: 13px; padding-left: 8px; padding-right: 8px; white-space: nowrap;
  }
  .screen-tools.sig-tools .field-inline {
    min-width: 0; width: 100%; flex: none; gap: 6px; font-size: 13px; padding-left: 8px; padding-right: 8px; white-space: nowrap; justify-content: space-between;
  }
  .screen-tools.sig-tools .btn span { overflow: hidden; text-overflow: ellipsis; }
  .sig-bar { height: 44px; }
}
:root[data-theme="dark"] {
  color-scheme: dark; --bg: #0c0f13; --surface: #13171d; --surface-2: #181d24; --surface-3: #232a34; --inset: #0e1217; --border: #353a41; --border-strong: #5b6168; --text: #eef2f6; --muted: #b6c0cc; --faint: #8996a6; --accent: #4fc6d3; --accent-strong: #7dd8e2; --accent-ink: #8fe1ea; --accent-soft: #10292e; --on-accent: #03161a; --ok: #4fd37d; --ok-soft: #14301f; --warn: #e6c455; --warn-soft: #2d290f; --bad: #ff7a80; --bad-soft: #3d1b1f; --sel: #11282d; --sel-border: #2d7d89; --row-hover: #1a2029; --shadow: 0 1px 2px rgb(0 0 0 / .5);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark; --bg: #0c0f13; --surface: #13171d; --surface-2: #181d24; --surface-3: #232a34; --inset: #0e1217; --border: #353a41; --border-strong: #5b6168; --text: #eef2f6; --muted: #b6c0cc; --faint: #8996a6; --accent: #4fc6d3; --accent-strong: #7dd8e2; --accent-ink: #8fe1ea; --accent-soft: #10292e; --on-accent: #03161a; --ok: #4fd37d; --ok-soft: #14301f; --warn: #e6c455; --warn-soft: #2d290f; --bad: #ff7a80; --bad-soft: #3d1b1f; --folder: #7ea6d6; --sel: #11282d; --sel-border: #2d7d89; --row-hover: #1a2029; --shadow: 0 1px 2px rgb(0 0 0 / .5);
  }
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong); border: 3px solid transparent; background-clip: content-box; border-radius: 99px;
}
*::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }
.tab:active { transform: scale(.97); }
.tab:hover .ic, .tab[aria-selected="true"] .ic { transform: translateY(-1px) scale(1.08); }
.view:not([hidden]) { animation: viewIn .28s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tab:focus-visible, .rk:focus-visible { outline: none; box-shadow: var(--ring); }
.device-card, .pane, .queue, .screen-tools, .nowbar, .remote, .channels { border-color: color-mix(in srgb, var(--border) 85%, transparent); }
.device-card::before {
  inset: 0 0 auto 0; height: 3px; opacity: .0; transition: opacity .2s; content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--border-strong);
}
.device-card:hover { box-shadow: var(--shadow-lg); }
.device-card:hover::before, .device-card.current::before { opacity: 1; }
.device-card .avatar .dot { width: 12px; height: 12px; border: 2px solid var(--surface); box-shadow: none; }
.device-actions .btn.primary {
  background: var(--accent-soft); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 35%, transparent); box-shadow: none;
}
.device-actions .btn.primary:hover:not(:disabled) { background: var(--accent); color: var(--on-accent); border-color: var(--accent-strong); }
.screen-tools { border-radius: 12px; }
.files tr.row td { transition: background .08s; }
.files tr.row:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 38%, transparent); }
.transfer .bar { border-radius: 99px; }
.transfer .bar > i { border-radius: 99px; }
.rk:active { transform: scale(.94); box-shadow: none; }
.ch-item:hover { background: var(--row-hover); }
.ch-item.current { background: color-mix(in srgb, var(--accent) 12%, transparent); }
dialog[open] { animation: dlgIn .22s var(--ease); }
dialog[open]::backdrop { animation: fadeIn .22s; backdrop-filter: blur(5px); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 900px) {
  .device-grid { grid-template-columns: 1fr; }
  .toast { bottom: calc(58px + 12px + env(safe-area-inset-bottom, 0px)); }
}
@media (hover: none) {
  .device-card:hover { transform: none; box-shadow: var(--shadow); }
}
.queue.empty {
  margin: 0; max-width: none; display: flex; padding: 0; gap: 0; text-align: left; justify-items: normal; color: inherit;
}
@media (max-width: 600px) {
  .brand { display: none; }
  .tab { padding: 0 9px; }
}
#bqAddDialog { max-width: min(640px, calc(100vw - 24px)); }
.bq-add-card { gap: 10px; }
.bq-add-list { height: min(46vh, 420px); }
.bq-add-list .bq-prov {
  color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; max-width: 40%; text-align: right; white-space: normal; overflow-wrap: anywhere;
}
#bqAddCount { font-size: 12.5px; }
.tools-row input#toolsDir { flex: 1 1 260px; min-width: 0; font-family: var(--mono); }
.lists-pane { display: grid; gap: 10px; align-content: start; min-width: 0; }
.lists-pane[hidden] { display: none; }
#view-lists .dialog-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#view-lists .view-head h1 .badge { vertical-align: middle; margin-left: 6px; }
#view-lists .view-head p { max-width: 70ch; }
.brand b { color: inherit; font-weight: 700; }
.tab[aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.device-card.current::before { background: var(--accent); }
.pane.drop, .pane.drop-os { background: var(--surface-2); outline-color: var(--accent); }
.rk:hover, .rk:active, .rk.sending, .rk.vol:hover, .rk.ch:hover { background: var(--surface-3); border-color: var(--border-strong); }
.rk.ok { font-weight: 700; }
.rk.ok:hover { border-color: var(--accent); }
.crumb.last { color: var(--text); background: var(--surface-3); }
.ch-marker, .gd-day { color: var(--muted); }
.ch-item.current, .bq-list li[aria-selected="true"], .bq-entries li[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--sel-border); }
.avatar { background: var(--surface-3); color: var(--text); }
.pane-badge.device { background: var(--surface-3); color: var(--text); }
#view-ipk { overflow: auto; }
#view-ipk .view-head h1 .badge { vertical-align: middle; margin-left: 6px; }
.ipk-card {
  display: grid; gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); min-width: 0; width: 100%; max-width: 920px;
}
.ipk-drop {
  display: grid; justify-items: center; gap: 4px; text-align: center; border: 2px dashed var(--border-strong); border-radius: 12px; background: var(--surface-2); color: var(--muted); cursor: pointer; transition: background .12s, border-color .12s; padding: 26px 16px;
}
.ipk-drop:hover, .ipk-drop:focus-visible, .ipk-drop.over { border-color: var(--accent); background: var(--surface-3); outline: none; }
.ipk-drop strong { color: var(--text); font-size: 15px; margin-top: 4px; }
.ipk-drop .ic.xl { color: var(--faint); }
.ipk-file {
  display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-2);
}
.ipk-file-ic {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-3); color: var(--muted); flex: none;
}
.ipk-file-ic .ic { width: 22px; height: 22px; }
.ipk-file-text { flex: 1 1 auto; min-width: 0; }
.ipk-file-name { font-weight: 650; }
.remote-top:hover:not(:disabled) { background: var(--surface-3); }
.pane-badge.local { background: var(--surface-3); color: var(--muted); }
.pane-head .pane-title { min-height: 24px; }
.bq-list:empty::before, .bq-entries:empty::before { display: block; padding: 22px 14px; text-align: center; color: var(--muted); font-size: 13px; }
.bq-list:empty::before { content: "No bouquets yet."; }
.bq-entries:empty::before { content: "Pick a bouquet on the left to edit its channels."; }
.bq-side .bq-actions { display: grid; gap: 6px; grid-template-columns: minmax(0, 1fr) auto auto auto; }
.bq-side .bq-actions .btn { padding: 0 6px; min-width: 0; justify-content: center; }
.bq-side .bq-actions #bqListRemove, .bq-side .bq-actions #bqListDelete { grid-column: span 2; }
.view-head h1 { font-size: 22px; }
@media (max-width: 560px) {
  .view-actions { max-width: 100%; }
  .ipk-card { padding: 12px; }
}
#view-lists .view-head, #view-ipk .view-head { align-items: flex-start; }
@media (max-width: 720px) {
  .bq-main .bq-toolbar { gap: 6px; }
  .bq-main .bq-toolbar input { flex: 1 1 100%; width: 100%; }
}
.tools-top { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.tools-top .toolsnav { margin: 0; }
.tools-actions { display: flex; margin-left: auto; min-width: 0; }
.tools-actions .field-inline { margin: 0; }
#view-devices .view-head { justify-content: flex-start; }
#view-lists, #view-ipk, #view-signal { padding-top: 10px; }
.pathbar .pane-title { flex: none; display: inline-flex; margin-right: 2px; }
#remoteHost, #localRoot { display: none; }
#view-lists .editor-status:empty { display: none; }
#bqTitle { display: none; }
#listsBackup .tools-body { max-width: none; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; gap: 14px; }
#listsBackup .tools-sec {
  padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow);
}
#listsBackup .tools-progress, #listsBackup .form-error { grid-column: 1 / -1; }
#view-lists .tools-body { max-height: none; overflow: visible; max-width: none; }
.ipk-bar { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; }
.ipk-drop span { max-width: 56ch; }
.ipk-warn { margin: 0; }
#view-lists .dialog-actions .editor-status { margin: 0; min-height: 0; }
#view-lists #listsEdit { gap: 8px; }
@media (max-width: 760px) {
  .screen-stage img { max-height: 34vh; }
  .remote-head h3 { display: none; }
  .remote-head { justify-content: space-between; padding: 3px 6px; }
  .remote-head .spacer { display: none; }
  .remote-head .remote-top { width: 34px; height: 30px; }
  .rk { min-height: 30px; }
  .remote .remote-row.extra { display: none; }
  .remote.more .remote-row.extra { display: grid; }
  .remote-more { display: inline-flex; width: 100%; }
  .screen-tools { padding: 6px 8px; gap: 6px; }
  .screen-tools select { min-height: 32px; }
  .screen-tools .btn.sm { min-height: 32px; flex: 1 1 20%; min-width: 0; padding: 0 4px; }
  .screen-tools .field-inline { flex: 1 1 28%; min-width: 0; font-size: 12px; gap: 2px; flex-direction: column; align-items: stretch; }
  .screen-tools .field-inline select { width: 100%; }
  .screen-tools .spacer { display: none; }
}
.status-pill, .sig-live {
  display: inline-block; flex: none; width: 12px; height: 12px; padding: 0; border-radius: 50%; overflow: hidden; font-size: 0; background: var(--bad);
}
.status-pill[data-state="connected"], .sig-live[data-state="live"] { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.status-pill[data-state="connecting"], .sig-live[data-state="wait"] { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); animation: pulse 1s ease-in-out infinite; }
.sig-live[data-state="paused"] { box-shadow: 0 0 0 3px var(--warn-soft); }
.sig-live[data-state="live"] { animation: sigpulse 1.4s ease-out infinite; }
.sig-live > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chip, .badge { letter-spacing: .1px; }
.tools-actions .status-pill, .tools-top .sig-live { margin: 0 4px; }
.term-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; min-width: 0; }
.term-top .termtabs { flex: 1 1 280px; min-width: 0; }
.term-top .connbar { flex: 0 1 auto; padding: 4px 8px; }
@media (max-width: 900px) {
  .term-top .connbar { flex: 1 1 100%; }
}
#bqSub { display: none; }
.remote-head { justify-content: space-between; }
.remote-head .spacer { display: none; }
@media (max-width: 600px) {
  .termtools .mini-select { display: none; }
  .termtools .icon-btn { width: 32px; }
  .termtools { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .termtools > * { flex: none; }
  .bq-list { height: auto; min-height: 44px; max-height: 22vh; }
  .bq-entries { height: 44vh; }
}
.files tr.row.drop-target > td { background: var(--accent-soft); }
#raDialog { max-width: min(600px, calc(100vw - 24px)); }
.ra-card { gap: 10px; max-height: calc(100vh - 24px); overflow-y: auto; }
.ra-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ra-head h2 { margin: 0; }
.ra-state::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); flex: none;
}
.ra-state[data-state="on"]::before { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.ra-switch {
  padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; font-weight: 600;
}
.ra-info li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ra-info li code { overflow-wrap: anywhere; }
.ra-cert summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.ra-pass { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; }
.ra-pass .input-row { flex-wrap: wrap; }
.ra-pass .input-row input { flex: 1 1 200px; min-width: 0; font-family: ui-monospace, monospace; }
@media (max-width: 760px) {
  .actionbar { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
  .actionbar .fkey-copy { display: none; }
}
.bq-side .seg { width: 100%; }
.bq-side .seg button { flex: 1; }
.bq-list li { padding: 9px 12px; border-bottom: 1px solid var(--surface-3); font-weight: 550; align-items: flex-start; }
.bq-list li.empty-row { cursor: default; font-weight: 400; }
.bq-list li.drop-target { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.bq-side .bq-actions #bqNew { grid-column: auto; }
.bq-side .bq-actions #bqListUp, .bq-side .bq-actions #bqListDown, .bq-side .bq-actions #bqListMore { grid-column: auto; padding: 0 10px; }
.bq-hint { margin: 2px 2px 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.bq-head { display: flex; gap: 8px; align-items: center; }
.bq-head #bqName { flex: 2 1 220px; font-weight: 650; font-size: 15px; }
.bq-head #bqFilter { flex: 1 1 140px; }
.bq-head #bqTitle, .bq-head #bqSub { display: none; }
.bq-foot { display: flex; align-items: center; gap: 10px; padding: 2px 4px; font-size: 12.5px; }
.bq-entries li { gap: 9px; padding: 0 12px; min-height: 38px; border-bottom: 1px solid var(--surface-3); }
.bq-entries li.marker { min-height: 34px; background: var(--surface-2) !important; }
.bq-entries li.marker .bq-name {
  font-size: 12px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); display: flex; align-items: center; gap: 10px;
}
.bq-entries li.marker .bq-name::after { content: ""; flex: 1; height: 1px; background: var(--border-strong); }
.bq-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.bq-was { font-size: 11.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bq-kind {
  flex: none; min-width: 42px; text-align: center; padding: 1px 6px; border-radius: 5px; font-size: 10px; font-weight: 800; letter-spacing: .05em; background: var(--surface-3); color: var(--muted);
}
.bq-kind.tv { background: var(--accent-soft); color: var(--accent-ink); }
.bq-kind.radio { background: var(--warn-soft); color: var(--warn); }
.bq-kind.stream { background: var(--ok-soft); color: var(--ok); }
.bq-kind.missing { background: var(--bad-soft); color: var(--bad); }
.bq-tag {
  flex: none; padding: 0 7px; border-radius: 99px; font-size: 11px; font-weight: 650; background: var(--surface-3); color: var(--muted);
}
.bq-add-list li.present { opacity: .55; }
.bq-add-list li { min-height: 34px; display: flex; align-items: center; gap: 10px; padding: 6px 12px; }
.bq-toolbar select { max-width: 40%; }
.bq-entries:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
#bqSave.dirty { box-shadow: 0 0 0 3px var(--accent-soft); }
#listsEdit.is-dirty #bqStatus:empty::before { content: "Unsaved changes"; color: var(--warn); font-weight: 650; }
#bqStreamDialog { max-width: min(600px, calc(100vw - 24px)); }
.bq-stream-card { gap: 12px; }
.bq-stream-pane { display: grid; gap: 10px; }
.bq-stream-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bq-m3u-text {
  width: 100%; min-height: 150px; resize: vertical; font-family: var(--mono); font-size: 12px; padding: 8px 10px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.bq-m3u-text:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.bq-stream-card .field { display: grid; gap: 4px; }
.bq-stream-card .field > span { font-weight: 600; color: var(--muted); font-size: 12.5px; }
.bq-stream-card .field input, .bq-stream-card .field select { width: 100%; }
@media (max-width: 720px) {
  .bq-head { flex-wrap: wrap; }
  .bq-head #bqName, .bq-head #bqFilter { flex: 1 1 100%; }
  .bq-kind { display: none; }
  .bq-ref { display: none; }
}
@media (min-width: 721px) {
  .bq-entries { height: clamp(240px, calc(100vh - 380px), 1000px); }
  .bq-list { height: clamp(200px, calc(100vh - 470px), 900px); }
}
@media (max-width: 720px) {
  .bq-body { grid-template-columns: minmax(0, 1fr); }
  .bq-list { height: auto; max-height: 24vh; }
  .bq-entries { height: 50vh; }
}
.device-card .icon-btn, .queue-head .icon-btn, .t-actions .icon-btn, .gd-acts .icon-btn { width: 30px; height: 30px; }
.tt .icon-btn { width: 24px; height: 24px; }
.dialog-actions { align-items: center; }
.tools-actions, .screen-tools, .device-actions { gap: 8px; align-items: center; }
.device-actions .btn { flex: none; }
.chip::before, .chip.on::before, .chip.off::before { display: none; }
.dot, .dot[data-state], .status-pill, .sig-live, .device-card .avatar .dot[data-state="online"] { box-shadow: none !important; }
.dot[data-state="online"]::after { content: none; }
.tt .dot[data-state="online"], .tt .dot[data-state="unknown"] { display: none; }
.status-pill[data-state="idle"], .sig-live[data-state="paused"] { background: var(--faint); }
@keyframes sigpulse { from, to { box-shadow: none; } }
.remote .remote-row.colors { gap: 6px; padding: 2px 0; }
.remote .rk.red { background: #e02424; }
.remote .rk.green { background: #16a34a; }
.remote .rk.yellow { background: #f5c400; }
.remote .rk.blue { background: #1d6fe0; }
.remote .rk.red:hover, .remote .rk.green:hover, .remote .rk.yellow:hover, .remote .rk.blue:hover { filter: brightness(1.12); border: 0; }
.remote .rk.red:active, .remote .rk.green:active, .remote .rk.yellow:active, .remote .rk.blue:active, .remote .rk.red.sending, .remote .rk.green.sending, .remote .rk.yellow.sending, .remote .rk.blue.sending { filter: brightness(.9); }
.remote .rk.red:focus-visible, .remote .rk.green:focus-visible, .remote .rk.yellow:focus-visible, .remote .rk.blue:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.remote .rk.red.sending, .remote .rk.green.sending, .remote .rk.yellow.sending, .remote .rk.blue.sending { opacity: .75; }
@media (pointer: coarse) {
  .remote .rk.red, .remote .rk.green, .remote .rk.yellow, .remote .rk.blue { min-height: 34px; }
}
.seg button, .tab { line-height: 1.25; }
.seg button { height: auto; white-space: nowrap; min-height: 24px; padding: 0 12px; font-size: 12px; border-radius: 4px; }
.bq-actions, .tools-actions, .screen-tools, .dialog-actions, .actionbar { flex-wrap: wrap; }
#bqEntries li {
  padding: 7px 12px; min-height: 40px; display: grid; grid-template-columns: max-content max-content minmax(0, 1fr) max-content; column-gap: 10px; row-gap: 2px; align-items: start; direction: ltr; text-align: left;
}
#bqEntries li.marker { padding: 4px 12px; min-height: 34px; }
.bq-entries .bq-name { white-space: normal; overflow: hidden; overflow-wrap: anywhere; line-height: 1.3; }
.bq-entries .bq-title { display: block; }
.bq-entries .bq-was { display: block; color: var(--muted); font-size: 12px; }
.bq-entries .bq-tag { justify-self: end; white-space: nowrap; }
.bq-entries .bq-ref {
  grid-column: 2 / -1; max-width: none; white-space: normal; overflow-wrap: anywhere; word-break: break-all; line-height: 1.35; font-size: 11.5px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.bq-entries li[aria-selected="true"] .bq-ref, .bq-entries li:hover .bq-ref { -webkit-line-clamp: unset; line-clamp: unset; display: block; }
.bq-list .bq-name { white-space: normal; overflow-wrap: anywhere; }
.files tr.row.selected td, .files tr.row.selected td.name span { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; height: auto; }
.t-name:hover, .gd-title.ellipsis:hover, .hist-cmd:hover { white-space: normal; overflow-wrap: anywhere; }
.menu button { line-height: 1.3; }
.device-name, .device-sub { overflow-wrap: anywhere; }
.device-sub.ellipsis { white-space: normal; }
.bq-entries li:nth-child(even):not([aria-selected="true"]):not(:hover) { background: transparent; }
.dialog-actions { display: flex; margin-top: 4px; gap: 8px; }
.bq-entries .bq-title, .bq-entries .bq-was { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.device-top .avatar { margin-top: 2px; }
.remote-more { display: inline-flex; width: 100%; }
.remote:not(.more) .remote-row.extra2 { display: none; }
.remote.more .remote-row.extra2 { display: grid; }
.screen-tools #screenSpeed:disabled { opacity: .5; }
.screen-tools .field-inline input#screenAuto {
  width: 16px; min-width: 16px; height: 16px; padding: 0; flex: none; margin: 0 2px 0 0; accent-color: var(--accent);
}
.screen-tools .field-inline:has(#screenAuto) { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.auto-refresh { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; white-space: nowrap; }
.auto-refresh .check { font-size: inherit; gap: 6px; }
.auto-refresh input[type="number"] { width: 4.6em; text-align: center; }
.auto-refresh input[type="number"]:disabled { opacity: .5; }
.screen-tools .auto-refresh input#screenAuto { margin: 0; }
.screen-foot {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
}
.screen-foot #screenStats { flex: none; min-width: 0; width: 100%; text-align: center; }
#bqEntries, .bq-entries { direction: ltr; text-align: left; }
#bqEntries li > .bq-kind { grid-column: 1; grid-row: 1; display: inline-block; }
#bqEntries li > .bq-no { grid-column: 2; grid-row: 1; text-align: right; }
#bqEntries li > .bq-name { grid-column: 3; grid-row: 1; text-align: left; justify-self: stretch; }
#bqEntries li > .bq-tag { grid-column: 4; grid-row: 1; justify-self: end; }
#bqEntries li > .bq-ref {
  grid-column: 3 / -1; grid-row: 2; display: block; max-width: none; text-align: left; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; word-break: break-all; -webkit-line-clamp: unset; line-clamp: unset;
}
#bqEntries li.marker > .bq-name { grid-column: 3 / -1; }
#bqEntries .bq-title, #bqEntries .bq-was { text-align: left; }
@media (max-width: 720px) {
  #bqEntries li > .bq-ref { display: block; grid-column: 2 / -1; }
  #bqEntries li > .bq-kind { display: none; }
  #bqEntries li { grid-template-columns: max-content minmax(0, 1fr) max-content; }
  #bqEntries li > .bq-no { grid-column: 1; }
  #bqEntries li > .bq-name { grid-column: 2; }
  #bqEntries li > .bq-tag { grid-column: 3; }
  #bqEntries li.marker > .bq-name { grid-column: 2 / -1; }
}
.bq-add-list { direction: ltr; text-align: left; }
.bq-add-list .bq-name { flex: 1 1 auto; min-width: 0; text-align: left; display: block; white-space: normal; overflow-wrap: anywhere; }
.bq-add-list .bq-tag { flex: none; }
.bq-add-list:empty::before { content: "No channels found."; }
.tab { border-radius: 9px; position: relative; }
.logs-live {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.logs-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.logs-live[data-state="on"]::before { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.logs-live[data-state="off"]::before { background: var(--bad); }
.logs-live[data-state="paused"]::before { background: var(--warn); }
.logs-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.logs-tab {
  min-height: 34px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer;
}
.logs-tab:hover { color: var(--text); }
.logs-tab[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--accent-ink); }
.logs-pane { display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; min-height: 0; }
.logs-search { flex: 1 1 180px; max-width: 320px; min-height: 32px; }
.lg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lg-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; cursor: pointer;
}
.lg-chip b { font-weight: 700; color: var(--text); text-transform: none; letter-spacing: 0; }
.lg-chip:hover { border-color: var(--accent); }
.lg-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.lg-chip[data-level="warn"] b { color: var(--warn); }
.lg-chip[data-level="error"] b { color: var(--bad); }
.logs-list {
  flex: 1 1 auto; min-height: 220px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-family: var(--mono); font-size: 12.5px; line-height: 1.5; padding: 4px 0;
}
.lg-row {
  display: grid; grid-template-columns: 92px 50px 76px minmax(0, 1fr); gap: 0 10px; align-items: baseline; padding: 3px 12px; border-left: 3px solid transparent;
}
.lg-row:hover { background: var(--row-hover); }
.lg-time { color: var(--faint); white-space: nowrap; }
.lg-level { font-weight: 700; font-size: 11px; letter-spacing: .04em; }
.lg-comp { color: var(--accent-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-msg { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.lg-text { min-width: 0; overflow-wrap: anywhere; }
.lg-fields { display: flex; flex-wrap: wrap; gap: 2px 8px; min-width: 0; }
.lg-msg .lg-fields { display: contents; }
.lg-field {
  display: inline-flex; gap: 4px; min-width: 0; max-width: 100%; padding: 0 6px; border-radius: 4px; background: var(--surface-2); white-space: normal;
}
.lg-field i { flex: none; font-style: normal; color: var(--faint); }
.lg-field b { min-width: 0; font-weight: 500; color: var(--muted); overflow-wrap: anywhere; }
.lg-field b.lg-err { color: var(--bad); }
.lg-row[data-level="trace"] { color: var(--faint); }
.lg-row[data-level="trace"] .lg-level { color: var(--faint); }
.lg-row[data-level="debug"] .lg-level { color: #8b5cf6; }
:root[data-theme="dark"] .lg-row[data-level="debug"] .lg-level { color: #b39bff; }
.lg-row[data-level="debug"] { color: var(--muted); }
.lg-row[data-level="info"] .lg-level { color: var(--ok); }
.lg-row[data-level="warn"] { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn-soft) 55%, transparent); }
.lg-row[data-level="warn"] .lg-level { color: var(--warn); }
.lg-row[data-level="error"] { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad-soft) 65%, transparent); }
.lg-row[data-level="error"] .lg-level { color: var(--bad); }
.lg-group { display: block; }
.lg-stack-box { margin: 2px 12px 6px 188px; }
.lg-stack-box summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.lg-stack {
  margin: 4px 0 0; padding: 8px 10px; max-height: 260px; overflow: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 11.5px; white-space: pre;
}
.logs-empty { margin: 0; padding: 4px 2px; }
.logs-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.faults-list { display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 0; }
.ft-card {
  display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--warn); border-radius: var(--radius);
}
.ft-card[data-level="error"] { border-left-color: var(--bad); }
.ft-card.acked { opacity: .6; border-left-color: var(--border-strong); }
.ft-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ft-head .lg-level[data-level="warn"] { color: var(--warn); }
.ft-head .lg-level[data-level="error"] { color: var(--bad); }
.ft-msg { min-width: 0; overflow-wrap: anywhere; }
.ft-error { font-family: var(--mono); font-size: 12.5px; color: var(--bad); overflow-wrap: anywhere; }
.ft-card .lg-fields { margin: 0; font-family: var(--mono); font-size: 12px; }
.ft-card .lg-stack-box { margin: 0; }
.ft-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 720px) {
  .lg-row { grid-template-columns: auto auto minmax(0, 1fr); gap: 0 8px; padding: 5px 10px; }
  .lg-msg { grid-column: 1 / -1; padding-top: 2px; }
  .lg-stack-box { margin-left: 10px; }
  .logs-search { max-width: none; flex-basis: 100%; }
}
.field input[type="color"] { height: 36px; padding: 2px 4px; cursor: pointer; }
.term-preview { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; white-space: pre; overflow: hidden; }
.term-preview #termCfgCaret { display: inline-block; width: .6em; }
html { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
body[data-view] {
  display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); grid-template-rows: var(--topbar-h) minmax(0, 1fr) var(--status-h); grid-template-areas: "rail top" "rail main" "rail status";
}
body[data-view] > .rail { grid-area: rail; }
body[data-view] > .topbar { grid-area: top; }
body[data-view] > main { grid-area: main; }
body[data-view] > .statusbar { grid-area: status; }
.brand-mark .ic { width: 19px; height: 19px; stroke-width: 2.2; }
.view-title { font-size: 14px; font-weight: 650; letter-spacing: .1px; }
.statusbar {
  display: flex; align-items: center; gap: 16px; padding: 0 12px; font-size: 12px; color: var(--muted); background: var(--surface); border-top: 1px solid var(--border); min-width: 0;
}
.statusbar b { color: var(--text); font-weight: 600; }
.sb-item { display: inline-flex; align-items: center; gap: 7px; min-width: 0; white-space: nowrap; }
.sb-btn {
  height: 100%; padding: 0 8px; margin: 0 -8px; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.sb-btn:hover { background: var(--surface-3); color: var(--text); }
.sb-btn[data-busy="true"] { color: var(--accent-ink); }
.sb-btn[data-busy="true"] .ic { animation: sb-pulse 1.1s ease-in-out infinite; }
@keyframes sb-pulse { 50% { opacity: .35; } }
.dot[data-state="online"] { background: var(--ok); box-shadow: 0 0 0 2px var(--ok-soft), 0 0 8px var(--ok); }
.dot[data-state="partial"] { background: var(--warn); box-shadow: 0 0 0 2px var(--warn-soft), 0 0 8px var(--warn); }
.dot[data-state="offline"], .dot[data-state="error"] { background: var(--bad); box-shadow: 0 0 0 2px var(--bad-soft); }
.seg button[aria-checked="true"], .seg button[aria-selected="true"] { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.dialog-card {
  border-color: var(--border-strong); display: grid; gap: 12px; padding: 0; border-radius: 12px; overflow: hidden auto; max-height: calc(100vh - 32px); align-content: start;
}
.device-grid { display: grid; align-content: start; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.device-card {
  position: relative; gap: 12px; padding: 14px 16px 14px 18px; border-radius: var(--radius); box-shadow: none; overflow: hidden;
}
.device-card:has(.dot[data-state="online"])::before { background: var(--ok); }
.device-card:has(.dot[data-state="partial"])::before { background: var(--warn); }
.device-card:has(.dot[data-state="offline"])::before, .device-card:has(.dot[data-state="error"])::before { background: var(--bad); }
.device-card:hover { transform: none; }
.device-card.current { box-shadow: none; }
.empty h2 { color: var(--text); font-size: 18px; }
#view-files { padding: 10px 12px; gap: 8px; }
#view-files .connbar { padding: 5px 8px; }
.commander { grid-template-columns: minmax(0, 1fr) 60px minmax(0, 1fr); }
.pane.active { border-color: var(--border-strong); box-shadow: inset 0 2px 0 var(--accent); }
.pane-badge {
  padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0; text-transform: none;
}
.filterbar .filter-input { min-height: 28px; font-size: 12.5px; }
.files tr.row:hover td { background: var(--row-hover); }
.files tr.row.selected td { background: var(--sel); }
.files tr.row.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.files td.mode, .files td.muted { font-size: 12px; }
.queue { border-radius: var(--radius); }
.queue-head h2 { font-size: 12.5px; font-weight: 650; }
.termtabs-list .tab { border-radius: 6px 6px 0 0; }
.toast.error { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
@media (max-width: 900px) {
  :root { --topbar-h: 46px; }
  body[data-view] {
    grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--topbar-h) minmax(0, 1fr) 58px; grid-template-areas: "top" "main" "rail";
  }
  body[data-view] > .statusbar { display: none; }
  .commander { grid-template-columns: minmax(0, 1fr); }
  .view { padding: 10px; }
}
.dialog-card > * { margin-left: 18px; margin-right: 18px; min-width: 0; }
.dialog-card > .dlg-head { margin: 0; }
.dlg-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 0 8px 0 18px; min-height: 46px; background: var(--surface-2); border-bottom: 1px solid var(--border); flex-wrap: nowrap;
}
.dlg-head > .ic { width: 18px; height: 18px; color: var(--accent); }
.dlg-head h2 { flex: 1; margin: 0; font-size: 14px; font-weight: 650; }
.dlg-close { margin-left: auto; }
.dialog-card > .dialog-actions {
  position: sticky; bottom: 0; z-index: 2; margin: 6px 0 0; padding: 10px 18px; gap: 8px; background: var(--surface-2); border-top: 1px solid var(--border);
}
.dialog-actions .btn { min-height: 32px; min-width: 92px; }
.dialog-actions .btn.danger { margin-right: auto; }
.ra-head { margin-top: 0; }
.ra-head:not(:has(*)) { display: none; }
.field > span:first-child { font-size: 12px; font-weight: 600; color: var(--muted); }
.advanced {
  padding: 8px 12px; background: var(--inset); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.advanced[open] summary { margin-bottom: 10px; }
.dialog-actions .btn.primary, .devicebar .btn.primary { box-shadow: 0 1px 0 rgb(0 0 0 / .15); }
.devicebar { gap: 6px; }
.logs-tab, .pane-switch button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.pane-switch button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-ink); }
input[type="color"] {
  width: 100%; height: 30px; padding: 3px; background: var(--inset); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 4px; }
input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px var(--inset) inset; -webkit-text-fill-color: var(--text); }
.dialog-card p { margin-block: 0; }
.dialog-card > textarea { width: calc(100% - 36px); }
.dlg-head .editor-title { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.dlg-head .editor-title code { background: transparent; color: var(--faint); padding: 0; }
.dlg-head .ra-state { margin: 0; }
/* ═══ Workspace: split terminals, saved sites, WinSCP-style Files ═══════════════════════════════ */
[data-color="red"] { --c: #e5484d; }
[data-color="orange"] { --c: #f76b15; }
[data-color="amber"] { --c: #e5a50a; }
[data-color="green"] { --c: #30a46c; }
[data-color="teal"] { --c: #12a594; }
[data-color="blue"] { --c: #0091ff; }
[data-color="violet"] { --c: #8e4ec6; }
[data-color="pink"] { --c: #d6409f; }
/* terminal: split layout */
.tlayout { position: absolute; inset: 6px 4px 4px 8px; display: flex; min-width: 0; min-height: 0; }
.tlayout > .tpane, .tlayout > .tsplit { flex: 1 1 0; min-width: 0; min-height: 0; }
.tparking { display: none; }
.tsplit { display: flex; min-width: 0; min-height: 0; }
.tsplit.row { flex-direction: row; }
.tsplit.col { flex-direction: column; }
.tpane { position: relative; display: flex; min-width: 0; min-height: 0; }
.tpane > .terminal-screen { position: absolute; inset: 0; }
.tbar { flex: 0 0 7px; position: relative; touch-action: none; outline: none; }
.tsplit.row > .tbar { cursor: col-resize; }
.tsplit.col > .tbar { cursor: row-resize; }
.tbar::after { content: ""; position: absolute; background: var(--border-strong); transition: background .12s; }
.tsplit.row > .tbar::after { left: 3px; right: 3px; top: 0; bottom: 0; }
.tsplit.col > .tbar::after { top: 3px; bottom: 3px; left: 0; right: 0; }
.tbar:hover::after, .tbar:focus-visible::after, .tbar.drag::after { background: var(--accent); }
.tlayout.multi .terminal-screen:not(.focused) { opacity: .74; }
.tlayout.multi .terminal-screen.focused::before {
  content: ""; position: absolute; left: 0; right: 0; top: -3px; height: 2px; background: var(--accent); z-index: 3;
}
.tpane-badge {
  display: none; position: absolute; top: 4px; right: 8px; z-index: 4; align-items: center; gap: 6px; max-width: 70%; padding: 1px 4px 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--muted); border: 1px solid var(--border);
}
.tlayout.multi .tpane-badge { display: inline-flex; }
.tpane-badge[data-color] { border-color: var(--c); }
.tpane-badge .dot { width: 7px; height: 7px; box-shadow: none; flex: none; background: var(--faint); }
.tpane-badge[data-state="connected"] .dot { background: var(--ok); }
.tpane-badge[data-state="connecting"] .dot { background: var(--accent); }
.tpane-badge[data-state="error"] .dot { background: var(--bad); }
.tpane-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpane-badge .icon-btn { width: 20px; height: 20px; min-height: 0; }
.tpane-badge .icon-btn .ic { width: 12px; height: 12px; }
.tt[data-color] { border-left: 3px solid var(--c); }
.tt-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; background: var(--surface-3); color: var(--muted);
}
#terminalLauncher { margin-left: -4px; }
/* saved sites */
.sites-head { justify-content: space-between; align-items: center; }
.sites-find {
  display: flex; align-items: center; gap: 6px; flex: 1 1 220px; max-width: 380px; padding: 0 10px; min-height: 36px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted);
}
.sites-find:focus-within { border-color: var(--accent); }
.sites-find .filter-input { flex: 1; min-width: 0; border: 0; background: transparent; box-shadow: none; padding: 0; }
.sites-find .filter-input:focus { outline: none; }
.sites-head .seg button { min-width: 34px; }
.sites { display: flex; flex-direction: column; gap: 16px; }
.site-group { display: flex; flex-direction: column; gap: 8px; }
.site-group-title {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 2px 6px 2px 2px; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 650; font-size: 13.5px; cursor: pointer; border-radius: 6px;
}
.site-group-title:hover { background: var(--surface-2); }
.site-group-title .ic { width: 16px; height: 16px; }
.sites-none { margin: 24px auto; }
.site-note { margin-top: 2px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.device-card[data-color] { border-top: 3px solid var(--c); }
.device-menu .icon-btn.on { color: var(--accent-ink); }
.device-menu .icon-btn.on .ic { fill: currentColor; }
.chip.folder { font-family: var(--mono); font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip.used { font-weight: 500; }
.sites[data-mode="list"] .device-grid { grid-template-columns: 1fr; gap: 6px; }
.sites[data-mode="list"] .device-card {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; align-items: center; column-gap: 14px; padding: 8px 12px;
}
.sites[data-mode="list"] .device-card .device-info { grid-column: 1 / -1; }
.sites[data-mode="list"] .device-actions { display: flex; margin: 0; flex-wrap: nowrap; }
.sites[data-mode="list"] .device-actions .btn { min-height: 32px; padding: 0 10px; }
.sites[data-mode="list"] .device-top .avatar { width: 32px; height: 32px; border-radius: 9px; }
@media (max-width: 900px) {
  .sites[data-mode="list"] .device-card { grid-template-columns: minmax(0, 1fr); row-gap: 6px; }
  .sites[data-mode="list"] .device-actions { display: grid; flex-wrap: wrap; }
}
.swatches { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 2px; }
.swatch {
  width: 24px; height: 24px; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid transparent; background: var(--c); cursor: pointer;
}
.swatch.none { background: transparent; border: 2px dashed var(--border-strong); }
.swatch[aria-checked="true"] { outline: 2px solid var(--text); outline-offset: 2px; }
/* Files: WinSCP-style commander with an optional Cyberduck-style site drawer */
.files-body { flex: 1 1 0; min-height: 0; display: flex; gap: 8px; }
.files-body > .commander { flex: 1 1 0; min-width: 0; }
.sites-side {
  flex: 0 0 224px; display: flex; flex-direction: column; gap: 8px; min-height: 0; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.sites-side[hidden] { display: none; }
.sites-side-list { flex: 1 1 0; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.side-heading { padding: 8px 8px 2px; font-size: 12px; font-weight: 650; color: var(--muted); }
.side-site {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; align-items: center; text-align: left; padding: 6px 8px; border: 0; border-left: 3px solid transparent; border-radius: 6px; background: transparent; color: var(--text); font: inherit; cursor: pointer;
}
.side-site[data-color] { border-left-color: var(--c); }
.side-site:hover { background: var(--surface-2); }
.side-site.current { background: var(--accent-soft); }
.side-site .dot { grid-row: 1 / span 2; width: 8px; height: 8px; box-shadow: none; }
.side-name { font-weight: 600; font-size: 13px; }
.side-host { font-family: var(--mono); font-size: 11px; }
.commander[data-local-left="1"] #localPane { order: 1; }
.commander[data-local-left="1"] .bridge { order: 2; }
.commander[data-local-left="1"] #remotePane { order: 3; }
.commander[data-local-left="1"] .bridge-btn .ic { transform: scaleX(-1); }
@media (max-width: 900px) {
  .files-body { flex-direction: column; flex: none; }
  .sites-side { flex: none; max-height: 190px; }
  .tpane-badge { max-width: 60%; }
}
/* ═══ Unified design system (final layer) ═════════════════════════════════════════════════════
   One rule set for controls so every screen looks the same:
   • Solid accent colour = the ONE main action of an area (.btn.primary). Nothing else is solid orange.
   • Every other button is neutral. Red appears only on hover/confirm of destructive actions.
   • Selected state (tabs, segmented controls, chips) = soft accent tint + accent text, never a solid fill.
   • Keyboard hints (kbd) are muted. Status is shown with small dots, not coloured blocks.
   ═══════════════════════════════════════════════════════════════════════════════════════════ */
/* selected = soft tint (was a solid orange block on every toggle) */
.seg button[aria-checked="true"], .seg button[aria-selected="true"], .seg button[aria-pressed="true"], .seg button.on {
  background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}
/* keyboard hints and chips: quiet */
kbd { color: var(--faint); font-weight: 600; background: transparent; border-color: var(--border); }
.lg-chip b, .lg-chip[data-level="warn"] b, .lg-chip[data-level="error"] b { color: var(--text); }
.lg-chip[data-level="warn"]::before, .lg-chip[data-level="error"]::before { content: ""; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--warn); }
.lg-chip[data-level="error"]::before { background: var(--bad); }
/* receiver remote: every key neutral; colour keys are slim bars, not a rainbow of blocks */
.remote .rk, .rk { background: var(--surface-3); color: var(--text); border: 1px solid var(--border); }
.rk.vol, .rk.ch, .rk.nav { background: var(--surface-3); }
.remote .rk.red, .remote .rk.green, .remote .rk.yellow, .remote .rk.blue, .rk.red, .rk.green, .rk.yellow, .rk.blue {
  min-height: 30px; height: 30px; padding: 0; border: 1px solid var(--border); border-bottom: 4px solid var(--k, #888); box-shadow: none;
}
.rk.red { --k: #d64545; }
.rk.green { --k: #2f9e57; }
.rk.blue { --k: #3a7bd5; }
.rk.ok {
  background: var(--accent-soft); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.rk.ok:hover { color: var(--on-accent); }
.rk.rec { color: var(--bad); }
/* status bar: the device is already in the top bar, do not repeat it */
.statusbar .sb-item:has(#sbDevice) { display: none; }
/* device cards: calm header, one tidy row of launchers */
.device-menu .icon-btn { width: 28px; height: 28px; }
.device-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.device-actions .btn { min-width: 0; padding: 0 6px; gap: 6px; font-size: 12.5px; }
@media (max-width: 420px) {
  .device-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* ═══ Outline controls (overrides everything above) ═══════════════════════════════════════════
   Buttons are never filled with colour. A clear 1px edge carries the state:
   neutral edge = normal · accent edge = the main action · red edge = destructive.
   Hover adds only a faint tint. Dark mode uses a lighter edge so every control stays visible.
   ═══════════════════════════════════════════════════════════════════════════════════════════ */
/* main action: accent edge + accent text, still no fill */
.device-actions .btn.primary { background: transparent; border: 1.5px solid var(--accent); color: var(--accent-ink); font-weight: 650; }
.device-actions .btn.primary:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
/* destructive: red edge and text, tint on hover */
/* fields: clearly outlined in both themes */
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
/* icon buttons get a visible edge on hover and when active */
/* selected = accent edge, faint tint (segmented, sub-tabs, protocol badge) */
.seg { background: transparent; }
.seg button[aria-checked="true"], .seg button[aria-selected="true"], .seg button[aria-pressed="true"], .seg button.on { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1.5px var(--accent); }
.proto-badge { background: transparent; color: var(--accent-ink); border: 1px solid var(--accent); }
/* logo: outlined like everything else */
.brand-mark { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
/* cards and panels: a real edge in dark mode, current device marked by edge not a bar */
.device-card, .pane, .queue, .lists-pane { border-color: var(--border); }
.device-card:hover { border-color: var(--border-strong); }
.device-card.current { border-color: var(--accent); }
.device-card.current::before { display: none; }
/* receiver remote: OK key outlined, never filled */
.rk { border-color: var(--border-strong); background: transparent; }
.rk:hover, .rk.vol:hover, .rk.ch:hover, .rk.nav:hover { background: color-mix(in srgb, var(--text) 7%, transparent); border-color: var(--muted); }
.rk.ok, .rk.ok:hover { background: transparent; color: var(--accent-ink); border: 1.5px solid var(--accent); }
.rk.ok:hover { background: var(--accent-soft); }
.remote .rk.red, .remote .rk.green, .remote .rk.yellow, .remote .rk.blue, .rk.red, .rk.green, .rk.yellow, .rk.blue { background: transparent; }
.rk.yellow { --k: #d1b23a; }
/* sub-tab strip: only the selected tab carries an edge, the rest stay quiet */
/* segmented controls: soft outer edge so the selected option is the only strong line */
.seg { border-color: var(--border); }
/* ═══ Detail pass ═════════════════════════════════════════════════════════════════════════════ */
/* disabled: dim the whole control, never change which buttons look "active" */
/* toolbars (file actions, channel editor): quiet but visible edge on every button */
.bq-toolbar .btn:not(.primary):not(.danger) { border-color: var(--border); }
/* status chips: outline + dot, no red or grey blocks */
.chip { background: transparent; border: 1px solid var(--border-strong); color: var(--muted); }
.chip.on { background: transparent; border-color: var(--border-strong); color: var(--muted); }
.chip.off { background: transparent; border-color: color-mix(in srgb, var(--bad) 55%, transparent); color: var(--bad); }
.chip.plain { border-color: var(--border); }
.badge { background: transparent; border: 1px solid var(--border-strong); color: var(--muted); }
.badge.ok { background: transparent; border-color: color-mix(in srgb, var(--ok) 55%, transparent); color: var(--ok); }
.badge.warn { background: transparent; border-color: color-mix(in srgb, var(--warn) 60%, transparent); color: var(--warn); }
.badge.bad { background: transparent; border-color: color-mix(in srgb, var(--bad) 55%, transparent); color: var(--bad); }
.badge.accent { background: transparent; border-color: var(--accent); color: var(--accent-ink); }
/* segmented controls and tabs inside dialogs: room between icon and label */
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
/* login: full-width fields and button */
.login-card form { display: grid; gap: 14px; }
.login-card .btn.primary { width: 100%; }
.login-card .brand-name b { font-weight: 700; }
/* notices keep their edge; the fill is only a whisper */
.notice { background: color-mix(in srgb, var(--warn) 8%, transparent); }
.notice.safe { background: color-mix(in srgb, var(--ok) 8%, transparent); }
/* dialogs: clearer edge in dark mode */
dialog { border: 1px solid var(--border-strong); }
dialog::backdrop { background: rgb(5 8 12 / .62); backdrop-filter: blur(2px); }
/* toasts: outlined as well */
.toast { background: var(--surface); }
/* table-like lists: header underline visible in dark */
.files thead th { border-bottom: 1px solid var(--border); }
/* chips: bring back the status dot so state never relies on colour alone */
.chip.on::before, .chip.off::before { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex: none; }
.chip.on::before { background: var(--ok); }
.chip.off::before { background: var(--bad); }
.chip { gap: 6px; }
/* native file picker button: same outline as every other button */
input[type="file"] { color: var(--muted); font: inherit; max-width: 100%; }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; color: var(--text); background: transparent; border: 1px solid var(--border-strong); border-radius: 8px; padding: 5px 12px; margin-right: 10px; cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: color-mix(in srgb, var(--text) 7%, transparent); border-color: var(--muted); }
/* ═══ Controls: the one place that defines buttons, fields, bars, side rail and top bar ═══════
   Everything here reads the tokens below, so a change is made once:
     --ctl-h         height of every button and field (Compact 28 · Normal 30 · Roomy 36 · touch 40)
     --field-border  quiet neutral edge of fields and buttons; hover/focus/selected use the accent
   Edges carry state: neutral = normal · accent = main action or selected · red = destructive.
   Nothing is filled with colour except a faint tint on hover.
   ═══════════════════════════════════════════════════════════════════════════════════════════ */
:root {
  --ctl-h: 30px;
  --ctl-fs: 13px;
  --field-border: color-mix(in srgb, var(--text) 30%, var(--surface));
  --topbar-h: 40px;
}
:root[data-density="compact"] { --ctl-h: 28px; }
:root[data-density="roomy"] { --ctl-h: 36px; }
@media (max-width: 900px), (pointer: coarse) { :root, :root[data-density] { --ctl-h: 40px; } }

/* ── Buttons ───────────────────────────────────────────────────────────────────────────────── */
/* Base rules sit in :where() so they have zero specificity: a rule for one place (.only-mobile, .screen-tools .btn …) always wins, whatever the order. */
:where(.btn, .toolsnav-btn, .actionbar .btn, .bridge-btn) {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--ctl-h); padding: 0 12px;
  font: inherit; font-size: var(--ctl-fs); font-weight: 600; line-height: 1.25; white-space: nowrap;
  color: var(--text); background: transparent;
  border: 1px solid var(--field-border); border-radius: var(--radius-sm);
  box-shadow: none; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.btn > span, .toolsnav-btn > span { min-width: 0; }
.btn .ic { width: 16px; height: 16px; flex: none; opacity: .9; }
.btn.sm { padding: 0 9px; }
.btn.sq { width: var(--ctl-h); min-width: var(--ctl-h); padding: 0; }
.btn:hover:not(:disabled), .toolsnav-btn:hover:not(:disabled), .actionbar .btn:hover:not(:disabled), .bridge-btn:hover:not(:disabled) {
  background: transparent; border-color: var(--accent); color: var(--text);
}
.btn.danger:hover:not(:disabled), .actionbar .btn.danger:hover:not(:disabled) { border-color: var(--bad); }
.btn:active:not(:disabled) { background: transparent; }
.btn:focus-visible, .icon-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled, .actionbar .btn:disabled, .bridge-btn:disabled { opacity: .42; cursor: not-allowed; border-color: var(--field-border); }
.btn:disabled:hover, .icon-btn:disabled:hover { background: transparent; }

.btn.primary, .actionbar .btn.primary, .device-actions .btn.primary { color: var(--text); border-color: var(--accent); font-weight: 650; }
.btn.primary:disabled { border-color: var(--accent); }
.btn.primary .ic { opacity: 1; color: inherit; }
.btn.primary kbd { color: inherit; opacity: .8; border-color: currentColor; }
/* Appearance ▸ Buttons: optional fills */
:root[data-btn="tinted"] .btn:not(.primary):not(.danger):not(:disabled), :root[data-btn="tinted"] .actionbar .btn:not(.primary):not(.danger) { background: color-mix(in srgb, var(--text) 7%, transparent); border-color: transparent; }
:root[data-btn="tinted"] .btn:not(.primary):not(.danger):hover:not(:disabled) { background: color-mix(in srgb, var(--text) 13%, transparent); border-color: transparent; }
:root[data-btn="tinted"] .btn.primary:not(:disabled), :root[data-btn="tinted"] .btn.primary:hover:not(:disabled) { background: var(--accent-soft); border-color: transparent; }
:root[data-btn="tinted"] .btn.danger:not(:disabled) { background: var(--bad-soft); border-color: transparent; }
:root[data-btn="solid"] .btn.primary, :root[data-btn="solid"] .btn.primary:hover:not(:disabled), :root[data-btn="solid"] .btn.primary:disabled { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
:root[data-btn="solid"] .btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
:root[data-btn="solid"] .btn.primary kbd { color: var(--on-accent); }

.btn.danger, .actionbar .btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 55%, var(--field-border)); }
.btn.danger:hover:not(:disabled), .actionbar .btn.danger:hover:not(:disabled) { color: var(--bad); }
.btn.danger:disabled, .actionbar .btn.danger:disabled { color: var(--muted); border-color: var(--field-border); background: transparent; }

:where(.icon-btn) {
  display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px; padding: 0;
  color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.icon-btn:hover:not(:disabled) { color: var(--text); background: transparent; border-color: var(--accent); }
.icon-btn:active:not(:disabled) { transform: scale(.92); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn.on { color: var(--text); background: transparent; border-color: var(--accent); }
.icon-btn[title^="Delete"]:hover:not(:disabled), .icon-btn[title^="Remove"]:hover:not(:disabled),
.icon-btn[title*="Delete"]:hover:not(:disabled), .icon-btn[title*="delete"]:hover:not(:disabled) { color: var(--bad); background: transparent; border-color: var(--bad); }

/* ── Fields ────────────────────────────────────────────────────────────────────────────────── */
select, textarea, input[type="text"], input[type="number"], input[type="password"], input[type="search"],
input[type="datetime-local"], input[type="email"], input[type="url"], input[type="tel"], input[type="date"], input[type="time"], input:not([type]) {
  min-width: 0; min-height: var(--ctl-h); padding: 0 10px;
  font: inherit; font-size: var(--ctl-fs); line-height: 1.3; color: var(--text);
  background: var(--inset); border: 1px solid var(--field-border); border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s;
}
textarea { padding: 6px 10px; }
select { padding-right: 6px; cursor: pointer; }
select:hover, textarea:hover, input:hover:not(:disabled):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]) { border-color: var(--faint); }
select:focus, textarea:focus, input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* ── Bars: no frame around a row of buttons, a hairline under it instead ──────────────────── */
.connbar, .bq-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.connbar { padding: 0 0 8px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; box-shadow: none; }
.term-top .connbar { flex: 0 1 auto; }
.term-top { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.term-top .connbar { padding: 0; border-bottom: 0; }
.connbar .status-pill { margin: 0 4px 0 2px; }
.connbar .proto, .connbar .badge { background: transparent; color: var(--text); border: 1px solid var(--accent); }

.tools-top { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.toolsnav { display: flex; flex-wrap: wrap; max-width: 100%; gap: 6px; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
.toolsnav-btn .ic { width: 16px; height: 16px; }
.toolsnav-btn[aria-selected="true"] { color: var(--text); border-color: var(--accent); background: transparent; }

.actionbar .btn { width: 100%; border-color: var(--border); }
.actionbar .btn.primary { border-color: var(--accent); }
.actionbar .btn.danger { border-color: color-mix(in srgb, var(--bad) 55%, var(--field-border)); }
.actionbar .btn { padding: 0 6px; gap: 5px; }
.actionbar .btn kbd { margin: 0 0 0 2px; order: 3; }
.actionbar .btn[data-fkey] kbd { color: var(--faint); font-weight: 600; background: transparent; border-color: var(--border); }
.bridge-btn { flex-direction: column; gap: 3px; width: 100%; min-height: 52px; padding: 6px 4px; font-size: 11px; }
.bridge-btn .ic { width: 20px; height: 20px; }

/* channel editor toolbar: one row of grouped buttons; labels fold into icons before anything wraps */
.bq-main { container-type: inline-size; }
.bq-tools { flex-wrap: nowrap; gap: 6px; min-width: 0; overflow: hidden; }
.bq-group { display: flex; flex: none; flex-wrap: nowrap; align-items: center; gap: 4px; }
.bq-group + .bq-group { padding-left: 6px; border-left: 1px solid var(--border); }
.bq-tools .btn { flex: none; padding: 0 8px; gap: 5px; }
.bq-tools .btn.sq { padding: 0; }
@container (max-width: 1020px) {
  .bq-tools .btn:not(.sq) { font-size: 0; gap: 0; padding: 0; width: var(--ctl-h); min-width: var(--ctl-h); }
}
@container (max-width: 380px) { .bq-tools { flex-wrap: wrap; row-gap: 4px; overflow: visible; } }
.bq-head { align-items: stretch; }
.bq-head #bqName { font-weight: 600; }
.bq-side { container-type: inline-size; }
.bq-side .bq-actions { display: grid; grid-auto-flow: column; grid-template-columns: minmax(0, 1fr) repeat(3, var(--ctl-h)); gap: 6px; }
.bq-side .bq-actions .btn { min-width: 0; padding: 0; grid-column: auto; }
.bq-side .bq-actions #bqNew { padding: 0 8px; }

/* ── Side rail ─────────────────────────────────────────────────────────────────────────────── */
.rail { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0; background: var(--surface); border-right: 1px solid var(--border); z-index: 3; }
.rail .brand { margin-bottom: 10px; }
.rail .brand-name { display: none; }
.rail .tabs { flex-direction: column; gap: 0; margin: 0; width: 100%; padding: 0 6px; }
.rail .tab {
  position: relative; flex-direction: column; justify-content: center; gap: 2px; width: 100%; height: 52px; padding: 0;
  font-size: 12px; font-weight: 600; line-height: 1.1; letter-spacing: 0; color: var(--faint);
  border-radius: var(--radius-sm); box-shadow: none; background: transparent;
}
.rail .tab .ic { width: 20px; height: 20px; }
.rail .tab:hover { background: transparent; color: var(--text); }
.rail .tab[aria-selected="true"] { background: transparent; color: var(--accent-ink); box-shadow: none; }
.rail-foot { margin-top: auto; }

/* ── Top bar: the device every tab works on ────────────────────────────────────────────────── */
.topbar { flex: none; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 14px; position: relative; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--border); }
.device-picker { display: flex; align-items: center; flex: 0 1 420px; min-width: 0; margin-left: 0; padding: 0 4px 0 11px; min-height: var(--ctl-h); background: var(--inset); border: 1px solid var(--field-border); border-radius: var(--radius-sm); }
.device-picker:focus-within { border-color: var(--accent); }
.device-picker .dot { margin-right: 8px; }
.device-picker select { flex: 1 1 auto; width: 100%; max-width: none; min-height: calc(var(--ctl-h) - 2px); padding: 0 22px 0 0; font-weight: 600; text-overflow: ellipsis; background: transparent; border: 0; box-shadow: none; outline: none; }
.device-picker select:focus { box-shadow: none; }
#logoutButton { margin-left: auto; }

/* ── Empty state ───────────────────────────────────────────────────────────────────────────── */
.empty .ic.xl { box-sizing: border-box; width: 48px; height: 48px; padding: 0; color: var(--faint); background: transparent; border-radius: 0; box-shadow: none; stroke-width: 1.4; }

/* ── Small screens ─────────────────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .topbar { gap: 8px; padding: 0 10px; padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .device-picker { flex: 1 1 auto; }
  .btn span { display: inline; }
  .actionbar .btn kbd { display: none; }
  .connbar #fileTerminalHere span, .connbar #fileRun span, .connbar #terminalFiles span { display: none; }
  .rail { flex-direction: row; justify-content: space-around; padding: 0 6px; border-right: 0; border-top: 1px solid var(--border); }
  .rail .brand { display: none; }
  .rail-foot { margin: 0; }
  .rail .tabs { flex-direction: row; padding: 0; gap: 2px; }
  .rail .tab { height: 50px; flex: 1; font-size: 11.5px; }
  .rail .tab span { display: inline; }
}
@media (max-width: 760px) { .actionbar .btn[data-fkey] kbd { display: none; } }
@media (max-width: 600px) {
  .connbar { gap: 6px; }
  .connbar #fileConnect .lbl, .connbar #fileDisconnect .lbl, .connbar #terminalConnect .lbl, .connbar #terminalDisconnect .lbl { display: none; }
  .connbar .field-inline input { width: 64px; }
  .connbar .spacer { display: none; }
}
@media (max-width: 560px) {
  .toolsnav { display: grid; grid-template-columns: 1fr 1fr; }
  .toolsnav-btn { font-size: 13px; padding: 0 6px; }
}
@media (max-width: 420px) { .device-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ═══ Icons: folders and one colour per file type ═══════════════════════════════════════════ */
:root { --folder: #3f86c8; }
:root[data-theme="dark"] { --folder: #6cb0f0; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] { --folder: #6cb0f0; }
}
.files .ic.dir-ic {
  color: var(--folder); width: 20px; height: 20px; stroke-width: 1.6; fill: color-mix(in srgb, var(--folder) 26%, transparent);
}
.files .ic.is-hidden { opacity: .55; }
.files .ic.file-ic { width: 19px; height: 19px; stroke-width: 1.6; }
.files .ic.fi-text { color: #64748b; }
.files .ic.fi-doc { color: #3b82f6; }
.files .ic.fi-pdf { color: #e5484d; }
.files .ic.fi-sheet { color: #22a35a; }
.files .ic.fi-config { color: #7c8aa5; }
.files .ic.fi-data { color: #14a8a8; }
.files .ic.fi-db { color: #0891b2; }
.files .ic.fi-code { color: #4f7df0; }
.files .ic.fi-script { color: #16a34a; }
.files .ic.fi-web { color: #6366f1; }
.files .ic.fi-image { color: #a855f7; }
.files .ic.fi-video { color: #ec4899; }
.files .ic.fi-audio { color: #0ea5e9; }
.files .ic.fi-sub { color: #8b5cf6; }
.files .ic.fi-archive { color: #c2528b; }
.files .ic.fi-box { color: #22a35a; }
.files .ic.fi-chip { color: #64748b; }
.files .ic.fi-key { color: #0d9488; }
.files .ic.fi-font { color: #6d7bd1; }
.files .ic.fi-bouquet, .files .ic.fi-tuner, .files .ic.fi-epg { color: var(--accent); }
.files .ic.fi-meta, .files .ic.fi-lock, .files .ic.fi-bak { color: var(--faint); }
:root[data-theme="dark"] .files .ic[class*="fi-"] { filter: brightness(1.28) saturate(1.05); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .files .ic[class*="fi-"] { filter: brightness(1.28) saturate(1.05); }
}
/* ═══ Backup & restore ══════════════════════════════════════════════════════════════════════ */
#listsBackup .tools-body.bk { align-items: stretch; gap: 16px; padding: 6px 2px; }
.bk-card {
  display: flex !important; flex-direction: column; gap: 16px !important; padding: 20px !important; border-bottom: 1px solid var(--border) !important;
}
.bk-head { display: flex; gap: 14px; align-items: flex-start; }
.bk-head h3 { font-size: 16px; margin: 0 0 4px; }
.bk-head p { margin: 0; line-height: 1.5; }
.bk-ic {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 1.5px solid var(--accent); border-radius: 12px; color: var(--accent-ink);
}
.bk-ic .ic { width: 22px; height: 22px; }
.bk-scope { display: grid; gap: 8px; padding: 0; border: 0; background: transparent; }
.bk-scope button {
  display: grid; grid-template-columns: 18px 1fr; column-gap: 12px; row-gap: 2px; text-align: left; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: transparent; box-shadow: none;
}
.bk-scope button::before {
  content: ""; grid-row: 1 / span 2; align-self: center; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); box-sizing: border-box;
}
.bk-scope button:hover { border-color: var(--muted); }
.bk-scope button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: none; }
.bk-scope button[aria-checked="true"]::before { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 38%, transparent 42%); }
.bk-opt-t { font-weight: 650; color: var(--text); text-align: left; }
.bk-opt-d { font-size: 12.5px; color: var(--muted); font-weight: 400; text-align: left; }
.bk-drop {
  display: grid; justify-items: center; gap: 6px; padding: 26px 16px; text-align: center; border: 1.5px dashed var(--border-strong); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s;
}
.bk-drop:hover, .bk-drop.drag { border-color: var(--accent); background: var(--accent-soft); }
.bk-drop.has-file { border-style: solid; border-color: var(--accent); }
.bk-drop .ic.xl { width: 38px; height: 38px; color: var(--faint); }
.bk-drop.has-file .ic.xl { color: var(--accent-ink); }
.bk-drop b { overflow-wrap: anywhere; }
.bk-drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.bk-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.bk-foot { margin-top: auto; display: flex; justify-content: flex-end; }
.files .ic.fi-log { color: #6f7b8a; }
.files .ic.fi-disc { color: #76849a; }
#listsBackup .tools-body.bk { max-width: 1100px; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
@media (max-width: 640px) {
  .bk-card { padding: 16px !important; }
  .bk-drop { padding: 20px 12px; }
}
#listsBackup, #listsBackup .tools-body.bk { min-width: 0; width: 100%; box-sizing: border-box; }
.bk-card, .bk-head > div, .bk-scope button, .bk-drop { min-width: 0; }
@media (max-width: 640px) {
  #listsBackup .tools-body.bk { grid-template-columns: minmax(0, 1fr); }
}
/* ═══ Final tweaks ═══════════════════════════════════════════════════════════════════════════ */
.ra-state:empty { display: none; }
/* main buttons: only the edge carries the accent. Text and icon stay neutral. */
.seg button[aria-checked="true"], .seg button[aria-selected="true"], .seg button[aria-pressed="true"], .seg button.on, .proto-badge, .rk.ok, .rk.ok:hover, .bk-scope button[aria-checked="true"] .bk-opt-t { color: var(--text); }
.bk-ic, .bk-drop.has-file .ic.xl { color: var(--text); }
/* receiver colour keys: outlined in their own colour, neutral label-free bar inside */
:root { --k-red: #d83b3b; --k-green: #1f9d4d; --k-yellow: #c9a400; --k-blue: #2f6fe0; }
:root[data-theme="dark"] { --k-red: #f06b6b; --k-green: #4fd883; --k-yellow: #f2d338; --k-blue: #6ea4ff; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] { --k-red: #f06b6b; --k-green: #4fd883; --k-yellow: #f2d338; --k-blue: #6ea4ff; }
}
.remote .rk.red, .remote .rk.green, .remote .rk.yellow, .remote .rk.blue {
  position: relative; height: 30px; min-height: 30px; padding: 0; background: transparent; box-shadow: none; border: 1.5px solid var(--k); border-bottom-width: 1.5px; border-radius: 9px; color: var(--k);
}
.remote .rk.red { --k: var(--k-red); }
.remote .rk.green { --k: var(--k-green); }
.remote .rk.yellow { --k: var(--k-yellow); }
.remote .rk.blue { --k: var(--k-blue); }
.remote .rk.red::after, .remote .rk.green::after, .remote .rk.yellow::after, .remote .rk.blue::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 5px; border-radius: 3px; transform: translate(-50%, -50%); background: var(--k);
}
.remote .rk.red:hover, .remote .rk.green:hover, .remote .rk.yellow:hover, .remote .rk.blue:hover { background: color-mix(in srgb, var(--k) 16%, transparent); border-color: var(--k); }
.remote .rk.red:active, .remote .rk.green:active, .remote .rk.yellow:active, .remote .rk.blue:active, .remote .rk.red.sending, .remote .rk.green.sending, .remote .rk.yellow.sending, .remote .rk.blue.sending { background: color-mix(in srgb, var(--k) 28%, transparent); transform: none; }
/* ═══ Appearance customisation (set from the palette button) ═══════════════════════════════ */
:root[data-accent]:not([data-theme="dark"]) {
  --accent: hsl(var(--acc-h) var(--acc-s) 33%); --accent-strong: hsl(var(--acc-h) var(--acc-s) 25%); --accent-ink: hsl(var(--acc-h) var(--acc-s) 24%); --accent-soft: hsl(var(--acc-h) calc(var(--acc-s) * .7) 92%); --on-accent: #fff; --sel: hsl(var(--acc-h) calc(var(--acc-s) * .7) 93%); --sel-border: hsl(var(--acc-h) var(--acc-s) 66%);
}
:root[data-accent][data-theme="dark"] {
  --accent: hsl(var(--acc-h) var(--acc-s) 62%); --accent-strong: hsl(var(--acc-h) var(--acc-s) 72%); --accent-ink: hsl(var(--acc-h) var(--acc-s) 76%); --accent-soft: hsl(var(--acc-h) calc(var(--acc-s) * .55) 14%); --on-accent: hsl(var(--acc-h) var(--acc-s) 8%); --sel: hsl(var(--acc-h) calc(var(--acc-s) * .55) 15%); --sel-border: hsl(var(--acc-h) calc(var(--acc-s) * .6) 36%);
}
@media (prefers-color-scheme: dark) {
  :root[data-accent][data-theme="auto"] {
    --accent: hsl(var(--acc-h) var(--acc-s) 62%); --accent-strong: hsl(var(--acc-h) var(--acc-s) 72%); --accent-ink: hsl(var(--acc-h) var(--acc-s) 76%); --accent-soft: hsl(var(--acc-h) calc(var(--acc-s) * .55) 14%); --on-accent: hsl(var(--acc-h) var(--acc-s) 8%); --sel: hsl(var(--acc-h) calc(var(--acc-s) * .55) 15%); --sel-border: hsl(var(--acc-h) calc(var(--acc-s) * .6) 36%);
  }
}
:root[data-folder="accent"] { --folder: var(--accent); }
:root[data-folder="custom"]:not([data-theme="dark"]) { --folder: hsl(var(--fld-h) var(--fld-s) 46%); }
:root[data-folder="custom"][data-theme="dark"] { --folder: hsl(var(--fld-h) var(--fld-s) 66%); }
@media (prefers-color-scheme: dark) {
  :root[data-folder="custom"][data-theme="auto"] { --folder: hsl(var(--fld-h) var(--fld-s) 66%); }
}
:root[data-tone="cool"]:not([data-theme="dark"]) {
  --bg: #e6edf5; --surface: #fff; --surface-2: #f1f6fb; --surface-3: #dde6f0; --inset: #f1f6fb; --border: #c8d4e2; --row-hover: #eef3f9;
}
:root[data-tone="cool"][data-theme="dark"] {
  --bg: #0b1017; --surface: #111925; --surface-2: #16202e; --surface-3: #202c3d; --inset: #0d141d; --border: #2b3a4f; --row-hover: #172231;
}
@media (prefers-color-scheme: dark) {
  :root[data-tone="cool"][data-theme="auto"] {
    --bg: #0b1017; --surface: #111925; --surface-2: #16202e; --surface-3: #202c3d; --inset: #0d141d; --border: #2b3a4f; --row-hover: #172231;
  }
}
:root[data-tone="neutral"]:not([data-theme="dark"]) {
  --bg: #ebebeb; --surface: #fff; --surface-2: #f5f5f5; --surface-3: #e4e4e4; --inset: #f5f5f5; --border: #d0d0d0; --row-hover: #f2f2f2;
}
:root[data-tone="neutral"][data-theme="dark"] {
  --bg: #0e0e0f; --surface: #161617; --surface-2: #1c1c1e; --surface-3: #272729; --inset: #0f0f10; --border: #38383b; --row-hover: #1d1d1f;
}
@media (prefers-color-scheme: dark) {
  :root[data-tone="neutral"][data-theme="auto"] {
    --bg: #0e0e0f; --surface: #161617; --surface-2: #1c1c1e; --surface-3: #272729; --inset: #0f0f10; --border: #38383b; --row-hover: #1d1d1f;
  }
}
:root[data-tone="oled"]:not([data-theme="dark"]) {
  --bg: #fff; --surface: #fff; --surface-2: #f6f6f6; --surface-3: #ececec; --inset: #f6f6f6; --border: #d9d9d9; --row-hover: #f4f4f4;
}
:root[data-tone="oled"][data-theme="dark"] {
  --bg: #000; --surface: #0a0a0a; --surface-2: #111; --surface-3: #1c1c1c; --inset: #000; --border: #2e2e2e; --row-hover: #131313;
}
@media (prefers-color-scheme: dark) {
  :root[data-tone="oled"][data-theme="auto"] {
    --bg: #000; --surface: #0a0a0a; --surface-2: #111; --surface-3: #1c1c1c; --inset: #000; --border: #2e2e2e; --row-hover: #131313;
  }
}
:root[data-edge="soft"] {
  --border: color-mix(in srgb, var(--text) 9%, var(--bg)); --border-strong: color-mix(in srgb, var(--text) 26%, var(--bg));
}
:root[data-edge="strong"] {
  --border: color-mix(in srgb, var(--text) 28%, var(--bg)); --border-strong: color-mix(in srgb, var(--text) 62%, var(--bg));
}
:root[data-btn="tinted"] .btn:not(.primary):not(.danger):not(:disabled), :root[data-btn="tinted"] .actionbar .btn:not(.primary):not(.danger) { background: color-mix(in srgb, var(--text) 7%, transparent); border-color: transparent; }
:root[data-btn="tinted"] .btn:not(.primary):not(.danger):hover:not(:disabled) { background: color-mix(in srgb, var(--text) 13%, transparent); border-color: transparent; }
:root[data-btn="tinted"] .btn.primary:not(:disabled), :root[data-btn="tinted"] .btn.primary:hover:not(:disabled) { background: var(--accent-soft); border-color: transparent; }
:root[data-btn="tinted"] .btn.danger:not(:disabled) { background: var(--bad-soft); border-color: transparent; }
:root[data-btn="solid"] .btn.primary, :root[data-btn="solid"] .btn.primary:hover:not(:disabled), :root[data-btn="solid"] .btn.primary:disabled, :root[data-theme="dark"][data-btn="solid"] .btn.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
:root[data-btn="solid"] .btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
:root[data-btn="solid"] .btn.primary kbd { color: var(--on-accent); }
:root[data-radius="sharp"] :is(.btn, input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),select,.seg,.seg button,.toolsnav,.toolsnav-btn,.chip,.badge,.bk-scope button,.bk-ic,.tab,.brand-mark,.rk,.ap-sw) { border-radius: 3px; }
:root[data-radius="sharp"] :is(.device-card,.pane,.connbar,.lists-pane,.tools-sec,.bk-card,.bk-drop,.queue,dialog,.dialog-card,.toast,.notice,.avatar) { border-radius: 4px; }
:root[data-radius="soft"] :is(.btn, input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),select,.seg,.seg button,.toolsnav,.toolsnav-btn,.chip,.badge,.bk-scope button,.bk-ic,.tab,.brand-mark,.rk,.ap-sw) { border-radius: 12px; }
:root[data-radius="soft"] :is(.device-card,.pane,.connbar,.lists-pane,.tools-sec,.bk-card,.bk-drop,.queue,dialog,.dialog-card,.toast,.notice,.avatar) { border-radius: 18px; }
:root[data-radius="round"] :is(.btn, input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),select,.seg,.seg button,.toolsnav,.toolsnav-btn,.chip,.badge,.bk-scope button,.bk-ic,.tab,.brand-mark,.rk,.ap-sw) { border-radius: 999px; }
:root[data-radius="round"] :is(.device-card,.pane,.connbar,.lists-pane,.tools-sec,.bk-card,.bk-drop,.queue,dialog,.dialog-card,.toast,.notice,.avatar) { border-radius: 24px; }
:root[data-radius="round"] :is(textarea,.seg,.bk-scope button,.bk-drop) { border-radius: 16px; }
:root[data-density="compact"] .files td, :root[data-density="compact"] .files td.name { height: 24px; }
:root[data-density="compact"] .view { padding: 8px 12px; gap: 8px; }
:root[data-density="roomy"] .files td, :root[data-density="roomy"] .files td.name { height: 38px; }
:root[data-density="roomy"] .view { padding: 20px 26px; gap: 16px; }
:root[data-icons="thin"] .ic { stroke-width: 1.35; }
:root[data-icons="bold"] .ic { stroke-width: 2.3; }
:root[data-font="system"] { --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; }
:root[data-font="rounded"] {
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", "Segoe UI Variable Display", system-ui, sans-serif;
}
:root[data-font="serif"] { --font: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Noto Serif", serif; }
:root[data-motion="reduced"] *:not(.xterm-cursor), :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
/* Appearance dialog */
#themeDialog { max-width: min(580px, calc(100vw - 24px)); }
.ap-card { max-height: calc(100vh - 32px); display: flex; flex-direction: column; gap: 12px; }
.ap-body { display: grid; gap: 4px; overflow: auto; padding-right: 2px; }
.ap-row {
  display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border);
}
.ap-row:last-child { border-bottom: 0; }
.ap-l { font-weight: 600; color: var(--muted); font-size: 13px; }
.ap-seg { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; border: 0; background: transparent; }
.ap-seg button {
  flex: 1 1 auto; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: transparent; color: var(--text); box-shadow: none;
}
.ap-seg button:hover { border-color: var(--muted); }
.ap-seg button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.ap-sws { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ap-sw {
  position: relative; width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 3px var(--surface);
}
.ap-sw:hover { border-color: var(--muted); }
.ap-sw[aria-pressed="true"], .ap-custom.on { border-color: var(--text); }
.ap-custom {
  display: inline-block; background: conic-gradient(#ef4444, #eab308, #22c55e, #06b6d4, #3b82f6, #a855f7, #ef4444); overflow: hidden;
}
.ap-custom input { position: absolute; inset: -6px; width: 44px; height: 44px; opacity: 0; cursor: pointer; }
@media (max-width: 520px) {
  .ap-row { grid-template-columns: 1fr; gap: 6px; }
}
/* phones: one button in the bottom bar (light/dark is inside Appearance) */
@media (max-width: 700px) {
  #themeToggle { display: none; }
}
/* ═══ Default look: sharp corners, buttons never filled ═══════════════════════════════════════
   Sharp corners are the default everywhere (labels, buttons, fields, panels, dialogs, bars).
   Soft / Round stay available in Appearance. Buttons, tabs and toggles are carried by their edge
   and text colour only: hover, selected and pressed states never paint the inside of the button.
   ═══════════════════════════════════════════════════════════════════════════════════════════ */
:root { --radius: 0; --radius-sm: 0; }
:root[data-radius="soft"] { --radius: 18px; --radius-sm: 12px; }
:root[data-radius="round"] { --radius: 24px; --radius-sm: 12px; }
:root[data-radius="sharp"] *, :root[data-radius="sharp"] *::before, :root[data-radius="sharp"] *::after, :root[data-radius="sharp"] ::-webkit-scrollbar-thumb { border-radius: 0 !important; }
.rk:hover, .rk.ok:hover, .rk:active, .seg button, .seg button:hover, .seg button[aria-checked="true"], .seg button[aria-selected="true"], .seg button[aria-pressed="true"], .seg button.on, .pane-switch button[aria-selected="true"], .tab:hover, .ap-seg button, .bk-scope button, .bk-scope button[aria-checked="true"] { background: transparent; }
.seg button:hover { border-color: var(--accent); }
/* ═══ File list: selected row keeps the same height as its neighbours and reads as one band ═══ */
.files tr.row.selected td { padding-top: 0; padding-bottom: 0; height: 30px; box-shadow: none; }
:root[data-density="compact"] .files tr.row.selected td { height: 24px; }
:root[data-density="compact"] .files tr.row.selected td.name { min-height: 24px; }
:root[data-density="roomy"] .files tr.row.selected td { height: 38px; }
:root[data-density="roomy"] .files tr.row.selected td.name { min-height: 38px; }
/* keyboard focus: one outline around the whole row instead of a dotted box per cell */
.files tr.row.focus td { outline: 0; box-shadow: inset 0 1px 0 var(--sel-border), inset 0 -1px 0 var(--sel-border); }
.files tr.row.focus td:first-child { box-shadow: inset 1px 1px 0 var(--sel-border), inset 0 -1px 0 var(--sel-border); }
.files tr.row.focus td:last-child { box-shadow: inset -1px 1px 0 var(--sel-border), inset 0 -1px 0 var(--sel-border); }
.files tr.row.drop-target > td { box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent); }
/* name cell is a real table cell (a flex <td> only painted part of the column, leaving a seam in selected/striped rows) */
.files td.name { display: table-cell; vertical-align: middle; }
.files td.name > .ic { display: inline-block; vertical-align: middle; margin-right: 9px; }
.files td.name > span {
  display: inline-block; vertical-align: middle; max-width: calc(100% - 28px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.files tr.row.selected td.name > span { white-space: normal; overflow-wrap: anywhere; }
.files tr.row.selected td.name { height: 30px; min-height: 0; }
:root[data-density="compact"] .files tr.row.selected td.name { height: 24px; }
:root[data-density="roomy"] .files tr.row.selected td.name { height: 38px; }
/* Terminal appearance preview: the caret follows the chosen shape and blink setting.
   (The terminal cursor itself is exempt from "Animations: Off" above, because blinking is a terminal option.) */
.term-preview #termCfgCaret { height: 1.1em; vertical-align: text-bottom; background: transparent; }
.term-preview #termCfgCaret[data-shape="block"] { background: var(--cc); }
.term-preview #termCfgCaret[data-shape="bar"] { background: linear-gradient(var(--cc), var(--cc)) left / 2px 100% no-repeat; }
.term-preview #termCfgCaret[data-shape="underline"] { background: linear-gradient(var(--cc), var(--cc)) bottom / 100% 2px no-repeat; }
.term-preview #termCfgCaret[data-blink="true"] { animation: ccBlink 1.1s step-end infinite !important; }
@keyframes ccBlink { 50% { opacity: 0; } }

/* Receiver picture on device cards */
.device-card .avatar.has-img { width: 68px; height: 42px; background: transparent; padding: 0; }
.avatar .box-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sites[data-mode="list"] .device-card .avatar.has-img { width: 52px; height: 32px; }

/* ═══ Device card layout + light theme (v1.2.6) ═══════════════════════════════════════════════
   Card: picture on the left spanning two rows; name and IP on top, the five icon buttons below.
   The IP never wraps. Light theme: greyer page, white cards with a real edge and shadow,
   filled controls, so nothing melts into pure white.
   ═══════════════════════════════════════════════════════════════════════════════════════════ */
.device-top {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "pic id" "pic menu";
  column-gap: 14px; row-gap: 4px; align-items: center;
}
.device-top .avatar { grid-area: pic; margin: 0; align-self: center; }
.device-top .site-id { grid-area: id; overflow: visible; white-space: normal; }
.device-top .device-menu { grid-area: menu; margin: 0; justify-self: end; }
.device-sub, .device-sub.ellipsis { white-space: nowrap; overflow-wrap: normal; word-break: normal; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.device-card .avatar { width: 56px; height: 56px; }
.device-card .avatar.has-img {
  width: 104px; height: 64px; padding: 4px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.device-card .avatar .box-img { border-radius: 6px; }
.device-card .avatar .dot { right: -4px; bottom: -4px; }
/* list view keeps its compact single-row look */
.sites[data-mode="list"] .device-top { display: flex; gap: 10px; }
.sites[data-mode="list"] .device-top .device-menu { margin-left: auto; }
.sites[data-mode="list"] .device-card .avatar { width: 32px; height: 32px; }
.sites[data-mode="list"] .device-card .avatar.has-img { width: 56px; height: 36px; padding: 2px; }
/* narrow phones: picture on top of the text instead of beside it */
@media (max-width: 380px) {
  .device-top { grid-template-columns: minmax(0, 1fr); grid-template-areas: "pic" "id" "menu"; }
  .device-top .device-menu { justify-self: start; }
}

/* ── Light theme ── */
:root { --ctl-fill: transparent; --chip-fill: transparent; --card-shadow: none; }
:root[data-theme="light"] {
  --bg: #dce3eb; --surface: #fcfdfe; --surface-2: #eef2f7; --surface-3: #dde4ec; --inset: #f0f3f8;
  --border: #bcc6d1; --border-strong: #8592a1; --field-border: #7f8b99;
  --text: #0e1520; --muted: #374452; --faint: #5a6775; --row-hover: #e9eef4;
  --ctl-fill: #eef2f7; --chip-fill: #eef2f7;
  --card-shadow: 0 1px 2px rgb(16 24 40 / .12), 0 4px 14px rgb(16 24 40 / .07);
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #dce3eb; --surface: #fcfdfe; --surface-2: #eef2f7; --surface-3: #dde4ec; --inset: #f0f3f8;
    --border: #bcc6d1; --border-strong: #8592a1; --field-border: #7f8b99;
    --text: #0e1520; --muted: #374452; --faint: #5a6775; --row-hover: #e9eef4;
    --ctl-fill: #eef2f7; --chip-fill: #eef2f7;
    --card-shadow: 0 1px 2px rgb(16 24 40 / .12), 0 4px 14px rgb(16 24 40 / .07);
  }
}
.btn:not(.primary):not(.danger):not(:disabled), .actionbar .btn:not(.primary):not(.danger):not(:disabled) { background: var(--ctl-fill); }
.btn:not(.primary):not(.danger):hover:not(:disabled) { background: var(--surface-3); }
.device-actions .btn.primary { background: var(--ctl-fill); }
.chip, .chip.on, .chip.plain, .badge { background: var(--chip-fill); }
.chip.off { background: color-mix(in srgb, var(--bad) 8%, var(--chip-fill)); }
.device-card, .pane, .lists-pane, .bk-card, .tools-sec { box-shadow: var(--card-shadow); }
.device-card.current { box-shadow: var(--card-shadow); }
.icon-btn { color: var(--text); }
.device-menu .icon-btn { color: var(--muted); }
.device-menu .icon-btn:hover:not(:disabled) { color: var(--text); background: var(--surface-3); }

/* v1.2.7: receiver picture as a full-width banner; name/IP left, icons right underneath */
.device-top:has(.avatar.has-img) {
  grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "pic pic" "id menu"; row-gap: 10px; column-gap: 10px; align-items: center;
}
.device-top:has(.avatar.has-img) .avatar.has-img { width: 100%; height: 104px; padding: 8px; border-radius: 10px; }
.device-top:has(.avatar.has-img) .device-menu { align-self: center; }
.sites[data-mode="list"] .device-top:has(.avatar.has-img) { display: flex; }
.sites[data-mode="list"] .device-card .avatar.has-img { width: 64px; height: 40px; padding: 2px; }

/* v1.2.8: terminal theme = two squares, black and white */
.term-swatches { display: inline-flex; gap: 6px; margin: 0 6px; align-items: center; }
.term-swatch { width: 22px; height: 22px; padding: 0; border-radius: 5px; border: 1.5px solid var(--border-strong); cursor: pointer; flex: none; }
.term-swatch.dark { background: #000; }
.term-swatch.light { background: #fff; }
.term-swatch:hover { border-color: var(--accent); }
.term-swatch[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.term-swatch:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }

/* v1.2.9: light theme for Files, channel lists and the remote (dark keeps its look: tokens stay transparent) */
:root { --row-line: transparent; --head-fill: var(--surface-2); --zebra: transparent; --key-edge: var(--border); --key-shadow: none; }
:root[data-theme="light"] { --row-line: #d3dbe4; --head-fill: #e3e9f0; --zebra: #f1f4f8; --key-edge: #8592a1; --key-shadow: 0 1px 0 rgb(16 24 40 / .18); --sel: #d7ebf0; --sel-border: #4aa3b3; }
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] { --row-line: #d3dbe4; --head-fill: #e3e9f0; --zebra: #f1f4f8; --key-edge: #8592a1; --key-shadow: 0 1px 0 rgb(16 24 40 / .18); --sel: #d7ebf0; --sel-border: #4aa3b3; }
}
.pane-head { background: var(--head-fill); }
.files thead th { background: var(--head-fill); border-bottom: 1px solid var(--border-strong); }
.files tr.row td { border-bottom: 1px solid var(--row-line); }
.files tr.row:nth-child(even) td { background: var(--zebra); }
.files tr.row:hover td { background: var(--row-hover); }
.pane-foot { background: var(--head-fill); border-top: 1px solid var(--border); }
.ch-list, .bq-list, .bq-entries { background: var(--surface); border-color: var(--border-strong); }
.ch-item, .bq-list li, .bq-entries li { border-bottom: 1px solid var(--row-line); }
.ch-item:hover, .bq-list li:hover, .bq-entries li:hover { background: var(--row-hover); }
.ch-item.current, .bq-list li[aria-selected="true"], .bq-entries li[aria-selected="true"] { background: var(--sel); }
.remote .rk, .rk { border-color: var(--key-edge); box-shadow: var(--key-shadow); }
.remote .rk:active, .rk:active { box-shadow: none; transform: translateY(1px); }
.remote .rk.red, .remote .rk.green, .remote .rk.yellow, .remote .rk.blue { border-color: var(--key-edge); border-bottom: 4px solid var(--k, #888); }
.picon.has-img { border: 1px solid var(--border); }
