/* =============================================================
   ARGUS · DESK dashboard shell (J-LAB / C-LAB)
   App-shell layout: left rail · topbar · view area.
   Tactical palette + Space Grotesk / IBM Plex Mono.
   Theme accent set per desk via --accent / --accent-h.
   ============================================================= */
:root {
  --bg:        oklch(0.135 0.008 240);
  --bg-2:      oklch(0.175 0.010 240);
  --bg-3:      oklch(0.215 0.012 240);
  --rail-bg:   oklch(0.165 0.010 240);
  --line:      oklch(0.30 0.012 240);
  --line-soft: oklch(0.23 0.010 240);
  --fg:        oklch(0.96 0.010 85);
  --fg-2:      oklch(0.82 0.012 85);
  --mid:       oklch(0.62 0.010 240);
  --dim:       oklch(0.48 0.010 240);
  --accent:    oklch(0.83 0.13 178);
  --accent-2:  oklch(0.91 0.08 178);
  --accent-h:  178;
  --accent-glow: oklch(0.83 0.13 var(--accent-h) / 0.28);
  --accent-soft: oklch(0.83 0.13 var(--accent-h) / 0.12);

  /* semafor accents, semantic state only */
  --sem-view:     oklch(70% 0.13 240);
  --sem-facts:    oklch(82% 0.14 90);
  --sem-scene:    oklch(64% 0.18 25);
  --sem-global:   oklch(70% 0.13 150);
  --sem-analysis: oklch(68% 0.14 310);

  --rail: 248px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body.desk {
  height: 100vh; height: 100dvh; overflow: hidden;
  background: var(--bg); color: var(--fg);
  font-family: "Space Grotesk", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  display: grid; grid-template-columns: var(--rail) 1fr; grid-template-rows: 1fr;
}
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; letter-spacing: 0.04em; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 3px solid var(--bg); }

/* ============================ RAIL ============================ */
.rail {
  background: var(--rail-bg); border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column; min-height: 0; position: relative; z-index: 3;
}
.rail-brand {
  display: flex; align-items: center; gap: 11px; padding: 18px 20px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.rail-brand .mk { width: 30px; height: 30px; border: 1px solid var(--accent); border-radius: 6px; display: grid; place-items: center; color: var(--accent); flex: 0 0 auto; }
.rail-brand .mk svg { width: 17px; height: 17px; }
.rail-brand .wm { display: flex; flex-direction: column; gap: 1px; line-height: 1; }
.rail-brand .wm b { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.rail-brand .wm b .ac { color: var(--accent); }
.rail-brand .wm span { font-family: "IBM Plex Mono", monospace; font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }

.rail-scroll { flex: 1 1 auto; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.nav-label {
  font-family: "IBM Plex Mono", monospace; font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--dim); padding: 14px 12px 7px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 6px;
  color: var(--fg-2); cursor: pointer; font-size: 14px; position: relative;
  transition: background .15s, color .15s; border: 1px solid transparent;
}
.nav-item svg { width: 18px; height: 18px; color: var(--mid); transition: color .15s; flex: 0 0 auto; }
.nav-item .badge { margin-left: auto; font-family: "IBM Plex Mono", monospace; font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.nav-item:hover { background: var(--bg-2); color: var(--fg); }
.nav-item:hover svg { color: var(--fg-2); }
.nav-item.active { background: var(--accent-soft); color: var(--fg); border-color: oklch(0.83 0.13 var(--accent-h) / 0.4); }
.nav-item.active svg { color: var(--accent); }
.nav-item.active::before { content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item.live .badge { color: var(--accent); display: inline-flex; align-items: center; gap: 5px; }
.nav-item.live .badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 7px var(--accent); }
.nav-item.soon { opacity: 0.75; }

.rail-foot { border-top: 1px solid var(--line-soft); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.rail-status {
  font-family: "IBM Plex Mono", monospace; font-size: 10.5px; letter-spacing: 0.1em; color: var(--mid);
  display: flex; align-items: center; gap: 8px;
}
.rail-status .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: 0.3 } }
.rail-up { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--mid); padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; transition: border-color .15s, color .15s; }
.rail-up svg { width: 15px; height: 15px; }
.rail-up:hover { border-color: var(--accent); color: var(--accent); }

/* ============================ MAIN COLUMN ============================ */
.col { display: grid; grid-template-rows: auto 1fr; min-height: 0; min-width: 0; }

.topbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 0 26px; height: 60px; border-bottom: 1px solid var(--line-soft);
  font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--mid);
  background: oklch(0.15 0.008 240 / 0.6); backdrop-filter: blur(6px);
}
.crumb { display: inline-flex; align-items: center; gap: 9px; letter-spacing: 0.06em; }
.crumb .sep { color: var(--dim); }
.crumb .cur { color: var(--fg); text-transform: uppercase; letter-spacing: 0.1em; }
.topbar .spacer { flex: 1 1 auto; }
.topbar .clock { color: var(--mid); }
.topbar .tb-status { display: inline-flex; align-items: center; gap: 7px; color: var(--accent); letter-spacing: 0.1em; text-transform: uppercase; font-size: 11px; }
.topbar .tb-status .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: pulse 1.6s ease-in-out infinite; }

