/* QBSupport operator console.
   Devices = fleet table; session = phone centre stage + resizable tools panel.
   Dark-only by design; system fonts only (no third-party requests). */
:root {
    color-scheme: dark;
    --bg: #0f0f0e;
    --surface: #171715;
    --surface-2: #1f1e1b;
    --surface-3: #282622;
    --line: #2d2b27;
    --line-strong: #46433d;
    --text: #ecebe7;
    --muted: #a19d94;
    --faint: #6e6a62;
    --accent: #f5c400;
    --accent-hover: #ffd31f;
    --accent-soft: rgba(245, 196, 0, .14);
    --accent-ink: #1b1600;
    --ok: #43d17f;
    --warn: #f2a43a;
    --err: #f0574e;
    --info: #67b0ff;
    --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
    --mono: "Cascadia Mono", "JetBrains Mono", Consolas, Menlo, "DejaVu Sans Mono", monospace;
    --r: 8px;
    --panel-w: 460px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; overflow: hidden; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tnum { font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.empty { color: var(--faint); font-size: 13px; padding: 16px; margin: 0; text-align: center; }

/* ── App shell ─────────────────────────────────────────────────────── */
.app { height: 100%; display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.topbar {
    display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 16px;
    border-bottom: 1px solid var(--line); background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; white-space: nowrap; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.brand small { color: var(--muted); font-weight: 400; }

.btn {
    display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px;
    border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
    font-size: 13px; font-weight: 500; white-space: nowrap; transition: border-color .12s, background .12s, color .12s;
}
.btn:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger:hover:not(:disabled) { border-color: var(--err); color: var(--err); background: var(--surface-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { color: var(--text); background: var(--surface-2); border-color: transparent; }
.btn.icon { width: 34px; padding: 0; justify-content: center; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.confirming { color: var(--err) !important; border-color: var(--err) !important; width: auto !important; padding: 0 8px !important; font-size: 12px; }

.input {
    height: 34px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--line);
    background: var(--bg); color: var(--text); min-width: 0;
}
.input:focus { outline: none; border-color: var(--accent); }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; min-height: 84px; line-height: 1.4; }
.search { position: relative; display: flex; align-items: center; }
.search .ic { position: absolute; left: 10px; color: var(--faint); width: 16px; height: 16px; pointer-events: none; }
.search .input { padding-left: 32px; width: 100%; }
.check { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; cursor: pointer; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-3); color: var(--muted); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: rgba(67, 209, 127, .1); }
.pill.accent { color: var(--accent); background: var(--accent-soft); }
.pill.warn { color: var(--warn); background: rgba(242, 164, 58, .12); }
.pill.err { color: var(--err); background: rgba(240, 87, 78, .12); }
.pill.info { color: var(--info); background: rgba(103, 176, 255, .12); }
.pill.off { color: var(--faint); }
.pill.plain::before { display: none; }

/* ── Devices ───────────────────────────────────────────────────────── */
.devices { overflow: auto; padding: 28px 16px 40px; }
.devices-inner { max-width: 1320px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.devices h1 { margin: 0; font-size: 22px; font-weight: 600; }
.devices-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.devices-head .lead { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .search { flex: 1 1 260px; max-width: 360px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 13px; }
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.chip b { font-weight: 600; margin-left: 5px; }
.connect-status { margin: 0; min-height: 0; font-size: 13px; color: var(--warn); }
.connect-status:empty { display: none; }
.connect-status.info { color: var(--info); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }
.dev-table { width: 100%; border-collapse: collapse; min-width: 1080px; }
.dev-table th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 11px 12px 6px; white-space: nowrap; }
.dev-table td { padding: 12px 12px; border-top: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.dev-table tbody tr { transition: background .1s; }
.dev-table tbody tr:hover { background: var(--surface-2); }
.dev-table tr.is-off td { color: var(--faint); }
.dev-table .empty { text-align: center; padding: 28px; }
th .sort { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
th .sort:hover { color: var(--text); }
th[aria-sort] .sort { color: var(--accent); }
th .arr { font-size: 8px; min-width: 8px; }
.filters th { padding: 0 8px 10px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.filters th:first-child { padding-left: 12px; }
.filters .input { width: 100%; height: 28px; padding: 0 8px; font-size: 12px; }
.filters .btn { height: 28px; font-size: 12px; padding: 0 8px; }
.dev-name { display: flex; align-items: center; gap: 10px; }
.dev-ico { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); }
.dev-name b { font-weight: 500; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.cut { display: inline-block; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cut.net { max-width: 140px; }
.cut.fw { max-width: 128px; }
.sig { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; margin-right: 6px; vertical-align: -1px; }
.sig i { width: 3px; background: var(--surface-3); border-radius: 1px; }
.sig i.on { background: currentColor; }
.bat { display: inline-flex; align-items: center; gap: 6px; }
.bat-bar { width: 26px; height: 11px; border: 1.5px solid var(--muted); border-radius: 3px; padding: 1px; position: relative; }
.bat-bar::after { content: ""; position: absolute; right: -4px; top: 3px; width: 2px; height: 4px; background: var(--muted); border-radius: 0 1px 1px 0; }
.bat-bar span { display: block; height: 100%; border-radius: 1px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.row-note { font-size: 12px; color: var(--faint); }
.split { display: inline-flex; }
.split .btn:first-child { border-radius: var(--r) 0 0 var(--r); }
.split .btn:last-child { border-radius: 0 var(--r) var(--r) 0; border-left-color: rgba(0, 0, 0, .25); padding: 0 8px; }
.menu { position: absolute; z-index: 30; min-width: 240px; padding: 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); box-shadow: 0 12px 30px rgba(0, 0, 0, .45); }
.menu button { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; text-align: left; }
.menu button:hover { background: var(--surface-3); }
.menu button span { font-size: 12px; color: var(--muted); }
.legend { font-size: 12px; color: var(--faint); display: flex; gap: 16px; flex-wrap: wrap; }

/* ── Session ───────────────────────────────────────────────────────── */
.session { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 6px var(--panel-w); min-height: 0; }
.session.wide { --panel-w: min(62vw, 1000px) !important; }
.session.limited { grid-template-columns: minmax(0, 1fr); }
.session.limited .stage, .session.limited .resizer { display: none; }
.sess-id { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.sess-id b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess-id small { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.sess-meta { color: var(--muted); font-size: 13px; }

.stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 16px 14px; min-height: 0; min-width: 0; background: radial-gradient(ellipse at 50% 40%, #1a1915 0%, var(--bg) 70%); }
.phone-box { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
.phone { position: relative; padding: 7px; border-radius: 22px; background: #050505; box-shadow: 0 0 0 1px #2e2c28, 0 20px 50px rgba(0, 0, 0, .55); transition: box-shadow .15s; outline: none; line-height: 0; }
.phone.focused { box-shadow: 0 0 0 2px var(--accent), 0 20px 50px rgba(0, 0, 0, .55); }
#screen-canvas { display: block; border-radius: 15px; background: #111; cursor: crosshair; touch-action: none; }
.navbar { display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); flex-wrap: wrap; justify-content: center; }
.navbar .btn { height: 38px; }
.navbar .btn.icon { width: 42px; }
.navbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.kbd-hint { font-size: 12px; color: var(--faint); min-height: 16px; text-align: center; }
.kbd-hint.on { color: var(--accent); }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); }

.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(10, 10, 9, .74); backdrop-filter: blur(2px); z-index: 8; padding: 20px; }
.overlay-box { max-width: 380px; display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; padding: 22px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); line-height: 1.45; }
.overlay-box b { font-size: 15px; }
.overlay-box code { font-family: var(--mono); font-size: 12px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.resizer { cursor: col-resize; border-left: 1px solid var(--line); transition: background .12s; touch-action: none; }
.resizer:hover, .resizer.drag { background: var(--accent-soft); border-left-color: var(--accent); }

/* Tools panel */
.panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--surface); }
.tabs { display: flex; align-items: center; padding: 6px 6px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab .ic { width: 16px; height: 16px; }
.tabs-btn { margin-bottom: 4px; }
.pane { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; flex-shrink: 0; }
.panel-head h2 { margin: 0; font-size: 14px; font-weight: 600; flex: 1; min-width: 90px; }
.panel-head .count { font-weight: 400; }
.panel-body { flex: 1; min-height: 0; overflow: auto; padding: 14px; }
.panel-body.flush { padding: 0; }
.bar { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; flex-shrink: 0; }
.status-line { font-size: 12px; color: var(--muted); padding: 7px 14px; border-top: 1px solid var(--line); line-height: 1.35; overflow-wrap: anywhere; flex-shrink: 0; }
.status-line:empty { display: none; }
.status-line.err { color: var(--err); }
.note { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--faint); padding: 9px 14px; border-top: 1px solid var(--line); line-height: 1.4; flex-shrink: 0; }
.note .ic { width: 14px; height: 14px; margin-top: 1px; }

/* Overview cards */
/* 260px: wide enough for "Firmware  FH04_WIFI_V02.00b03" on one row; narrower panels stack the cards. */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.card { padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.card h3 { margin: 0; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); display: flex; align-items: center; gap: 6px; }
.card h3 .ic { width: 14px; height: 14px; }
.card.wide { grid-column: 1 / -1; }
/* Label/value rows: a value never breaks; if it doesn't fit beside its label it
   moves, whole, to the line below (right-aligned). Wider than the card: "…" + title. */
.kv { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin: 0; }
.kv-row { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 12px; row-gap: 1px; min-width: 0; }
.kv dt { color: var(--muted); white-space: nowrap; }
.kv dd { margin: 0 0 0 auto; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.kv dd.wrap { white-space: normal; overflow-wrap: anywhere; }
.kv dd.mono { font-size: 12px; }
.kv dd.note-val { font-size: 12px; color: var(--faint); }
.big { font-size: 22px; font-weight: 600; }
.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.meter.ok span { background: var(--ok); }
.meter.warn span { background: var(--warn); }
.meter.crit span { background: var(--err); }
.meter-label { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.clip-box { font-family: var(--mono); font-size: 12px; padding: 8px; border-radius: 6px; background: var(--bg); color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 90px; overflow: auto; min-height: 32px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* Lists (files, apps) */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 10px; padding: 7px 14px; border-bottom: 1px solid var(--line); cursor: pointer; min-width: 0; }
.row:hover, .row.open { background: var(--surface-2); }
.row .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .acts { display: flex; gap: 2px; opacity: 0; transition: opacity .1s; flex-shrink: 0; }
.row:hover .acts, .row.open .acts, .row .acts:focus-within { opacity: 1; }
.row .acts .btn { height: 30px; width: 30px; }
.row-ico { color: var(--muted); display: grid; place-items: center; }
.row-ico.dir { color: var(--accent); }
.crumbs { display: flex; align-items: center; gap: 2px; padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 13px; flex-wrap: wrap; flex-shrink: 0; }
.crumbs button { border: 0; background: none; color: var(--accent); padding: 2px 5px; border-radius: 4px; }
.crumbs button:hover { background: var(--accent-soft); }
.crumbs .ic { width: 14px; height: 14px; color: var(--faint); }
.pane.dragover::after { content: "Drop to upload here"; position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: 10px; background: rgba(15, 15, 14, .85); display: grid; place-items: center; color: var(--accent); font-weight: 600; z-index: 3; }
.app-ico { width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; overflow: hidden; }
.app-ico img { width: 34px; height: 34px; display: block; }
.app-ico img:not([src]) { display: none; }
.app-ico:has(img[src]) { background: none; }
.badge { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 99px; border: 1px solid var(--line); font-size: 11px; color: var(--faint); vertical-align: 1px; }
.badge.warn { color: var(--warn); border-color: #5a3a10; }
.ver { flex-shrink: 0; font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--text); padding: 1px 8px; border-radius: 6px; background: var(--surface-3); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.details { padding: 10px 14px 12px 58px; border-bottom: 1px solid var(--line); background: var(--surface-2); }

/* Intent sheet */
.sheet { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; background: var(--surface); }
.form { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label { font-size: 12px; color: var(--muted); }
.field .input { width: 100%; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.extra-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr) 30px; gap: 6px; align-items: center; }
.extra-row .btn { height: 30px; width: 30px; }
.extras-head { display: flex; align-items: center; justify-content: space-between; }
.extras-head label { font-size: 12px; color: var(--muted); }
.cmd { font-family: var(--mono); font-size: 12px; padding: 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; user-select: all; }
.result { font-size: 13px; min-height: 1em; overflow-wrap: anywhere; }
.result.ok { color: var(--ok); }
.result.err { color: var(--err); }
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line); align-self: flex-start; flex-wrap: wrap; }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; }
.seg button.on { background: var(--surface-3); color: var(--text); }

/* Logs */
.levels { display: flex; gap: 4px; }
.lv { height: 28px; min-width: 28px; border-radius: 6px; border: 1px solid var(--line); background: transparent; font-family: var(--mono); font-size: 12px; color: var(--faint); }
.lv.on { color: var(--bg); border-color: transparent; }
.lv.on[data-l="V"], .lv.on[data-l="D"] { background: var(--muted); }
.lv.on[data-l="I"] { background: var(--info); }
.lv.on[data-l="W"] { background: var(--warn); }
.lv.on[data-l="E"] { background: var(--err); }
.log-scroll { background: #0b0b0a; }
.log { font-family: var(--mono); font-size: 12px; line-height: 1.55; padding: 8px 14px; white-space: pre; min-width: max-content; }
.log .l-V, .log .l-D { color: #8a867e; }
.log .l-I { color: #cfd6de; }
.log .l-W { color: var(--warn); }
.log .l-E, .log .l-F { color: var(--err); }
.log .l-x { color: var(--muted); }

/* Shell */
.shell-pane { flex: 1; min-height: 0; padding: 8px 6px 6px 12px; background: #0b0b0a; overflow: hidden; }
.shell-pane .xterm { height: 100%; }

/* Message modal */
.modal-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: min(760px, 100%); max-height: 100%; overflow: auto; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0, 0, 0, .6); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; }
.modal-body { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 20px; padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.preview-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin-bottom: 6px; }
.mini-phone { width: 100%; aspect-ratio: 1 / 2; border-radius: 16px; padding: 5px; background: #050505; box-shadow: 0 0 0 1px #2e2c28; }
.mini-screen { position: relative; width: 100%; height: 100%; border-radius: 11px; overflow: hidden; background: #2b2b2b center / cover no-repeat; container-type: size; }
.mini-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; padding: 6cqw; }
.mini-dialog { width: 100%; padding: 6cqw 7cqw 3cqw; border-radius: 3cqw; background: #222018; color: #f1ead2; display: flex; flex-direction: column; gap: 3cqw; }
.mini-dialog b { font-size: 7cqw; font-weight: 600; }
.mini-dialog p { margin: 0; font-size: 5.4cqw; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 60cqh; overflow: hidden; }
.mini-dialog span { align-self: flex-end; color: #f5d36b; font-weight: 600; font-size: 5cqw; padding: 2cqw; }
.mini-toast { position: absolute; left: 50%; bottom: 9cqh; transform: translateX(-50%); width: max-content; max-width: 84%; padding: 2.4cqw 4.5cqw; border-radius: 2cqw; background: #f3ecd9; color: #222; font-size: 5cqw; text-align: center; overflow-wrap: anywhere; }

/* Toasts */
.toasts { position: fixed; left: 50%; top: 66px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; background: var(--surface-3); border: 1px solid #3a3833; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); font-size: 13px; animation: toast-in .18s ease-out; max-width: 640px; overflow-wrap: anywhere; }
.toast .ic { width: 16px; height: 16px; color: var(--ok); }
.toast.warn .ic { color: var(--warn); }
.toast.err .ic { color: var(--err); }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } }

/* ── Sign in ───────────────────────────────────────────────────────── */
.auth { position: fixed; inset: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px 16px; background: radial-gradient(ellipse at 50% 30%, #1a1915 0%, var(--bg) 70%); }
.auth-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 26px 24px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0, 0, 0, .5); }
.auth-card h1 { margin: 6px 0 0; font-size: 20px; font-weight: 600; }
.auth-card p { margin: 0; line-height: 1.45; }
.auth-foot { text-align: center; max-width: 380px; }
.auth-foot:empty { display: none; }
.form-err { margin: 0; font-size: 13px; color: var(--err); line-height: 1.4; }
.form-err:empty { display: none; }
.btn.block { width: 100%; justify-content: center; height: 38px; }
.btn-row.end { justify-content: flex-end; }
#user-btn .chev { width: 14px; height: 14px; }

/* ── Admin ─────────────────────────────────────────────────────────── */
.seg button { display: inline-flex; align-items: center; gap: 6px; }
.seg button .ic { width: 15px; height: 15px; }
.admin-sec { display: flex; flex-direction: column; gap: 16px; }
.toolbar > .input { width: 170px; }
.users-table { min-width: 880px; }
.audit-table { min-width: 1080px; }
.audit-table td { vertical-align: top; padding-top: 10px; padding-bottom: 10px; }
.audit-table td.det { white-space: normal; overflow-wrap: anywhere; min-width: 280px; max-width: 520px; font-size: 13px; }
.audit-table td.det code { font-family: var(--mono); font-size: 12px; color: var(--text); }
.t-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.dev-sub { display: block; font-size: 12px; color: var(--faint); font-family: var(--mono); }
.act { display: inline-block; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 6px; background: var(--surface-3); color: var(--muted); }
.act.c-auth { color: var(--info); }
.act.c-user, .act.c-audit { color: var(--accent); }
.act.c-session { color: var(--ok); }
.act.c-shell, .act.c-file, .act.c-app, .act.c-intent, .act.c-key { color: var(--warn); }
.act.bad { color: var(--err); }
.center { display: flex; justify-content: center; }
.modal.narrow { width: min(460px, 100%); }
.modal-pad { padding: 18px; }
.secret-row { display: flex; gap: 8px; align-items: center; }
.secret-row code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 16px; padding: 8px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); user-select: all; overflow-wrap: anywhere; }

/* xterm scrollbar */
.xterm .xterm-viewport::-webkit-scrollbar { width: 8px; }
.xterm .xterm-viewport::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
.panel-body::-webkit-scrollbar { width: 8px; height: 8px; }
.panel-body::-webkit-scrollbar-thumb { background: #33312c; border-radius: 4px; }

@media (max-width: 860px) {
    body { overflow: auto; }
    .session, .session.wide { grid-template-columns: minmax(0, 1fr); grid-template-rows: 62vh auto; overflow: auto; }
    .resizer { display: none; }
    .panel { min-height: 70vh; }
    .hide-sm { display: none !important; }
    .modal-body { grid-template-columns: 1fr; }
    .msg-preview-col { width: 150px; margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
