/* BENCH AI — registry style. Navy + gold, ruled lines, square edges, no shadows. */
:root {
  --navy: #0d1b33;
  --navy-2: #172a4b;
  --navy-line: #2a3d60;
  --gold: #b08d3c;
  --gold-ink: #7d6224;
  --gold-wash: #f3ecdb;
  --ink: #141b27;
  --ink-2: #3f4858;
  --ink-3: #6b7280;
  --rule: #d9d5cb;
  --rule-2: #ebe8e0;
  --paper: #f7f6f2;
  --sheet: #ffffff;
  --good: #1f6b45;
  --warn: #8a5a00;
  --bad: #9b1c24;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.6 var(--sans); color: var(--ink); background: var(--paper); }
a { color: var(--navy); text-decoration-color: var(--gold); text-underline-offset: 3px; }
a:hover { color: var(--gold-ink); }
h1, h2, h3, h4 { margin: 0 0 .5em; color: var(--navy); font-weight: 600; line-height: 1.25; }
h1 { font: 600 30px/1.15 var(--serif); letter-spacing: -.01em; }
h2 { font: 600 19px/1.3 var(--serif); }
h3 { font-size: 15px; }
p { margin: 0 0 .8em; }
code { font: 13px var(--mono); }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- Shell: navy registry sidebar ---------- */
body.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--navy); color: #cfd6e2; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 3px solid var(--gold); }
.brand { display: block; padding: 26px 24px 22px; text-decoration: none; border-bottom: 1px solid var(--navy-line); }
.brand-name { display: block; font: 600 22px/1 var(--serif); color: #fff; letter-spacing: .14em; }
.brand-name span { color: var(--gold); margin-left: .3em; }
.brand-sub { display: block; margin-top: 8px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #8e9bb3; }
.sidenav { display: flex; flex-direction: column; flex: 1; padding: 14px 0; overflow-y: auto; }
.navlabel { padding: 18px 24px 6px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #7f8ca6; }
.sidenav a { display: flex; align-items: baseline; gap: 10px; padding: 9px 24px; color: #d5dbe6; text-decoration: none; font-size: 14.5px; border-left: 3px solid transparent; margin-left: -3px; }
.sidenav a:hover { color: #fff; background: var(--navy-2); }
.sidenav a.active { color: #fff; background: var(--navy-2); border-left-color: var(--gold); }
.navnum { font: 500 11px var(--mono); color: var(--gold); width: 26px; flex: none; }
.sideuser { margin-top: auto; padding: 16px 24px 22px; border-top: 1px solid var(--navy-line); display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.sideuser .who { color: #fff; text-decoration: none; font-size: 14px; display: flex; flex-direction: column; min-width: 0; }
.sideuser .who small { color: #8e9bb3; font-size: 12px; }
.sideuser form { margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; cursor: pointer; }
.side .linkbtn { color: #cfd6e2; font-size: 13px; white-space: nowrap; }
.navtoggle { display: none; }
.shell { display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }
.wrap { width: 100%; max-width: 1180px; padding: 40px 48px 56px; flex: 1; }
.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 48px; font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--rule); }

/* Signed-out pages */
body.bare { min-height: 100vh; display: flex; flex-direction: column; }
.barehead { background: var(--navy); border-bottom: 3px solid var(--gold); }
.barehead .brand { border: 0; padding: 20px 32px; }
body.bare .wrap { margin: 0 auto; }
body.bare .foot { padding: 16px 32px; }

/* ---------- Page header ---------- */
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; padding-bottom: 18px; margin-bottom: 28px; border-bottom: 1px solid var(--navy); position: relative; }
.pagehead::after { content: ""; position: absolute; left: 0; bottom: -3px; width: 72px; height: 3px; background: var(--gold); }
.pagehead p { margin: 0; }
.pagehead h1 { margin-bottom: 4px; }
.eyebrow { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px !important; }
.eyebrow a { color: var(--ink-2); text-decoration: none; }
.eyebrow a:hover { color: var(--gold-ink); }

/* ---------- Sheets (formerly cards) ---------- */
.card { background: var(--sheet); border: 1px solid var(--rule); border-top: 2px solid var(--navy); padding: 24px 26px; margin-bottom: 24px; min-width: 0; }
.card.flush { padding: 0; }
.card.narrow, .narrow { max-width: 760px; }
.card > h2:first-child, .cardhead h2 { padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid var(--rule-2); }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--rule-2); }
.cardhead h2, .cardhead h3 { margin: 0; padding-bottom: 10px; border: 0; }
.cardhead .actions, .cardhead form { padding-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.grid2 > .card, .grid3 > .card { margin-bottom: 0; }
.grid3 + .card, .grid2 + .card { margin-top: 24px; }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.sidecol .card { border-top-color: var(--gold); }
.sidecol.sticky { position: sticky; top: 24px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; flex-wrap: wrap; }

/* ---------- Forms ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label small { font-weight: 400; color: var(--ink-3); }
input, select, textarea { font: 15px/1.4 var(--sans); color: var(--ink); background: #fff; border: 1px solid #bfc4cd; border-radius: 2px; padding: 10px 12px; width: 100%; min-width: 0; }
textarea { line-height: 1.6; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: -1px; border-color: var(--gold); }
input[type=checkbox] { width: auto; accent-color: var(--navy); }
input[type=file] { padding: 8px; background: var(--paper); }
.inlinecheck { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 14px var(--sans); padding: 10px 18px; border-radius: 2px; border: 1px solid var(--navy); background: transparent; color: var(--navy); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--navy); color: #fff; }
.btn.primary { background: var(--navy); color: #fff; box-shadow: inset 0 -2px 0 var(--gold); }
.btn.primary:hover { background: var(--navy-2); }
.btn.ghost { border-color: var(--rule); color: var(--ink-2); }
.btn.ghost:hover { border-color: var(--navy); background: transparent; color: var(--navy); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn[disabled]:hover { background: transparent; color: var(--navy); }
.btn.primary[disabled]:hover { background: var(--navy); color: #fff; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--gold); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Notices and labels ---------- */
.flash { padding: 12px 16px; margin-bottom: 20px; font-size: 14px; background: var(--sheet); border: 1px solid var(--rule); border-left: 4px solid var(--navy); }
.flash-success { border-left-color: var(--good); }
.flash-error { border-left-color: var(--bad); color: var(--bad); }
.flash-info { border-left-color: var(--gold); }
.busybar { position: fixed; inset: auto 0 0 0; background: var(--navy); color: #fff; padding: 14px 28px; font-size: 14px; z-index: 50; display: flex; align-items: center; gap: 12px; border-top: 3px solid var(--gold); }
.busybar::before { content: ""; width: 14px; height: 14px; border: 2px solid var(--gold); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
.badge { display: inline-flex; align-items: center; gap: 6px; font: 500 12px/1.4 var(--sans); color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
.badge::before { content: ""; width: 8px; height: 8px; background: #a3a9b4; flex: none; }
.badge-good { color: var(--good); } .badge-good::before { background: var(--good); }
.badge-warn { color: var(--warn); } .badge-warn::before { background: #c58a14; }
.badge-bad { color: var(--bad); } .badge-bad::before { background: var(--bad); }
.badge-gold { color: var(--gold-ink); } .badge-gold::before { background: var(--gold); }
.badges { display: flex; gap: 6px 16px; flex-wrap: wrap; margin: 8px 0; }
.ailabel { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--gold-ink); border-top: 1px solid var(--gold); border-bottom: 1px solid var(--gold); padding: 6px 0; margin-bottom: 16px; font-variant: small-caps; letter-spacing: .06em; }
.ailabel span:first-child { font-weight: 600; }
.ailabel span + span { font-variant: normal; letter-spacing: 0; color: var(--ink-3); }
.empty { border: 1px solid var(--rule); border-top: 2px solid var(--gold); background: var(--sheet); padding: 36px 32px; margin-bottom: 24px; }
.empty h3 { font: 600 19px var(--serif); }
.empty p { color: var(--ink-2); max-width: 600px; margin: 0 0 18px; }

/* ---------- Sign-in ---------- */
.authwrap { max-width: 440px; margin: 7vh 0 0; }
.card.auth { padding: 32px 34px; border-top: 3px solid var(--gold); }
.authhead { margin-bottom: 22px; }
.authhead .mark { display: none; }
.authhead h1 { font-size: 26px; }
.authnote { font-size: 12px; color: var(--ink-3); margin-top: 14px; }
.steps { padding-left: 20px; font-size: 14px; }
.steps li { margin-bottom: 10px; }
.secret { font: 500 18px/1.4 var(--mono); letter-spacing: .08em; background: var(--paper); border: 1px dashed var(--gold); padding: 10px 12px; margin: 8px 0; word-break: break-all; }

/* ---------- Overview: ruled module index ---------- */
.modules { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 2px solid var(--navy); border-bottom: 1px solid var(--rule); margin-bottom: 32px; background: var(--sheet); }
.module { display: block; padding: 20px 22px 22px; text-decoration: none; color: var(--ink); border-right: 1px solid var(--rule); }
.module:last-child { border-right: 0; }
.module:hover { background: var(--gold-wash); color: var(--ink); }
.module .num { display: block; font: 600 28px/1 var(--serif); color: var(--gold); }
.module h3 { font: 600 17px var(--serif); margin: 14px 0 6px; color: var(--navy); }
.module p { color: var(--ink-2); font-size: 13.5px; margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--rule-2); }
.list li:first-child { border-top: 0; }
.list a { display: flex; flex-direction: column; padding: 10px 0; text-decoration: none; color: var(--ink); }
.list a span { font-size: 12.5px; color: var(--ink-3); }
.list a:hover b { color: var(--gold-ink); text-decoration: underline; text-decoration-color: var(--gold); }
.list.plain li { padding: 6px 0; }
.security { border-top-color: var(--gold); }
.security p { margin: 0; font-size: 14px; }

/* ---------- Tables ---------- */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .08em; padding: 10px 14px; border-bottom: 1px solid var(--navy); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
.card:not(.flush) .table td:first-child, .card:not(.flush) .table th:first-child { padding-left: 0; }
.card:not(.flush) .table td:last-child, .card:not(.flush) .table th:last-child { padding-right: 0; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbfaf7; }
.table.small td { padding: 7px 10px; font-size: 13px; }
.docid { font: 500 12px var(--mono); color: var(--gold-ink); }

/* ---------- Case ---------- */
.uploadbox { margin-top: 16px; border-top: 1px solid var(--rule-2); padding-top: 14px; }
.uploadbox summary { cursor: pointer; font-weight: 600; color: var(--navy); margin-bottom: 12px; }
.members { list-style: none; padding: 0; margin: 0 0 14px; }
.members li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--rule-2); font-size: 14px; flex-wrap: wrap; }
.members li:first-child { border-top: 0; }
.inlineform { display: flex; gap: 8px; }
.toc { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-bottom: 4px; font-size: 13px; }
.toc a { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--rule); }
.toc a:hover { color: var(--gold-ink); border-color: var(--gold); }
.asec { padding-top: 22px; margin-top: 22px; border-top: 1px solid var(--rule-2); scroll-margin-top: 24px; }
.asec h3 { font: 600 18px var(--serif); }
.asec ol, .asec ul { padding-left: 22px; margin: 0; }
.asec li { margin-bottom: 6px; }
.arg { border-left: 2px solid var(--gold); padding: 2px 0 2px 16px; margin-bottom: 14px; }
.arg p { margin: 4px 0 0; }
.ref { font: 500 12px var(--mono); color: var(--navy); text-decoration: none; border-bottom: 1px solid var(--gold); white-space: nowrap; }
.ref:hover { color: var(--gold-ink); }
.src { white-space: nowrap; }
.docpage { border-top: 1px solid var(--rule-2); padding: 18px 0; scroll-margin-top: 24px; }
.docpage:target { background: var(--gold-wash); }
.pageno { font: 500 11px var(--mono); color: var(--gold-ink); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 8px; }
.doctext { font: 16px/1.75 var(--serif); max-width: 72ch; }

/* ---------- Assistant ---------- */
.thread { display: flex; flex-direction: column; gap: 0; margin-bottom: 24px; border-top: 2px solid var(--navy); background: var(--sheet); border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); }
.msg { padding: 22px 26px; border-bottom: 1px solid var(--rule); }
.msg.user { background: var(--paper); }
.msg.user p { margin: 0; font: 17px/1.5 var(--serif); color: var(--navy); }
.msg .who { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.sources { border-top: 1px solid var(--rule-2); margin-top: 16px; padding-top: 12px; }
.sources h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); }
.sources ul { margin: 0; padding-left: 18px; font-size: 14px; }
.prose { font-size: 15.5px; line-height: 1.7; max-width: 76ch; }
.prose h3, .prose h4, .prose h5, .prose h6 { margin-top: 1.2em; font-family: var(--serif); }
.prose ul, .prose ol { padding-left: 22px; }

/* ---------- Precedents ---------- */
.searchbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 16px; }
.searchbar input[type=search] { flex: 1 1 320px; }
.searchbar select { width: auto; flex: 0 1 200px; }
.searchbar .year { width: 90px; }
.result { display: flex; gap: 14px; border-top: 1px solid var(--rule-2); padding: 18px 0; }
.result h3 { margin: 0; font: 600 18px var(--serif); }
.result h3 a { text-decoration: none; color: var(--navy); }
.result h3 a:hover { text-decoration: underline; text-decoration-color: var(--gold); }
.result .meta { font: 500 12.5px var(--mono); color: var(--ink-3); margin-top: 2px; }
.pick { padding-top: 4px; }
blockquote { margin: 10px 0 0; padding: 4px 0 4px 16px; border-left: 2px solid var(--rule); font: 15px/1.65 var(--serif); color: var(--ink-2); }
.judgment .para { display: flex; gap: 16px; font: 16px/1.8 var(--serif); scroll-margin-top: 24px; padding: 4px 0; max-width: 78ch; }
.judgment .para:target { background: var(--gold-wash); }
.pn { flex: none; width: 34px; text-align: right; color: var(--gold-ink); font: 500 12px/2.4 var(--mono); text-decoration: none; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; margin: 0 0 14px; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Judgments ---------- */
.jsection { border-top: 1px solid var(--rule-2); padding: 22px 0; scroll-margin-top: 24px; }
.jsection:first-child { border-top: 0; padding-top: 0; }
.jsection .cardhead { border: 0; margin-bottom: 6px; }
.jsection .cardhead h3 { font: 600 18px var(--serif); padding: 0; }
.jsection select { width: auto; font-size: 13px; padding: 5px 8px; }
.jsection textarea { font: 16px/1.8 var(--serif); margin: 8px 0; background: #fffefb; }
.aibox { border-left: 2px solid var(--gold); background: #fdfbf6; padding: 12px 16px; margin: 10px 0; }
.aibox summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--gold-ink); }
.aibox[open] summary { margin-bottom: 10px; }
.suggest-text { font: 15.5px/1.75 var(--serif); max-height: 360px; overflow: auto; margin-bottom: 10px; }
.savebar { position: sticky; bottom: 0; display: flex; gap: 8px; background: var(--sheet); border-top: 1px solid var(--navy); padding: 14px 0 0; margin-top: 8px; }
.outline { padding-left: 22px; margin: 0; font-size: 14px; }
.outline li { margin-bottom: 10px; }
.outline li a { display: block; text-decoration: none; }
.review h3 { margin-top: 20px; font-family: var(--serif); }
.review .count { font: 500 12px var(--mono); color: var(--ink-3); }
.review ul { padding-left: 20px; font-size: 14px; }
.review q { font-family: var(--serif); color: var(--ink-2); }
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--rule); margin: -12px 0 24px; overflow-x: auto; }
.tabs a { padding: 10px 16px; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 14px; }
.tabs a.active { color: var(--navy); border-bottom-color: var(--gold); font-weight: 600; }

/* ---------- Print report ---------- */
body.print { background: #fff; display: block; }
.report { margin: 0 auto; }
@media print {
  .noprint, .side, .foot, .toc { display: none !important; }
  body.app { display: block; }
  .card { border: 0; padding: 0; }
  body { background: #fff; font-size: 12px; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .modules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .module:nth-child(2) { border-right: 0; }
  .module:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .layout-side { grid-template-columns: 1fr; }
  .sidecol.sticky { position: static; }
  .wrap { padding: 32px 32px 48px; }
  .foot { padding: 16px 32px; }
}
@media (max-width: 900px) {
  body.app { display: block; }
  .side { position: sticky; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 3px solid var(--gold); z-index: 20; }
  .side .brand { border: 0; padding: 14px 16px; flex: 1; }
  .brand-name { font-size: 18px; }
  .brand-sub { display: none; }
  .navtoggle { display: block; margin-right: 16px; background: transparent; color: #fff; border: 1px solid var(--navy-line); border-radius: 2px; padding: 6px 14px; font: 500 14px var(--sans); }
  .sidenav { display: none; width: 100%; padding: 0 0 8px; border-top: 1px solid var(--navy-line); }
  .side.open .sidenav { display: flex; }
  .sidenav a { padding: 11px 16px; }
  .navlabel { padding: 14px 16px 4px; }
  .sideuser { padding: 14px 16px 6px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .wrap { padding: 24px 16px 40px; }
  .foot, body.bare .foot { padding: 16px; }
  .barehead .brand { padding: 16px; }
  h1 { font-size: 24px; }
  .card { padding: 18px 16px; }
  .card.auth { padding: 24px 20px; }
  .authwrap { margin-top: 3vh; }
  .modules { grid-template-columns: 1fr; }
  .module { border-right: 0; border-bottom: 1px solid var(--rule); }
  .module:last-child { border-bottom: 0; }
  .row2 { grid-template-columns: 1fr; }
  .msg { padding: 18px 16px; }
  .searchbar select, .searchbar .year { flex: 1 1 45%; }
  .inlineform { flex-direction: column; }
}