.viewport { overflow-y: auto; min-height: 0; position: relative; }
.viewport::before {
  content: ''; position: fixed; inset: 0 0 0 var(--rail); pointer-events: none; z-index: 0; opacity: 0.5;
  background:
    radial-gradient(ellipse 60% 50% at 80% 0%, var(--accent-glow), transparent 60%),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: auto, 70px 70px, 70px 70px;
  -webkit-mask-image: linear-gradient(black, black);
}
.view { position: relative; z-index: 1; padding: 30px 32px 56px; max-width: 1180px; }
.view[hidden] { display: none; }

/* view entrance, CSS-only fade, no fill so content is always visible */
.view:not([hidden]) { animation: viewIn .45s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============================ HEADINGS ============================ */
.view-eyebrow { font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); display: inline-flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.view-eyebrow svg { width: 14px; height: 14px; }
.view-title { font-size: clamp(28px, 3.4vw, 44px); font-weight: 700; letter-spacing: -0.025em; line-height: 1.02; margin: 0 0 12px; text-wrap: balance; }
.view-title .ac { color: var(--accent); }
.view-lead { font-size: clamp(15px, 1.5vw, 17px); line-height: 1.55; color: var(--fg-2); max-width: 62ch; margin: 0; text-wrap: pretty; }
.section-h { display: flex; align-items: center; gap: 12px; margin: 34px 0 16px; }
.section-h h2 { font-size: 14px; font-family: "IBM Plex Mono", monospace; letter-spacing: 0.14em; text-transform: uppercase; color: var(--mid); margin: 0; font-weight: 500; }
.section-h .ln { flex: 1; height: 1px; background: var(--line-soft); }
.section-h .more { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--dim); }

/* ============================ DASHBOARD HUB ============================ */
.hub-top { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: stretch; }
@media (max-width: 1000px) { .hub-top { grid-template-columns: 1fr; } }

.modules { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.module {
  position: relative; border: 1px solid var(--line); background: var(--bg-2); border-radius: 8px;
  padding: 18px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; overflow: hidden;
  transition: border-color .2s, transform .2s var(--ease); min-height: 132px;
}
.module::after { content: ''; position: absolute; inset: 0; background: radial-gradient(220px circle at var(--mx,80%) var(--my,0%), var(--accent-soft), transparent 60%); opacity: 0; transition: opacity .25s; }
.module:hover { border-color: var(--accent); transform: translateY(-3px); }
.module:hover::after { opacity: 1; }
.module .mi { width: 26px; height: 26px; color: var(--accent); }
.module h3 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.module p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--fg-2); }
.module .tag { position: absolute; top: 16px; right: 16px; font-family: "IBM Plex Mono", monospace; font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); border: 1px solid var(--line); padding: 2px 6px; border-radius: 3px; }
.module .go { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--accent); }

