/* ═══════════════════════════════════════════════════════════════
   TPA CONTENT COMMAND CENTRE — LCARS DESIGN SYSTEM
   Version 1.0 | Palette: LCARS 2357
   ═══════════════════════════════════════════════════════════════

   USAGE
   All pages import this file, then add page-specific layout only:
     <link rel="stylesheet" href="lcars-system.css">

   CONTENTS
   1.  Design Tokens
   2.  Base
   3.  Topbar
   4.  Page Layout
   5.  LCARS Panel
   6.  Pipeline
   7.  Missions
   8.  Agents + Cooldown Rings
   9.  Operations Log
   10. Bullet Charts
   11. Score Block
   12. Metric Groups
   13. Channel Bars
   14. Source Rows
   15. Data Table
   16. Utility

   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Antonio:wght@400;700&family=Inter:wght@400;500&family=Share+Tech+Mono&display=swap');


/* ─── 1. DESIGN TOKENS ─────────────────────────────────────────── */

:root {
  /* LCARS 2357 canonical palette */
  --orange:    #FF9933;   /* neon-carrot    | primary chrome */
  --peach:     #FFCC99;   /* tanoi          | labels, primary text */
  --golden:    #FFCC66;   /* golden-tanoi   | achievement, highlights */
  --canary:    #FFFF99;   /* pale-canary    | active, healthy */
  --lilac:     #CC99CC;   /* lilac          | secondary panels */
  --blue:      #99CCFF;   /* anakiwa        | informational, data */
  --mblue:     #6688CC;   /* danub          | active data state */
  --dblue:     #3366CC;   /* mariner        | deep reference blue */
  --eggplant:  #664466;   /* eggplant       | muted, disabled */
  --red:       #CC6666;   /* chestnut-rose  | critical, urgent */
  --orpeel:    #FF9966;   /* orange-peel    | warning */
  --ltgreen:   #99CC99;   /* custom         | healthy, complete */

  /* Semantic pipeline color mapping */
  --col-seeds:   var(--orange);
  --col-briefs:  var(--lilac);
  --col-drafts:  var(--blue);
  --col-publish: var(--golden);

  /* Alert state mapping */
  --col-urgent:  var(--red);
  --col-warn:    var(--orpeel);
  --col-ok:      var(--canary);
  --col-info:    var(--blue);

  /* Base surfaces */
  --bg:          #000000;
  --bg-panel:    #0a0a0a;
  --bg-hover:    #111111;

  /* Text */
  --text:        #FFCC99;   /* peach — primary on black */
  --text-dim:    #996633;
  --text-muted:  #553322;

  /* Typography */
  --hud:   'Antonio', 'Barlow Condensed', sans-serif;
  --body:  'Inter', -apple-system, sans-serif;
  --mono:  'Share Tech Mono', monospace;

  /* LCARS geometry */
  --pill:    40px;   /* standard endcap diameter */
  --pill-sm: 28px;   /* section divider pill */
  --pill-xs: 20px;   /* metric group divider */
  --bar-h:   40px;   /* standard bar height */
  --bar-sm:  28px;
  --bar-xs:  20px;
  --gap:     4px;    /* inter-element gap */
}


/* ─── 2. BASE ──────────────────────────────────────────────────── */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 13px;
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

button { cursor: pointer; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--eggplant); border-radius: 2px; }


/* ─── 3. TOPBAR ────────────────────────────────────────────────── */

.topbar {
  height: 56px;
  background: var(--bg);
  display: flex;
  align-items: flex-end;
  padding: 0 24px 0 20px;
  gap: 0;
  /* Sticky positioning for all pages */
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: flex-end;
  gap: var(--gap);
  flex-shrink: 0;
}

.topbar-pill {
  width: var(--pill);
  height: var(--pill);
  background: var(--orange);
  border-radius: 50%;
  flex-shrink: 0;
}

.topbar-logo-bar {
  height: var(--bar-h);
  background: var(--orange);
  padding: 0 20px 0 12px;
  display: flex;
  align-items: center;
  border-radius: 0 var(--pill) var(--pill) 0;
  white-space: nowrap;
}

.topbar-logo {
  font-family: var(--hud);
  font-size: 20px;
  font-weight: 700;
  color: #000;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.topbar-nav-section {
  display: flex;
  align-items: flex-end;
  gap: var(--gap);
  margin-left: 8px;
  flex: 1;
}

