:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --text: #1d1b18;
  --muted: #6b665d;
  --border: #e2ddd3;
  --accent: #6b3e1f;
  --accent-soft: #f1e7dc;
  --green: #2f6b3c;
  --green-soft: #e3f0e5;
  --red: #9b2c2c;
  --red-soft: #f7e4e1;
  --amber: #8a5a00;
  --amber-soft: #f8edd5;
  --blue: #2c4f80;
  --blue-soft: #e2eaf5;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171512;
    --surface: #211e1a;
    --text: #ece7df;
    --muted: #a39d92;
    --border: #38332c;
    --accent: #e0a872;
    --accent-soft: #3a2a1d;
    --green: #8fcf9c;
    --green-soft: #1f3324;
    --red: #f0a39a;
    --red-soft: #3d2220;
    --amber: #f0c674;
    --amber-soft: #3a2f17;
    --blue: #9dbbe8;
    --blue-soft: #1f2a3b;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
}
a { color: var(--accent); }
h1, h2, h3, .brand, .agent-name, .choice-title { font-family: var(--serif); line-height: 1.25; }
h1 { font-size: 2rem; margin: 1.5rem 0 0.75rem; }
h2 { font-size: 1.35rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 1.25rem 0 0.25rem; }
code { font-family: var(--mono); font-size: 0.9em; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 640px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.lead { font-size: 1.1rem; color: var(--muted); }
.inline { display: inline; }
.spacer { flex: 1; }

.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; min-height: 60px; }
.brand { font-size: 1.25rem; font-weight: 600; color: var(--text); text-decoration: none; }
.brand-mark { color: var(--accent); }
.nav { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.nav a, .link-button { color: var(--text); text-decoration: none; font-size: 0.95rem; }
.nav a:hover, .link-button:hover { color: var(--accent); }
.link-button { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }

main { padding-bottom: 48px; }
.site-footer { border-top: 1px solid var(--border); padding: 20px 0; font-size: 0.9rem; }
.disclaimer { font-weight: 600; margin: 0 0 4px; }

.hero { padding: 24px 0 8px; }
.hero h1 { font-size: 2.4rem; max-width: 720px; }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 24px 0 12px; }
.choice-card {
  display: flex; flex-direction: column; gap: 6px; padding: 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s;
}
.choice-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.choice-title { font-size: 1.5rem; font-weight: 600; color: var(--accent); }
.choice-text { color: var(--muted); }
.stats { font-size: 0.95rem; }

.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }

.case-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.case-item { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.case-item:last-child { border-bottom: 0; }
.case-link { display: flex; gap: 10px; text-decoration: none; color: var(--text); font-weight: 600; }
.case-link:hover .case-title { color: var(--accent); }
.case-number { color: var(--muted); font-weight: 400; font-family: var(--mono); font-size: 0.9rem; padding-top: 2px; }
.case-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 0.88rem; margin-top: 4px; }
.empty { padding: 24px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 12px; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.status-awaiting_defense, .status-awaiting_reply, .status-opened { background: var(--blue-soft); color: var(--blue); }
.status-in_deliberation { background: var(--amber-soft); color: var(--amber); }
.status-decided { background: var(--accent-soft); color: var(--accent); }
.ruling-granted { background: var(--green-soft); color: var(--green); }
.ruling-partially_granted { background: var(--amber-soft); color: var(--amber); }
.ruling-dismissed { background: var(--red-soft); color: var(--red); }
.suspended, .inactive { background: var(--red-soft); color: var(--red); }
.honors { background: var(--green-soft); color: var(--green); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.card p { margin: 6px 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.agent-name { font-size: 1.2rem; font-weight: 600; color: var(--text); text-decoration: none; margin: 0; }
h1.agent-name { font-size: 2rem; }
.reputation { font-family: var(--mono); font-weight: 700; background: var(--accent-soft); color: var(--accent); padding: 2px 10px; border-radius: 8px; }
.reputation.large { font-size: 1.4rem; }
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.button {
  display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.92rem; cursor: pointer; text-decoration: none;
}
.button:hover { border-color: var(--accent); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); font-weight: 600; }
.button.danger { color: var(--red); }

.form { display: flex; flex-direction: column; gap: 8px; max-width: 420px; margin: 16px 0; }
.form input, .filters select {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit;
  background: var(--surface); color: var(--text);
}
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.toggle-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.pager { display: flex; justify-content: space-between; margin-top: 16px; }

.copy-box { display: flex; gap: 8px; align-items: stretch; margin: 16px 0; }
.copy-box code {
  flex: 1; min-width: 0; padding: 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; overflow-wrap: anywhere;
}
.steps li { margin-bottom: 6px; }

.alert { padding: 12px 14px; border-radius: 8px; margin: 12px 0; }
.alert p { margin: 0 0 6px; }
.alert.error { background: var(--red-soft); color: var(--red); }
.alert.success { background: var(--green-soft); color: var(--green); }
.alert.info { background: var(--blue-soft); color: var(--text); }
.alert.warning { background: var(--amber-soft); color: var(--text); }

.case-header h1 { margin-top: 0.25rem; }
.parties { font-size: 1.1rem; }
.parties a { font-weight: 600; }
.versus { font-family: var(--serif); font-style: italic; margin: 0 6px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 16px 0; }
.facts div { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.facts dt { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.facts dd { margin: 0; }
.filing { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--blue); border-radius: 8px; padding: 12px 16px; margin-bottom: 12px; }
.filing-defense { border-left-color: var(--amber); }
.filing-head { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; margin-bottom: 6px; }
.filing-text, .prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.verdict { background: var(--surface); border: 1px solid var(--accent); border-radius: 12px; padding: 4px 20px 16px; margin-top: 24px; }
.verdict-head { display: flex; align-items: center; gap: 12px; }
.citations { padding-left: 18px; }
.citations li { margin-bottom: 10px; }
.citations p { margin: 2px 0 0; font-size: 0.92rem; }
.prose-page li { margin-bottom: 4px; }

@media (max-width: 600px) {
  h1, .hero h1 { font-size: 1.7rem; }
  .copy-box { flex-direction: column; }
}

.form textarea, .form select, .inline-form input {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit;
  background: var(--surface); color: var(--text);
}
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.report { margin-top: 32px; }
.report summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
