/* =========================================================================
   CitationScraper Dashboard — Tokyo Night / IDE-dark theme
   ------------------------------------------------------------------------
   Palette: Tokyo Night (https://github.com/enkia/tokyo-night-vscode-theme)
     - base  #1a1b26  - the editor background
     - mantl #16161e  - the chrome/mantle (panels, navbar)
     - surf1 #2a2b3d  - the sidebar/surface
     - surf2 #363a52  - elevated surface (hover, popover)
     - bordr #414868  - 1px borders / dividers
     - text  #c0caf5  - default text
     - dim   #9aa5ce  - secondary text
     - mute  #565f89  - tertiary / disabled
     - blue  #7aa2f7  - primary accent
     - cyan  #7dcfff  - data / chart
     - purp  #bb9af7  - highlights / focus
     - pink  #f7768e  - critical / red
     - green #9ece6a  - positive
     - yell  #e0af68  - warn
     - orng  #ff9e64  - emphasis
   Typography:
     - JetBrains Mono  →  body, tables, code, small UI (13-14px)
     - IBM Plex Mono   →  panel titles, page titles, big numbers
     - Inter           →  dense UI labels / fallback
   Client brand color (--brand) overrides blue for logos / accents.
   ========================================================================= */

:root {
  /* Tokyo Night */
  --base:    #1a1b26;
  --mantl:   #16161e;
  --surf1:   #2a2b3d;
  --surf2:   #363a52;
  --surf3:   #414868;
  --bordr:   #292e42;
  --text:    #c0caf5;
  --dim:     #9aa5ce;
  --mute:    #565f89;

  --blue:    #7aa2f7;
  --cyan:    #7dcfff;
  --purp:    #bb9af7;
  --pink:    #f7768e;
  --green:   #9ece6a;
  --yell:    #e0af68;
  --orng:    #ff9e64;
  --red:     #f7768e;

  /* Brand color = the client brand, defaults to blue */
  --brand:        var(--blue);
  --brand-soft:   rgba(122, 162, 247, 0.12);
  --brand-fg:     #ffffff;

  /* Spacing */
  --gap: 14px;
  --gap-sm: 10px;
  --pad: 22px;
  --pad-sm: 14px;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  /* Subtle grid backdrop (Tokyo Night terminal feel) */
  --grid-line: rgba(65, 72, 104, 0.08);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--base);
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
  font-size: 13.5px;
  font-feature-settings: "calt" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background: dark with a very subtle two-tone ambient + faint grid */
.app-bg {
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(122, 162, 247, 0.04), transparent 50%),
    radial-gradient(circle at 90% 30%, rgba(187, 154, 247, 0.04), transparent 55%),
    var(--base);
  position: relative;
}
.app-bg::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  opacity: 0.4;
  z-index: 0;
}

code, pre, .font-mono {
  font-family: 'JetBrains Mono', ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
}
code {
  font-size: 12.5px;
  background: var(--surf1);
  border: 1px solid var(--bordr);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--cyan);
}

/* ----- Navbar ----- */
.dash-navbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--mantl);
  border-bottom: 1px solid var(--bordr);
  backdrop-filter: blur(6px);
}
.dash-navbar a {
  color: var(--dim);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: color .12s, background .12s;
}
.dash-navbar a:hover { color: var(--text); background: var(--surf1); }

/* ----- Brand mark (squared monogram with a colored bar) ----- */
.brand-mark {
  width: 32px; height: 32px;
  background: var(--brand);
  color: #1a1b26;
  display: flex; align-items: center; justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  font-size: 16px;
  border-radius: 6px;
  position: relative;
  letter-spacing: -0.5px;
}
.brand-mark::after {
  content: "";
  position: absolute; bottom: -1px; left: -1px; right: -1px;
  height: 3px;
  background: var(--pink);
  border-radius: 0 0 6px 6px;
}

