/* =========================================================================
   Academic Summarizer — Editorial-Tech Magazine theme
   Newsreader (display serif) · Geist (body) · JetBrains Mono (meta)
   Default: LIGHT (warm paper).  Dark mode via [data-theme="dark"].

   Faithful port of the Claude Design editorial-tech prototype, plus a
   compatibility layer at the bottom that re-styles every legacy class
   name still used by Django templates (.paper-card, .alert, .breadcrumb,
   .dropdown-menu, .btn-outline-*, .bg-*-subtle, etc.) so that template
   migration can happen wave-by-wave without breakage.
   ========================================================================= */


/* ── 1.  Design tokens ──────────────────────────────────────────────── */

:root {
  /* Light — warm paper */
  --bg:           #FAF8F3;
  --bg-elev:      #FFFFFF;
  --bg-sunk:      #F2EFE8;
  --bg-hover:     #F0EDE5;

  --ink:          #16161C;
  --ink-2:        #3B3B47;
  --ink-3:        #6E6E7C;
  --ink-4:        #9C9CA8;
  --ink-5:        #C9C9D0;

  --rule:         #E5E2D9;
  --rule-2:       #D8D5CA;
  --rule-strong:  #B5B2A5;

  /* accent — violet by default */
  --accent:       oklch(56% 0.21 295);
  --accent-2:     oklch(48% 0.20 295);
  --accent-soft:  oklch(56% 0.21 295 / 0.10);
  --accent-ring:  oklch(56% 0.21 295 / 0.22);
  --accent-ink:   oklch(30% 0.10 295);

  --ok:           oklch(62% 0.16 145);
  --ok-soft:      oklch(62% 0.16 145 / 0.12);
  --warn:         oklch(72% 0.14 75);
  --warn-soft:    oklch(72% 0.14 75 / 0.14);
  --err:          oklch(60% 0.20 25);
  --err-soft:     oklch(60% 0.20 25 / 0.12);

  --radius-xs:   4px;
  --radius-sm:   6px;
  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  22px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 0 rgba(22,22,28,0.04), 0 1px 2px rgba(22,22,28,0.04);
  --shadow-2: 0 4px 14px rgba(22,22,28,0.06), 0 1px 3px rgba(22,22,28,0.04);
  --shadow-3: 0 20px 50px -20px rgba(22,22,28,0.18), 0 8px 20px -8px rgba(22,22,28,0.08);

  --t:    180ms cubic-bezier(.2,.7,.2,1);
  --t-sl: 320ms cubic-bezier(.2,.7,.2,1);

  --serif: "Newsreader", "Source Serif Pro", "Iowan Old Style", Georgia, serif;
  --sans:  "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gap-section: clamp(48px, 7vw, 96px);
  --gap-card: 24px;
  --text-base: 16px;
  --text-lead: 1.05rem;
  --measure: 70ch;
}

[data-theme="dark"] {
  /* Softened palette — Linear/GitHub/Vercel feel, charcoal rather than
     near-black. Easier on the eyes for long-form academic reading.
     Elevation: sunk (inputs) #0F < bg (page) #16 < elev (cards) #1E. */
  --bg:           #16161D;
  --bg-elev:      #1E1E27;
  --bg-sunk:      #0F0F14;
  --bg-hover:     #24242E;

  --ink:          #E8E8EB;
  --ink-2:        #B4B4BD;
  --ink-3:        #8B8B96;
  --ink-4:        #65656E;
  --ink-5:        #4A4A52;

  --rule:         #2E2E38;
  --rule-2:       #383844;
  --rule-strong:  #484854;

  --accent:       oklch(70% 0.20 295);
  --accent-2:     oklch(78% 0.18 295);
  --accent-soft:  oklch(70% 0.20 295 / 0.16);
  --accent-ring:  oklch(70% 0.20 295 / 0.30);
  --accent-ink:   oklch(85% 0.10 295);

  /* Softer shadows — lifted black, not flat black */
  --shadow-1: 0 1px 0 rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-2: 0 4px 18px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.3);
  --shadow-3: 0 20px 60px -20px rgba(0,0,0,0.6), 0 8px 24px -8px rgba(0,0,0,0.4);
}


/* ── 2.  Base reset ─────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  background: var(--bg);
  color: var(--ink);
  scroll-behavior: smooth;
}
body {
  font-family: var(--sans);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }

img, svg { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; transition: color 0.2s ease; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; cursor: pointer; background: none; border: 0; color: inherit; transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease; }
::selection { background: var(--accent-soft); color: var(--ink); }

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-ring);
  border-radius: var(--radius-xs);
}
.btn:focus, .form-control:focus, .form-select:focus, .chip:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-ring) !important;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.012em;
  line-height: 1.08;
  margin: 0;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: clamp(2.4rem, 5.6vw, 4.6rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.6rem); letter-spacing: -0.014em; }
h3 { font-size: clamp(1.2rem, 1.8vw, 1.5rem); letter-spacing: -0.006em; }
h4 { font-size: 1.05rem; letter-spacing: 0; font-weight: 600; }
p  { margin: 0 0 1em; text-wrap: pretty; }

.container { width: min(1240px, 100% - 48px); margin: 0 auto; }
.container-narrow { width: min(920px, 100% - 48px); margin: 0 auto; }


/* ── 3.  Typography utilities ───────────────────────────────────────── */

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.label-cap {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}
.mono   { font-family: var(--mono); }
.serif  { font-family: var(--serif); }
.dim    { color: var(--ink-3); }
.dimmer { color: var(--ink-4); }

.dropcap::first-letter,
.has-dropcap p:first-of-type::first-letter {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 4.4em;
  line-height: 0.84;
  float: left;
  padding: 4px 0.1em 0 0;
  color: var(--accent-2);
}
[data-theme="dark"] .dropcap::first-letter,
[data-theme="dark"] .has-dropcap p:first-of-type::first-letter {
  color: var(--accent);
  text-shadow: 0 0 25px var(--accent-ring);
}

