/* =============================================================================
   Headnote app · calm design system
   Premise: the marketing landing is loud (CRED neoPOP). The work surface is the
   opposite — white, hairline borders, monochrome, generous whitespace. One
   small accent (acid neon) used exactly once: the ✓ on a verified citation.
   ========================================================================== */

:root {
  /* base palette — pure white surface, near-black ink, neutral greys.
     Background is white everywhere (no warm tint) per the consistency audit. */
  --bg:        #ffffff;
  --surface:   #ffffff;
  --ink:       #0c0c0a;
  --ink-2:     #4b4b48;
  --ink-3:     #8a8a82;
  --line:      #e7e7e4;
  --line-2:    #f1f1ef;
  --soft:      #f5f5f4;

  /* one accent, used scarcely */
  --accent:    #d4ff3a;        /* trust signal — verified citations only */
  --warn:      #b7791f;
  --bad:       #9b2c2c;
  --good:      #2d6a2d;
  --navy:      #1e3a5f;        /* the fact-match column tint */

  /* type scale */
  --t-xs:  11px;
  --t-sm:  13px;
  --t-md:  15px;
  --t-lg:  18px;
  --t-xl:  22px;
  --t-2xl: 28px;

  /* layout */
  --sidebar-w: 240px;
  --main-pad:  40px;
  --radius:    6px;
  --radius-lg: 10px;

  /* ---- (formerly gold) — now monochrome ----------------------------------
     The drafting surface used to carry a warm gold signature. Per the
     consistency audit the whole product is one calm monochrome system:
     CTAs are black, surfaces are white/neutral-grey, no warm tint anywhere.
     These tokens are repurposed to neutral values so every existing
     var(--gold*) reference resolves to the monochrome palette in one place. */
  --gold:      #0c0c0a;   /* was gold — now ink (CTA fills / borders) */
  --gold-deep: #000000;   /* was deep gold — now black (borders / hover) */
  --gold-soft: #f5f5f4;   /* was cream — now neutral soft surface */
  --gold-line: #e7e7e4;   /* was gold hairline — now neutral hairline */
  --gold-ink:  #4b4b48;   /* was gold ink — now muted ink text */
  --gold-grad: #0c0c0a;   /* was gold gradient — now solid ink */

  /* Neutral elevation — soft, cool, barely-there depth. Minimal, not heavy. */
  --shadow-card: 0 1px 2px rgba(12, 12, 10, 0.04);
  --shadow-lift: 0 12px 28px -14px rgba(12, 12, 10, 0.18);

  /* One shared motion curve so every lift / fade feels like one system. */
  --ease:   cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 0.16s;
  --t-med:  0.26s;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
  font-size: var(--t-md);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.005em;
}

.mono { font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.skip-link {
  position: absolute; top: -100px; left: 0;
  background: var(--ink); color: var(--surface);
  padding: 8px 16px; z-index: 100;
}
.skip-link:focus { top: 0; }

/* ============================================================================
   App shell
   ============================================================================ */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  min-height: 100dvh;   /* dynamic viewport: no jump as mobile chrome hides */
}

/* ============================================================================
   Sidebar
   ============================================================================ */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 24px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.sidebar__brand .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px;
}
.brand__dot {
  width: 9px; height: 9px;
  background: var(--ink);
  border-radius: 2px;
}
.brand__name {
  font-weight: 700;
  font-size: var(--t-lg);
  letter-spacing: -0.03em;
}

.sidebar__nav {
  display: flex; flex-direction: column;
  gap: 2px;
}
.navitem {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  font-size: var(--t-sm);
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
  letter-spacing: -0.005em;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.navitem:hover {
  background: var(--soft);
  color: var(--ink);
}
.navitem.is-active {
  background: var(--ink);
  color: var(--surface);
}
.navitem.is-active .navicon { color: var(--surface); }
.navitem--soon {
  cursor: not-allowed;
  opacity: 0.55;
}
.navitem--soon:hover { background: transparent; color: var(--ink-2); }
.navicon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: var(--ink-2);
}
.navitem.is-active .navicon { color: var(--surface); }
.badge-soon {
  margin-left: auto;
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--line);
  color: var(--ink-3);
  padding: 2px 6px;
  border-radius: 3px;
}

.sidebar__section {
  display: flex; flex-direction: column;
  gap: 8px;
}
.sidebar__label {
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0 12px;
}

.history {
  display: flex; flex-direction: column;
  gap: 1px;
}
.history-item {
  display: block;
  padding: 7px 12px;
  font-size: 12.5px;
  color: var(--ink-2);
  border-radius: var(--radius);
  cursor: pointer;
  background: transparent;
  border: 0;
  text-align: left;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: inherit;
  letter-spacing: -0.005em;
}
.history-item:hover {
  background: var(--soft);
  color: var(--ink);
}
.history-empty {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--ink-3);
  padding: 8px 12px;
  line-height: 1.4;
}

