/* ============================================================
   AI-Native Learning — Design Tokens
   Qquench look & feel: clean white, thin borders, AI gradient
   ============================================================ */

:root {
  /* Type */
  --font-display: 'Poppins', 'Inter', system-ui, sans-serif;
  --font-ui: 'Inter', 'Poppins', system-ui, sans-serif;

  /* Base neutrals (light) */
  --bg-app: #f8f8f8;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-muted: #f4f5f7;
  --bg-subtle: #fafafa;
  --border-default: #e8e8e8;
  --border-strong: #d0d0d0;
  --border-subtle: #f0f0f0;
  --text-primary: #1b1b1b;
  --text-secondary: #4a4a4a;
  --text-muted: #8a8a8a;
  --text-faint: #b5b5b5;

  /* Brand */
  --brand-teal: #2bb5d4;        /* Qquench logo teal */
  --brand-teal-soft: #e8f7fb;

  /* Accents (vary by tweak) */
  --accent: #4049e0;            /* default blue */
  --accent-fg: #ffffff;
  --accent-soft: #eef0ff;
  --accent-strong: #2f37c4;

  /* AI gradient */
  --ai-grad: linear-gradient(135deg, #49c3ea 0%, #4049e0 50%, #5e00ff 100%);
  --ai-grad-soft: linear-gradient(135deg, rgba(73,195,234,0.10) 0%, rgba(64,73,224,0.10) 50%, rgba(94,0,255,0.10) 100%);

  /* Status */
  --success: #049b67;
  --success-soft: #e6f6ee;
  --warning: #d68a00;
  --warning-soft: #fff5d9;
  --danger: #d83a3a;
  --info: #2b7fff;

  /* Density */
  --density-pad: 24px;
  --density-gap: 16px;
  --density-row: 56px;

  /* Radii / shadow */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-card: 0 1px 2px rgba(15, 15, 15, 0.04), 0 4px 16px rgba(15, 15, 15, 0.04);
  --shadow-pop: 0 8px 32px rgba(15, 15, 15, 0.10);
  --focus-ring: 0 0 0 3px rgba(64,73,224,0.18);
}

[data-density="compact"] {
  --density-pad: 16px;
  --density-gap: 12px;
  --density-row: 44px;
}

[data-theme="dark"] {
  --bg-app: #0d1014;
  --bg-surface: #151a20;
  --bg-elevated: #1a2027;
  --bg-muted: #1f262e;
  --bg-subtle: #131820;
  --border-default: #262d36;
  --border-strong: #3a424c;
  --border-subtle: #1f262e;
  --text-primary: #f4f5f7;
  --text-secondary: #c2c8d0;
  --text-muted: #8b94a0;
  --text-faint: #5a626c;
  --brand-teal-soft: rgba(73,195,234,0.10);
  --accent-soft: rgba(64,73,224,0.18);
  --success-soft: rgba(0,225,160,0.14);
  --warning-soft: rgba(255,185,0,0.14);
  --shadow-card: 0 1px 2px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.3);
  --shadow-pop: 0 12px 40px rgba(0,0,0,0.5);
}