/* signal widget */
.signal { border: 1px solid var(--line); background: var(--bg-2); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.signal-h { display: flex; align-items: center; justify-content: space-between; font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--mid); }
.signal-h .v { color: var(--accent); }
.signal .radar { width: 100%; max-width: 230px; aspect-ratio: 1; margin: 2px auto; position: relative; }
.signal .radar svg { width: 100%; height: 100%; display: block; }
.signal .radar-sweep { position: absolute; inset: 0; animation: spin 6s linear infinite; transform-origin: 50% 50%; }
.signal .radar-sweep::before { content: ''; position: absolute; left: 50%; top: 6%; width: 2px; height: 44%; background: linear-gradient(to top, var(--accent), transparent); transform: translateX(-50%); box-shadow: 0 0 12px var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* stat strip */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } .modules { grid-template-columns: 1fr; } }
.stat { border: 1px solid var(--line); background: var(--bg-2); border-radius: 8px; padding: 15px 16px; }
.stat .n { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.stat .n .u { font-size: 14px; color: var(--mid); font-weight: 500; }
.stat .l { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); margin-top: 7px; }

/* tool tiles */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .tiles { grid-template-columns: 1fr; } }
.tile {
  position: relative; border: 1px solid var(--line); background: var(--bg-2); border-radius: 8px;
  padding: 17px; display: flex; flex-direction: column; gap: 9px; overflow: hidden;
  transition: border-color .2s, transform .2s var(--ease);
}
.tile.live:hover { border-color: var(--accent); transform: translateY(-3px); }
.tile.soon { border-style: dashed; opacity: 0.78; }
.tile .ti { width: 22px; height: 22px; color: var(--accent); }
.tile.soon .ti { color: var(--mid); }
.tile h3 { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: -0.01em; display: flex; align-items: center; gap: 9px; }
.tile .dm { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--dim); letter-spacing: 0.03em; }
.tile p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--fg-2); }
.tile .st { font-family: "IBM Plex Mono", monospace; font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; padding: 2px 7px; border-radius: 3px; border: 1px solid currentColor; }
.tile .st.on { color: var(--accent); }
.tile .st.wait { color: var(--mid); }
.tile .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 4px; }
.tile .go { display: inline-flex; align-items: center; gap: 6px; font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--accent); }
.tile .go svg { width: 14px; height: 14px; }

/* activity feed */
.activity { border: 1px solid var(--line); background: var(--bg-2); border-radius: 8px; overflow: hidden; }
.activity .row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.activity .row:last-child { border-bottom: 0; }
.activity .row .t { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--dim); flex: 0 0 64px; }
.activity .row .ic { width: 16px; height: 16px; color: var(--accent); flex: 0 0 auto; }
.activity .row .tx { color: var(--fg-2); flex: 1; }
.activity .row .tg { font-family: "IBM Plex Mono", monospace; font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 7px; border-radius: 3px; }

/* tags (semafor) */
.tag-sem { font-family: "IBM Plex Mono", monospace; font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 8px; border-radius: 3px; border: 1px solid currentColor; }
.sem-view { color: var(--sem-view); } .sem-facts { color: var(--sem-facts); } .sem-scene { color: var(--sem-scene); }
.sem-global { color: var(--sem-global); } .sem-analysis { color: var(--sem-analysis); }