.lead {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.15rem, 1.6vw, 1.45rem);
  line-height: 1.42;
  color: var(--ink-2);
  letter-spacing: -0.005em;
  text-wrap: pretty;
}

.hairline        { height: 1px; background: var(--rule); border: 0; margin: 0; }
.hairline-strong { height: 1px; background: var(--rule-strong); border: 0; margin: 0; }


/* ── 4.  Status pill ────────────────────────────────────────────────── */

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  line-height: 1;
}
.pill .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4);
  flex: 0 0 auto;
}
.pill.is-ok { color: color-mix(in oklch, var(--ok), var(--ink) 25%); }
.pill.is-ok .dot { background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse-ok 2.2s ease-out infinite; }
.pill.is-run .dot { background: var(--accent); animation: pulse-a 1.6s ease-out infinite; }
.pill.is-warn { color: color-mix(in oklch, var(--warn), var(--ink) 25%); }
.pill.is-warn .dot { background: var(--warn); }
.pill.is-err { color: color-mix(in oklch, var(--err), var(--ink) 25%); }
.pill.is-err .dot { background: var(--err); }

@keyframes pulse-ok {
  0% { box-shadow: 0 0 0 0 var(--ok-soft); }
  70% { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes pulse-a {
  0% { box-shadow: 0 0 0 0 var(--accent-ring); }
  70% { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}


/* ── 5.  Buttons ────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  transition: background var(--t), color var(--t), border-color var(--t), transform var(--t), box-shadow var(--t);
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.btn:hover  { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: var(--shadow-1);
}
[data-theme="dark"] .btn-primary { color: var(--bg); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); box-shadow: var(--shadow-2); color: white; }
[data-theme="dark"] .btn-primary:hover { color: var(--bg); }

.btn-secondary {
  background: var(--bg-elev);
  color: var(--ink);
  border-color: var(--rule-2);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--rule-strong); color: var(--ink); }

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--ink); }

.btn-danger {
  background: var(--err);
  color: white;
  border-color: var(--err);
}
.btn-danger:hover { background: color-mix(in oklch, var(--err), black 12%); color: white; }

.btn-lg { padding: 14px 22px; font-size: 15px; }
.btn-sm { padding: 7px 12px;  font-size: 13px; }
.btn-block { width: 100%; }

.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 4px;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 500;
}


/* ── 6.  Card ────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.card.hoverable:hover { border-color: var(--rule-strong); box-shadow: var(--shadow-2); }


/* ── 7.  Inputs ─────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.input, .textarea, .form-control, .form-select,
input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="url"], input[type="number"],
textarea, select {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  padding: 11px 14px;
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--ink);
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
.input:focus, .textarea:focus, .form-control:focus, .form-select:focus,
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.input::placeholder,
input::placeholder, textarea::placeholder { color: var(--ink-3); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }


/* ── 8.  Chip (tag) ─────────────────────────────────────────────────── */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 500;
  text-decoration: none;
  transition: background var(--t), border-color var(--t), color var(--t);
  cursor: pointer;
}
.chip:hover { background: var(--bg-hover); color: var(--ink); text-decoration: none; }
.chip.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
[data-theme="dark"] .chip.is-on { color: var(--accent); }


/* ── 9.  Navigation ─────────────────────────────────────────────────── */

.nav {
  position: sticky; top: 0; z-index: 1050;
  background: color-mix(in oklch, var(--bg), transparent 15%);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
  transition: background 0.3s ease, border-color 0.3s ease;
}
.nav-inner {
  display: flex; align-items: center; gap: 24px;
  height: 64px;
}
.nav-brand {
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-decoration: none;
}
.nav-brand:hover { text-decoration: none; color: var(--ink); }
.nav-brand .brand-sub {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  padding-bottom: 2px;
}
.nav-search {
  flex: 1; max-width: 380px;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  color: var(--ink-3);
  font-size: 13.5px;
}
.nav-search input {
  flex: 1; background: none; border: 0; outline: 0; color: var(--ink);
  font: inherit; font-size: 13.5px; padding: 0;
}
.nav-search input::placeholder { color: var(--ink-3); }
.nav-search input:focus { box-shadow: none; background: transparent; }

.nav-links { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-link {
  position: relative;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: color var(--t), background var(--t);
}
.nav-link:hover    { color: var(--ink); background: var(--bg-hover); text-decoration: none; }
.nav-link.is-active{ color: var(--ink); }
.nav-link.is-active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px;
  height: 2px; background: var(--accent); border-radius: 2px 2px 0 0;
}

.icon-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  transition: background var(--t), color var(--t);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-decoration: none;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--ink); text-decoration: none; }

.avatar {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 13px;
  border: 1px solid var(--accent-ring);
  cursor: pointer;
}
[data-theme="dark"] .avatar { color: var(--accent); }


/* ── 10.  Footer ────────────────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--rule);
  margin-top: var(--gap-section);
  padding: 32px 0 48px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.footer-inner { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: center; }
.footer a { color: var(--ink-3); }
.footer a:hover { color: var(--ink); }


/* ── 11.  Page transitions ──────────────────────────────────────────── */

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.page { animation: page-in 320ms cubic-bezier(.2,.7,.2,1) both; }


/* ── 12.  Landing ───────────────────────────────────────────────────── */

.hero {
  padding: clamp(64px, 11vh, 140px) 0 clamp(48px, 8vh, 96px);
  position: relative;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 64px;
  align-items: end;
}
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: 40px; } }

.hero-title {
  font-family: var(--serif);
  font-size: clamp(2.8rem, 7vw, 6rem);
  line-height: 0.96;
  letter-spacing: -0.025em;
  font-weight: 400;
  color: var(--ink);
  text-wrap: balance;
}
.hero-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent-2);
}
[data-theme="dark"] .hero-title em { color: var(--accent); }

.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.hero-meta {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 18px 0;
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 700px) { .hero-meta { grid-template-columns: 1fr; gap: 14px; } }
.hero-meta .cell .k { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.hero-meta .cell .v { font-family: var(--serif); font-size: 22px; color: var(--ink); }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 36px; }
.cta-hint { font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: 0.04em; margin-left: 6px; }