[data-accent="blue"]   { --accent: #4049e0; --accent-strong: #2f37c4; --accent-soft: #eef0ff; }
[data-accent="purple"] { --accent: #5e00ff; --accent-strong: #4b00cc; --accent-soft: #f0e8ff; }
[data-accent="teal"]   { --accent: #2bb5d4; --accent-strong: #1c91ad; --accent-soft: #e2f6fb; }
[data-accent="green"]  { --accent: #049b67; --accent-strong: #037552; --accent-soft: #e2f5ec; }
[data-theme="dark"][data-accent="blue"]   { --accent-soft: rgba(64,73,224,0.20); }
[data-theme="dark"][data-accent="purple"] { --accent-soft: rgba(94,0,255,0.22); }
[data-theme="dark"][data-accent="teal"]   { --accent-soft: rgba(43,181,212,0.20); }
[data-theme="dark"][data-accent="green"]  { --accent-soft: rgba(4,155,103,0.22); }

* { box-sizing: border-box; }
html, body, #root {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
body { overflow: hidden; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ============================================================
   Shell
   ============================================================ */
.app {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: 50px 1fr 30px;
  background: var(--bg-app);
  position: relative;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  z-index: 10;
}
.topbar .logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--brand-teal);
  display: flex;
  align-items: center;
  gap: 2px;
}
.topbar .logo sup { color: var(--accent); font-size: 14px; }
.topbar .crumbs {
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  gap: 6px;
  border-left: 1px solid var(--border-default);
  padding-left: 16px;
  height: 28px;
  align-items: center;
}
.topbar .crumbs span:last-child { color: var(--text-primary); font-weight: 500; }
.topbar .spacer { flex: 1; }
.topbar .env {
  color: var(--text-muted);
  font-size: 12px;
}
.topbar .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--ai-grad);
  color: white;
  display: grid; place-items: center;
  font-weight: 600; font-size: 12px;
  font-family: var(--font-display);
}

.statusbar {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  padding: 0 24px;
  font-size: 11px;
  color: var(--text-muted);
  gap: 16px;
}
.statusbar .ai-badge {
  margin-left: auto;
  background: var(--ai-grad);
  color: white;
  font-weight: 700;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-display);
}

.main {
  display: grid;
  grid-template-columns: 50px 1fr;
  overflow: hidden;
  position: relative;
}
.main.with-ai { grid-template-columns: 50px 1fr 320px; }
.main.with-sidenav { grid-template-columns: 50px 220px 1fr; }
.main.with-sidenav.with-ai { grid-template-columns: 50px 220px 1fr 320px; }

.nav-rail {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 6px;
}
.nav-rail .nav-item {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--text-muted);
  position: relative;
}
.nav-rail .nav-item:hover { background: var(--bg-muted); color: var(--text-primary); }
.nav-rail .nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.nav-rail .nav-divider {
  width: 24px; height: 1px;
  background: var(--border-default);
  margin: 8px 0;
}

.canvas {
  overflow: auto;
  padding: 0;
  position: relative;
}

/* ============================================================
   AI Intelligence panel
   ============================================================ */
