/* TOPOS working surface. Tokens and type come from /styles.css. */
.topos-bar { background: var(--band); border-bottom: 1px solid var(--rule); }
.topos-bar-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; min-height: 48px; font-size: 0.9375rem; }
.topos-bar nav { display: flex; gap: 22px; }
.topos-bar a { text-decoration: none; font-weight: 500; color: var(--ink); border-bottom: 2px solid transparent; padding: 4px 0; }
.topos-bar a[aria-current="true"] { border-bottom-color: var(--navy); color: var(--navy); }
.who { color: var(--ink-2); }
.linkish { font: inherit; color: var(--navy); background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 0; }

#app { padding: clamp(36px, 6vw, 72px) 0 var(--space); min-height: 60vh; outline: none; }
#app h1 { margin-bottom: 14px; }
.narrow { max-width: 760px; }
.stack > * + * { margin-top: 28px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.muted { color: var(--ink-2); }
.small { font-size: 0.9375rem; }
.hint { font-size: 0.875rem; color: var(--ink-2); margin-top: 4px; }

.notice { border-left: 3px solid var(--gold); background: var(--band); padding: 14px 18px; }
.notice.error { border-left-color: #9b2226; }
.notice.ok { border-left-color: #1f6b3a; }
.busy { opacity: 0.6; pointer-events: none; }

/* Sign in */
.signin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 6vw, 88px); align-items: start; }
.card { border: 1px solid var(--ink); background: var(--bg); padding: 28px 30px 32px; }
.points { margin-top: 28px; border-top: 1px solid var(--ink); }
.points li { padding: 16px 0; border-bottom: 1px solid var(--rule); color: var(--ink-2); }
.points strong { display: block; color: var(--ink); font-weight: 600; }

/* Library */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; margin-top: 24px; }
.case { border: 1px solid var(--ink); padding: 26px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.case .kicker { font-size: 0.875rem; font-weight: 600; color: var(--navy); }
.case p { color: var(--ink-2); font-size: 0.9375rem; }
.case .meta { font-size: 0.875rem; color: var(--ink-2); margin-top: auto; padding-top: 10px; border-top: 1px solid var(--rule); }
.label { font-size: 0.9375rem; font-weight: 600; color: var(--navy); margin: 44px 0 12px; }
.list { border-top: 1px solid var(--ink); }
.list li { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.list .t { font-family: var(--serif); font-weight: 600; font-size: 1.1875rem; }
.list .s { font-size: 0.9375rem; color: var(--ink-2); }
.btn.small { padding: 9px 15px; font-size: 0.9375rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn.danger { background: transparent; color: #9b2226; border-color: #9b2226; }
.btn.danger:hover { background: #9b2226; color: #fff; }

/* Chips */
.chip { display: inline-block; font-size: 0.8125rem; font-weight: 600; padding: 3px 9px; border-radius: 2px; white-space: nowrap; }
.chip.strong { color: #1f6b3a; background: #e6f1e9; }
.chip.adequate { color: #8a5a00; background: #f8eed6; }
.chip.weak { color: #9b2226; background: #f7e4e4; }
.chip.missing, .chip.none { color: var(--ink-2); background: var(--band); border: 1px dashed var(--field); }
.chip.stale { color: var(--navy); background: #e8eef7; }

/* Forms */
.field { margin-bottom: 18px; }
.field label, .lbl { display: block; font-weight: 600; font-size: 0.9375rem; margin-bottom: 6px; }
.field input, .field textarea, .field select, input.plain, select.plain {
  width: 100%; font: 400 1rem/1.45 var(--sans); color: var(--ink); background: #fff;
  border: 1px solid var(--field); border-radius: 2px; padding: 11px 13px;
}
textarea, select, input { font-family: var(--sans); }
.field textarea { min-height: 88px; resize: vertical; }
.fact textarea, .ground textarea { width: 100%; font: 400 1rem/1.45 var(--sans); color: var(--ink); background: #fff; border: 1px solid var(--field); border-radius: 2px; padding: 11px 13px; resize: vertical; }
.field textarea.tall { min-height: 160px; }
.field textarea.serif { font-family: var(--serif); font-size: 1.125rem; min-height: 80px; }

/* Workbench */
.wb-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.title-input { font: 600 clamp(1.6rem, 3.2vw, 2.25rem)/1.15 var(--serif); width: 100%; border: 0; border-bottom: 1px solid var(--rule); padding: 4px 0 8px; background: transparent; color: var(--ink); }
.crumb { font-size: 0.9375rem; color: var(--ink-2); }
.saved { font-size: 0.875rem; color: var(--ink-2); }
.sec { border-top: 1px solid var(--ink); padding-top: 22px; margin-top: 44px; }
.sec > h2 { margin-bottom: 6px; max-width: none; }
.summary-table { width: 100%; border-collapse: collapse; margin-top: 14px; }
.summary-table td, .summary-table th { text-align: left; padding: 10px 8px 10px 0; border-bottom: 1px solid var(--rule); font-size: 0.9375rem; vertical-align: top; }
.summary-table th { font-weight: 600; color: var(--ink-2); }
details.case-text { border: 1px solid var(--rule); padding: 12px 16px; margin-top: 14px; }
details.case-text summary { cursor: pointer; font-weight: 600; color: var(--navy); }
details.case-text pre { white-space: pre-wrap; font: 0.9375rem/1.6 var(--sans); color: var(--ink-2); margin: 12px 0 0; max-height: 420px; overflow: auto; }
.fact { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: start; margin-bottom: 8px; }
.fid { font-size: 0.875rem; font-weight: 600; color: var(--navy); border: 1px solid var(--rule); background: var(--band); padding: 10px 0; text-align: center; border-radius: 2px; }
.fact textarea { min-height: 52px; }
.issue { border-top: 1px solid var(--rule); padding: 28px 0 8px; }
.issue:first-of-type { border-top: 0; }
.issue-head { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.issue-head h3 { font-size: 1.5rem; }
.hyp-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0 18px; }
.hyp-tabs button { font: 600 0.9375rem var(--sans); border: 1px solid var(--field); background: #fff; color: var(--ink); padding: 7px 13px; border-radius: 2px; cursor: pointer; }
.hyp-tabs button[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.tou { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.ground { display: grid; grid-template-columns: 160px 1fr auto; gap: 10px; margin-bottom: 10px; align-items: start; }
.ground textarea { min-height: 60px; }
.findings { border: 1px solid var(--ink); padding: 20px 22px; margin: 20px 0 8px; }
.finding { border-top: 1px solid var(--rule); padding: 12px 0; }
.finding:first-of-type { border-top: 0; padding-top: 0; }
.finding .el { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: #9b2226; }
.objection { background: var(--band); border-left: 3px solid var(--gold); padding: 12px 16px; font-family: var(--serif); font-style: italic; margin-top: 14px; }
.pyramid { border: 1px solid var(--ink); padding: 24px 26px; margin-top: 16px; }
.pyramid h4 { font-family: var(--serif); font-size: 1.1875rem; margin: 0 0 4px; }
.pyramid .gov { font-family: var(--serif); font-size: 1.375rem; line-height: 1.3; font-weight: 600; border-bottom: 1px solid var(--rule); padding-bottom: 16px; margin-bottom: 16px; }
.pyramid .kl { border-left: 3px solid var(--gold); padding: 2px 0 2px 16px; margin-top: 16px; }
.pyramid ul { list-style: disc; padding-left: 20px; color: var(--ink-2); }
.scqa dt { font-weight: 600; font-size: 0.875rem; color: var(--navy); margin-top: 10px; }
.scqa dd { margin: 0; color: var(--ink-2); }
.code-reveal { font: 600 1.25rem/1.4 var(--sans); letter-spacing: 0.04em; background: var(--band); border: 1px dashed var(--field); padding: 14px 18px; user-select: all; display: inline-block; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--rule); text-align: left; font-size: 0.9375rem; }
.table-wrap { overflow-x: auto; }

@media (max-width: 960px) {
  .signin-grid, .tou { grid-template-columns: 1fr; }
  .list li { grid-template-columns: 1fr; gap: 6px; }
  .ground { grid-template-columns: 1fr; }
  .fact { grid-template-columns: 48px 1fr; }
  .fact .btn { grid-column: 2; justify-self: start; }
}
@media print {
  .topos-bar, .btn, .nav-toggle { display: none !important; }
}

/* Library sections */
.lib-h { font-family: "Source Serif 4", Georgia, serif; font-size: 1.375rem; color: var(--navy); margin: 40px 0 14px; }
.own-case { margin-top: 48px; padding: 24px 24px 8px; background: var(--band); border-radius: 8px; }
.own-case h2 { font-family: "Source Serif 4", Georgia, serif; font-size: 1.375rem; color: var(--navy); margin: 0 0 6px; max-width: none; }
.own-case .muted { margin-bottom: 18px; }
