/* ==========================================================
   Ops Console — SHADCN theme (a flat theme on theme-kit.css): the clean product UI of shadcn/ui and Base UI.
   Zinc neutrals, Geist, 1px borders, soft radii and shadows, card headers, a quiet sidebar with keyboard hints on the right,
   pill tabs on a muted track, focus rings, black primary buttons (white in dark mode). Nothing decorative.
   ========================================================== */
@font-face { font-family: 'Geist'; src: url(/fonts/geist-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Geist'; src: url(/fonts/geist-500.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Geist'; src: url(/fonts/geist-600.woff2) format('woff2'); font-weight: 600 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url(/fonts/geist-mono-400.woff2) format('woff2'); font-weight: 400 900; font-display: swap; }

/* ---------- light ---------- */
:root[data-theme="shadcn"] {
  --cream: #ffffff;
  --paper: #ffffff;
  --fg: #09090b;
  --hi: #09090b;
  --ink: #e4e4e7;           /* border */
  --on: #fafafa;            /* text on primary */
  --y: #18181b;             /* primary */
  --muted: #71717a;
  --faint: #a1a1aa;
  --rule: #f4f4f5;
  --dash: #d4d4d8;
  --tint: #f4f4f5;          /* accent (hover) */
  --well: #fafafa;
  --sidebar: #fafafa;
  --ring: #a1a1aa;
  --blue: #2563eb; --red: #dc2626; --green: #16a34a; --orange: #ea580c; --purple: #7c3aed; --mint: #0d9488; --pink: #db2777;
  --screen: #09090b;
  --screen-fg: #fafafa;
  --k-bw-lg: 1px; --k-bw: 1px; --k-bw-sm: 1px; --k-bw-xs: 1px;
  --k-r: 0.75; --k-r-pill: 1; --k-move: 0;
  --sh-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --sh: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px -1px rgba(0, 0, 0, 0.07);
  --sh-lg: 0 16px 40px -12px rgba(0, 0, 0, 0.25);
  --sh-hover: var(--sh-sm); --sh-hover-lg: var(--sh); --sh-press: none;
  --k-inset: none; --k-inset-on: none;
  --ui: 'Geist', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --chart-line: #2563eb;
  --chart-alt: #ea580c;
  --chart-font: 500 11px Geist, sans-serif;
  /* cursors: generated by tools/kit-cursors.mjs shadcn */
  --cur-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='28' viewBox='0 0 24 28'%3E%3Cdefs%3E%3Cfilter id='d' x='-40%' y='-40%' width='180%' height='180%'%3E%3CfeGaussianBlur stdDeviation='1'/%3E%3C/filter%3E%3Cpath id='s' d='M5 3.2V21.4L9.2 17.5L12 24L14.7 22.9L11.9 16.5H17.8Z'/%3E%3C/defs%3E%3Cuse href='%23s' x='0' y='1.2' fill='%23000' stroke='%23000' stroke-width='2.6' opacity='.28' filter='url(%23d)'/%3E%3Cuse href='%23s' fill='%23ffffff' stroke='%23ffffff' stroke-width='2.6' stroke-linejoin='round'/%3E%3Cuse href='%23s' fill='%2309090b'/%3E%3C/svg%3E") 5 3, default;
  --cur-hand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='32' viewBox='0 0 30 32'%3E%3Cdefs%3E%3Cfilter id='d' x='-40%' y='-40%' width='180%' height='180%'%3E%3CfeGaussianBlur stdDeviation='1'/%3E%3C/filter%3E%3Cg id='s'%3E%3Crect x='10.4' y='2.6' width='4.2' height='14.4' rx='2.1'/%3E%3Crect x='14.3' y='10.4' width='4' height='8.6' rx='2'/%3E%3Crect x='18' y='11.6' width='3.8' height='8' rx='1.9'/%3E%3Crect x='21.3' y='13.2' width='3.4' height='7' rx='1.7'/%3E%3Crect x='8.6' y='14.6' width='16.1' height='12.6' rx='5.6'/%3E%3Crect x='4.4' y='14.3' width='7.6' height='4' rx='2' transform='rotate(40 8.2 16.3)'/%3E%3C/g%3E%3C/defs%3E%3Cuse href='%23s' x='0' y='1.2' fill='%23000' stroke='%23000' stroke-width='2.6' opacity='.28' filter='url(%23d)'/%3E%3Cuse href='%23s' fill='%23ffffff' stroke='%23ffffff' stroke-width='2.6' stroke-linejoin='round'/%3E%3Cuse href='%23s' fill='%2309090b'/%3E%3Cpath d='M14.4 14.2V18.6M18.1 15.2V19.4M21.4 16.4V20' stroke='%23ffffff' stroke-width='1' stroke-linecap='round' opacity='.85'/%3E%3C/svg%3E") 12 3, pointer;
  --cur-text: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='32' viewBox='0 0 20 32'%3E%3Cpath d='M6 4C8.6 4 9.6 5 10 6.6C10.4 5 11.4 4 14 4M10 6.6V25.4M6 28C8.6 28 9.6 27 10 25.4C10.4 27 11.4 28 14 28' stroke='%23ffffff' stroke-width='3.6' fill='none' stroke-linecap='round'/%3E%3Cpath d='M6 4C8.6 4 9.6 5 10 6.6C10.4 5 11.4 4 14 4M10 6.6V25.4M6 28C8.6 28 9.6 27 10 25.4C10.4 27 11.4 28 14 28' stroke='%2309090b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") 10 16, text;
  color-scheme: light;
}

/* ---------- dark ---------- */
:root[data-theme="shadcn"][data-mode="dark"] {
  --cream: #09090b;
  --paper: #09090b;
  --fg: #fafafa;
  --hi: #fafafa;
  --ink: #27272a;
  --on: #18181b;
  --y: #fafafa;
  --muted: #a1a1aa;
  --faint: #71717a;
  --rule: #18181b;
  --dash: #3f3f46;
  --tint: #27272a;
  --well: #0f0f12;
  --sidebar: #0c0c0e;
  --ring: #71717a;
  --blue: #3b82f6; --red: #ef4444; --green: #22c55e; --orange: #f97316; --purple: #a78bfa; --mint: #2dd4bf; --pink: #f472b6;
  --sh-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --sh: 0 1px 3px rgba(0, 0, 0, 0.4);
  --sh-lg: 0 16px 40px -12px rgba(0, 0, 0, 0.7);
  --chart-line: #3b82f6;
  --chart-alt: #f97316;
  --cur-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='28' viewBox='0 0 24 28'%3E%3Cdefs%3E%3Cfilter id='d' x='-40%' y='-40%' width='180%' height='180%'%3E%3CfeGaussianBlur stdDeviation='1'/%3E%3C/filter%3E%3Cpath id='s' d='M5 3.2V21.4L9.2 17.5L12 24L14.7 22.9L11.9 16.5H17.8Z'/%3E%3C/defs%3E%3Cuse href='%23s' x='0' y='1.2' fill='%23000' stroke='%23000' stroke-width='2.6' opacity='.28' filter='url(%23d)'/%3E%3Cuse href='%23s' fill='%2309090b' stroke='%2309090b' stroke-width='2.6' stroke-linejoin='round'/%3E%3Cuse href='%23s' fill='%23fafafa'/%3E%3C/svg%3E") 5 3, default;
  --cur-hand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='32' viewBox='0 0 30 32'%3E%3Cdefs%3E%3Cfilter id='d' x='-40%' y='-40%' width='180%' height='180%'%3E%3CfeGaussianBlur stdDeviation='1'/%3E%3C/filter%3E%3Cg id='s'%3E%3Crect x='10.4' y='2.6' width='4.2' height='14.4' rx='2.1'/%3E%3Crect x='14.3' y='10.4' width='4' height='8.6' rx='2'/%3E%3Crect x='18' y='11.6' width='3.8' height='8' rx='1.9'/%3E%3Crect x='21.3' y='13.2' width='3.4' height='7' rx='1.7'/%3E%3Crect x='8.6' y='14.6' width='16.1' height='12.6' rx='5.6'/%3E%3Crect x='4.4' y='14.3' width='7.6' height='4' rx='2' transform='rotate(40 8.2 16.3)'/%3E%3C/g%3E%3C/defs%3E%3Cuse href='%23s' x='0' y='1.2' fill='%23000' stroke='%23000' stroke-width='2.6' opacity='.28' filter='url(%23d)'/%3E%3Cuse href='%23s' fill='%2309090b' stroke='%2309090b' stroke-width='2.6' stroke-linejoin='round'/%3E%3Cuse href='%23s' fill='%23fafafa'/%3E%3Cpath d='M14.4 14.2V18.6M18.1 15.2V19.4M21.4 16.4V20' stroke='%2309090b' stroke-width='1' stroke-linecap='round' opacity='.85'/%3E%3C/svg%3E") 12 3, pointer;
  --cur-text: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='32' viewBox='0 0 20 32'%3E%3Cpath d='M6 4C8.6 4 9.6 5 10 6.6C10.4 5 11.4 4 14 4M10 6.6V25.4M6 28C8.6 28 9.6 27 10 25.4C10.4 27 11.4 28 14 28' stroke='%2309090b' stroke-width='3.6' fill='none' stroke-linecap='round'/%3E%3Cpath d='M6 4C8.6 4 9.6 5 10 6.6C10.4 5 11.4 4 14 4M10 6.6V25.4M6 28C8.6 28 9.6 27 10 25.4C10.4 27 11.4 28 14 28' stroke='%23fafafa' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") 10 16, text;
  color-scheme: dark;
}

[data-theme="shadcn"] {
  & body { font-weight: 400; font-size: 13.5px; letter-spacing: -0.006em; }
  --focus: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent);

  /* shell: white topbar, quiet sidebar, ghost items, shortcuts on the right */
  .topbar { background: var(--paper); border-bottom: 1px solid var(--ink); }
  .brand { font: 600 15px/1 var(--ui); letter-spacing: -0.02em; }
  .brand::before, .login-head::before { border: 0; box-shadow: none; border-radius: 6px; }
  .clock { background: none; color: var(--muted); font: 500 12.5px/1 var(--mono); padding: 0; }
  .nav { background: var(--sidebar); border-right: 1px solid var(--ink); gap: 2px; padding: 12px 10px; }
  .nav a { font: 500 13.5px/1 var(--ui); letter-spacing: 0; color: var(--muted); padding: 8px 10px; border: 0; border-radius: 6px; }
  .nav a kbd { order: 2; margin-left: auto; min-width: 0; font: 500 10.5px/1 var(--mono); color: var(--faint); background: none; border: 1px solid var(--ink); border-radius: 4px; padding: 2px 5px; box-shadow: none; }
  .nav a:hover { background: var(--tint); color: var(--fg); border: 0; box-shadow: none; }
  .nav a.active { background: var(--tint); color: var(--fg); font-weight: 600; border: 0; box-shadow: none; }
  .nav a.active kbd { color: var(--muted); border-color: var(--dash); }
  .nav-gauges { border-top: 1px solid var(--ink); }
  .statusline { background: var(--paper); border-top: 1px solid var(--ink); color: var(--muted); font: 500 12px var(--ui); }
  .statusline .prompt { background: var(--tint); color: var(--fg); border-radius: 4px; font: 500 11px var(--mono); }

  /* cards with a header */
  .panel, .panel.agent-card.live { border: 1px solid var(--ink); border-radius: 12px; box-shadow: var(--sh-sm); padding: 18px 20px; }
  .panel > h2 { font: 600 14px/1.3 var(--ui); letter-spacing: -0.01em; margin-bottom: 14px; }
  .panel.agent-card.live { border-color: color-mix(in srgb, var(--green) 45%, var(--ink)); }
  .panel.term-stage { padding: 0; border-radius: 12px; }

  /* buttons: outline by default, solid primary, destructive */
  .btn { background: var(--paper); color: var(--fg); border: 1px solid var(--ink); border-radius: 6px; padding: 5px 12px; font: 500 13px/1.3 var(--ui); letter-spacing: 0; box-shadow: var(--sh-sm); }
  .btn:hover, .btn:focus-visible { background: var(--tint); color: var(--fg); box-shadow: var(--sh-sm); }
  .btn:focus-visible { box-shadow: var(--focus); border-color: var(--ring); }
  .btn-primary, .btn.on { background: var(--y); color: var(--on); border-color: var(--y); }
  .btn-primary:hover, .btn-primary:focus-visible { background: color-mix(in srgb, var(--y) 88%, var(--paper)); color: var(--on); }
  .btn-danger { background: var(--paper); color: var(--red); border-color: var(--ink); }
  .btn-danger:hover, .btn-danger:focus-visible { background: var(--red); color: #fff; border-color: var(--red); }
  .btn-warn { background: var(--paper); color: var(--orange-text); border-color: var(--ink); }
  .btn-warn:hover, .btn-warn:focus-visible { background: var(--orange); color: #fff; border-color: var(--orange); }
  .btn-sm { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
  .btn-wide { padding: 9px; font-size: 14px; border-radius: 8px; box-shadow: none; background: var(--y); color: var(--on); border-color: var(--y); }

  /* tabs: pills on a muted track */
  .seg { background: var(--tint); border: 0; border-radius: 8px; padding: 3px; gap: 2px; box-shadow: none; }
  .seg button { border: 0; border-radius: 6px; padding: 4px 11px; font: 500 12.5px var(--ui); letter-spacing: 0; color: var(--muted); }
  .seg button + button { border-left: 0; }
  .seg button:hover { background: none; color: var(--fg); }
  .seg button.on { background: var(--paper); color: var(--fg); box-shadow: var(--sh); }
  .term-tab, .hx-tabs button { border: 1px solid var(--ink); border-radius: 6px; box-shadow: none; font: 500 12.5px var(--ui); }
  .term-tab.active, .hx-tabs button.on { background: var(--tint); color: var(--fg); border-color: var(--dash); transform: none; }

  /* inputs: 1px border, focus ring */
  .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, .hx-area, .hx-editor, .term-compose textarea, & select {
    background: transparent; border: 1px solid var(--ink); border-radius: 6px; box-shadow: none;
  }
  .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 {
    border-color: var(--ring); box-shadow: var(--focus); background: transparent; transform: none;
  }
  .field span, .hx-field > span { font: 500 12px var(--ui); letter-spacing: 0; color: var(--fg); }
  .switch { width: 36px; height: 20px; background: var(--dash); border: 0; border-radius: 99px; }
  .switch i { top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border: 0; border-radius: 50%; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
  .switch.on { background: var(--y); }
  .switch.on i { left: 18px; background: var(--paper); }

  /* tables: muted header, row hover */
  .table th { background: none; color: var(--muted); font: 500 12px var(--ui); letter-spacing: 0; border-bottom: 1px solid var(--ink); }
  .table td { border-bottom: 1px solid var(--ink); }
  .table tbody tr:hover td { background: color-mix(in srgb, var(--tint) 60%, transparent); }
  .table tbody tr.sel td, .table tbody tr.sel td b { background: var(--tint); color: var(--fg); }
  .table tr.sel .f-name, .table tr.sel .f-icon { color: var(--fg); } /* the kit puts them in --on, made for a dark selection */
  .table tr.sel .f-name::after, .table tbody tr.sel td .dim, .table tbody tr.sel td .muted { color: var(--muted); }

  /* badges, gauges, numbers */
  .badge { border: 1px solid transparent; border-radius: 99px; padding: 1px 8px; font: 500 11px/1.5 var(--ui); letter-spacing: 0; background: var(--tint); color: var(--fg); }
  .badge.warn { background: var(--orange-soft); color: var(--orange-text); }
  .bar { height: 8px; background: var(--tint); border: 0; border-radius: 99px; }
  .bar > i { background: var(--y); }
  .bar.warn > i { background: var(--orange); }
  .bar.alert > i { background: var(--red); }
  .bignum { font: 600 40px/1 var(--ui); letter-spacing: -0.04em; }
  .sum-item, .hx-tile, .pj-card, .pj-bm-link, .theme-card, .sess-card, .alert-state { border: 1px solid var(--ink); border-radius: 12px; box-shadow: var(--sh-sm); }
  .sum-item:hover, .pj-card:hover, .pj-card:focus-visible, .pj-bm-link:hover, .theme-card:hover { background: var(--well); box-shadow: var(--sh); transform: none; }
  .sum-item .n, .hx-tile .n { font-weight: 600; letter-spacing: -0.03em; }
  .theme-card.on { background: var(--paper); box-shadow: 0 0 0 2px var(--y); transform: none; }
  .pj-card.alert { box-shadow: var(--sh-sm), inset 3px 0 0 var(--red); }
  .pj-group-count { background: var(--tint); color: var(--fg); border: 0; }
  .pj-group-rule { height: 1px; background: var(--ink); }
  .pj-ev-dot { background: var(--paper); border: 2px solid var(--y); box-shadow: none; }
  .pj-bm-mono { border: 0; box-shadow: none; border-radius: 8px; color: #fff; }
  .modal, .login-box { border: 1px solid var(--ink); border-radius: 12px; box-shadow: var(--sh-lg); }
  .modal-back { background: rgba(0, 0, 0, 0.45); }
  .chip { border: 1px solid var(--ink); border-radius: 99px; }
  .chip:hover { background: var(--tint); color: var(--fg); border-color: var(--dash); }
}

/* sentence case for the navigation and the card titles ("Memory", not "MEMORY"); acronyms stay upper case */
[data-theme="shadcn"] .nav-label { display: inline-block; text-transform: lowercase; }
[data-theme="shadcn"] .panel > h2 { text-transform: lowercase; }
[data-theme="shadcn"] :is(.nav-label, .panel > h2)::first-letter { text-transform: uppercase; }
[data-theme="shadcn"] .p-cpu > h2 { text-transform: none; }

/* ---------- tabs and context menu: browser-like tabs on a muted track, a dropdown menu ---------- */
[data-theme="shadcn"] {
  .tabstrip { gap: 2px; padding: 5px 10px; align-items: center; background: color-mix(in srgb, var(--tint) 60%, var(--paper)); border-bottom: 1px solid var(--ink); }
  .tab { height: 30px; padding: 0 4px 0 12px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--muted); font: 500 13px/1 var(--ui); letter-spacing: 0; }
  .tab .tl-view, .sheet-tab .tl-view { display: inline-block; text-transform: lowercase; }
  .tab .tl-view::first-letter, .sheet-tab .tl-view::first-letter { text-transform: uppercase; }
  .tab:hover { background: var(--tint); color: var(--fg); border-color: transparent; }
  .tab.active { height: 30px; margin-bottom: 0; background: var(--paper); color: var(--fg); border-color: var(--ink); box-shadow: var(--sh-sm); }
  .tab:focus-visible { outline: none; border-color: var(--ring); box-shadow: var(--focus); }
  .tab-x { width: 20px; height: 20px; border-radius: 4px; color: var(--muted); font: 400 15px/1 var(--ui); opacity: 0; }
  .tab:hover .tab-x, .tab.active .tab-x { opacity: 1; }
  .tab-x:hover { background: var(--tint); color: var(--fg); }
  .tab-new { width: 28px; height: 28px; margin: 0 0 0 4px; border: 0; border-radius: 6px; color: var(--muted); font: 400 18px/1 var(--ui); }
  .tab-new:hover { border: 0; background: var(--paper); color: var(--fg); box-shadow: var(--sh-sm); }
  .tab-new:focus-visible { border: 0; box-shadow: var(--focus); }
  @keyframes tab-flash { 0%, 30% { background: var(--fg); color: var(--paper); } }

  .ctx-menu { min-width: 224px; padding: 4px; border: 1px solid var(--ink); border-radius: 8px; background: var(--paper); color: var(--fg); box-shadow: var(--sh-lg); font: 400 13.5px/1.25 var(--ui); }
  .ctx-head { margin: 0 -4px 4px; padding: 6px 12px 8px; border-bottom: 1px solid var(--ink); color: var(--fg); font: 600 13px var(--ui); letter-spacing: 0; }
  .ctx-item { gap: 24px; padding: 6px 8px; border-radius: 4px; }
  .ctx-item:hover, .ctx-item:focus { background: var(--tint); color: var(--fg); }
  .ctx-item.danger { color: var(--red); }
  .ctx-item.danger:hover, .ctx-item.danger:focus { background: color-mix(in srgb, var(--red) 10%, transparent); color: var(--red); }
  .ctx-kbd { font: 400 11.5px var(--ui); letter-spacing: 0.1em; color: var(--muted); }
  .ctx-sep { height: 1px; margin: 4px -4px; background: var(--ink); }
  .ctx-foot { margin: 4px -4px -4px; padding: 7px 12px; border-top: 1px solid var(--ink); border-radius: 0 0 7px 7px; background: color-mix(in srgb, var(--tint) 50%, transparent); color: var(--muted); font: 400 11.5px var(--ui); }
  .more-count { border-radius: 9px; background: var(--fg); color: var(--paper); font: 600 10px/16px var(--ui); }
  @media (max-width: 900px) {
    .sheet-tab { border: 1px solid var(--ink); border-radius: 8px; background: var(--paper); color: var(--fg); font: 500 15px/1 var(--ui); }
    .sheet-tab.active { background: var(--tint); color: var(--fg); font-weight: 600; box-shadow: none; }
  }
}

/* ---------- SETTINGS preview (shown in every theme) ---------- */
.tc-shadcn { background: #ffffff; border: 1px solid #e4e4e7; border-radius: 10px; }
.tc-shadcn b { background: #18181b; border-radius: 3px; }
.tc-shadcn i { background: #e4e4e7; border-radius: 3px; }
.tc-shadcn .tcp-side { background: #fafafa; border-radius: 6px; padding: 3px; }
.tc-shadcn .tcp-side i.on { background: #e4e4e7; }
.tc-shadcn .tcp-side i:not(.on) { background: transparent; box-shadow: inset 0 0 0 1px #f0f0f1; }
.tc-shadcn .tcp-panel { background: #ffffff; border: 1px solid #e4e4e7; border-radius: 7px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.tc-shadcn .tcp-btn { background: #18181b; border-radius: 5px; }
.tc-shadcn.dark { background: #09090b; border-color: #27272a; }
.tc-shadcn.dark b, .tc-shadcn.dark .tcp-btn { background: #fafafa; }
.tc-shadcn.dark i { background: #27272a; }
.tc-shadcn.dark .tcp-side { background: #0c0c0e; }
.tc-shadcn.dark .tcp-side i.on { background: #27272a; }
.tc-shadcn.dark .tcp-side i:not(.on) { box-shadow: inset 0 0 0 1px #18181b; }
.tc-shadcn.dark .tcp-panel { background: #09090b; border-color: #27272a; box-shadow: none; }
