:root {
  --ink: #102a43;
  --ink-2: #243b53;
  --muted: #627d98;
  --line: #d9e2ec;
  --paper: #f7f9fb;
  --white: #ffffff;
  --teal: #087f8c;
  --teal-soft: #e4f4f3;
  --amber: #b7791f;
  --amber-soft: #fff7e6;
  --red: #b42318;
  --red-soft: #fff0ed;
  --shadow: 0 16px 45px rgba(16, 42, 67, 0.08);
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid rgba(8, 127, 140, .28); outline-offset: 2px; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  grid-template-rows: 76px minmax(0, 1fr);
}

.topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 248px 1fr auto;
  align-items: center;
  min-width: 0;
  background: var(--ink);
  color: white;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.brand-lockup { height: 100%; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-right: 1px solid rgba(255,255,255,.12); }
.brand-mark, .signin-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(145deg, #25a6a0, #087f8c); color: white; font-size: .78rem; font-weight: 800; letter-spacing: .04em; }
.brand-lockup div { min-width: 0; }
.brand-lockup strong, .brand-lockup span { display: block; }
.brand-lockup strong { font-size: .92rem; letter-spacing: -.01em; white-space: nowrap; }
.brand-lockup span { color: #bcccdc; font-size: .72rem; margin-top: 2px; }

.topbar-center { padding: 0 26px; min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.topbar-center strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.matter-label { color: #9fb3c8; font-size: .75rem; text-transform: uppercase; letter-spacing: .09em; white-space: nowrap; }

.user-menu { display: flex; align-items: center; gap: 10px; padding: 0 22px; min-width: 235px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #334e68; font-weight: 700; font-size: .75rem; }
.user-menu div { flex: 1; }
.user-menu strong, .user-menu div span { display: block; }
.user-menu strong { font-size: .8rem; }
.user-menu div span { color: #9fb3c8; font-size: .72rem; text-transform: capitalize; }
.user-menu a { color: #d9e2ec; font-size: .75rem; }
.demo-chip { border: 1px solid rgba(255,255,255,.2); color: #d9e2ec; border-radius: 999px; padding: 5px 9px; font-size: .7rem; white-space: nowrap; }

.sidebar { grid-row: 2; background: #183b56; color: white; padding: 24px 16px; display: flex; flex-direction: column; gap: 28px; }
.sidebar-section { display: grid; gap: 6px; }
.section-label { margin: 0 0 8px; color: #9fb3c8; font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.nav-item { width: 100%; border: 0; color: #bcccdc; background: transparent; padding: 10px 11px; border-radius: 7px; display: flex; align-items: center; gap: 12px; text-align: left; font-size: .88rem; }
.nav-item span { font-size: .66rem; color: #829ab1; }
.nav-item.active { color: white; background: rgba(79, 209, 197, .12); box-shadow: inset 3px 0 0 #4fd1c5; }
.matter-card { padding: 15px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; background: rgba(255,255,255,.035); }
.matter-card strong, .matter-card > span { display: block; }
.matter-card > span { font-size: .76rem; color: #9fb3c8; margin-top: 2px; }
.matter-card dl { margin: 14px 0 0; display: grid; gap: 7px; }
.matter-card dl div { display: flex; justify-content: space-between; padding-top: 7px; border-top: 1px solid rgba(255,255,255,.09); }
.matter-card dt { color: #9fb3c8; font-size: .72rem; }
.matter-card dd { margin: 0; font-size: .72rem; font-weight: 700; }
.sidebar-note { margin-top: auto; padding: 14px; border-left: 3px solid #f6ad55; background: rgba(255,255,255,.05); }
.sidebar-note strong { font-size: .78rem; }
.sidebar-note p { color: #bcccdc; font-size: .72rem; margin: 5px 0 0; }

.workspace { grid-column: 2; min-width: 0; padding: 26px 30px 36px; overflow: hidden; }
.workspace-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0 0 6px; color: var(--teal); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
.workspace-header h1 { margin-bottom: 5px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.65rem, 2.3vw, 2.25rem); font-weight: 600; letter-spacing: -.025em; }
.subhead { margin: 0; color: var(--muted); font-size: .88rem; }
.run-button { border: 0; min-width: 190px; padding: 12px 18px; border-radius: 8px; color: white; background: var(--teal); box-shadow: 0 7px 18px rgba(8,127,140,.18); font-weight: 700; font-size: .84rem; }
.run-button:hover { background: #066f7a; }
.run-button:disabled { opacity: .78; cursor: wait; }

.agent-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 20px; background: white; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 25px rgba(16,42,67,.045); overflow: hidden; }
.agent-step { position: relative; min-width: 0; min-height: 82px; display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-right: 1px solid var(--line); transition: background .25s ease; }
.agent-step:last-child { border-right: 0; }
.agent-step::after { content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 3px; background: var(--teal); transition: right .35s ease; }
.agent-step.complete { background: #f3fbfa; }
.agent-step.complete::after, .agent-step.active::after { right: 0; }
.agent-step.active { background: var(--amber-soft); }
.agent-number { flex: 0 0 26px; width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid #bcccdc; border-radius: 50%; color: var(--muted); font-size: .72rem; font-weight: 800; }
.agent-step.complete .agent-number { border-color: var(--teal); background: var(--teal); color: white; }
.agent-step.active .agent-number { border-color: var(--amber); color: var(--amber); }
.agent-step strong, .agent-step span { display: block; overflow: hidden; text-overflow: ellipsis; }
.agent-step strong { font-size: .76rem; white-space: nowrap; }
.agent-step span { color: var(--muted); font-size: .66rem; line-height: 1.3; margin-top: 3px; }

.runtime-banner { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 9px 12px; border: 1px solid #bee3df; border-radius: 8px; background: #f2f9f9; }
.runtime-banner p { flex: 1; margin: 0; color: var(--muted); font-size: .7rem; }
.runtime-banner button { border: 0; color: var(--teal); background: transparent; font-size: .7rem; font-weight: 800; }
.runtime-mode { flex: 0 0 auto; border-radius: 999px; padding: 4px 8px; color: #0c6b58; background: #dff3ed; font-size: .64rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.runtime-mode.live { color: white; background: var(--teal); }

.tabs { display: flex; gap: 24px; margin-top: 18px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; padding: 0 2px 10px; color: var(--muted); background: transparent; font-size: .8rem; font-weight: 700; }
.tabs button.active { color: var(--ink); border-bottom: 3px solid var(--teal); }

.review-grid { display: grid; grid-template-columns: minmax(340px, .83fr) minmax(520px, 1.35fr); gap: 16px; margin-top: 16px; align-items: start; }
.finding-list, .finding-detail, .single-panel { border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: var(--shadow); }
.finding-list { overflow: hidden; }
.list-heading { display: flex; align-items: center; justify-content: space-between; padding: 15px 16px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.list-heading strong, .list-heading span { display: block; }
.list-heading strong { font-size: .8rem; }
.list-heading div span { color: var(--muted); font-size: .68rem; margin-top: 2px; }
.source-backed { padding: 4px 8px; border-radius: 999px; color: #0c6b58; background: #e6f6f1; font-size: .66rem !important; font-weight: 700; }
.finding-row { width: 100%; display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 15px 14px; border: 0; border-bottom: 1px solid #edf1f5; background: white; color: var(--ink); text-align: left; }
.finding-row:hover { background: #f8fafc; }
.finding-row.selected { background: #edf7f7; box-shadow: inset 3px 0 0 var(--teal); }
.risk-marker { align-self: stretch; min-height: 54px; border-radius: 4px; background: var(--amber); }
.risk-marker.critical { background: var(--red); }
.risk-marker.medium { background: #3e7cb1; }
.finding-copy { min-width: 0; }
.finding-copy > span { display: flex; align-items: baseline; gap: 6px; }
.finding-copy strong { font-size: .78rem; line-height: 1.35; }
.finding-copy em { color: var(--muted); font-size: .63rem; font-style: normal; white-space: nowrap; }
.finding-copy small { display: block; margin-top: 5px; color: var(--muted); font-size: .66rem; }
.risk-badge { display: inline-block; width: max-content; padding: 4px 7px; border-radius: 4px; color: #7b4c08; background: var(--amber-soft); font-size: .63rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.risk-badge.critical { color: var(--red); background: var(--red-soft); }
.risk-badge.medium { color: #245b89; background: #eaf3fb; }
.decision-status { grid-column: 2 / 4; color: var(--muted); font-size: .64rem; font-weight: 700; }

.finding-detail { padding: 20px; }
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.detail-header h2 { font-family: Georgia, "Times New Roman", serif; font-size: 1.35rem; font-weight: 600; margin: 12px 0 6px; line-height: 1.25; }
.detail-header p { color: var(--muted); font-size: .8rem; margin-bottom: 0; max-width: 720px; }
.finding-id { color: var(--muted); font-size: .66rem; margin-left: 8px; }
.page-link { flex: 0 0 auto; border: 1px solid var(--line); background: white; color: var(--teal); border-radius: 7px; padding: 8px 10px; font-size: .72rem; font-weight: 700; }
.evidence-chain { display: grid; grid-template-columns: minmax(0,1fr) 26px minmax(0,1fr); align-items: stretch; gap: 10px; margin-top: 18px; }
.evidence-source { padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; }
.evidence-source > span, .revision-block > div > span:first-child { color: var(--muted); font-size: .67rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.evidence-source blockquote, .evidence-source p { margin: 9px 0; color: var(--ink-2); font-family: Georgia, "Times New Roman", serif; font-size: .79rem; line-height: 1.55; }
.evidence-source small { color: var(--teal); font-size: .65rem; font-weight: 700; }
.playbook-source { background: #f3fbfa; border-color: #bee3df; }
.comparison-symbol { align-self: center; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--red); background: var(--red-soft); font-weight: 800; }
.revision-block { margin-top: 14px; padding: 14px; border-left: 3px solid var(--teal); background: #eef8f8; }
.revision-block > div { display: flex; justify-content: space-between; gap: 12px; }
.approval-label { color: #7b4c08; font-size: .66rem; font-weight: 700; }
.revision-block p { margin: 8px 0 0; color: var(--ink-2); font-size: .79rem; line-height: 1.55; }
.decision-bar { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.decision-bar > div { flex: 1; }
.decision-bar strong, .decision-bar span { display: block; }
.decision-bar strong { font-size: .75rem; }
.decision-bar span { color: var(--muted); font-size: .66rem; margin-top: 2px; }
.decision-bar button { border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink-2); padding: 8px 11px; font-size: .72rem; font-weight: 700; }
.decision-bar .primary-action { border-color: var(--teal); color: white; background: var(--teal); }

.single-panel { margin-top: 16px; padding: 22px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.4rem; font-weight: 600; }
.panel-heading > span, .panel-heading button { border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: white; padding: 7px 9px; font-size: .68rem; }
.panel-intro { max-width: 760px; margin: 16px 0; color: var(--muted); font-size: .82rem; }
.rule-table { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.rule-row { display: grid; grid-template-columns: 180px 1.25fr 1fr 80px; gap: 18px; align-items: center; padding: 14px; border-bottom: 1px solid var(--line); font-size: .75rem; }
.rule-row:last-child { border-bottom: 0; }
.rule-row.header { color: var(--muted); background: #f4f7fa; font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.rule-row small { color: var(--muted); font-weight: 400; }
.rule-row input { width: 70px; margin-right: 7px; padding: 6px; border: 1px solid var(--line); border-radius: 5px; }
.rule-row em { color: #0c6b58; font-size: .66rem; font-weight: 800; font-style: normal; }
.playbook-action { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; color: var(--muted); font-size: .75rem; }
.playbook-action button { border: 0; border-radius: 7px; color: white; background: var(--teal); padding: 9px 12px; font-weight: 700; }
.audit-list { max-width: 760px; padding: 10px 0; }
.audit-event { display: grid; grid-template-columns: 50px 12px 1fr; gap: 12px; min-height: 64px; }
.audit-event time { color: var(--muted); font-size: .7rem; padding-top: 2px; }
.audit-event > span { position: relative; width: 9px; height: 9px; border-radius: 50%; background: var(--teal); margin-top: 5px; }
.audit-event > span::after { content: ""; position: absolute; top: 11px; left: 4px; width: 1px; height: 44px; background: var(--line); }
.audit-event:last-child > span::after { display: none; }
.audit-event strong { font-size: .76rem; }
.audit-event p { margin: 3px 0 0; color: var(--muted); font-size: .75rem; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
.metric-grid > div { padding: 15px; border: 1px solid var(--line); border-radius: 8px; }
.metric-grid span, .metric-grid strong, .metric-grid small { display: block; }
.metric-grid span { color: var(--muted); font-size: .68rem; font-weight: 700; }
.metric-grid strong { margin: 7px 0 4px; font-family: Georgia, "Times New Roman", serif; font-size: 1.55rem; font-weight: 600; }
.metric-grid small { color: var(--muted); font-size: .64rem; }
.governance-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding-top: 17px; border-top: 1px solid var(--line); }
.governance-grid > div { padding: 14px; border-left: 3px solid #829ab1; background: #f7f9fb; }
.governance-grid strong { font-size: .75rem; }
.governance-grid p { margin: 5px 0 0; color: var(--muted); font-size: .72rem; }
.evaluation-note { margin: 16px 0 0; color: var(--muted); font-size: .68rem; }

.mandate-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.mandate-card { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; }
.mandate-card strong { display: block; font-size: .74rem; }
.mandate-card span { display: block; margin: 5px 0; color: var(--ink-2); font-size: .69rem; line-height: 1.45; }
.mandate-card small { display: block; padding-top: 7px; border-top: 1px solid var(--line); color: var(--muted); font-size: .61rem; line-height: 1.4; }
.mandate-card.auditor { border-color: #efc2bb; background: var(--red-soft); }
.challenge-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 24px 0 10px; }
.challenge-heading h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.12rem; font-weight: 600; }
.challenge-heading > span { color: var(--muted); font-size: .68rem; }
.challenge-list { display: grid; gap: 10px; }
.challenge-card { display: grid; grid-template-columns: 130px 1fr 1fr; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.challenge-status { padding: 13px; color: var(--red); background: var(--red-soft); font-size: .66rem; font-weight: 800; }
.challenge-status strong, .challenge-status span { display: block; }
.challenge-status span { margin-top: 4px; color: var(--muted); font-size: .6rem; }
.challenge-position { padding: 13px; border-left: 1px solid var(--line); }
.challenge-position span { display: block; color: var(--muted); font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.challenge-position strong { display: block; margin: 5px 0; font-size: .72rem; }
.challenge-position p { margin: 0; color: var(--ink-2); font-size: .7rem; line-height: 1.5; }
.challenge-resolution { margin-top: 8px !important; padding-top: 8px; border-top: 1px solid var(--line); color: #0c6b58 !important; }
.human-gate { display: flex; gap: 12px; margin-top: 12px; padding: 12px 14px; border-left: 3px solid var(--amber); background: var(--amber-soft); }
.human-gate strong { flex: 0 0 auto; font-size: .73rem; }
.human-gate span { color: var(--ink-2); font-size: .7rem; }

.secondary-workspace { grid-column: 2; }
.portfolio-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 20px 0 16px; }
.portfolio-summary > div { padding: 14px 16px; border: 1px solid var(--line); border-radius: 9px; background: white; box-shadow: 0 8px 24px rgba(16,42,67,.04); }
.portfolio-summary span, .portfolio-summary strong, .portfolio-summary small { display: block; }
.portfolio-summary span { color: var(--muted); font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.portfolio-summary strong { margin: 4px 0 1px; font-family: Georgia, "Times New Roman", serif; font-size: 1.3rem; font-weight: 600; }
.portfolio-summary small { color: var(--muted); font-size: .64rem; }
.portfolio-panel { margin-top: 0; }
.comparison-table { margin-top: 16px; border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.comparison-row { min-width: 920px; display: grid; grid-template-columns: 1.2fr repeat(4, 1fr) .7fr; align-items: stretch; border-bottom: 1px solid var(--line); }
.comparison-row:last-child { border-bottom: 0; }
.comparison-row > * { min-width: 0; padding: 13px; border-right: 1px solid var(--line); }
.comparison-row > *:last-child { border-right: 0; }
.comparison-row > strong { font-size: .75rem; }
.comparison-row > strong small { display: block; margin-top: 3px; color: var(--muted); font-size: .62rem; font-weight: 400; }
.comparison-header { color: var(--muted); background: #f4f7fa; font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.matrix-cell { border: 0; border-right: 1px solid var(--line); border-radius: 0; color: var(--ink); background: white; text-align: left; font-size: .72rem; font-weight: 800; }
.matrix-cell small { display: block; margin-top: 4px; color: var(--muted); font-size: .61rem; font-weight: 400; }
.matrix-cell.critical { background: var(--red-soft); box-shadow: inset 3px 0 0 var(--red); }
.matrix-cell.high { background: var(--amber-soft); box-shadow: inset 3px 0 0 var(--amber); }
.matrix-cell.medium { background: #eef5fb; box-shadow: inset 3px 0 0 #3e7cb1; }
.matrix-cell.pass { background: #eef9f4; box-shadow: inset 3px 0 0 #2f855a; }
.comparison-row > em { align-self: center; border: 0; color: var(--amber); font-size: .68rem; font-style: normal; font-weight: 800; }
.comparison-row > em.approved { color: #287a57; }
.portfolio-action { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 16px; padding: 14px; border-left: 3px solid var(--teal); background: #f2f9f9; }
.portfolio-action strong, .portfolio-action span { display: block; }
.portfolio-action strong { font-size: .76rem; }
.portfolio-action span { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.portfolio-action button { flex: 0 0 auto; border: 0; border-radius: 7px; padding: 9px 12px; color: white; background: var(--teal); font-size: .72rem; font-weight: 800; }
.portfolio-audit { display: flex; gap: 10px; align-items: baseline; margin-top: 12px; padding: 12px 15px; border: 1px solid #bee3df; border-radius: 8px; color: #0c6b58; background: #eef9f4; }
.portfolio-audit strong { font-size: .75rem; }
.portfolio-audit span { font-size: .69rem; }
.obligation-flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 18px 0; }
.obligation-flow > div { display: grid; grid-template-columns: 28px 1fr; column-gap: 9px; padding: 11px; border: 1px solid var(--line); border-right: 0; }
.obligation-flow > div:last-child { border-right: 1px solid var(--line); }
.obligation-flow span { grid-row: 1 / 3; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--teal); font-size: .7rem; font-weight: 800; }
.obligation-flow strong { font-size: .73rem; }
.obligation-flow small { color: var(--muted); font-size: .63rem; }
.obligation-table { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.obligation-row { display: grid; grid-template-columns: 1.45fr 1fr 1fr 1fr .65fr; align-items: center; border-bottom: 1px solid var(--line); }
.obligation-row:last-child { border-bottom: 0; }
.obligation-row > * { padding: 12px; font-size: .71rem; }
.obligation-row strong small { display: block; color: var(--muted); font-size: .61rem; font-weight: 400; }
.obligation-header { color: var(--muted); background: #f4f7fa; font-size: .64rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.obligation-row em { justify-self: start; border-radius: 999px; padding: 4px 7px; font-size: .62rem; font-style: normal; font-weight: 800; }
.status-ontrack { color: #287a57; background: #e8f7ef; }
.status-watch { color: #245b89; background: #eaf3fb; }
.status-due { color: #8b5508; background: var(--amber-soft); }

.view-toggle { border: 1px solid rgba(255,255,255,.24); border-radius: 999px; padding: 6px 10px; color: white; background: transparent; font-size: .66rem; font-weight: 800; white-space: nowrap; }
.matter-selector { display: grid; grid-template-columns: 1.35fr 1fr auto auto; gap: 14px; align-items: end; margin: 18px 0 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 9px; background: white; box-shadow: 0 8px 24px rgba(16,42,67,.04); }
.matter-selector label { display: block; margin-bottom: 5px; color: var(--muted); font-size: .63rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.matter-selector select { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; color: var(--ink); background: white; font-size: .72rem; font-weight: 700; }
.matter-selector > span { align-self: center; border-radius: 999px; padding: 5px 8px; color: #0c6b58; background: #e6f6f1; font-size: .62rem; font-weight: 800; white-space: nowrap; }
.matter-links { display: flex; gap: 7px; }
.matter-links a { border: 1px solid var(--line); border-radius: 6px; padding: 8px 9px; color: var(--teal); background: white; font-size: .67rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.page-link { text-decoration: none; }
.validation-action { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding: 14px; border-left: 3px solid var(--teal); background: #f2f9f9; }
.validation-action strong, .validation-action span { display: block; }
.validation-action strong { font-size: .75rem; }
.validation-action span { margin-top: 3px; color: var(--muted); font-size: .69rem; }
.validation-action button { border: 0; border-radius: 7px; padding: 9px 12px; color: white; background: var(--teal); font-size: .7rem; font-weight: 800; }
.answer-key { margin-top: 10px; padding: 14px; border: 1px solid #efc2bb; border-radius: 8px; background: var(--red-soft); }
.answer-key strong { font-size: .76rem; }
.answer-key p { margin: 6px 0; color: var(--ink-2); font-size: .73rem; }
.answer-key small { color: var(--muted); font-size: .65rem; }
.library-guide { color: white; text-decoration: none; }
.admin-notice { display: flex; gap: 12px; align-items: baseline; margin: 18px 0 0; padding: 12px 14px; border-left: 3px solid var(--amber); background: var(--amber-soft); }
.admin-notice strong { font-size: .75rem; }
.admin-notice span { color: var(--ink-2); font-size: .7rem; }
.library-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.library-card { display: flex; flex-direction: column; min-height: 190px; padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; }
.library-card > span { color: var(--teal); font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.library-card h3 { margin: 8px 0 5px; font-family: Georgia, "Times New Roman", serif; font-size: 1rem; }
.library-card p { flex: 1; margin: 0; color: var(--muted); font-size: .71rem; line-height: 1.5; }
.library-card > div { display: flex; align-items: center; gap: 7px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.library-card a { color: var(--teal); font-size: .67rem; font-weight: 800; text-decoration: none; }
.library-card em { margin-left: auto; color: #287a57; font-size: .61rem; font-style: normal; font-weight: 800; }
.locked-card { border-color: #efc2bb; background: var(--red-soft); }
.locked-card > span, .locked-card em { color: var(--red); }
.control-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.control-grid > div { padding: 13px; border: 1px solid var(--line); border-radius: 7px; }
.control-grid span, .control-grid strong, .control-grid small { display: block; }
.control-grid span { color: var(--muted); font-size: .62rem; font-weight: 800; text-transform: uppercase; }
.control-grid strong { margin: 5px 0 2px; font-size: .79rem; }
.control-grid small { color: var(--muted); font-size: .63rem; }
.guide-notice { display: flex; gap: 12px; align-items: baseline; margin: 18px 0 0; padding: 13px 15px; border-left: 3px solid var(--teal); background: #eef8f8; }
.guide-notice strong { flex: 0 0 auto; font-size: .75rem; }
.guide-notice span { color: var(--ink-2); font-size: .71rem; line-height: 1.5; }
.guide-steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 18px; }
.guide-steps article { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; }
.guide-steps article > span { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--teal); font-size: .68rem; font-weight: 800; }
.guide-steps strong { font-size: .75rem; }
.guide-steps p { margin: 4px 0 0; color: var(--muted); font-size: .69rem; line-height: 1.5; }
.scenario-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.scenario-grid article { padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.scenario-grid span { color: var(--teal); font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.scenario-grid h3 { margin: 7px 0 5px; font-family: Georgia, "Times New Roman", serif; font-size: 1rem; }
.scenario-grid p { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.guide-panel, .jtbd-panel { min-width: 0; }
.jtbd-table { min-width: 0; max-width: 100%; margin-top: 18px; border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.jtbd-row { min-width: 930px; display: grid; grid-template-columns: .85fr 1.35fr 1.55fr 1.2fr; border-bottom: 1px solid var(--line); }
.jtbd-row:last-child { border-bottom: 0; }
.jtbd-row > * { padding: 11px 12px; border-right: 1px solid var(--line); font-size: .68rem; line-height: 1.45; }
.jtbd-row > *:last-child { border-right: 0; }
.jtbd-row strong { font-size: .7rem; }
.jtbd-row span { color: var(--ink-2); }
.jtbd-row:nth-child(odd):not(.jtbd-header) { background: #f7f9fb; }
.jtbd-header { color: var(--muted); background: #eef2f6; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.reviewer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.reviewer-grid article { padding: 13px; border-left: 3px solid #829ab1; background: #f7f9fb; }
.reviewer-grid strong { font-size: .73rem; }
.reviewer-grid p { margin: 5px 0 0; color: var(--muted); font-size: .67rem; line-height: 1.45; }
.guide-footer-action { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 16px; padding: 14px; border-left: 3px solid var(--amber); background: var(--amber-soft); }
.guide-footer-action strong, .guide-footer-action span { display: block; }
.guide-footer-action strong { font-size: .75rem; }
.guide-footer-action span { margin-top: 3px; color: var(--muted); font-size: .69rem; }
.guide-footer-action a { flex: 0 0 auto; border-radius: 7px; padding: 9px 12px; color: white; background: var(--teal); font-size: .7rem; font-weight: 800; text-decoration: none; }

.governance-downloads { display: flex; align-items: center; gap: 9px; }
.governance-downloads > a:last-child { border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; color: var(--teal); background: white; font-size: .7rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.assurance-notice { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: baseline; margin: 18px 0 14px; padding: 12px 14px; border-left: 3px solid var(--teal); background: #eef8f8; }
.assurance-notice strong { font-size: .75rem; }
.assurance-notice span { color: var(--ink-2); font-size: .7rem; line-height: 1.5; }
.assurance-notice em { color: var(--muted); font-size: .64rem; font-style: normal; white-space: nowrap; }
.assurance-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.assurance-summary article { padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: 0 8px 24px rgba(16,42,67,.04); }
.assurance-summary span, .assurance-summary strong, .assurance-summary small { display: block; }
.assurance-summary span { color: var(--muted); font-size: .61rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.assurance-summary strong { margin: 5px 0 3px; font-size: .78rem; }
.assurance-summary small { color: var(--muted); font-size: .63rem; line-height: 1.45; }
.serve-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 18px; }
.serve-grid article { display: grid; grid-template-columns: 30px 1fr; gap: 9px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; }
.serve-grid article > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--teal); font-size: .73rem; font-weight: 900; }
.serve-grid strong { font-size: .74rem; }
.serve-grid p { margin: 4px 0 8px; color: var(--ink-2); font-size: .66rem; line-height: 1.45; }
.serve-grid small { display: block; padding-top: 7px; border-top: 1px solid var(--line); color: var(--muted); font-size: .59rem; line-height: 1.4; }
.system-card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 18px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.system-card-grid > div { min-height: 77px; padding: 13px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.system-card-grid > div:nth-child(4n) { border-right: 0; }
.system-card-grid > div:nth-last-child(-n+4) { border-bottom: 0; }
.system-card-grid span, .system-card-grid strong { display: block; }
.system-card-grid span { color: var(--muted); font-size: .61rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.system-card-grid strong { margin-top: 6px; font-size: .7rem; line-height: 1.45; }
.assurance-table { margin-top: 18px; border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.assurance-row { min-width: 1040px; display: grid; grid-template-columns: 1.35fr .72fr .72fr 1.1fr 1.45fr .8fr; align-items: center; border-bottom: 1px solid var(--line); }
.assurance-row:last-child { border-bottom: 0; }
.assurance-row > * { min-width: 0; padding: 11px; border-right: 1px solid var(--line); color: var(--ink-2); font-size: .66rem; line-height: 1.42; }
.assurance-row > *:last-child { border-right: 0; }
.assurance-row > strong { color: var(--ink); font-size: .68rem; }
.assurance-header { color: var(--muted); background: #eef2f6; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.assurance-header span { color: var(--muted); }
.status-pill { display: inline-block; justify-self: start; border-radius: 999px; padding: 4px 8px; font-size: .59rem !important; font-style: normal; font-weight: 800; line-height: 1.2; white-space: nowrap; }
.status-pill.implemented, .status-pill.evidence, .status-pill.direct { color: #0c6b58; background: #e6f6f1; }
.status-pill.mapped { color: #245b89; background: #eaf3fb; }
.status-pill.test, .status-pill.conditional { color: #8b5508; background: var(--amber-soft); }
.status-pill.outscope { color: var(--muted); background: #eef2f6; }
.applicability-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.applicability-grid article { padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; }
.applicability-grid strong { display: block; margin: 10px 0 6px; font-size: .73rem; line-height: 1.4; }
.applicability-grid p { margin: 0; color: var(--muted); font-size: .67rem; line-height: 1.5; }
.release-gate-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.release-gate-grid > div { display: grid; grid-template-columns: 26px 1fr; gap: 8px; padding: 12px; border: 1px solid #bee3df; border-radius: 8px; background: #f3fbf7; }
.release-gate-grid span { grid-row: 1 / 3; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: white; background: #287a57; font-size: .67rem; font-weight: 900; }
.release-gate-grid strong { font-size: .7rem; }
.release-gate-grid small { color: var(--muted); font-size: .61rem; line-height: 1.4; }
.governance-test-action { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 14px; padding: 14px; border-left: 3px solid var(--amber); background: var(--amber-soft); }
.governance-test-action strong, .governance-test-action span { display: block; }
.governance-test-action strong { font-size: .75rem; }
.governance-test-action span { margin-top: 4px; color: var(--ink-2); font-size: .68rem; line-height: 1.45; }
.governance-test-action button { flex: 0 0 auto; border: 0; border-radius: 7px; padding: 10px 13px; color: white; background: var(--teal); font-size: .7rem; font-weight: 800; }
.incident-trace { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.incident-trace > div { padding: 13px; border-right: 1px solid var(--line); background: white; }
.incident-trace > div:last-child { border-right: 0; }
.incident-trace span { width: 24px; height: 24px; display: grid; place-items: center; margin-bottom: 7px; border-radius: 50%; color: white; background: var(--teal); font-size: .65rem; font-weight: 900; }
.incident-trace strong { display: block; font-size: .7rem; }
.incident-trace p { margin: 4px 0 0; color: var(--muted); font-size: .63rem; line-height: 1.45; }

.signin-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 25% 20%, #214e69, var(--ink) 52%, #091d2d); }
.signin-card { width: min(480px, 100%); padding: 36px; border-radius: 14px; color: var(--ink); background: white; box-shadow: 0 30px 80px rgba(0,0,0,.28); }
.signin-mark { margin-bottom: 24px; }
.signin-card h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: -.02em; }
.signin-card > p:not(.eyebrow) { color: var(--muted); }
.signin-form { display: grid; gap: 8px; margin-top: 24px; }
.signin-form label { font-size: .75rem; font-weight: 800; }
.signin-form input { padding: 12px; border: 1px solid var(--line); border-radius: 7px; }
.signin-form button { border: 0; border-radius: 7px; padding: 12px; color: white; background: var(--teal); font-weight: 800; }
.signin-form p { min-height: 22px; margin: 4px 0 0; color: var(--muted); font-size: .72rem; }
.signin-card > small { display: block; margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted); }
.signin-alert, .signin-success { padding: 10px; border-radius: 6px; font-size: .75rem; }
.signin-alert { color: var(--red); background: var(--red-soft); }
.signin-success { color: #0c6b58; background: #e6f6f1; }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 205px minmax(0, 1fr); }
  .topbar { grid-template-columns: 205px 1fr auto; }
  .brand-lockup { padding: 0 14px; }
  .brand-lockup strong { font-size: .78rem; }
  .review-grid { grid-template-columns: 1fr; }
  .agent-step { padding: 11px 9px; }
  .agent-step span { display: none; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .portfolio-summary { grid-template-columns: repeat(2, 1fr); }
  .matter-selector { grid-template-columns: 1fr 1fr; }
  .library-grid { grid-template-columns: repeat(2, 1fr); }
  .control-grid { grid-template-columns: repeat(2, 1fr); }
  .reviewer-grid { grid-template-columns: repeat(2, 1fr); }
  .mandate-grid { grid-template-columns: repeat(2, 1fr); }
  .serve-grid { grid-template-columns: repeat(2, 1fr); }
  .assurance-summary, .system-card-grid { grid-template-columns: repeat(2, 1fr); }
  .system-card-grid > div:nth-child(4n) { border-right: 1px solid var(--line); }
  .system-card-grid > div:nth-child(2n) { border-right: 0; }
  .system-card-grid > div:nth-last-child(-n+4) { border-bottom: 1px solid var(--line); }
  .system-card-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
  .release-gate-grid { grid-template-columns: repeat(2, 1fr); }
  .incident-trace { grid-template-columns: 1fr 1fr; }
  .incident-trace > div { border-bottom: 1px solid var(--line); }
  .incident-trace > div:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .challenge-card { grid-template-columns: 105px 1fr; }
  .challenge-position:last-child { grid-column: 2; }
}

@media (max-width: 780px) {
  .app-shell { display: block; }
  .topbar { display: flex; height: auto; min-height: 70px; padding: 10px 14px; }
  .brand-lockup { border: 0; padding: 0; }
  .topbar-center { display: none; }
  .user-menu { margin-left: auto; min-width: 0; padding: 0; }
  .user-menu div { display: none; }
  .user-menu .demo-chip { display: none; }
  .sidebar { display: none; }
  .workspace { padding: 20px 14px 30px; }
  .workspace-header { align-items: stretch; flex-direction: column; }
  .run-button { width: 100%; }
  .agent-strip { grid-template-columns: 1fr; }
  .agent-step { min-height: 56px; border-right: 0; border-bottom: 1px solid var(--line); }
  .agent-step span { display: block; }
  .runtime-banner { align-items: flex-start; flex-direction: column; }
  .tabs { gap: 16px; overflow-x: auto; }
  .tabs button { white-space: nowrap; }
  .review-grid { grid-template-columns: minmax(0,1fr); }
  .evidence-chain { grid-template-columns: 1fr; }
  .comparison-symbol { margin: -2px auto; }
  .decision-bar { align-items: stretch; flex-wrap: wrap; }
  .decision-bar > div { flex-basis: 100%; }
  .decision-bar button { flex: 1; }
  .rule-row { grid-template-columns: 1fr; gap: 6px; }
  .rule-row.header { display: none; }
  .metric-grid, .governance-grid { grid-template-columns: 1fr; }
  .secondary-workspace { grid-column: 1; padding: 20px 14px 30px; }
  .portfolio-summary { grid-template-columns: 1fr 1fr; }
  .portfolio-action, .portfolio-audit { align-items: stretch; flex-direction: column; }
  .obligation-flow { grid-template-columns: 1fr 1fr; gap: 8px; }
  .obligation-flow > div, .obligation-flow > div:last-child { border: 1px solid var(--line); }
  .obligation-table { overflow-x: auto; }
  .obligation-row { min-width: 760px; }
  .mandate-grid { grid-template-columns: 1fr; }
  .challenge-card { grid-template-columns: 1fr; }
  .challenge-position, .challenge-position:last-child { grid-column: 1; border-left: 0; border-top: 1px solid var(--line); }
  .human-gate { flex-direction: column; }
  .matter-selector { grid-template-columns: 1fr; }
  .matter-links { flex-wrap: wrap; }
  .validation-action, .admin-notice { align-items: stretch; flex-direction: column; }
  .library-grid, .control-grid { grid-template-columns: 1fr; }
  .guide-steps, .scenario-grid, .reviewer-grid { grid-template-columns: 1fr; }
  .guide-footer-action, .guide-notice { align-items: stretch; flex-direction: column; }
  .guide-panel { padding: 16px; }
  .governance-downloads, .assurance-notice, .governance-test-action { align-items: stretch; flex-direction: column; }
  .governance-downloads { display: flex; }
  .assurance-notice { display: flex; }
  .assurance-summary, .serve-grid, .system-card-grid, .applicability-grid, .release-gate-grid, .incident-trace { grid-template-columns: 1fr; }
  .system-card-grid > div, .system-card-grid > div:nth-child(2n), .system-card-grid > div:nth-last-child(-n+2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .system-card-grid > div:last-child { border-bottom: 0; }
  .incident-trace > div, .incident-trace > div:last-child { grid-column: 1; border-right: 0; border-bottom: 1px solid var(--line); }
  .incident-trace > div:last-child { border-bottom: 0; }
}