.hero-side {
  border-left: 1px solid var(--rule);
  padding-left: 28px;
  padding-bottom: 8px;
}
.hero-side .quote {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.34;
  color: var(--ink-2);
  margin-bottom: 16px;
}
.hero-side .cite {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

.section { padding: var(--gap-section) 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: 18px;
  margin-bottom: 40px;
}
.section-head h2 { letter-spacing: -0.016em; }
.section-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
}
@media (max-width: 800px) { .steps { grid-template-columns: 1fr; } }
.step {
  padding: 32px 28px 32px 0;
  border-right: 1px solid var(--rule);
  position: relative;
}
.step:last-child { border-right: 0; }
.step + .step { padding-left: 28px; }
@media (max-width: 800px) {
  .step { border-right: 0; border-bottom: 1px solid var(--rule); padding-left: 0 !important; padding-right: 0; }
  .step:last-child { border-bottom: 0; }
}
.step-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.16em;
  margin-bottom: 18px;
}
.step h3 { font-size: 1.35rem; margin-bottom: 8px; }
.step p { color: var(--ink-2); margin: 0; max-width: 38ch; }

.section-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
@media (max-width: 1100px) { .section-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .section-cards { grid-template-columns: 1fr; } }
.sc-cell {
  padding: 24px 22px;
  border-right: 1px solid var(--rule);
}
@media (max-width: 1100px) {
  .sc-cell:nth-child(2n) { border-right: 0; }
  .sc-cell { border-bottom: 1px solid var(--rule); }
  .sc-cell:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 640px)  {
  .sc-cell { border-right: 0; border-bottom: 1px solid var(--rule); }
  .sc-cell:last-child { border-bottom: 0; }
}
.sc-cell:last-child { border-right: 0; }
.sc-num   { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.18em; }
.sc-label { font-family: var(--serif); font-size: 1.25rem; margin: 12px 0 6px; }
.sc-desc  { font-size: 13.5px; color: var(--ink-3); }


/* ── 13.  Auth ──────────────────────────────────────────────────────── */

.auth-wrap {
  min-height: calc(100vh - 64px - 96px);
  display: grid; place-items: center;
  padding: 48px 0 96px;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow-3);
}
.auth-card h1 { font-size: 2rem; margin-bottom: 6px; letter-spacing: -0.018em; }
.auth-tabs {
  display: inline-flex;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  padding: 3px;
  margin-bottom: 28px;
}
.auth-tab {
  padding: 7px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  text-decoration: none;
  transition: color var(--t), background var(--t);
}
.auth-tab:hover    { color: var(--ink); text-decoration: none; }
.auth-tab.is-on    { background: var(--bg-elev); color: var(--ink); box-shadow: var(--shadow-1); }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-4);
  letter-spacing: 0.18em; text-transform: uppercase;
  margin: 22px 0 18px;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--rule);
}


/* ── 14.  Upload ────────────────────────────────────────────────────── */

.upload-page { padding: 48px 0 80px; }
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 48px;
  align-items: start;
}
@media (max-width: 980px) { .upload-grid { grid-template-columns: 1fr; } }

.dropzone {
  position: relative;
  border: 1.5px dashed var(--rule-strong);
  border-radius: var(--radius-lg);
  padding: clamp(40px, 8vw, 80px) 32px;
  text-align: center;
  background: var(--bg-elev);
  transition: border-color var(--t), background var(--t), transform var(--t);
  cursor: pointer;
}
.dropzone.is-drag, .dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.005);
}
.dropzone.has-file {
  border-style: solid;
  border-color: var(--accent);
  background: var(--bg-elev);
  padding: 32px;
  text-align: left;
}
.dropzone-icon {
  width: 56px; height: 56px;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}
.dropzone h3 { font-family: var(--serif); font-weight: 500; font-size: 1.5rem; margin-bottom: 8px; }
.dropzone p { color: var(--ink-3); margin: 0; }

.file-row { display: flex; align-items: center; gap: 16px; }
.file-thumb {
  width: 56px; height: 72px;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
}
.file-thumb::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, transparent 22%, var(--rule) 22%, var(--rule) 23%, transparent 23%) 0 0/100% 8px,
    var(--bg-sunk);
  opacity: 0.6;
}
.file-thumb .ext {
  position: relative;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: var(--accent-2);
  font-weight: 600;
  background: var(--bg-elev);
  padding: 2px 5px;
  border-radius: 3px;
}
[data-theme="dark"] .file-thumb .ext { color: var(--accent); }

.suggested-tags { display: flex; flex-wrap: wrap; gap: 8px; }

/* File analysis panel (client-side token estimate on upload page) */
.file-analysis {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-elev);
}
.file-analysis-head {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: flex-start;
}
.file-analysis-metrics {
  grid-template-columns: auto auto;
  gap: 4px 14px;
  font-size: 12px;
  min-width: 200px;
}
.side-card { padding: 24px; }
.side-card h4 { font-family: var(--serif); font-weight: 500; font-size: 1.1rem; letter-spacing: -0.006em; margin-bottom: 14px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; font-size: 13px; }
.kv .k { font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: 0.08em; text-transform: uppercase; align-self: center; }
.kv .v { text-align: right; color: var(--ink); font-feature-settings: "tnum"; }


/* ── 15.  Loading overlay ───────────────────────────────────────────── */

