/* ============================================================
   ll-console.css — the reusable v5 OPERATOR CONSOLE chrome.

   Extracted from the operator's "Console Chrome" design (top bar +
   collapsible left rail + content scaffolding). Paired with
   js/ll-console-shell.js, which renders the chrome and wraps the page.

   Like ll-public.css, this file does NOT redefine the palette: it BRIDGES
   the design's local token vocabulary (--canvas/--card/--raised/--line/
   --ink/--mut/--dim/--ledger/--signals/--warden/--admin/--up/--warn/--down)
   onto the canonical v5 tokens in ll-v5.css, so the console rides the exact
   same colors as the Operator Hub and the rest of v5. Load order per page:

       <link rel="stylesheet" href="/v5/ll-v5.css"/>      (tokens + base)
       <link rel="stylesheet" href="/css/ll-console.css"/> (this — chrome)

   Dark-first like the rest of v5, but it HONOURS the [data-theme="light"]
   switch: every colour below resolves through the v5 tokens (or console.css's
   own [data-ll-theme] palette), both of which flip with the theme. The top-bar
   toggle in ll-console-shell.js drives it.
   ============================================================ */

/* ---------- TOKEN BRIDGE: design names → v5 ----------
   Only the design's own vocabulary is bridged here. Tokens v5 already owns
   (--card/--ink/--dim/--admin) are intentionally NOT redeclared: aliasing a
   property to itself (--ink: var(--ink)) is a self-reference, which computes
   to the guaranteed-invalid value and wipes the token to empty — the cause of
   the dark-on-dark "black --ink text" bug. Leave them to v5 / console.css. */
:root {
  --canvas: var(--bg);
  --raised: var(--inset);
  --line: var(--border);
  --mut: var(--muted);

  /* group accents — the four operator lanes */
  --ledger: var(--blue);
  --signals: var(--violet);
  --warden: var(--goldHi);

  /* status spectrum (design used GitHub-ish greens/ambers/reds; map to v5) */
  --up: var(--green);
  --warn: var(--gold);
  --down: var(--red);

  /* chrome metrics carried from the design */
  --rail-w: 236px;
  --rail-c: 56px;
  --top-h: 50px;
}

/* ---------- BASE for a bare console page (no .app shell) ----------
   These pages are #ll-content bodies, not the full app shell. Own the
   background + scroll so tall tool bodies scroll the page normally. */
html.ll-console-doc,
html.ll-console-doc body {
  background: var(--bg);
  color: var(--ink);
  min-height: 100%;
}
/* The VIEWPORT (html) owns page scroll; body must stay overflow-VISIBLE. Any non-visible
   overflow on body makes body a scroll container that never actually scrolls — and every
   position:sticky descendant (the llc topbar + left rail) anchors to it and silently stops
   sticking (the 2026-07-10 "sidebar has its own scroll + giant void" bug). console.css's
   app-frame body{overflow:hidden} is deliberately overridden here for the doc-style pages. */
html.ll-console-doc {
  overflow-y: auto;
  height: auto;
}
html.ll-console-doc body {
  overflow: visible;
  height: auto;
}
.ll-console-doc .num { font-variant-numeric: tabular-nums; }
.ll-console-doc .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.ll-console-doc svg { display: block; }