.topbar-nav-bar {
  height: var(--bar-h);
  background: var(--peach);
  display: flex;
  align-items: center;
  padding: 0 4px 0 0;
  gap: 2px;
  flex: 1;
  border-radius: 0 var(--pill) var(--pill) 0;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.topbar-nav a {
  height: 32px;
  padding: 0 14px;
  font-family: var(--hud);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #000;
  text-decoration: none;
  display: flex;
  align-items: center;
  border-radius: 16px;
  transition: background 0.1s;
}
.topbar-nav a:hover { background: rgba(0,0,0,0.15); }
.topbar-nav a.active { background: var(--orange); color: #000; }
.topbar-nav a.dim { opacity: 0.4; }

.topbar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--canary);
  letter-spacing: 0.5px;
  margin-left: 12px;
  white-space: nowrap;
  align-self: flex-end;
  padding-bottom: 10px;
}

.topbar-status .status-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--canary);
  animation: lcars-blink 2.5s infinite;
}
.topbar-status.warn { color: var(--orpeel); }
.topbar-status.warn .status-pip { background: var(--orpeel); }
.topbar-status.alert { color: var(--red); }
.topbar-status.alert .status-pip { background: var(--red); }


/* ─── 4. PAGE LAYOUT ───────────────────────────────────────────── */

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 48px;
}

/* Three-column body grid — Dashboard layout */
.grid-3col {
  display: grid;
  grid-template-columns: 268px 1fr 356px;
  gap: 16px;
  align-items: start;
}

/* Two-column body grid — Queue / History layout */
.grid-2col {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: start;
}

/* Editor layout — Staging: left list, centre editor, right meta */
.grid-editor {
  display: grid;
  grid-template-columns: 300px 1fr 320px;
  gap: 0;
  height: calc(100vh - 56px);
}

/* Database layout — left sidebar, centre table, right detail */
.grid-database {
  display: grid;
  grid-template-columns: 260px 1fr 380px;
  gap: 0;
  height: calc(100vh - 56px);
}

/* Full-width single column — for tables, simple lists */
.grid-full { width: 100%; }

/* Column helpers */
.col-left  { display: flex; flex-direction: column; gap: 16px; }
.col-right { display: flex; flex-direction: column; gap: 16px; }


/* ─── 5. LCARS PANEL ───────────────────────────────────────────── */
/*  The core building block. Every card/section uses this pattern:
    [pill endcap] + [colored bar with title] + [black content area]
    ──────────────────────────────────────────────────────────────
    Usage:
      <div class="lcars-panel">
        <div class="panel-chrome">
          <div class="panel-pill" style="background:var(--orange)"></div>
          <div class="panel-bar" style="background:var(--orange)">
            <span class="panel-title">Section Name</span>
            <span class="panel-badge">meta</span>
          </div>
        </div>
        <div class="panel-content">...</div>
      </div>
*/

.lcars-panel { margin-bottom: 16px; }
.lcars-panel:last-child { margin-bottom: 0; }