/* ----- Stat cards (terminal-window style) ----- */
.stat-card {
  position: relative;
  background: var(--mantl);
  border: 1px solid var(--bordr);
  border-radius: var(--r-md);
  padding: 18px 18px 18px 20px;
  transition: transform .15s, border-color .15s;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 6px 18px rgba(0, 0, 0, 0.25);
}
.stat-card::before {
  /* A left "tag" bar colored by gradient */
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--blue);
}
.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--surf3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.stat-card.g1::before { background: var(--blue); }
.stat-card.g2::before { background: var(--purp); }
.stat-card.g3::before { background: var(--cyan); }
.stat-card.g4::before { background: var(--green); }
.stat-card.g5::before { background: var(--orng); }
.stat-card.g6::before { background: var(--pink); }

.stat-card .stat-label {
  font-size: 11px;
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  margin-bottom: 8px;
  font-family: 'JetBrains Mono', monospace;
}
.stat-card .stat-value {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 28px;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}
.stat-card .stat-delta {
  font-size: 11px;
  color: var(--mute);
  margin-top: 6px;
}
.stat-card .stat-delta.up   { color: var(--green); }
.stat-card .stat-delta.down { color: var(--pink); }

/* ----- Panel (the "editor window" — title bar with traffic lights) ----- */
.panel {
  background: var(--mantl);
  border: 1px solid var(--bordr);
  border-radius: var(--r-md);
  padding: var(--pad);
  margin-bottom: var(--gap);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 8px 24px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1;
}
.panel::before {
  /* faint top accent line */
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--surf3) 50%, transparent);
  opacity: 0.6;
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.panel h2 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text);
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel h2::before {
  /* terminal window dots, in monochrome for IDE feel */
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--mute);
  box-shadow:
    14px 0 0 var(--mute),
    28px 0 0 var(--mute);
  margin-right: 4px;
}
.panel h2 .h2-icon { color: var(--brand); margin-right: 4px; }
.panel .h2-sub {
  font-size: 12px;
  color: var(--mute);
  margin: 4px 0 14px 0;
  line-height: 1.5;
  font-style: italic;
}

/* ----- Tab bar ----- */
.tabs-row {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--bordr);
  margin-bottom: var(--gap);
}
.tabs-row a {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--mute);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color .12s, border-color .12s;
  font-family: 'JetBrains Mono', monospace;
}
.tabs-row a:hover { color: var(--dim); }
.tabs-row a.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

/* ----- Tables ----- */
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  font-family: 'JetBrains Mono', monospace;
}
.tbl thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--mute);
  padding: 8px 12px;
  border-bottom: 1px solid var(--bordr);
  background: var(--surf1);
}
.tbl thead th:first-child { border-top-left-radius: 6px; }
.tbl thead th:last-child { border-top-right-radius: 6px; }
.tbl tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--bordr);
  color: var(--text);
  vertical-align: top;
}
.tbl tbody tr:hover td { background: var(--surf1); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--cyan); }

