@import url("/static/fonts.css");

/* Chambers — paper, ink and brass. Status is blue / amber / oxblood (distinct in lightness too);
   machine-proposed material is violet so it is never mistaken for a lawyer's conclusion. */
:root {
  --paper: #F6F4EF; --panel: #FFFFFF; --panel-2: #FBFAF7; --line: #E4E0D6; --line-2: #EEEAE1;
  --ink: #1B2433; --ink-strong: #14213D; --muted: #4E5869; --faint: #5E6778;
  --navy: #14213D; --navy-2: #2A3A5C; --brass: #A8752A; --brass-ink: #8A6A3A; --brass-soft: #FBF7EE; --brass-line: #E4D3B4;
  --slate: #3E4C63; --slate-bg: #EEF0F3;
  --blue: #1F4E8C; --blue-bg: #E6EEF8;
  --amber: #7A4F00; --amber-bg: #FBF1DE;
  --oxblood: #8E2A2A; --oxblood-bg: #F8E6E4;
  --violet: #4A3480; --violet-bg: #EFEAF7; --violet-line: #E3D9F2;
  --highlight: #FCE9B8;
  --radius: 10px; --radius-sm: 8px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Source Sans Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--paper); color: var(--ink); font: 15.5px/1.6 var(--sans); -webkit-font-smoothing: antialiased;
       font-feature-settings: "kern", "liga"; text-rendering: optimizeLegibility; }
table, .stat .n, .mono, .kv dd { font-variant-numeric: tabular-nums; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--ink-strong); text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--ink-strong); letter-spacing: -0.01em; margin: 0 0 .5rem; }
h1 { font-size: 31px; line-height: 1.2; } h2 { font-size: 21px; line-height: 1.3; margin-top: 1.25rem; } h3 { font-size: 17px; }
p { margin: .4rem 0 .85rem; }
.prose { font-family: var(--serif); font-size: 17px; line-height: 1.7; color: #232C3B; max-width: 72ch; }
.muted { color: var(--muted); } .small { font-size: 13.5px; } .mono { font-family: var(--mono); font-size: 13px; }
.nowrap { white-space: nowrap; } .right { text-align: right; }
.eyebrow { font-family: var(--sans); font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--brass-ink); font-weight: 600; }