.panel-chrome {
  display: flex;
  align-items: center;
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.panel-pill {
  width: var(--pill);
  height: var(--pill);
  border-radius: 50%;
  flex-shrink: 0;
}

.panel-bar {
  flex: 1;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 12px;
  border-radius: 0 20px 20px 0;
}

.panel-title {
  font-family: var(--hud);
  font-size: 18px;
  font-weight: 700;
  color: #000;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.panel-badge {
  font-family: var(--hud);
  font-size: 13px;
  font-weight: 700;
  color: rgba(0,0,0,0.55);
  letter-spacing: 1px;
}

.panel-action {
  font-family: var(--hud);
  font-size: 13px;
  font-weight: 700;
  color: rgba(0,0,0,0.65);
  background: none;
  border: none;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: color 0.1s;
}
.panel-action:hover { color: #000; }

.panel-content {
  background: var(--bg-panel);
}

/* Section divider — small LCARS bar within a panel */
.section-divider {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 8px 0 4px;
}
.section-divider-pill {
  width: var(--pill-sm);
  height: var(--pill-sm);
  border-radius: 50%;
  flex-shrink: 0;
}
.section-divider-bar {
  flex: 1;
  height: var(--bar-sm);
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 0 14px 14px 0;
}
.section-divider-label {
  font-family: var(--hud);
  font-size: 13px;
  font-weight: 700;
  color: rgba(0,0,0,0.65);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Metric group divider — smallest LCARS bar, used inside Objectives */
.metric-group {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 8px 16px 4px;
  background: var(--bg-panel);
}
.metric-group-pip {
  width: var(--pill-xs);
  height: var(--pill-xs);
  border-radius: 50%;
  flex-shrink: 0;
}
.metric-group-bar {
  flex: 1;
  height: var(--bar-xs);
  border-radius: 0 10px 10px 0;
  display: flex;
  align-items: center;
  padding: 0 10px;
}
.metric-group-label {
  font-family: var(--hud);
  font-size: 11px;
  font-weight: 700;
  color: rgba(0,0,0,0.6);
  letter-spacing: 2px;
  text-transform: uppercase;
}


/* ─── 6. PIPELINE ──────────────────────────────────────────────── */
/*
    Pipeline stages sit inside a CSS grid in the page template:
    grid-template-columns: 1fr 44px 1fr 44px 1fr 44px 1fr
*/

.stage-chrome {
  display: flex;
  align-items: center;
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.stage-endcap {
  width: var(--pill);
  height: var(--pill);
  border-radius: 50%;
  flex-shrink: 0;
}
.stage-bar {
  flex: 1;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 0 10px;
  border-radius: 0 20px 20px 0;
  cursor: pointer;
  transition: filter 0.15s;
}
.stage-bar:hover { filter: brightness(1.1); }
.stage-name {
  font-family: var(--hud);
  font-size: 16px;
  font-weight: 700;
  color: #000;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.stage-alert-tag {
  font-family: var(--hud);
  font-size: 10px;
  font-weight: 700;
  background: rgba(0,0,0,0.22);
  color: #000;
  padding: 1px 6px;
  border-radius: 8px;
  letter-spacing: 1px;
}
.stage-body {
  background: var(--bg-panel);
  padding: 14px 16px 12px;
}
.stage-count {
  font-family: var(--mono);
  font-size: 36px;
  line-height: 1;
  margin-bottom: 10px;
  letter-spacing: -1px;
}

/* Divided status bar — proportional segment fill */
.div-bar {
  height: 8px;
  display: flex;
  gap: 2px;
  background: #1a1a1a;
  margin-bottom: 8px;
}
.div-seg { height: 100%; }
.seg-unprocessed { background: var(--red); }
.seg-processed   { background: var(--ltgreen); }
.seg-ready       { background: var(--blue); }
.seg-staged      { background: var(--golden); }
.seg-draft       { background: var(--orpeel); }
.seg-empty       { background: #1a1a1a; }

.stage-breakdown {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
/* Stage breakdown text colors */
.bd-red   { color: var(--red); }
.bd-green { color: var(--ltgreen); }
.bd-blue  { color: var(--blue); }
.bd-gold  { color: var(--golden); }
.bd-amber { color: var(--orpeel); }
.bd-muted { color: var(--text-dim); }

/* Pipeline connector */
.connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding-top: 8px;
}
.connector-arrow { font-family: var(--mono); font-size: 16px; color: var(--peach); }
.connector-rate  { font-family: var(--mono); font-size: 9px; color: var(--text-dim); }
.connector-rate.warn { color: var(--red); }
.connector-rate.zero { color: var(--text-muted); opacity: 0.5; }


/* ─── 7. MISSIONS ──────────────────────────────────────────────── */

.mission {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #1a1a1a;
  cursor: pointer;
  transition: background 0.1s;
}
.mission:last-child { border-bottom: none; }
.mission:hover { background: var(--bg-hover); }

.mission-indicator {
  width: 12px;
  align-self: stretch;
  flex-shrink: 0;
  border-radius: 6px;
  min-height: 40px;
}
.ind-red   { background: var(--red); }
.ind-amber { background: var(--orpeel); }
.ind-blue  { background: var(--blue); }

.mission-body { flex: 1; }

.mission-tier {
  font-family: var(--hud);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.tier-red   { color: var(--red); }
.tier-amber { color: var(--orpeel); }
.tier-blue  { color: var(--blue); }

.mission-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}
.mission-desc {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
}

.mission-cta {
  font-family: var(--hud);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 5px 12px;
  background: var(--orpeel);
  color: #000;
  border: none;
  border-radius: 12px;
  flex-shrink: 0;
  margin-top: 1px;
  white-space: nowrap;
  transition: filter 0.1s;
}
.mission-cta:hover { filter: brightness(1.1); }
.mission-cta.primary { background: var(--red); color: #fff; }
.mission-cta.info    { background: var(--blue); color: #000; }


/* ─── 8. AGENTS + COOLDOWN RINGS ───────────────────────────────── */

.agent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid #1a1a1a;
  transition: background 0.1s;
  cursor: pointer;
}
.agent-row:last-child { border-bottom: none; }
.agent-row:hover { background: var(--bg-hover); }

/* Cooldown ring — SVG-based, keep exact dimensions
   SVG template:
   <svg width="32" height="32" viewBox="0 0 32 32">
     <circle class="ring-bg" cx="16" cy="16" r="12"/>
     <circle class="ring-fill [rf-active|rf-cooldown|rf-error]"
       cx="16" cy="16" r="12"
       stroke-dasharray="75.4" stroke-dashoffset="[remaining]"/>
   </svg>
   For active: stroke-dasharray="6 3" (no stroke-dashoffset)
   Circumference at r=12: 75.4px
   dashoffset = circumference × (1 - elapsed/cycle)
*/
.ring-wrap {
  position: relative;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.ring-wrap svg { transform: rotate(-90deg); }
.ring-bg   { fill: none; stroke: #1a1a1a; stroke-width: 2.5; }
.ring-fill { fill: none; stroke-width: 2.5; stroke-linecap: round; }

.rf-active   { stroke: var(--canary); stroke-dasharray: 6 3; animation: lcars-spin 1.8s linear infinite; }
.rf-cooldown { stroke: var(--orange); }
.rf-error    { stroke: var(--red); stroke-dasharray: 5 3; animation: lcars-blink 1.2s ease-in-out infinite; }

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 8px;
}

.agent-info { flex: 1; }
.agent-name {
  font-family: var(--hud);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 1px;
}
.agent-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
}

.agent-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

/* LCARS pill badge — solid colored, black text */
.lcars-badge {
  font-family: var(--hud);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #000;
  padding: 2px 10px;
  border-radius: 10px;
}
.badge-canary  { background: var(--canary); }
.badge-orange  { background: var(--orange); }
.badge-red     { background: var(--red); color: #fff; }
.badge-blue    { background: var(--blue); }
.badge-golden  { background: var(--golden); }
.badge-lilac   { background: var(--lilac); }
.badge-ltgreen { background: var(--ltgreen); }

.agent-output { font-family: var(--mono); font-size: 10px; color: var(--text-dim); }

.trigger-btn {
  font-family: var(--hud);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 10px;
  background: #222;
  color: var(--peach);
  border: none;
  border-radius: 10px;
  transition: background 0.1s;
}
.trigger-btn:hover { background: var(--eggplant); color: var(--lilac); }


/* ─── 9. OPERATIONS LOG ────────────────────────────────────────── */

.log-body {
  padding: 4px 0;
  overflow-y: auto;
}

.log-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 16px;
  transition: background 0.1s;
}
.log-row:hover { background: var(--bg-hover); }

.log-time {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 1px;
  width: 32px;
  flex-shrink: 0;
}

/* LCARS pill tags — solid colored, black text */
.log-tag {
  font-family: var(--hud);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #000;
  padding: 1px 8px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.lt-seed  { background: var(--orange); }
.lt-brief { background: var(--lilac); }
.lt-draft { background: var(--blue); }
.lt-stage { background: var(--golden); }
.lt-pub   { background: var(--ltgreen); }
.lt-sys   { background: var(--eggplant); color: var(--lilac); }

.log-text {
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
  flex: 1;
}
.log-text strong { color: var(--peach); font-weight: 500; }
.log-text a { color: var(--blue); }


/* ─── 10. BULLET CHARTS ────────────────────────────────────────── */
/*
   Zone mapping (% of track, track-max = 120% of target):
   Poor zone:    0–50%   (= 0–60% of target)
   Sat zone:     50–67%  (= 60–80% of target)
   Good zone:    67–83%  (= 80–100% of target)
   Exceeds zone: 83–100% (= 100–120% of target)
   Target marker: always at 83.3% of track width

   Fill width calculation:
   fill% = (actual / (target × 1.2)) × 100

   Score key:
   0 = actual < 60% of target   → bf-poor  / bs-0
   1 = actual 60–79% of target  → bf-sat   / bs-1
   2 = actual 80–99% of target  → bf-good  / bs-2
   3 = actual ≥ 100% of target  → bf-over  / bs-3 (muted)
*/

.bullet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid #111;
  background: var(--bg-panel);
  transition: background 0.1s;
}
.bullet-row:hover { background: var(--bg-hover); }

.bullet-name {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  width: 90px;
  flex-shrink: 0;
  line-height: 1.3;
}

.bullet-chart {
  flex: 1;
  position: relative;
  height: 18px;
  display: flex;
  align-items: center;
  min-width: 80px;
}

/* Zone bands — very subtle solid fills */
.bullet-zones { position: absolute; inset: 0; display: flex; }
.bz-poor { background: rgba(204,102,102,0.12); }
.bz-sat  { background: rgba(255,153,102,0.10); }
.bz-good { background: rgba(153,204,153,0.10); }
.bz-over { background: rgba(255,204,102,0.06); }

/* Actual value fill bar */
.bullet-fill {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 9px;
  z-index: 2;
  transition: width 0.4s ease;
}
.bf-over { background: var(--text-dim); opacity: 0.6; }  /* done/at-target — muted */
.bf-good { background: var(--blue); }
.bf-sat  { background: var(--orpeel); }
.bf-poor { background: var(--red); }
.bf-zero { width: 2px !important; background: var(--red); opacity: 0.5; }

/* Target marker line */
.bullet-target {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--peach);
  opacity: 0.8;
  z-index: 3;
}

/* Value display */
.bullet-vals {
  font-family: var(--mono);
  font-size: 10px;
  display: flex;
  align-items: baseline;
  gap: 2px;
  width: 62px;
  flex-shrink: 0;
  justify-content: flex-end;
}
.bv-actual { font-size: 12px; }
.bv-actual.s3 { color: var(--text-dim); }
.bv-actual.s2 { color: var(--blue); }
.bv-actual.s1 { color: var(--orpeel); }
.bv-actual.s0 { color: var(--red); }
.bv-sep    { color: var(--text-muted); }
.bv-target { color: var(--text-muted); }

/* Score digit */
.bullet-score {
  font-family: var(--hud);
  font-size: 13px;
  font-weight: 700;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}
.bs-3 { color: var(--canary); }
.bs-2 { color: var(--blue); }
.bs-1 { color: var(--orpeel); }
.bs-0 { color: var(--red); }

/* Non-standard metric (binary or reversed-direction) */
.status-metric-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid #111;
  background: var(--bg-panel);
  transition: background 0.1s;
}
.status-metric-row:hover { background: var(--bg-hover); }
.smr-name {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  width: 90px;
  flex-shrink: 0;
  line-height: 1.3;
}
.smr-status {
  flex: 1;
  font-family: var(--hud);
  font-size: 12px;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.smr-note {
  font-family: var(--body);
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 400;
  letter-spacing: 0;
}
.smr-vals {
  font-family: var(--mono);
  font-size: 10px;
  width: 62px;
  flex-shrink: 0;
  text-align: right;
  color: var(--text-dim);
}
.smr-score {
  font-family: var(--hud);
  font-size: 13px;
  font-weight: 700;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  color: var(--red);
}
.no-border { border-bottom: none !important; }


/* ─── 11. SCORE BLOCK ──────────────────────────────────────────── */

.score-block { padding: 14px 16px 12px; background: var(--bg-panel); }
.score-wk-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.score-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 10px;
}
.score-num {
  font-family: var(--hud);
  font-size: 48px;
  font-weight: 700;
  color: var(--orange);
  line-height: 1;
  letter-spacing: -2px;
}
.score-denom {
  font-family: var(--hud);
  font-size: 20px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.score-rank {
  margin-left: auto;
  margin-bottom: 3px;
  font-family: var(--hud);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 4px 14px;
  border-radius: 20px;
  background: var(--orange);
  color: #000;
}
.score-bar-track {
  height: 8px;
  background: #1a1a1a;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.score-bar-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 4px;
}
.score-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.score-rank-note {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
}
.score-sparkline-wrap { display: flex; align-items: center; gap: 8px; }
.score-delta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--canary);
  font-weight: 500;
}

/* Sparkline — render as inline SVG:
   <svg width="76" height="20" viewBox="0 0 76 20" overflow="visible">
     <path d="..." fill="rgba(255,153,51,0.1)"/>
     <polyline points="..." fill="none" stroke="#FF9933" stroke-width="1.5"
       stroke-linecap="round" stroke-linejoin="round"/>
     <circle cx="..." cy="..." r="2" fill="#553322"/>  (past points, muted)
     <circle cx="..." cy="..." r="2.5" fill="#FF9933"/> (current point)
   </svg>
   Y = 2 + (24 - score) / 24 × 16
   X: 4 data points evenly at x=4, 28, 52, 72
*/


/* ─── 12. CHANNEL BARS ─────────────────────────────────────────── */

.channel-list { padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg-panel); }
.ch-row { display: flex; align-items: center; gap: 10px; }
.ch-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ch-name { font-family: var(--mono); font-size: 11px; color: var(--text); width: 76px; }
.ch-track { flex: 1; height: 8px; background: #1a1a1a; }
.ch-bar { height: 100%; }
.ch-count { font-family: var(--hud); font-size: 16px; font-weight: 700; color: var(--peach); width: 20px; text-align: right; }


/* ─── 13. SOURCE ROWS ──────────────────────────────────────────── */

.source-list { padding: 10px 16px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--bg-panel); }
.src-row { display: flex; align-items: center; gap: 10px; }
.src-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--canary); flex-shrink: 0;
  animation: lcars-blink 3s infinite;
}
.src-dot.warn { background: var(--orpeel); }
.src-dot.error { background: var(--red); animation: none; }
.src-name { font-size: 12px; color: var(--text); flex: 1; }
.src-time { font-family: var(--mono); font-size: 11px; color: var(--canary); }