/* ----- Pills (Tokyo Night "operator" style — colored tag) ----- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surf1);
  color: var(--dim);
  border: 1px solid var(--bordr);
  font-family: 'JetBrains Mono', monospace;
}
.pill.green  { background: rgba(158, 206, 106, 0.10); color: var(--green); border-color: rgba(158, 206, 106, 0.30); }
.pill.blue   { background: rgba(122, 162, 247, 0.10); color: var(--blue);  border-color: rgba(122, 162, 247, 0.30); }
.pill.purple { background: rgba(187, 154, 247, 0.10); color: var(--purp);  border-color: rgba(187, 154, 247, 0.30); }
.pill.cyan   { background: rgba(125, 207, 255, 0.10); color: var(--cyan);  border-color: rgba(125, 207, 255, 0.30); }
.pill.amber  { background: rgba(224, 175, 104, 0.10); color: var(--yell);  border-color: rgba(224, 175, 104, 0.30); }
.pill.pink   { background: rgba(247, 118, 142, 0.10); color: var(--pink);  border-color: rgba(247, 118, 142, 0.30); }
.pill.red    { background: rgba(247, 118, 142, 0.10); color: var(--pink);  border-color: rgba(247, 118, 142, 0.30); }

/* ----- Filter bar (terminal status-bar feel) ----- */
.filter-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: var(--mantl);
  border: 1px solid var(--bordr);
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-bottom: var(--gap);
  flex-wrap: wrap;
}
.filter-row .field { display: flex; flex-direction: column; gap: 4px; }
.filter-row .field label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--mute);
  font-weight: 600;
}
.filter-row .field input[type=date] {
  background: var(--surf1);
  border: 1px solid var(--bordr);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color-scheme: dark;
}
.filter-row .field input[type=date]:focus {
  border-color: var(--brand);
  outline: none;
}
.filter-row .platform-pills { display: flex; gap: 6px; }
.filter-row .platform-pills label {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--bordr);
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  background: var(--surf1);
  color: var(--dim);
  user-select: none;
  transition: all .12s;
}
.filter-row .platform-pills label:hover { border-color: var(--surf3); color: var(--text); }
.filter-row .platform-pills label:has(input:checked) {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand);
}
.filter-row .platform-pills input { display: none; }

/* ----- Buttons (IDE-style "Run" / "Build" buttons) ----- */
.btn-primary-grad {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--blue);
  color: #1a1b26;
  border: 1px solid var(--blue);
  padding: 7px 14px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.3px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all .12s;
}
.btn-primary-grad:hover { background: #93b6fb; border-color: #93b6fb; }
.btn-primary-grad:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost-grad {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--bordr);
  padding: 7px 14px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.3px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all .12s;
}
.btn-ghost-grad:hover { color: var(--text); border-color: var(--surf3); background: var(--surf1); }

/* ----- Login shell (terminal greeting) ----- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 30%, rgba(122, 162, 247, 0.06), transparent 60%),
    var(--base);
}
.login-card {
  background: var(--mantl);
  border: 1px solid var(--bordr);
  border-radius: var(--r-lg);
  padding: 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  position: relative;
}
.login-card::before {
  content: "user@citationscraper: ~/login";
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--mute);
  margin-bottom: 24px;
  border-bottom: 1px solid var(--bordr);
  padding-bottom: 12px;
}
.login-card h2 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.3px;
}
.login-card p {
  color: var(--mute);
  font-size: 13px;
  margin: 8px 0 24px 0;
  line-height: 1.5;
}
.login-card input[type=email] {
  width: 100%;
  background: var(--surf1);
  border: 1px solid var(--bordr);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 5px;
  font-size: 13.5px;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 14px;
}
.login-card input[type=email]:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.login-card .login-btn {
  width: 100%;
  background: var(--blue);
  color: #1a1b26;
  border: none;
  padding: 11px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .12s;
}
.login-card .login-btn:hover { background: #93b6fb; }
.login-card .alert {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 10px 12px;
  border-radius: 5px;
  margin: 12px 0 16px 0;
  line-height: 1.5;
}
.login-card .alert-success {
  background: rgba(158, 206, 106, 0.08);
  color: var(--green);
  border: 1px solid rgba(158, 206, 106, 0.30);
}
.login-card .alert-error {
  background: rgba(247, 118, 142, 0.08);
  color: var(--pink);
  border: 1px solid rgba(247, 118, 142, 0.30);
}

/* ----- Bar list (used on AI Traffic tab) ----- */
.bar-list { display: flex; flex-direction: column; gap: 6px; }
.bar-list .bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 3fr auto;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  padding: 4px 0;
}
.bar-list .bar-row .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); }
.bar-list .bar-row .track {
  height: 6px;
  background: var(--surf1);
  border-radius: 3px;
  overflow: hidden;
}
.bar-list .bar-row .fill {
  height: 100%;
  background: var(--brand);
  border-radius: 3px;
}
.bar-list .bar-row .count { color: var(--cyan); font-variant-numeric: tabular-nums; }

