:root {
  --ink: #17272e;
  --muted: #66767b;
  --line: #dce2df;
  --line-strong: #c8d2ce;
  --canvas: #f7f5f0;
  --surface: #ffffff;
  --surface-alt: #eff3f1;
  --navy: #102833;
  --navy-2: #173844;
  --teal: #087e83;
  --teal-dark: #05666b;
  --teal-pale: #dff2f0;
  --amber: #a96808;
  --amber-pale: #fff1d8;
  --red: #a53d3d;
  --red-pale: #fdeaea;
  --blue: #3d6580;
  --blue-pale: #e8f0f4;
  --green: #2d7659;
  --green-pale: #e3f3ea;
  --shadow: 0 10px 28px rgba(16, 40, 51, .07);
  --radius: 9px;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
html, body, #root { min-height: 100%; margin: 0; }
body { background: var(--canvas); font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(8,126,131,.35); outline-offset: 2px; }
a { color: var(--teal-dark); text-underline-offset: 2px; }
.noscript { max-width: 620px; margin: 12vh auto; padding: 32px; background: #fff; border: 1px solid var(--line); }

/* Login */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(300px, .95fr) minmax(400px, 1.05fr); background: var(--canvas); }
.login-aside { background: var(--navy); color: #eaf2ef; padding: clamp(32px, 8vw, 110px) clamp(28px, 7vw, 100px); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-aside::after { content: ""; width: 460px; height: 460px; border: 1px solid rgba(111,205,198,.23); border-radius: 50%; position: absolute; right: -250px; top: -130px; box-shadow: 0 0 0 40px rgba(111,205,198,.05), 0 0 0 95px rgba(111,205,198,.04); }
.brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand img { width: 37px; height: 37px; }
.brand-word { line-height: 1.02; letter-spacing: .02em; font-weight: 700; font-size: 13px; }
.brand-word span { display: block; color: #a8c4c4; font-size: 9px; letter-spacing: .17em; margin-top: 4px; }
.login-aside h1 { position: relative; z-index: 1; margin: 52px 0 16px; max-width: 490px; color: #fff; font: 400 clamp(34px, 4vw, 52px)/1.04 Georgia, serif; letter-spacing: -.03em; }
.login-aside p { position: relative; z-index: 1; color: #b9cfcb; max-width: 440px; font-size: 16px; }
.login-foot { position: relative; z-index: 1; color: #91aaa8; font-size: 12px; }
.login-panel { display: flex; justify-content: center; align-items: center; padding: 38px; }
.login-card { width: min(410px, 100%); }
.eyebrow { margin: 0 0 10px; color: var(--teal-dark); font-size: 11px; letter-spacing: .13em; font-weight: 700; text-transform: uppercase; }
.login-card h2 { margin: 0 0 8px; font: 400 31px/1.1 Georgia, serif; letter-spacing: -.02em; }
.login-card > p { color: var(--muted); margin: 0 0 25px; }
.login-form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label { color: #415258; font-size: 12px; font-weight: 700; }
.field input, .field select, .field textarea, .top-select { width: 100%; min-height: 40px; border: 1px solid var(--line-strong); border-radius: 5px; background: #fff; color: var(--ink); padding: 9px 10px; }
.field textarea { min-height: 82px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal); }
.demo-credentials { border-left: 3px solid var(--teal); background: var(--teal-pale); margin: 20px 0; padding: 13px 14px; font-size: 12px; }
.demo-credentials strong { display: block; margin-bottom: 6px; color: #16484b; }
.demo-credentials code { display: block; overflow-wrap: anywhere; font-size: 11px; padding: 2px 0; }
.login-error { margin-top: 14px; color: var(--red); font-size: 13px; min-height: 20px; }

/* Shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 235px 1fr; }
.rail { position: sticky; top: 0; height: 100vh; background: var(--navy); color: #dce8e6; padding: 18px 12px; display: flex; flex-direction: column; overflow-y: auto; z-index: 10; }
.rail .brand { padding: 2px 8px 20px; }
.rail .brand img { width: 32px; height: 32px; }
.rail-label { color: #87a8a7; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; padding: 14px 10px 6px; }
.nav-list { list-style: none; padding: 0; margin: 0; }
.nav-item { width: 100%; border: 0; border-left: 2px solid transparent; border-radius: 0 5px 5px 0; color: #bed0ce; background: transparent; display: flex; align-items: center; gap: 11px; text-align: left; padding: 10px 9px; font-size: 13px; }
.nav-item:hover { background: rgba(255,255,255,.055); color: #fff; }
.nav-item.active { border-left-color: #4fc5bd; background: #183d46; color: #fff; font-weight: 700; }
.nav-icon { width: 17px; height: 17px; flex: 0 0 17px; color: #84c8c2; }
.rail-bottom { margin-top: auto; padding: 18px 8px 3px; border-top: 1px solid rgba(230,250,245,.12); }
.rail-bottom .tenant { font-size: 11px; color: #a0b9b7; overflow-wrap: anywhere; }
.rail-bottom .role { color: #fff; text-transform: capitalize; margin-top: 3px; font-size: 13px; }
.main-shell { min-width: 0; }
.commandbar { min-height: 67px; display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,.9); border-bottom: 1px solid var(--line); padding: 12px 28px; position: sticky; top: 0; z-index: 8; backdrop-filter: blur(8px); }
.command-title { font-size: 12px; color: var(--muted); white-space: nowrap; }
.command-spacer { flex: 1; }
.top-select { min-width: min(300px, 33vw); max-width: 380px; min-height: 35px; font-size: 12px; padding: 6px 28px 6px 9px; }
.user-menu { display: flex; align-items: center; gap: 7px; }
.user-initials { width: 29px; height: 29px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: white; font-size: 11px; font-weight: 700; }
.user-text { font-size: 12px; line-height: 1.15; }
.user-text span { display: block; color: var(--muted); font-size: 10px; text-transform: capitalize; }
.page { max-width: 1540px; margin: 0 auto; padding: 28px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head h1 { margin: 0; font: 400 clamp(28px, 3vw, 40px)/1.05 Georgia, serif; letter-spacing: -.025em; }
.page-head p { margin: 7px 0 0; color: var(--muted); max-width: 740px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { min-height: 34px; border: 1px solid var(--line-strong); border-radius: 5px; background: #fff; color: #293e45; padding: 7px 11px; font-size: 12px; font-weight: 700; }
.btn:hover { border-color: #aabbb8; background: #f9fbfa; }
.btn.primary { color: white; background: var(--teal); border-color: var(--teal); }
.btn.primary:hover { background: var(--teal-dark); }
.btn.danger { color: var(--red); border-color: #edc1c1; }
.btn.ghost-dark { border-color: #3c5a62; color: #d8eeeb; background: transparent; }
.btn:disabled { cursor: not-allowed; opacity: .48; }
.mobile-menu { display: none; }

/* Components */
.synthetic-banner { display: flex; align-items: center; gap: 9px; padding: 9px 12px; margin: 0 0 20px; color: #6c500a; background: var(--amber-pale); border: 1px solid #efd69d; border-radius: var(--radius); font-size: 12px; }
.synthetic-banner strong { letter-spacing: .08em; font-size: 10px; }
.notice { padding: 13px 15px; background: var(--blue-pale); border-left: 3px solid var(--blue); color: #385665; margin-bottom: 18px; font-size: 13px; }
.notice.warn { background: var(--amber-pale); border-color: var(--amber); color: #765717; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 5px rgba(19,42,48,.025); }
.card-pad { padding: 18px; }
.card-title { margin: 0; font-size: 13px; font-weight: 700; color: #253a40; }
.card-subtitle { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.overview-main { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr); gap: 16px; }
.metric { padding: 16px; min-height: 115px; position: relative; overflow: hidden; }
.metric::after { content: ""; position: absolute; height: 2px; width: 34px; top: 0; left: 16px; background: var(--teal); }
.metric .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.metric .value { margin: 10px 0 3px; font: 400 30px/1 Georgia, serif; }
.metric .detail { font-size: 11px; color: var(--muted); }
.score-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.score { padding: 13px 11px; border: 1px solid var(--line); background: #fcfdfc; }
.score-name { display: block; min-height: 30px; color: var(--muted); font-size: 10px; line-height: 1.25; text-transform: uppercase; letter-spacing: .06em; }
.score-val { display: block; font: 400 25px/1 Georgia, serif; margin: 9px 0 7px; }
.meter { height: 4px; background: #e5ebea; overflow: hidden; border-radius: 3px; }
.meter > span { display: block; height: 100%; background: var(--teal); }
.meter.unknown > span { width: 100% !important; background: #c4cfcc; background-image: repeating-linear-gradient(135deg, transparent 0 4px, rgba(255,255,255,.6) 4px 7px); }
.split-card-head { display: flex; gap: 12px; justify-content: space-between; align-items: start; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 610px; }
th { background: #fbfcfb; padding: 9px 13px; color: #6a7b7d; text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 13px; border-bottom: 1px solid #e8edeb; vertical-align: top; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: #f1f8f6; }
.cell-main { font-weight: 700; color: #253c42; }
.cell-note { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: .92em; word-break: break-word; }
.badge { display: inline-flex; align-items: center; min-height: 21px; border-radius: 999px; padding: 2px 8px; font-size: 10px; font-weight: 700; line-height: 1.25; white-space: nowrap; }
.badge.pass, .badge.verified, .badge.observed, .badge.approved { color: #27664e; background: var(--green-pale); }
.badge.fail { color: #8a3333; background: var(--red-pale); }
.badge.unknown, .badge.manual_review, .badge.self_reported, .badge.inferred, .badge.draft { color: #826015; background: var(--amber-pale); }
.badge.not_applicable { color: #63747a; background: #edf0ef; }
.badge.user_confirmed, .badge.in_review { color: #3d6178; background: var(--blue-pale); }
.toolbar { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 15px; }
.toolbar .search { flex: 1 1 240px; max-width: 390px; min-height: 35px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 5px; }
.toolbar select { min-height: 35px; border: 1px solid var(--line-strong); border-radius: 5px; background: #fff; padding: 6px 27px 6px 8px; font-size: 12px; }
.section-label { margin: 28px 0 9px; color: #64777a; font-weight: 700; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.empty { border: 1px dashed #bdcac6; background: rgba(255,255,255,.52); padding: 42px 25px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--ink); font: 400 25px Georgia, serif; margin: 0 0 7px; }
.empty p { max-width: 520px; margin: 0 auto 16px; }
.kv { margin: 0; display: grid; grid-template-columns: minmax(100px, .78fr) 1.4fr; gap: 0; }
.kv dt, .kv dd { border-top: 1px solid var(--line); padding: 8px 0; font-size: 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: #263e44; overflow-wrap: anywhere; }

/* Drawers and dialogs */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(8,27,34,.34); }
.drawer { position: fixed; z-index: 51; right: 0; top: 0; height: 100vh; width: min(570px, 100vw); background: #fff; box-shadow: -18px 0 45px rgba(10,27,33,.16); display: flex; flex-direction: column; animation: slidein .16s ease-out; }
.drawer-head { display: flex; gap: 10px; justify-content: space-between; align-items: start; padding: 22px 24px 15px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font: 400 26px/1.05 Georgia, serif; margin: 0; }
.drawer-body { overflow-y: auto; padding: 20px 24px 48px; }
.icon-btn { background: transparent; border: 0; color: #53666c; padding: 4px; font-size: 20px; line-height: 1; }
.drawer-section { margin: 0 0 23px; }
.drawer-section h3 { margin: 0 0 9px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #5b6f74; }
.capability-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.capability { border: 1px solid var(--line); padding: 10px; min-height: 88px; }
.capability h4 { margin: 0 0 5px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.capability p { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.result-item { border-left: 3px solid var(--line-strong); padding: 9px 0 9px 11px; margin-bottom: 8px; }
.result-item.fail { border-color: var(--red); }
.result-item.unknown, .result-item.manual_review { border-color: var(--amber); }
.result-item h4 { margin: 0 0 4px; font-size: 13px; }
.result-item p { margin: 0; font-size: 12px; color: var(--muted); }
.modal-wrap { position: fixed; z-index: 60; inset: 0; display: grid; align-items: center; justify-items: center; padding: 18px; }
.modal { width: min(570px, 100%); max-height: calc(100vh - 36px); overflow-y: auto; background: #fff; border-radius: 10px; box-shadow: 0 17px 55px rgba(9,26,32,.26); }
.modal-head { padding: 18px 20px 13px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: start; }
.modal-head h2 { margin: 0; font: 400 24px Georgia, serif; }
.modal-body { padding: 18px 20px 20px; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.dropzone { padding: 25px; text-align: center; border: 1px dashed #9dada9; background: #f7fbfa; color: #607377; margin: 13px 0; }
.dropzone.drag { border-color: var(--teal); background: var(--teal-pale); }
.form-error { color: var(--red); font-size: 12px; min-height: 17px; margin-top: 10px; }
.toast-region { position: fixed; z-index: 100; top: 14px; right: 14px; display: grid; gap: 8px; max-width: min(390px, calc(100vw - 28px)); }
.toast { color: #fff; background: var(--navy); padding: 12px 14px; box-shadow: var(--shadow); border-left: 3px solid var(--teal); font-size: 13px; animation: fadein .15s ease-out; }
.toast.error { border-color: #e46c6c; }
@keyframes slidein { from { transform: translateX(18px); opacity: .5; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadein { from { transform: translateY(-5px); opacity: .2; } to { transform: translateY(0); opacity: 1; } }

/* Dependency, evidence, HSM, payment */
.dep-canvas { height: min(580px, 67vh); min-height: 390px; position: relative; overflow: auto; background-color: #fcfdfc; background-image: linear-gradient(#edf1ef 1px, transparent 1px), linear-gradient(90deg, #edf1ef 1px, transparent 1px); background-size: 28px 28px; }
.dep-canvas svg { min-width: 760px; width: 100%; height: 100%; }
.dep-node { cursor: pointer; }
.dep-node:hover circle { stroke: var(--teal); stroke-width: 3; }
.dep-node text { pointer-events: none; font: 11px Arial, sans-serif; fill: #243b41; }
.dep-edge-label { font: 10px Arial, sans-serif; fill: #5d7376; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 11px; }
.legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; background: var(--teal); }
.timeline-list { list-style: none; padding: 0; margin: 0; }
.timeline-list li { padding: 12px 0 12px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline-list li::before { content: ""; width: 8px; height: 8px; position: absolute; border-radius: 50%; background: var(--teal); left: -5px; top: 17px; }
.timeline-list li strong { display: block; font-size: 12px; }
.timeline-list li span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.ceremony-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ceremony-card { border: 1px solid var(--line); padding: 13px; background: #fff; }
.ceremony-card .ceremony-type { color: var(--teal-dark); text-transform: uppercase; letter-spacing: .1em; font-size: 10px; font-weight: 700; }
.ceremony-card h3 { margin: 7px 0 4px; font-size: 13px; }
.ceremony-card p { color: var(--muted); font-size: 11px; margin: 0; }
.payment-layout { display: grid; grid-template-columns: minmax(480px, 1.2fr) minmax(280px, .8fr); gap: 16px; }
.payment-diagram { overflow: auto; min-height: 380px; background: #fcfdfc; border: 1px solid var(--line); }
.payment-diagram svg { min-width: 650px; width: 100%; height: 390px; }
.source-line { padding: 8px 0; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.source-line a { margin-left: 5px; }
.task-card { padding: 15px; border-bottom: 1px solid var(--line); }
.task-card:last-child { border-bottom: 0; }
.task-card h3 { margin: 0 0 5px; font-size: 13px; }
.task-card p { margin: 0 0 9px; color: var(--muted); font-size: 12px; }

@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-main, .payment-layout { grid-template-columns: 1fr; }
  .score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ceremony-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  .app-shell { grid-template-columns: 1fr; }
  .rail { position: fixed; inset: 0 auto 0 0; width: 245px; transform: translateX(-102%); transition: transform .16s ease-out; box-shadow: 10px 0 30px rgba(0,0,0,.14); }
  .rail.open { transform: translateX(0); }
  .mobile-menu { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); background: #fff; border-radius: 5px; }
  .commandbar { padding: 10px 14px; }
  .command-title { display: none; }
  .top-select { min-width: 0; flex: 1; max-width: none; }
  .user-text { display: none; }
  .page { padding: 20px 15px; }
  .page-head { display: block; }
  .page-head .actions { margin-top: 15px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-aside { min-height: 310px; padding: 30px; }
  .login-aside h1 { margin-top: 35px; font-size: 36px; }
  .login-panel { padding: 34px 24px; }
  .ceremony-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Offline tutorial library */
.tutorial-card { margin: 20px 0; }
.tutorial-video { display: block; width: 100%; max-width: 1100px; aspect-ratio: 16 / 9; background: var(--navy); border-radius: 5px; }
.tutorial-chapters { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.tutorial-chapters .btn { text-align: left; font-weight: 400; }
.tutorial-transcript { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.tutorial-transcript summary { cursor: pointer; color: var(--teal-dark); font-weight: 700; }
.tutorial-steps { padding-left: 24px; max-width: 920px; }
.tutorial-steps li { margin: 16px 0; }
.tutorial-steps p { color: var(--muted); margin: 5px 0; }
video:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