/* "+ new chat" CTA at the top of the chat list */
.history-newchat {
  display: block;
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 6px;
  background: var(--ink, #1a1814);
  color: var(--bg, #faf8f3);
  border: none;
  border-radius: var(--radius, 6px);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.history-newchat:hover { background: #000; }

/* Chat row = item + delete button */
.history-row {
  display: flex;
  align-items: stretch;
  gap: 2px;
  border-radius: var(--radius, 6px);
  position: relative;
}
.history-row .history-item { flex: 1; min-width: 0; }
.history-row--active { background: var(--soft, #f6f4ee); }
.history-row--active .history-item { color: var(--ink); font-weight: 500; }
.history-del {
  background: transparent;
  border: none;
  color: var(--ink-3, #b4afa3);
  font-size: 16px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: var(--radius, 6px);
  opacity: 0;
  transition: opacity 0.12s;
}
.history-row:hover .history-del,
.history-row--active .history-del { opacity: 1; }
.history-del:hover { color: var(--bad, #c0392b); background: var(--soft); }

.sidebar__footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.footer-link {
  display: block;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--ink-3);
  padding: 4px 12px;
}
.footer-link:hover { color: var(--ink); }

/* Signed-in user card (sidebar footer) ---------------------------------- */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: var(--surface-2, rgba(0,0,0,0.02));
  border: 1px solid var(--line);
}
.sidebar-user[hidden] { display: none; }
.sidebar-user__avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Geist', sans-serif;
  flex: 0 0 auto;
  overflow: hidden;
}
.sidebar-user__avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.sidebar-user__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}
.sidebar-user__name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.sidebar-user__signout {
  background: none;
  border: none;
  padding: 0;
  font-size: 10px;
  color: var(--ink-3);
  cursor: pointer;
  text-align: left;
  font-family: 'Geist Mono', monospace;
  text-transform: lowercase;
  letter-spacing: 0.04em;
}
.sidebar-user__signout:hover { color: var(--accent, var(--ink)); }

/* ============================================================================
   Main content
   ============================================================================ */
.main {
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.view {
  display: none;
  padding: 24px var(--main-pad) 80px;
  max-width: 920px;
  margin: 0 auto;
}
.view.is-active { display: block; }

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.topbar__title {
  font-weight: 600;
  font-size: var(--t-xl);
  letter-spacing: -0.025em;
}
.topbar__hint {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  text-align: right;
}

/* ============================================================================
   Composer (input area)
   ============================================================================ */
.composer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.composer:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(12, 12, 10, 0.05);
}
.composer__inner {
  padding: 18px 20px 14px;
}

.composer__input {
  width: 100%;
  border: 0;
  background: transparent;
  font-family: 'Geist', sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  resize: vertical;
  min-height: 60px;
  letter-spacing: -0.005em;
}
.composer__input:focus { outline: none; }
.composer__input::placeholder { color: var(--ink-3); }

.composer__input--single {
  min-height: 0;
  resize: none;
  padding: 4px 0;
}

.composer__row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
}

.composer__chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.chip-label {
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: 4px;
}
.chip {
  font-family: 'Geist', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: -0.005em;
  transition: all 0.12s ease;
}
.chip:hover {
  border-color: var(--ink-3);
  color: var(--ink);
}
.chip.is-active {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}
.chip-divider {
  width: 1px; height: 18px;
  background: var(--line);
  margin: 0 4px;
}
.chip-input {
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  min-width: 200px;
  letter-spacing: 0;
  font-family: 'Geist Mono', monospace;
}
.chip-input:focus {
  outline: none;
  border-color: var(--ink);
}
.chip-input::placeholder { color: var(--ink-3); }

.composer__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.toggle input { accent-color: var(--ink); }
.toggle__label {
  font-size: 11px;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: var(--t-sm);
  font-weight: 500;
  cursor: pointer;
  letter-spacing: -0.005em;
  transition: all 0.12s ease;
}
.btn:hover { background: var(--soft); }
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn--primary {
  background: var(--ink);
  color: var(--surface);
  font-weight: 600;
  transition: background var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}
.btn--primary:hover {
  background: #1f1f1c;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px -10px rgba(12, 12, 10, 0.45);
}
.btn--primary:active { transform: translateY(0); box-shadow: none; }
.btn--primary:disabled { background: var(--ink-3); border-color: var(--ink-3); color: var(--surface); transform: none; box-shadow: none; }
.btn__icon {
  font-weight: 600;
  transition: transform 0.12s ease;
}
.btn:hover .btn__icon { transform: translateX(2px); }

.composer__mode-display {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 10px;
  letter-spacing: 0.01em;
  min-height: 14px;
}

/* Browse-judgments CTA + inline panel (folded into the Research view).
   The CTA is a quiet full-width affordance below the research results; it
   expands the direct Indian-Kanoon search in place. Monochrome, no accent. */
.browse-cta { margin: 22px 0 0; }
.browse-cta__btn {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px 16px; cursor: pointer; color: var(--ink);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.browse-cta__btn:hover { border-color: var(--ink-3); background: var(--soft); }
.browse-cta__icon { flex: none; width: 20px; height: 20px; color: var(--ink-2); }
.browse-cta__icon svg { width: 100%; height: 100%; }
.browse-cta__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.browse-cta__label { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.browse-cta__hint { font-size: 11px; color: var(--ink-3); }
.browse-cta__chev { flex: none; margin-left: auto; width: 18px; height: 18px; color: var(--ink-3); transition: transform var(--t-med) var(--ease); }
.browse-cta__chev svg { width: 100%; height: 100%; }
.browse-cta__btn[aria-expanded="true"] .browse-cta__chev { transform: rotate(180deg); }
.browse-panel { margin-top: 14px; }
.browse-panel[hidden] { display: none; }

/* Browse form layout */
.browse-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.browse-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
  align-items: center;
}
.browse-filter {
  display: flex;
  align-items: center;
  gap: 6px;
}
.browse-filter__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-right: 2px;
}
.browse-filter__sep { color: var(--ink-3); font-size: 12px; }
.select, .input {
  font-family: 'Geist', sans-serif;
  font-size: 12.5px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}
.select:focus, .input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(12, 12, 10, 0.08);
}
.input--year    { width: 78px;  font-family: 'Geist Mono', monospace; }
.input--judge   { width: 160px; }
.input--statute { width: 200px; }

/* ============================================================================
   Results
   ============================================================================ */
.results { display: flex; flex-direction: column; gap: 16px; }

/* "researching:" transparency panel */
.researching {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.researching__label {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.researching__line {
  display: flex;
  gap: 14px;
  align-items: baseline;
  font-size: 13px;
  line-height: 1.5;
}
.researching__lane {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  color: var(--ink-2);
  flex-shrink: 0;
  width: 88px;
}
.researching__text {
  color: var(--ink);
  flex: 1;
}
.researching.is-loading .researching__text {
  background: linear-gradient(90deg, var(--line-2) 25%, var(--line) 50%, var(--line-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 3px;
  color: transparent;
  height: 16px;
}

/* Progressive stage indicator */
.stages {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 16px;
}
.stages__label {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-transform: capitalize;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.stage {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 12.5px;
  color: var(--ink-3);
  transition: color 0.2s ease;
}
.stage__icon {
  width: 14px; height: 14px;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  color: transparent;
  flex-shrink: 0;
}
.stage__label { letter-spacing: -0.005em; }
.stage--active .stage__icon {
  border-color: var(--ink);
  position: relative;
}
.stage--active .stage__icon::after {
  content: '';
  position: absolute; inset: 2px;
  border: 1.5px solid var(--ink);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spinner 0.8s linear infinite;
}
.stage--active .stage__label { color: var(--ink); font-weight: 500; }
.stage--done .stage__icon {
  background: var(--soft);
  border-color: var(--line);
  color: var(--ink);
}
.stage--done .stage__icon::before { content: '✓'; }
.stage--done .stage__label { color: var(--ink-2); }
@keyframes spinner { to { transform: rotate(360deg); } }

.btn--ghost {
  padding: 4px 10px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-2);
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: 0.005em;
}
.btn--ghost:hover { background: var(--soft); color: var(--ink); }
.btn--ghost.is-active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Bilingual strip for Hindi queries */
.bilingual {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px 14px;
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bilingual__line {
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.bilingual__label {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  min-width: 84px;
}
.bilingual__text { color: var(--ink-2); }
.bilingual__english { color: var(--ink); font-family: 'Geist Mono', monospace; font-size: 12px; }

/* Result header bar */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}
.results-header__count {
  font-size: 13px;
  color: var(--ink-2);
}
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.view-toggle__btn {
  background: var(--surface);
  border: 0;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 11.5px;
  color: var(--ink-3);
  cursor: pointer;
  letter-spacing: 0.005em;
}
.view-toggle__btn:hover { color: var(--ink); }
.view-toggle__btn.is-active {
  background: var(--ink);
  color: var(--surface);
}

/* ============================================================================
   Case card (Perplexity-style)
   ============================================================================ */
.case-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-card);
  transition: transform var(--t-med) var(--ease),
              box-shadow var(--t-med) var(--ease),
              border-color var(--t-fast) var(--ease);
}
.case-card:hover {
  border-color: var(--ink-3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

/* Staggered fade-in as results land — feels alive, not dumped on screen.
   `backwards` (not `both`) so the entrance transform is released afterwards
   and the :hover lift above stays free to animate. */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.results > .case-card { animation: cardIn 0.5s var(--ease) backwards; }
.results > .case-card:nth-child(1) { animation-delay: 0.03s; }
.results > .case-card:nth-child(2) { animation-delay: 0.09s; }
.results > .case-card:nth-child(3) { animation-delay: 0.15s; }
.results > .case-card:nth-child(4) { animation-delay: 0.21s; }
.results > .case-card:nth-child(5) { animation-delay: 0.27s; }
.results > .case-card:nth-child(n+6) { animation-delay: 0.32s; }
@media (prefers-reduced-motion: reduce) {
  .results > .case-card { animation: none; }
}

.case-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.case-card__title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.018em;
  flex: 1;
}
.case-card__title a {
  color: var(--ink);
  border-bottom: 1px dashed var(--line);
}
.case-card__title a:hover {
  border-bottom-color: var(--ink);
}
.case-card__title .ext-arrow {
  margin-left: 4px;
  font-size: 12px;
  color: var(--ink-3);
}
.case-card__meta {
  font-family: 'Geist Mono', monospace;
  font-size: 11.5px;
  color: var(--ink-2);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.case-card__meta span:not(:last-child)::after {
  content: '·';
  margin-left: 8px;
  color: var(--ink-3);
}

.case-card__row {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 14px;
  font-size: 14px;
  line-height: 1.55;
}
.case-card__rowlabel {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.01em;
  text-transform: capitalize;
  padding-top: 2px;
}
.case-card__rowtext { color: var(--ink); }

/* Fact-match row gets the navy tint highlight — the differentiator */
.case-card__row--factmatch .case-card__rowlabel {
  color: var(--navy);
  font-weight: 500;
}
.case-card__row--factmatch .case-card__rowtext {
  color: var(--navy);
  background: rgba(30, 58, 95, 0.04);
  padding: 4px 8px;
  border-radius: 4px;
  border-left: 2px solid var(--navy);
  padding-left: 10px;
}

/* "Reported in" row — the full reporter list a lawyer pastes into a pleading.
   Uses the gold accent (scoped to legal data) with a divider above it so it
   reads as the card's citation footer, not another body row. */
.case-card__row--reported {
  border-top: 1px solid var(--line-2);
  padding-top: 12px;
  margin-top: 2px;
  align-items: start;
}
.case-card__row--reported .case-card__rowlabel { padding-top: 5px; }
.cites {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}
.cite {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  color: var(--ink);
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  padding: 3px 9px;
  border-radius: 5px;
  white-space: nowrap;
}
.cite--primary { color: var(--gold-ink); font-weight: 600; }
.cite--neutral {
  background: var(--soft);
  border-color: var(--line);
  color: var(--ink-2);
}
/* Regional long-tail reporters, revealed by "+N more" — quieter than the
   recognised national reporters so the primaries still lead the eye. */
.cite--minor {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-3);
}
.cite-more {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 5px;
  padding: 3px 8px;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.cite-more:hover { color: var(--ink); border-color: var(--ink-3); }
.cite-more:focus-visible { outline: 2px solid var(--ink-3); outline-offset: 2px; }

/* Progressive research — Tier-1 shell cards (real cases, analysis streaming in).
   Shares .case-card styling; only the pending-analysis area is bespoke. */
.case-card__row--pending .case-card__rowtext {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.analyzing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--gold-ink);
}
.analyzing__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  animation: hnPulse 1s var(--ease) infinite;
}
@keyframes hnPulse { 0%,100% { opacity:.35; transform:scale(.8); } 50% { opacity:1; transform:scale(1.15); } }
.shimmer {
  height: 11px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--line-2) 25%, var(--soft) 37%, var(--line-2) 63%);
  background-size: 400% 100%;
  animation: hnShimmer 1.3s ease infinite;
}
.shimmer--w1 { width: 92%; }
.shimmer--w2 { width: 70%; }
@keyframes hnShimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .analyzing__dot, .shimmer { animation: none; } }
.cite-sep {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  color: var(--ink-3);
}
.cite-copy {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--gold-ink);
  background: transparent;
  border: 1px solid var(--gold-line);
  border-radius: 5px;
  padding: 3px 9px;
  margin-left: 2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease);
}
.cite-copy:hover { background: var(--gold-soft); }
.cite-copy:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; }
.cite-copy.copied {
  background: var(--good);
  color: #fff;
  border-color: var(--good);
}

.case-card__badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink-2);
  letter-spacing: 0.02em;
  text-transform: lowercase;
  border: 1px solid var(--line);
}
.badge--obscure {
  background: rgba(30, 58, 95, 0.06);
  color: var(--navy);
  border-color: rgba(30, 58, 95, 0.15);
}
.badge--famous {
  background: var(--soft);
  color: var(--ink-2);
}
.badge--verified {
  background: #eef3ec;
  color: var(--good);
  border-color: #cfe0c6;
  font-weight: 600;
}
.badge--verified::before {
  content: '✓';
  font-weight: 700;
  color: var(--good);
}
/* Unverified — citation not auto-confirmed against its source. Icon-only,
   muted: the absence of the green tick is the signal; the tooltip carries
   the explanation. Never green — a lawyer must not read it as checked. */
.badge--unverified {
  background: var(--soft);
  color: var(--ink-2);
  border-color: var(--line);
  text-transform: none;
  cursor: help;
  padding: 2px 7px;
}
.badge--unverified::before {
  content: '◌';
  font-weight: 600;
  color: var(--ink-2);
}
/* Fallback-fit strip — the card was kept only to avoid an empty page and is
   NOT an exact match; amber row pinned at the top of the card body. */
