/* Workspace layout. The reconciliation screen is the one that matters: the source
   document stays on the left, always, and the accountant never opens another tab. */

/* ---------- top bar ---------- */
.top {
  height: 52px; background: var(--surface); border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 750; letter-spacing: -.02em;
  font-size: 15px; text-decoration: none; }
.brand .m { width: 22px; height: 22px; border-radius: 6px; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.co { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border: 1px solid var(--rule);
  border-radius: 8px; font-size: 13px; font-weight: 600; background: #fbfcfe; cursor: pointer; }
.co:hover { border-color: var(--ink3); }
.co .mst { font-size: 11px; color: var(--ink3); font-weight: 500; }
.co .car { color: var(--ink3); font-size: 10px; }
.co-menu { position: absolute; top: 48px; left: 150px; z-index: 60; min-width: 300px;
  background: #fff; border: 1px solid var(--rule); border-radius: 11px; padding: 6px;
  box-shadow: 0 14px 40px rgba(20,26,46,.16); max-height: 60vh; overflow-y: auto; }
.co-menu button { display: flex; width: 100%; text-align: left; padding: 8px 10px;
  border-radius: 8px; gap: 10px; align-items: center; font-size: 13px; }
.co-menu button:hover { background: var(--rule2); }
.co-menu button.on { background: var(--ink); color: #fff; }
.co-menu .mst { font-family: var(--mono); font-size: 11px; opacity: .7; }
.co-menu .pend { margin-left: auto; font-family: var(--mono); font-size: 11px; font-weight: 700; }

.tabs { display: flex; gap: 2px; margin-left: 6px; }
.tabs a { padding: 6px 11px; border-radius: 7px; font-size: 13px; color: var(--ink2);
  text-decoration: none; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.tabs a.on { background: var(--ink); color: #fff; font-weight: 600; }
.tabs a:hover:not(.on) { background: var(--rule2); }
.tabs a .ct { font-family: var(--mono); font-size: 10.5px; font-weight: 700; padding: 0 5px;
  border-radius: 20px; background: var(--rose); color: #fff; }
.tabs a.on .ct { background: #fff; color: var(--ink); }
.usage { font-size: 11.5px; color: var(--ink2); text-align: right; line-height: 1.3; }
.usage b { font-family: var(--mono); color: var(--ink); font-size: 12.5px; }
.usage .warn { color: var(--amber); font-weight: 700; }
.avatar { width: 29px; height: 29px; border-radius: 50%; background: var(--teal); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; }

/* ---------- gate (login, sign-up, onboarding wizard) ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; }
.gate .box { width: 100%; max-width: 520px; }
.gate .box.wide { max-width: 720px; }
.gate h1 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 6px; }
.gate .lede { color: var(--ink2); font-size: 14.5px; margin: 0 0 22px; }
.gate .brandline { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px;
  letter-spacing: -.03em; margin-bottom: 26px; text-decoration: none; }
.gate .brandline .m { width: 25px; height: 25px; border-radius: 7px; background: var(--ink);
  color: #fff; display: grid; place-items: center; font-size: 12px; }
.steps { display: flex; gap: 6px; margin-bottom: 22px; }
.steps .s { flex: 1; height: 3px; border-radius: 3px; background: var(--rule); }
.steps .s.on { background: var(--teal); }
.steps .s.done { background: var(--teal-dk); }
.regime-pick { display: grid; gap: 10px; }
.regime-pick label { display: flex; gap: 12px; align-items: flex-start; padding: 14px 15px;
  border: 1px solid var(--rule); border-radius: 12px; cursor: pointer; background: #fbfcfe; }
.regime-pick label:hover { border-color: var(--ink3); }
.regime-pick input { margin-top: 3px; }
.regime-pick input:checked + div { color: var(--ink); }
.regime-pick label:has(input:checked) { border-color: var(--teal); background: var(--teal-bg);
  box-shadow: 0 0 0 3px rgba(13,122,107,.09); }
.regime-pick b { display: block; font-size: 14.5px; margin-bottom: 3px; }
.regime-pick p { margin: 0; font-size: 13px; color: var(--ink2); line-height: 1.5; }

/* ---------- generic page ---------- */
.page { padding: 22px 26px 60px; max-width: 1280px; margin: 0 auto; }
.page h1 { font-size: 22px; letter-spacing: -.02em; margin: 0 0 4px; }
.page .lede { color: var(--ink2); font-size: 14px; margin: 0 0 22px; }
.page-h { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-h .sp { flex: 1; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 12px;
  margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--rule); border-radius: 13px; padding: 15px 17px; }
.stat .k { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink3);
  font-weight: 800; }
.stat .v { font-family: var(--mono); font-size: 27px; font-weight: 700; letter-spacing: -.02em;
  margin: 5px 0 2px; }
.stat .s { font-size: 12.5px; color: var(--ink2); }
.stat.warn { border-color: #f0dcb5; background: var(--amber-bg); }
.stat.warn .v { color: var(--amber); }
.stat.bad { border-color: #f4d3ce; background: var(--rose-bg); }
.stat.bad .v { color: var(--rose); }

/* ---------- three-column reconciliation shell ---------- */
.shell { display: grid; grid-template-columns: 250px minmax(0,1fr) 430px; height: calc(100vh - 52px); }

.rail { background: var(--surface); border-right: 1px solid var(--rule); display: flex;
  flex-direction: column; min-height: 0; }
.rail-h { padding: 12px 14px 10px; border-bottom: 1px solid var(--rule2); }
.rail-h .t { font-size: 13px; font-weight: 700; display: flex; align-items: center;
  justify-content: space-between; }
.rail-h .t .ct { font-family: var(--mono); font-size: 11px; color: var(--ink3); font-weight: 600; }
.rail-h .chips { display: flex; gap: 5px; margin-top: 9px; flex-wrap: wrap; }
.rail-list { flex: 1; overflow-y: auto; min-height: 0; }
.rail-item { display: block; width: 100%; text-align: left; padding: 10px 14px;
  border-bottom: 1px solid var(--rule2); position: relative; }
.rail-item:hover { background: #f7fafc; }
.rail-item.on { background: var(--teal-bg); }
.rail-item.on::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--teal); }
.rail-item .nm { font-size: 13px; font-weight: 620; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.rail-item .nm .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); flex: none; }
.rail-item .meta { font-family: var(--mono); font-size: 10.5px; color: var(--ink3); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-item .amt { font-family: var(--mono); font-size: 12px; font-weight: 700; margin-top: 3px; }
.rail-drop { border-top: 1px dashed var(--rule); padding: 14px; text-align: center;
  font-size: 12px; color: var(--ink3); cursor: pointer; }
.rail-drop.hot { background: var(--teal-bg); border-color: var(--teal); color: var(--teal-dk); }

.doc-pane { background: var(--rule2); overflow-y: auto; min-height: 0; padding: 18px; }
.doc-tabs { display: flex; gap: 4px; margin-bottom: 14px; align-items: center;
  max-width: 720px; margin-left: auto; margin-right: auto; }
.doc-tabs button { padding: 6px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  color: var(--ink2); border: 1px solid transparent; }
.doc-tabs button.on { background: #fff; border-color: var(--rule); color: var(--ink); }
.doc-sig { max-width: 720px; margin: 0 auto 12px; }
.xml-raw { max-width: 720px; margin: 0 auto; background: #0d1120; color: #9fe6d6;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.65; padding: 18px 20px;
  border-radius: 10px; overflow-x: auto; white-space: pre; }

/* ---------- right pane ---------- */
.side { background: var(--surface); border-left: 1px solid var(--rule); display: flex;
  flex-direction: column; min-height: 0; }
.side-h { padding: 13px 16px; border-bottom: 1px solid var(--rule2); }
.side-h .no { font-family: var(--mono); font-size: 11px; color: var(--ink3); }
.side-h .ttl { font-size: 14.5px; font-weight: 700; margin-top: 3px; }
.side-body { flex: 1; overflow-y: auto; min-height: 0; padding: 0 16px 16px; }
.side-foot { border-top: 1px solid var(--rule); padding: 12px 16px; background: #fbfcfe; }
.side-foot .note { font-size: 11.5px; color: var(--ink3); margin-top: 8px; text-align: center; }

.blk { margin-top: 18px; }
.blk-h { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.blk-h h4 { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink2); }
.blk-h .sp { flex: 1; }
.blk-h .sub { font-size: 11.5px; color: var(--ink3); font-weight: 500; text-transform: none;
  letter-spacing: 0; }

/* Field rows: hovering one lights the matching region on the document. */
.fld { display: grid; grid-template-columns: 108px 1fr auto; gap: 8px; align-items: center;
  padding: 6px 8px; border-radius: 7px; font-size: 13px; cursor: default; }
.fld:hover { background: var(--rule2); }
.fld .lb { color: var(--ink3); font-size: 12px; }
.fld .vl { font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fld.weak { background: var(--amber-bg); }
.fld.weak .vl { color: #6b4506; }
.fld-note { grid-column: 1/-1; font-size: 11.5px; color: var(--amber); padding: 0 0 4px; }

table.jl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.jl th { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink3);
  font-weight: 800; text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--rule); }
table.jl td { padding: 6px; border-bottom: 1px solid var(--rule2); }
table.jl td.n, table.jl th.n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.jl .acc { font-family: var(--mono); font-weight: 700; }
table.jl tr.tot td { border-bottom: 0; border-top: 1px solid var(--ink); font-weight: 750;
  padding-top: 8px; }
.jl-ok { font-size: 12px; color: var(--teal-dk); background: var(--teal-bg); border: 1px solid #bfe3dc;
  border-radius: 8px; padding: 7px 10px; margin-top: 9px; }
.jl-bad { font-size: 12px; color: var(--rose); background: var(--rose-bg); border: 1px solid #f4d3ce;
  border-radius: 8px; padding: 7px 10px; margin-top: 9px; }

/* Citations: the thing that turns this from a chatbot into a tool. */
.cite { border: 1px solid var(--rule); border-radius: 10px; margin-bottom: 9px; overflow: hidden; }
.cite summary { padding: 9px 11px; cursor: pointer; display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; list-style: none; }
.cite summary::-webkit-details-marker { display: none; }
.cite summary:hover { background: #f7fafc; }
.cite .doc { font-weight: 700; }
.cite .axis { margin-left: auto; }
.cite .body { padding: 0 12px 12px; }
.cite .quote { font-family: var(--serif); font-size: 13px; line-height: 1.6; color: #2a3348;
  border-left: 2px solid var(--teal); padding-left: 11px; margin: 4px 0 9px; }
.cite .why { font-size: 11.5px; color: var(--ink3); line-height: 1.5; }
.cite .why b { color: var(--ink2); }
.cite .anchors { font-family: var(--mono); font-size: 10px; color: var(--ink3); margin-top: 7px;
  word-break: break-all; line-height: 1.6; }
.cite .unver { margin-top: 8px; }

.exc { border: 1px solid #f4d3ce; background: var(--rose-bg); border-radius: 10px;
  padding: 11px 13px; margin-bottom: 9px; }
.exc .k { font-size: 12px; font-weight: 800; color: var(--rose); }
.exc .m { font-size: 12.5px; color: #7d2317; margin: 5px 0; line-height: 1.5; }
.exc .a { font-size: 12px; color: var(--ink2); }

/* ---------- legal lookup ---------- */
.legal-grid { display: grid; grid-template-columns: 320px minmax(0,1fr); gap: 20px; align-items: start; }
.atom { border: 1px solid var(--rule); border-radius: 12px; background: var(--surface);
  margin-bottom: 12px; }
.atom-h { padding: 12px 15px; border-bottom: 1px solid var(--rule2); display: flex;
  align-items: center; gap: 9px; flex-wrap: wrap; }
.atom-h .lb { font-weight: 700; font-size: 13.5px; }
.atom-b { padding: 13px 15px; }
.atom-b .tx { font-family: var(--serif); font-size: 14px; line-height: 1.65; color: #232c40; }
.atom-b .meta { font-size: 11.5px; color: var(--ink3); margin-top: 10px; display: flex;
  gap: 14px; flex-wrap: wrap; }
.ver-chain { display: flex; flex-direction: column; gap: 8px; }
.ver { border-left: 2px solid var(--rule); padding: 8px 0 8px 13px; position: relative; }
.ver.cur { border-color: var(--teal); }
.ver::before { content: ""; position: absolute; left: -5px; top: 13px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--rule); }
.ver.cur::before { background: var(--teal); }
.ver .vh { font-size: 12px; font-weight: 700; }
.ver .vt { font-size: 12.5px; color: var(--ink2); margin-top: 4px; line-height: 1.55; }
.ver .vn { font-size: 11.5px; color: var(--amber); margin-top: 5px; }

@media (max-width: 1200px) {
  .shell { grid-template-columns: 210px minmax(0,1fr) 380px; }
}
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; height: auto; }
  .rail, .side { border: 0; border-top: 1px solid var(--rule); }
  .legal-grid { grid-template-columns: 1fr; }
  .tabs { display: none; }
}

/* Separator between single sign-on and the password form. */
.or-split { display: flex; align-items: center; gap: 12px; margin: 16px 0 18px;
  color: var(--ink3); font-size: 12px; }
.or-split::before, .or-split::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* Platform administration, shown only to the platform owner. */
.admin-badge { background: var(--violet-bg); color: var(--violet); border: 1px solid #ddd4f7;
  font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px; }
.sso-state { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; }
.switch input { width: 16px; height: 16px; }
.user-row .em { font-family: var(--mono); font-size: 11.5px; color: var(--ink3); }
.setup-steps { counter-reset: s; margin: 0; padding: 0; list-style: none; }
.setup-steps li { counter-increment: s; position: relative; padding: 7px 0 7px 30px;
  font-size: 13px; color: var(--ink2); line-height: 1.55; }
.setup-steps li::before { content: counter(s); position: absolute; left: 0; top: 7px;
  width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.setup-steps code { font-family: var(--mono); font-size: 11.5px; background: #f3f6fa;
  border: 1px solid var(--rule); border-radius: 5px; padding: 1px 5px; word-break: break-all; }

/* ---------- details brought back in line with the approved mockup ---------- */

/* Rail: the dot is what the eye lands on when scanning a queue of two hundred. */
.rail-item .nm { display: grid; grid-template-columns: auto 1fr auto; gap: 7px; align-items: baseline; }
.rail-item .nm .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-item .nm .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; align-self: center; }
.rail-item .nm .dot.ok { background: var(--teal); }
.rail-item .nm .dot.warn { background: var(--amber); }
.rail-item .nm .dot.bad { background: var(--rose); }
.rail-item .nm .dot.done { background: var(--rule); }
.rail-item .nm .amt { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--ink); }

/* The XML is what has legal standing, so its signature status sits in the toolbar. */
.sig-pill { font-size: 11.5px; font-weight: 650; padding: 5px 11px; border-radius: 8px;
  border: 1px solid #bfe3dc; background: var(--teal-bg); color: var(--teal-dk);
  white-space: nowrap; }
.sig-pill.bad { border-color: #f4d3ce; background: var(--rose-bg); color: var(--rose); }
.doc-tabs { flex-wrap: wrap; }

.side-h .ttl { font-size: 15px; font-weight: 750; margin-top: 3px; letter-spacing: -.01em; }
.side-h .sub-co { font-size: 12.5px; color: var(--ink2); margin-top: 2px; }
.review-chip { display: flex; align-items: baseline; gap: 9px; margin-top: 9px;
  background: var(--amber-bg); border: 1px solid #f0dcb5; border-radius: 9px;
  padding: 7px 11px; font-size: 12px; font-weight: 700; color: var(--amber); }
.review-chip::before { content: "●"; font-size: 8px; line-height: 1.6; flex: none; }
/* The label stays on one line so the reason keeps a clean text column beside it. */
.review-chip > b { white-space: nowrap; flex: none; }
.review-chip span { font-weight: 400; color: #6b4506; line-height: 1.5; }

/* Weak fields carry their explanation inline, the way the mockup shows the payment row. */
.fld.weak { background: var(--amber-bg); border-radius: 7px; }
.fld.weak .fld-note { color: #6b4506; }

/* The basis is open by default: one you have to click to see is one nobody reads. */
.cite[open] summary { border-bottom: 1px solid var(--rule2); }
