@import url('/css/fonts.css');

/* =========================================================================
   1. Design tokens — change these to reskin the whole app.
   ========================================================================= */
:root {
  /* Paper & ink */
  --bg: #faf7f2;
  --paper: #fffdf8;
  --ink: #1a1410;
  --ink-soft: #3d342b;
  --muted: #7a7066;
  --rule: #e5dfd5;
  --rule-strong: #cfc7b9;

  /* Accent (single, confident) */
  --accent: #c68a2d;
  --accent-ink: #5c3d0f;
  --accent-hover: #a8721f;
  --accent-soft: #f4e6c8;

  /* Status */
  --danger: #a73131;
  --danger-soft: #f3dada;
  --success: #4a6b3e;

  /* Typography */
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --fs-display: clamp(2.75rem, 6.5vw, 5rem);
  --fs-h1: clamp(1.75rem, 3vw, 2.5rem);
  --fs-h2: 1.5rem;
  --fs-lead: 1.1875rem;
  --fs-base: 1rem;
  --fs-sm: 0.875rem;
  --fs-xs: 0.75rem;

  --lh-display: 0.98;
  --lh-heading: 1.15;
  --lh-body: 1.55;

  /* Space */
  --sp-0: 0.25rem;
  --sp-1: 0.5rem;
  --sp-2: 1rem;
  --sp-3: 1.5rem;
  --sp-4: 2rem;
  --sp-5: 3rem;
  --sp-6: 4.5rem;
  --sp-7: 7rem;

  /* Shape */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(26, 20, 16, 0.04);
  --shadow: 0 1px 2px rgba(26, 20, 16, 0.04), 0 6px 20px rgba(26, 20, 16, 0.06);
  --shadow-lg: 0 2px 4px rgba(26, 20, 16, 0.05), 0 20px 60px rgba(26, 20, 16, 0.1);

  /* Layout */
  --max-width: 1180px;
  --reading-width: 660px;
  --gutter: 1.5rem;
}

/* =========================================================================
   2. Reset + base
   ========================================================================= */
*,
*::before,
*::after { box-sizing: border-box; }

/* The `hidden` HTML attribute normally maps to `display: none`, but any
 * explicit `display` declaration overrides it. For elements that toggle
 * via hidden (.btn#admin-link, .btn#upgrade-link), the .btn rule's
 * `display: inline-flex` was leaking them in for everyone. Force hidden
 * to win regardless of selector specificity. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  font-feature-settings: "ss01", "ss02", "cv05";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 450; line-height: var(--lh-heading); letter-spacing: -0.015em; }
p { margin: 0; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

::selection { background: var(--accent-soft); color: var(--ink); }

/* =========================================================================
   3. Layout primitives
   ========================================================================= */
.wrap {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--narrow {
  max-width: calc(var(--reading-width) + var(--gutter) * 2);
}

.rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }
.rule--strong { border-top-color: var(--rule-strong); }

.stack > * + * { margin-top: var(--sp-3); }
.stack--lg > * + * { margin-top: var(--sp-5); }
.stack--sm > * + * { margin-top: var(--sp-2); }

/* =========================================================================
   4. Typography utilities
   ========================================================================= */
.display {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: 340;
  line-height: var(--lh-display);
  letter-spacing: -0.025em;
  font-variation-settings: "opsz" 144, "SOFT" 30;
}
.display em { font-style: italic; font-variation-settings: "opsz" 144, "SOFT" 100; color: var(--ink-soft); }

.h1 { font-size: var(--fs-h1); }
.h2 { font-size: var(--fs-h2); font-weight: 500; }

.lead {
  font-family: var(--font-display);
  font-size: var(--fs-lead);
  font-weight: 350;
  font-variation-settings: "opsz" 60;
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 56ch;
}

.label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.meta {
  font-size: var(--fs-sm);
  color: var(--muted);
}

.prose { max-width: 60ch; line-height: 1.6; }
.prose p + p { margin-top: var(--sp-2); }

/* =========================================================================
   5. Buttons
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.005em;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease, border-color 120ms ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--ink); color: var(--bg); }
.btn--primary:hover { background: var(--ink-soft); }

.btn--accent { background: var(--accent); color: var(--accent-ink); }
.btn--accent:hover { background: var(--accent-hover); color: var(--bg); }

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

.btn--link { padding: 0; color: var(--muted); text-decoration: underline; text-decoration-color: var(--rule-strong); }
.btn--link:hover { color: var(--ink); text-decoration-color: var(--accent); }

.btn--block { width: 100%; }
.btn--lg { padding: 0.95rem 1.5rem; font-size: 1rem; }

.btn[disabled], .btn.is-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* Google icon in the Google button */
.btn .g-icon { width: 18px; height: 18px; flex-shrink: 0; }