/* ===== top bar (identical identity to the Operator Hub) ===== */
.llc-top {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--top-h);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 0 1rem;
}
.llc-brandlink { display: inline-flex; align-items: center; gap: .5rem; flex: none; text-decoration: none; color: inherit; border-radius: 6px; }
.llc-brandlink:hover .llc-wm { color: var(--warden); }
.llc-mark { width: 21px; height: 21px; flex: none; display: grid; place-items: center; }
.llc-mark svg { width: 21px; height: 21px; display: block; }
.llc-wm { font-weight: 700; font-size: .88rem; letter-spacing: -.01em; white-space: nowrap; color: var(--ink); }
.llc-wm b { color: var(--warden); font-weight: 700; }
.llc-top .llc-div { width: 1px; height: 17px; background: var(--line); flex: none; }
.llc-top .llc-pg { font-size: .8rem; font-weight: 600; color: var(--mut); white-space: nowrap; }
.llc-top .llc-tool { font-size: .8rem; font-weight: 700; color: var(--ink); white-space: nowrap; display: flex; align-items: center; gap: .45rem; }
.llc-top .llc-tool .sw { width: 7px; height: 7px; border-radius: 3px; background: var(--ledger); }
/* breadcrumb: ◂ Hub ▸ <group> ▸ <tool> — the left/center of the top bar */
.llc-crumbs { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.llc-crumbs .llc-crumb-sep { color: var(--dim); font-size: .7rem; flex: none; }
.llc-crumb-group { display: inline-flex; align-items: center; gap: .5rem; min-width: 0; }
.llc-crumb-group .llc-pg { overflow: hidden; text-overflow: ellipsis; }
.llc-crumb-hub { flex: none; }
.llc-top-r { margin-left: auto; display: flex; align-items: center; gap: .55rem; }
.llc-hublink {
  display: flex; align-items: center; gap: .3rem;
  font-size: .74rem; font-weight: 700; color: var(--mut);
  border: 1px solid var(--line); background: var(--card);
  border-radius: 7px; padding: .32rem .65rem;
  transition: color .12s, border-color .12s; white-space: nowrap;
}
.llc-hublink:hover { color: var(--ink); border-color: var(--border-strong); }
.llc-themebtn {
  display: grid; place-items: center; flex: none;
  width: 29px; height: 29px; border-radius: 8px;
  color: var(--mut); border: 1px solid var(--line); background: var(--card);
  transition: color .12s, border-color .12s;
}
.llc-themebtn:hover { color: var(--ink); border-color: var(--border-strong); }
.llc-themebtn svg { width: 15px; height: 15px; }
/* Freeze every transition during a theme flip so the swap is instant, not a
   200ms colour-crossfade across the whole page (matches ll-shell.css). */
html.theme-snap *, html.theme-snap *::before, html.theme-snap *::after { transition: none !important; }
.llc-idchip {
  display: flex; align-items: center; gap: .45rem;
  font-size: .72rem; font-weight: 600; color: var(--mut);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: .28rem .65rem; white-space: nowrap;
}
.llc-idchip .av { width: 15px; height: 15px; border-radius: 50%; background: linear-gradient(135deg, var(--warden), #c07f16); flex: none; }
.llc-envb {
  font-family: var(--mono); font-size: .6rem; font-weight: 700; letter-spacing: .08em;
  color: var(--warn); background: rgba(210, 153, 34, .1);
  border: 1px solid rgba(210, 153, 34, .35); border-radius: 6px;
  padding: .26rem .5rem; white-space: nowrap;
}
.llc-ghealth {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--dim); box-shadow: 0 0 0 3px rgba(95, 107, 122, .18);
  flex: none; cursor: default; transition: background .2s, box-shadow .2s;
}
.llc-ghealth.up { background: var(--up); box-shadow: 0 0 0 3px rgba(46, 160, 67, .18); }
.llc-ghealth.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(210, 153, 34, .18); }
.llc-ghealth.down { background: var(--down); box-shadow: 0 0 0 3px rgba(218, 54, 51, .2); }
@media (prefers-reduced-motion: no-preference) {
  .llc-ghealth.warn, .llc-ghealth.down { animation: llc-gpulse 2.4s ease-in-out infinite; }
}
@keyframes llc-gpulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(210, 153, 34, .18); }
  50% { box-shadow: 0 0 0 6px rgba(210, 153, 34, .07); }
}
@media (max-width: 860px) { .llc-idchip { display: none; } }
@media (max-width: 640px) { .llc-crumb-group { display: none; } }

/* ===== frame ===== */
.llc-frame {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--top-h));
  transition: grid-template-columns .18s ease;
}
body.llc-rail-c .llc-frame { grid-template-columns: var(--rail-c) minmax(0, 1fr); }
@media (max-width: 900px) { .llc-frame { grid-template-columns: var(--rail-c) minmax(0, 1fr); } }