/* ----- Chart wrapper ----- */
.chart-wrap { position: relative; height: 280px; width: 100%; }
.chart-wrap-sm { position: relative; height: 180px; width: 100%; }

/* ----- Grid layouts ----- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ----- Empty state ----- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--mute);
  font-size: 13px;
  font-style: italic;
}
.panel-empty { text-align: center; padding: 60px 20px; color: var(--mute); }

/* ----- Section title (with icon dot) ----- */
.section-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title .icon { color: var(--brand); }
.section-sub { color: var(--mute); font-size: 12px; font-weight: 400; margin-left: 8px; }
.muted { color: var(--mute); font-size: 12px; }

/* ==========================================================================
   NEW COMPONENTS — Pull-quote, Platform grid, Fanout legend, Tone chips,
   Citation row, Collapsible, Framing quote, Citation row, Recent row.
   ========================================================================== */

/* ---- Pull-quote hero (Framing tab) ---- */
.pull-quote {
  position: relative;
  padding: 36px 32px 28px 32px;
  background: linear-gradient(135deg,
    rgba(122, 162, 247, 0.08) 0%,
    rgba(187, 154, 247, 0.10) 50%,
    rgba(247, 118, 142, 0.06) 100%);
  border: 1px solid var(--bordr);
  border-left: 3px solid var(--purp);
  border-radius: var(--r-md);
}
.pull-quote-mark {
  position: absolute;
  top: 6px; left: 14px;
  font-size: 56px;
  line-height: 1;
  color: var(--purp);
  opacity: 0.4;
  font-family: 'IBM Plex Mono', serif;
  font-weight: 700;
}
.pull-quote-text {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 18px;
  line-height: 1.55;
  color: var(--text);
  font-weight: 400;
  font-style: italic;
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 0 16px 0;
  letter-spacing: -0.2px;
}
.pull-quote-attr {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- Platform grid (Overview) ---- */
.platform-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 640px) { .platform-grid { grid-template-columns: 1fr; } }
.platform-tile {
  padding: 14px 16px;
  background: var(--surf1);
  border: 1px solid var(--bordr);
  border-radius: 8px;
  transition: border-color .12s, transform .12s;
  position: relative;
}
.platform-tile:hover {
  border-color: var(--surf3);
  transform: translateY(-1px);
}
.platform-tile.empty { opacity: 0.55; }
.platform-tile.has-data { border-color: var(--brand); background: var(--brand-soft); }
.platform-tile-name {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--mute);
  margin-bottom: 4px;
}
.platform-tile-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}
.platform-tile.has-data .platform-tile-num { color: var(--brand); }
.platform-tile-sub {
  font-size: 11px;
  color: var(--mute);
  margin-top: 4px;
}
.platform-tile-bar {
  margin-top: 10px;
  height: 4px;
  background: var(--base);
  border-radius: 2px;
  overflow: hidden;
}
.platform-tile-bar > div {
  height: 100%;
  border-radius: 2px;
  transition: width .4s ease;
}

/* ---- Fanout legend ---- */
.fanout-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 768px) { .fanout-legend { grid-template-columns: 1fr; } }
.fanout-legend-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surf1);
  border: 1px solid var(--bordr);
  border-radius: 6px;
}
.fanout-legend-item.is-focus {
  background: rgba(187, 154, 247, 0.08);
  border-color: var(--purp);
  box-shadow: 0 0 0 1px var(--purp) inset;
}
.fanout-legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.fanout-legend-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}
.fanout-legend-def {
  font-size: 11px;
  color: var(--mute);
  margin-top: 2px;
  line-height: 1.45;
}

/* ---- Fanout type chip ---- */
.fanout-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

