:root {
  --navy: #12243c;
  --navy-2: #1a304d;
  --navy-3: #294562;
  --gold: #895f0c;
  --gold-bright: #c99228;
  --gold-pale: #fbf4e7;
  --ink: #17263a;
  --slate: #5f6f83;
  --muted: #667085;
  --line: #d7dee6;
  --line-soft: #e9edf2;
  --surface: #f4f6f8;
  --surface-raised: #fbfcfd;
  --white: #fff;
  --green: #287a5a;
  --green-pale: #eaf6f0;
  --amber: #9b6910;
  --amber-pale: #fff6dc;
  --red: #b5433d;
  --red-pale: #fcecea;
  --blue: #356ca8;
  --blue-pale: #eaf2fb;
  --shadow-sm: 0 1px 2px rgba(18, 36, 60, .04), 0 5px 16px rgba(18, 36, 60, .04);
  --shadow: 0 18px 48px rgba(18, 36, 60, .08);
  --radius-sm: 9px;
  --radius: 14px;
  --font-sans: Inter, "Segoe UI Variable", "Segoe UI", Roboto, Helvetica, Arial, system-ui, -apple-system, sans-serif;
  --font-display: "Segoe UI Variable Display", "Aptos Display", Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--surface);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--ink); background: var(--surface); font-family: var(--font-sans); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(201, 146, 40, .3); outline-offset: 2px; }