.loading-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: color-mix(in oklch, var(--bg), transparent 4%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center;
  animation: fade-in 240ms ease both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.loading-card {
  width: min(560px, calc(100% - 48px));
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius-xl);
  padding: 40px 40px 32px;
  box-shadow: var(--shadow-3);
}
.loading-title {
  font-family: var(--serif);
  font-size: 1.6rem;
  letter-spacing: -0.012em;
  margin-bottom: 6px;
}
.loading-sub { color: var(--ink-3); font-size: 14px; margin-bottom: 28px; }
.loading-steps { display: flex; flex-direction: column; gap: 0; }
.loading-step {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  transition: color var(--t);
  color: var(--ink-4);
}
.loading-step:last-child { border-bottom: 0; }
.loading-step.is-active { color: var(--ink); }
.loading-step.is-done   { color: var(--ink-2); }
.step-bullet {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--rule-strong);
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 10px; color: var(--ink-3);
  transition: all var(--t);
  background: var(--bg-elev);
}
.loading-step.is-active .step-bullet { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.loading-step.is-done .step-bullet   { border-color: var(--accent); color: white; background: var(--accent); }
[data-theme="dark"] .loading-step.is-done .step-bullet { color: var(--bg); }
.step-label { font-family: var(--sans); font-size: 14.5px; font-weight: 500; }
.step-detail { font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: 0.04em; }
.step-state {
  font-family: var(--mono); font-size: 10.5px;
  color: var(--ink-4); letter-spacing: 0.08em;
}

.progress-track {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--bg-sunk);
  overflow: hidden;
  margin: 24px 0 14px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 600ms cubic-bezier(.6, 0, .2, 1);
}
.progress-meta {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-3);
  letter-spacing: 0.08em;
}


/* ── 16.  Summary detail ────────────────────────────────────────────── */

.summary-page { padding: 36px 0 80px; }
.summary-grid {
  display: grid;
  grid-template-columns: 220px 1fr 280px;
  gap: 56px;
  align-items: start;
}
@media (max-width: 1080px) {
  .summary-grid { grid-template-columns: 1fr; gap: 32px; }
  .summary-aside, .summary-meta { display: none !important; }
}

.summary-aside {
  position: sticky; top: 88px;
  align-self: start;
}
.summary-toc { display: flex; flex-direction: column; gap: 2px; }
.toc-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ink-3);
  text-decoration: none;
  transition: color var(--t), background var(--t), transform var(--t);
  font-weight: 500;
  cursor: pointer;
}
.toc-item:hover { color: var(--ink); background: var(--bg-hover); text-decoration: none; }
.toc-item.is-on { color: var(--ink); background: var(--bg-hover); transform: scale(1.05); }
.toc-item.is-on .toc-bar { background: var(--accent); }
.toc-bar {
  width: 2px; height: 16px; border-radius: 1px;
  background: var(--rule-2); transition: background var(--t);
  flex: 0 0 auto;
}
.toc-num { font-family: var(--mono); font-size: 10px; color: var(--ink-4); letter-spacing: 0.1em; }

.summary-meta { position: sticky; top: 88px; align-self: start; }

.summary-header {
  padding: 0 0 40px;
  border-bottom: 1px solid var(--rule-strong);
  margin-bottom: 48px;
}
.summary-header h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 3.6vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.018em;
  line-height: 1.06;
  margin: 14px 0 18px;
  text-wrap: balance;
}
.summary-author {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--ink-2);
}
.summary-mono-row {
  display: flex; flex-wrap: wrap; gap: 18px;
  margin-top: 22px;
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-3); letter-spacing: 0.08em;
}
.summary-mono-row .k { color: var(--ink-4); }
.summary-mono-row .v { color: var(--ink-2); margin-left: 6px; }
.summary-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0 24px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.summary-body { max-width: var(--measure); }
.sec {
  padding: 40px 0;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 80px;
}
.sec:first-child { padding-top: 0; }
.sec:last-child { border-bottom: 0; }
.sec-eyebrow {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.sec-eyebrow .num { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.18em; }
.sec-eyebrow .label { font-family: var(--sans); font-weight: 600; font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-3); }
.sec-eyebrow .rule { flex: 1; height: 1px; background: var(--rule); }

.sec h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  letter-spacing: -0.014em;
  margin-bottom: 18px;
}
.sec p {
  font-family: var(--serif);
  font-size: 1.075rem;
  line-height: 1.62;
  color: var(--ink);
  margin-bottom: 1.15em;
  max-width: var(--measure);
}
.sec p:last-child { margin-bottom: 0; }

.key-points {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex; flex-direction: column; gap: 14px;
}
.key-points li {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  font-family: var(--serif);
  font-size: 1.06rem;
  line-height: 1.55;
  color: var(--ink);
  padding-left: 2px;
}
.key-points li .k-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  padding-top: 6px;
  font-feature-settings: "tnum";
}

.pull-quote {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.45rem;
  line-height: 1.32;
  color: var(--ink-2);
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 28px;
  margin: 28px 0;
  max-width: var(--measure);
}
.pull-quote .cite {
  display: block;
  font-family: var(--mono);
  font-style: normal;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 10px;
}

.fn-list { counter-reset: fn; padding: 0; margin: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.fn-list li {
  counter-increment: fn;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  font-family: var(--serif);
  font-size: 0.97rem;
  line-height: 1.5;
  color: var(--ink-2);
}
.fn-list li::before {
  content: "[" counter(fn, decimal-leading-zero) "]";
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.04em;
  padding-top: 4px;
}


/* ── 17.  History (papers list) ─────────────────────────────────────── */

.history-page { padding: 48px 0 80px; }
.history-head {
  display: flex; align-items: end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: 24px;
  margin-bottom: 32px;
}
.history-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.history-shell {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-elev);
}
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.history-table th {
  text-align: left;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-elev);
}
.history-table td {
  padding: 18px 16px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.history-table tr { transition: background var(--t); }
.history-table tbody tr:hover { background: var(--bg-hover); cursor: pointer; }
.history-table tbody tr:last-child td { border-bottom: 0; }
.history-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.25;
  font-weight: 500;
  color: var(--ink);
  display: block;
  margin-bottom: 2px;
  letter-spacing: -0.008em;
  text-decoration: none;
}
.history-title:hover { color: var(--ink); text-decoration: none; }
.history-author {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.25;
}
.history-date { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.04em; font-feature-settings: "tnum"; white-space: nowrap; }
.history-lang {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10.5px;
  color: var(--ink-2); letter-spacing: 0.12em;
  padding: 3px 8px;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
}
.row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 4px;
  justify-content: flex-end;
  opacity: 0.55;
  transition: opacity var(--t);
}
tr:hover .row-actions { opacity: 1; }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }


/* ── 18.  Misc helpers ──────────────────────────────────────────────── */

.stack { display: flex; flex-direction: column; }
.stack-2 > * + * { margin-top: 8px; }
.stack-3 > * + * { margin-top: 14px; }
.stack-4 > * + * { margin-top: 22px; }
.stack-6 > * + * { margin-top: 40px; }

/* "h-row" is the editorial flex-row primitive. It is intentionally NOT
   called .row to avoid clashing with Bootstrap's grid (which existing
   templates use sparingly). Use h-row in new editorial markup. */
.h-row       { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.h-row-tight { display: flex; align-items: center; gap: 6px; }
.spacer      { flex: 1; }

.shortcuts-row {
  display: flex; align-items: center; gap: 18px;
  font-family: var(--mono); font-size: 10.5px;
  color: var(--ink-3); letter-spacing: 0.08em;
}
.shortcuts-row .sc { display: inline-flex; align-items: center; gap: 6px; }


/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--rule-strong); border-color: var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* i18n safety */
.btn, .nav-link, .stat-label {
  min-width: 0;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.stat-card { min-width: 0; }
.h-row { min-width: 0; }


/* =========================================================================
   LEGACY COMPATIBILITY
   Re-implement / neutralise class names still used by Django templates,
   so wave-by-wave migration is non-breaking. Most rules below resolve to
   the editorial primitives above.
   ========================================================================= */

/* ── A. Bootstrap utility overrides (we don't use Bootstrap grid in new
       templates, but legacy templates may still reference these) ─────── */

.text-primary   { color: var(--accent)  !important; }
.text-success   { color: var(--ok)      !important; }
.text-warning   { color: var(--warn)    !important; }
.text-danger    { color: var(--err)     !important; }
.text-muted     { color: var(--ink-3)   !important; }
.text-body      { color: var(--ink)     !important; }
.text-secondary { color: var(--ink-3)   !important; }
.text-center    { text-align: center; }
.text-end       { text-align: right; }

.bg-body-secondary    { background-color: var(--bg-sunk) !important; }
.bg-primary           { background: var(--accent) !important;  color: white; }
.bg-success           { background: var(--ok) !important;      color: white; }
.bg-secondary         { background: var(--bg-sunk) !important; color: var(--ink); }
.bg-primary-subtle    { background: var(--accent-soft) !important; color: var(--accent-ink) !important; }
.bg-success-subtle    { background: var(--ok-soft) !important;     color: color-mix(in oklch, var(--ok), var(--ink) 25%) !important; }
.bg-warning-subtle    { background: var(--warn-soft) !important;   color: color-mix(in oklch, var(--warn), var(--ink) 25%) !important; }
.bg-danger-subtle     { background: var(--err-soft) !important;    color: color-mix(in oklch, var(--err), var(--ink) 25%) !important; }
.bg-info-subtle       { background: var(--accent-soft) !important; color: var(--accent-ink) !important; }
.bg-secondary-subtle  { background: var(--bg-sunk) !important;     color: var(--ink-2) !important; }

[data-theme="dark"] .bg-primary-subtle { color: var(--accent) !important; }

.border-top    { border-top: 1px solid var(--rule) !important; }
.border-bottom { border-bottom: 1px solid var(--rule) !important; }

/* Bootstrap rounding utilities map to design radii */
.rounded-2 { border-radius: var(--radius)    !important; }
.rounded-3 { border-radius: var(--radius-lg) !important; }
.rounded-4 { border-radius: var(--radius-xl) !important; }


/* ── B. Bootstrap outline buttons ───────────────────────────────────── */

.btn-outline-primary   { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-outline-primary:hover   { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.btn-outline-secondary { background: transparent; color: var(--ink-2); border: 1px solid var(--rule-2); }
.btn-outline-secondary:hover { background: var(--bg-hover); color: var(--ink); border-color: var(--rule-strong); }
.btn-outline-danger    { background: transparent; color: var(--err); border: 1px solid color-mix(in oklch, var(--err), transparent 60%); }
.btn-outline-danger:hover    { background: var(--err-soft); color: var(--err); border-color: var(--err); }
.btn-outline-warning   { background: transparent; color: var(--warn); border: 1px solid color-mix(in oklch, var(--warn), transparent 60%); }
.btn-outline-warning:hover   { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.btn-light { background: var(--bg-elev); color: var(--ink); border: 1px solid var(--rule-2); }
.btn-link  { background: transparent; color: var(--accent); border: 0; padding: 0; box-shadow: none; }
.btn-link:hover { color: var(--accent-2); transform: none; box-shadow: none; text-decoration: underline; }

.btn-close { background: transparent; border: 0; cursor: pointer; color: var(--ink-3); font-size: 1.1rem; padding: 4px 8px; }
.btn-close:hover { color: var(--ink); }


/* ── C. Alerts ──────────────────────────────────────────────────────── */

.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--ink-2);
  font-size: 14px;
  margin-bottom: 12px;
}
.alert i { flex-shrink: 0; }
.alert-success { background: var(--ok-soft);     border-color: color-mix(in oklch, var(--ok), transparent 70%);   color: color-mix(in oklch, var(--ok), var(--ink) 25%); }
.alert-warning { background: var(--warn-soft);   border-color: color-mix(in oklch, var(--warn), transparent 70%); color: color-mix(in oklch, var(--warn), var(--ink) 25%); }
.alert-danger,
.alert-error   { background: var(--err-soft);    border-color: color-mix(in oklch, var(--err), transparent 70%);  color: color-mix(in oklch, var(--err), var(--ink) 25%); }
.alert-info    { background: var(--accent-soft); border-color: var(--accent-ring); color: var(--accent-ink); }
[data-theme="dark"] .alert-info { color: var(--accent); }


/* ── D. Breadcrumb ──────────────────────────────────────────────────── */

.breadcrumb {
  list-style: none;
  padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.08em;
}
.breadcrumb-item a { color: var(--ink-3); text-decoration: none; }
.breadcrumb-item a:hover { color: var(--accent); text-decoration: none; }
.breadcrumb-item + .breadcrumb-item::before { content: '/ '; color: var(--ink-4); padding-right: 4px; }
.breadcrumb-item.active { color: var(--ink-2); }


/* ── E. Pagination ──────────────────────────────────────────────────── */

.pagination { display: inline-flex; gap: 4px; list-style: none; padding: 0; margin: 0; }
.page-item .page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px;
  border: 1px solid var(--rule-2);
  background: var(--bg-elev);
  color: var(--ink-2);
  border-radius: var(--radius-xs);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
  transition: all var(--t);
}
.page-item .page-link:hover {
  background: var(--bg-hover);
  color: var(--ink);
  border-color: var(--rule-strong);
  text-decoration: none;
}
.page-item.active .page-link {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
[data-theme="dark"] .page-item.active .page-link { color: var(--bg); }


/* ── F. Dropdown menu (Bootstrap-driven) ────────────────────────────── */

.dropdown-menu {
  background: var(--bg-elev) !important;
  border: 1px solid var(--rule) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-2);
  padding: 4px;
  min-width: 200px;
  font-size: 13.5px;
}
.dropdown-item {
  color: var(--ink-2) !important;
  font-size: 13.5px;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  display: flex; align-items: center; gap: 8px;
}
.dropdown-item:hover  { background: var(--bg-hover) !important; color: var(--ink) !important; }
.dropdown-divider     { border-color: var(--rule) !important; margin: 4px 0; }
.dropdown-item.disabled, .dropdown-item:disabled { opacity: 0.7; pointer-events: none; }


/* ── G. Toasts ──────────────────────────────────────────────────────── */

.toast-container {
  position: fixed; top: 84px; right: 24px;
  z-index: 9999; max-width: 380px;
  pointer-events: none;
}
.toast-container .toast { pointer-events: all; margin-bottom: 8px; }
.toast {
  background: var(--bg-elev) !important;
  color: var(--ink) !important;
  border: 1px solid var(--rule) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-2) !important;
}
.toast-header {
  background: transparent !important;
  border-bottom: 1px solid var(--rule) !important;
  color: var(--ink) !important;
  font-family: var(--mono);
  font-size: 12px;
}