.ai-panel {
  background: var(--bg-surface);
  border-left: 1px solid var(--border-default);
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ai-panel-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.ai-panel-head .icon-wrap {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--ai-grad);
  display: grid; place-items: center;
  color: white;
  flex-shrink: 0;
}
.ai-panel-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
}
.ai-panel-head p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}
.ai-card {
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-surface);
}
.ai-card.tone-info { background: var(--accent-soft); border-color: transparent; }
.ai-card.tone-success { background: var(--success-soft); border-color: transparent; }
.ai-card.tone-warning { background: var(--warning-soft); border-color: transparent; }
.ai-card.tone-purple { background: rgba(94,0,255,0.06); border-color: transparent; }
[data-theme="dark"] .ai-card.tone-purple { background: rgba(94,0,255,0.18); }
.ai-card .ai-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-card .ai-label .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
}
.ai-card.tone-success .ai-label .dot { background: var(--success); }
.ai-card.tone-warning .ai-label .dot { background: var(--warning); }
.ai-card.tone-purple .ai-label .dot { background: #5e00ff; }
.ai-card .ai-body {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.ai-rec-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 6px;
}
.ai-rec {
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  padding: 12px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.ai-rec .arr { color: var(--accent); flex-shrink: 0; margin-top: 2px; }

/* ============================================================
   Buttons, inputs
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  font-family: var(--font-display);
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
}
.btn-primary:hover { background: var(--accent-strong); }
.btn-primary.gradient { background: var(--ai-grad); }
.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
}
.btn-secondary:hover { background: var(--bg-muted); }
.btn-ghost { color: var(--text-secondary); padding: 10px 14px; }
.btn-ghost:hover { background: var(--bg-muted); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

.input, .select {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.input::placeholder { color: var(--text-faint); }
.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-display);
}
.field { margin-bottom: 14px; }

/* checkbox card */
.check-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  background: var(--bg-surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.check-card:hover { border-color: var(--border-strong); }
.check-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.check-card .cb {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface);
  display: grid; place-items: center;
  flex-shrink: 0;
  color: white;
}
.check-card.selected .cb {
  background: var(--accent);
  border-color: var(--accent);
}
.check-card .cb svg { width: 12px; height: 12px; opacity: 0; }
.check-card.selected .cb svg { opacity: 1; }
.check-card .label { font-weight: 500; font-size: 14px; }
.check-card .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* toggle switch */
.toggle {
  width: 40px; height: 22px;
  background: var(--border-strong);
  border-radius: 100px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  left: 2px; top: 2px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(18px); }

/* ============================================================
   Centered scene (auth, splash, onboarding cards)
   ============================================================ */
.scene {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
}
.scene-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.scene-bg .blob {
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
}
[data-theme="dark"] .scene-bg .blob { opacity: 0.45; }
.scene-bg .blob.a { background: #49c3ea; top: -200px; left: -150px; }
.scene-bg .blob.b { background: #5e00ff; bottom: -200px; right: -100px; opacity: 0.25; }
.scene-bg .blob.c { background: #4049e0; top: 30%; right: 20%; width: 400px; height: 400px; opacity: 0.18; }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 20px;
  padding: 40px;
  width: 460px;
  box-shadow: var(--shadow-card);
  position: relative;
  z-index: 1;
}
.card.wide { width: 720px; }
.card .head {
  text-align: center;
  margin-bottom: 28px;
}
.card .head h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.card .head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* Stepper dots */
.stepper {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
.stepper .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
  transition: width 0.2s, background 0.2s;
}
.stepper .dot.done { background: var(--accent); }
.stepper .dot.current { background: var(--accent); width: 24px; border-radius: 4px; }

/* progress bar */
.progress {
  width: 100%;
  height: 6px;
  background: var(--bg-muted);
  border-radius: 100px;
  overflow: hidden;
}
.progress .bar {
  height: 100%;
  background: var(--ai-grad);
  border-radius: 100px;
  transition: width 0.4s ease;
}

/* card footer */
.card-foot {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* Pill / chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-display);
  background: var(--bg-muted);
  color: var(--text-secondary);
}
.chip.success { background: var(--success-soft); color: var(--success); }
.chip.info { background: var(--accent-soft); color: var(--accent); }
.chip.warn { background: var(--warning-soft); color: var(--warning); }
.chip.purple { background: rgba(94,0,255,0.10); color: #5e00ff; }

/* Step navigator overlay */
.step-nav {
  position: fixed;
  left: 50%;
  bottom: 50px;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 100px;
  padding: 8px;
  display: flex;
  gap: 4px;
  box-shadow: var(--shadow-pop);
  z-index: 50;
  align-items: center;
  max-width: 90vw;
  overflow-x: auto;
}
.step-nav .group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 10px;
  font-family: var(--font-display);
}
.step-nav .step-pill {
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.step-nav .step-pill:hover { background: var(--bg-muted); }
.step-nav .step-pill.active {
  background: var(--accent);
  color: white;
}
.step-nav .divider {
  width: 1px; height: 16px;
  background: var(--border-default);
  margin: 0 4px;
}

/* Splash visuals */
.splash-mark {
  width: 96px; height: 96px;
  margin: 0 auto 24px;
  border-radius: 22px;
  background: var(--ai-grad);
  display: grid; place-items: center;
  color: white;
  box-shadow: 0 12px 40px rgba(64,73,224,0.30);
}

/* Auth illustration */
.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}
.auth-illu {
  aspect-ratio: 1;
  border-radius: 16px;
  background: var(--bg-muted);
  display: grid; place-items: center;
  color: var(--text-faint);
  position: relative;
  overflow: hidden;
}
.auth-illu .iconwrap {
  width: 120px; height: 120px;
  border-radius: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  display: grid; place-items: center;
  color: var(--accent);
  box-shadow: var(--shadow-card);
  z-index: 1;
}

/* Pin input (MFA) */
.pin-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 8px 0 16px;
}
.pin-row input {
  width: 48px; height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  font-family: var(--font-display);
  border: 1.5px solid var(--border-default);
  border-radius: 10px;
  background: var(--bg-surface);
  color: var(--text-primary);
}
.pin-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* SSO buttons */
.sso-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 500;
  font-size: 14px;
  transition: background 0.15s, border-color 0.15s;
  margin-bottom: 10px;
}
.sso-btn:hover { background: var(--bg-muted); border-color: var(--border-strong); }
.sso-btn .sso-icon {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  flex-shrink: 0;
}

/* Workspace list */
.ws-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border-default);
  border-radius: 12px;
  background: var(--bg-surface);
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.ws-row:hover { border-color: var(--accent); transform: translateY(-1px); }
.ws-row .ws-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--ai-grad-soft);
  display: grid; place-items: center;
  color: var(--accent);
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: 700;
}
.ws-row .ws-name { font-weight: 600; font-size: 14px; }
.ws-row .ws-role { font-size: 11px; color: var(--text-muted); }
.ws-row .ws-arrow { margin-left: auto; color: var(--text-muted); }

