/* ==========================================================
   Ops Console — CONTROL ROOM theme (a flat theme on theme-kit.css): a 1970s operations console.
   Screwed-on metal modules with engraved label plates; the navigation is a keypad of raised keys, each with an LED that
   lights for the current view; buttons are key caps that press in; fields are recessed amber read-out windows; numbers
   are seven-segment (DSEG7); toggles are levers; gauges are LED bars; the status line is an LCD strip.
   Barlow Condensed lettering. Light = daylight console (putty enclosure); dark = night operations (charcoal).
   ========================================================== */
@font-face { font-family: 'Barlow Cond'; src: url(/fonts/barlow-cond-500.woff2) format('woff2'); font-weight: 400 600; font-display: swap; }
@font-face { font-family: 'Barlow Cond'; src: url(/fonts/barlow-cond-700.woff2) format('woff2'); font-weight: 700 900; font-display: swap; }
@font-face { font-family: 'DSEG7'; src: url(/fonts/dseg7-700.woff2) format('woff2'); font-weight: 400 900; font-display: swap; }

/* ---------- light: daylight console ---------- */
:root[data-theme="control"] {
  --cream: #cbc4b1;
  --paper: #e3ddcc;
  --fg: #2a2924;
  --hi: #121110;
  --ink: #6d675a;
  --on: #1b1a17;
  --y: #f2a900;
  --blue: #2f6fa8; --red: #c8392b; --green: #2f9a41; --orange: #dd7a00; --purple: #6e58b8; --mint: #2b8f82; --pink: #b8527f;
  --screen: #12100c;
  --screen-fg: #ffb000;
  --plate: #3b382f; --plate-fg: #efe8d6;           /* engraved label plates */
  --lcd-bg: #1d1b14; --lcd-fg: #ffb000;            /* recessed read-out windows */
  --key-top: #f3eee2; --key-bot: #d6cfbc;           /* key caps */
  --bezel: #5e584b; --bezel-dark: #3d392f;
  --led-off: #6b6656; --led-on: #4fd65a;
  --lamp-glow: 0.55;
  --screw: #9a9384;
  --hl: rgba(255, 255, 255, 0.65);
  --sd: rgba(0, 0, 0, 0.16);
  --k-bw-lg: 2px; --k-bw: 1.5px; --k-bw-sm: 1px; --k-bw-xs: 1px;
  --k-r: 0.45; --k-r-pill: 0.5; --k-move: 0;
  --sh-sm: inset 0 1px 0 var(--hl), 0 1px 0 var(--sd);
  --sh: inset 0 1px 0 var(--hl), inset 0 -2px 0 var(--sd), 0 2px 4px rgba(0, 0, 0, 0.16);
  --sh-lg: 0 16px 34px rgba(0, 0, 0, 0.32);
  --sh-hover: var(--sh); --sh-hover-lg: var(--sh); --sh-press: inset 0 2px 4px rgba(0, 0, 0, 0.3);
  --k-inset: inset 0 2px 4px rgba(0, 0, 0, 0.3); --k-inset-on: inset 0 2px 4px rgba(0, 0, 0, 0.25);
  --ui: 'Barlow Cond', 'Arial Narrow', system-ui, sans-serif;
  --chart-line: #2f6fa8;
  --chart-alt: #dd7a00;
  --chart-font: 600 12px 'Barlow Cond', sans-serif;
  /* cursors: generated by tools/kit-cursors.mjs control */
  --cur-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='28' viewBox='0 0 26 28'%3E%3Cdefs%3E%3Cpath id='s' d='M4 3V22L10 16.5L19.5 16Z'/%3E%3C/defs%3E%3Cuse href='%23s' x='1.6' y='1.6' fill='%23000' stroke='%23000' stroke-width='3.4' stroke-linejoin='round' opacity='.4'/%3E%3Cuse href='%23s' fill='%231b1a17' stroke='%231b1a17' stroke-width='3.4' stroke-linejoin='round'/%3E%3Cpath d='M4 3V22L10 16.5Z' fill='%23ffd36b'/%3E%3Cpath d='M4 3L10 16.5L19.5 16Z' fill='%23ffb000'/%3E%3Cpath d='M4 22L10 16.5L19.5 16L10 17.6Z' fill='%23c98600'/%3E%3C/svg%3E") 4 3, default;
  --cur-arrow-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='28' viewBox='0 0 26 28'%3E%3Cdefs%3E%3Cpath id='s' d='M4 3V22L10 16.5L19.5 16Z'/%3E%3C/defs%3E%3Cuse href='%23s' fill='%231b1a17' stroke='%231b1a17' stroke-width='3.4' stroke-linejoin='round'/%3E%3Cpath d='M4 3V22L10 16.5Z' fill='%23ffb000'/%3E%3Cpath d='M4 3L10 16.5L19.5 16Z' fill='%23c98600'/%3E%3Cpath d='M4 22L10 16.5L19.5 16L10 17.6Z' fill='%23c98600'/%3E%3C/svg%3E") 4 3, default;
  --cur-hand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 26 26'%3E%3Ccircle cx='13.6' cy='13.8' r='10.5' fill='%23000' opacity='.35'/%3E%3Ccircle cx='12' cy='12' r='10.5' fill='%231b1a17'/%3E%3Ccircle cx='12' cy='12' r='9' fill='%238d8778'/%3E%3Cpath d='M4.6 9.6A8 8 0 0 1 19.4 9.6' stroke='%23d9d3c4' stroke-width='1.4' fill='none' opacity='.8'/%3E%3Ccircle cx='12' cy='12' r='6.2' fill='%23ffb000' stroke='%231b1a17' stroke-width='1.2'/%3E%3Cpath d='M9 9.6A3.6 3.6 0 0 1 13.6 8.3' stroke='%23fff' stroke-width='1.3' fill='none' stroke-linecap='round' opacity='.85'/%3E%3C/svg%3E") 12 12, pointer;
  --cur-hand-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 26 26'%3E%3Ccircle cx='12' cy='12' r='10.5' fill='%231b1a17'/%3E%3Ccircle cx='12' cy='12' r='9' fill='%238d8778'/%3E%3Cpath d='M4.6 9.6A8 8 0 0 1 19.4 9.6' stroke='%23d9d3c4' stroke-width='1.4' fill='none' opacity='.8'/%3E%3Ccircle cx='12' cy='12' r='5.6' fill='%23c98600' stroke='%231b1a17' stroke-width='1.2'/%3E%3C/svg%3E") 12 12, pointer;
  --cur-text: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='28' viewBox='0 0 16 28'%3E%3Crect x='4' y='4' width='8' height='20' rx='1' fill='%23ffb000' stroke='%231b1a17' stroke-width='2'/%3E%3Crect x='5.6' y='5.6' width='2' height='16.8' fill='%23ffd36b' opacity='.8'/%3E%3C/svg%3E") 8 14, text;
  color-scheme: light;
}