.case-card__row--fallback .case-card__rowlabel { color: var(--warn); }
.case-card__row--fallback .case-card__rowtext {
  color: var(--warn);
  background: rgba(183, 121, 31, 0.07);
  border: 1px solid rgba(183, 121, 31, 0.22);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12.5px;
}

/* Best-match pin — the ONE case the backend confirmed as the closest
   authority (source-verified + direct fact parallel + clear margin).
   Ink-emphasis per the monochrome work-surface DS. */
.best-match { margin-bottom: 10px; }
.best-match__label {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 6px;
}
.best-match__star { font-size: 12px; }
.best-match > .case-card {
  border: 1.5px solid var(--ink);
  box-shadow: 0 2px 8px rgba(12, 12, 10, 0.08);
}
.best-match__toggle {
  display: block;
  margin: 4px 0 12px;
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
}
.best-match__rest[hidden] { display: none; }

/* Ask-this-judgment slide-over — grounded Q&A scoped to one judgment. */
.jchat {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(440px, 92vw);
  background: var(--paper, #fff);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 28px rgba(12, 12, 10, 0.10);
  display: flex;
  flex-direction: column;
  z-index: 60;
}
.jchat[hidden] { display: none; }
.jchat__head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.jchat__titlewrap { flex: 1; min-width: 0; }
.jchat__kicker {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.jchat__title { font-size: 14px; font-weight: 600; line-height: 1.35; margin-top: 2px; }
.jchat__title a { color: var(--ink); border-bottom: 1px dashed var(--line); }
.jchat__close {
  border: none; background: none; cursor: pointer;
  font-size: 15px; color: var(--ink-2); padding: 2px 6px;
}
.jchat__close:hover { color: var(--ink); }
.jchat__hint {
  font-size: 12px; color: var(--ink-2);
  padding: 8px 16px; border-bottom: 1px solid var(--line);
  background: var(--soft);
}
.jchat__body { flex: 1; overflow-y: auto; padding: 14px 16px; }
.jchat__q {
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  margin: 12px 0 6px; padding: 8px 10px;
  background: var(--soft); border-radius: 8px;
}
.jchat__a { font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.jchat__a p { margin: 6px 0; }
.jchat__verify {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  margin-top: 8px; padding: 4px 8px;
  border-radius: 6px; display: inline-block;
}
.jchat__verify--ok   { color: var(--good); background: rgba(45, 106, 45, 0.07); border: 1px solid rgba(45, 106, 45, 0.20); }
.jchat__verify--warn { color: var(--warn); background: rgba(183, 121, 31, 0.08); border: 1px solid rgba(183, 121, 31, 0.24); }
.jchat__inputrow {
  display: flex; gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line);
}
.jchat__input {
  flex: 1; resize: none;
  font: inherit; font-size: 13.5px;
  padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px;
}
.jchat__input:focus { outline: none; border-color: var(--ink); }
.jchat__send {
  align-self: flex-end;
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 16px;
  background: var(--ink); color: #fff;
  border: none; border-radius: 8px; cursor: pointer;
}
.jchat__send:disabled { opacity: 0.5; cursor: default; }
.badge--outcome-good { color: var(--good); background: rgba(45, 106, 45, 0.07); border-color: rgba(45, 106, 45, 0.20); font-weight: 600; }
.badge--outcome-bad  { color: var(--bad);  background: rgba(155, 44, 44, 0.07); border-color: rgba(155, 44, 44, 0.20); font-weight: 600; }
.badge--outcome-neutral { color: var(--ink-2); background: var(--soft); border-color: var(--line); }
.badge--treatment-good { color: var(--good); background: rgba(45, 106, 45, 0.07); border-color: rgba(45, 106, 45, 0.15); }
.badge--treatment-bad  { color: var(--bad);  background: rgba(155, 44, 44, 0.07); border-color: rgba(155, 44, 44, 0.15); }
.badge--treatment-warn { color: var(--warn); background: rgba(183, 121, 31, 0.08); border-color: rgba(183, 121, 31, 0.18); }

.judgment-link {
  font-family: 'Geist Mono', monospace;
  font-size: 11.5px;
  color: var(--ink-2);
  border-bottom: 1px dashed var(--line);
}
.judgment-link:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* Official Supreme Court copy — court-accepted source, styled authoritatively */
.badge--official {
  background: rgba(30, 58, 95, 0.08);
  color: var(--navy);
  border-color: rgba(30, 58, 95, 0.22);
  font-weight: 600;
  text-transform: none;
}
.judgment-link--official {
  color: var(--navy);
  font-weight: 600;
  border-bottom: 1px solid rgba(30, 58, 95, 0.35);
  text-transform: none;
}
.judgment-link--official:hover {
  color: var(--navy);
  border-bottom-color: var(--navy);
}

/* ============================================================================
   Comparison table view
   ============================================================================ */
.comparison-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow-x: auto;
}
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.comparison-table th {
  text-align: left;
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.comparison-table th.fact-match-col {
  color: var(--navy);
  background: rgba(30, 58, 95, 0.04);
}
.comparison-table td {
  padding: 14px 16px;
  vertical-align: top;
  border-bottom: 1px solid var(--line-2);
  line-height: 1.5;
}
.comparison-table tr:last-child td { border-bottom: 0; }
.comparison-table td.fact-match {
  background: rgba(30, 58, 95, 0.03);
  color: var(--navy);
  font-weight: 500;
}
.comparison-table .ct-title {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.comparison-table .ct-citation {
  display: block;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
}

/* ============================================================================
   Browse list
   ============================================================================ */
.browse-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.12s ease;
}
.browse-item:hover { border-color: var(--ink-3); }
.browse-item__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.browse-item__title a { color: var(--ink); }
.browse-item__title a:hover { text-decoration: underline; }
.browse-item__meta {
  font-family: 'Geist Mono', monospace;
  font-size: 11.5px;
  color: var(--ink-2);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.browse-item__meta span:not(:last-child)::after { content: '·'; margin-left: 8px; color: var(--ink-3); }
.browse-item__headline {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
}
.browse-item__headline b { color: var(--ink); font-weight: 600; background: rgba(212, 255, 58, 0.4); padding: 0 2px; border-radius: 2px; }
.browse-item__actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.browse-item__action {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.005em;
}
.browse-item__action:hover { background: var(--soft); color: var(--ink); }

.browse-meta {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}
.browse-note {
  font-size: 12px;
  color: var(--warn);
  background: rgba(183, 121, 31, 0.06);
  border-left: 2px solid var(--warn);
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 8px;
}

/* ============================================================================
   States: empty, loading, error
   ============================================================================ */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--ink-2);
}
.empty h2 {
  font-size: var(--t-lg);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 8px;
}
.empty p { font-size: var(--t-sm); max-width: 44ch; margin: 0 auto; }

.loading-cards {
  display: flex; flex-direction: column;
  gap: 16px;
}
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  height: 140px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.skeleton-line {
  background: linear-gradient(90deg, var(--line-2) 25%, var(--line) 50%, var(--line-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 3px;
  height: 14px;
}
.skeleton-line--title { height: 18px; width: 60%; }
.skeleton-line--short { width: 35%; }
.skeleton-line--med   { width: 80%; }

.error-card {
  background: var(--surface);
  border: 1px solid var(--bad);
  border-left: 3px solid var(--bad);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  color: var(--bad);
  font-size: 13px;
}

/* ============================================================================
   Headnote-output (Cri.L.J.-format) — preserved styling for headnote mode
   ============================================================================ */
.headnote-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}
.headnote-block__letter {
  display: inline-block;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  background: var(--ink);
  color: var(--surface);
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}
.headnote-block__catchwords {
  font-family: 'Geist Mono', monospace;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-bottom: 10px;
  letter-spacing: 0.01em;
}
.headnote-block__ratio {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 10px;
}
.headnote-block__quote {
  font-style: italic;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.55;
  border-left: 2px solid var(--line);
  padding-left: 12px;
  margin: 10px 0;
}
.headnote-block__statute {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold-deep, #8c7549);
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}
.headnote-block__carveout {
  font-size: 12.5px;
  color: #b05c00;
  background: #fff8f0;
  border-left: 2px solid #e8a060;
  padding: 6px 10px;
  border-radius: 0 4px 4px 0;
  margin: 8px 0;
}
.headnote-block__anchor {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--ink-4);
  margin-top: 4px;
}
.headnote-block__gist {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
  margin-top: 10px;
}
.headnote-block__grounds {
  margin: 14px 0 4px;
  background: #f2f8f2;
  border: 1px solid #c6dfc6;
  border-radius: 8px;
  padding: 12px 14px;
}
.headnote-block__grounds-label {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #3a7a3a;
  margin-bottom: 8px;
}
.headnote-block__ground {
  font-size: 12.5px;
  color: #1a3a1a;
  line-height: 1.5;
  margin-bottom: 6px;
  padding-left: 10px;
  border-left: 2px solid #8fc88f;
}
.headnote-block__ground:last-child { margin-bottom: 0; }
.headnote-block__cases {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-2);
}

/* ============================================================================
   Digest output (topic mode)
   ============================================================================ */
.digest-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.digest-subhead {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  border-bottom: 1px solid var(--line-2);
  padding-bottom: 6px;
}
.digest-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink);
}
.digest-cases {
  font-family: 'Geist Mono', monospace;
  font-size: 11.5px;
  color: var(--ink-2);
}

/* ============================================================================
   Toasts
   ============================================================================ */
.toasts {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--surface);
  font-size: 12.5px;
  padding: 10px 14px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  max-width: 320px;
  pointer-events: auto;
}
.toast--error { background: var(--bad); }
.toast--success { background: var(--good); }

/* ============================================================================
   Responsive
   ============================================================================ */
/* ============================================================================
   Drafting home — tile grid for the 10 draft types
   Matches the research/browse aesthetic: warm paper background, subtle
   borders, restrained accent. Each tile is a button to keep keyboard
   navigation correct. Grid auto-fills to 1 / 2 / 3 columns based on width.
   ============================================================================ */