/* =========================================================================
   6. Form controls
   ========================================================================= */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.input, .textarea {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 0.8rem 0.95rem;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--ink);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.input:hover, .textarea:hover { border-color: var(--ink-soft); }
.input:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--muted); }

.textarea { resize: none; min-height: 56px; max-height: 240px; font-family: var(--font-body); }

.divider {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--muted);
  font-size: var(--fs-sm);
  margin: var(--sp-2) 0;
}
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }

/* =========================================================================
   7. Cards / surfaces
   ========================================================================= */
.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
}
.card--sm { padding: var(--sp-3); }
.card--lg { padding: var(--sp-5); }

.banner {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  color: var(--accent-ink);
  font-size: var(--fs-sm);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.banner a { color: var(--accent-ink); font-weight: 500; }

.alert {
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
}
.alert--danger { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 20%, transparent); }
.alert--success { background: color-mix(in srgb, var(--success) 12%, var(--bg)); color: var(--success); border: 1px solid color-mix(in srgb, var(--success) 25%, transparent); }

/* =========================================================================
   8. Top bar (shared by chat + upgrade)
   ========================================================================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-block: var(--sp-2);
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 420;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.brand .brand__dash { color: var(--accent); font-weight: 360; }
.brand .brand__tag { font-family: var(--font-mono); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); align-self: center; }

.topbar__right { display: inline-flex; align-items: center; gap: var(--sp-2); }

.counter {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--paper);
}
.counter strong { color: var(--ink); font-weight: 500; }

/* =========================================================================
   9. Landing page
   ========================================================================= */
.landing-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-block: var(--sp-3);
}
.landing-nav a { text-decoration: none; }

.hero {
  padding-top: var(--sp-5);
  padding-bottom: var(--sp-6);
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  gap: var(--sp-5);
  align-items: end;
}

.hero__headline {
  grid-column: 1 / -1;
  margin: 0;
}

.hero__body { display: flex; flex-direction: column; gap: var(--sp-3); }

.hero__meta {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
}
.hero__meta dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1rem; }
.hero__meta dt { font-family: var(--font-mono); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); padding-top: 0.15rem; }
.hero__meta dd { margin: 0; color: var(--ink-soft); }

.hero .pullquote {
  border-left: 2px solid var(--accent);
  padding-left: 1rem;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-style: italic;
  color: var(--ink-soft);
  font-variation-settings: "opsz" 60;
}
.hero .pullquote cite { display: block; margin-top: 0.4rem; font-style: normal; font-size: var(--fs-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-family: var(--font-mono); }

/* Auth block */
.auth {
  padding-block: var(--sp-5);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--sp-5);
  align-items: start;
}
.auth__intro .label { display: block; margin-bottom: var(--sp-1); }
.auth__intro h2 { font-size: var(--fs-h1); font-weight: 380; letter-spacing: -0.02em; margin-bottom: var(--sp-2); }
.auth__card { display: flex; flex-direction: column; gap: var(--sp-2); }

/* Steps */
.steps {
  padding-block: var(--sp-5);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-4);
}
.step__num { font-family: var(--font-mono); color: var(--accent); font-size: var(--fs-sm); letter-spacing: 0.1em; display: block; margin-bottom: var(--sp-1); }
.step h3 { font-size: 1.25rem; font-weight: 440; margin-bottom: var(--sp-1); }
.step p { color: var(--ink-soft); font-size: 0.9375rem; }

/* Footer */
.footer {
  padding-block: var(--sp-4) var(--sp-5);
  color: var(--muted);
  font-size: var(--fs-sm);
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

/* =========================================================================
   10. Chat
   ========================================================================= */
.chat-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.chat-main {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
  padding: var(--sp-4) var(--gutter) 220px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.chat-empty {
  margin-top: var(--sp-5);
  text-align: center;
  color: var(--muted);
}
.chat-empty h2 { font-size: var(--fs-h1); color: var(--ink); font-weight: 380; margin-bottom: var(--sp-1); }
.chat-empty p { max-width: 36ch; margin-inline: auto; }

.msg {
  animation: msg-in 240ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg__role {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.msg--user .msg__role { color: var(--accent-ink); }
.msg--user .msg__body {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--ink-soft);
  padding: 0.8rem 1rem;
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--accent) 15%, transparent);
  border-radius: var(--radius);
  max-width: 75%;
  margin-left: auto;
}
.msg--user { text-align: right; }
.msg--user .msg__role { margin-right: 0.25rem; }

.msg--assistant .msg__body {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 380;
  line-height: 1.55;
  color: var(--ink);
  font-variation-settings: "opsz" 30;
}
.msg--assistant .msg__body strong { font-weight: 500; }
.msg--assistant .msg__body em { color: var(--ink-soft); }

@keyframes msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Typing indicator */
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: typing-pulse 1.1s ease-in-out infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-pulse {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

/* Input dock (sticky) */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, var(--bg) 70%, color-mix(in srgb, var(--bg) 0%, transparent));
  padding: var(--sp-3) var(--gutter) var(--sp-3);
  z-index: 10;
}
.dock__inner { max-width: 760px; margin-inline: auto; display: flex; flex-direction: column; gap: var(--sp-2); }