/* ---------- dark: night operations ---------- */
:root[data-theme="control"][data-mode="dark"] {
  --cream: #181a17;
  --paper: #23261f;
  --fg: #d6d0bf;
  --hi: #f3eee0;
  --ink: #4e5248;
  --y: #ffb000;
  --blue: #6fa8e0; --red: #ff6a4d; --green: #7fd66a; --orange: #ff9a2e; --purple: #b39cff; --mint: #6fd6c4; --pink: #ff8fbd;
  --plate: #0d0e0c; --plate-fg: #cfc8b4;
  --lcd-bg: #0b0b08;
  --key-top: #3d4038; --key-bot: #2a2c26;
  --bezel: #0e0f0c; --bezel-dark: #050605;
  --led-off: #33362e; --led-on: #6dff7a;
  --lamp-glow: 0.8;
  --screw: #5d6157;
  --hl: rgba(255, 255, 255, 0.08);
  --sd: rgba(0, 0, 0, 0.45);
  --sh: inset 0 1px 0 var(--hl), inset 0 -2px 0 var(--sd), 0 2px 5px rgba(0, 0, 0, 0.45);
  --sh-lg: 0 16px 38px rgba(0, 0, 0, 0.6);
  --chart-line: #ffb000;
  --chart-alt: #6fa8e0;
  color-scheme: dark;
}