/* ===== left rail ===== */
.llc-rail {
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 55%, var(--bg));
  padding: .7rem .55rem 1rem;
  position: sticky; top: var(--top-h);
  height: calc(100vh - var(--top-h));
  overflow-y: auto; overflow-x: hidden;
}
.llc-rail::-webkit-scrollbar { width: 7px; }
.llc-rail::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px; }
.llc-rail:hover::-webkit-scrollbar-thumb { background: var(--line); }
.llc-rgroup { margin-bottom: .9rem; }
.llc-rgh { display: flex; align-items: center; gap: .45rem; padding: .2rem .5rem .35rem; }
.llc-rgh .sw { width: 7px; height: 7px; border-radius: 3px; flex: none; }
.llc-rgh .t { font-size: .58rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); white-space: nowrap; overflow: hidden; }
.llc-rlink {
  display: flex; align-items: center; gap: .55rem;
  padding: .4rem .5rem; border-radius: 8px;
  font-size: .78rem; font-weight: 600; color: var(--mut);
  transition: background .1s, color .1s;
  white-space: nowrap; position: relative;
}
.llc-rlink svg { width: 15px; height: 15px; flex: none; opacity: .75; }
.llc-rlink .lb { overflow: hidden; text-overflow: ellipsis; }
.llc-rlink:hover { background: var(--raised); color: var(--ink); }
.llc-rlink.active { background: color-mix(in srgb, var(--gacc) 14%, transparent); color: color-mix(in srgb, var(--gacc) 70%, #fff); }
.llc-rlink.active svg { opacity: 1; }
.llc-rlink.active::before { content: ""; position: absolute; left: -0.55rem; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: var(--gacc); }
.llc-rlink .soon {
  font-family: var(--mono); font-size: .5rem; font-weight: 700; letter-spacing: .06em;
  color: var(--dim); border: 1px solid var(--line); border-radius: 4px;
  padding: .06rem .26rem; margin-left: auto;
}
.llc-rail-toggle {
  width: 100%; display: flex; align-items: center; gap: .55rem;
  padding: .42rem .5rem; border-radius: 8px;
  font-size: .72rem; font-weight: 700; color: var(--dim);
  border: 1px dashed var(--line); background: none;
  margin-bottom: .8rem; transition: color .12s, border-color .12s;
}
.llc-rail-toggle:hover { color: var(--mut); border-color: var(--border-strong); }
.llc-rail-toggle svg { width: 15px; height: 15px; flex: none; transition: transform .18s; }
/* collapsed */
body.llc-rail-c .llc-rgh .t,
body.llc-rail-c .llc-rlink .lb,
body.llc-rail-c .llc-rlink .soon,
body.llc-rail-c .llc-rail-toggle .lb { display: none; }
body.llc-rail-c .llc-rgh { justify-content: center; padding: .2rem 0 .35rem; }
body.llc-rail-c .llc-rlink { justify-content: center; padding: .45rem 0; }
body.llc-rail-c .llc-rail-toggle { justify-content: center; }
body.llc-rail-c .llc-rail-toggle svg { transform: rotate(180deg); }
body.llc-rail-c .llc-rlink.active::before { left: 2px; }
@media (max-width: 900px) {
  .llc-rgh .t, .llc-rlink .lb, .llc-rlink .soon, .llc-rail-toggle { display: none; }
  .llc-rgh { justify-content: center; padding: .2rem 0 .35rem; }
  .llc-rlink { justify-content: center; padding: .45rem 0; }
  .llc-rlink.active::before { left: 2px; }
}

/* ===== content region ===== */
.llc-content { padding: 1.1rem 1.3rem 2rem; min-width: 0; }
@media (max-width: 640px) { .llc-content { padding: .9rem .8rem 1.6rem; } }

/* crumbrow (page title row) */
.crumbrow { display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap; margin-bottom: .9rem; }
.crumbrow h1 { font-size: 1.22rem; font-weight: 700; letter-spacing: -.015em; color: var(--ink); }
.crumbrow .sub { font-size: .76rem; color: var(--dim); }
.crumbrow .live { margin-left: auto; font-family: var(--mono); font-size: .62rem; color: var(--dim); display: flex; align-items: center; gap: .35rem; }
.crumbrow .live .d { width: 6px; height: 6px; border-radius: 50%; background: var(--up); }

/* control row */
.controls { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; margin-bottom: .9rem; }
.controls .seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.controls .seg button { font-size: .7rem; font-weight: 700; color: var(--mut); padding: .3rem .7rem; border-radius: 6px; background: none; border: none; }
.controls .seg button.on { background: var(--raised); color: var(--ink); }
.fchip {
  display: flex; align-items: center; gap: .4rem;
  font-size: .7rem; font-weight: 600; color: var(--mut);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: .36rem .7rem; cursor: pointer;
  transition: border-color .12s, color .12s;
}
.fchip:hover { color: var(--ink); border-color: var(--border-strong); }
.fchip b { color: var(--ink); font-weight: 700; }
.fchip svg { width: 13px; height: 13px; opacity: .7; }
.controls .sp { flex: 1; }
.export {
  font-size: .7rem; font-weight: 700; color: var(--mut);
  border: 1px solid var(--line); background: var(--card);
  border-radius: 8px; padding: .36rem .75rem;
  transition: color .12s, border-color .12s;
}
.export:hover { color: var(--ink); border-color: var(--border-strong); }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; margin-bottom: .9rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: .7rem .85rem; }
.tile .l { font-size: .64rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-bottom: .3rem; white-space: nowrap; }
.tile .v { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 1.35rem; font-weight: 700; line-height: 1.1; color: var(--ink); }
.tile .d { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: .64rem; margin-top: .25rem; color: var(--dim); }
.tile .d.pos { color: var(--up); }
.tile .d.neg { color: var(--warn); }

/* chart card + placeholder */
.chartcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: .75rem .9rem .5rem; margin-bottom: .9rem; }
.chartcard .ch { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .4rem; }
.chartcard .ch .t { font-size: .72rem; font-weight: 700; color: var(--mut); }
.chartcard .ch .ph { font-family: var(--mono); font-size: .58rem; font-weight: 700; letter-spacing: .08em; color: var(--dim); border: 1px dashed var(--line); border-radius: 5px; padding: .1rem .4rem; }
.chartcard .ch .lg { margin-left: auto; display: flex; gap: .9rem; font-size: .62rem; color: var(--dim); }
.chartcard .ch .lg i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: .3rem; vertical-align: baseline; }
.chart { width: 100%; height: 120px; }
.chart .bar { fill: color-mix(in srgb, var(--ledger) 55%, transparent); }
.chart .bar.b2 { fill: color-mix(in srgb, var(--signals) 45%, transparent); }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.chart text { font-family: var(--mono); font-size: 8px; fill: var(--dim); }