/* ── H. Legacy class names from earlier wow-theme (templates use these) ─ */

.paper-card  { /* same look as .card.hoverable */
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
  cursor: pointer;
}
.paper-card:hover { border-color: var(--rule-strong); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.paper-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.05rem;
  line-height: 1.3;
  letter-spacing: -0.008em;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag-badge { /* used by old detail templates */
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--bg-sunk);
  color: var(--ink-2);
  border: 1px solid var(--rule);
  font-size: 12px;
  font-family: var(--sans);
  font-weight: 500;
  text-decoration: none;
}
.tag-badge:hover { background: var(--bg-hover); color: var(--ink); text-decoration: none; }

.lang-badge { /* alias */
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 10.5px;
  color: var(--ink-2); letter-spacing: 0.12em;
  padding: 3px 8px;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
}

.section-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9rem;
  border: 1px solid var(--accent-ring);
}

.citation-item {
  padding: 10px 14px;
  border-left: 2px solid var(--accent);
  background: var(--bg-elev);
  margin-bottom: 6px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-2);
  font-family: var(--serif);
}

.share-link-input {
  font-family: var(--mono) !important;
  font-size: 11.5px !important;
  background: var(--bg-sunk) !important;
  color: var(--ink-2) !important;
  border-color: var(--rule) !important;
}


/* ── I. Status pill alias (older templates render `.status.pulse`) ─── */

.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10.5px;
  color: color-mix(in oklch, var(--ok), var(--ink) 25%);
  letter-spacing: 0.12em; text-transform: uppercase;
}
.status .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
}
.status.pulse .dot { animation: pulse-ok 2.2s ease-out infinite; }


/* ── J. Legacy drop zone helpers ────────────────────────────────────── */

.drop-zone    { /* alias of .dropzone */
  position: relative;
  border: 1.5px dashed var(--rule-strong);
  border-radius: var(--radius-lg);
  padding: clamp(40px, 8vw, 80px) 32px;
  text-align: center;
  background: var(--bg-elev);
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
}
.drop-zone.drag-over, .drop-zone:hover { border-color: var(--accent); background: var(--accent-soft); }
.drop-zone.has-file  { border-style: solid; border-color: var(--accent); padding: 32px; text-align: left; }
.drop-icon { color: var(--ink-3); font-size: 2.2rem; transition: color var(--t); }
.drop-zone:hover .drop-icon { color: var(--accent); }

.file-preview { display: none; align-items: center; gap: 14px; padding: 12px; background: var(--bg-elev); border: 1px solid var(--rule); border-radius: var(--radius); margin-top: 14px; }
.file-preview.visible { display: flex; }


/* ── K. Tag chip variants (upload AI suggestion UI) ─────────────────── */

.tag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--rule);
  background: var(--bg-sunk);
  color: var(--ink-2);
  cursor: pointer;
  transition: all var(--t);
}
.tag-chip:hover { background: var(--bg-hover); color: var(--ink); }
.tag-chip--suggested { background: transparent; border-style: dashed; color: var(--accent-ink); border-color: var(--accent); }
[data-theme="dark"] .tag-chip--suggested { color: var(--accent); }
.tag-chip--suggested.tag-chip--added { opacity: 0.4; cursor: default; }
.tag-chip--selected { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
[data-theme="dark"] .tag-chip--selected { color: var(--accent); }
.tag-chip__remove { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; display: inline-flex; align-items: center; }


/* ── L. Misc legacy progress steps (kept for compatibility) ─────────── */

.progress-steps { display: none; }
.progress-steps.visible { display: block; }


/* ── 18b.  Chat with paper (feature card on summary detail) ─────────── */

.chat-panel {
  margin-top: 40px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-width: var(--measure);
}

.chat-head {
  display: flex; align-items: baseline; gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-elev);
}
.chat-head h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.3rem;
  margin: 0;
  letter-spacing: -0.008em;
}
.chat-head .chat-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.chat-head .spacer { flex: 1; }
.chat-head .chat-clear {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.04em;
  transition: background var(--t), color var(--t);
}
.chat-head .chat-clear:hover { background: var(--bg-hover); color: var(--err); }

