/* True&FairView prototype v3 — shared styles. Visual language carried over from v2 (teal). */
:root {
  --bg: #f3f6f5;
  --surface: #fff;
  --ink: #15302f;
  --muted: #6b7b79;
  --line: #e1e8e6;
  --brand: #0a5c55;
  --brand-2: #0d7a70;
  --brand-soft: #e6f4f1;
  --nav: #112e35;
  --nav-ink: #cfe3df;
  --nav-2: #183d45; --nav-3: #1f4c55; --nav-deep: #0f2f36; --nav-line: #2f5d64; --nav-accent: #75e1c1; --nav-muted: #8fb9b1; --nav-sub: #b9d3cf; --focus: #3aa596;
  --green: #087e5a; --green-bg: #e5f5ee;
  --amber: #9a6512; --amber-bg: #fbf1de;
  --red: #b3403b; --red-bg: #fbe9e8;
  --blue: #2a5ea8; --blue-bg: #e8f0fb;
  --teal: #0a6d66; --teal-bg: #e0f3f0;
  --gray: #5d6b6a; --gray-bg: #eef2f1;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(17, 46, 53, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 'DM Sans', system-ui, Arial, sans-serif; }
h1, h2, h3 { font-family: Manrope, 'DM Sans', sans-serif; margin: 0; letter-spacing: -.3px; }
h1 { font-size: 27px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
p { margin: 0; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; margin: 0; padding: 0; accent-color: var(--brand); cursor: pointer; flex-shrink: 0; vertical-align: middle; }
code { font: 12px/1.4 ui-monospace, Consolas, monospace; background: var(--gray-bg); padding: 1px 5px; border-radius: 4px; }
small { display: block; color: var(--muted); font-size: 12px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.neg { color: var(--red); }
.note { margin-top: 12px; font-size: 13px; color: var(--muted); background: var(--gray-bg); border-radius: 8px; padding: 9px 12px; }
.boot { padding: 48px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.note.lock { background: var(--amber-bg); color: var(--amber); margin: 0 0 14px; }

/* layout */
.app { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--nav); color: var(--nav-ink); padding: 20px 14px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; color: #fff; text-decoration: none !important; }
.brand-logo { display: block; width: auto; height: 36px; max-width: 100%; }
.brand small { font: 600 9.5px 'DM Sans', sans-serif; letter-spacing: 1.4px; color: var(--nav-muted); }
.tenant { display: flex; gap: 10px; align-items: center; background: var(--nav-2); border-radius: 10px; padding: 9px 10px; color: #fff; font-weight: 600; font-size: 14px; }
.tenant small { color: var(--nav-muted); }
.tenant-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--nav-line); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; line-height: 1; text-align: center; }
.nav-label { font-size: 10.5px; letter-spacing: 1.4px; color: var(--nav-muted); margin: 6px 6px -6px; }
.mods { display: flex; flex-direction: column; gap: 2px; }
.mod { display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 6px; padding: 8px; border-radius: 8px; color: var(--nav-ink); font-size: 13px; line-height: 1.3; text-decoration: none !important; }
.mod:hover { background: var(--nav-2); }
.mod.active { background: var(--nav-3); color: #fff; }
.mod-code { font: 700 11px ui-monospace, Consolas, monospace; color: var(--nav-accent); }
.mod.planned { opacity: .5; cursor: default; }
.mod.planned:hover { background: none; }
.mod-tag { white-space: nowrap; font-size: 8.5px; letter-spacing: .5px; text-transform: uppercase; border: 1px solid var(--nav-line); border-radius: 99px; padding: 0 6px; }
.subnav { display: flex; flex-direction: column; margin: 2px 0 8px 46px; border-left: 1px solid var(--nav-line); }
.subnav a { color: var(--nav-sub); font-size: 13px; padding: 5px 10px; border-radius: 0 6px 6px 0; text-decoration: none; }
.subnav a:hover { background: var(--nav-2); }
.subnav a.active { color: #fff; background: var(--nav-3); box-shadow: inset 2px 0 var(--nav-accent); }
.side-foot { margin-top: auto; }
.side-foot .btn { color: var(--nav-ink); border-color: var(--nav-line); width: 100%; }
.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; background: rgba(255, 255, 255, .94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 10px 28px; min-height: 60px; }
.crumb { font-size: 14px; color: var(--muted); }
.crumb span { margin: 0 4px; }
.crumb strong { color: var(--ink); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.pill { font-size: 12px; background: var(--amber-bg); color: var(--amber); border-radius: 99px; padding: 3px 10px; }
.actor { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.actor select { max-width: 290px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 13px; }
.menu { display: none; }
main { padding: 26px 28px 40px; outline: none; flex: 1; }
.footer { font-size: 12px; color: var(--muted); padding: 14px 28px; border-top: 1px solid var(--line); }

/* page parts */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.eyebrow { font-size: 11px; letter-spacing: 1.3px; font-weight: 700; color: var(--brand-2); margin-bottom: 6px; }
.subtitle { color: var(--muted); margin-top: 6px; max-width: 780px; }
.refs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ref { font-size: 11.5px; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 1px 9px; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; min-width: 0; }
.card.error { border-color: var(--red); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.split > .card { margin-bottom: 18px; }
.sub-h { margin: 16px 0 8px; }
.sub-h small { display: inline; margin-left: 6px; font-weight: 400; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b9cbc7; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--red); border-color: #efc9c6; }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { background: var(--gray-bg); }
.link-btn { border: 0; background: none; padding: 0; color: var(--brand-2); cursor: pointer; font: 600 12.5px ui-monospace, Consolas, monospace; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* badges, people */
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 99px; padding: 2px 9px; white-space: nowrap; vertical-align: middle; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.teal { background: var(--teal-bg); color: var(--teal); }
.badge.gray { background: var(--gray-bg); color: var(--gray); }
.person { display: inline-flex; gap: 9px; align-items: center; }
.person a { font-weight: 600; color: var(--ink); }
.avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; line-height: 1; text-align: center; padding-top: 1.5px; box-sizing: border-box; }
.avatar.client { background: var(--amber-bg); color: var(--amber); }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: #f7faf9; font-size: 11.5px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); font-weight: 700; white-space: nowrap; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tr.dim td { opacity: .55; }
.empty-row td { text-align: center; color: var(--muted); padding: 22px; }

/* table checkbox columns */
table:has(tbody td input[type="checkbox"]) thead th:first-child,
table:has(tbody td input[type="checkbox"]) tbody td:first-child,
th:has(> input[type="checkbox"]),
td:has(> input[type="checkbox"]),
th:has(> .check),
td:has(> .check) {
  width: 40px;
  min-width: 40px;
  max-width: 44px;
  text-align: center;
  vertical-align: middle;
  padding: 8px 4px;
}
table td > input[type="checkbox"],
table th > input[type="checkbox"] {
  display: block;
  margin: 0 auto;
}
table td > .check {
  display: inline-flex;
  justify-content: center;
  margin: 0 auto;
}

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.tile-label { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.sample { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; background: var(--gray-bg); border-radius: 99px; padding: 0 6px; }
.tile-value { font: 800 28px Manrope, sans-serif; margin: 6px 0 2px; }
.tile-caption { font-size: 12.5px; color: var(--muted); }
.two-col-list { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.ticks, .crosses { list-style: none; padding: 0; margin: 8px 0 0; }
.ticks li, .crosses li { padding: 3px 0 3px 22px; position: relative; font-size: 13.5px; }
.ticks li::before { content: '✓'; position: absolute; left: 0; color: var(--green); font-weight: 700; }
.crosses li::before { content: '✕'; position: absolute; left: 0; color: var(--red); font-weight: 700; }

/* forms */
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.span2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field legend { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea, .search { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; font-size: 14px; font-weight: 400; color: var(--ink); width: 100%; }
.field input[type="checkbox"], .field input[type="radio"] { width: 16px; height: 16px; border: 0; padding: 0; background: transparent; flex-shrink: 0; }
.field input[readonly] { background: var(--gray-bg); }
fieldset:disabled input, fieldset:disabled select, fieldset:disabled textarea { background: var(--gray-bg); color: var(--muted); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline select { width: auto; max-width: 340px; }
.check { display: inline-flex; gap: 8px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; font-weight: 400; color: var(--ink); cursor: pointer; user-select: none; }
.check input { margin: 2px 0 0 0; width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; accent-color: var(--brand); }
.check.inline, .inline-checks .check, .radio-row .check, .qual-row .check { display: inline-flex; align-items: center; }
.check.inline input, .inline-checks .check input, .radio-row .check input, .qual-row .check input { margin: 0; }
.inline-checks { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .search { max-width: 320px; }
.count-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.count-chip { font-size: 12px; color: var(--muted); display: inline-flex; gap: 4px; align-items: center; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.tab { flex: none; white-space: nowrap; padding: 8px 14px; font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none !important; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.platform { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 12px; border: 1px dashed #b9cbc7; border-radius: 99px; padding: 2px 10px; color: var(--muted); }

/* hierarchy tree */
.tree, .tree ul { list-style: none; margin: 0; padding-left: 20px; }
.tree { padding-left: 0; margin-top: 12px; font-size: 13.5px; }
.tree li { position: relative; padding: 3px 0 3px 14px; }
.tree ul li::before { content: ''; position: absolute; left: -6px; top: 0; bottom: 0; border-left: 1px solid var(--line); }
.tree ul li::after { content: ''; position: absolute; left: -6px; top: 14px; width: 14px; border-top: 1px solid var(--line); }
.tree small { display: inline; margin-left: 6px; }

/* flows, key-values */
.flow { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.flow-arrow { color: var(--muted); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 18px; }
.kv strong { font-weight: 600; font-size: 14px; word-break: break-word; }

/* roles and matrix */
.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.role-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.role-card p { font-size: 13px; color: var(--muted); margin: 4px 0; }
.matrix-wrap { max-height: 72vh; }
.matrix th, .matrix td { padding: 6px 10px; text-align: center; white-space: nowrap; }
.matrix .sticky { position: sticky; left: 0; background: #fff; text-align: left; z-index: 1; font-weight: 500; }
.matrix thead th { position: sticky; top: 0; z-index: 2; }
.matrix thead .sticky { z-index: 3; background: #f7faf9; }
.matrix .rot { vertical-align: bottom; height: 120px; }
.matrix .rot span { writing-mode: vertical-rl; transform: rotate(180deg); display: inline-block; }
.matrix .cat-row th, .matrix .cat-row td { background: #f2f7f6; font-weight: 700; }
.matrix .sticky small { display: inline; margin-left: 4px; }
.lvl { font: 700 10px ui-monospace, Consolas, monospace; padding: 1px 5px; border-radius: 4px; background: var(--gray-bg); color: var(--gray); }
.lvl-view { background: var(--blue-bg); color: var(--blue); }
.lvl-create, .lvl-edit { background: var(--teal-bg); color: var(--teal); }
.lvl-review { background: var(--amber-bg); color: var(--amber); }
.lvl-approve { background: var(--green-bg); color: var(--green); }
.lvl-admin { background: var(--red-bg); color: var(--red); }
.cell-y { color: var(--green); font-weight: 700; }
.cell-r { color: var(--amber); font-size: 11.5px; font-weight: 700; }
.cell-n { color: #b8c4c2; }
.cell-btn { border: 1px dashed #c9d8d5; background: #fff; border-radius: 6px; min-width: 58px; padding: 2px 6px; cursor: pointer; }
.cell-btn:hover { border-color: var(--brand-2); }
td.changed { background: #fff6dc; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.legend strong { color: var(--ink); margin-right: 4px; }

/* access matrix and gates */
.mx { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 2px 8px; }
.mx.none { color: #b8c4c2; }
.mx.lv-full { background: var(--green-bg); color: var(--green); }
.mx.lv-audit { background: var(--teal-bg); color: var(--teal); }
.mx.lv-specialist { background: var(--blue-bg); color: var(--blue); }
.mx.lv-pbc { background: var(--amber-bg); color: var(--amber); }
.check-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 12px; align-items: end; margin-bottom: 16px; }
.gates { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.gates li { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.gates li.pass { border-color: #bfe3d3; background: #f5fbf8; }
.gates li.fail { border-color: #efc9c6; background: #fdf5f4; }
.gates li.skip { opacity: .55; }
.gate-mark { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--gray-bg); }
.pass .gate-mark { background: var(--green); color: #fff; }
.fail .gate-mark { background: var(--red); color: #fff; }
.gate-verdict { margin-top: 12px; font-weight: 700; padding: 10px 12px; border-radius: 10px; }
.gate-verdict.pass { background: var(--green-bg); color: var(--green); }
.gate-verdict.fail { background: var(--red-bg); color: var(--red); }
.issues { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.issues li { border-radius: 8px; padding: 8px 10px; font-size: 13.5px; }
.issues li.block { background: var(--red-bg); color: var(--red); }
.issues li.flag { background: var(--amber-bg); color: var(--amber); }
.sim-result { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.eng-head { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; }
.eng-head .note { grid-column: 1 / -1; margin-top: 4px; }

/* modal and toast */
.modal { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 24px 80px rgba(0, 0, 0, .25); color: var(--ink); }
.modal.wide { width: min(820px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(10, 30, 34, .45); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-body { padding: 16px 20px 20px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s; background: var(--nav); color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 14px; max-width: min(640px, calc(100vw - 32px)); z-index: 50; box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--red); }
#toast.warn { background: #8a5a10; }

/* signed out: login page fills the window */
body.logged-out .app { grid-template-columns: minmax(0, 1fr); }
body.logged-out .sidebar, body.logged-out .topbar { display: none; }
body.logged-out main { padding: 0; }
.login { min-height: calc(100vh - 46px); display: grid; grid-template-columns: minmax(320px, 440px) minmax(0, 1fr); }
.login-card { background: #fff; border-right: 1px solid var(--line); padding: 40px 36px; display: flex; flex-direction: column; gap: 22px; }
.login-card > .btn { align-self: flex-start; }
.brand.dark { color: var(--ink); }
.brand.dark small { color: var(--muted); }
.brand.dark .brand-logo { height: 40px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form h2 { font-size: 22px; }
.hint { font-size: 13px; color: var(--muted); }
.btn.wide { width: 100%; justify-content: center; padding: 11px; }
.login-demo { padding: 40px 36px; overflow-y: auto; }
.login-demo h2 { font-size: 22px; margin-bottom: 6px; }
.demo-group { margin-top: 22px; }
.demo-group h3 { font-size: 12px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.demo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.demo-acc { display: flex; gap: 10px; align-items: center; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.demo-acc:hover { border-color: var(--brand-2); box-shadow: var(--shadow); }
.avatar.platform { background: #ece6fb; color: #5b3fa8; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.user-chip small { font-weight: 400; }

/* guide */
.accounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 18px; }
.accounts code { font-size: 12.5px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.step { display: flex; gap: 14px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.step-no { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.step p { font-size: 14px; margin: 2px 0 6px; }
.step-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; }
details.card > summary { cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2::before { content: '▸ '; color: var(--muted); }
details.card[open] > summary { margin-bottom: 14px; }
details.card[open] > summary h2::before { content: '▾ '; }

/* BRD-A02: setup wizard, lifecycle, engagement record */
.wizard { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.wz-nav { position: sticky; top: 78px; padding: 14px; }
.wz-nav ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.wz a { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 8px; color: var(--ink); font-size: 14px; text-decoration: none !important; }
.wz a:hover { background: var(--gray-bg); }
.wz.current a { background: var(--brand-soft); font-weight: 700; }
.wz-no { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--gray-bg); color: var(--gray); }
.wz.pass .wz-no { background: var(--green); color: #fff; }
.wz.fail .wz-no { background: var(--red-bg); color: var(--red); }
.wz.warn .wz-no { background: var(--amber-bg); color: var(--amber); }
.wz-body > .card fieldset.field, .wz-body .card > fieldset > fieldset.field { margin: 14px 0; }
.wz-body .check small { display: block; }
.wz-body .card p.muted { margin: 4px 0 14px; }
.wz-body .gates { margin-top: 4px; }
.cf-box { display: grid; gap: 8px; margin-top: 14px; padding: 12px; border: 1px dashed var(--amber); border-radius: 10px; background: #fffaf0; }
.cf-box .badge { justify-self: start; }
.kv.tight { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.gates li.warnli { border-color: #ecd7ad; background: #fffaf0; }
.gates li.warnli .gate-mark { background: var(--amber); color: #fff; }
.gates li > .btn { margin-left: auto; }
.gates small { display: block; }
.lifecycle { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.lc { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 13px; }
.lc > span { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--gray-bg); color: var(--gray); }
.lc.done { background: #f5fbf8; border-color: #bfe3d3; }
.lc.done > span { background: var(--green); color: #fff; }
.lc.current { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.lc.current > span { background: var(--brand); color: #fff; }
.lc small { font-size: 11.5px; }
.lc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.chip.current { border-style: solid; border-color: var(--brand); color: var(--brand); font-weight: 600; background: var(--brand-soft); }
a.chip { text-decoration: none; }
.later { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.later li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding: 4px 0; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.file-part { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--gray-bg); }
.reopen { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.reopen:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.entities { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.entities > li { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.ent-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.ent-head small { display: inline; }
.ent-head .btn { margin-left: auto; }
.flow.years { margin-top: 10px; }
input.mini { width: 80px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
ol.ac { padding-left: 20px; font-size: 14px; }

/* BRD-A03 materiality */
.qual-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; font-size: 13.5px; }
.qual-list li { display: flex; gap: 8px; color: var(--muted); }
.qual-list li.on { color: var(--ink); font-weight: 600; }
.qual-list li small { font-weight: 400; }
.calc { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.calc-row { display: grid; grid-template-columns: minmax(0, 1.2fr) auto; gap: 2px 16px; padding: 9px 14px; border-bottom: 1px solid var(--line); align-items: baseline; }
.calc-row:last-child { border-bottom: 0; }
.calc-row strong { text-align: right; font-variant-numeric: tabular-nums; }
.calc-row small { grid-column: 1 / -1; }
.calc-row.total { background: var(--brand-soft); }
.calc-row.total strong { font-size: 16px; color: var(--brand); }
.calc-row.override { background: var(--amber-bg); }
.big { display: block; font-size: 18px; font-weight: 700; color: var(--brand); padding-top: 6px; font-variant-numeric: tabular-nums; }
.qual-grid { display: grid; gap: 8px; margin-bottom: 12px; }
.qual-row { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 10px; align-items: center; }
.qual-row input:not([type]) , .qual-row input[name^="qn_"] { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.auto-val { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px; background: var(--gray-bg); font-size: 14px; }
.q-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.recs { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.recs > li { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.recs p { font-size: 14px; margin: 2px 0; }
.rec-act { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 280px; }
.tag { display: inline-block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; border-radius: 99px; padding: 0 7px; background: var(--blue-bg); color: var(--blue); }
.tag.rec { background: var(--teal-bg); color: var(--teal); }
tr.selected td { background: var(--brand-soft); }
tr.changed td { background: #fffaf0; }
.scale { position: relative; display: flex; height: 14px; border-radius: 99px; overflow: visible; margin: 18px 0 46px; }
.sc-band { height: 100%; }
.sc-band.trivial { background: #d9e7e4; border-radius: 99px 0 0 99px; }
.sc-band.low { background: #bfe3d3; }
.sc-band.mid { background: #f2d9a6; }
.sc-band.high { background: #efc9c6; border-radius: 0 99px 99px 0; }
.sc-mark { position: absolute; top: 0; height: 22px; border-left: 2px solid var(--ink); }
.sc-mark small { position: absolute; top: 24px; left: -30px; width: 70px; text-align: center; font-size: 11px; line-height: 1.25; }
.sc-amt { position: absolute; top: -16px; transform: translateX(-50%); color: var(--red); font-size: 13px; }

.radio-row { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.radio-row .check { display: inline-flex; align-items: center; gap: 6px; }

/* BRD-A04 PBC */
.pbar { height: 10px; border-radius: 99px; background: var(--gray-bg); overflow: hidden; margin: 6px 0; }
.pbar span { display: block; height: 100%; background: var(--green); }
.pbar span.blue { background: var(--blue); }
.pbar span.amber { background: var(--amber); }
ul.plain { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; font-size: 13.5px; }
.version { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.version.old { background: #fafbfb; }
code.hash { font-size: 10.5px; word-break: break-all; }
.thread { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.thread li { border-radius: 10px; padding: 8px 12px; max-width: 85%; }
.thread li.auditor { background: var(--brand-soft); }
.thread li.client { background: var(--blue-bg); justify-self: end; }
.thread li.internal { background: var(--amber-bg); border: 1px dashed var(--amber); }
.thread p { font-size: 14px; margin-top: 2px; }
.comment-form { display: grid; gap: 8px; }
.comment-form textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.comment-form .btn { justify-self: start; }
.dep-list { display: grid; gap: 4px; max-height: 180px; overflow: auto; font-size: 13px; }
ol.tx { font-size: 13.5px; padding-left: 20px; }
.flow.chain .chip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* BRD-A05 ingestion */
ol.stages { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
ol.stages li { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
ol.stages li.done { background: #f5fbf8; border-color: #bfe3d3; }
ol.stages li.fail { background: #fdf5f4; border-color: #efc9c6; }
ol.stages li small { font-size: 11.5px; word-break: break-word; }
pre.raw { background: #0f2a30; color: #d6ebe6; border-radius: 10px; padding: 12px; font: 11.5px/1.5 ui-monospace, Consolas, monospace; overflow: auto; max-height: 360px; white-space: pre; margin: 0; }
pre.raw .hit { background: #f2d9a6; color: #15302f; display: inline-block; min-width: 100%; }

/* BRD-A06 validation */
.layers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.layer { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; gap: 4px; font-size: 13px; }
.layer.pass { background: #f5fbf8; border-color: #bfe3d3; }
.layer.warning { background: #fffaf0; border-color: #ecd7ad; }
.layer.fail { background: #fdf5f4; border-color: #efc9c6; }
.layer small { font-size: 11.5px; }
pre.cert { background: #fbfaf5; border: 1px dashed #b9cbc7; border-radius: 10px; padding: 14px; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; margin: 10px 0 0; }
form.sign { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }

/* BRD-A07 COA mapping */
.bulk { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.bulk .field { margin: 0; min-width: 220px; }
.bulk .grow, .inline-form .grow { flex: 1; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 10px; }
.inline-form .field { margin: 0; }
.toolbar .grow { flex: 1; }
ul.reasons { margin: 6px 0 0; padding-left: 18px; font-size: 13.5px; }
.flow.chain.sem { margin-bottom: 12px; }
.split-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px; gap: 8px; margin-top: 6px; }
tr.group-row td { background: #f7faf9; }
ol.priority { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 13.5px; }
ol.priority small { margin-left: 6px; }
small.side { display: inline; color: var(--muted); }

/* BRD-A07.1 mapping engine */
ul.evidence { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; font-size: 13.5px; }
ul.evidence li::before { content: "✓ "; color: var(--green); font-weight: 700; }
ul.evidence li.neg::before { content: "✗ "; color: var(--red); }

/* BRD-A08 trial balance */
.num { display: block; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.total td { background: var(--brand-soft); font-weight: 600; }
tr.hl td { background: #fffaf0; }
tr.muted-row td { color: var(--muted); }
.tabs.sub { margin-top: -6px; }
#tb-table td:first-child, #mv-table td:first-child { min-width: 210px; }
.chip.muted { opacity: .45; }
a.chip { text-decoration: none; }
.warn-card { border-color: #ecd7ad; background: #fffaf0; }
.adj-form .adj-line { display: grid; grid-template-columns: minmax(0, 1fr) 110px 150px; gap: 8px; margin-bottom: 8px; }

/* BRD-A09 reconciliation */
.recbar { height: 10px; border-radius: 99px; background: var(--gray-bg); overflow: hidden; margin-top: 14px; }
.recbar span { display: block; height: 100%; background: var(--green); }
.stack { display: grid; gap: 4px; }
.gap-top { margin-top: 14px; }
.stack > .btn { justify-self: start; margin-top: 8px; }
#rec-table td:first-child { min-width: 200px; }

/* responsive */
@media (max-width: 1100px) {
  .wizard { grid-template-columns: 1fr; }
  .wz-nav { position: static; }
  .wz-nav ol { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .lifecycle { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .check-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); width: 100%; }
  .top-right { min-width: 0; }
  .actor > span { display: none; }
  .actor select { max-width: 52vw; }
  .crumb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  html, body { overflow-x: hidden; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); height: 100%; height: 100dvh; z-index: 30; transform: translateX(-100%); transition: transform .25s ease; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  body.nav-open { overflow: hidden; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 25; background: rgba(17, 46, 53, .5); backdrop-filter: blur(2px); }
  .choose { padding: 28px 16px; min-height: auto; }
  .choose-head h1 { font-size: 24px; }
  .choose-foot, .service-card-foot { flex-direction: column; align-items: stretch; }
  .service-card { padding: 20px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .kv { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; gap: 10px; }
  .page-actions { width: 100%; flex-wrap: wrap; gap: 8px; }
  .table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .crumb { flex: 1 1 auto; }
  .top-right { flex: none; flex-wrap: nowrap; gap: 8px; }
  .field.inline { display: grid; grid-template-columns: 1fr; gap: 4px; }
  .field.inline select, .field.inline input { width: 100%; max-width: 100%; min-width: 0; }
  .eng-head { grid-template-columns: minmax(0, 1fr); }
  .eng-head .badge { justify-self: start; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0, 0, 0, .4); }
  .menu { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 36px; cursor: pointer; }
  .topbar { padding: 10px 16px; min-height: 54px; }
  main { padding: 20px 16px 32px; }
  .footer { padding: 14px 16px; font-size: 11.5px; }
  .form-grid, .two-col-list, .check-form, .kv.tight, .qual-list, .qual-row, .adj-form .adj-line { grid-template-columns: 1fr; }
  .recs > li { flex-direction: column; }
  .thread li { max-width: 100%; }
  .rec-act { justify-content: flex-start; max-width: none; }
  .pill { display: none; }
  h1 { font-size: 23px; }
  .login { grid-template-columns: minmax(0, 1fr); min-height: auto; }
  .login-card { border-right: 0; border-bottom: 1px solid var(--line); padding: 28px 16px; }
  .login-demo { padding: 24px 16px; }
  .user-chip > span:last-child { display: none; }
  .modal { width: min(92vw, 560px); max-height: calc(100dvh - 32px); margin: auto; }
}

@media (max-width: 480px) {
  .topbar { padding: 8px 12px; gap: 8px; }
  main { padding: 14px 12px 24px; }
  .login-card { padding: 20px 12px; }
  .login-demo { padding: 18px 12px; }
  .demo-grid { grid-template-columns: 1fr; }
  .demo-acc { padding: 10px 10px; font-size: 13px; }
  .service-card { padding: 16px; }
  .choose { padding: 18px 12px; }
  .modal { width: calc(100vw - 16px); }
  .modal-body { padding: 14px 14px; }
  .btn { min-height: 36px; }
}

/* ---------- BRD-00: service chooser and switch ---------- */
.choose { min-height: calc(100vh - 46px); padding: 56px 36px; max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }
.choose-head h1 { font-size: 28px; margin: 6px 0 10px; }
.service-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 22px; }
.service-card { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; font: inherit; color: inherit; transition: transform .12s, border-color .12s; }
.service-card:hover { transform: translateY(-2px); border-color: var(--brand); }
.service-card h2 { font-size: 22px; }
.service-card .law { font-size: 13px; color: var(--brand); font-weight: 600; }
.service-card-head { display: flex; align-items: center; gap: 8px; }
.service-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: auto; padding-top: 12px; flex-wrap: wrap; }
.service-dot { width: 12px; height: 12px; border-radius: 50%; background: #2fb48a; display: inline-block; flex: none; }
.service-card.TA .service-dot, .service-chip.TA .service-dot { background: #e5a33b; }
.service-card.FS .service-dot, .service-chip.FS .service-dot { background: #7c8cf0; }
.choose-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.service-chip { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; background: var(--nav-deep); border: 1px solid var(--nav-line); border-radius: 10px; padding: 8px 10px; color: #fff; font-size: 13.5px; font-weight: 600; text-decoration: none !important; }
.service-chip small { display: block; font-size: 9.5px; letter-spacing: 1.2px; color: var(--nav-muted); font-weight: 600; }
.service-chip .service-switch { font-size: 11px; color: var(--nav-accent); border: 1px solid var(--nav-line); border-radius: 6px; padding: 2px 7px; }
.service-chip:hover .service-switch { background: var(--nav-3); }
.sidebar .nav-label + .mods { margin-bottom: 4px; }


/* ---------- client version: single-line navigation and themes (client.html only) ---------- */
@media (min-width: 861px) { body.client:not(.logged-out) .app { grid-template-columns: 288px minmax(0, 1fr); } }
.service-card.soon { cursor: default; opacity: .75; }
.service-card.soon:hover { transform: none; border-color: var(--line); }
.service-card.soon .btn { opacity: .6; }
body.client .mod { grid-template-columns: minmax(0, 1fr) auto; }
body.client .mod-name, body.client .subnav a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.client .subnav { margin-left: 12px; }
body.client .mod.active { box-shadow: inset 3px 0 var(--nav-accent); }
.theme-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 4px; }
.theme-pick small { width: 100%; letter-spacing: 1.2px; font-size: 9.5px; color: var(--nav-muted); }
.theme-swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: 0 0 0 1px rgba(255,255,255,.25) inset; }
.theme-swatch.active { border-color: #fff; }
.choose .theme-pick { padding: 0; }
.choose .theme-pick small { width: auto; color: var(--muted); }
.choose .theme-swatch { box-shadow: 0 0 0 1px rgba(0,0,0,.15) inset; }
.choose .theme-swatch.active { border-color: var(--ink); }
/* themes: professional shades; each sets the brand and the navigation palette */
body.client[data-theme="navy"] { --brand: #1e3f8f; --brand-2: #2a55b8; --brand-soft: #e8eefb; --teal: #1e3f8f; --teal-bg: #e8eefb; --nav: #0f1f3d; --nav-2: #1a2f55; --nav-3: #22407a; --nav-deep: #0b1730; --nav-line: #2b4575; --nav-accent: #8fb3ff; --nav-ink: #cdd8ee; --nav-muted: #8fa3cc; --nav-sub: #b7c6e8; --focus: #5b8def; --shadow: 0 6px 24px rgba(15, 31, 61, .08); }
body.client[data-theme="graphite"] { --brand: #2f3e46; --brand-2: #41525c; --brand-soft: #e9edef; --teal: #2f3e46; --teal-bg: #e9edef; --nav: #1f2429; --nav-2: #2b3238; --nav-3: #363e46; --nav-deep: #171b1f; --nav-line: #3b444c; --nav-accent: #9fd3c7; --nav-ink: #d5dadf; --nav-muted: #98a2ab; --nav-sub: #c2cad1; --focus: #6c8a99; --shadow: 0 6px 24px rgba(31, 36, 41, .08); }
body.client[data-theme="burgundy"] { --brand: #7a1f3d; --brand-2: #93304f; --brand-soft: #f8e9ee; --teal: #7a1f3d; --teal-bg: #f8e9ee; --nav: #3b1220; --nav-2: #4d1a2c; --nav-3: #5e2438; --nav-deep: #2d0d18; --nav-line: #5e2a3b; --nav-accent: #f1a7b9; --nav-ink: #ead3da; --nav-muted: #c18e9d; --nav-sub: #dcb8c3; --focus: #c25a7a; --shadow: 0 6px 24px rgba(59, 18, 32, .08); }
body.client[data-theme="forest"] { --brand: #1e6b3a; --brand-2: #27834a; --brand-soft: #e6f4ea; --teal: #1e6b3a; --teal-bg: #e6f4ea; --nav: #14301f; --nav-2: #1d4029; --nav-3: #255235; --nav-deep: #0f2518; --nav-line: #2f5a3f; --nav-accent: #9ee6b3; --nav-ink: #cfe5d6; --nav-muted: #8fb89d; --nav-sub: #b8d8c3; --focus: #4aa36a; --shadow: 0 6px 24px rgba(20, 48, 31, .08); }
body.client[data-theme="slate"] { --brand: #3b4f6b; --brand-2: #4d6487; --brand-soft: #eaeef4; --teal: #3b4f6b; --teal-bg: #eaeef4; --nav: #1c2533; --nav-2: #273244; --nav-3: #324059; --nav-deep: #151c27; --nav-line: #3a4a63; --nav-accent: #a8c4ec; --nav-ink: #d3dbe6; --nav-muted: #93a2b8; --nav-sub: #bfcbdb; --focus: #6f8fb8; --shadow: 0 6px 24px rgba(28, 37, 51, .08); }