.draft-home {
  max-width: 920px;
  margin: 0 auto;
  padding: 8px 0 60px;
}

.draft-prompt {
  text-align: left;
  margin-bottom: 28px;
  padding: 0 4px;
}
.draft-prompt__title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 8px;
  line-height: 1.2;
}
.draft-prompt__sub {
  font-size: var(--t-sm, 14px);
  color: var(--ink-2);
  max-width: 60ch;
  margin: 0;
  line-height: 1.55;
}

/* ✨ Smart Drafter hero CTA — full-width feature card above the template grid. */
.smart-cta {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 22px;
  margin: 0 0 14px;
  background: linear-gradient(135deg, #1a1814 0%, #2a261f 100%);
  color: #faf8f3;
  border-radius: 14px;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 4px 16px rgba(26, 24, 20, 0.18);
}
.smart-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(26, 24, 20, 0.26);
}
.smart-cta__icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(255,255,255,0.15));
}
.smart-cta__body { flex: 1; min-width: 0; }
.smart-cta__title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.smart-cta__sub {
  font-size: 12.5px;
  color: rgba(250, 248, 243, 0.72);
  line-height: 1.45;
}
.smart-cta__arrow {
  font-size: 22px; opacity: 0.7;
  flex-shrink: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.smart-cta:hover .smart-cta__arrow { transform: translateX(4px); opacity: 1; }
@media (max-width: 760px) {
  .smart-cta { padding: 14px 16px; margin-bottom: 18px; gap: 12px; }
  .smart-cta__icon { font-size: 26px; }
  .smart-cta__title { font-size: 14.5px; }
  .smart-cta__sub { font-size: 11.5px; }
  .smart-cta__arrow { font-size: 18px; }
}

/* ============================================================================
   v2 — court-organised drafting home
   Cards rendered by renderCourtCards() in app.js, populated from
   /api/draft/courts. Layout: 5 court cards in a responsive grid,
   followed by a 3-tile procedural mini-rail.
   ============================================================================ */

.persona-nudge {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin: 0 0 22px;
  border: 1px solid #e6d9b8;
  background: linear-gradient(135deg, #fdf8e8, #fffbf0);
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink, #0c0c0a);
  transition: transform 0.15s, box-shadow 0.15s;
}
.persona-nudge:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px -8px rgba(0,0,0,0.1);
}
.persona-nudge__icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink);
  color: #ffffff;
  font-size: 18px;
  flex-shrink: 0;
}
.persona-nudge__body { flex: 1; min-width: 0; }
.persona-nudge__title {
  font-size: 14px; font-weight: 600;
  color: #0c0c0a;
  margin-bottom: 2px;
}
.persona-nudge__sub {
  font-size: 11.5px;
  color: #5d5b54;
  line-height: 1.4;
}
.persona-nudge__arrow {
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
  transition: transform 0.15s;
}
.persona-nudge:hover .persona-nudge__arrow { transform: translateX(3px); }

