:root {
  --desk: #e7e0d2;
  --paper: #fbf8f0;
  --paper-deep: #f2ebdd;
  --ink: #18242e;
  --muted: #59646a;
  --line: #b8ae9f;
  --archive: #234d61;
  --archive-dark: #173746;
  --stamp: #b84732;
  --verified: #35624b;
  --marker: #f3d875;
  --tint-blue: #dce8e9;
  --tint-red: #f0ddd5;
  --tint-green: #dce7dc;
  --tint-gold: #eee4c7;
  --tint-lilac: #e3ddea;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  --font-meta: ui-monospace, SFMono-Regular, Consolas, monospace;
  --shadow-paper:
    0 0 0 1px rgb(24 36 46 / 8%),
    0 1px 0 rgb(24 36 46 / 10%),
    0 8px 24px rgb(24 36 46 / 8%);
  --shadow-paper-hover:
    0 0 0 1px rgb(24 36 46 / 12%),
    0 2px 2px rgb(24 36 46 / 8%),
    0 14px 32px rgb(24 36 46 / 12%);
  --shadow-float:
    0 0 0 1px rgb(24 36 46 / 10%),
    0 18px 48px rgb(24 36 46 / 18%);
  --focus: 0 0 0 3px rgb(35 77 97 / 28%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  background: var(--desk);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow: hidden;
  background:
    linear-gradient(rgb(35 77 97 / 3%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(35 77 97 / 3%) 1px, transparent 1px),
    var(--desk);
  background-size: 24px 24px;
}

button,
textarea {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  min-height: 44px;
}

button:not(:disabled) {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
dialog:focus-visible {
  outline: 2px solid var(--archive);
  outline-offset: 3px;
  box-shadow: var(--focus);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p,
li,
button,
blockquote {
  text-wrap: pretty;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.paper-noise {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.18;
  background:
    repeating-linear-gradient(77deg, transparent 0 7px, rgb(24 36 46 / 1.5%) 8px 9px),
    repeating-linear-gradient(13deg, transparent 0 11px, rgb(255 255 255 / 12%) 12px 13px);
  mix-blend-mode: multiply;
}

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  height: 100dvh;
}

.case-rail {
  position: relative;
  z-index: 20;
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 22px 18px 18px;
  overflow: hidden;
  color: #f8f3e8;
  background:
    linear-gradient(165deg, rgb(255 255 255 / 5%), transparent 34%),
    var(--archive-dark);
  box-shadow: 10px 0 36px rgb(24 36 46 / 14%);
}

.case-rail::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.18;
  background-image:
    linear-gradient(rgb(255 255 255 / 8%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 8%) 1px, transparent 1px);
  background-size: 20px 20px;
}

.rail-head,
.brand,
.topbar-case,
.topbar-actions,
.quota-line,
.section-heading,
.hero-actions,
.case-index-row,
.composer-meta,
.drawer-header,
.evidence-legend {
  display: flex;
  align-items: center;
}

.rail-head,
.section-heading,
.drawer-header {
  justify-content: space-between;
}

.brand {
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 46px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px 9px 12px 12px;
  color: var(--archive-dark);
  background: var(--marker);
  box-shadow:
    inset 0 0 0 1px rgb(24 36 46 / 12%),
    0 5px 14px rgb(0 0 0 / 18%);
  transform: rotate(-1.5deg);
}

.brand-mark::before {
  position: absolute;
  top: 6px;
  width: 8px;
  height: 8px;
  content: "";
  border-radius: 50%;
  background: var(--archive-dark);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 32%);
}

.brand-mark span {
  margin-top: 7px;
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 800;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-family: var(--font-display);
  font-size: 21px;
  letter-spacing: -0.02em;
}

.brand-copy small,
.rail-ledger small {
  color: rgb(248 243 232 / 62%);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: var(--radius-pill);
  color: inherit;
  background: transparent;
  transition-property: background-color, transform;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.icon-button:hover {
  background: rgb(255 255 255 / 9%);
}

.icon-button:active,
.new-case-button:active,
.primary-action:active,
.text-action:active,
.shuffle-button:active,
.evidence-top-button:active,
.send-button:active,
.question-list button:active,
.position-card:active,
.verdict-card:active,
.fact-source-button:active,
.case-history button:active {
  transform: scale(0.96);
}

.rail-close,
.mobile-menu {
  display: none;
}

.new-case-button {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  margin-top: 30px;
  padding: 6px 14px 6px 7px;
  border: 0;
  border-radius: 15px;
  color: var(--archive-dark);
  background: var(--paper);
  box-shadow:
    0 0 0 1px rgb(255 255 255 / 16%),
    0 8px 18px rgb(0 0 0 / 16%);
  font-size: 13px;
  font-weight: 750;
  transition-property: transform, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.new-case-button:hover {
  box-shadow:
    0 0 0 1px rgb(255 255 255 / 22%),
    0 11px 24px rgb(0 0 0 / 22%);
}

.new-case-plus {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: var(--stamp);
  font-size: 23px;
  font-weight: 400;
}

.rail-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 7px 10px;
  color: rgb(248 243 232 / 54%);
  font-family: var(--font-meta);
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.rail-count {
  min-width: 22px;
  padding: 3px 6px;
  border-radius: var(--radius-pill);
  color: rgb(248 243 232 / 76%);
  background: rgb(255 255 255 / 8%);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.case-history {
  min-height: 0;
  flex: 1;
  overflow: auto;
}

.case-history ol {
  display: grid;
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.case-history button {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 58px;
  gap: 5px;
  padding: 10px 12px;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  color: rgb(248 243 232 / 76%);
  background: transparent;
  text-align: left;
  transition-property: color, background-color, transform;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.case-history button:hover,
.case-history button.is-active {
  color: #fff;
  background: rgb(255 255 255 / 9%);
}

.case-history button.is-active::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 3px;
  content: "";
  border-radius: 0 3px 3px 0;
  background: var(--marker);
}

.case-history strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-history small {
  color: currentColor;
  font-family: var(--font-meta);
  font-size: 9px;
  letter-spacing: 0.07em;
  opacity: 0.56;
  text-transform: uppercase;
}

.empty-history {
  padding: 14px 10px;
  color: rgb(248 243 232 / 46%);
  font-size: 12px;
  line-height: 1.55;
}

.rail-ledger {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 14px 5px 2px;
  border-top: 1px solid rgb(255 255 255 / 9%);
}

.rail-ledger strong {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
}

.status-light {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  margin-top: 4px;
  border-radius: 50%;
  background: #8fc6a5;
  box-shadow: 0 0 0 4px rgb(143 198 165 / 12%);
}

.rail-scrim {
  display: none;
}

.workspace {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-rows: 76px minmax(0, 1fr) auto;
  overflow: hidden;
}

.archive-topbar {
  position: relative;
  z-index: 12;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px clamp(18px, 3vw, 42px);
  border-bottom: 1px solid rgb(24 36 46 / 9%);
  background: rgb(251 248 240 / 90%);
}

.topbar-case {
  min-width: 0;
  gap: 10px;
}

.topbar-case > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.topbar-case strong {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.micro-label,
.case-index,
.case-status,
.position-number,
.position-person,
.cover-code,
.fact-index,
.turn-label,
.evidence-type {
  font-family: var(--font-meta);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.085em;
  text-transform: uppercase;
}

.micro-label {
  color: var(--muted);
}

.topbar-actions {
  gap: 18px;
}

.quota {
  min-width: 130px;
}

.quota-line {
  gap: 6px;
  margin-top: 2px;
}

.quota-line strong,
.quota-line span,
.evidence-count,
.composer-meta,
.case-index,
.cover-code {
  font-variant-numeric: tabular-nums;
}

.quota-line strong {
  font-family: var(--font-meta);
  font-size: 13px;
}

.quota-line span {
  color: var(--muted);
  font-size: 10px;
}

.quota-ticks {
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 2px;
  width: 130px;
  margin-top: 7px;
}

.quota-ticks i {
  height: 3px;
  border-radius: 2px;
  background: rgb(24 36 46 / 12%);
}

.quota-ticks i.is-live {
  background: var(--verified);
}

.quota-ticks i.is-low {
  background: var(--stamp);
}

.evidence-top-button {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 14px;
  border: 0;
  border-radius: 13px;
  color: var(--paper);
  background: var(--archive);
  box-shadow: 0 5px 16px rgb(35 77 97 / 18%);
  font-size: 12px;
  font-weight: 750;
  transition-property: transform, opacity, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.evidence-top-button:disabled {
  opacity: 0.42;
  cursor: default;
}

.evidence-top-button:not(:disabled):hover {
  box-shadow: 0 9px 22px rgb(35 77 97 / 25%);
}

.evidence-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--marker);
}

.evidence-count {
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: var(--radius-pill);
  background: rgb(255 255 255 / 12%);
  font-family: var(--font-meta);
  font-size: 10px;
}

.workspace-scroll {
  min-height: 0;
  overflow: auto;
  scroll-behavior: smooth;
}

.landing-dashboard,
.chat-thread {
  width: min(100%, 1160px);
  padding: clamp(20px, 4vw, 52px) clamp(16px, 4vw, 52px) 160px;
  margin: 0 auto;
}

.dossier-sheet {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: var(--paper);
  box-shadow: var(--shadow-paper);
}

.dossier-sheet::after {
  position: absolute;
  right: 36%;
  bottom: -100px;
  z-index: -1;
  width: 220px;
  height: 220px;
  content: "";
  border: 28px double rgb(184 71 50 / 6%);
  border-radius: 50%;
  transform: rotate(-18deg);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: clamp(28px, 5vw, 72px);
  padding: clamp(26px, 5vw, 64px);
}

.hero-copy {
  min-width: 0;
}

.case-index-row {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 48px;
}

.case-index {
  color: var(--archive);
}

.case-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--stamp);
}

.case-status span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.hero-kicker {
  margin-bottom: 10px;
  color: var(--archive);
  font-family: var(--font-meta);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  margin-bottom: 15px;
  font-family: var(--font-display);
  font-size: clamp(44px, 7vw, 82px);
  font-weight: 750;
  letter-spacing: -0.055em;
  line-height: 0.91;
}

.hero h1 em {
  display: inline-block;
  margin: 0 0.06em;
  color: var(--stamp);
  font-size: 0.46em;
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.03em;
  transform: translateY(-0.18em) rotate(-5deg);
}

.hero-subtitle {
  max-width: 660px;
  margin-bottom: 15px;
  font-family: var(--font-display);
  font-size: clamp(21px, 2.6vw, 30px);
  line-height: 1.15;
}

.hero-explainer {
  max-width: 620px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 10px;
}

.primary-action,
.text-action,
.shuffle-button,
.send-button,
.fact-source-button,
.context-button {
  border: 0;
  font-weight: 750;
  transition-property: transform, background-color, box-shadow, color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.primary-action {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  gap: 16px;
  padding: 0 16px 0 18px;
  border-radius: 13px;
  color: #fff;
  background: var(--archive);
  box-shadow: 0 7px 18px rgb(35 77 97 / 20%);
}

.primary-action:hover {
  background: var(--archive-dark);
  box-shadow: 0 11px 24px rgb(35 77 97 / 26%);
}

.text-action {
  min-height: 50px;
  padding: 0 16px;
  border-radius: 13px;
  color: var(--archive);
  background: transparent;
}

.text-action:hover {
  background: var(--tint-blue);
}

.case-cover {
  position: relative;
  display: flex;
  min-height: 356px;
  flex-direction: column;
  align-self: center;
  padding: 22px;
  overflow: hidden;
  border-radius: 8px 8px 18px 18px;
  color: #f8f3e8;
  background:
    linear-gradient(155deg, rgb(255 255 255 / 7%), transparent 40%),
    var(--archive);
  box-shadow:
    0 0 0 1px rgb(24 36 46 / 14%),
    0 18px 34px rgb(24 36 46 / 20%);
  transform: rotate(1.1deg);
}

.case-cover::before {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 68px;
  height: 27px;
  content: "";
  border-radius: 0 0 9px 9px;
  background: var(--paper-deep);
  box-shadow: inset 0 -1px 0 rgb(24 36 46 / 12%);
  transform: translateX(-50%);
}

.cover-stamp {
  align-self: flex-end;
  padding: 7px 9px;
  border: 2px solid rgb(243 216 117 / 78%);
  color: var(--marker);
  font-family: var(--font-meta);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-align: center;
  transform: rotate(-4deg);
}

.cover-code {
  margin-top: 20px;
  color: rgb(248 243 232 / 56%);
}

.cover-title {
  display: grid;
  gap: 8px;
  margin: auto 0;
}

.cover-title span {
  color: var(--marker);
  font-family: var(--font-meta);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.cover-title strong {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 650;
  line-height: 1.08;
}

.cover-footer {
  display: grid;
  gap: 3px;
  padding-top: 14px;
  border-top: 1px solid rgb(255 255 255 / 14%);
  color: rgb(248 243 232 / 60%);
  font-family: var(--font-meta);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.case-map,
.fact-section,
.question-deck {
  margin-top: clamp(52px, 7vw, 88px);
}

.section-heading {
  gap: 24px;
  margin-bottom: 24px;
}

.section-heading--compact {
  margin-bottom: 17px;
}

.section-heading h2,
.question-deck h2,
.drawer-header h2 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.5vw, 38px);
  letter-spacing: -0.03em;
}

.section-heading p,
.question-deck-copy p,
.drawer-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.case-map-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 0.72fr;
  gap: 12px;
}

.position-card,
.verdict-card {
  position: relative;
  min-height: 190px;
  padding: 22px;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-lg);
  text-align: left;
  box-shadow: var(--shadow-paper);
  transition-property: transform, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.position-card:hover,
.verdict-card:hover,
.fact-card:hover {
  z-index: 2;
  box-shadow: var(--shadow-paper-hover);
  transform: translateY(-2px);
}

.position-card--kolyan {
  background: var(--tint-blue);
}

.position-card--yura {
  background: var(--tint-gold);
}

.position-number {
  position: absolute;
  top: 17px;
  right: 18px;
  color: rgb(24 36 46 / 32%);
  font-size: 22px;
}

.position-person {
  display: block;
  margin-bottom: 34px;
  color: var(--archive);
}

.position-card strong,
.verdict-card strong {
  display: block;
  max-width: 340px;
  font-family: var(--font-display);
  font-size: clamp(20px, 2vw, 27px);
  line-height: 1.12;
}

.position-link {
  display: block;
  margin-top: 23px;
  color: var(--archive);
  font-size: 11px;
  font-weight: 750;
}

.versus-seal {
  position: absolute;
  top: 50%;
  left: calc((100% - 24px) * 0.37);
  z-index: 3;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 5px double var(--stamp);
  border-radius: 50%;
  color: var(--stamp);
  background: var(--paper);
  font-family: var(--font-meta);
  font-size: 12px;
  font-weight: 900;
  transform: translate(-50%, -50%) rotate(-8deg);
}

.verdict-card {
  color: var(--paper);
  background: var(--archive);
}

.verdict-card .micro-label {
  display: block;
  margin-bottom: 25px;
  color: var(--marker);
}

.verdict-card > span:not(.micro-label, .verdict-arrow) {
  display: block;
  margin-top: 12px;
  color: rgb(251 248 240 / 62%);
  font-size: 11px;
  line-height: 1.45;
}

.verdict-arrow {
  position: absolute;
  right: 18px;
  bottom: 15px;
  font-size: 20px;
}

.shuffle-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  gap: 8px;
  padding: 0 15px;
  border-radius: 13px;
  color: var(--archive);
  background: var(--paper);
  box-shadow: var(--shadow-paper);
}

.shuffle-button:hover {
  box-shadow: var(--shadow-paper-hover);
}

.shuffle-icon {
  display: inline-block;
  font-size: 20px;
  transition-property: opacity, filter, transform;
  transition-duration: 300ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.shuffle-button.is-loading .shuffle-icon {
  opacity: 0;
  filter: blur(4px);
  transform: scale(0.25);
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.fact-card,
.fact-skeleton {
  min-height: 196px;
  grid-column: span 4;
  padding: 21px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-paper);
}

.fact-card {
  position: relative;
  display: flex;
  flex-direction: column;
  animation: card-enter 220ms ease-out both;
  transition-property: transform, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.fact-card:nth-child(5n + 1) {
  grid-column: span 7;
  background: var(--tint-blue);
}

.fact-card:nth-child(5n + 2) {
  grid-column: span 5;
  background: var(--tint-gold);
}

.fact-card:nth-child(5n + 3) {
  background: var(--tint-green);
}

.fact-card:nth-child(5n + 4) {
  grid-column: span 5;
  background: var(--tint-lilac);
  transform: rotate(-0.2deg);
}

.fact-card:nth-child(5n + 5) {
  grid-column: span 4;
  background: var(--tint-red);
}

.fact-card:nth-child(2) { animation-delay: 25ms; }
.fact-card:nth-child(3) { animation-delay: 50ms; }
.fact-card:nth-child(4) { animation-delay: 75ms; }
.fact-card:nth-child(5) { animation-delay: 100ms; }
.fact-card:nth-child(6) { animation-delay: 125ms; }
.fact-card:nth-child(7) { animation-delay: 150ms; }
.fact-card:nth-child(8) { animation-delay: 175ms; }
.fact-card:nth-child(9) { animation-delay: 200ms; }
.fact-card:nth-child(10) { animation-delay: 225ms; }

.fact-index {
  display: flex;
  justify-content: space-between;
  color: var(--archive);
}

.fact-confidence {
  padding: 3px 6px;
  border-radius: var(--radius-pill);
  background: rgb(255 255 255 / 36%);
}

.fact-card h3 {
  max-width: 580px;
  margin: 32px 0 22px;
  font-family: var(--font-display);
  font-size: clamp(20px, 2.3vw, 29px);
  font-weight: 650;
  line-height: 1.12;
}

.fact-source-button {
  align-self: flex-start;
  min-height: 44px;
  padding: 0 11px;
  margin-top: auto;
  border-radius: 10px;
  color: var(--archive);
  background: rgb(255 255 255 / 42%);
  font-size: 11px;
}

.fact-source-button:hover {
  background: rgb(255 255 255 / 72%);
}

.empty-facts {
  display: grid;
  min-height: 150px;
  grid-column: 1 / -1;
  place-items: center;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  color: var(--muted);
  background: rgb(251 248 240 / 62%);
  text-align: center;
}

.fact-skeleton {
  background: rgb(251 248 240 / 58%);
}

.fact-skeleton span,
.fact-skeleton strong,
.fact-skeleton p {
  display: block;
  border-radius: 4px;
  background: linear-gradient(90deg, rgb(24 36 46 / 5%), rgb(255 255 255 / 46%), rgb(24 36 46 / 5%));
  background-size: 220% 100%;
  animation: skeleton-shift 1.4s linear infinite;
}

.fact-skeleton span { width: 72px; height: 9px; }
.fact-skeleton strong { width: 82%; height: 22px; margin-top: 44px; }
.fact-skeleton p { width: 56%; height: 11px; margin-top: 12px; }

.question-deck {
  display: grid;
  grid-template-columns: 0.58fr 1fr;
  gap: clamp(28px, 6vw, 80px);
  padding: clamp(28px, 5vw, 54px);
  border-radius: var(--radius-xl);
  background: var(--paper-deep);
  box-shadow: var(--shadow-paper);
}

.question-deck-copy p {
  max-width: 310px;
  line-height: 1.55;
}

.question-list {
  display: grid;
}

.question-list button {
  position: relative;
  display: grid;
  min-height: 76px;
  grid-template-columns: 88px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border: 0;
  border-bottom: 1px solid rgb(24 36 46 / 12%);
  background: transparent;
  text-align: left;
  transition-property: color, transform, padding-left;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.question-list button:last-child {
  border-bottom: 0;
}

.question-list button:hover {
  padding-left: 6px;
  color: var(--archive);
}

.question-list button > span {
  color: var(--muted);
  font-family: var(--font-meta);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.question-list button strong {
  font-family: var(--font-display);
  font-size: 17px;
}

.question-list button i {
  color: rgb(24 36 46 / 28%);
  font-family: var(--font-meta);
  font-size: 11px;
  font-style: normal;
  text-align: right;
}

.chat-thread {
  display: grid;
  align-content: start;
  gap: 18px;
}

.turn {
  content-visibility: auto;
  contain-intrinsic-size: 180px;
  animation: turn-enter 240ms ease-out both;
}

.turn--user {
  width: min(76%, 650px);
  justify-self: end;
  padding: 17px 19px;
  border-radius: 16px 16px 5px 16px;
  background: var(--tint-gold);
  box-shadow: var(--shadow-paper);
}

.turn-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
}

.turn--user p {
  margin: 0;
  line-height: 1.55;
}

.turn--assistant {
  padding: clamp(22px, 4vw, 38px);
  border-radius: var(--radius-xl);
  background: var(--paper);
  box-shadow: var(--shadow-paper);
}

.answer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgb(24 36 46 / 10%);
}

.answer-head h2 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: clamp(25px, 3vw, 36px);
}

.answer-stamp {
  flex: 0 0 auto;
  padding: 7px 9px;
  border: 2px solid currentColor;
  color: var(--verified);
  font-family: var(--font-meta);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: rotate(-2deg);
  animation: stamp-in 220ms ease-out both;
}

.answer-stamp--mixed { color: #8b6422; }
.answer-stamp--version { color: var(--stamp); }

.answer-body {
  display: grid;
  gap: 16px;
  padding-top: 22px;
}

.answer-segment {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
}

.citation-button {
  display: inline-grid;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  padding: 0;
  margin: -8px 2px;
  border: 0;
  color: inherit;
  background: transparent;
  vertical-align: 0.12em;
  transition-property: transform;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.citation-number {
  display: inline-grid;
  width: 24px;
  height: 20px;
  place-items: center;
  border-radius: 6px;
  color: var(--archive);
  background: var(--tint-blue);
  font-family: var(--font-meta);
  font-size: 8px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  transition-property: background-color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.citation-button:hover .citation-number {
  background: var(--marker);
}

.answer-caveat {
  padding: 12px 14px;
  margin: 4px 0 0;
  border-left: 3px solid var(--stamp);
  color: var(--muted);
  background: var(--tint-red);
  font-size: 12px;
  line-height: 1.55;
}

.answer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
  margin-top: 22px;
  border-top: 1px solid rgb(24 36 46 / 10%);
}

.answer-footer span {
  color: var(--muted);
  font-family: var(--font-meta);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.answer-footer button {
  min-height: 44px;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  color: var(--paper);
  background: var(--archive);
  font-size: 11px;
  font-weight: 750;
}

.loading-card {
  display: flex;
  min-height: 116px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: var(--radius-xl);
  color: var(--muted);
  background: rgb(251 248 240 / 72%);
  box-shadow: var(--shadow-paper);
  font-size: 12px;
}

.loading-tabs {
  display: flex;
  gap: 3px;
  margin-right: 7px;
}

.loading-tabs i {
  width: 7px;
  height: 18px;
  border-radius: 2px;
  background: var(--archive);
  animation: tab-search 780ms ease-in-out infinite alternate;
}

.loading-tabs i:nth-child(2) { animation-delay: 120ms; }
.loading-tabs i:nth-child(3) { animation-delay: 240ms; }

.composer-dock {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 11;
  padding: 16px clamp(16px, 4vw, 52px) max(18px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--desk) 28%);
  pointer-events: none;
}

.investigation-composer {
  display: grid;
  width: min(100%, 1040px);
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px;
  margin: 0 auto;
  border-radius: 22px;
  background: var(--paper);
  box-shadow: var(--shadow-float);
  pointer-events: auto;
}

.investigation-composer textarea {
  width: 100%;
  min-height: 52px;
  max-height: 180px;
  resize: none;
  padding: 15px 14px;
  overflow: auto;
  border: 1px solid transparent;
  border-radius: 14px;
  outline: 0;
  background: transparent;
  font-size: 14px;
  line-height: 1.45;
  transition-property: border-color, background-color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.investigation-composer textarea:hover,
.investigation-composer textarea:focus {
  border-color: rgb(35 77 97 / 16%);
  background: var(--paper-deep);
}

.send-button {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 12px;
  align-self: start;
  padding: 0 13px 0 16px;
  border-radius: 14px;
  color: var(--paper);
  background: var(--archive);
  box-shadow: 0 6px 15px rgb(35 77 97 / 18%);
  font-size: 12px;
}

.send-button:hover {
  background: var(--archive-dark);
}

.send-button:disabled {
  opacity: 0.48;
  cursor: wait;
}

.send-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 9px;
  color: var(--archive);
  background: var(--marker);
  font-size: 16px;
}

.composer-meta {
  grid-column: 1 / -1;
  justify-content: space-between;
  gap: 12px;
  padding: 0 9px 3px;
  color: var(--muted);
  font-family: var(--font-meta);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.verified-mini {
  color: var(--verified);
}

.evidence-drawer {
  width: min(440px, calc(100vw - 24px));
  max-width: none;
  height: calc(100dvh - 24px);
  max-height: none;
  padding: 0;
  margin: 12px 12px 12px auto;
  overflow: hidden;
  border: 0;
  border-radius: 22px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow-float);
}

.evidence-drawer[open] {
  animation: drawer-enter 220ms ease-out both;
}

.evidence-drawer::backdrop {
  background: rgb(24 36 46 / 24%);
}

.drawer-shell {
  display: grid;
  height: 100%;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.drawer-header {
  align-items: flex-start;
  gap: 16px;
  padding: 25px 22px 18px;
  border-bottom: 1px solid rgb(24 36 46 / 10%);
}

.drawer-header h2 {
  font-size: 30px;
}

.drawer-header .icon-button:hover {
  background: var(--paper-deep);
}

.evidence-legend {
  gap: 17px;
  padding: 11px 22px;
  color: var(--muted);
  background: var(--paper-deep);
  font-family: var(--font-meta);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.legend-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
}

.legend-dot--primary { background: var(--verified); }
.legend-dot--context { background: #9d7f41; }

.evidence-list {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px;
  overflow: auto;
}

.evidence-card {
  position: relative;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--paper-deep);
  box-shadow: 0 0 0 1px rgb(24 36 46 / 8%);
  content-visibility: auto;
  transition-property: background-color, box-shadow, transform;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.evidence-card.is-focused {
  background: color-mix(in srgb, var(--marker) 35%, var(--paper));
  box-shadow: 0 0 0 2px rgb(184 71 50 / 30%);
}

.evidence-type {
  color: var(--verified);
}

.evidence-card--context .evidence-type {
  color: #806225;
}

.evidence-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 8px;
  color: var(--muted);
  font-family: var(--font-meta);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.evidence-card blockquote {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.5;
}

.context-button {
  min-height: 44px;
  padding: 0 10px;
  margin-top: 13px;
  border-radius: 9px;
  color: var(--archive);
  background: var(--tint-blue);
  font-size: 10px;
}

.context-button:hover {
  background: var(--marker);
}

.context-stack {
  display: grid;
  gap: 7px;
  margin-top: 13px;
}

.context-line {
  padding: 9px 10px;
  border-left: 2px solid rgb(35 77 97 / 20%);
  color: var(--muted);
  background: rgb(255 255 255 / 40%);
  font-size: 11px;
  line-height: 1.5;
}

.context-line.is-target {
  border-left-color: var(--stamp);
  color: var(--ink);
  background: rgb(243 216 117 / 32%);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  max-width: min(380px, calc(100vw - 36px));
  padding: 13px 15px;
  border-radius: 12px;
  color: var(--paper);
  background: var(--archive-dark);
  box-shadow: var(--shadow-float);
  font-size: 12px;
  animation: toast-enter 180ms ease-out both;
}

@keyframes card-enter {
  from { opacity: 0; filter: blur(4px); transform: translateY(6px); }
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}

@keyframes turn-enter {
  from { opacity: 0; filter: blur(4px); transform: translateY(8px); }
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}

@keyframes drawer-enter {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes stamp-in {
  from { opacity: 0; transform: rotate(-2deg) scale(1.06); }
  to { opacity: 1; transform: rotate(-2deg) scale(1); }
}

@keyframes toast-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes tab-search {
  from { opacity: 0.28; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(-3px); }
}

@keyframes skeleton-shift {
  to { background-position: -120% 0; }
}

@media (max-width: 1100px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 32px;
  }

  .case-cover {
    min-height: 325px;
  }

  .case-map-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .verdict-card {
    min-height: 150px;
    grid-column: 1 / -1;
  }

  .versus-seal {
    left: 50%;
  }

  .fact-card,
  .fact-card:nth-child(n) {
    grid-column: span 6;
  }
}

@media (max-width: 820px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    display: block;
  }

  .case-rail {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(326px, calc(100vw - 38px));
    transform: translateX(-105%);
    transition-property: transform;
    transition-duration: 220ms;
    transition-timing-function: ease-out;
  }

  .case-rail.is-open {
    transform: translateX(0);
  }

  .rail-close,
  .mobile-menu {
    display: grid;
  }

  .rail-scrim {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: block;
    min-height: 0;
    padding: 0;
    border: 0;
    background: rgb(24 36 46 / 32%);
    opacity: 0;
    pointer-events: none;
    transition-property: opacity;
    transition-duration: 180ms;
    transition-timing-function: ease-out;
  }

  .rail-scrim.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  .workspace {
    height: 100dvh;
    grid-template-rows: 68px minmax(0, 1fr) auto;
  }

  .archive-topbar {
    padding: 9px 14px;
  }

  .quota {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .case-cover {
    display: none;
  }

  .case-index-row {
    margin-bottom: 35px;
  }

  .question-deck {
    grid-template-columns: 1fr;
  }

  .question-deck-copy p {
    max-width: none;
  }
}

@media (max-width: 620px) {
  .landing-dashboard,
  .chat-thread {
    padding: 14px 12px 152px;
  }

  .archive-topbar {
    gap: 8px;
  }

  .topbar-actions {
    gap: 7px;
  }

  .evidence-top-button {
    min-height: 44px;
    padding: 0 8px;
  }

  .hero {
    padding: 24px 20px 29px;
  }

  .case-index-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .hero h1 {
    font-size: clamp(43px, 15vw, 64px);
  }

  .hero-subtitle {
    font-size: 21px;
  }

  .primary-action,
  .text-action {
    width: 100%;
    justify-content: space-between;
  }

  .case-map-grid {
    grid-template-columns: 1fr;
  }

  .verdict-card {
    grid-column: auto;
  }

  .versus-seal {
    top: 202px;
    left: 50%;
  }

  .fact-card,
  .fact-card:nth-child(n),
  .fact-skeleton {
    min-height: 180px;
    grid-column: 1 / -1;
    transform: none;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .question-deck {
    padding: 27px 20px;
  }

  .question-list button {
    grid-template-columns: 70px minmax(0, 1fr) 22px;
  }

  .turn--user {
    width: 88%;
  }

  .turn--assistant {
    padding: 20px;
  }

  .answer-head,
  .answer-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .composer-dock {
    padding: 10px 10px max(10px, env(safe-area-inset-bottom));
  }

  .investigation-composer {
    grid-template-columns: minmax(0, 1fr) 48px;
    border-radius: 20px;
  }

  .send-button {
    width: 48px;
    min-height: 48px;
    justify-content: center;
    padding: 0;
  }

  .send-button > span:first-child {
    display: none;
  }

  .send-icon {
    background: transparent;
    color: var(--paper);
  }

  .composer-meta span:first-child {
    display: none;
  }

  .composer-meta {
    justify-content: flex-end;
  }

  .evidence-drawer {
    width: 100%;
    height: min(82dvh, 720px);
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
  }

  .evidence-drawer[open] {
    animation-name: drawer-enter-mobile;
  }
}

@keyframes drawer-enter-mobile {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

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