[data-theme="control"] {
  & body { font: 500 13.5px/1.4 var(--ui); letter-spacing: 0.01em; }
  --key: linear-gradient(to bottom, var(--key-top), var(--key-bot));
  --key-edge: inset 0 1px 0 var(--hl), 0 2px 0 var(--bezel-dark), 0 3px 5px rgba(0, 0, 0, 0.22);
  --key-down: inset 0 2px 4px rgba(0, 0, 0, 0.35), 0 0 0 var(--bezel-dark);
  --window: inset 0 2px 6px rgba(0, 0, 0, 0.7), 0 1px 0 var(--hl);

  /* enclosure: brushed finish, a bevelled top strip */
  .crt { background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.018) 0 1px, transparent 1px 3px), var(--cream); }
  .topbar { background: var(--paper); border-bottom: 2px solid var(--bezel); box-shadow: inset 0 -1px 0 var(--hl), 0 2px 6px rgba(0, 0, 0, 0.15); }
  .brand { font: 700 18px/1 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; }
  .brand::before, .login-head::before { background: var(--y); color: var(--on); border: 1px solid var(--bezel); border-radius: 5px; box-shadow: var(--key-edge), 0 0 10px rgba(255, 176, 0, calc(var(--lamp-glow) * 0.5)); }
  .statusline { background: var(--lcd-bg); color: var(--lcd-fg); border-top: 2px solid var(--bezel); font: 500 12px var(--mono); box-shadow: var(--window); }
  .statusline .prompt { background: none; color: var(--lcd-fg); }
  #status-msg.ok, #link-state { color: var(--led-on); }

  /* navigation: a keypad, an LED on each key */
  .nav { background: var(--cream); border-right: 2px solid var(--bezel); padding: 14px 12px; gap: 7px; }
  .nav a {
    font: 700 13px/1 var(--ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--fg);
    padding: 10px 10px; background: var(--key); border: 1px solid var(--bezel); border-radius: 5px; box-shadow: var(--key-edge);
  }
  .nav a kbd { min-width: 18px; padding: 2px 4px; font: 700 10px/1 var(--ui); color: var(--plate-fg); background: var(--plate); border: 0; border-radius: 2px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6); }
  .nav a::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--led-off); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.5); }
  .nav a:hover { background: var(--key); border-color: var(--bezel); box-shadow: var(--key-edge); filter: brightness(1.04); }
  .nav a:active { transform: translateY(2px); box-shadow: var(--key-down); }
  .nav a.active { background: linear-gradient(to bottom, var(--key-bot), var(--key-top)); color: var(--hi); border-color: var(--bezel); transform: translateY(2px); box-shadow: var(--key-down); }
  .nav a.active::after { content: ''; background: var(--led-on); box-shadow: 0 0 8px var(--led-on), inset 0 1px 1px rgba(255, 255, 255, 0.4); }
  .nav a.active kbd { color: var(--lcd-fg); }

  /* modules: raised, two screws, an engraved plate as title */
  .panel, .panel.agent-card.live { background: var(--paper); border: 1.5px solid var(--ink); border-radius: 7px; box-shadow: var(--sh); padding: 26px 18px 16px; }
  .panel::before, .panel::after {
    content: ''; position: absolute; width: 7px; height: 7px; border: 0; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.55), transparent 55%), var(--screw);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  }
  .panel::before { left: 7px; bottom: 7px; }
  .panel::after { right: 7px; top: 7px; }
  .panel > h2 {
    position: absolute; top: -11px; left: 16px; margin: 0; padding: 5px 10px 4px;
    font: 700 11.5px/1 var(--ui); letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--plate-fg); background: var(--plate); border-radius: 3px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6), 0 1px 0 var(--hl);
  }
  .panel-flush { padding: 22px 0 0; }
  .panel-flush > h2 { padding: 5px 10px 4px; }
  .panel.agent-card.live > h2 { box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6), 0 0 0 2px var(--led-on); }
  .panel.term-stage { padding: 0; border: 2px solid var(--bezel); border-radius: 7px; box-shadow: var(--window); }
  .panel.term-stage::before, .panel.term-stage::after { display: none; }

  /* key caps: press in on click; amber main key, red danger key */
  .btn, .term-tab, .hx-tabs button, .term-keys button, .term-zoom button, .term-kill {
    background: var(--key); color: var(--fg); border: 1px solid var(--bezel); border-radius: 5px; box-shadow: var(--key-edge);
    font: 700 12px/1.2 var(--ui); letter-spacing: 0.12em; text-transform: uppercase;
  }
  .btn { padding: 5px 12px 4px; }
  .btn:hover, .btn:focus-visible { background: var(--key); color: var(--hi); box-shadow: var(--key-edge); filter: brightness(1.05); }
  .btn:active, .term-tab:active, .hx-tabs button:active { transform: translateY(2px); box-shadow: var(--key-down); }
  .btn-primary, .btn-wide, .btn.on { background: linear-gradient(to bottom, #ffc640, #e39a00); color: #1b1a17; }
  .btn-danger, .term-kill { background: linear-gradient(to bottom, #e05a46, #b33222); color: #fff; }
  .btn-warn { background: linear-gradient(to bottom, #f0a040, #c97300); color: #1b1a17; }
  .btn-sm { padding: 3px 8px 2px; font-size: 11px; }
  .term-tab.active, .hx-tabs button.on { transform: translateY(2px); box-shadow: var(--key-down); color: var(--hi); }
  .seg { background: var(--bezel); border: 1px solid var(--bezel); border-radius: 6px; padding: 2px; gap: 2px; box-shadow: none; }
  .seg button { background: var(--key); border: 0; border-radius: 4px; color: var(--fg); font: 700 11.5px var(--ui); letter-spacing: 0.12em; text-transform: uppercase; box-shadow: inset 0 1px 0 var(--hl); }
  .seg button + button { border-left: 0; }
  .seg button.on { background: linear-gradient(to bottom, var(--key-bot), var(--key-top)); color: var(--hi); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35), inset 0 -2px 0 var(--y); }

  /* fields: recessed amber read-outs */
  .field, .search, .modal input[type=text], .hx-field input, .hx-field select, .launch input, .launch select, .hx-ask-side input,
  .pj-rem-form input, .sess-send input, .term-compose textarea, .hx-area, .hx-editor, & select {
    background: var(--lcd-bg); color: var(--lcd-fg); border: 1px solid var(--bezel); border-radius: 4px; box-shadow: var(--window);
  }
  .field input, .search input, .hx-area, .hx-editor, .term-compose textarea { color: var(--lcd-fg); font-family: var(--mono); caret-color: var(--lcd-fg); }
  .field span, .search span { color: color-mix(in srgb, var(--lcd-fg) 60%, transparent); font: 700 10.5px var(--ui); letter-spacing: 0.18em; }
  & input::placeholder, & textarea::placeholder { color: color-mix(in srgb, var(--lcd-fg) 35%, transparent); }
  .field:focus-within, .search:focus-within, .modal input[type=text]:focus, .hx-field input:focus, .hx-area:focus, .hx-editor:focus,
  .pj-rem-form input:focus, .sess-send input:focus, .term-compose textarea:focus, & select:focus {
    background: var(--lcd-bg); box-shadow: var(--window), 0 0 0 2px color-mix(in srgb, var(--y) 55%, transparent); transform: none;
  }
  .hx-field > span { font: 700 10.5px var(--ui); letter-spacing: 0.18em; color: var(--fg); }
  /* toggles: a lever in a slot */
  .switch { width: 40px; height: 20px; background: var(--lcd-bg); border: 1px solid var(--bezel); border-radius: 10px; box-shadow: var(--window); }
  .switch i { top: 1px; left: 1px; width: 16px; height: 16px; border: 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #b9b3a3 60%, #7d776a); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
  .switch.on { background: color-mix(in srgb, var(--led-on) 35%, var(--lcd-bg)); }
  .switch.on i { left: 21px; background: radial-gradient(circle at 35% 30%, #fff, #b9b3a3 60%, #7d776a); }

  /* tables: an engraved header plate, rows on the module face */
  .table th { background: var(--plate); color: var(--plate-fg); font: 700 11px var(--ui); letter-spacing: 0.16em; text-transform: uppercase; border-bottom: 1px solid var(--bezel); }
  .table td { border-bottom: 1px solid color-mix(in srgb, var(--ink) 35%, transparent); }
  .table tbody tr:hover td { background: color-mix(in srgb, var(--y) 12%, var(--paper)); }
  .table tbody tr.sel td, .table tbody tr.sel td b { background: var(--y); color: var(--on); }

  /* seven-segment read-outs in recessed windows */
  .bignum, .sum-item .n, .an-val, .clock {
    font-family: 'DSEG7', var(--ui); font-weight: 700; letter-spacing: 0.02em;
    color: var(--lcd-fg); background: var(--lcd-bg); border-radius: 4px; box-shadow: var(--window);
    text-shadow: 0 0 7px rgba(255, 176, 0, var(--lamp-glow)) !important;
  }
  .bignum { display: inline-block; padding: 10px 14px 8px; font-size: 40px; }
  .bignum small, .sum-item .n small { font-family: var(--ui); font-size: 0.45em; color: var(--lcd-fg); opacity: 0.75; }
  .sum-item .n { display: inline-block; padding: 6px 9px 5px; font-size: 24px; }
  .an-val { display: inline-block; padding: 6px 9px 5px; font-size: 20px; }
  .an-panel .bignum { font-size: 34px; }
  .clock { padding: 6px 10px 5px; font-size: 15px; }
  .hx-tile .n { color: var(--lcd-fg); background: var(--lcd-bg); border-radius: 4px; padding: 3px 8px; display: inline-block; box-shadow: var(--window); }

  /* lamps, LED gauges, badges with a pilot light */
  .state.ok::before { color: var(--led-on); text-shadow: 0 0 6px var(--led-on) !important; }
  .state.bad::before { text-shadow: 0 0 6px var(--red) !important; }
  .state.mid::before { text-shadow: 0 0 6px var(--orange) !important; }
  .bar { height: 12px; background: var(--lcd-bg); border: 1px solid var(--bezel); border-radius: 3px; box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6); }
  .bar > i { background: repeating-linear-gradient(90deg, var(--led-on) 0 6px, transparent 6px 8px); box-shadow: none; }
  .bar.warn > i { background: repeating-linear-gradient(90deg, var(--orange) 0 6px, transparent 6px 8px); }
  .bar.alert > i { background: repeating-linear-gradient(90deg, var(--red) 0 6px, transparent 6px 8px); }
  .minibars i { background: repeating-linear-gradient(to top, var(--y) 0 3px, transparent 3px 4px); border: 0; }
  .badge { background: var(--key) !important; color: var(--fg) !important; border: 1px solid var(--bezel); border-radius: 3px; font: 700 10px/1.5 var(--ui); letter-spacing: 0.12em; text-transform: uppercase; box-shadow: inset 0 1px 0 var(--hl); }
  .badge::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--led-on); box-shadow: 0 0 4px var(--led-on); vertical-align: 1px; }
  .badge.warn::before { background: var(--orange); box-shadow: 0 0 4px var(--orange); }

  /* cards are small modules too */
  .sum-item, .hx-tile, .pj-card, .pj-bm-link, .theme-card, .sess-card, .alert-state {
    background: var(--paper); border: 1.5px solid var(--ink); border-radius: 6px; box-shadow: var(--sh);
  }
  .sum-item:active, .pj-card:active, .theme-card:active { transform: translateY(2px); box-shadow: var(--sh-press); }
  .theme-card.on { box-shadow: var(--sh), 0 0 0 2px var(--y); transform: none; }
  .pj-card.alert { box-shadow: var(--sh), inset 0 3px 0 var(--red); }
  .pj-group-title { font: 700 16px/1 var(--ui); letter-spacing: 0.2em; text-transform: uppercase; }
  .pj-group-count { background: var(--plate); color: var(--plate-fg); border: 0; border-radius: 3px; }
  .pj-group-rule { height: 3px; background: var(--bezel); box-shadow: 0 1px 0 var(--hl); }
  .pj-ev-dot { background: var(--y); border: 1px solid var(--bezel); box-shadow: 0 0 8px rgba(255, 176, 0, var(--lamp-glow)); }
  .pj-bm-mono { border: 1px solid var(--bezel); border-radius: 5px; box-shadow: var(--key-edge); }
  .modal, .login-box { border: 3px solid var(--bezel); border-radius: 9px; box-shadow: var(--sh-lg), inset 0 1px 0 var(--hl); }
  .modal h3, .login-title, .hx-title { text-transform: uppercase; letter-spacing: 0.1em; }
  @media (max-width: 900px) {
    .tabbar { background: var(--paper); border-top: 2px solid var(--bezel); }
    .tabbar b { background: var(--key); border: 1px solid var(--bezel) !important; border-radius: 5px; box-shadow: var(--key-edge); color: var(--fg); }
    .tabbar .active b { transform: translateY(2px); box-shadow: var(--key-down), 0 0 0 2px var(--led-on); color: var(--hi); background: var(--key); }
  }
}

/* keys press in: the cursor sinks too while the mouse is pressed (:active matches the pressed element and its ancestors) */
[data-theme="control"] :active { --cur-arrow: var(--cur-arrow-down); --cur-hand: var(--cur-hand-down); }

/* ---------- tabs and context menu: key caps on a rail (an LED on the active one), a screwed-on module with a plate ---------- */
[data-theme="control"] {
  .tabstrip { gap: 6px; padding: 8px 16px; align-items: center; background: var(--cream); border-bottom: 2px solid var(--bezel); box-shadow: inset 0 -1px 0 var(--hl); }
  .tab {
    height: 30px; padding: 0 6px 0 10px; border: 1px solid var(--bezel); border-radius: 5px; background: var(--key); box-shadow: var(--key-edge);
    color: var(--fg); font: 700 12.5px/1 var(--ui); letter-spacing: 0.12em;
  }
  .tab::before, .tab.active::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--led-off); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.5); }
  .tab:hover { background: var(--key); border-color: var(--bezel); color: var(--hi); filter: brightness(1.04); }
  .tab:active { transform: translateY(2px); box-shadow: var(--key-down); }
  .tab.active { height: 30px; margin-bottom: 0; transform: translateY(2px); background: linear-gradient(to bottom, var(--key-bot), var(--key-top)); color: var(--hi); border-color: var(--bezel); box-shadow: var(--key-down); }
  .tab.active::before { background: var(--led-on); box-shadow: 0 0 7px var(--led-on); }
  .tab-x { color: var(--fg); font: 700 14px/1 var(--ui); }
  .tab-x:hover { background: none; color: var(--red); }
  .tab-new { width: 30px; height: 30px; margin: 0; border: 1px solid var(--bezel); border-radius: 5px; background: linear-gradient(to bottom, #ffc640, #e39a00); color: #1b1a17; font: 700 17px/1 var(--ui); box-shadow: var(--key-edge); }
  .tab-new:hover, .tab-new:focus-visible { border: 1px solid var(--bezel); background: linear-gradient(to bottom, #ffc640, #e39a00); color: #1b1a17; filter: brightness(1.06); }
  .tab-new:active { transform: translateY(2px); box-shadow: var(--key-down); }
  .tab.drop-before { box-shadow: var(--key-edge), -4px 0 0 var(--y); }
  .tab.drop-after { box-shadow: var(--key-edge), 4px 0 0 var(--y); }
  @keyframes tab-flash { 0%, 30% { background: var(--y); color: #1b1a17; } }

  .ctx-menu {
    min-width: 240px; padding: 34px 8px 8px; border: 2px solid var(--bezel); border-radius: 8px; background: var(--paper);
    box-shadow: var(--sh-lg), inset 0 1px 0 var(--hl); font: 600 13px/1.2 var(--ui); letter-spacing: 0.1em; text-transform: uppercase;
  }
  .ctx-menu:not(:has(.ctx-head)) { padding-top: 8px; }
  .ctx-head {
    position: absolute; top: 7px; left: 10px; right: 10px; margin: 0; padding: 5px 9px 4px; border: 0; border-radius: 3px;
    background: var(--plate); color: var(--plate-fg); font: 700 11px/1.2 var(--ui); letter-spacing: 0.16em; text-transform: none;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6), 0 1px 0 var(--hl);
  }
  .ctx-item { gap: 12px; padding: 7px 8px; border-radius: 4px; }
  .ctx-item::before { content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--led-off); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.5); }
  .ctx-item:hover, .ctx-item:focus { background: var(--lcd-bg); color: var(--lcd-fg); box-shadow: var(--window); }
  .ctx-item:hover::before, .ctx-item:focus::before { background: var(--y); box-shadow: 0 0 6px var(--y); }
  .ctx-item.danger { color: var(--red); }
  .ctx-item.danger:hover, .ctx-item.danger:focus { background: var(--lcd-bg); color: #ff6a4d; }
  .ctx-item.danger:hover::before, .ctx-item.danger:focus::before { background: #ff6a4d; box-shadow: 0 0 6px #ff6a4d; }
  .ctx-kbd { padding: 2px 5px; border: 1px solid var(--bezel); border-radius: 3px; background: var(--key); box-shadow: inset 0 1px 0 var(--hl); color: var(--fg); font: 700 10px var(--ui); letter-spacing: 0.06em; }
  .ctx-item:hover .ctx-kbd, .ctx-item:focus .ctx-kbd { color: var(--fg); }
  .ctx-sep { height: 2px; margin: 6px 2px; background: var(--bezel); box-shadow: 0 1px 0 var(--hl); }
  .ctx-foot { border-top: 0; color: var(--fg); opacity: 0.6; font: 600 10.5px var(--ui); letter-spacing: 0.1em; text-transform: uppercase; }
  .more-count { border-radius: 8px; background: var(--led-on); color: #0b0b08; box-shadow: 0 0 6px var(--led-on); font: 700 10px/16px var(--ui); }
  @media (max-width: 900px) {
    .sheet-tab { border: 1px solid var(--bezel); border-radius: 5px; background: var(--key); box-shadow: var(--key-edge); color: var(--fg); font: 700 15px/1 var(--ui); letter-spacing: 0.1em; }
    .sheet-tab::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--led-off); }
    .sheet-tab.active { background: linear-gradient(to bottom, var(--key-bot), var(--key-top)); color: var(--hi); box-shadow: var(--key-down); }
    .sheet-tab.active::before { background: var(--led-on); box-shadow: 0 0 7px var(--led-on); }
  }
}

/* ---------- SETTINGS preview (shown in every theme) ---------- */
.tc-control { background: #cbc4b1; border: 1.5px solid #6d675a; border-radius: 6px; }
.tc-control b { background: #3b382f; border-radius: 2px; }
.tc-control i { background: #a9a290; border-radius: 2px; }
.tc-control .tcp-top i { background: #1d1b14; box-shadow: inset 0 0 0 2px #1d1b14, inset 0 0 0 3px #ffb000; }
.tc-control .tcp-side i { background: linear-gradient(#f3eee2, #d6cfbc); border: 1px solid #5e584b; border-radius: 2px; height: 11px; }
.tc-control .tcp-side i.on { box-shadow: inset -4px 0 0 -2px #4fd65a; }
.tc-control .tcp-panel { background: #e3ddcc; border: 1px solid #6d675a; border-radius: 4px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6); }
.tc-control .tcp-panel b { background: #3b382f; }
.tc-control .tcp-btn { background: linear-gradient(#ffc640, #e39a00); border: 1px solid #5e584b; border-radius: 3px; }
.tc-control.dark { background: #181a17; border-color: #4e5248; }
.tc-control.dark b, .tc-control.dark .tcp-panel b { background: #0d0e0c; }
.tc-control.dark i { background: #4a4e44; }
.tc-control.dark .tcp-side i { background: linear-gradient(#3d4038, #2a2c26); border-color: #0e0f0c; }
.tc-control.dark .tcp-panel { background: #23261f; border-color: #4e5248; box-shadow: none; }