/* Color swatches */
.swatches { display: flex; gap: 8px; }
.swatches button {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
}
.swatches button.active { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--bg-surface) inset; }

/* Mentor card */
.mentor-card {
  border: 1.5px solid var(--border-default);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.mentor-card:hover { border-color: var(--border-strong); }
.mentor-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.mentor-card .av {
  width: 52px; height: 52px;
  border-radius: 50%;
  margin: 0 auto 8px;
  background: var(--ai-grad);
  display: grid; place-items: center;
  color: white;
}
.mentor-card.selected .check-pin {
  position: absolute;
  top: 8px; right: 8px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  display: grid; place-items: center;
  color: white;
}
.mentor-card .check-pin { display: none; }
.mentor-card .name {
  font-weight: 600;
  font-size: 13px;
  font-family: var(--font-display);
}
.mentor-card .desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Invited row */
.invited-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-muted);
  margin-bottom: 6px;
  font-size: 13px;
}
.invited-row .av {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--ai-grad);
  color: white;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.invited-row .role-chip {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  padding: 2px 8px;
  border-radius: 100px;
  font-weight: 500;
}
.invited-row .x {
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

/* Hint banner */
.hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: var(--accent-soft);
  border-radius: 8px;
  color: var(--accent-strong);
  font-size: 12px;
  line-height: 1.4;
}
[data-theme="dark"] .hint { color: var(--text-secondary); }
.hint svg { flex-shrink: 0; margin-top: 1px; }

/* Two col */
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cols-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* Sidenav (in-app subnav) */
.sidenav {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-default);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidenav .group-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 12px 4px;
  font-family: var(--font-display);
}
.sidenav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.sidenav .nav-link:hover { background: var(--bg-muted); color: var(--text-primary); }
.sidenav .nav-link.active {
  background: var(--accent);
  color: white;
}
[data-theme="dark"] .sidenav .nav-link.active { color: white; }
.sidenav .nav-link svg { flex-shrink: 0; }

/* fade in */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.scene > .card, .scene > .auth-grid { animation: fadeIn 0.3s ease; }

/* ============================================================
   Pipeline shell (deep views: Inputs, Intake, Extraction, …)
   ============================================================ */