.dock__nudge { display: none; }
.dock.is-nudging .dock__nudge { display: flex; }

.dock__form {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-1);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.dock__form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dock__form .textarea { border: 0; background: transparent; padding: 0.6rem 0.5rem; min-height: 40px; }
.dock__form .textarea:focus { box-shadow: none; border: 0; }
.dock__send { padding: 0.65rem 1rem; }

.dock__limit {
  display: none;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-lg);
  padding: var(--sp-3);
  text-align: center;
}
.dock.is-limited .dock__form { display: none; }
.dock.is-limited .dock__nudge { display: none; }
.dock.is-limited .dock__limit { display: block; }
.dock__limit h3 { font-size: 1.125rem; font-weight: 460; margin-bottom: var(--sp-1); }
.dock__limit p { color: var(--ink-soft); margin-bottom: var(--sp-2); font-size: var(--fs-sm); }

.kbdhint { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--muted); text-align: right; margin-top: 0.25rem; }

/* =========================================================================
   11. Upgrade page
   ========================================================================= */
.price-hero {
  padding-block: var(--sp-6);
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
  gap: var(--sp-5);
  align-items: start;
}
.price-display { display: flex; align-items: baseline; gap: 0.75rem; }
.price-amount { font-family: var(--font-display); font-size: clamp(3rem, 6vw, 4.5rem); font-weight: 340; letter-spacing: -0.03em; line-height: 1; }
.price-cadence { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }

.currency-toggle { display: inline-flex; gap: 4px; padding: 3px; background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--radius); margin-bottom: var(--sp-3); }
.currency-toggle button { padding: 0.4rem 0.85rem; font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: 0.1em; color: var(--muted); border-radius: var(--radius-sm); transition: background 120ms ease, color 120ms ease; }
.currency-toggle button.is-active { background: var(--ink); color: var(--bg); }

.perks { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--sp-2); }
.perks li { padding-left: 1.75rem; position: relative; font-size: 0.9375rem; }
.perks li::before { content: "→"; position: absolute; left: 0; top: 0.05rem; color: var(--accent); font-family: var(--font-mono); }
.perks strong { font-weight: 500; }

/* =========================================================================
   12. Success page
   ========================================================================= */
.success {
  min-height: 70vh;
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  text-align: center;
}
.success__inner { max-width: 520px; }
.success h1 { font-size: var(--fs-h1); font-weight: 380; margin-bottom: var(--sp-2); }
.success p { color: var(--ink-soft); margin-bottom: var(--sp-3); }

/* =========================================================================
   13. Reveal animation for landing
   ========================================================================= */
.reveal { opacity: 0; transform: translateY(8px); animation: reveal 600ms cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
.reveal-1 { animation-delay: 80ms; }
.reveal-2 { animation-delay: 200ms; }
.reveal-3 { animation-delay: 340ms; }
.reveal-4 { animation-delay: 480ms; }
.reveal-5 { animation-delay: 620ms; }

@keyframes reveal {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .msg, .typing span { animation: none !important; opacity: 1; transform: none; }
}

/* =========================================================================
   14. Responsive
   ========================================================================= */
/* =========================================================================
   15. Admin (internal dashboard)
   ========================================================================= */
.admin-shell { min-height: 100vh; display: flex; flex-direction: column; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-2) var(--gutter); border-bottom: 1px solid var(--rule); background: var(--bg); }
.admin-topbar nav { display: flex; gap: var(--sp-3); align-items: baseline; }
.admin-topbar nav a { text-decoration: none; color: var(--muted); font-size: var(--fs-sm); }
.admin-topbar nav a.is-active, .admin-topbar nav a:hover { color: var(--ink); }

.admin-main { flex: 1; padding: var(--sp-4) var(--gutter); max-width: 1280px; margin-inline: auto; width: 100%; }