/* ---- Tone chip cloud ---- */
.tone-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid var(--bordr);
}
.tone-chip-name { color: inherit; }
.tone-chip-count {
  font-variant-numeric: tabular-nums;
  opacity: 0.65;
  font-size: 11px;
}

/* ---- Citation row (Overview recent-citation preview) ---- */
.cite-row {
  padding: 10px 12px;
  background: var(--surf1);
  border: 1px solid var(--bordr);
  border-radius: 6px;
  transition: border-color .12s;
}
.cite-row:hover { border-color: var(--surf3); }
.cite-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.cite-row-date {
  font-size: 11px;
  color: var(--mute);
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.cite-row-query {
  font-size: 12.5px;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.45;
  font-weight: 500;
}
.cite-row-url {
  font-size: 11px;
  color: var(--cyan);
  font-family: 'JetBrains Mono', monospace;
  text-decoration: none;
  word-break: break-all;
}
.cite-row-url:hover { color: var(--brand); text-decoration: underline; }

/* ---- Collapsible details ---- */
.collapsible { padding: 0; }
.collapsible > summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  position: relative;
}
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible > summary::before {
  content: "▶";
  font-size: 9px;
  color: var(--mute);
  transition: transform .15s;
  display: inline-block;
}
.collapsible[open] > summary::before { transform: rotate(90deg); }
.collapsible[open] > summary {
  border-bottom: 1px solid var(--bordr);
  margin-bottom: 14px;
}
.collapsible > summary h2 { margin: 0; }
.collapsible > summary .muted { color: var(--mute); font-size: 12px; font-weight: 400; }
.collapsible > .h2-sub, .collapsible > table, .collapsible > div:not(.h2-sub) {
  margin-left: 22px; margin-right: 22px; margin-bottom: 16px;
}
.collapsible > .h2-sub:first-of-type { margin-top: 10px; }

/* ---- Framing quote card ---- */
.framing-quote {
  padding: 14px 16px;
  background: var(--surf1);
  border: 1px solid var(--bordr);
  border-left: 3px solid var(--brand);
  border-radius: 6px;
  margin-bottom: 10px;
}
.framing-quote-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.framing-quote-body {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 6px;
  font-style: italic;
}
.framing-quote-query {
  font-size: 11.5px;
  color: var(--mute);
  font-family: 'JetBrains Mono', monospace;
}
.framing-quote-query em {
  color: var(--dim);
  font-style: normal;
}

/* ==========================================================================
   Citation with AI answer — long text block, monospace, IDE tooltip feel
   ========================================================================== */
.cite-answer {
  margin-top: 10px;
  background: var(--base);
  border: 1px solid var(--bordr);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--dim);
  font-family: 'JetBrains Mono', monospace;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 180px;
  overflow: auto;
  position: relative;
}
.cite-answer::before {
  content: "▎ AI RESPONSE";
  position: sticky;
  top: 0;
  display: block;
  font-size: 9.5px;
  letter-spacing: 0.8px;
  font-weight: 700;
  color: var(--mute);
  text-transform: uppercase;
  margin: -10px -12px 8px -12px;
  padding: 6px 12px;
  background: var(--mantl);
  border-bottom: 1px solid var(--bordr);
}
.cite-answer mark {
  background: rgba(224, 175, 104, 0.25);
  color: var(--yell);
  padding: 1px 3px;
  border-radius: 2px;
  font-weight: 600;
}

/* Citation answer row (Citations tab) */
.cite-answer-row > summary::-webkit-details-marker { display: none; }
.cite-answer-row > summary::marker { content: ""; }
.cite-answer-row > summary:hover .cite-row-url { color: var(--brand); }
.cite-answer-row[open] > summary > span:last-child { transform: rotate(90deg); display: inline-block; }
.cite-answer-row > summary > span:last-child { transition: transform .15s; }
.cite-answer-row[open] > summary { padding-bottom: 0; }