.pipe-app {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: 60px 1fr 28px;
  background: var(--bg-app);
  position: relative;
  overflow: hidden;
}
.pipe-topbar {
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 18px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  z-index: 10;
}
.pipe-topbar .logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--brand-teal);
}
.pipe-topbar .logo sup { color: #5e00ff; }
.pipe-project {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-display);
  cursor: pointer;
  min-width: 280px;
}
.pipe-project:hover { background: var(--bg-muted); }
.pipe-project .chev { color: var(--text-muted); margin-left: auto; }
.pipe-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.pipe-search input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  background: var(--bg-surface);
  font-size: 13px;
  color: var(--text-primary);
}
.pipe-search .ic { position: absolute; left: 12px; top: 11px; color: var(--text-muted); }
.pipe-search .kbd {
  position: absolute; right: 12px; top: 9px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-display);
  font-weight: 600;
}
.pipe-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-display);
}
.pipe-pill.green { background: rgba(4,155,103,0.12); color: #049b67; }
.pipe-pill.purple { background: rgba(94,0,255,0.10); color: #5e00ff; }
.pipe-topbar .bell {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
}
.pipe-topbar .bell:hover { background: var(--bg-muted); }
.pipe-topbar .bell::after {
  content: '';
  position: absolute;
  top: 8px; right: 9px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #5e00ff;
  border: 2px solid var(--bg-surface);
}
.pipe-topbar .user {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 500;
}
.pipe-topbar .user .av {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4049e0, #5e00ff);
  color: white;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  font-family: var(--font-display);
}

.pipe-main {
  display: grid;
  grid-template-columns: 200px 240px 1fr 340px;
  overflow: hidden;
}
.pipe-main.no-sub { grid-template-columns: 200px 1fr 340px; }
.pipe-main.no-ai { grid-template-columns: 200px 240px 1fr; }
.pipe-main.no-sub.no-ai { grid-template-columns: 200px 1fr; }

.pipe-outernav {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-default);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pipe-outernav .item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-display);
  cursor: pointer;
}
.pipe-outernav .item:hover { background: var(--bg-muted); color: var(--text-primary); }
.pipe-outernav .item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.pipe-outernav .collapse {
  margin-top: auto;
  display: flex; align-items: center; gap: 8px;
  color: var(--text-muted);
  padding: 11px 14px;
  font-size: 12px;
  cursor: pointer;
  border-top: 1px solid var(--border-subtle);
}

.pipe-subnav {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-default);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
}
.pipe-subnav .group-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 12px 12px;
  font-family: var(--font-display);
}
.pipe-subnav .item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 2px;
}
.pipe-subnav .item:hover { background: var(--bg-muted); }
.pipe-subnav .item.active {
  background: var(--accent-soft);
}
.pipe-subnav .item .ic-wrap {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  color: var(--text-secondary);
}
.pipe-subnav .item.active .ic-wrap { color: var(--accent); }
.pipe-subnav .item .text { line-height: 1.2; }
.pipe-subnav .item .name {
  font-size: 13px; font-weight: 600;
  font-family: var(--font-display);
  color: var(--text-primary);
}
.pipe-subnav .item.active .name { color: var(--accent); }
.pipe-subnav .item .sub {
  font-size: 11px; color: var(--text-muted);
  margin-top: 2px;
}
.pipe-progress-widget {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--border-default);
  border-radius: 12px;
}
.pipe-progress-widget .lbl { font-size: 13px; font-weight: 600; font-family: var(--font-display); }
.pipe-progress-widget .step { font-size: 11px; color: var(--text-muted); margin: 4px 0 10px; }
.pipe-progress-widget .pct { font-size: 12px; color: var(--accent); margin-top: 10px; font-weight: 600; }
.pipe-progress-widget .link {
  margin-top: 8px;
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  display: inline-block;
}

.pipe-canvas {
  overflow-y: auto;
  padding: 28px 32px 60px;
}
.pipe-canvas h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.pipe-canvas .sub { color: var(--text-muted); font-size: 13px; }
.pipe-canvas .head-row {
  display: flex;
  align-items: flex-start;
  margin-bottom: 22px;
  gap: 12px;
}
.pipe-canvas .head-row .actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
}