/* data table */
.tablecard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.tscroll { overflow-x: auto; }
.tablecard table { width: 100%; border-collapse: collapse; min-width: 780px; }
.tablecard thead th {
  position: sticky; top: 0; background: var(--raised);
  font-size: .62rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--mut); text-align: left; padding: .5rem .8rem;
  border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; white-space: nowrap;
}
.tablecard thead th:hover { color: var(--ink); }
.tablecard thead th .arr { display: inline-block; margin-left: .3rem; font-size: .6rem; color: var(--dim); opacity: 0; transition: opacity .1s; }
.tablecard thead th.sorted .arr { opacity: 1; color: var(--ledger); }
.tablecard thead th:hover .arr { opacity: .6; }
.tablecard thead th.r, .tablecard td.r { text-align: right; }
.tablecard tbody td { font-size: .76rem; color: var(--mut); padding: .46rem .8rem; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); white-space: nowrap; }
.tablecard tbody tr:last-child td { border-bottom: none; }
.tablecard tbody tr:hover td { background: color-mix(in srgb, var(--raised) 55%, transparent); }
.tablecard tbody td.k { color: var(--ink); font-weight: 600; }
.tablecard tbody td.num, .tablecard tbody td.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* pill (status chip in tables) */
.pill { display: inline-flex; align-items: center; gap: .35rem; font-family: var(--mono); font-size: .58rem; font-weight: 700; letter-spacing: .06em; border-radius: 999px; padding: .16rem .55rem; border: 1px solid; }
.pill .pd { width: 6px; height: 6px; border-radius: 50%; }
.pill.ok { color: var(--up); border-color: rgba(46, 160, 67, .4); } .pill.ok .pd { background: var(--up); }
.pill.warn { color: var(--warn); border-color: rgba(210, 153, 34, .45); } .pill.warn .pd { background: var(--warn); }
.pill.down { color: var(--down); border-color: rgba(218, 54, 51, .45); } .pill.down .pd { background: var(--down); }

.tfoot { display: flex; align-items: center; gap: 1rem; padding: .5rem .8rem; border-top: 1px solid var(--line); font-family: var(--mono); font-size: .62rem; color: var(--dim); }
.tfoot .sp { flex: 1; }
.tfoot button { font-size: .62rem; font-weight: 700; color: var(--mut); font-family: var(--mono); background: none; border: none; }
.tfoot button:hover { color: var(--ink); }

/* ===== console footer ===== */
.llc-foot { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; font-size: .68rem; color: var(--dim); border-top: 1px solid var(--line); margin-top: 1.4rem; padding-top: .8rem; }
.llc-foot .lock { display: flex; align-items: center; gap: .4rem; }
.llc-foot .lock svg { width: 11px; height: 11px; }
.llc-foot .sp { flex: 1; }
.llc-foot .mono { font-family: var(--mono); font-size: .64rem; }