.admin-h1 { font-family: var(--font-display); font-size: 1.75rem; font-weight: 400; margin-bottom: var(--sp-3); }
.admin-h2 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 440; margin: var(--sp-4) 0 var(--sp-2); }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-2); }
.kpi { padding: var(--sp-2) var(--sp-3); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); }
.kpi__label { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.kpi__value { font-family: var(--font-display); font-size: 2rem; font-weight: 380; line-height: 1.1; color: var(--ink); margin-top: 2px; }
.kpi__delta { font-size: var(--fs-sm); color: var(--muted); }

.admin-table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; font-size: var(--fs-sm); }
.admin-table th { text-align: left; font-family: var(--font-mono); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 0.65rem 0.9rem; background: var(--bg); border-bottom: 1px solid var(--rule); font-weight: 500; }
.admin-table td { padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tr:hover td { background: color-mix(in srgb, var(--accent-soft) 30%, transparent); cursor: pointer; }
.admin-table a { text-decoration: none; color: var(--ink); }

.pill { display: inline-block; font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.08em; padding: 0.1rem 0.45rem; border-radius: 999px; text-transform: uppercase; }
.pill--paid { background: color-mix(in srgb, var(--accent) 15%, var(--paper)); color: var(--accent-ink); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.pill--free { background: var(--bg); color: var(--muted); border: 1px solid var(--rule); }
.pill--google { background: #eef6ff; color: #1252a3; border: 1px solid #cde2ff; }
.pill--magic { background: var(--bg); color: var(--muted); border: 1px solid var(--rule); }

.admin-search { display: flex; gap: var(--sp-2); align-items: center; margin-bottom: var(--sp-2); }
.admin-search .input { max-width: 360px; }

.pagination { display: flex; gap: var(--sp-1); align-items: center; justify-content: center; margin-top: var(--sp-3); font-size: var(--fs-sm); }
.pagination button { padding: 0.35rem 0.8rem; border: 1px solid var(--rule-strong); background: var(--paper); border-radius: var(--radius-sm); cursor: pointer; }
.pagination button[disabled] { opacity: 0.4; cursor: default; }
.pagination .meta { color: var(--muted); font-family: var(--font-mono); font-size: var(--fs-xs); }

.session-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--sp-1); }
.session-list > li { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.session-list__head { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0.9rem; cursor: pointer; gap: var(--sp-2); }
.session-list__head:hover { background: var(--bg); }
.session-list__body { display: none; padding: 0.75rem 1rem; border-top: 1px solid var(--rule); background: color-mix(in srgb, var(--accent-soft) 20%, var(--paper)); }
.session-list > li.is-open .session-list__body { display: block; }
.session-list__msg { padding: 0.35rem 0; border-bottom: 1px dashed var(--rule); }
.session-list__msg:last-child { border-bottom: 0; }
.session-list__msg .role { display: inline-block; font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-right: 0.4rem; }
.session-list__msg .role--user { color: var(--accent-ink); }

.seg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-3); }
.seg-card { padding: var(--sp-2) var(--sp-3); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); }
.seg-card h3 { font-family: var(--font-mono); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 0 0 var(--sp-1); font-weight: 500; }
.seg-card ol { padding-left: 1.25rem; margin: 0; font-size: var(--fs-sm); }
.seg-card ol li { padding: 0.15rem 0; }
.seg-card .count { color: var(--muted); font-family: var(--font-mono); font-size: 0.8em; }

.tag-bar { display: grid; grid-template-columns: 1fr auto; gap: 0.4rem 0.75rem; align-items: center; margin-bottom: 0.25rem; font-size: var(--fs-sm); }
.tag-bar__name { font-family: var(--font-mono); font-size: 0.8125rem; }
.tag-bar__count { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); text-align: right; }
.tag-bar__track { grid-column: 1 / -1; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.tag-bar__fill { height: 100%; background: var(--accent); }

/* Inline SVG bar chart */
.chart-svg { width: 100%; max-height: 260px; font-family: var(--font-mono); font-size: 10px; }

/* =========================================================================
   16. Responsive
   ========================================================================= */
@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; gap: var(--sp-4); }
  .hero__meta dl { grid-template-columns: 1fr; gap: 0.25rem 0; }
  .hero__meta dt { padding-top: 0.5rem; }
  .auth { grid-template-columns: 1fr; gap: var(--sp-4); }
  .steps { grid-template-columns: 1fr; }
  .price-hero { grid-template-columns: 1fr; gap: var(--sp-4); }
  .msg--user .msg__body { max-width: 85%; }
}
