:root {
  --ink: #1d2433;
  --ink-2: #4a5468;
  --muted: #7a8396;
  --paper: #f6f4ef;
  --card: #ffffff;
  --line: #e3dfd5;
  --accent: #7a1f2b;      /* advocate's maroon */
  --accent-2: #a8323f;
  --gold: #b08a3e;
  --pet: #1f5f8b;
  --def: #7a4b12;
  --ok: #2e7d4f;
  --warn: #b5651d;
  --bad: #a8323f;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; }
h1, h2, h3, h4, .serif { font-family: var(--serif); letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 600; }
h2 { font-size: 1.2rem; font-weight: 600; }
h3 { font-size: 1.02rem; font-weight: 600; }

/* shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 232px; flex: 0 0 232px; background: var(--ink); color: #cfd5e2; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; color: #fff; }
.brand .seal { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--gold); display: grid; place-items: center; font-family: var(--serif); font-weight: 700; color: var(--gold); }
.brand b { font-family: var(--serif); font-size: 1.15rem; display: block; line-height: 1.1; }
.brand small { color: #8f98ad; font-size: .72rem; }
.side .nav-h { text-transform: uppercase; font-size: .66rem; letter-spacing: .08em; color: #7d879c; margin: 14px 8px 4px; }
.side a { display: block; color: #cfd5e2; padding: 7px 10px; border-radius: 6px; font-size: .88rem; }
.side a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.side a.on { background: rgba(176,138,62,.18); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.main { flex: 1; min-width: 0; padding: 22px 28px 60px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar form { display: flex; gap: 6px; }
.topbar input { min-width: 260px; }
.menu-btn { display: none; }

/* cards */
.card-l { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.card-l > h2, .card-l > h3 { margin: 0 0 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-l > h2 small, .card-l > h3 small { font-family: var(--sans); font-weight: 400; font-size: .8rem; color: var(--muted); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat .v { font-family: var(--serif); font-size: 1.9rem; font-weight: 600; line-height: 1; }
.stat .l { color: var(--muted); font-size: .78rem; margin-top: 6px; text-transform: uppercase; letter-spacing: .05em; }
.stat.accent { border-top: 3px solid var(--accent); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 8px 8px; text-align: left; white-space: nowrap; }
.tbl td { border-bottom: 1px solid #f0ede6; padding: 9px 8px; vertical-align: top; }
.tbl tr:hover td { background: #fbfaf7; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; }
.cno { font-weight: 600; white-space: nowrap; }
.sub { color: var(--muted); font-size: .8rem; }

/* pills */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.st-pending { background: #e7f0f8; color: #1f5f8b; }
.st-disposed { background: #e6f3ec; color: var(--ok); }
.st-reserved { background: #f4ecdd; color: #8a6420; }
.st-stayed { background: #fbeee2; color: var(--warn); }
.st-muted { background: #efefef; color: #666; }
.side-pet { background: #e3eef7; color: var(--pet); border-color: #c5dbec; }
.side-def { background: #f5ecdf; color: var(--def); border-color: #e7d5ba; }
.win { background: #e6f3ec; color: var(--ok); }
.loss { background: #f8e5e7; color: var(--bad); }
.sec { display: inline-block; padding: 2px 8px; margin: 0 4px 4px 0; border-radius: 4px; background: #f3efe6; border: 1px solid #e5dccb; font-size: .78rem; font-weight: 600; color: #5a4320; }
.sec:hover { background: #ece4d3; text-decoration: none; }
.term { border-bottom: 1px dotted var(--ink-2); cursor: help; }

/* case header */
.case-head { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.case-head .cno-big { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; }
.case-head .title { font-family: var(--serif); font-size: 1.1rem; color: var(--ink-2); margin-top: 2px; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 18px; margin-top: 14px; }
.meta-grid .k { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.meta-grid .v { font-weight: 500; }
.citation { font-family: var(--serif); background: #faf7f0; border: 1px dashed #d8ccb1; padding: 10px 12px; border-radius: 6px; font-size: .95rem; }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.grounds li { margin-bottom: 6px; }
.grounds li .ref { color: var(--muted); font-size: .78rem; }

/* timeline */
.tl { list-style: none; padding: 0; margin: 0; position: relative; }
.tl li { position: relative; padding: 0 0 14px 26px; }
.tl li::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: -6px; width: 2px; background: var(--line); }
.tl li:last-child::before { display: none; }
.tl li .dot { position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--card); border: 3px solid var(--muted); }
.tl li.SCHEDULED .dot { border-color: var(--pet); }
.tl li.HEARD .dot, .tl li.DISPOSED .dot { border-color: var(--ok); }
.tl li.ADJOURNED .dot { border-color: var(--warn); }
.tl .when { font-weight: 600; }
.vno { font-family: var(--serif); color: var(--gold); font-weight: 700; margin-right: 4px; }

/* chain */
.chain { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chain .node { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 6px 10px; font-size: .82rem; }
.chain .node.cur { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(122,31,43,.12); }
.chain .arr { color: var(--muted); }

/* bars */
.bar { height: 8px; background: #efebe2; border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.barrow { display: grid; grid-template-columns: 1fr 2fr 40px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: .85rem; }

/* advocate */
.avatar { width: 72px; height: 72px; border-radius: 50%; background: var(--ink); color: var(--gold); display: grid; place-items: center; font-family: var(--serif); font-size: 1.6rem; font-weight: 700; object-fit: cover; flex: 0 0 72px; }
.avatar.sm { width: 40px; height: 40px; flex-basis: 40px; font-size: .95rem; }
.adv-card { display: flex; gap: 14px; align-items: center; }

.btn-lex { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-lex:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.form-label, label { font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: 2px; }
.helptext, .form-text { font-size: .72rem; color: var(--muted); }
.errorlist { color: var(--bad); font-size: .78rem; padding-left: 16px; margin: 2px 0; }
.empty { color: var(--muted); font-style: italic; padding: 8px 0; }
.alert { border-radius: 8px; }

@media (max-width: 900px) {
  .shell { display: block; }
  .side { position: fixed; z-index: 50; left: -250px; transition: left .2s; }
  .side.open { left: 0; }
  .main { padding: 14px 16px 60px; }
  .menu-btn { display: inline-block; }
  .cols { grid-template-columns: 1fr; }
  .topbar input { min-width: 0; width: 100%; }
}
@media print {
  .side, .topbar, .no-print, .messages { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; }
  .card-l { border: none; padding: 0; }
}
mark.ph{background:#fff1a8;padding:0 3px;border-radius:2px;color:#6b4e00}