/* ─── 14. DATA TABLE ───────────────────────────────────────────── */
/*  Used in Database and Queue/History pages */

.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table thead { position: sticky; top: 0; z-index: 10; }
.data-table th {
  background: #111;
  border-bottom: 2px solid var(--eggplant);
  padding: 10px 14px;
  text-align: left;
  font-family: var(--hud);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.data-table th:hover { color: var(--peach); }
.data-table th.sorted { color: var(--orange); border-bottom-color: var(--orange); }
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #1a1a1a;
  color: var(--text-dim);
  vertical-align: top;
}
.data-table tr { cursor: pointer; transition: background 0.1s; }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr.selected { background: #111; border-left: 3px solid var(--orange); }

/* Table cell variants */
.cell-title { font-weight: 500; color: var(--text); }
.cell-meta  { font-family: var(--mono); font-size: 10px; color: var(--text-muted); }
.cell-link  { color: var(--blue); }
.cell-date  { font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.cell-score { display: flex; align-items: center; gap: 6px; }
.cell-score-bar { width: 40px; height: 4px; background: #1a1a1a; border-radius: 2px; overflow: hidden; }
.cell-score-fill { height: 100%; border-radius: 2px; }
.cell-score-fill.high { background: var(--ltgreen); }
.cell-score-fill.mid  { background: var(--orpeel); }
.cell-score-fill.low  { background: var(--red); }


/* ─── 15. STATUS + CHANNEL BADGES ──────────────────────────────── */

.status-badge {
  font-family: var(--hud);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 8px;
  color: #000;
}
.status-new        { background: var(--blue); }
.status-processed  { background: var(--ltgreen); }
.status-ready      { background: var(--blue); }
.status-staged     { background: var(--golden); }
.status-draft      { background: var(--orpeel); }
.status-published  { background: var(--ltgreen); }
.status-rejected   { background: var(--red); color: #fff; }
.status-editing    { background: var(--lilac); }

.channel-badge {
  font-family: var(--hud);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 6px;
  color: #000;
}
.channel-blog       { background: var(--blue); }
.channel-newsletter { background: var(--lilac); }
.channel-social     { background: var(--canary); }
.channel-video      { background: var(--orange); }


/* ─── 16. UTILITY ──────────────────────────────────────────────── */

/* Scrollable containers */
.scroll-y { overflow-y: auto; }
.scroll-x { overflow-x: auto; }

/* Divider */
.lcars-divider { height: 1px; background: #1a1a1a; margin: 0; }
.lcars-divider-heavy { height: 2px; background: var(--eggplant); }

/* Animations */
@keyframes lcars-blink { 0%,100%{opacity:1} 50%{opacity:.2} }
@keyframes lcars-spin  { from{stroke-dashoffset:0} to{stroke-dashoffset:-27} }

/* Visibility helpers */
.hide { display: none !important; }
.mono { font-family: var(--mono); }
.hud  { font-family: var(--hud); }

/* Color text utilities */
.c-orange   { color: var(--orange); }
.c-peach    { color: var(--peach); }
.c-golden   { color: var(--golden); }
.c-canary   { color: var(--canary); }
.c-lilac    { color: var(--lilac); }
.c-blue     { color: var(--blue); }
.c-red      { color: var(--red); }
.c-orpeel   { color: var(--orpeel); }
.c-ltgreen  { color: var(--ltgreen); }
.c-dim      { color: var(--text-dim); }
.c-muted    { color: var(--text-muted); }

/* Background utilities */
.bg-panel { background: var(--bg-panel); }
.bg-hover { background: var(--bg-hover); }


/* ─── 17. DATABASE PAGE ───────────────────────────────────────── */

.grid-database { overflow: hidden; }
.grid-database > * { overflow-y: auto; min-width: 0; }

.db-left {
  display: flex; flex-direction: column;
  border-right: 1px solid #1a1a1a;
}
.db-left-header { padding: 14px 16px 12px; }

.db-search {
  display: flex; align-items: center;
  background: var(--bg-panel); border: 1px solid #1a1a1a;
  padding: 0 10px; height: 34px; gap: 8px; margin-top: 10px;
}
.db-search svg { color: var(--text-muted); flex-shrink: 0; }
.db-search input {
  border: none; background: none; color: var(--text);
  font-family: var(--mono); font-size: 12px; width: 100%; outline: none;
}
.db-search input::placeholder { color: var(--text-muted); }
.db-search-shortcut {
  font-family: var(--mono); font-size: 9px; color: var(--text-muted);
  background: #111; border: 1px solid #1a1a1a; padding: 1px 5px; white-space: nowrap;
}

.table-tabs { display: flex; flex-direction: column; gap: 2px; padding: 12px 12px 8px; }
.table-tab {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; cursor: pointer;
  border: none; background: none; text-align: left; width: 100%;
  border-left: 3px solid transparent; transition: background 0.1s;
}
.table-tab:hover { background: var(--bg-hover); }
.table-tab.active { border-left-color: var(--orange); background: var(--bg-hover); }
.table-tab-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--hud); font-size: 12px; font-weight: 700;
  color: #000; flex-shrink: 0;
}
.table-tab-icon.seeds  { background: var(--orange); }
.table-tab-icon.briefs { background: var(--lilac); }
.table-tab-icon.drafts { background: var(--blue); }
.table-tab-info { flex: 1; }
.table-tab-name {
  font-family: var(--hud); font-size: 13px; font-weight: 700;
  color: var(--text); letter-spacing: 1px; text-transform: uppercase;
}
.table-tab-count { font-family: var(--mono); font-size: 10px; color: var(--text-dim); }
.table-tab-badge {
  font-family: var(--mono); font-size: 10px; color: var(--text-muted);
  padding: 2px 7px; background: #111; border-radius: 10px;
}

.filters-section {
  padding: 12px 16px; flex: 1; overflow-y: auto;
  border-top: 1px solid #1a1a1a;
}
.filter-group { margin-bottom: 16px; }
.filter-group-title {
  font-family: var(--mono); font-size: 9px; text-transform: uppercase;
  letter-spacing: 2px; color: var(--text-muted); margin-bottom: 8px;
}
.filter-option {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; cursor: pointer; font-size: 12px; color: var(--text-dim);
}
.filter-option:hover { color: var(--text); }
.filter-option input[type="checkbox"] { accent-color: var(--orange); width: 14px; height: 14px; flex-shrink: 0; }
.filter-count { font-family: var(--mono); font-size: 10px; color: var(--text-muted); margin-left: auto; }

.filter-date-row { display: flex; gap: 6px; align-items: center; }
.filter-date-input {
  flex: 1; padding: 5px 8px;
  background: var(--bg-panel); border: 1px solid #1a1a1a;
  color: var(--text-dim); font-family: var(--mono); font-size: 11px; outline: none;
}
.filter-date-sep { color: var(--text-muted); font-size: 11px; }

.filter-actions {
  display: flex; gap: 6px; padding: 12px 16px;
  border-top: 1px solid #1a1a1a;
}
.filter-btn {
  flex: 1; padding: 7px; font-size: 11.5px; font-weight: 500;
  cursor: pointer; text-align: center; transition: all 0.15s;
}
.filter-btn-apply {
  background: var(--orange); color: #000; font-family: var(--hud);
  border: none; letter-spacing: 1px; text-transform: uppercase;
}
.filter-btn-clear {
  background: none; border: 1px solid #1a1a1a;
  color: var(--text-dim); font-family: var(--hud);
  letter-spacing: 1px; text-transform: uppercase;
}

.db-centre { display: flex; flex-direction: column; min-width: 0; }
.results-toolbar {
  display: flex; align-items: center; padding: 10px 20px;
  border-bottom: 1px solid #1a1a1a; background: var(--bg-panel);
  gap: 12px; font-family: var(--mono); font-size: 11px; color: var(--text-dim);
}
.results-toolbar strong { color: var(--text); }
.results-sort { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.results-sort label { font-family: var(--mono); font-size: 10px; color: var(--text-muted); }
.results-sort select {
  background: var(--bg-panel); border: 1px solid #1a1a1a;
  color: var(--text); font-family: var(--mono); font-size: 11px;
  padding: 4px 8px; outline: none;
}

.data-table-wrap { flex: 1; overflow: auto; }

.cell-headline {
  font-weight: 500; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4;
}
.cell-snippet {
  font-size: 11.5px; color: var(--text-dim);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  line-height: 1.4; max-width: 400px;
}
.cell-url {
  font-size: 11px; color: var(--blue); text-decoration: none;
  word-break: break-all;
  display: -webkit-box; -webkit-line-clamp: 1;
  -webkit-box-orient: vertical; overflow: hidden;
}

.domain-badge {
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  padding: 2px 6px; background: #111; color: var(--text-dim);
  border: 1px solid #1a1a1a; display: inline-block; margin: 1px 2px;
}

.highlight { background: rgba(255,153,51,0.15); color: var(--orange); padding: 0 2px; }

.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; border-top: 1px solid #1a1a1a; background: var(--bg-panel);
}
.pagination-info { font-family: var(--mono); font-size: 10px; color: var(--text-muted); }
.pagination-controls { display: flex; gap: 4px; }
.pagination-btn {
  width: 28px; height: 28px;
  border: 1px solid #1a1a1a; background: none;
  color: var(--text-dim); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  transition: all 0.15s;
}
.pagination-btn:hover { border-color: var(--orange); color: var(--orange); }
.pagination-btn.active {
  background: rgba(255,153,51,0.08); border: 1px solid var(--orange); color: var(--orange);
}
.pagination-btn.disabled { opacity: 0.3; cursor: default; }
.per-page { display: flex; align-items: center; gap: 6px; }
.per-page label { font-family: var(--mono); font-size: 10px; color: var(--text-muted); }
.per-page select {
  background: var(--bg-panel); border: 1px solid #1a1a1a;
  color: var(--text-dim); font-family: var(--mono); font-size: 11px;
  padding: 3px 6px; outline: none;
}

.db-right {
  display: flex; flex-direction: column;
  border-left: 1px solid #1a1a1a; overflow-y: auto;
}

.detail-header {
  padding: 16px 18px; border-bottom: 1px solid #1a1a1a;
  display: flex; align-items: flex-start; justify-content: space-between;
}
.detail-type-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.detail-type-icon {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--hud); font-size: 11px; font-weight: 700; color: #000;
}
.detail-type-label {
  font-family: var(--mono); font-size: 9px; text-transform: uppercase;
  letter-spacing: 2px; color: var(--text-muted);
}
.detail-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  line-height: 1.3; margin-bottom: 8px;
}
.detail-meta-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.detail-close {
  width: 24px; height: 24px; border: none;
  background: #111; color: var(--text-muted);
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; font-size: 14px; flex-shrink: 0;
}
.detail-close:hover { color: var(--text); }

.detail-actions {
  display: flex; gap: 6px; padding: 14px 18px; border-bottom: 1px solid #1a1a1a;
}
.detail-action-btn {
  flex: 1; padding: 7px 12px; font-size: 11.5px; font-weight: 500;
  cursor: pointer; text-align: center; transition: all 0.15s;
}
.detail-action-btn.primary {
  background: var(--orange); color: #000; font-family: var(--hud);
  border: none; letter-spacing: 1px; text-transform: uppercase;
}
.detail-action-btn.secondary {
  border: 1px solid #1a1a1a; background: none;
  color: var(--text-dim); font-family: var(--hud);
  letter-spacing: 1px; text-transform: uppercase;
}

.detail-section { padding: 14px 18px; border-bottom: 1px solid #1a1a1a; }
.detail-section-title {
  font-family: var(--mono); font-size: 9px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px;
}
.detail-field { margin-bottom: 10px; }
.detail-label { font-family: var(--mono); font-size: 10px; color: var(--text-dim); margin-bottom: 3px; }
.detail-value { font-size: 12.5px; color: var(--text); line-height: 1.5; }

.linked-record {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: var(--bg-panel); border: 1px solid #1a1a1a;
  cursor: pointer; margin-bottom: 4px; transition: all 0.15s;
}
.linked-record:hover { background: var(--bg-hover); }
.linked-icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--hud); font-size: 10px; font-weight: 700;
  color: #000; flex-shrink: 0;
}
.linked-icon.seed  { background: var(--orange); }
.linked-icon.brief { background: var(--lilac); }
.linked-icon.draft { background: var(--blue); }
.linked-info { flex: 1; min-width: 0; }
.linked-name {
  font-size: 11.5px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.linked-meta { font-family: var(--mono); font-size: 10px; color: var(--text-muted); }
.linked-arrow { color: var(--text-muted); font-size: 12px; }

.prov-chain { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11px; }
.prov-step {
  padding: 3px 8px; font-family: var(--hud); font-size: 10px;
  font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #000;
}
.prov-arrow { color: var(--text-muted); font-family: var(--mono); }
.prov-inactive { background: #111; color: var(--text-muted); }

.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 48px 32px;
  color: var(--text-muted); text-align: center;
}
.empty-state-icon { font-size: 32px; margin-bottom: 12px; opacity: 0.4; }
.empty-state-text { font-size: 13px; max-width: 240px; }