/* ============================ CHAT VIEW ============================ */
.chat { display: flex; flex-direction: column; gap: 16px; max-width: 820px; }
.chat-stream { display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 13px; max-width: 100%; }
.msg .av { width: 32px; height: 32px; border-radius: 7px; flex: 0 0 auto; display: grid; place-items: center; }
.msg .av svg { width: 17px; height: 17px; }
.msg.ai .av { background: var(--accent-soft); color: var(--accent); border: 1px solid oklch(0.83 0.13 var(--accent-h) / 0.4); }
.msg.me .av { background: var(--bg-3); color: var(--fg-2); border: 1px solid var(--line); }
.msg .bub { border: 1px solid var(--line); background: var(--bg-2); border-radius: 10px; padding: 13px 16px; font-size: 14px; line-height: 1.55; color: var(--fg); }
.msg.me { flex-direction: row-reverse; }
.msg.me .bub { background: var(--bg-3); }
.msg .bub p { margin: 0 0 8px; } .msg .bub p:last-child { margin: 0; }
.msg .who { font-family: "IBM Plex Mono", monospace; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); margin-bottom: 5px; }
.composer { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); background: var(--bg-2); border-radius: 10px; padding: 8px 8px 8px 16px; }
.composer input { flex: 1; background: transparent; border: 0; outline: 0; color: var(--fg); font-family: "Space Grotesk", sans-serif; font-size: 14px; }
.composer input::placeholder { color: var(--dim); }
.composer .send { width: 38px; height: 38px; border-radius: 7px; background: var(--accent); color: var(--bg); border: 0; display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; }
.composer .send svg { width: 17px; height: 17px; }
.chat-note { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--dim); letter-spacing: 0.04em; text-align: center; }

/* ============================ KB / GUIDES ============================ */
.cardlist { display: grid; gap: 12px; }
.entry { display: flex; align-items: flex-start; gap: 15px; border: 1px solid var(--line); background: var(--bg-2); border-radius: 8px; padding: 16px 18px; transition: border-color .2s, transform .2s var(--ease); cursor: pointer; }
.entry:hover { border-color: var(--accent); transform: translateX(3px); }
.entry .ei { width: 22px; height: 22px; color: var(--accent); flex: 0 0 auto; margin-top: 2px; }
.entry .body { flex: 1; min-width: 0; }
.entry h3 { font-size: 16px; font-weight: 600; margin: 0 0 5px; letter-spacing: -0.01em; }
.entry p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--fg-2); }
.entry .meta { display: flex; align-items: center; gap: 10px; margin-top: 9px; flex-wrap: wrap; }
.entry .arrow { color: var(--dim); flex: 0 0 auto; align-self: center; transition: color .2s, transform .2s; }
.entry:hover .arrow { color: var(--accent); transform: translate(3px, -3px); }
.entry .read { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--dim); letter-spacing: 0.04em; }
.kb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 8px; }
@media (max-width: 820px) { .kb-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 540px) { .kb-grid { grid-template-columns: 1fr; } }
.kbcat { border: 1px solid var(--line); background: var(--bg-2); border-radius: 8px; padding: 15px; display: flex; flex-direction: column; gap: 7px; cursor: pointer; transition: border-color .2s, transform .2s; }
.kbcat:hover { border-color: var(--accent); transform: translateY(-2px); }
.kbcat .ki { width: 22px; height: 22px; color: var(--accent); }
.kbcat h3 { font-size: 15px; font-weight: 600; margin: 0; }
.kbcat .c { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--dim); }

/* ============================ MOBILE RAIL ============================ */
.rail-toggle { display: none; }
@media (max-width: 820px) {
  body.desk { grid-template-columns: 1fr; }
  .rail {
    position: fixed; inset: 0 auto 0 0; width: 264px; transform: translateX(-100%);
    transition: transform .25s var(--ease); z-index: 50; box-shadow: 0 0 60px #000;
  }
  body.desk.nav-open .rail { transform: none; }
  .rail-scrim { position: fixed; inset: 0; background: oklch(0.1 0 0 / 0.6); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 49; }
  body.desk.nav-open .rail-scrim { opacity: 1; pointer-events: auto; }
  .rail-toggle { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg-2); color: var(--fg); cursor: pointer; }
  .rail-toggle svg { width: 18px; height: 18px; }
  .viewport::before { inset: 0; }
  .view { padding: 22px 18px 48px; }
  .hub-top { grid-template-columns: 1fr; }
}
@media (min-width: 821px) { .rail-scrim { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .view > *, .signal .radar-sweep, .rail-status .live-dot, .topbar .tb-status .live-dot { animation: none !important; }
  .view > * { opacity: 1 !important; transform: none !important; }
}