.pipe-aipanel {
  background: var(--bg-surface);
  border-left: 1px solid var(--border-default);
  padding: 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pipe-aipanel .head {
  display: flex; gap: 10px; align-items: center;
}
.pipe-aipanel .head .ic-wrap {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #7c5cff, #5e00ff);
  color: white;
  display: grid; place-items: center;
}
.pipe-aipanel .head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}
.pipe-aipanel .head-sub {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 4px;
}
.pipe-aicard {
  border-radius: 12px;
  padding: 14px;
  display: grid;
  grid-template-columns: 32px 1fr 14px;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
}
.pipe-aicard.success { background: rgba(4,155,103,0.08); }
.pipe-aicard.warn { background: rgba(214,138,0,0.10); }
.pipe-aicard.info { background: rgba(64,73,224,0.08); }
.pipe-aicard.danger { background: rgba(216,58,58,0.08); }
[data-theme="dark"] .pipe-aicard.success { background: rgba(4,155,103,0.18); }
[data-theme="dark"] .pipe-aicard.warn { background: rgba(214,138,0,0.20); }
[data-theme="dark"] .pipe-aicard.info { background: rgba(64,73,224,0.20); }
[data-theme="dark"] .pipe-aicard.danger { background: rgba(216,58,58,0.20); }
.pipe-aicard .ic {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.7);
}
[data-theme="dark"] .pipe-aicard .ic { background: rgba(255,255,255,0.06); }
.pipe-aicard.success .ic { color: #049b67; }
.pipe-aicard.warn .ic { color: #d68a00; }
.pipe-aicard.info .ic { color: #4049e0; }
.pipe-aicard.danger .ic { color: #d83a3a; }
.pipe-aicard .ttl {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}
.pipe-aicard .bd {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.pipe-aicard .ch { color: var(--text-muted); margin-top: 8px; }
.pipe-aicard .lnk { color: var(--accent); font-size: 12px; font-weight: 600; margin-top: 6px; cursor: pointer; display: inline-block; }

.pipe-section-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  margin: 8px 0 4px;
}
.pipe-action-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  background: var(--bg-surface);
  font-weight: 500;
}
.pipe-action-row:hover { background: var(--bg-muted); }
.pipe-action-row .ic { color: var(--text-secondary); }
.pipe-action-row .ar { margin-left: auto; color: var(--text-muted); }

.pipe-ask {
  margin-top: 8px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(94,0,255,0.06), rgba(124,92,255,0.10));
  border-radius: 14px;
}
[data-theme="dark"] .pipe-ask { background: linear-gradient(135deg, rgba(94,0,255,0.18), rgba(124,92,255,0.18)); }
.pipe-ask .ttl {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  display: flex; gap: 6px; align-items: center;
  color: #5e00ff;
}
.pipe-ask .bd { font-size: 12px; color: var(--text-secondary); line-height: 1.4; margin-bottom: 14px; }
.pipe-ask .cta {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid #d9ccff;
  color: #5e00ff;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 13px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer;
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.stat-card .stat-ic {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  margin-bottom: 12px;
}
.stat-card .stat-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.stat-card .stat-lbl {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.stat-card .stat-extra {
  font-size: 11px;
  margin-top: 6px;
  font-weight: 600;
  font-family: var(--font-display);
}
.stat-card .stat-spark {
  margin-top: 8px;
  height: 30px;
}

/* Card */
.pcard {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
}
.pcard .pcard-head {
  display: flex;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 10px;
}
.pcard .pcard-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
}
.pcard .pcard-head .pcard-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.pcard .pcard-head .pcard-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* Stage row */
.stage-row {
  display: grid;
  grid-template-columns: repeat(var(--stages, 5), 1fr);
  position: relative;
  margin: 6px 0;
}
.stage-row::before {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  top: 28px;
  height: 1.5px;
  background: var(--border-default);
  z-index: 0;
}
.stage-node {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  position: relative; z-index: 1;
}
.stage-node .ring {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-strong);
  color: var(--text-muted);
}
.stage-node.done .ring {
  background: var(--bg-surface);
  border-color: var(--accent);
  color: var(--accent);
}
.stage-node.active .ring {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 6px 20px rgba(94,0,255,0.30);
}
.stage-node .name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
}
.stage-node .meta {
  font-size: 11px;
  color: var(--text-muted);
}
.stage-node.done .meta { color: var(--success); font-weight: 600; }
.stage-node.active .meta { color: var(--accent); font-weight: 600; }

/* Tabs */
.tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--border-default);
  margin-bottom: 16px;
  font-family: var(--font-display);
}
.tabs .tab {
  padding: 10px 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs .tab:hover { color: var(--text-primary); }
.tabs .tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* Data table */
.dtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.dtable thead th {
  text-align: left;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-default);
}
.dtable tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.dtable tbody tr:last-child td { border-bottom: none; }
.dtable .fileicon {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  margin-right: 12px;
  vertical-align: middle;
}
.dtable .filename {
  font-weight: 500;
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
}
.dtable .filename .meta {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}
.statuschip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-display);
}
.statuschip.success { background: rgba(4,155,103,0.12); color: #049b67; }
.statuschip.warn { background: rgba(214,138,0,0.15); color: #d68a00; }
.statuschip.info { background: rgba(64,73,224,0.10); color: #4049e0; }
.statuschip.danger { background: rgba(216,58,58,0.10); color: #d83a3a; }
.statuschip.neutral { background: var(--bg-muted); color: var(--text-secondary); }
.statuschip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.kebab {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: inline-grid; place-items: center;
  color: var(--text-muted);
  cursor: pointer;
}
.kebab:hover { background: var(--bg-muted); }

.paginator {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text-muted);
  padding: 14px 18px;
}
.paginator .pages { display: flex; gap: 4px; align-items: center; }
.paginator .pages button {
  min-width: 28px; height: 28px;
  border-radius: 6px;
  display: inline-grid; place-items: center;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-display);
}
.paginator .pages button.active { background: var(--accent-soft); color: var(--accent); }
.paginator .pages button:hover { background: var(--bg-muted); }

.uploader-card {
  border: 2px dashed #c5b8ff;
  background: linear-gradient(180deg, rgba(245,241,255,0.4), rgba(255,255,255,0.5));
  border-radius: 16px;
  padding: 36px;
  text-align: center;
}
[data-theme="dark"] .uploader-card {
  background: rgba(94,0,255,0.06);
}
.uploader-card .cloud {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: rgba(94,0,255,0.10);
  display: grid; place-items: center;
  color: #5e00ff;
}
.uploader-card .ttl {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}
.uploader-card .ttl a {
  color: #5e00ff;
  cursor: pointer;
}
.uploader-card .types {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.uploader-card .browse {
  display: inline-flex;
  padding: 10px 22px;
  border: 1px solid #d9ccff;
  border-radius: 8px;
  color: #5e00ff;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 13px;
  background: var(--bg-surface);
  cursor: pointer;
}

/* sparkline */
.sparkline {
  width: 100%;
  height: 30px;
}

/* progress bar inline */
.bar-inline {
  width: 100%;
  height: 6px;
  background: var(--bg-muted);
  border-radius: 100px;
  overflow: hidden;
}
.bar-inline > div {
  height: 100%;
  border-radius: 100px;
  background: var(--accent);
}

/* Donut placeholder */
.donut-wrap {
  display: flex; align-items: center; gap: 22px;
}
.donut {
  width: 130px; height: 130px;
  border-radius: 50%;
  display: grid; place-items: center;
  position: relative;
}
.donut .donut-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
}
.donut .donut-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Knowledge map placeholder */
.kmap {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 20px;
  position: relative;
  min-height: 280px;
}

/* Storyboard thumb */
.story-thumb {
  width: 48px; height: 36px;
  border-radius: 6px;
  background: var(--bg-muted);
  display: inline-grid; place-items: center;
  font-size: 16px;
  margin-right: 12px;
  vertical-align: middle;
}

/* n8n-style flow */
.n8n-stage {
  background: linear-gradient(180deg, #fafbff 0%, #fff 100%);
  min-height: 700px;
  padding: 36px;
  position: relative;
  border-radius: 0;
  overflow: auto;
}
[data-theme="dark"] .n8n-stage { background: var(--bg-app); }
.n8n-zoom {
  position: absolute;
  right: 24px;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}
.n8n-zoom button {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  display: grid; place-items: center;
  color: var(--text-secondary);
  cursor: pointer;
}
.n8n-node {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  padding: 12px;
  position: absolute;
  font-family: var(--font-ui);
}
.n8n-node.active {
  border-color: #4049e0;
  background: linear-gradient(180deg, rgba(64,73,224,0.04), white);
}
[data-theme="dark"] .n8n-node.active { background: linear-gradient(180deg, rgba(64,73,224,0.18), var(--bg-surface)); }
.n8n-node .nh { display: flex; align-items: center; gap: 8px; }
.n8n-node .nh .ic-wrap {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: grid; place-items: center;
  background: rgba(64,73,224,0.10);
  color: #4049e0;
}
.n8n-node .nh .ic-wrap.green { background: rgba(4,155,103,0.14); color: #049b67; }
.n8n-node .nh .ic-wrap.purple { background: rgba(94,0,255,0.12); color: #5e00ff; }
.n8n-node .nh .ic-wrap.cyan { background: rgba(43,181,212,0.16); color: #2bb5d4; }
.n8n-node .nh .ic-wrap.warn { background: rgba(214,138,0,0.16); color: #d68a00; }
.n8n-node .nh .title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
}
.n8n-node .nh .arr {
  margin-left: auto;
  color: var(--text-muted);
}

/* Character mentor floating */
.mentor-floater {
  position: fixed;
  right: 360px;
  bottom: 80px;
  width: 260px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow-pop);
  z-index: 30;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: fadeIn 0.3s ease;
}
.main:not(.with-ai) .mentor-floater { right: 40px; }
.mentor-floater .av {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--ai-grad);
  color: white;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.mentor-floater .who {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
}
.mentor-floater .what {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 2px;
}
.mentor-floater .x {
  position: absolute;
  top: 8px; right: 8px;
  color: var(--text-muted);
  cursor: pointer;
}

/* ===== Interactive additions: dropdown, toast, selection bar, gate banner, issue queue ===== */
/* Added to make previously-decorative buttons/layouts functional. Built entirely from existing
   tokens above — no new colors or type scale introduced. */

.ddown-wrap { position: relative; display: inline-block; }
.ddown-menu {
  position: absolute; top: calc(100% + 6px); z-index: 40;
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); box-shadow: var(--shadow-pop);
  padding: 6px; animation: ddownIn .12s ease-out;
}
.ddown-menu.right { right: 0; }
.ddown-menu.left { left: 0; }
@keyframes ddownIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.ddown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-primary); cursor: pointer; white-space: nowrap;
}
.ddown-item:hover { background: var(--bg-muted); }
.ddown-item.danger { color: var(--danger); }
.ddown-item.disabled { color: var(--text-faint); cursor: not-allowed; }
.ddown-divider { height: 1px; background: var(--border-subtle); margin: 4px 2px; }

.inline-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); box-shadow: var(--shadow-pop);
  padding: 10px 16px; font-size: 13px; font-weight: 500; z-index: 100;
  animation: toastIn .18s ease-out;
}
.inline-toast.success { color: var(--success); border-color: var(--success-soft); }
.inline-toast.danger { color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.selection-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; background: var(--accent-soft);
  border-bottom: 1px solid var(--border-default);
}
.selection-bar .count { font-weight: 600; font-size: 13px; color: var(--accent-strong); margin-right: 6px; }
.selection-bar .clear { margin-left: auto; font-size: 12px; color: var(--text-muted); cursor: pointer; text-decoration: underline; }