/* ---------------------------------------------------------------- header */
header.top { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 18px; padding: 0 32px; height: 56px; border-bottom: 2px solid var(--brass); }
header.top a { color: #fff; }
header.top a:hover { text-decoration: none; }
header.top .brand { display: flex; align-items: baseline; gap: 8px; }
header.top .brand b { font-family: var(--serif); font-size: 20px; font-weight: 600; }
header.top .brand span { font-size: 12.5px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: #D9B77A; }
header.top .sep { width: 1px; height: 22px; background: #33415E; }
header.top .ws { font-size: 13px; color: #B8C2D6; }
header.top .spacer { flex: 1; }
header.top .nav-link { font-size: 13px; color: #D5DCE8; }
header.top .me { display: flex; align-items: center; gap: 10px; }
header.top .avatar { width: 30px; height: 30px; border-radius: 15px; background: var(--navy-2); color: var(--paper); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
header.top .who { display: flex; flex-direction: column; line-height: 1.2; }
header.top .who b { font-size: 13px; font-weight: 500; }
header.top .who i { font-style: normal; font-size: 10.5px; color: #9AA8C2; text-transform: uppercase; letter-spacing: .08em; }
header.top form { display: inline; margin: 0; }
header.top button { background: transparent; color: #D5DCE8; border: 1px solid #3C4B6B; padding: 0 12px; height: 32px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 12px; }
header.top button:hover { border-color: #6B7A99; color: #fff; }

.wrap { max-width: 1360px; margin: 0 auto; padding: 24px 32px; }
.txnhead { background: var(--panel); border-bottom: 1px solid var(--line); }
.txnhead .wrap { padding-bottom: 0; }
.txnhead .row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.txnhead .title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.txnhead h1 { font-size: 32px; margin: 0; }
.txnhead .meta { color: var(--muted); font-size: 14px; margin: .3rem 0 0; }
.cutoff { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--brass-line); background: var(--brass-soft); border-radius: var(--radius-sm); }
.cutoff span { font-size: 11.5px; color: var(--brass-ink); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.cutoff strong { font-family: var(--serif); font-size: 18px; color: var(--ink-strong); font-weight: 600; }
nav.tabs { display: flex; gap: 2px; flex-wrap: wrap; margin-top: 18px; }
nav.tabs a { padding: 10px 14px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; font-size: 15px; }
nav.tabs a.on { color: var(--ink-strong); border-bottom-color: var(--brass); font-weight: 600; }
nav.tabs a:hover { text-decoration: none; color: var(--ink-strong); }

/* ---------------------------------------------------------------- surfaces */
.flash { padding: .7rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: var(--blue-bg); color: var(--blue); border-color: #C9D8EE; }
.flash.err { background: var(--oxblood-bg); color: var(--oxblood); border-color: #EDC9C4; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 20px; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel.dark { background: var(--navy); border-color: var(--navy); color: #E8ECF4; }
.panel.dark h2, .panel.dark h3 { color: #fff; }
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(340px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1000px) { .g2, .g3, .g4, .split { grid-template-columns: 1fr; } .wrap { padding: 20px 16px; } }

.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.stat .l { font-size: 12.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); font-weight: 600; order: -1; }
.stat .n { font-family: var(--serif); font-size: 34px; font-weight: 600; line-height: 1.1; color: var(--ink-strong); }
.stat .n small { font-size: 16px; color: var(--faint); font-weight: 500; }
.stat .sub { font-size: 14px; color: var(--muted); }
.stat.bad .n { color: var(--oxblood); } .stat.warn .n { color: var(--amber); } .stat.ok .n { color: var(--blue); }
.bar { height: 6px; background: #ECE8DF; border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; background: var(--blue); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; background: transparent; border-bottom: 1px solid var(--line); }
tbody tr:hover td { background: var(--panel-2); }
td.path { word-break: break-word; }
tr.group td { background: var(--panel-2); font-family: var(--serif); font-weight: 600; color: var(--ink-strong); font-size: 15px; }

/* ---------------------------------------------------------------- badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--slate-bg); color: var(--slate); white-space: nowrap; line-height: 1.6; }
.badge.ok { background: var(--blue-bg); color: var(--blue); }
.badge.warn { background: var(--amber-bg); color: var(--amber); }
.badge.bad { background: var(--oxblood-bg); color: var(--oxblood); }
.badge.info, .badge.ai { background: var(--violet-bg); color: var(--violet); }
.sev { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.sev.critical { color: #6E1A1A; } .sev.high { color: var(--oxblood); } .sev.medium { color: var(--amber); } .sev.low { color: var(--faint); }

/* ---------------------------------------------------------------- forms */
form.inline { display: inline; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.form-row > label { flex: 1 1 180px; }
label { display: block; font-size: 13.5px; color: var(--slate); font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid #CFC9BC; border-radius: var(--radius-sm); font: inherit; font-size: 15.5px; font-weight: 400; color: var(--ink); background: #fff; margin-top: 5px; }
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 3px solid #D6E2F2; border-color: var(--blue); }
input[type=file] { margin-top: 6px; font-size: 13px; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; background: var(--navy); color: #fff; border: 0; padding: 0 18px; border-radius: var(--radius-sm); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
button:hover, .btn:hover { background: #22325A; text-decoration: none; color: #fff; }
button.secondary, .btn.secondary { background: #fff; color: var(--ink-strong); border: 1px solid #CFC9BC; font-weight: 500; }
button.secondary:hover, .btn.secondary:hover { background: var(--panel-2); color: var(--ink-strong); }
button.accent, .btn.accent { background: var(--brass); } button.accent:hover, .btn.accent:hover { background: #946622; }
button.danger { background: var(--oxblood); } button.danger:hover { background: #7A2222; }
button.small, .btn.small { min-height: 32px; padding: 0 12px; font-size: 12.5px; }
button:disabled { opacity: .45; cursor: not-allowed; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 16px; margin: 0 0 14px; }
legend { font-size: 12px; color: var(--slate); font-weight: 600; padding: 0 .3rem; }
.checks label { display: inline-flex; gap: .4rem; align-items: center; color: var(--ink); font-size: 13.5px; margin: .2rem 1.1rem .2rem 0; font-weight: 400; }

/* ---------------------------------------------------------------- content */
.quote { border: 1px solid var(--line); background: var(--panel-2); padding: 14px 18px; margin: 8px 0; white-space: pre-wrap; font-family: var(--serif); font-size: 17px; line-height: 1.7; color: #232C3B; border-radius: var(--radius-sm); max-width: 78ch; }
.quote mark, .pagetext mark { background: var(--highlight); box-shadow: 0 0 0 2px var(--highlight); border-radius: 2px; color: inherit; }
.callout { border-radius: var(--radius-sm); padding: 12px 16px; margin: 8px 0 16px; border: 1px solid; }
.callout.warn { background: var(--amber-bg); color: #5C3B00; border-color: #EBD5A8; }
.callout.bad { background: var(--oxblood-bg); color: #6B2419; border-color: #EDC9C4; }
.callout.info { background: var(--brass-soft); color: #5C4520; border-color: var(--brass-line); }
.callout.ok { background: var(--blue-bg); color: #1B3E6B; border-color: #C9D8EE; }
.callout.ai { background: #F7F3FC; color: #3F2D6B; border-color: var(--violet-line); }
.pagetext { white-space: pre-wrap; font-family: var(--serif); font-size: 17px; line-height: 1.75; color: #232C3B; background: #FFFEFB; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 22px 28px; max-height: 680px; overflow: auto; max-width: 80ch; }
.pagetext.sheet { font-family: var(--mono); font-size: 13.5px; line-height: 1.65; max-width: none; }
.page { margin-bottom: 18px; scroll-margin-top: 16px; }
.page .pagehead { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; font-size: 12.5px; }
.page .pagehead strong { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--brass-ink); }
.page.focus .pagetext { outline: 2px solid var(--brass); }
pre.json { white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); padding: 14px; border-radius: var(--radius-sm); max-height: 520px; overflow: auto; }
details > summary { cursor: pointer; color: var(--blue); font-weight: 500; }
details[open] > summary { margin-bottom: 10px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; font-size: 15px; }
.kv dt { color: var(--faint); } .kv dd { margin: 0; word-break: break-word; }
.login { max-width: 420px; margin: 10vh auto; }
.login h1 { font-size: 28px; }
.empty { color: var(--faint); padding: 8px 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pill-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-nav a { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 13px; }
.pill-nav a.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.pill-nav a:hover { text-decoration: none; border-color: #CFC9BC; }
.list-row { display: grid; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 4px; background: #E0A15A; margin-right: 8px; vertical-align: middle; }
.dot.soft { background: #8FA4C8; }
.readiness { display: flex; flex-direction: column; gap: 12px; }
.readiness .big { font-family: var(--serif); font-size: 26px; font-weight: 600; color: #fff; }
.readiness .eyebrow { color: #D9B77A; }
.minigrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mini { padding: 12px 14px; border-radius: var(--radius-sm); }
.mini b { display: block; font-family: var(--serif); font-size: 24px; font-weight: 600; }
.mini span { font-size: 12px; }
.mini.ai { background: #F3EFF9; color: var(--violet); } .mini.ok { background: #EAF0F8; color: var(--blue); }
.mini.warn { background: #FBF4E6; color: var(--amber); } .mini.neutral { background: #F1F2F4; color: var(--slate); }
.crumbs { font-size: 13px; color: var(--faint); margin-bottom: 12px; display: flex; gap: 8px; }
.choice { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 1px solid #CFC9BC; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; color: var(--slate); cursor: pointer; background: #fff; }
.choice:has(input:checked) { border: 2px solid var(--blue); background: #EEF3FA; color: var(--ink-strong); font-weight: 600; }
a.mini:hover { text-decoration: none; filter: brightness(.97); }
input[type=file]::file-selector-button { font: inherit; font-size: 13px; font-weight: 500; color: var(--ink-strong); background: #fff; border: 1px solid #CFC9BC; border-radius: 6px; padding: 7px 12px; margin-right: 10px; cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--panel-2); }

/* ---------------------------------------------------------------- auth */
body.auth { background: var(--paper); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 5fr) 7fr; }
.auth-brand { background: var(--navy); color: #E8ECF4; padding: 40px 48px; display: flex; flex-direction: column; border-right: 3px solid var(--brass); }
.auth-brand .brand { display: flex; align-items: baseline; gap: 8px; color: #fff; }
.auth-brand .brand:hover { text-decoration: none; }
.auth-brand .brand b { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.auth-brand .brand span { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: #D9B77A; }
.auth-pitch { margin-top: auto; margin-bottom: auto; max-width: 440px; }
.auth-pitch h2 { color: #fff; font-size: 32px; line-height: 1.2; margin: 0 0 20px; }
.auth-pitch ul { margin: 0; padding: 0; list-style: none; }
.auth-pitch li { padding: 11px 0 11px 22px; border-top: 1px solid #2A3A5C; position: relative; font-size: 16.5px; line-height: 1.5; color: #D5DCE8; }
.auth-pitch li::before { content: ""; position: absolute; left: 0; top: 18px; width: 8px; height: 8px; border-radius: 4px; background: var(--brass); }
.auth-foot { font-size: 12.5px; color: #9AA8C2; margin: 0; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h1 { font-size: 32px; margin: 6px 0 10px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }
.auth-form label { font-size: 14px; }
.auth-form .hint { display: block; font-weight: 400; color: var(--faint); font-size: 13px; margin-top: 5px; }
.auth-form label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--ink); line-height: 1.45; }
.auth-form label.check input { margin-top: 3px; }
.right-link { float: right; font-weight: 500; }
button.wide { width: 100%; min-height: 46px; font-size: 15px; }
.auth-alt { margin-top: 22px; font-size: 14px; color: var(--muted); }
.auth-inline { margin-top: 12px; }
.ws-switch select { min-height: 32px; margin: 0; padding: 4px 10px; background: var(--navy-2); color: #fff; border-color: #3C4B6B; font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 860px) { .auth-shell { grid-template-columns: 1fr; } .auth-brand { padding: 24px; } .auth-pitch { display: none; } }

/* Original-page preview: page images with passage highlights */
.viewtoggle { display: inline-flex; border: 1px solid #CFC9BC; border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.viewtoggle a, .viewtoggle span { padding: 5px 14px; color: var(--muted); font-weight: 500; font-size: 13.5px; }
.viewtoggle a + a, .viewtoggle span + a { border-left: 1px solid #CFC9BC; }
.viewtoggle a:hover { text-decoration: none; color: var(--ink-strong); background: var(--panel-2); }
.viewtoggle a.on { background: var(--navy); color: #fff; }
.viewtoggle .off { color: var(--faint); cursor: not-allowed; }
.pv { position: relative; max-width: 900px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.pv img { display: block; width: 100%; height: auto; aspect-ratio: auto 210 / 297; }
.pv .hl, .pvcrop .hl { position: absolute; background: var(--highlight); mix-blend-mode: multiply; box-shadow: 0 0 0 2px var(--highlight); border-radius: 2px; pointer-events: none; }
.pvcrop { display: block; position: relative; overflow: hidden; max-width: 78ch; margin: 10px 0 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.pvcrop img { position: absolute; max-width: none; height: auto; }
.pvcrop:hover { border-color: var(--brass-line); }

/* ---------------------------------------------------------------- cap table view: differences */
td.cell-conflict { background: var(--oxblood-bg); color: var(--oxblood); font-weight: 600; }
td.cell-uncertain { background: var(--amber-bg); color: var(--amber); font-weight: 600; }
td.cell-conflict a, td.cell-uncertain a { color: inherit; }