/* Empty state with prompt-suggestion chips */
.chat-empty {
  padding: 32px 28px 24px;
  text-align: center;
}
.chat-empty .chat-empty-icon {
  width: 44px; height: 44px;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}
.chat-empty h4 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.15rem;
  margin-bottom: 6px;
  letter-spacing: -0.006em;
}
.chat-empty p {
  color: var(--ink-3);
  font-size: 13.5px;
  margin: 0 0 22px;
}
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

/* Messages list (scrollable) */
.chat-messages {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 540px;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.chat-messages:empty { padding: 0; }

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 88%;
  animation: chat-msg-in 220ms cubic-bezier(.2,.7,.2,1) both;
}
@keyframes chat-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-msg .chat-role {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.chat-msg .chat-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.chat-msg--user {
  align-self: flex-end;
  align-items: flex-end;
}
.chat-msg--user .chat-bubble {
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-top-right-radius: var(--radius-sm);
  font-family: var(--sans);
  color: var(--ink);
}

.chat-msg--assistant {
  align-self: flex-start;
  align-items: flex-start;
  max-width: 100%;
}
.chat-msg--assistant .chat-bubble {
  background: transparent;
  border-left: 2px solid var(--accent);
  border-radius: 0;
  padding: 4px 0 4px 18px;
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.62;
  color: var(--ink);
}

/* Markdown content inside assistant bubbles */
.chat-bubble p { margin: 0 0 0.8em; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble ul, .chat-bubble ol { margin: 0 0 0.8em; padding-left: 1.4em; }
.chat-bubble li { margin-bottom: 4px; }
.chat-bubble li:last-child { margin-bottom: 0; }
.chat-bubble strong { color: var(--ink); font-weight: 600; }
.chat-bubble em { font-style: italic; }
.chat-bubble code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-sunk);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--rule);
}
.chat-bubble pre {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow-x: auto;
  margin: 0 0 0.8em;
}
.chat-bubble pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.chat-bubble blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 12px;
  margin: 0 0 0.8em;
  color: var(--ink-2);
  font-style: italic;
}
.chat-bubble h1, .chat-bubble h2, .chat-bubble h3, .chat-bubble h4 {
  font-family: var(--serif);
  font-weight: 500;
  margin: 0.6em 0 0.3em;
  font-size: 1.05em;
}
.chat-bubble a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.chat-bubble hr { border: 0; border-top: 1px solid var(--rule); margin: 1em 0; }

/* Typing indicator */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
}
.typing-indicator span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.30s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Error state */
.chat-error {
  margin: 0 24px 16px;
  padding: 10px 14px;
  font-size: 13px;
  background: var(--err-soft);
  border: 1px solid color-mix(in oklch, var(--err), transparent 70%);
  color: color-mix(in oklch, var(--err), var(--ink) 25%);
  border-radius: var(--radius);
  display: none;
  align-items: center;
  gap: 8px;
}
.chat-error.is-shown { display: flex; }

/* Input row */
.chat-input {
  display: flex;
  gap: 10px;
  padding: 16px 24px 18px;
  border-top: 1px solid var(--rule);
  background: var(--bg-elev);
  align-items: flex-end;
}
.chat-input textarea {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 200px;
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
  padding: 10px 14px;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  transition: border-color var(--t), box-shadow var(--t);
  overflow-y: auto;
}
.chat-input textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.chat-input .send-btn { flex: 0 0 auto; align-self: flex-end; }
.chat-input .send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.chat-hint {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  padding: 0 24px 14px;
  text-align: right;
}

/* Mobile */
@media (max-width: 700px) {
  .chat-head    { padding: 16px 18px; }
  .chat-empty   { padding: 24px 18px 20px; }
  .chat-messages{ padding: 16px 18px; max-height: 60vh; }
  .chat-input   { padding: 12px 18px 14px; }
  .chat-hint    { padding: 0 18px 12px; }
  .chat-msg     { max-width: 95%; }
}


/* ── 18c.  Citation export (Cite this paper panel) ──────────────────── */

.cite-panel {
  margin-top: 32px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-width: var(--measure);
}

.cite-head {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--rule);
}
.cite-head h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.3rem;
  margin: 0;
  letter-spacing: -0.008em;
}
.cite-head .cite-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 4px;
}

.cite-tabs {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 16px 24px 0;
}
.cite-tabs .chip {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-color: var(--rule);
}

.cite-body {
  padding: 16px 24px 20px;
}

.cite-code {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin: 0 0 14px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  min-height: 86px;
  transition: background var(--t), border-color var(--t);
}
.cite-code .cite-loading {
  color: var(--ink-3);
  font-style: italic;
}
.cite-code.cite-error {
  color: var(--err);
  border-color: var(--err);
}

.cite-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center;
}
.cite-actions .btn.is-copied {
  color: var(--ok);
  border-color: var(--ok);
}

.cite-hint {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  padding: 0 24px 14px;
  text-align: right;
}

/* Mobile */
@media (max-width: 700px) {
  .cite-head     { padding: 16px 18px 12px; }
  .cite-tabs     { padding: 12px 18px 0; }
  .cite-body     { padding: 12px 18px 16px; }
  .cite-hint     { padding: 0 18px 12px; }
  .cite-code     { font-size: 11.5px; padding: 14px 16px; }
}


/* ── 18d.  Language switcher (navbar dropdown) ──────────────────────── */

.lang-btn {
  display: inline-flex; align-items: center; gap: 6px;
  width: auto !important;
  padding: 0 10px 0 8px;
}
.lang-btn .lang-code {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}
.lang-btn:hover .lang-code { color: var(--ink); }