::selection { color: var(--navy); background: #ecd6a7; }

.eyebrow { margin: 0 0 11px; color: var(--gold); font-size: 10px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow.light { color: #d9af5b; }
.muted { color: var(--slate); }
.small { font-size: 12px; }
.tabular { font-variant-numeric: tabular-nums; }
.form-error { padding: 10px 12px; border-radius: 8px; background: var(--red-pale); color: var(--red); font-size: 13px; }

/* Login */
.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(420px, .75fr); }
.login-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(38px, 6vw, 86px); color: white; background: var(--navy); }
.login-brand::before { content: ""; position: absolute; width: 48vw; height: 48vw; right: -18vw; top: -20vw; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; box-shadow: 0 0 0 8vw rgba(255,255,255,.025), 0 0 0 16vw rgba(255,255,255,.018); }
.login-brand::after { content: "360"; position: absolute; right: -28px; bottom: -60px; color: rgba(255,255,255,.025); font-family: var(--font-display); font-size: clamp(160px, 24vw, 340px); font-weight: 750; line-height: 1; letter-spacing: -.08em; }
.brand-mark { position: relative; z-index: 1; width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; color: #e2ba69; font-family: var(--font-display); font-size: 25px; font-weight: 750; line-height: 1; }
.brand-mark span { transform: translateY(-1px); }
.login-brand h1 { position: relative; z-index: 1; max-width: 760px; margin: 0; font-family: var(--font-display); font-size: clamp(42px, 5.3vw, 78px); font-weight: 650; line-height: 1.07; letter-spacing: -.05em; }
.login-brand h1 em { color: #d9af5b; font-style: normal; }
.login-lead { position: relative; z-index: 1; max-width: 630px; margin: 28px 0 0; color: #c5ced9; font-size: clamp(15px, 1.4vw, 19px); line-height: 1.7; }
.login-proof { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; max-width: 760px; }
.login-proof div { display: grid; grid-template-columns: 34px 1fr; gap: 10px; border-top: 1px solid rgba(255,255,255,.18); padding-top: 14px; }
.login-proof strong { color: #d9af5b; font-size: 12px; letter-spacing: .08em; }
.login-proof span { color: #b7c1cd; font-size: 12px; line-height: 1.45; }
.login-panel { display: grid; place-items: center; padding: 36px; background: white; }
.login-form { width: min(100%, 390px); }
.login-form h2 { margin: 0 0 10px; font-family: var(--font-display); font-size: 29px; font-weight: 650; line-height: 1.2; letter-spacing: -.025em; }
.login-form > .muted { margin: 0 0 34px; line-height: 1.55; font-size: 14px; }
.login-form label { display: grid; gap: 8px; margin: 0 0 17px; color: #38465a; font-size: 12px; font-weight: 600; }
.login-form input { height: 48px; padding: 0 14px; border: 1px solid #cbd3dc; border-radius: var(--radius-sm); background: var(--surface-raised); transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.login-form input:focus { border-color: var(--gold); background: white; box-shadow: 0 0 0 3px rgba(169,117,18,.1); outline: none; }
.security-note { margin: 20px 0 0; text-align: center; color: var(--muted); font-size: 11px; }
.security-note span { color: var(--green); font-size: 8px; }
.mobile-logo { display: none; }

/* Shell */
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: 232px; display: flex; flex-direction: column; padding: 27px 16px 18px; color: #dbe3eb; background: linear-gradient(180deg, var(--navy) 0%, #102139 100%); box-shadow: 1px 0 rgba(255,255,255,.025); }
.logo { display: grid; grid-template-columns: auto auto 1fr; align-items: baseline; padding: 2px 12px 34px; font-family: var(--font-display); }
.brand-word { color: white; font-size: 22px; font-weight: 700; letter-spacing: .05em; }
.logo b { color: #d4a241; font-size: 22px; font-weight: 500; }
.logo small { grid-column: 1 / -1; margin-top: 4px; color: #8d9bad; font-family: var(--font-sans); font-size: 9px; font-weight: 700; line-height: 1; letter-spacing: .14em; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a, .nav-bottom > a, .nav-button { position: relative; width: 100%; min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border: 0; border-radius: var(--radius-sm); color: #b4bfcc; background: transparent; cursor: pointer; font-size: 13px; font-weight: 550; text-align: left; transition: color .17s ease, background .17s ease, box-shadow .17s ease; }
.sidebar nav a:hover, .nav-bottom > a:hover, .nav-button:hover { color: white; background: rgba(255,255,255,.06); }
.sidebar nav a.active, .nav-bottom > a.active { color: white; background: rgba(255,255,255,.09); box-shadow: inset 3px 0 #c89126; }
.sidebar i { width: 21px; color: #8493a4; font-family: "Segoe UI Symbol", "Apple Symbols", var(--font-sans); font-size: 17px; font-style: normal; text-align: center; }
.sidebar .active i { color: #ddb355; }
.sidebar mark { min-width: 19px; height: 19px; display: grid; place-items: center; margin-left: auto; border-radius: 10px; color: white; background: var(--red); font-size: 10px; }
.nav-bottom { display: grid; gap: 5px; margin-top: auto; }
.sidebar-user { display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: center; margin-top: 14px; padding: 15px 10px 2px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-user > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--navy); background: #d9af5b; font-size: 12px; font-weight: 700; }
.sidebar-user div { min-width: 0; }
.sidebar-user strong, .sidebar-user small { overflow: hidden; display: block; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { color: white; font-size: 11px; font-weight: 600; }
.sidebar-user small { margin-top: 2px; color: #8897a8; font-size: 10px; }
.mobile-header { display: none; }
#app-view { min-height: 100vh; margin-left: 232px; padding: 34px clamp(26px, 3.8vw, 64px) 72px; }

/* Reusable page pieces */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-title h1 { margin: 0; color: var(--navy); font-family: var(--font-display); font-size: clamp(29px, 3vw, 39px); font-weight: 650; line-height: 1.14; letter-spacing: -.035em; }
.page-title > p:last-child { max-width: 720px; margin: 9px 0 0; color: var(--slate); font-size: 13.5px; line-height: 1.55; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: white; cursor: pointer; font-size: 12.5px; font-weight: 650; letter-spacing: .005em; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background .18s ease; }
.button:hover { border-color: #b7c1cc; box-shadow: 0 5px 16px rgba(18,36,60,.09); transform: translateY(-1px); }
.button.primary { border-color: var(--gold); color: white; background: var(--gold); }
.button.primary:hover { border-color: #8c5f0d; background: #8c5f0d; }
.button.navy { border-color: var(--navy); color: white; background: var(--navy); }
.button.danger { border-color: #e5b8b5; color: var(--red); background: var(--red-pale); }
.button.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.button.small-button { min-height: 34px; padding: 0 12px; font-size: 11.5px; }
.button.full { width: 100%; min-height: 48px; }
.button[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.card { border: 1px solid var(--line-soft); border-radius: var(--radius); background: white; box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line-soft); }
.card-header h2, .card-header h3 { margin: 0; color: var(--navy); font-family: var(--font-display); font-size: 16px; font-weight: 650; line-height: 1.3; letter-spacing: -.01em; }
.card-header p { margin: 5px 0 0; color: var(--slate); font-size: 11.5px; }
.help-tip { position: relative; display: inline-flex; margin-left: 4px; vertical-align: middle; }
.help-tip-trigger { width: 18px; height: 18px; display: inline-grid; place-items: center; padding: 0; border: 1px solid #b9c5d0; border-radius: 50%; color: #5b6d80; background: white; cursor: help; font-family: var(--font-sans); font-size: 11px; font-weight: 750; line-height: 1; }
.help-tip-trigger:hover, .help-tip-trigger:focus-visible { border-color: var(--gold); color: #7e5a16; background: var(--gold-pale); outline: none; }
.help-tip-content { position: absolute; z-index: 30; top: calc(100% + 8px); left: 50%; width: min(310px, calc(100vw - 48px)); padding: 10px 11px; border: 1px solid #d7dfe7; border-radius: 8px; color: #405166; background: white; box-shadow: 0 10px 26px rgba(18,36,60,.16); font-family: var(--font-sans); font-size: 11px; font-weight: 500; letter-spacing: normal; line-height: 1.5; text-align: left; text-transform: none; white-space: normal; opacity: 0; pointer-events: none; transform: translate(-50%, -4px); visibility: hidden; transition: opacity .16s ease, transform .16s ease, visibility .16s ease; }
.help-tip:hover .help-tip-content, .help-tip:focus-within .help-tip-content { opacity: 1; transform: translate(-50%, 0); visibility: visible; }
.card-body { padding: 22px; }
.stack { display: grid; gap: 18px; }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .7fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.divider { height: 1px; margin: 18px 0; background: var(--line-soft); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric-card { position: relative; min-height: 132px; overflow: hidden; padding: 20px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: white; box-shadow: var(--shadow-sm); }
.metric-card::after { content: ""; position: absolute; width: 72px; height: 72px; right: -28px; top: -27px; border-radius: 50%; background: var(--gold-pale); }
.metric-card .label { display: flex; align-items: center; gap: 7px; color: var(--slate); font-size: 11px; font-weight: 600; }
.metric-card .label i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.metric-card strong { display: block; margin-top: 18px; color: var(--navy); font-family: var(--font-display); font-size: 30px; font-weight: 650; line-height: 1; letter-spacing: -.035em; }
.metric-card small { display: block; margin-top: 9px; color: var(--muted); font-size: 10px; }
.metric-card.alert::after { background: var(--red-pale); }
.metric-card.alert .label i { background: var(--red); }
.metric-card.success::after { background: var(--green-pale); }
.metric-card.success .label i { background: var(--green); }
.metric-card.limitation::after { background: var(--amber-pale); }
.metric-card.limitation .label i { background: var(--amber); }
.metric-card strong, .data-table .money, .report-top-meta, .scope-strip strong, .check-card small { font-variant-numeric: tabular-nums; }

.status { display: inline-flex; align-items: center; gap: 6px; min-height: 25px; padding: 3px 9px; border: 1px solid #dde2e7; border-radius: 14px; color: #5f6875; background: #f1f3f5; font-size: 11px; font-weight: 650; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #8792a0; }
.status.tone-success { border-color: #c7e4d5; color: #246849; background: var(--green-pale); }
.status.tone-success::before { background: var(--green); }
.status.tone-action { border-color: #efc9c6; color: #973934; background: var(--red-pale); }
.status.tone-action::before { background: var(--red); }
.status.tone-neutral { border-color: #dde2e7; color: #5f6875; background: #f1f3f5; }
.status.tone-neutral::before { background: #8792a0; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { padding: 11px 12px; border-bottom: 1px solid var(--line); color: #748196; font-size: 9.5px; font-weight: 750; letter-spacing: .065em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table th.actions-column { text-align: right; }
.data-table th.actions-column .button { letter-spacing: .005em; text-transform: none; }
.data-table td { padding: 13px 12px; border-bottom: 1px solid var(--line-soft); color: #344256; line-height: 1.45; vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .14s ease; }
.data-table tbody tr:hover { background: #fafbfc; }
.data-table a { color: var(--navy); font-weight: 600; }
.data-table a:hover { color: var(--gold); }
.data-table .money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .primary-cell strong { display: block; color: var(--navy); font-size: 12px; }
.data-table .primary-cell small { display: block; margin-top: 3px; color: var(--muted); }
.empty-state { display: grid; place-items: center; min-height: 240px; padding: 30px; color: var(--slate); text-align: center; }
.empty-state .empty-icon { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 15px; border-radius: 50%; color: var(--gold); background: var(--gold-pale); font-size: 23px; }
.empty-state h3 { margin: 0 0 7px; color: var(--navy); font-family: var(--font-display); font-size: 17px; font-weight: 650; line-height: 1.3; }
.empty-state p { max-width: 390px; margin: 0 0 16px; font-size: 12px; line-height: 1.5; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.search-field { position: relative; flex: 1 1 270px; }
.search-field::before { content: "⌕"; position: absolute; left: 12px; top: 50%; color: var(--muted); font-size: 17px; transform: translateY(-52%); }
.search-field input { width: 100%; height: 42px; padding: 0 13px 0 37px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: white; }
.toolbar select { height: 42px; min-width: 165px; padding: 0 32px 0 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: #465367; background: white; }
.report-filters .search-field { flex: 1 1 260px; }
.compact-date { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10.5px; font-weight: 600; }
.compact-date input { height: 42px; padding: 0 9px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: #465367; background: white; }

/* Report readiness */
.readiness-card { overflow: hidden; border-color: #dce4eb; box-shadow: 0 7px 22px rgba(18,36,60,.05); }
.readiness-card.is-complete { border-color: #cfe6da; }
.readiness-header { align-items: center; padding: 21px 24px 19px; background: linear-gradient(100deg, #fff 0%, #fbfdfc 100%); }
.readiness-kicker { display: block; margin-bottom: 6px; color: var(--green); font-size: 9px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.readiness-header h2 { font-size: 17px; }
.readiness-header p { max-width: 760px; margin-top: 6px; line-height: 1.5; }
.readiness-summary { display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; gap: 12px; }
.readiness-count { min-width: 91px; padding: 3px 0; border-right: 1px solid var(--line-soft); text-align: right; }
.readiness-count strong { display: block; color: var(--navy); font-family: var(--font-display); font-size: 20px; font-weight: 700; line-height: 1; letter-spacing: -.04em; }
.readiness-count strong small { margin-left: 2px; color: #8a96a5; font-family: var(--font-sans); font-size: 11px; font-weight: 650; letter-spacing: 0; }
.readiness-count > span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; font-weight: 650; white-space: nowrap; }
.readiness-body { padding: 18px 20px 20px; }
.readiness-progress { height: 4px; overflow: hidden; margin: 0 3px 16px; border-radius: 4px; background: #e7edf1; }
.readiness-progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2f8b68, #5aaf82); transition: width .25s ease; }
.readiness-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 0; padding: 0; list-style: none; }
.readiness-steps li { min-width: 0; }
.readiness-step { width: 100%; min-height: 72px; display: grid; grid-template-columns: 30px minmax(0, 1fr) 18px; align-items: center; gap: 11px; padding: 12px 13px; border: 1px solid var(--line-soft); border-radius: 10px; color: var(--ink); background: #fff; cursor: pointer; text-align: left; transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease; }
.readiness-step:hover { border-color: #c9d6df; background: #fcfdfd; box-shadow: 0 5px 14px rgba(18,36,60,.07); transform: translateY(-1px); }
.readiness-step:focus-visible { outline-offset: 1px; }
.readiness-step-marker { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid #d7e5dd; border-radius: 50%; color: var(--green); background: var(--green-pale); font-size: 13px; font-weight: 800; line-height: 1; }
.readiness-step-copy { min-width: 0; }
.readiness-step-copy strong, .readiness-step-copy small { overflow: hidden; display: block; text-overflow: ellipsis; white-space: nowrap; }
.readiness-step-copy strong { color: var(--navy); font-size: 11.5px; font-weight: 700; line-height: 1.35; }
.readiness-step-copy small { margin-top: 3px; color: var(--muted); font-size: 9.5px; line-height: 1.35; }
.readiness-step-arrow { color: #9aa7b5; font-size: 17px; line-height: 1; transition: color .18s ease, transform .18s ease; }
.readiness-step:hover .readiness-step-arrow { color: var(--navy); transform: translateX(2px); }
.readiness-step.action_required { border-color: #edcfcc; background: #fffafa; }
.readiness-step.action_required .readiness-step-marker { border-color: #edc8c5; color: var(--red); background: var(--red-pale); }
.readiness-step.optional_missing { border-color: #eadfbe; background: #fffdf8; }
.readiness-step.optional_missing .readiness-step-marker { border-color: #eadcb8; color: var(--amber); background: var(--amber-pale); }
.readiness-next { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 14px; padding: 13px 14px 13px 16px; border: 1px solid #e8d8b5; border-radius: 10px; background: #fffaf0; }
.readiness-next > div { display: grid; gap: 2px; }
.readiness-next span { color: #82682e; font-size: 9px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.readiness-next strong { color: #604b1c; font-size: 12px; }
.readiness-card.is-compact .readiness-header { display: grid; gap: 13px; padding: 18px; }
.readiness-card.is-compact .readiness-header h2 { font-size: 15px; }
.readiness-card.is-compact .readiness-summary { justify-content: flex-start; }
.readiness-card.is-compact .readiness-count { min-width: 70px; padding-right: 11px; text-align: left; }
.readiness-card.is-compact .readiness-body { padding: 15px; }
.readiness-card.is-compact .readiness-steps { grid-template-columns: 1fr; }
.readiness-card.is-compact .readiness-step { min-height: 68px; grid-template-columns: 27px minmax(0, 1fr) 14px; gap: 9px; padding: 10px; }
.readiness-card.is-compact .readiness-step-marker { width: 27px; height: 27px; font-size: 12px; }
.readiness-card.is-compact .readiness-step-copy strong, .readiness-card.is-compact .readiness-step-copy small { white-space: normal; }

/* Dashboard */
.welcome-row { margin-bottom: 26px; }
.welcome-row .date-line { margin-top: 8px; color: var(--slate); font-size: 12px; }
.action-list { display: grid; }
.action-row { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.action-row:last-child { border-bottom: 0; }
.action-row > i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.action-row.critical > i { background: var(--red); }
.action-row.info > i { background: var(--blue); }
.action-row.success > i { background: var(--green); }
.action-row strong { display: block; color: var(--navy); font-size: 12px; }
.action-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.source-banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid #d5e8de; border-radius: 10px; background: #f2faf6; }
.source-banner > i { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: white; font-style: normal; }
.source-banner strong { display: block; color: #245d45; font-size: 12px; }
.source-banner small { display: block; margin-top: 2px; color: #567765; font-size: 10.5px; }

/* Wizard */
.wizard { max-width: 1040px; margin: 0 auto; }
.stepper { display: grid; grid-template-columns: repeat(3, 1fr); margin: 2px 0 30px; }
.step { position: relative; display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: 12px; }
.step::after { content: ""; position: absolute; z-index: 0; left: 32px; right: 0; top: 16px; height: 1px; background: var(--line); }
.step:last-child::after { display: none; }
.step b, .step span { position: relative; z-index: 1; }
.step span { padding-right: 14px; background: var(--surface); }
.step b { width: 32px; height: 32px; display: grid; flex: 0 0 32px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); font-size: 11px; font-weight: 700; }
.step.active { color: var(--navy); font-weight: 600; }
.step.active b { border-color: var(--gold); color: white; background: var(--gold); box-shadow: 0 0 0 4px var(--gold-pale); }
.step.done b { border-color: var(--green); color: white; background: var(--green); }
.wizard-card { padding: clamp(26px, 4vw, 44px); box-shadow: 0 16px 42px rgba(18,36,60,.065); }
.wizard-card > h2 { margin: 0; color: var(--navy); font-family: var(--font-display); font-size: 24px; font-weight: 650; line-height: 1.25; letter-spacing: -.025em; }
.wizard-card > p { margin: 9px 0 28px; color: var(--slate); font-size: 13px; line-height: 1.55; }
.wizard-client-search { margin-bottom: 24px; }
.client-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-height: 420px; overflow: auto; }
.client-choice { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; min-height: 70px; padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; background: white; text-align: left; transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease; }
.client-choice:hover { border-color: #b9c3ce; background: var(--surface-raised); transform: translateY(-1px); }
.client-choice.selected { border-color: var(--gold); background: #fffdf8; box-shadow: 0 0 0 3px rgba(173,121,25,.09); }
.client-choice > span:first-child { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; color: var(--navy); background: var(--gold-pale); font-size: 11px; font-weight: 700; }
.client-choice strong, .client-choice small { overflow: hidden; display: block; text-overflow: ellipsis; white-space: nowrap; }
.client-choice strong { color: var(--navy); font-size: 12.5px; }
.client-choice small { margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.client-choice em { color: var(--slate); font-size: 10.5px; font-style: normal; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; row-gap: 20px; }
.form-grid > .full-span { grid-column: 1 / -1; }
.form-field { display: grid; gap: 8px; color: #3d4d62; font-size: 12px; font-weight: 650; }
.form-field.full-span { grid-column: 1 / -1; }
.form-field input:not([type="checkbox"]):not([type="radio"]), .form-field select, .form-field textarea { width: 100%; min-height: 46px; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); background: var(--surface-raised); font-size: 13px; font-weight: 450; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.form-field input:not([type="checkbox"]):not([type="radio"]):hover, .form-field select:hover, .form-field textarea:hover, .search-field input:hover, .toolbar select:hover, .compact-date input:hover { border-color: #bdc6d0; }
.form-field input:not([type="checkbox"]):not([type="radio"]):focus, .form-field select:focus, .form-field textarea:focus, .search-field input:focus, .toolbar select:focus, .compact-date input:focus { border-color: var(--gold); background: white; box-shadow: 0 0 0 3px rgba(173,121,25,.1); outline: none; }
.form-field textarea { min-height: 105px; line-height: 1.5; resize: vertical; }
.form-field small { color: var(--muted); font-size: 10.5px; font-weight: 450; line-height: 1.45; }
.form-field select[multiple] { min-height: 210px; padding: 5px; }
.form-field select[multiple] option { padding: 7px 8px; border-radius: 4px; }
.form-field.checkbox-row { display: flex; align-items: center; gap: 9px; }
.form-field.checkbox-row input { width: 17px; height: 17px; min-height: 17px; margin: 0; padding: 0; accent-color: var(--gold); }
.scope-field { min-width: 0; margin: 0; padding: 0; border: 0; grid-column: 1 / -1; }
.scope-field legend { width: 100%; margin: 0 0 9px; padding: 0; color: #3d4d62; font-size: 12px; font-weight: 650; }
.unit-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check-card { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: center; min-height: 68px; padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: white; cursor: pointer; transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease; }
.check-card:hover { border-color: #b9c3ce; background: var(--surface-raised); transform: translateY(-1px); }
.check-card:has(input:checked) { border-color: #d8bc80; background: #fffdf8; box-shadow: inset 3px 0 var(--gold); }
.check-card:has(input:focus-visible) { outline: 3px solid rgba(201,146,40,.25); outline-offset: 2px; }
.check-card > span { min-width: 0; }
.check-card input[type="checkbox"] { appearance: none; width: 20px; height: 20px; min-height: 20px; margin: 0; padding: 0; display: grid; place-content: center; border: 1.5px solid #aeb9c6; border-radius: 5px; background: white; cursor: pointer; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.check-card input[type="checkbox"]::before { content: ""; width: 5px; height: 9px; margin-top: -2px; border-right: 2px solid white; border-bottom: 2px solid white; transform: rotate(45deg) scale(0); transition: transform .12s ease; }
.check-card input[type="checkbox"]:checked { border-color: var(--gold); background: var(--gold); box-shadow: 0 0 0 3px rgba(173,121,25,.1); }
.check-card input[type="checkbox"]:checked::before { transform: rotate(45deg) scale(1); }
.check-card input[type="checkbox"]:focus-visible { outline: 0; }
.check-card strong { overflow: hidden; display: block; color: var(--navy); font-size: 12.5px; font-weight: 700; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.check-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 10.5px; font-weight: 450; }
.wizard-footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line-soft); }
.wizard-review-sections { display: grid; gap: 18px; }
.summary-box { padding: 19px; border-left: 3px solid var(--gold); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: #fcf8ef; }
.summary-box dl { display: grid; grid-template-columns: 170px 1fr; gap: 9px 14px; margin: 0; font-size: 12px; }
.summary-box dt { color: var(--slate); }
.summary-box dd { margin: 0; color: var(--navy); font-weight: 600; }

/* Report */
.client-report-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; }
.report-top { margin: -34px calc(clamp(26px, 3.8vw, 64px) * -1) 0; padding: 30px clamp(26px, 3.8vw, 64px) 22px; color: white; background: var(--navy); }
.report-breadcrumbs { display: flex; gap: 8px; margin-bottom: 15px; color: #a6b3c2; font-size: 11px; }
.report-breadcrumbs a:hover { color: white; }
.report-top-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: flex-start; gap: 25px; }
.report-title-block { min-width: 0; }
.report-top h1 { width: 100%; max-width: none; overflow: hidden; margin: 5px 0 8px; font-family: var(--font-display); font-size: clamp(24px, 2.05vw, 35px); font-weight: 650; line-height: 1.12; letter-spacing: -.035em; text-overflow: ellipsis; white-space: nowrap; }
.report-top-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: #bdc7d2; font-size: 11px; }
.report-top-main > .page-actions { flex-wrap: nowrap; }
.report-top .page-actions .button { border-color: rgba(255,255,255,.22); color: white; background: rgba(255,255,255,.06); }
.report-top .page-actions .button.primary { border-color: var(--gold); background: var(--gold); }
.report-tabs { display: flex; overflow-x: auto; margin: 0 calc(clamp(26px, 3.8vw, 64px) * -1) 24px; padding: 0 clamp(26px, 3.8vw, 64px); border-bottom: 1px solid var(--line); background: white; scrollbar-width: none; }
.report-tabs button { min-height: 52px; padding: 0 16px; border: 0; border-bottom: 2px solid transparent; color: var(--slate); background: transparent; cursor: pointer; font-size: 12px; font-weight: 650; white-space: nowrap; }
.report-tabs button:hover { color: var(--navy); }
.report-tabs button.active { border-color: var(--gold); color: var(--navy); }
.report-tabs mark { min-width: 18px; min-height: 18px; display: inline-grid; place-items: center; margin-left: 5px; padding: 1px 5px; border-radius: 999px; color: var(--red); background: var(--red-pale); font-size: 10px; font-variant-numeric: tabular-nums; }
.report-tabs mark.alert { color: white; background: var(--red); box-shadow: 0 0 0 2px #fff, 0 0 0 3px #e9bbb7; }
.report-tabs mark.changed { color: #845b0c; background: var(--amber-pale); }
.report-tabs mark.default { color: #2e628e; background: var(--blue-pale); }
.report-tabs mark.optional { color: #845b0c; background: var(--amber-pale); }
.tab-attention { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 17px; padding: 14px 16px; border: 1px solid #edcfcc; border-radius: var(--radius-sm); background: #fffafa; box-shadow: var(--shadow-sm); }
.tab-attention.optional { border-color: #eadfbe; background: #fffdf8; }
.tab-attention strong { display: block; color: var(--navy); font-size: 12px; }
.tab-attention p { max-width: 780px; margin: 3px 0 0; color: var(--slate); font-size: 11.5px; line-height: 1.5; }
.tab-attention .page-actions { flex: 0 0 auto; }
.report-section { animation: enter .2s ease; }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } }
.scope-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 20px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: white; }
.scope-strip div { padding: 14px 16px; border-right: 1px solid var(--line-soft); }
.scope-strip div:last-child { border-right: 0; }
.scope-strip span { display: block; color: var(--muted); font-size: 9.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.scope-strip strong { display: block; margin-top: 5px; color: var(--navy); font-size: 12px; }
.quality-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.quality-item { min-width: 0; padding: 13px; border-radius: 8px; background: var(--surface); }
.quality-item span { display: block; overflow: hidden; color: var(--muted); font-size: 9.5px; font-weight: 700; letter-spacing: .035em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.quality-item .status { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.quality-item strong { display: block; margin-top: 6px; font-size: 12px; }
.quality-guide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: hidden; border: 1px solid #d9e3ed; border-radius: var(--radius); background: white; box-shadow: var(--shadow-sm); }
.quality-guide-item { min-width: 0; padding: 18px 20px; }
.quality-guide-item + .quality-guide-item { border-left: 1px solid #d9e3ed; }
.quality-guide-item.action { background: #fffaf0; }
.quality-guide-item.system { background: #f7fbff; }
.quality-guide-item > span, .alert-context > span, .alert-next-step > span { display: block; color: var(--muted); font-size: 9.5px; font-weight: 750; letter-spacing: .07em; line-height: 1.35; text-transform: uppercase; }
.quality-guide-item.action > span { color: #875d10; }
.quality-guide-item.system > span { color: #3d6e99; }
.quality-guide-item strong { display: block; margin-top: 5px; color: var(--navy); font-size: 13px; line-height: 1.35; }
.quality-guide-item p { max-width: 58ch; margin: 5px 0 0; color: var(--slate); font-size: 11.5px; line-height: 1.55; }
.alert-list { display: grid; gap: 16px; }
.alert-group { display: grid; gap: 10px; }
.alert-group[hidden] { display: none; }
.alert-group-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 2px 2px 0; }
.alert-group-header h3 { margin: 0; color: var(--navy); font-size: 12px; font-weight: 750; line-height: 1.35; }
.alert-group-header p { margin: 3px 0 0; color: var(--slate); font-size: 10.5px; line-height: 1.45; }
.alert-group-header > span { min-width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: #526176; background: var(--surface); font-size: 10px; font-weight: 750; }
.alert-card { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 13px; padding: 16px; border: 1px solid var(--line-soft); border-radius: 10px; background: white; }
.alert-card > i { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--amber); }
.alert-card.critical > i { background: var(--red); }
.alert-card.info > i { background: var(--blue); }
.alert-card.resolved { opacity: .62; }
.alert-card.decision-default { background: #fafdff; }
.alert-card.decision-human { background: #fffefb; }
.alert-card.decision-open { border-color: #ead8b2; box-shadow: inset 3px 0 var(--amber); }
.alert-card[hidden] { display: none; }
.alert-card-main { min-width: 0; }
.alert-card h4 { margin: 0; color: var(--navy); font-size: 13px; line-height: 1.35; }
.alert-card p { margin: 0; color: var(--slate); font-size: 11.5px; line-height: 1.55; }
.alert-description { margin-top: 4px !important; }
.alert-context-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 13px 0; }
.alert-context { min-width: 0; padding: 11px 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--surface-raised); }
.alert-context > span { font-size: 8.5px; }
.alert-context > strong { display: block; margin-top: 5px; color: var(--navy); font-size: 11.5px; line-height: 1.35; }
.alert-context > p { margin-top: 4px; color: var(--slate); font-size: 10.5px; line-height: 1.45; }
.alert-context.decision.system { border-color: #d8e4f0; background: #f5faff; }
.alert-context.decision.system > span { color: #3f719d; }
.alert-context.decision.action-required { border-color: #eac7c4; background: #fff7f6; }
.alert-context.decision.action-required > span, .alert-context.decision.action-required > strong { color: #963e38; }
.alert-context.decision.human { border-color: #e9dfc9; background: #fffdf7; }
.alert-context.decision.human > span { color: #805c18; }
.alert-context.impact.blocking { border-color: #eac7c4; background: var(--red-pale); }
.alert-context.impact.blocking > span, .alert-context.impact.blocking > strong { color: #963e38; }
.alert-context.impact.limitation { border-color: #eedbb4; background: var(--amber-pale); }
.alert-context.impact.limitation > span, .alert-context.impact.limitation > strong { color: #805b16; }
.alert-context.impact.clear { border-color: #cce7da; background: #f4fbf7; }
.alert-context.impact.clear > span, .alert-context.impact.clear > strong { color: #277452; }
.alert-context.priority { background: #fafbfc; }
.alert-context.priority.critical { border-color: #f0d0cd; }
.alert-context.priority.critical > span, .alert-context.priority.critical > strong { color: #963e38; }
.alert-context.priority.warning { border-color: #eadfca; }
.alert-context.priority.warning > span, .alert-context.priority.warning > strong { color: #805b16; }
.alert-context.priority.info { border-color: #d8e4f0; }
.alert-context.priority.info > span, .alert-context.priority.info > strong { color: #3f719d; }
.alert-next-step { padding: 10px 12px; border-radius: 8px; background: #f6f8fa; }
.alert-next-step > span { color: #59697c; font-size: 8.5px; }
.alert-next-step p { margin-top: 4px; color: #405167; }
.alert-resolution { margin-top: 10px !important; }
.alert-resolution strong { color: var(--navy); }
.alert-card .alert-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-width: 142px; }
.alert-card .alert-actions .button { min-height: 38px; }
.alert-evidence-button { color: #4f6175; }
.alert-decision-button { border-color: #caa25f; color: #725019; background: #fffaf0; }
.alert-decision-button:hover { border-color: var(--gold); background: #fff7e7; }
.quality-toolbar { justify-content: space-between; }
.source-ref { display: inline-block; margin: 6px 5px 0 0; padding: 2px 6px; border-radius: 4px; color: #5d6877; background: #f0f2f4; font: 10px ui-monospace, monospace; }
.alert-evidence { display: grid; gap: 13px; margin-top: 14px; padding: 14px; border: 1px solid #d9e2ec; border-radius: 8px; background: #fff; }
.alert-evidence[hidden] { display: none; }
.alert-evidence section { display: grid; gap: 6px; }
.alert-evidence h4 { margin: 0; color: var(--navy); font-size: 11px; font-weight: 750; letter-spacing: .02em; }
.alert-evidence-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 0; }
.alert-evidence-facts > div { min-width: 0; padding: 9px 10px; border-radius: 6px; background: var(--surface); }
.alert-evidence-facts dt { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
.alert-evidence-facts dd { margin: 4px 0 0; color: var(--navy); font-size: 11.5px; font-weight: 650; overflow-wrap: anywhere; }
.alert-evidence-facts dd small { display: block; margin-top: 2px; color: var(--muted); font-size: 9.5px; font-weight: 500; }
.alert-evidence-records { display: grid; gap: 7px; }
.alert-evidence-records > article { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line-soft); border-radius: 7px; }
.alert-evidence-records > article > div:first-child { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; }
.alert-evidence-records code { color: var(--muted); font-size: 9.5px; }
.alert-evidence-rule { padding-top: 11px; border-top: 1px solid var(--line-soft); }
.evidence-missing { color: var(--red); font-weight: 750; }
.definition-note { padding: 13px 15px; border-left: 3px solid var(--blue); color: #486177; background: var(--blue-pale); font-size: 11.5px; line-height: 1.55; }
.chart-list { display: grid; gap: 11px; }
.bar-row { display: grid; grid-template-columns: minmax(100px, 1fr) 3fr 52px; gap: 10px; align-items: center; font-size: 11.5px; }
.bar-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 7px; overflow: hidden; border-radius: 4px; background: #edf0f3; }
.bar-progress { display: block; width: 100%; height: 100%; margin: 0; overflow: hidden; border: 0; border-radius: inherit; appearance: none; -webkit-appearance: none; background: transparent; color: var(--gold); }
.bar-progress::-webkit-progress-bar { background: #edf0f3; border-radius: inherit; }
.bar-progress::-webkit-progress-value { background: var(--gold); border-radius: inherit; }
.bar-progress::-moz-progress-bar { background: var(--gold); border-radius: inherit; }
.bar-row b { display: grid; gap: 1px; color: var(--slate); font-size: 11px; line-height: 1.1; text-align: right; }
.bar-row b small { color: #6d7b8d; font-size: 9px; font-weight: 500; }
.client-preview { min-height: 700px; padding: clamp(28px, 5vw, 68px); border: 1px solid var(--line); background: white; box-shadow: var(--shadow); }
.preview-kicker { margin: 0 0 12px; color: var(--gold); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.client-preview h2 { max-width: 700px; margin: 0; color: var(--navy); font-family: var(--font-display); font-size: 35px; font-weight: 650; line-height: 1.14; letter-spacing: -.035em; }
.client-preview h3 { margin: 32px 0 10px; color: var(--navy); font-family: var(--font-display); font-size: 18px; font-weight: 650; line-height: 1.3; }
.client-preview p, .client-preview li { color: #465469; font-size: 13px; line-height: 1.7; }
.executive-summary { display: grid; gap: 14px; margin: 13px 0 31px; padding: 22px 25px 23px; border: 1px solid #e8dcc5; border-left: 4px solid var(--gold); border-radius: 0 12px 12px 0; background: linear-gradient(135deg, #fffdf8 0%, #fbf8f1 100%); box-shadow: 0 10px 24px rgba(18,36,60,.055); }
.executive-summary h4 { display: flex; align-items: center; gap: 8px; margin: 2px 0 -1px; color: #725018; font-size: 10px; font-weight: 800; line-height: 1.35; letter-spacing: .1em; text-transform: uppercase; }
.executive-summary h4::before { content: ""; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--gold-bright); box-shadow: 0 0 0 4px rgba(201,146,40,.11); }
.executive-summary h4:not(:first-child) { margin-top: 6px; padding-top: 17px; border-top: 1px solid #eadfcb; }
.executive-summary p { max-width: 82ch; margin: 0; color: #3c4b5f; font-size: 13px; line-height: 1.7; }
.executive-summary strong { color: var(--navy); font-weight: 750; }
.executive-summary ul, .executive-summary ol { max-width: 84ch; margin: 0; padding-left: 1.35rem; }
.executive-summary li { padding-left: 4px; color: #3c4b5f; font-size: 13px; line-height: 1.62; }
.executive-summary li + li { margin-top: 9px; }
.executive-summary li::marker { color: var(--gold); font-weight: 800; }
.summary-editor-card .card-body { display: grid; gap: 13px; }
.summary-ai-intro { margin: 0; color: var(--slate); font-size: 11.5px; line-height: 1.6; }
.summary-generation-actions { margin: 0; }
.manual-summary-editor { border-top: 1px solid var(--line-soft); }
.manual-summary-editor summary { padding-top: 13px; color: var(--navy); cursor: pointer; font-size: 11.5px; font-weight: 700; }
.manual-summary-editor summary::marker { color: var(--gold); }
.manual-summary-editor-content { display: grid; gap: 10px; padding-top: 13px; }
.summary-editor-card .editor-area { min-height: 180px; }
.source-draft-summary-note .editor-area { min-height: 180px; }
.source-draft-summary-note .card-body { color: var(--slate); font-size: 11.5px; line-height: 1.6; }
.source-draft-summary-note .card-body p { margin: 0; }
.summary-format-help { margin: 10px 0 0; color: var(--slate); font-size: 10.5px; line-height: 1.55; }
.summary-format-help strong { color: var(--navy); }
.summary-format-help code { padding: 1px 4px; border-radius: 4px; color: #71521d; background: var(--gold-pale); font: 10px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.summary-ai-gate-help { margin: 10px 0 0; padding: 9px 10px; border-left: 3px solid var(--gold); color: #725018; background: var(--gold-pale); font-size: 10.5px; line-height: 1.5; }
.quality-focus-note { color: #76591e; font-size: 10.5px; font-weight: 650; }
.preview-meta { display: flex; flex-wrap: wrap; gap: 16px; margin: 20px 0 32px; padding: 13px 0; border-block: 1px solid var(--line); color: var(--slate); font-size: 11px; }
.draft-ribbon { margin: -25px -25px 25px; padding: 7px; color: #8f6110; background: var(--amber-pale); font-size: 10px; font-weight: 700; text-align: center; letter-spacing: .08em; }
.editor-area { width: 100%; min-height: 260px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: #344256; background: var(--surface-raised); font-size: 13px; line-height: 1.7; resize: vertical; }
.ai-report-view { width: 100%; max-width: 1440px; margin-inline: auto; }
.ai-report-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(135deg, #fffdf8 0%, #f7fafc 100%); }
.ai-report-toolbar h2, .ai-report-empty h2 { margin: 0; color: var(--navy); font-family: var(--font-display); font-size: 25px; font-weight: 650; }
.ai-report-toolbar p:not(.preview-kicker), .ai-report-empty p:not(.preview-kicker) { max-width: 720px; margin: 7px 0 0; color: var(--slate); font-size: 12.5px; line-height: 1.6; }
.ai-report-actions { justify-items: end; min-width: max-content; }
.ai-report-actions small { color: var(--muted); font-size: 10px; }
.ai-report-content { display: grid; gap: 18px; }
.ai-editorial-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(330px, .85fr); gap: clamp(24px, 4vw, 54px); padding: clamp(26px, 4vw, 42px); border-color: #dce4eb; background: linear-gradient(125deg, #fffdf8 0%, #f8fbfc 59%, #eef5f8 100%); box-shadow: 0 13px 30px rgba(18,36,60,.07); }
.ai-editorial-hero::after { content: ""; position: absolute; width: 310px; height: 310px; right: -158px; top: -180px; border: 1px solid rgba(169,117,18,.16); border-radius: 50%; box-shadow: 0 0 0 38px rgba(169,117,18,.035), 0 0 0 76px rgba(38,109,151,.025); pointer-events: none; }
.ai-editorial-copy, .ai-rating-grid { position: relative; z-index: 1; }
.ai-editorial-copy { align-self: center; }
.ai-editorial-copy .preview-kicker { margin-bottom: 13px; }
.ai-editorial-copy h2 { max-width: 770px; margin: 0; color: var(--navy); font-family: var(--font-display); font-size: clamp(28px, 3vw, 39px); font-weight: 650; line-height: 1.1; letter-spacing: -.04em; }
.ai-editorial-copy > p:not(.preview-kicker) { max-width: 760px; margin: 14px 0 0; color: #43546a; font-size: 14px; line-height: 1.7; }
.ai-report-context { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 22px; padding-top: 16px; border-top: 1px solid rgba(84,108,132,.18); color: #647489; font-size: 10.5px; line-height: 1.45; }
.ai-report-context span + span::before { content: "·"; margin-right: 16px; color: var(--gold); font-weight: 800; }
.ai-rating-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; align-self: center; }
.ai-rating-card { min-width: 0; min-height: 151px; display: grid; align-content: start; gap: 5px; padding: 15px 13px; border: 1px solid #dce4eb; border-radius: 12px; background: rgba(255,255,255,.84); box-shadow: 0 8px 18px rgba(18,36,60,.045); }
.ai-rating-mark { width: 24px; height: 24px; display: grid; place-items: center; margin-bottom: 3px; border-radius: 50%; font-size: 12px; font-weight: 850; }
.ai-rating-title { min-height: 22px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .045em; line-height: 1.22; text-transform: uppercase; }
.ai-rating-card strong { color: var(--navy); font-size: 12px; line-height: 1.3; }
.ai-rating-card small { color: var(--muted); font-size: 9.5px; }
.ai-rating-card.success { border-color: #c9e4d7; background: #f7fcf9; }
.ai-rating-card.success .ai-rating-mark { color: var(--green); background: var(--green-pale); }
.ai-rating-card.watch { border-color: #ecd8ac; background: #fffdf7; }
.ai-rating-card.watch .ai-rating-mark { color: #9b7019; background: var(--amber-pale); }
.ai-rating-card.attention { border-color: #edcfcc; background: #fffafa; }
.ai-rating-card.attention .ai-rating-mark { color: var(--red); background: var(--red-pale); }
.ai-rating-card.unknown { border-color: #dce3ea; background: #fafbfd; }
.ai-rating-card.unknown .ai-rating-mark { color: #78889a; background: #edf1f4; }
.ai-report-metrics { margin-bottom: 0; }
.ai-report-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.ai-report-charts .card-header { min-height: 82px; padding: 18px 19px; }
.ai-report-charts .card-header h2 { font-size: 15px; }
.ai-report-charts .card-header p { max-width: 260px; line-height: 1.45; }
.ai-report-charts .card-body { min-height: 148px; padding: 18px 19px; }
.ai-insights-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.ai-insights-grid .card-header { padding: 19px 20px; }
.ai-observation-list { display: grid; gap: 13px; margin: 0; padding: 0; list-style: none; }
.ai-observation { display: grid; grid-template-columns: 9px minmax(0, 1fr); gap: 12px; align-items: start; }
.ai-observation > i { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--blue); }
.ai-observation.success > i { background: var(--green); }
.ai-observation.attention > i { background: var(--red); }
.ai-observation strong { display: block; color: var(--navy); font-size: 12px; line-height: 1.4; }
.ai-observation p { margin: 4px 0 0; color: var(--slate); font-size: 11px; line-height: 1.55; }
.ai-insights-grid .action-row { grid-template-columns: 9px minmax(0, 1fr); padding-block: 13px; }
.ai-insights-grid .action-row small { max-width: 63ch; font-size: 10.5px; line-height: 1.5; }
.ai-report-empty { width: 100%; max-width: 830px; margin: 45px auto; }
.ai-report-empty-body { display: grid; grid-template-columns: 72px 1fr; gap: 24px; align-items: start; padding: 38px; }
.ai-report-icon { display: grid; width: 64px; height: 64px; place-items: center; border-radius: 18px; color: #846019; background: linear-gradient(135deg, #fff3d9, #f8ddb0); font-size: 29px; box-shadow: inset 0 0 0 1px #efd0a0; }
.section-controls { display: grid; gap: 7px; }
.section-control { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 11.5px; }
.section-control:last-child { border-bottom: 0; }
.section-control label { display: flex; align-items: center; gap: 7px; }
.section-control input { accent-color: var(--gold); }
.section-control span { display: flex; gap: 3px; }
.button.icon-button { min-width: 27px; height: 27px; padding: 0; }
.timeline { position: relative; display: grid; gap: 0; padding-left: 21px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 10px; width: 1px; background: var(--line); }
.timeline-item { position: relative; padding: 0 0 18px 6px; }
.timeline-item::before { content: ""; position: absolute; left: -20px; top: 4px; width: 9px; height: 9px; border: 2px solid white; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.timeline-item strong { display: block; color: var(--navy); font-size: 12px; }
.timeline-item small { display: block; margin-top: 3px; color: var(--muted); font-size: 10.5px; }

/* Report history */
.history-view { width: 100%; max-width: 1580px; display: grid; gap: 20px; margin-inline: auto; }
.history-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(340px, .75fr); gap: 20px; align-items: start; }
.history-card { overflow: hidden; }
.history-card .card-header, .history-comments .card-header { align-items: center; padding: 19px 21px; }
.history-count { min-width: 32px; min-height: 28px; display: inline-flex; align-items: center; justify-content: center; padding: 4px 9px; border: 1px solid var(--line); border-radius: 16px; color: var(--slate); background: var(--surface-raised); font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.history-timeline { padding: 22px 23px 20px 35px; }
.history-timeline::before { left: 21px; top: 27px; bottom: 25px; background: #d9dfe6; }
.history-timeline .timeline-item { min-height: 46px; padding: 0 0 20px 11px; }
.history-timeline .timeline-item:last-child { min-height: 26px; padding-bottom: 0; }
.history-timeline .timeline-item::before { left: -18px; top: 3px; width: 9px; height: 9px; border-width: 3px; box-shadow: 0 0 0 1px #c49432; }
.history-event strong { font-size: 12.5px; line-height: 1.35; }
.history-event small { display: inline-block; margin-top: 5px; }
.history-event small + small::before { content: "·"; margin: 0 6px; color: #a0a9b5; }
.history-version strong { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-version strong > span { display: inline-flex; align-items: center; gap: 7px; }
.history-version a { color: var(--navy); font-size: 13px; font-weight: 700; }
.history-version a:hover { color: var(--gold); }
.history-version em { padding: 2px 6px; border-radius: 9px; color: #6e571d; background: var(--gold-pale); font-size: 8.5px; font-style: normal; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.history-version.current-version::before { background: var(--green); box-shadow: 0 0 0 1px var(--green); }
.history-version small { line-height: 1.4; }
.history-comments { overflow: hidden; }
.history-comments .card-body { padding: 0; }
.history-empty { min-height: 92px; display: flex; align-items: center; gap: 14px; padding: 20px 22px; color: var(--slate); background: linear-gradient(90deg, #fbfcfd, #fff); }
.history-empty > span { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; color: #748093; background: white; font-size: 16px; font-weight: 750; letter-spacing: 1px; }
.history-empty strong, .history-empty small { display: block; }
.history-empty strong { color: var(--navy); font-size: 12.5px; }
.history-empty small { margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.history-empty.compact { min-height: 70px; padding: 6px 0; background: transparent; }
.history-comment-list { display: grid; }
.history-comment { display: grid; justify-items: start; gap: 11px; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); }
.history-comment:last-child { border-bottom: 0; }
.history-comment-head { width: 100%; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.history-comment-head strong, .history-comment-head small { display: block; }
.history-comment-head strong { color: var(--navy); font-size: 12.5px; }
.history-comment-head small { margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.history-comment p { max-width: 980px; margin: 0; color: #465469; font-size: 12px; line-height: 1.65; }

/* Settings */
.settings-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 24px; }
.settings-nav { display: grid; align-content: start; gap: 4px; }
.settings-nav button { min-height: 41px; padding: 0 11px; border: 0; border-radius: var(--radius-sm); color: var(--slate); background: transparent; cursor: pointer; font-size: 12px; font-weight: 650; text-align: left; }
.settings-nav button.active { color: var(--navy); background: white; box-shadow: inset 3px 0 var(--gold); }
.secret-status { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 13px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--surface); }
.secret-status i { width: 9px; height: 9px; border-radius: 50%; background: var(--red); }
.secret-status.configured i { background: var(--green); }
.secret-status strong { display: block; font-size: 12px; }
.secret-status small { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.callout { padding: 15px; border: 1px solid #e5d5b2; border-radius: var(--radius-sm); color: #76591e; background: #fffaf0; font-size: 11.5px; line-height: 1.55; }
.ai-generation-error { margin-bottom: 12px; border-color: #e5b8b5; color: #843b36; background: var(--red-pale); }
.ai-generation-error strong { display: block; color: #7c302d; }
.ai-generation-error p { margin: 6px 0 0; }
.ai-generation-error small { display: block; margin-top: 8px; color: #775451; }
.ai-generation-error code { padding: 1px 4px; border-radius: 4px; color: inherit; background: rgba(132, 59, 54, .08); font: 10px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.danger-zone { border-color: #ead0ce; box-shadow: none; }
.danger-zone .card-header { align-items: center; border-bottom-color: #f2dfdd; }
.danger-zone .card-header h2 { color: var(--red); }
.danger-callout { border-color: #e5b8b5; color: #843b36; background: var(--red-pale); }
.deleted-version { opacity: .72; }

/* Dialog, toast, loader */
dialog { width: min(620px, calc(100% - 32px)); max-height: calc(100vh - 40px); overflow: auto; padding: 0; border: 0; border-radius: 13px; box-shadow: 0 25px 80px rgba(13,26,43,.3); }
dialog::backdrop { background: rgba(10,22,38,.55); backdrop-filter: blur(2px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line-soft); }
.dialog-head h2 { margin: 0; color: var(--navy); font-family: var(--font-display); font-size: 18px; font-weight: 650; line-height: 1.3; }
.dialog-head p { margin: 5px 0 0; color: var(--slate); font-size: 11.5px; }
.dialog-close { width: 30px; height: 30px; border: 0; border-radius: 50%; color: var(--slate); background: var(--surface); cursor: pointer; }
.dialog-body { padding: 22px; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 22px; border-top: 1px solid var(--line-soft); background: #fafbfc; }
.toast-region { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 8px; width: min(360px, calc(100vw - 40px)); }
.toast { padding: 13px 15px; border-left: 3px solid var(--green); border-radius: var(--radius-sm); color: white; background: var(--navy); box-shadow: var(--shadow); font-size: 12px; animation: toast-in .2s ease; }
.toast.error { border-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } }
.loading { min-height: 60vh; display: grid; place-items: center; color: var(--slate); }
.spinner { width: 30px; height: 30px; border: 3px solid #e5e8ec; border-top-color: var(--gold); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1180px) {
  .metric-grid, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-report-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-report-charts > :last-child { grid-column: 1 / -1; }
  .scope-strip { grid-template-columns: repeat(3, 1fr); }
  .scope-strip div:nth-child(3) { border-right: 0; }
  .scope-strip div:nth-child(n+4) { border-top: 1px solid var(--line-soft); }
  .quality-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1400px) {
  .report-top-main { grid-template-columns: minmax(0, 1fr); }
  .report-top-main > .page-actions { justify-content: flex-start; margin-top: 10px; }
}

@media (max-width: 920px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; }
  .mobile-logo { display: block; margin-bottom: 50px; color: var(--gold); font-family: var(--font-display); }
  .mobile-logo .brand-word { color: var(--navy); }
  .sidebar { transform: translateX(-100%); transition: .25s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 20px 0 60px rgba(0,0,0,.18); }
  .mobile-header { position: sticky; top: 0; z-index: 40; height: 57px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; color: white; background: var(--navy); }
  .mobile-app-logo { color: #d5a343; font-family: var(--font-display); font-size: 18px; font-weight: 650; line-height: 1; }
  .mobile-app-logo span { color: white; }
  .mobile-header button { border: 0; color: white; background: transparent; font-size: 20px; }
  #app-view { margin-left: 0; padding: 25px 20px 60px; }
  .report-top { margin-top: -25px; }
  .split, .settings-layout, .client-report-layout, .history-grid { grid-template-columns: 1fr; }
  .ai-report-toolbar { align-items: flex-start; flex-direction: column; }
  .ai-report-actions { justify-items: start; }
  .ai-editorial-hero { grid-template-columns: 1fr; }
  .ai-rating-grid { max-width: 620px; }
  .settings-nav { grid-template-columns: repeat(3, 1fr); }
  .settings-nav button { text-align: center; }
  .readiness-header { align-items: flex-start; }
  .readiness-summary { align-items: flex-end; flex-direction: column-reverse; }
  .readiness-count { min-width: 0; padding: 0; border-right: 0; }
  .alert-context-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .login-panel { padding: 26px; }
  .page-header, .report-top-main { display: grid; }
  .page-actions { justify-content: flex-start; }
  .metric-grid, .grid-2, .grid-3, .grid-4, .form-grid, .client-choice-grid, .unit-list, .ai-report-charts, .ai-insights-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 112px; }
  .scope-strip { grid-template-columns: 1fr 1fr; }
  .scope-strip div, .scope-strip div:nth-child(3) { border-right: 1px solid var(--line-soft); border-top: 1px solid var(--line-soft); }
  .scope-strip div:nth-child(odd) { border-left: 0; }
  .scope-strip div:nth-child(-n+2) { border-top: 0; }
  .quality-bar { grid-template-columns: 1fr 1fr; }
  .quality-guide, .alert-context-grid { grid-template-columns: 1fr; }
  .quality-guide-item + .quality-guide-item { border-top: 1px solid #d9e3ed; border-left: 0; }
  .wizard-card { padding: 22px; }
  .step { gap: 7px; }
  .step span { display: none; }
  .step.active span { display: block; padding-right: 8px; font-size: 11px; }
  .summary-box dl { grid-template-columns: 1fr; }
  .summary-box dd { margin-bottom: 7px; }
  .alert-card { grid-template-columns: 8px 1fr; }
  .alert-card .alert-actions { grid-column: 2; display: grid; grid-template-columns: 1fr; min-width: 0; }
  .alert-evidence-facts { grid-template-columns: 1fr; }
  .report-top .page-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .report-top .page-actions .button { width: 100%; }
  .client-preview { padding: 28px 20px; }
  .client-preview h2 { font-size: 26px; }
  .ai-report-toolbar { margin-inline: -2px; padding: 20px; }
  .ai-report-toolbar h2, .ai-report-empty h2 { font-size: 22px; }
  .ai-editorial-hero { gap: 24px; padding: 25px 21px; }
  .ai-editorial-copy h2 { font-size: 27px; }
  .ai-editorial-copy > p:not(.preview-kicker) { font-size: 13px; }
  .ai-rating-grid { grid-template-columns: 1fr; max-width: none; }
  .ai-rating-card { min-height: 0; grid-template-columns: 24px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; padding: 13px; }
  .ai-rating-mark { grid-row: 1 / span 2; margin: 0; }
  .ai-rating-title, .ai-rating-card strong, .ai-rating-card small { grid-column: 2; }
  .ai-rating-card small { display: none; }
  .ai-report-charts > :last-child { grid-column: auto; }
  .ai-report-empty { margin: 20px auto; }
  .ai-report-empty-body { grid-template-columns: 1fr; padding: 27px 22px; }
  .executive-summary { margin-bottom: 25px; padding: 19px 18px 20px; }
  .executive-summary p, .executive-summary li { font-size: 12.5px; }
  .settings-nav { grid-template-columns: 1fr; }
  .report-top { margin-inline: -20px; padding-inline: 20px; }
  .report-tabs { margin-inline: -20px; padding-inline: 20px; }
  .tab-attention { align-items: flex-start; flex-direction: column; }
  .tab-attention .page-actions { width: 100%; }
  .readiness-header { display: grid; gap: 14px; padding: 19px; }
  .readiness-summary { flex-direction: row; align-items: center; justify-content: flex-start; }
  .readiness-count { min-width: 84px; padding-right: 12px; border-right: 1px solid var(--line-soft); text-align: left; }
  .readiness-body { padding: 15px; }
  .readiness-steps { grid-template-columns: 1fr; }
  .readiness-step-copy strong, .readiness-step-copy small { white-space: normal; }
  .readiness-next { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  .sidebar, .mobile-header, .report-top, .report-tabs, .page-actions, .button { display: none !important; }
  #app-view { margin: 0; padding: 0; }
  .client-preview { border: 0; box-shadow: none; }
}