/* Hard-gate banner — used on Intake and CO to add the missing Review & Approve action */
.gate-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 22px; border-radius: var(--radius-lg);
  background: var(--bg-subtle); border: 1px solid var(--border-default); margin-top: 18px;
}
.gate-banner .gtxt .ttl { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.gate-banner .gtxt .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.gate-banner .gcounts { display: flex; gap: 18px; margin-right: auto; padding-left: 24px; }
.gate-banner .gcounts .n { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.gate-banner .gcounts .l { font-size: 11px; color: var(--text-muted); }
.gate-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* AI Issue Queue / correction workspace — used on Extraction */
.issue-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--radius-md); border: 1px solid var(--border-default); cursor: pointer; }
.issue-card.active { border-color: var(--accent); background: var(--accent-soft); }
.issue-card .row1 { display: flex; align-items: center; justify-content: space-between; }
.issue-card .loc { font-weight: 600; font-size: 13px; }
.issue-card .desc { font-size: 12px; color: var(--text-secondary); }
.issue-card .conf { font-size: 11px; color: var(--text-muted); }
.correction-panel textarea {
  width: 100%; min-height: 80px; border: 1px solid var(--border-default); border-radius: var(--radius-md);
  padding: 10px 12px; font-family: var(--font-ui); font-size: 13px; resize: vertical;
}
.correction-panel textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.uploader-card.dragover { border-color: var(--accent); background: var(--accent-soft); }