.lang-menu {
  min-width: 220px;
  padding: 6px;
}
.lang-menu .dropdown-item {
  display: inline-flex; align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
}
.lang-menu .dropdown-item:hover,
.lang-menu .dropdown-item:focus {
  background: var(--bg-hover);
}
.lang-menu .dropdown-item.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
[data-theme="dark"] .lang-menu .dropdown-item.active { color: var(--accent); }
.lang-code-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  margin-right: 10px;
  min-width: 30px;
  text-align: center;
}
.lang-menu .dropdown-item.active .lang-code-tag {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}


/* ── 18e.  Smart Dashboard (logged-in home) ─────────────────────────── */

.dash-page { padding: 56px 0 80px; }

.dash-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 32px;
}
.dash-greeting {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -0.012em;
  line-height: 1.1;
  margin: 0;
}
.dash-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  margin-top: 10px;
  text-transform: uppercase;
}

/* Empty state */
.dash-empty {
  padding: 80px 32px;
  text-align: center;
  border-style: dashed;
}

/* Stats strip */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 36px;
}
@media (max-width: 1100px) { .dash-stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .dash-stats { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 160ms ease, transform 160ms ease;
}
.stat-card:hover {
  border-color: var(--rule-strong);
  transform: translateY(-1px);
}
.stat-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.stat-value {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.1;
}
.stat-value .stat-unit {
  font-size: 14px;
  color: var(--ink-3);
  font-weight: 500;
  margin-left: 2px;
}
.stat-foot {
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.35;
}
.stat-langs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.lang-pill {
  display: inline-block;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}

/* Charts grid */
.dash-charts {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 36px;
}
@media (max-width: 1100px) { .dash-charts { grid-template-columns: 1fr 1fr; } .chart-card--wide { grid-column: 1 / -1; } }
@media (max-width: 700px)  { .dash-charts { grid-template-columns: 1fr; } .chart-card--wide { grid-column: auto; } }

.chart-card { padding: 20px 22px; }
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 12px;
}
.chart-head h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: -0.006em;
  margin: 0;
  color: var(--ink);
}
.chart-canvas-wrap {
  position: relative;
  width: 100%;
}

/* Tag cloud */
.dash-cloud { padding: 22px 24px; margin-bottom: 24px; }
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: baseline;
}
.cloud-tag {
  display: inline-block;
  padding: 4px 11px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-2);
  text-decoration: none;
  font-family: var(--sans);
  font-weight: 500;
  line-height: 1.4;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.cloud-tag:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}
.cloud-tag.tier-1 { font-size: 12px;   opacity: 0.78; }
.cloud-tag.tier-2 { font-size: 13.5px; opacity: 0.86; }
.cloud-tag.tier-3 { font-size: 15px;   opacity: 0.92; }
.cloud-tag.tier-4 { font-size: 17px;   font-weight: 600; }
.cloud-tag.tier-5 { font-size: 19px;   font-weight: 600; color: var(--ink); }

/* Timeline */
.dash-timeline { padding: 22px 24px; }
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.timeline-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--rule);
}
.timeline-row:first-child { border-top: none; }
.timeline-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.timeline-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.timeline-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.timeline-title:hover { color: var(--accent); text-decoration: none; }
.timeline-author {
  font-size: 12px;
  color: var(--ink-3);
  font-style: italic;
}

/* ── 20.  Phase 1 Improvements ─────────────────────────────────────── */

/* Reading Progress Bar */
.reading-progress {
  position: fixed; top: 0; left: 0; width: 0%; height: 3px;
  background: var(--accent);
  z-index: 1100;
  transition: width 0.1s ease;
}

/* Command Palette */
.palette-content {
  background: var(--bg-elev) !important;
  border: 1px solid var(--rule) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-3) !important;
  overflow: hidden;
}
.palette-search {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--rule);
}
.palette-search i { color: var(--ink-3); font-size: 1.1rem; }
.palette-search input {
  flex: 1; background: none; border: 0; outline: 0;
  font-family: var(--sans); font-size: 16px; color: var(--ink);
}
.palette-results {
  max-height: 400px; overflow-y: auto; padding: 8px;
}
.palette-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14.5px;
  transition: background var(--t), color var(--t);
  cursor: pointer;
}
.palette-item:hover, .palette-item.is-selected {
  background: var(--bg-hover);
  color: var(--ink);
  text-decoration: none;
}
.palette-item i { font-size: 1.1rem; color: var(--ink-3); transition: color var(--t); }
.palette-item:hover i, .palette-item.is-selected i { color: var(--accent); }
.palette-item .spacer { flex: 1; }
.palette-item .shortcut {
  font-family: var(--mono); font-size: 10px; color: var(--ink-4);
  letter-spacing: 0.05em; text-transform: uppercase;
}

/* Shortcuts Modal */
.shortcuts-content {
  background: var(--bg-elev) !important;
  border: 1px solid var(--rule) !important;
  border-radius: var(--radius-lg) !important;
}
.shortcuts-content .modal-header { border-bottom: 1px solid var(--rule); }
.shortcuts-content .label {
  display: block; font-family: var(--mono); font-size: 10px;
  color: var(--ink-4); letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 12px;
}
.shortcuts-content .row { font-size: 14px; color: var(--ink-2); align-items: center; }

/* Refined Skeleton Loaders */
.skeleton-block {
  height: 12px;
  background: var(--bg-sunk);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  margin-bottom: 10px;
}
.skeleton-block::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--bg-hover), transparent);
  animation: skeleton-shimmer 1.5s infinite;
}
@keyframes skeleton-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.skeleton-block.w-75 { width: 75%; }
.skeleton-block.w-50 { width: 50%; }
.skeleton-block.w-25 { width: 25%; }

.timeline-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
@media (max-width: 640px) {
  .timeline-row { grid-template-columns: 56px 1fr auto; gap: 12px; }
  .timeline-title { font-size: 14.5px; white-space: normal; }
}


/* ── 19.  Reduced motion ────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