/* ── Prompt drafter — describe the matter → court-ready draft (one shot) ───── */
.pd {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px 12px;
  margin: 0 0 14px;
  box-shadow: 0 1px 2px rgba(12,12,10,0.03);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pd:focus-within { border-color: var(--ink); box-shadow: 0 2px 14px -6px rgba(12,12,10,0.22); }
.pd__input {
  width: 100%; border: 0; outline: 0; background: none; resize: vertical;
  font-family: inherit; font-size: 15px; line-height: 1.55; color: var(--ink); min-height: 64px;
}
.pd__input::placeholder { color: var(--muted, #6b6960); }
.pd__bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.pd__grow { flex: 1; }
.pd__seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.pd__seg button { border: 0; background: var(--surface); color: var(--muted, #6b6960); font-family: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 12px; cursor: pointer; }
.pd__seg button.on { background: var(--ink); color: var(--surface); }
.pd__seg--sm button { font-size: 11px; padding: 4px 9px; }
/* Attach actions — quiet secondary controls so the ONLY prominent CTA is "Draft it". */
.pd__attach-btn {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  border: 0; background: none; color: var(--muted, #6b6960);
  font-family: inherit; font-size: 13px; font-weight: 500; padding: 5px 4px;
  border-radius: 7px; cursor: pointer; text-decoration: none; transition: color 0.12s, background 0.12s;
}
.pd__attach-btn:hover { color: var(--ink, #0c0c0a); background: rgba(12,12,10,0.04); }
.pd__attach-btn--ref { color: var(--gold-ink, #8c7549); }
.pd__attach-btn--ref:hover { color: var(--gold-deep, #b4894b); background: var(--gold-soft, #faf7ed); }
.pd__voice { color: var(--gold-ink, #8c7549); }
.pd__auto { font-size: 11px; color: var(--muted, #9a988f); white-space: nowrap; opacity: 0.8; }
.pd__btn {
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  font-family: inherit; font-size: 13px; font-weight: 600; padding: 8px 16px; border-radius: 8px; cursor: pointer; transition: filter 0.12s;
}
.pd__btn:hover { filter: brightness(1.35); }
.pd__btn[disabled] { opacity: 0.5; cursor: default; }
.pd__btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line); font-weight: 500; }
.pd__btn--ghost:hover { border-color: var(--ink); filter: none; }
.pd__attached { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

/* Composer CTA row on phones — attach actions become tappable chips that wrap,
   the auto-detect hint sits centered, and "Draft it" is a full-width primary. */
@media (max-width: 560px) {
  .pd { padding: 12px 13px 12px; }
  .pd__bar { flex-wrap: wrap; gap: 8px; }
  .pd__grow { display: none; }
  .pd__attach-btn {
    border: 1px solid var(--gold-line, #ece3c8); background: var(--gold-soft, #faf7ed);
    color: var(--gold-ink, #8c7549); padding: 8px 12px; font-size: 12.5px;
  }
  .pd__auto { flex: 1 1 100%; order: 3; text-align: center; padding: 2px 0; }
  #pd-draft { flex: 1 1 100%; order: 4; padding: 12px; font-size: 14px; text-align: center; }
}
.pd__attached[hidden] { display: none; }
.pd__chip { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; background: var(--gold-soft, #faf7ed); border: 1px solid var(--gold-line, #ece3c8); color: var(--gold-ink, #8c7549); border-radius: 999px; padding: 5px 6px 5px 12px; }
.pd__chip button { border: 0; background: rgba(12,12,10,0.07); color: inherit; width: 18px; height: 18px; border-radius: 50%; cursor: pointer; font-size: 10px; line-height: 1; display: grid; place-items: center; }
.pd__chip button:hover { background: rgba(12,12,10,0.14); }
.pd__attach-note { font-size: 11.5px; color: var(--muted, #6b6960); }
.pd__loading { display: flex; align-items: center; gap: 10px; margin: 6px 2px 16px; color: var(--muted, #6b6960); font-size: 13px; }
.pd__loading[hidden] { display: none; }
.pd__spin { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--gold, #c9a96e); border-radius: 50%; animation: pd-spin 0.7s linear infinite; flex-shrink: 0; }
@keyframes pd-spin { to { transform: rotate(360deg); } }
.pd__err { margin: 6px 2px 16px; background: #fdecec; border: 1px solid #f3c9c9; color: #9a2b2b; border-radius: 10px; padding: 11px 14px; font-size: 13.5px; }
.pd__err[hidden] { display: none; }
.pd-result[hidden] { display: none; }
.pd-result__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.pd-badge { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 4px 10px; border-radius: 999px; font-family: 'Geist Mono', monospace; }
.pd-badge--ok { background: #eef6ef; color: #2c6e34; }
.pd-badge--ai { background: var(--gold-soft, #faf7ed); color: var(--gold-ink, #8c7549); }
.pd-result__type { font-size: 14px; font-weight: 600; }
.pd-result__meta { font-size: 11.5px; color: var(--muted, #6b6960); }
.pd-result__frame { width: 100%; height: 760px; border: 1px solid var(--line); border-radius: 12px; background: #cdccc6; }
.pd-notes { margin-top: 14px; display: grid; gap: 12px; }
.pd-note { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.55; }
.pd-note h4 { margin: 0 0 6px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; font-family: 'Geist Mono', monospace; }
.pd-note ul { margin: 0; padding-left: 18px; } .pd-note li { margin-bottom: 4px; }
.pd-note--cite { background: #fafafa; border-color: var(--line); } .pd-note--cite h4 { color: var(--gold-ink, #8c7549); }
.pd-note--warn { background: #fbf2dc; border-color: #eedfb4; } .pd-note--warn h4 { color: #9a6b00; }
.pd-note--comp h4 { color: var(--muted, #6b6960); }
.pd-note--mirror { background: #fafafa; border-color: var(--line); }
.pd-note--mirror h4 { color: var(--gold-ink, #8c7549); }
.pd-note--mirror p { margin: 0; }
/* ⚠ fact-grounding card — invented/unverified details. Loud on purpose: this is the
   one warning that must never be missed. Red border + tint, matching the inline mark. */
.pd-note--fab { background: #fdf1ef; border-color: #e7b7ad; border-left: 3px solid #c0392b; }
.pd-note--fab h4 { color: #b3341f; }
.pd-note--fab p { margin: 0 0 8px; }
.pd-note--fab mark.fab, mark.fab { background: #fff2c2; border-bottom: 1.5px solid #d99a00; border-radius: 2px; padding: 0 1px; }

/* सुझाव rail — sections check + missing points beside an authored draft.
   Suggestion-only surface: pips carry state, + जोड़ें routes through /refine. */
.pd-note--sug { background: #fafafa; border-color: var(--line); }
.pd-note--sug h4 { color: var(--gold-ink, #8c7549); display: flex; justify-content: space-between; gap: 8px; }
.pd-note--sug h4 .pd-sug-badge { font-weight: 500; color: var(--muted, #6b6960); letter-spacing: 0.05em; }
.pd-sug-row { display: flex; gap: 9px; align-items: flex-start; padding: 6px 0; }
.pd-sug-row + .pd-sug-row { border-top: 1px solid #f0eee8; }
.pd-sug-pip { flex: none; width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; background: var(--ink-3); }
.pd-sug-pip--ok { background: #3d6b4f; }
.pd-sug-pip--flag { background: #b3402a; }
.pd-sug-row small { display: block; color: var(--muted, #6b6960); font-size: 11.5px; margin-top: 1px; }
.pd-sug-add { margin-left: auto; flex: none; font-family: 'Geist Mono', monospace; font-size: 10px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-ink, #8c7549);
  border: 1px solid var(--gold-line, #ece3c8); border-radius: 6px; padding: 2px 8px; background: #fff; cursor: pointer; }
.pd-sug-add:hover { background: var(--gold-ink, #8c7549); color: #fff; border-color: var(--gold-ink, #8c7549); }
.pd-sug-add:disabled { opacity: 0.5; cursor: default; }
.pd-sug-lim { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--gold-line, #ece3c8);
  font-size: 12.5px; color: var(--muted, #6b6960); }

/* Reference-draft chip after selecting a file — gold-outlined so it reads as the
   "match this document's style" affordance (the button itself is quiet in the bar). */
.pd__chip--ref { background: #fff; border-color: var(--gold-deep, #b4894b); color: var(--gold-ink, #8c7549); }
.pd__attach-note--ref { color: var(--gold-ink, #8c7549); max-width: 640px; line-height: 1.5; }

/* ---- Editor discoverability — primary Edit CTA, coach-mark, editability strip, refine panel ---- */
.pd__btn--primary { box-shadow: 0 2px 10px -3px rgba(12,12,10,0.35); }

.pd-edit-wrap { position: relative; display: inline-flex; }
.pd-coach {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 20;
  width: 268px; background: var(--ink, #0c0c0a); color: #f4f2ea;
  border-radius: 10px; padding: 12px 13px; font-size: 12.5px; line-height: 1.5;
  box-shadow: 0 10px 30px -8px rgba(12,12,10,0.45);
}
.pd-coach[hidden] { display: none; }
.pd-coach::before {
  content: ""; position: absolute; top: -6px; right: 26px; width: 12px; height: 12px;
  background: var(--ink, #0c0c0a); transform: rotate(45deg);
}
.pd-coach strong { display: block; margin-bottom: 4px; color: #ffffff; font-size: 13px; }
.pd-coach__x {
  margin-top: 9px; border: 0; background: rgba(255,255,255,0.14); color: #f4f2ea;
  font-family: inherit; font-size: 11.5px; font-weight: 600; padding: 5px 11px;
  border-radius: 7px; cursor: pointer;
}
.pd-coach__x:hover { background: rgba(255,255,255,0.24); }

.pd-editbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 10px 14px;
  background: var(--gold-soft, #faf7ed); border: 1px solid var(--gold-line, #ece3c8);
  border-radius: 10px;
}
.pd-editbar__txt { flex: 1; min-width: 220px; font-size: 12.5px; color: var(--gold-ink, #8c7549); }
.pd-editbar__btn {
  border: 1px solid var(--gold-deep, #b4894b); background: #fff; color: var(--gold-ink, #8c7549);
  font-family: inherit; font-size: 12.5px; font-weight: 600; padding: 7px 13px;
  border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.pd-editbar__btn:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

.pd-refine {
  margin-top: 14px; padding: 14px; border: 1px solid var(--line);
  border-radius: 12px; background: #fafafa;
}
.pd-refine[hidden] { display: none; }
.pd-refine__label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--gold-ink, #8c7549); margin-bottom: 8px; }
.pd-refine__input {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
  font-family: inherit; font-size: 14px; line-height: 1.5; color: var(--ink); resize: vertical; background: #fff;
}
.pd-refine__input::placeholder { color: var(--muted, #6b6960); }
.pd-refine__bar { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.pd-refine__hint { font-size: 11.5px; color: var(--muted, #6b6960); }
@media (max-width: 560px) {
  .pd-edit-wrap { order: 3; }
  .pd-coach { right: auto; left: 0; }
  .pd-coach::before { right: auto; left: 26px; }
}

.draft-section-eyebrow {
  font-size: 11px;
  color: var(--muted, #6b6960);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 30px 0 14px;
  font-weight: 500;
}

/* 5-card court row — responsive grid. Desktop: 5 across. Tablet: 3 across.
   Mobile: 2 across, 1 if very narrow. */
.draft-courts {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
@media (max-width: 1100px) { .draft-courts { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px)  { .draft-courts { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px)  { .draft-courts { grid-template-columns: 1fr; } }

.court-card {
  display: flex; flex-direction: column;
  align-items: flex-start; gap: 6px;
  padding: 16px 16px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  font-family: inherit;
  text-decoration: none;
  color: var(--ink, #0c0c0a);
  min-height: 98px;
}
.court-card:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 6px 18px -10px rgba(12,12,10,0.12);
}
.court-card__name {
  font-size: 14.5px;
  font-weight: 600;
  color: #0c0c0a;
  letter-spacing: -0.01em;
}
.court-card__name-hi {
  font-family: 'Noto Sans Devanagari', 'Geist', sans-serif;
  font-size: 12px;
  color: #5d5b54;
  font-weight: 500;
}
.court-card__count {
  margin-top: auto;
  font-size: 11px;
  color: #8a857a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: 'Geist Mono', monospace;
}
.court-card--empty {
  opacity: 0.55;
  cursor: not-allowed;
}
.court-card--empty:hover {
  transform: none;
  border-color: #e8e3d6;
  box-shadow: none;
}

/* Procedural mini-rail — 3 small tiles. */
.draft-procedural {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 720px) { .draft-procedural { grid-template-columns: 1fr; } }
.procedural-tile {
  display: flex; flex-direction: column; gap: 3px;
  padding: 13px 14px;
  background: var(--bg, #fdfcf9);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink, #0c0c0a);
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}
.procedural-tile:hover {
  background: #fff;
  border-color: var(--line-strong);
}
.procedural-tile__name {
  font-size: 13px; font-weight: 600;
  color: #0c0c0a;
}
.procedural-tile__sub {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: #8a857a;
}

/* Inline search above the grid — filters tiles by name + statute hint.
   Position: relative so the clear-button absolute-anchors inside. */
.draft-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}
.draft-search__icon {
  position: absolute;
  left: 14px;
  width: 16px; height: 16px;
  color: var(--ink-3);
  pointer-events: none;
}
.draft-search__input {
  width: 100%;
  padding: 12px 38px 12px 38px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface, #fff);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.draft-search__input::placeholder { color: var(--ink-3); }
.draft-search__input:focus {
  outline: none;
  border-color: var(--ink-2);
  box-shadow: 0 0 0 3px var(--line-soft, #f4f1ea);
}
.draft-search__clear {
  position: absolute;
  right: 8px;
  width: 24px; height: 24px;
  background: none;
  border: none;
  color: var(--ink-3);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
}
.draft-search__clear:hover { color: var(--ink); background: var(--line-soft, #f4f1ea); }

.draft-empty {
  padding: 28px 0;
  text-align: center;
  color: var(--ink-3);
  font-size: 12px;
}

.draft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

/* Tile hidden by search filter (no display:none — keeps a11y order
   easier to debug). Visibility:hidden + position:absolute would break
   the grid; we just omit them from grid layout. */
.draft-tile[data-hidden="true"] { display: none; }

.draft-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 18px 16px 16px;
  background: var(--surface, #fff);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
  font-family: inherit;
  color: var(--ink);
  min-height: 132px;
}
.draft-tile:hover {
  border-color: var(--ink-3, #999);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.draft-tile:focus-visible {
  outline: 2px solid var(--accent, var(--ink));
  outline-offset: 2px;
}
.draft-tile:active { transform: translateY(0); }

.draft-tile__icon {
  width: 24px; height: 24px;
  color: var(--ink-2);
  flex: 0 0 auto;
}

.draft-tile__name {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink);
  line-height: 1.3;
}

.draft-tile__sub {
  font-size: 11px;
  color: var(--ink-3);
  text-transform: lowercase;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.draft-tile__badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--line-soft, #f4f1ea);
  border: 1px solid var(--line);
  padding: 3px 7px;
  border-radius: 4px;
}

/* "Try now" / live tile — slightly emphasised so the one tile that
   actually works visually pops out of the wall of "soon" placeholders. */
.draft-tile--live { border-color: var(--ink-2, #4a4a4a); }
.draft-tile--live:hover {
  border-color: var(--ink, #1a1a1a);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.draft-tile__badge--live {
  color: var(--paper, #fff);
  background: var(--ink, #1a1a1a);
  border-color: var(--ink, #1a1a1a);
}

.draft-footer {
  padding: 20px 4px;
  border-top: 1px dashed var(--line);
}
.draft-footer__line {
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.6;
  margin: 0 0 6px;
  max-width: 64ch;
}
.draft-footer__hint { color: var(--ink-2); margin-top: 12px; }

/* =============================================================================
   Mobile shell — top bar + bottom nav + slide-out drawer
   Default state: hidden on desktop. Shown when viewport <= 760px.
   ============================================================================= */
.mobnav, .botnav { display: none; }
/* The drawer backdrop hides via its [hidden] attribute (toggled by openDrawer/
   closeDrawer), NOT a blanket display:none — otherwise it can never render to
   catch an outside tap. It only ever opens on mobile, so desktop keeps [hidden]. */
.drawer-backdrop[hidden] { display: none; }

.mobnav {
  position: fixed; top: 0; left: 0; right: 0;
  height: 52px;
  background: var(--bg);
  border-bottom: 1px solid var(--line, #e8e6df);
  z-index: 90;
  padding: 0 8px;
  align-items: center; justify-content: space-between;
}
.mobnav__icon {
  width: 40px; height: 40px;
  border: none; background: transparent;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink, #1a1814); cursor: pointer;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}
.mobnav__icon:active { background: var(--soft, #f6f4ee); }
.mobnav__icon svg { width: 22px; height: 22px; }
.mobnav__brand {
  font-weight: 600; font-size: 16px;
  letter-spacing: -0.01em;
}

.botnav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 60px;
  background: var(--bg);
  border-top: 1px solid var(--line, #e8e6df);
  z-index: 90;
  padding: 4px 4px env(safe-area-inset-bottom);
  align-items: stretch; justify-content: space-around;
}
.botnav__item {
  flex: 1; min-width: 0;
  background: transparent; border: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  padding: 6px 2px;
  font-size: 10.5px; font-weight: 500;
  color: var(--muted, #847e6f);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  text-transform: lowercase;
  letter-spacing: 0.01em;
}
.botnav__item svg { width: 22px; height: 22px; }
.botnav__item.is-active { color: var(--ink, #1a1814); font-weight: 600; }

.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.drawer-backdrop.is-open { opacity: 1; }

/* Tablet breakpoint — keep the icon-only sidebar look */
@media (max-width: 960px) and (min-width: 761px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 76px;
    padding: 16px 8px;
    z-index: 50;
    gap: 16px;
  }
  .sidebar__brand .brand__name,
  .navitem span:not(.badge-soon),
  .sidebar__section,
  .sidebar__footer { display: none; }
  .sidebar__nav { gap: 4px; }
  .navitem {
    justify-content: center;
    padding: 10px;
  }
  .main { margin-left: 76px; }
  :root { --main-pad: 20px; }
  .view { padding-top: 18px; padding-bottom: 60px; }
}

/* Phone breakpoint — full mobile shell */
@media (max-width: 760px) {
  /* Activate mobile chrome */
  .mobnav { display: flex; }
  .botnav { display: flex; }

  /* Sidebar becomes a slide-out drawer (hamburger-controlled) */
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 280px;
    max-width: 85vw;
    padding: 16px 14px 18px;
    z-index: 110;
    gap: 16px;
    background: var(--bg, #faf8f3);
    border-right: 1px solid var(--line, #e8e6df);
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .sidebar.is-open { transform: translateX(0); }

  /* Body offset to clear the fixed top bar and bottom nav */
  .main {
    margin-left: 0;
    padding-top: 52px;
    padding-bottom: 72px;
  }
  :root { --main-pad: 14px; }
  .view { padding-top: 12px; padding-bottom: 12px; }

  /* All sidebar internals visible in drawer mode */
  .sidebar__brand .brand__name,
  .navitem span:not(.badge-soon),
  .sidebar__section,
  .sidebar__footer { display: block; }
  .sidebar__nav { gap: 6px; }
  .navitem { justify-content: flex-start; padding: 10px 12px; }
}

@media (max-width: 760px) {
  .browse-form { grid-template-columns: 1fr; gap: 8px; }
  .input--year { width: 100%; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 4px; }
  .topbar__hint { text-align: left; }
  .case-card__row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .case-card__rowlabel { font-size: 10px; }
  .composer__row { flex-direction: column; align-items: flex-start; }
  .composer__actions { width: 100%; justify-content: space-between; }

  /* Drafting home — mobile: two columns, tighter padding, smaller heading */
  .draft-prompt__title { font-size: 22px; }
  .draft-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
  }
  .draft-tile {
    padding: 14px 12px 12px;
    min-height: 116px;
    gap: 8px;
  }
  .draft-tile__name { font-size: 14px; }
  .draft-tile__sub { font-size: 10px; }
  .draft-tile__badge { font-size: 8px; padding: 2px 5px; top: 8px; right: 8px; }
}

@media (max-width: 480px) {
  .draft-grid { grid-template-columns: 1fr 1fr; }
  .draft-prompt { padding: 0 2px; }
  .draft-prompt__title { font-size: 20px; }
  .draft-prompt__sub { font-size: 13px; }
}


/* =============================================================================
   Auth overlay — full-screen login + onboarding
   Hides the app shell completely until session is resolved (no FOUC).
   ============================================================================= */

/* Hide app shell until auth.js says we're authorised */
body:not(.auth-ready) .shell { display: none !important; }
/* Overlay is visible by default (HTML loads before JS — prevents flash). */
.auth-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 24px;
  opacity: 1;
  transition: opacity 0.25s ease;
}
.auth-overlay.is-hidden {
  opacity: 0; pointer-events: none;
}

/* Soft radial accent in background — subtle, expensive-feeling */
.auth-overlay::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(800px 400px at 20% 0%, rgba(212,255,58,0.06), transparent 60%),
    radial-gradient(600px 400px at 80% 100%, rgba(30,58,95,0.04), transparent 60%);
  pointer-events: none;
}

/* Loading state shown for the ~50-300ms while auth.js decides whether
   to reveal the app or show the login modal. Prevents the flash-of-
   login-modal on every refresh for already-signed-in users. */
.auth-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--ink-2);
}
.auth-loading__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ink);
  animation: auth-loading-pulse 1.2s ease-in-out infinite;
}
.auth-loading__text {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
@keyframes auth-loading-pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.9); }
  50%      { opacity: 0.9;  transform: scale(1.15); }
}

.auth-modal {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 44px 40px 32px;
  width: 100%; max-width: 420px;
  box-shadow:
    0 1px 0 rgba(0,0,0,0.02),
    0 24px 64px rgba(12,12,10,0.10),
    0 4px 16px rgba(12,12,10,0.04);
  display: flex; flex-direction: column; align-items: stretch;
  text-align: center;
  animation: authModalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes authModalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ---- Brand mark at top ---- */
.auth-modal__brand {
  display: inline-flex; align-items: center; gap: 9px;
  align-self: center;
  padding: 6px 12px;
  background: var(--soft);
  border-radius: 100px;
  margin-bottom: 28px;
}
.auth-modal__brand .brand__dot {
  width: 8px; height: 8px;
  background: var(--ink); border-radius: 50%;
  flex-shrink: 0;
}
.auth-modal__brand .brand__name {
  font-size: 13px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink);
}
/* When the brand pill carries the SVG wordmark instead of the dot+name pair,
   keep height in lockstep with the old text size (13px) so the pill geometry
   doesn't shift. width:auto preserves the 5.7:1 aspect ratio. */
.auth-modal__brand-logo {
  height: 14px; width: auto; display: block;
}

/* ---- Title block ---- */
.auth-modal__title {
  font-size: 26px; font-weight: 700; letter-spacing: -0.035em;
  line-height: 1.15; color: var(--ink);
  margin-bottom: 10px;
}
.auth-modal__sub {
  font-size: 14px; color: var(--ink-2);
  margin-bottom: 28px; line-height: 1.5;
  max-width: 320px; margin-left: auto; margin-right: auto;
}

/* ---- Error pill ---- */
.auth-modal__error {
  font-size: 13px; color: var(--bad);
  background: #fef5f5; border: 1px solid #f5d5d5;
  border-radius: 8px; padding: 10px 14px;
  margin-top: 16px; text-align: left; line-height: 1.4;
}

/* ---- Bottom note ---- */
.auth-modal__note {
  font-size: 11px; color: var(--ink-3);
  margin-top: 20px; line-height: 1.5;
  letter-spacing: 0.005em;
}

/* ---- Google sign-in button ---- */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%;
  height: 48px;
  padding: 0 20px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px; font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.1s ease;
}
.btn-google:hover {
  border-color: var(--ink);
  box-shadow: 0 4px 14px rgba(12,12,10,0.08);
}
.btn-google:active {
  transform: translateY(1px);
  box-shadow: 0 2px 6px rgba(12,12,10,0.06);
}
.btn-google:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-google__icon {
  width: 18px; height: 18px; flex-shrink: 0;
}
.btn-google__label { font-weight: 500; }

/* OTPless button: sits below the Google one with 10px gap. Same chrome,
   different icon stroke colour so the two buttons read as siblings. */
.btn-otpless { margin-top: 10px; }
.btn-otpless .btn-google__icon { color: var(--accent, #8c7549); stroke: currentColor; }

/* ---- Trust signals row (login screen only) ---- */
.auth-trust {
  display: flex; gap: 12px; flex-wrap: wrap; justify-content: center;
  margin-top: 24px;
}
.auth-trust__item {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 500;
}
.auth-trust__item::before {
  content: ""; width: 4px; height: 4px;
  background: var(--accent); border-radius: 50%;
}

/* ---- Onboarding form ---- */
.auth-form {
  display: flex; flex-direction: column; gap: 18px;
  text-align: left;
  margin-top: 4px;
}
.auth-form__field {
  display: flex; flex-direction: column; gap: 7px;
}
.auth-form__label {
  font-size: 12px; font-weight: 500; color: var(--ink-2);
  letter-spacing: 0.01em;
}
.auth-form__required { color: var(--bad); margin-left: 2px; }
.auth-form__optional { font-weight: 400; color: var(--ink-3); font-size: 11px; }

.auth-form__input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-family: inherit; font-size: 15px; color: var(--ink);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  letter-spacing: -0.005em;
}
.auth-form__input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(12,12,10,0.06);
}
.auth-form__input--error {
  border-color: var(--bad) !important;
  box-shadow: 0 0 0 3px rgba(155,44,44,0.1) !important;
}
.auth-form__input::placeholder { color: var(--ink-3); }

/* Phone with +91 prefix */
.auth-form__phone-wrap {
  display: flex; align-items: stretch;
  border: 1.5px solid var(--line); border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--surface);
  height: 44px;
}
.auth-form__phone-wrap:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(12,12,10,0.06);
}
.auth-form__prefix {
  display: flex; align-items: center;
  padding: 0 14px;
  font-size: 14px; color: var(--ink-2); font-weight: 600;
  border-right: 1.5px solid var(--line);
  background: var(--soft);
  flex-shrink: 0;
  letter-spacing: -0.005em;
}
.auth-form__input--phone {
  flex: 1;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  height: 100%;
}
.auth-form__input--phone:focus { box-shadow: none !important; }

.auth-field-error {
  font-size: 11px; color: var(--bad); margin-top: 2px; line-height: 1.3;
}

/* ---- Onboarding submit button (Headnote primary, dark) ---- */
.btn-auth-submit {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  height: 48px;
  margin-top: 8px;
  padding: 0 20px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-family: inherit;
  font-size: 15px; font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn-auth-submit:hover {
  background: #1f1f1c;
  box-shadow: 0 6px 16px rgba(12,12,10,0.16);
}
.btn-auth-submit:active { transform: translateY(1px); }
.btn-auth-submit:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-auth-submit__arrow { transition: transform 0.15s ease; }
.btn-auth-submit:hover .btn-auth-submit__arrow { transform: translateX(3px); }

/* Welcome name on onboarding (replaces generic title) */
.auth-welcome-name { color: var(--ink); font-weight: 700; }

/* Mobile */
@media (max-width: 480px) {
  .auth-overlay { padding: 16px; }
  .auth-modal { padding: 32px 24px 24px; border-radius: 14px; }
  .auth-modal__title { font-size: 22px; }
  .auth-modal__sub { font-size: 13px; }
}

/* ============================================================================
 * Entitlements UI — plan badge, usage bar, upgrade modal
 * ========================================================================== */

/* Plan badge in sidebar */
.plan-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  margin: 12px 8px 4px;
  background: #0c0c0a;
  color: #fdfcf9;
  border-radius: 10px;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.plan-badge__label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.plan-badge__upgrade {
  color: #d9c89e;
  text-decoration: none;
  font-weight: 500;
}
.plan-badge__upgrade:hover { color: #fff; }

/* Usage bar (compact, shows quota burndown) */
.usage-bar {
  margin: 0 8px 12px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.03);
  border-radius: 8px;
  font-size: 11px;
  color: #5d5b54;
}
.usage-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}
.usage-row span:last-child {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #0c0c0a;
}

/* Upgrade modal — used when API returns 402 */
.upgrade-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.upgrade-modal.is-open { display: flex; }
.upgrade-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12,12,10,0.5);
  backdrop-filter: blur(4px);
  cursor: pointer;
}
.upgrade-modal__card {
  position: relative;
  width: min(90vw, 440px);
  background: #fdfcf9;
  border-radius: 16px;
  padding: 36px 32px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  text-align: center;
}
.upgrade-modal__close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 28px;
  color: #918d80;
  cursor: pointer;
  line-height: 1;
}
.upgrade-modal__close:hover { color: #0c0c0a; }
.upgrade-modal__icon { font-size: 36px; margin-bottom: 12px; }
.upgrade-modal__title {
  font-size: 22px;
  font-weight: 700;
  color: #0c0c0a;
  margin: 0 0 8px;
}
.upgrade-modal__msg {
  font-size: 14px;
  color: #5d5b54;
  margin: 0 0 20px;
  line-height: 1.5;
}
.upgrade-modal__plan {
  background: rgba(0,0,0,0.04);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}
.upgrade-modal__plan-name {
  font-size: 13px;
  color: #5d5b54;
  margin-bottom: 6px;
}
.upgrade-modal__plan-name span {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  background: #0c0c0a;
  color: #fdfcf9;
  border-radius: 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.upgrade-modal__plan-price {
  font-size: 22px;
  font-weight: 700;
  color: #0c0c0a;
}
.upgrade-modal__cta {
  display: inline-block;
  padding: 12px 24px;
  background: #0c0c0a;
  color: #fdfcf9;
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}
.upgrade-modal__cta:hover { background: #1f1f1c; }

/* ============================================================================
   Personal-assist CTA — "Not satisfied? Our team will help personally."
   Appears below every research response (and on the draft screen).
   Designed to feel warm + premium, not desperate — gold accent + cream panel.
   ============================================================================ */
.assist-cta {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink);
  border-radius: 12px;
  padding: 22px 24px;
  margin: 28px 0 12px;
  font-family: inherit;
}
.assist-cta__head { margin-bottom: 14px; }
.assist-cta__eyebrow {
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.assist-cta__title {
  font-size: 17px;
  font-weight: 600;
  color: #0c0c0a;
  letter-spacing: -0.015em;
  line-height: 1.35;
  margin-bottom: 6px;
}
.assist-cta__sub {
  font-size: 13.5px;
  line-height: 1.55;
  color: #5d5b54;
}

.assist-cta__form { margin-top: 14px; }
.assist-cta__input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  color: #0c0c0a;
  line-height: 1.5;
  resize: vertical;
  min-height: 70px;
  transition: border-color 0.12s, background 0.12s;
}
.assist-cta__input:focus {
  outline: none;
  border-color: var(--ink);
  background: #ffffff;
}
.assist-cta__input::placeholder { color: var(--ink-3); }

.assist-cta__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.assist-cta__sla {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.assist-cta__submit {
  padding: 9px 18px;
  background: var(--ink);
  color: var(--surface);
  border: 1px solid var(--ink);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), transform 0.08s, box-shadow var(--t-fast);
}
.assist-cta__submit:hover:not(:disabled) {
  background: #1f1f1c;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px -10px rgba(12, 12, 10, 0.45);
}
.assist-cta__submit:disabled { opacity: 0.6; cursor: wait; box-shadow: none; }

.assist-cta--sent { background: #f0f7ea; border-color: #cfe0b8; border-left-color: #6b9237; }
.assist-cta__done {
  display: flex;
  align-items: center;
  gap: 14px;
}
@keyframes popIn {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.assist-cta__done-icon {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #6b9237;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  animation: popIn 0.42s var(--ease) both;
}
.assist-cta__done-msg {
  font-size: 14px;
  font-weight: 500;
  color: #2f4d12;
  line-height: 1.45;
}

@media (max-width: 600px) {
  .assist-cta { padding: 18px 16px; margin: 22px 0 8px; }
  .assist-cta__title { font-size: 15.5px; }
  .assist-cta__sub { font-size: 13px; }
  .assist-cta__submit { width: 100%; }
  .assist-cta__row { gap: 8px; }
}

/* ============================================================================
   Saved case-law — the ☆/★ toggle on every result card, and the library view.
   Reuses .btn--ghost, .case-card and .results-header; the gold tokens mark the
   "kept" state so it reads as a deliberate, editorial action (not a generic AI
   bookmark).
   ============================================================================ */

/* Saved state of the card's save toggle — deep-gold, matching the brand accent. */
.case-save-btn.is-saved {
  background: var(--gold-soft);
  border-color: var(--gold-line);
  color: var(--gold-ink);
  font-weight: 500;
}
.case-save-btn.is-saved:hover {
  background: var(--gold-soft);
  color: var(--gold-deep);
}

.saved-loading {
  color: var(--ink-3);
  font-size: 12px;
  padding: 24px 4px;
}

/* In the library, each entry = the re-rendered card + its source query + note. */
.saved-card { margin-bottom: 22px; }

.saved-card__context {
  font-size: 11.5px;
  color: var(--ink-3);
  margin: 6px 2px 0;
  padding-left: 10px;
  border-left: 2px solid var(--gold-line);
  line-height: 1.45;
}

.saved-note {
  margin: 8px 2px 0;
  padding: 10px 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.saved-note__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.saved-note__input {
  width: 100%;
  resize: vertical;
  min-height: 40px;
  font-family: inherit;
  font-size: var(--t-sm);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  box-sizing: border-box;
}
.saved-note__input:focus {
  outline: none;
  border-color: var(--gold);
}
.saved-note__save {
  margin-top: 8px;
}

/* =====================================================================
   ASK MODE — "AI for lawyers" (Claude-calm: literary, serif, minimal chrome)
   The answer breathes on the page. Serif body = the voice; Geist sans = chrome.
   No boxes, no uppercase micro-labels. Gold only on "Draft this".
   ===================================================================== */
:root { --font-read: 'Newsreader', Georgia, 'Times New Roman', serif; }

.view--ask { max-width: 712px; padding-bottom: 0; min-height: calc(100vh - 48px); }
.view--ask.is-active { display: flex; flex-direction: column; }
.topbar--ask { padding-bottom: 14px; margin-bottom: 4px; border-bottom-color: var(--line-2); }

.ask { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.ask__thread { flex: 1 1 auto; display: flex; flex-direction: column; padding: 16px 0 30px; }

/* Empty state — calm, literary greeting */
.ask__empty { margin: auto; text-align: center; max-width: 540px; padding: 6vh 0 3vh; }
.ask-empty__mark { width: 40px; height: 40px; margin: 0 auto 22px; display: flex; align-items: center; justify-content: center; color: var(--ink-3); }
.ask-empty__mark svg { width: 28px; height: 28px; }
.ask-empty__title { font-family: var(--font-read); font-size: 30px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.2; margin: 0 0 12px; color: var(--ink); }
.ask-empty__sub { font-size: 15px; color: var(--ink-2); line-height: 1.6; margin: 0 auto 30px; max-width: 440px; }
.ask-empty__chips { display: flex; flex-direction: column; gap: 0; text-align: left; border-top: 1px solid var(--line-2); }
.ask-chip { font-family: inherit; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); background: transparent; border: none; border-bottom: 1px solid var(--line-2); border-radius: 0; padding: 14px 4px; cursor: pointer; transition: color var(--t-fast) var(--ease), padding var(--t-fast) var(--ease); text-align: left; display: flex; align-items: center; gap: 10px; }
.ask-chip::before { content: '→'; color: var(--ink-3); font-size: 14px; transition: transform var(--t-fast) var(--ease); }
.ask-chip:hover { color: var(--ink); padding-left: 8px; }
.ask-chip:hover::before { transform: translateX(2px); color: var(--ink); }

/* The lawyer's turn — a subtle right-aligned note, not a bubble, not a title */
.askq { align-self: flex-end; max-width: 82%; background: var(--soft); border-radius: 16px; padding: 11px 17px; margin: 34px 0 6px; font-size: 15px; line-height: 1.55; color: var(--ink); }
.askq:first-child { margin-top: 6px; }
.askq__att { color: var(--ink-3); }
.askq .askmsg__files { margin-bottom: 8px; justify-content: flex-end; }
.askmsg__files { display: flex; flex-wrap: wrap; gap: 6px; }
.askmsg__file { display: inline-flex; align-items: center; gap: 6px; font-family: 'Geist Mono', ui-monospace, monospace; font-size: 11px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 4px 9px; }
.askmsg__file svg { width: 13px; height: 13px; }

/* The answer — the star. Serif, roomy, no container. */
.answer { margin: 6px 0 20px; }
.answer__body { font-family: var(--font-read); font-size: 17.5px; line-height: 1.68; color: #26251f; letter-spacing: 0.003em; }
.answer__body > *:first-child { margin-top: 0; }
.answer__body p { margin: 0 0 15px; }
.answer__body p:last-child { margin-bottom: 0; }
.askmd-lead { font-size: 18.5px; line-height: 1.6; color: var(--ink); }
.askmd-h { font-family: var(--font-read); font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); margin: 26px 0 10px; }
.answer__body ul, .answer__body ol { margin: 0 0 15px; padding-left: 24px; }
.answer__body li { margin: 6px 0; padding-left: 2px; }
.answer__body li::marker { color: var(--ink-3); }
.answer__body strong { font-weight: 600; color: var(--ink); }
.askmd-hr { border: 0; border-top: 1px solid var(--line-2); margin: 22px 0; }
.askmd-quote { font-family: var(--font-read); border-left: 2px solid var(--line); padding: 4px 0 4px 18px; margin: 16px 0; color: var(--ink-2); font-style: italic; font-size: 16.5px; line-height: 1.6; }
.answer__body code { font-family: 'Geist Mono', ui-monospace, monospace; font-size: 0.82em; background: var(--soft); border-radius: 4px; padding: 1px 5px; }
.answer__body a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--ink-3); text-decoration-thickness: 1px; }
.answer__body a:hover { text-decoration-color: var(--ink); }
.askcite { font-family: 'Geist Mono', ui-monospace, monospace; font-size: 10px; font-weight: 500; color: var(--ink-3); vertical-align: super; margin: 0 1px; }
.askmsg__err { color: var(--bad); font-family: var(--font-read); font-style: italic; }

/* No-bluff caveat — a quiet italic aside, monochrome (gold reserved for drafts) */
.askmd-caveat { display: flex; gap: 10px; align-items: flex-start; border-left: 2px solid var(--ink-3); padding: 3px 0 3px 16px; margin: 18px 0; color: var(--ink-2); font-family: var(--font-read); font-style: italic; font-size: 15.5px; line-height: 1.55; }
.askmd-caveat svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 4px; color: var(--ink-3); }

/* Tables */
.askmd-tablewrap { overflow-x: auto; margin: 16px 0; }
.askmd-table { border-collapse: collapse; width: 100%; font-family: var(--font-sans, inherit); font-size: 13.5px; }
.askmd-table th, .askmd-table td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.askmd-table th { background: var(--soft); font-weight: 600; color: var(--ink); }
.askmd-table td { color: var(--ink-2); }

/* Thinking indicator + streaming caret */
.askmsg__thinking { display: inline-flex; gap: 5px; align-items: center; padding: 8px 0; }
.askmsg__thinking span { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: askthink 1.2s ease-in-out infinite; }
.askmsg__thinking span:nth-child(2) { animation-delay: 0.18s; }
.askmsg__thinking span:nth-child(3) { animation-delay: 0.36s; }
@keyframes askthink { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.askmsg__cursor { display: inline-block; width: 2px; height: 1.05em; background: var(--ink-3); vertical-align: -2px; margin-left: 1px; animation: askblink 1.1s steps(2, start) infinite; }
@keyframes askblink { 50% { opacity: 0; } }

/* Quiet grounding footer */
.answer__grounding { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 20px; font-size: 12.5px; color: var(--ink-3); }
.answer__grounding > svg { width: 14px; height: 14px; }
.ask-gr__label { color: var(--ink-3); }
.ask-gr__ref { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--line); }
.ask-gr__ref:hover { color: var(--ink); border-bottom-color: var(--ink-3); }
.ask-gr__dot { color: var(--line); }

/* Action rail — quiet, appears settled under the answer */
.answer__rail { display: flex; align-items: center; gap: 2px; margin-top: 14px; }
.answer__act { display: inline-flex; align-items: center; gap: 5px; font-family: 'Geist Mono', ui-monospace, monospace; font-size: 11px; color: var(--ink-3); background: transparent; border: none; border-radius: 7px; padding: 6px 8px; cursor: pointer; transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.answer__act svg { width: 15px; height: 15px; }
.answer__act:hover { color: var(--ink); background: var(--soft); }
.answer__act.is-on { color: var(--ink); }
.answer__draftlink { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-family: 'Geist Mono', ui-monospace, monospace; font-size: 11px; color: var(--gold-ink); background: transparent; border: 1px solid var(--gold-line); border-radius: 8px; padding: 6px 12px; text-decoration: none; transition: background var(--t-fast) var(--ease); }
.answer__draftlink svg { width: 14px; height: 14px; }
.answer__draftlink:hover { background: var(--gold-soft); }

/* Related — quiet suggestions, hairline-separated */
.answer__related { margin-top: 26px; }
.ask-rellabel { font-family: var(--font-read); font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 4px; display: flex; align-items: center; gap: 7px; }
.ask-rellabel svg { display: none; }
.ask-rellist { border-top: 1px solid var(--line-2); }
.ask-relrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; padding: 12px 2px; border: none; border-bottom: 1px solid var(--line-2); background: transparent; cursor: pointer; font-family: var(--font-read); font-size: 15.5px; color: var(--ink-2); transition: padding var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.ask-relrow:hover { padding-left: 6px; color: var(--ink); }
.ask-relrow svg { width: 15px; height: 15px; color: var(--ink-3); flex: 0 0 auto; }
.ask-relrow:hover svg { color: var(--ink); }

/* Composer — a calm floating card */
.ask__composer { position: sticky; bottom: 0; padding: 10px 0 18px; background: linear-gradient(to top, var(--bg) 76%, transparent); }
.ask__composer-inner { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); padding: 14px 16px 12px; box-shadow: 0 2px 14px -6px rgba(12,12,10,0.08); transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-med) var(--ease); }
.ask__composer-inner:focus-within { border-color: var(--ink-3); box-shadow: 0 6px 22px -10px rgba(12,12,10,0.14); }
.ask__input { width: 100%; border: none; resize: none; background: transparent; font-family: inherit; font-size: 15.5px; line-height: 1.55; color: var(--ink); padding: 0; max-height: 200px; overflow-y: auto; }
.ask__input:focus { outline: none; }
.ask__input::placeholder { color: var(--ink-3); }
.ask__composer-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.ask__composer-spacer { flex: 1 1 auto; }
.ask__attach-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: none; border-radius: 50%; background: transparent; color: var(--ink-3); cursor: pointer; transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.ask__attach-btn svg { width: 18px; height: 18px; }
.ask__attach-btn:hover { color: var(--ink); background: var(--soft); }
.ask__send { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: none; border-radius: 50%; background: var(--ink); color: var(--surface); cursor: pointer; transition: transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease); }
.ask__send svg { width: 17px; height: 17px; }
.ask__send:hover { transform: translateY(-1px); }
.ask__send:disabled { opacity: 0.3; cursor: default; transform: none; }

/* Pending attachment chips */
.ask__attachments { display: none; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.ask-att { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); background: var(--soft); border-radius: 8px; padding: 5px 8px 5px 9px; max-width: 260px; }
.ask-att.is-error { color: var(--bad); }
.ask-att > svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--ink-3); }
.ask-att__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.ask-att__meta { color: var(--ink-3); font-size: 10px; }
.ask-att__err { color: var(--bad); font-size: 10px; }
.ask-att__x { border: none; background: transparent; cursor: pointer; color: var(--ink-3); font-size: 16px; line-height: 1; padding: 0 2px; }
.ask-att__x:hover { color: var(--ink); }
.ask-att__spin { width: 12px; height: 12px; flex: 0 0 auto; border: 2px solid var(--line); border-top-color: var(--ink-2); border-radius: 50%; animation: askspin 0.7s linear infinite; }
@keyframes askspin { to { transform: rotate(360deg); } }

.ask__disclaimer { text-align: center; font-size: 10px; color: var(--ink-3); margin-top: 9px; letter-spacing: 0.02em; }

/* Mobile: the fixed bottom-nav (60px) appears at <=760px — lift the sticky
   composer above it so they never collide, and give the thread room to clear. */
@media (max-width: 760px) {
  .view--ask { min-height: auto; padding-left: 20px; padding-right: 20px; padding-bottom: 0; }
  .ask-empty__title { font-size: 25px; }
  .answer__body { font-size: 17px; }
  .askq { max-width: 88%; }
  /* Fixed composer docked ABOVE the 60px bottom-nav — reliable on mobile
     where sticky-in-flex is flaky. Thread gets bottom room so nothing hides. */
  .ask__composer { position: fixed; left: 0; right: 0; bottom: 60px; z-index: 40; padding: 8px 20px 10px; background: var(--bg); border-top: 1px solid var(--line-2); }
  .ask__thread { padding-bottom: 150px; }
  .ask__disclaimer { display: none; }
}
@media (max-width: 420px) {
  .ask-empty__title { font-size: 23px; }
}
