:root {
    --ink: #17233c;
    --muted: #6b7589;
    --line: #e5e9f0;
    --surface: #ffffff;
    --canvas: #f4f6f9;
    --navy: #101b33;
    --navy-soft: #182641;
    --accent: #6b5cff;
    --accent-soft: #eeecff;
    --teal: #20b89a;
    --amber: #f4a340;
    --red: #df5b68;
    --shadow: 0 16px 40px rgba(26, 39, 66, .07);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 1.75rem; letter-spacing: -.035em; }
h2 { margin-bottom: .5rem; font-size: 1.25rem; letter-spacing: -.025em; }
h3 { margin-bottom: .4rem; }
p { line-height: 1.6; }

.eyebrow { margin: 0 0 .45rem; color: #8b94a5; font-size: .68rem; font-weight: 800; letter-spacing: .14em; }
.eyebrow.accent { color: var(--accent); }
.muted { color: var(--muted); }
.brand-mark { display: grid; width: 58px; height: 58px; place-items: center; border-radius: 17px; background: linear-gradient(145deg, #7669ff, #4f42dd); box-shadow: 0 12px 30px #0a0d1b55; color: white; font-weight: 850; letter-spacing: -.05em; }
.brand-mark.small { width: 39px; height: 39px; border-radius: 11px; box-shadow: none; font-size: .8rem; }

.login-body { background: var(--navy); }
.login-layout { display: grid; min-height: 100vh; grid-template-columns: minmax(360px, 1.05fr) minmax(440px, .95fr); }
.login-brand { display: flex; flex-direction: column; justify-content: center; padding: 9vw; background: radial-gradient(circle at 15% 20%, #29395d 0, transparent 40%), var(--navy); color: white; }
.login-brand .eyebrow { margin-top: 2.6rem; color: #aab5ce; }
.login-brand h1 { max-width: 690px; margin: .7rem 0 1.4rem; font-size: clamp(2.4rem, 4vw, 4.6rem); line-height: 1.04; }
.brand-copy { max-width: 630px; color: #b8c3d8; font-size: 1.06rem; }
.trust-line { display: flex; align-items: center; gap: .7rem; margin-top: 2.5rem; color: #d9e0ee; font-size: .85rem; font-weight: 650; }
.trust-line span { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 5px #20b89a22; }
.login-panel { display: grid; place-items: center; padding: 5vw; background: #f7f8fb; }
.login-card { display: flex; width: min(430px, 100%); flex-direction: column; gap: 1.15rem; padding: 2.7rem; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: var(--shadow); }
.login-card h2 { margin: 0; font-size: 2rem; }
label { display: flex; flex-direction: column; gap: .45rem; color: #3f4a60; font-size: .78rem; font-weight: 750; }
input, textarea, select { width: 100%; border: 1px solid #dce1e9; border-radius: 10px; outline: none; background: #fff; color: var(--ink); padding: .78rem .9rem; transition: border .15s, box-shadow .15s; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #6b5cff18; }
textarea { resize: vertical; }
.form-error { min-height: 1.2rem; margin: 0; color: #c74251; font-size: .78rem; }

.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 10px; padding: .65rem 1rem; font-weight: 750; transition: transform .15s, background .15s, border .15s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button.primary { background: var(--accent); color: white; box-shadow: 0 8px 20px #6b5cff22; }
.button.primary:hover:not(:disabled) { background: #584bea; }
.button.ghost { border-color: var(--line); background: white; color: var(--ink); }
.button.danger { border-color: #71323b; background: #351f2a; color: #ffdbe0; }
.button.danger:hover:not(:disabled) { background: #492630; }
.button.danger-outline { border-color: #efc9cf; background: #fff; color: #b63d4c; }
.button.danger-outline:hover:not(:disabled) { border-color: #df5b68; background: #fff5f6; }
.button.full { width: 100%; }
.button-group { display: flex; align-items: center; gap: .65rem; }
.small-button { min-height: 35px; padding: .4rem .75rem; font-size: .75rem; }

.app-shell { display: grid; min-height: 100vh; grid-template-columns: 250px 1fr; }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; padding: 1.45rem 1rem; background: var(--navy); color: white; }
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 0 .35rem 2rem; }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand strong { font-size: .86rem; }
.sidebar-brand span { margin-top: .13rem; color: #8793ac; font-size: .67rem; }
.sidebar-toggle { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; margin-left: auto; border: 1px solid #ffffff18; border-radius: 8px; background: #ffffff08; color: #aeb8ca; font-size: 1.15rem; line-height: 1; }
.sidebar-toggle:hover { background: #ffffff12; color: #fff; }
.framework-switcher { margin: 0 .35rem 1.35rem; }
.framework-switcher label { color: #8793ac; font-size: .62rem; letter-spacing: .06em; text-transform: uppercase; }
.framework-switcher select { margin-top: .35rem; border-color: #ffffff1a; padding: .62rem .7rem; background: var(--navy-soft); color: white; font-size: .7rem; }
.sidebar nav { display: flex; flex-direction: column; gap: .35rem; }
.nav-item { display: flex; align-items: center; gap: .8rem; border-radius: 9px; padding: .7rem .75rem; color: #aeb8ca; text-decoration: none; font-size: .84rem; font-weight: 650; }
.nav-item:hover { background: #ffffff0a; color: white; }
.nav-item.active { background: var(--navy-soft); color: white; box-shadow: inset 3px 0 var(--accent); }
.nav-icon { display: grid; width: 22px; place-items: center; color: #7c89a4; font-size: 1rem; }
.nav-item.active .nav-icon { color: #8b80ff; }
.sidebar-foot { display: flex; align-items: flex-start; gap: .7rem; margin-top: auto; border-top: 1px solid #ffffff12; padding: 1.2rem .45rem .2rem; }
.sidebar-foot strong, .sidebar-foot span { display: block; }
.sidebar-foot strong { font-size: .7rem; }
.sidebar-foot div span { margin-top: .15rem; color: #748099; font-size: .61rem; }
.status-dot { width: 8px; height: 8px; margin-top: .25rem; border-radius: 50%; background: var(--teal); }

.app-shell.sidebar-collapsed { grid-template-columns: 76px 1fr; }
.sidebar-collapsed .sidebar { padding-right: .65rem; padding-left: .65rem; }
.sidebar-collapsed .sidebar-brand { justify-content: center; gap: .3rem; padding-right: 0; padding-left: 0; }
.sidebar-collapsed .sidebar-brand-copy, .sidebar-collapsed .framework-switcher, .sidebar-collapsed .nav-label, .sidebar-collapsed .sidebar-foot-copy { display: none; }
.sidebar-collapsed .sidebar-toggle { position: absolute; top: 4.2rem; left: 24px; margin: 0; }
.sidebar-collapsed .nav-item { justify-content: center; gap: 0; padding-right: .5rem; padding-left: .5rem; }
.sidebar-collapsed .nav-icon { width: 28px; font-size: 1.05rem; }
.sidebar-collapsed .sidebar-foot { justify-content: center; padding-right: 0; padding-left: 0; }

.workspace { min-width: 0; }
.topbar { display: flex; min-height: 92px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 1.15rem clamp(1.5rem, 3vw, 3.2rem); background: #fff; }
.user-area { display: flex; align-items: center; gap: .65rem; }
.avatar { display: grid; width: 35px; height: 35px; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: .7rem; font-weight: 850; }
.user-copy strong, .user-copy span { display: block; }
.user-copy strong { font-size: .78rem; }
.user-copy span { margin-top: .1rem; color: var(--muted); font-size: .64rem; text-transform: capitalize; }
.content { max-width: 1520px; margin: 0 auto; padding: clamp(1.5rem, 3vw, 3.2rem); }
.loading-state { display: flex; min-height: 40vh; align-items: center; justify-content: center; gap: .75rem; color: var(--muted); }
.spinner { width: 17px; height: 17px; border: 2px solid #dce1e9; border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.panel { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 9px 25px rgba(26,39,66,.035); }
.hero-grid { display: grid; grid-template-columns: 1.45fr .85fr; gap: 1.2rem; }
.readiness-card { display: flex; min-height: 220px; align-items: center; justify-content: space-between; overflow: hidden; border-radius: 17px; padding: 2.1rem; background: linear-gradient(135deg, #17243f, #213353); color: white; box-shadow: var(--shadow); }
.readiness-card p:not(.eyebrow) { max-width: 430px; margin-bottom: 0; color: #aebbd0; font-size: .87rem; }
.readiness-card h2 { font-size: 1.6rem; }
.score-ring { position: relative; width: 145px; height: 145px; flex: 0 0 145px; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring circle { fill: none; stroke-width: 7; }
.ring-bg { stroke: #ffffff16; }
.ring-progress { stroke: #8478ff; stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.score-ring div { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.score-ring strong, .score-ring span { display: block; }
.score-ring strong { font-size: 1.9rem; }
.score-ring span { color: #aebbd0; font-size: .65rem; }
.guide-card { position: relative; display: flex; min-height: 220px; align-items: flex-end; overflow: hidden; border: 1px solid #ddd9ff; border-radius: 17px; padding: 2rem; background: linear-gradient(145deg, #f0eeff, #fff); }
.guide-card::after { position: absolute; width: 210px; height: 210px; right: -85px; top: -90px; border-radius: 50%; background: #6b5cff0c; content: ""; }
.guide-card p:last-child { margin-bottom: 0; color: var(--muted); font-size: .83rem; }
.ai-badge { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border-radius: 11px; background: var(--accent); color: white; font-size: .68rem; font-weight: 900; box-shadow: 0 8px 20px #6b5cff33; }
.guide-card .ai-badge { position: absolute; top: 1.7rem; left: 2rem; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 1.2rem 0; }
.metric { min-height: 126px; border: 1px solid var(--line); border-radius: 14px; padding: 1.25rem; background: white; }
.metric span, .metric small, .metric strong { display: block; }
.metric span { color: var(--muted); font-size: .7rem; font-weight: 750; }
.metric strong { margin: .35rem 0 .2rem; font-size: 2rem; letter-spacing: -.05em; }
.metric small { color: #9aa2b0; font-size: .64rem; }
.metric.warning strong { color: var(--red); }
.two-column { display: grid; grid-template-columns: 1.4fr .8fr; gap: 1.2rem; }
.two-column > .panel { padding: 1.5rem; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem; }
.panel-head h2 { margin-bottom: 0; }

.action-list { display: flex; flex-direction: column; }
.action-row { display: grid; width: 100%; grid-template-columns: 34px 1fr auto; align-items: center; gap: .85rem; border: 0; border-top: 1px solid #edf0f4; padding: 1rem .2rem; background: transparent; color: var(--ink); text-align: left; }
.action-row:first-child { border-top: 0; }
.action-row:hover strong { color: var(--accent); }
.action-row strong, .action-row small { display: block; }
.action-row strong { font-size: .78rem; }
.action-row small { margin-top: .18rem; color: var(--muted); font-size: .66rem; }
.action-number { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: .7rem; font-weight: 850; }
.priority { border-radius: 20px; padding: .28rem .5rem; background: #f0f2f6; color: var(--muted); font-size: .57rem; font-weight: 850; text-transform: uppercase; }
.priority.high { background: #fff0f1; color: #c34652; }
.priority.medium { background: #fff6e7; color: #ac701d; }
.activity-list { margin: 0; padding: 0; list-style: none; }
.activity-list li { display: flex; align-items: flex-start; gap: .7rem; padding: .7rem 0; }
.activity-dot { width: 7px; height: 7px; flex: 0 0 7px; margin-top: .28rem; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px #20b89a13; }
.activity-list strong, .activity-list small { display: block; }
.activity-list strong { font-size: .7rem; font-weight: 700; }
.activity-list small { margin-top: .2rem; color: var(--muted); font-size: .61rem; }
.empty-compact { padding: 1rem 0; color: var(--muted); font-size: .78rem; }

.page-actions, .detail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.page-actions p { margin: 0; color: var(--muted); font-size: .84rem; }
.table-panel { overflow: hidden; }
.table-tools { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 1rem 1.2rem; color: var(--muted); font-size: .72rem; }
.table-tools input { width: min(360px, 60%); padding: .6rem .8rem; }
.risk-tools { gap: 1rem; }
.risk-filter-group { display: flex; min-width: 0; flex: 1; align-items: center; gap: .65rem; }
.risk-filter-group input { width: min(360px, 55%); }
.risk-filter-group select { width: min(230px, 40%); padding: .6rem .8rem; }
.risk-table-head, .risk-row { display: grid; grid-template-columns: 34px minmax(280px, 2fr) 110px 70px 130px 90px; align-items: center; gap: .8rem; }
.risk-table-head { padding: .7rem 1.2rem; background: #fafbfc; color: #8c95a5; font-size: .62rem; font-weight: 800; text-transform: uppercase; }
.risk-row { width: 100%; border: 0; border-top: 1px solid #edf0f4; padding: .9rem 1.2rem; background: white; color: var(--ink); text-align: left; }
.risk-row:hover { background: #fafaff; }
.risk-title strong, .risk-title small { display: block; }
.risk-title strong { overflow: hidden; font-size: .77rem; text-overflow: ellipsis; white-space: nowrap; }
.risk-title small { margin-top: .22rem; color: var(--muted); font-size: .63rem; }
.risk-row > span { font-size: .68rem; }
.risk-select { display: grid; place-items: center; }
.risk-select input { width: 16px; height: 16px; margin: 0; }
.risk-open { min-width: 0; border: 0; padding: 0; background: transparent; color: inherit; text-align: left; }
.risk-open:hover strong { color: var(--accent); }
.source-label { color: var(--muted); }
.pill { display: inline-flex; align-items: center; border-radius: 20px; padding: .28rem .55rem; background: #eef1f5; color: #566075; font-size: .59rem; font-weight: 800; text-transform: capitalize; }
.pill.open, .pill.connected, .pill.completed { background: #e7f8f3; color: #14856f; }
.pill.unreachable, .pill.failed, .pill.critical { background: #ffeaed; color: #bd3e4c; }
.pill.queued, .pill.running, .pill.monitoring { background: #fff3df; color: #a36917; }
.score { display: inline-grid; width: 34px; height: 28px; place-items: center; border-radius: 7px; background: #eef1f5; color: #596376; font-size: .68rem; font-weight: 850; }
.score.critical { background: #ffe8eb; color: #bd3e4c; }
.score.high { background: #fff0e5; color: #c36623; }
.score.medium { background: #fff7df; color: #9b771a; }
.score.low { background: #e7f8f3; color: #14856f; }
.empty-state { padding: 4.5rem 2rem; color: var(--muted); text-align: center; }
.empty-state h3 { color: var(--ink); }
.empty-icon { display: grid; width: 48px; height: 48px; margin: 0 auto 1rem; place-items: center; border-radius: 13px; background: var(--accent-soft); color: var(--accent); }

.detail-head { justify-content: flex-start; gap: 1.2rem; }
.detail-head > div { flex: 1; }
.detail-head h2 { margin: 0; font-size: 1.6rem; }
.back-link { border: 0; padding: .4rem 0; background: transparent; color: var(--muted); font-size: .72rem; font-weight: 700; }
.back-link:hover { color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding: 1.5rem; }
.form-grid .wide { grid-column: 1 / -1; }
.form-section { display: flex; flex-direction: column; gap: .45rem; }
.form-section-label { color: #3f4a60; font-size: .78rem; font-weight: 750; }
.form-hint { color: var(--muted); font-size: .66rem; font-weight: 500; }
.form-actions { display: flex; justify-content: flex-end; gap: .7rem; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(390px, .9fr); align-items: start; gap: 1.2rem; }
.risk-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; padding: 1.5rem; }
.field { border-bottom: 1px solid #edf0f4; padding-bottom: 1rem; }
.field.wide { grid-column: 1 / -1; }
.field span, .field strong { display: block; }
.field > span { margin-bottom: .45rem; color: var(--muted); font-size: .65rem; font-weight: 750; }
.field strong { font-size: .8rem; }
.field p { margin: 0; color: #465169; font-size: .79rem; white-space: pre-wrap; }
.provenance { grid-column: 1 / -1; color: #9099aa; font-size: .62rem; }
.ai-panel { padding: 1.4rem; }
.empty-ai { text-align: center; }
.empty-ai .ai-badge { margin: .4rem auto 1rem; }
.empty-ai p { margin-bottom: .3rem; color: var(--muted); font-size: .78rem; }
.ai-head { display: flex; gap: .9rem; margin-bottom: 1.2rem; }
.ai-head h3 { font-size: .92rem; line-height: 1.4; }
.ai-head small { color: var(--muted); font-size: .6rem; }
.analysis-group { margin-top: .8rem; border: 1px solid var(--line); border-radius: 10px; padding: .9rem; }
.analysis-group h4 { display: flex; align-items: center; justify-content: space-between; margin: 0; font-size: .7rem; text-transform: uppercase; }
.analysis-group h4 span { display: grid; width: 21px; height: 21px; place-items: center; border-radius: 50%; background: #eef1f5; font-size: .58rem; }
.analysis-group ul { margin: .6rem 0 0; padding: 0; list-style: none; }
.analysis-group li { margin-top: .65rem; padding-left: .7rem; border-left: 2px solid var(--line); }
.analysis-group strong, .analysis-group small { display: block; }
.analysis-group strong { font-size: .68rem; line-height: 1.4; }
.analysis-group small { margin-top: .18rem; color: var(--muted); font-size: .58rem; }
.analysis-group p { margin: .6rem 0 0; color: var(--muted); font-size: .65rem; }
.analysis-group.known { border-color: #cdece4; }
.analysis-group.known li { border-color: var(--teal); }
.analysis-group.inferred { border-color: #dedaff; }
.analysis-group.inferred li { border-color: var(--accent); }
.analysis-group.suggested { border-color: #f5dfb9; }
.analysis-group.suggested li { border-color: var(--amber); }
.analysis-group.unknown { border-color: #f1d4d8; }
.analysis-group.unknown li { border-color: var(--red); }

.source-card { display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 1.2rem; padding: 1.5rem; }
.source-icon { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 14px; background: var(--navy); color: white; font-size: .7rem; font-weight: 850; }
.source-main h2 { margin-bottom: .3rem; }
.source-main p:last-child { margin: 0; color: var(--muted); font-size: .76rem; }
.source-state { display: flex; align-items: flex-end; flex-direction: column; gap: .45rem; }
.source-state small { color: var(--muted); font-size: .62rem; }
.import-options { display: grid; grid-template-columns: minmax(260px, .9fr) minmax(360px, 1.1fr); align-items: center; gap: 1.5rem; margin: 1rem 0; padding: 1.25rem 1.5rem; }
.import-options h2, .import-options p { margin-bottom: .2rem; }
.import-options p:not(.eyebrow) { color: var(--muted); font-size: .72rem; }
.import-options .checkbox-line { border-left: 1px solid var(--line); padding-left: 1.5rem; }
.import-options .checkbox-line span, .import-options .checkbox-line strong, .import-options .checkbox-line small { display: block; }
.import-options .checkbox-line small { margin-top: .2rem; color: var(--muted); font-weight: 500; }
.framework-import-options { margin: 1rem 0; padding: 1.25rem 1.5rem; }
.framework-import-options .panel-head { align-items: flex-start; margin-bottom: .8rem; }
.framework-import-options .panel-head p:not(.eyebrow) { max-width: 720px; margin: .2rem 0 0; color: var(--muted); font-size: .72rem; }
.framework-import-list { display: grid; max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.framework-import-item { display: flex; align-items: flex-start; gap: .65rem; border-bottom: 1px solid var(--line); padding: .8rem .9rem; cursor: pointer; }
.framework-import-item:hover { background: #fafaff; }
.framework-import-item input { width: auto; margin-top: .15rem; }
.framework-import-item span, .framework-import-item strong, .framework-import-item small { display: block; }
.framework-import-item strong { font-size: .7rem; }
.framework-import-item small { margin-top: .18rem; color: var(--muted); font-size: .59rem; }
.selection-summary { margin: 0 0 .55rem; color: var(--accent); font-size: .66rem; font-weight: 800; }
.framework-import-options > small { display: block; margin-top: .65rem; font-size: .62rem; }
.notice { margin: 1rem 0; border-radius: 10px; padding: .8rem 1rem; font-size: .73rem; }
.warning-notice { border: 1px solid #f0d8ad; background: #fff7e9; color: #8a621f; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid #edf0f4; padding: .65rem .3rem; text-align: left; }
th { color: #929bab; font-size: .61rem; text-transform: uppercase; }
td { color: #49546a; font-size: .7rem; }
th:last-child, td:last-child { text-align: right; }
.job-card { margin: 1rem 0; padding: 1rem; }
.job-card > div:first-child { display: flex; justify-content: space-between; font-size: .7rem; }
.progress { width: 100%; height: 7px; margin-top: .65rem; overflow: hidden; border: 0; border-radius: 10px; background: #edf0f4; }
.progress::-webkit-progress-bar { border-radius: 10px; background: #edf0f4; }
.progress::-webkit-progress-value { border-radius: 10px; background: var(--accent); }
.progress::-moz-progress-bar { border-radius: 10px; background: var(--accent); }

.intro-card { margin-bottom: 1rem; padding: 1.7rem; }
.intro-card p:not(.eyebrow) { max-width: 720px; color: var(--muted); font-size: .8rem; }
.text-link { color: var(--accent); font-size: .75rem; font-weight: 750; text-decoration: none; }
.compact-form { display: flex; align-items: flex-end; gap: .8rem; padding: 1.2rem; }
.compact-form label { flex: 1; }
.token-result { margin-top: 1rem; padding: 1.5rem; }
.token-result code { display: block; overflow-wrap: anywhere; border-radius: 8px; padding: .9rem; background: #f1f3f7; color: #303b50; font-size: .72rem; }
.token-result p:last-child { margin: 1rem 0 0; color: var(--muted); font-size: .68rem; }
.token-result p:last-child code { display: inline; padding: .1rem .25rem; }
.account-layout { display: grid; grid-template-columns: minmax(230px, .6fr) minmax(420px, 1.4fr); align-items: start; gap: 1.2rem; }
.account-summary, .account-card { padding: 1.7rem; }
.account-summary h2 { margin-bottom: .35rem; }
.account-summary p:last-child { margin: 0; color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
.account-card { max-width: 760px; }
.account-card .panel-head { margin-bottom: .4rem; }
.account-note { margin: 0 0 1.3rem; color: var(--muted); font-size: .76rem; line-height: 1.6; }
.account-form { display: grid; gap: 1rem; }
.account-form .form-actions { padding-top: .25rem; }
.toast { position: fixed; right: 1.4rem; bottom: 1.4rem; z-index: 20; transform: translateY(20px); border-radius: 10px; padding: .8rem 1rem; background: var(--navy); color: white; box-shadow: var(--shadow); font-size: .72rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #a83542; }

[hidden] { display: none !important; }
.framework-layout { display: grid; grid-template-columns: minmax(230px, .42fr) minmax(0, 1.58fr); align-items: start; gap: 1.2rem; }
.framework-list { overflow: hidden; }
.framework-list-item, .record-row { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: .8rem; border: 0; border-top: 1px solid var(--line); padding: 1rem 1.1rem; background: white; color: var(--ink); text-align: left; }
.framework-list-item:first-child, .record-row:first-child { border-top: 0; }
.framework-list-item:hover, .framework-list-item.active, .record-row:hover { background: #fafaff; }
.framework-list-item.active { box-shadow: inset 3px 0 var(--accent); }
.framework-list-item strong, .framework-list-item small, .record-row strong, .record-row small { display: block; }
.framework-list-item strong, .record-row strong { font-size: .76rem; }
.framework-list-item small, .record-row small { margin-top: .25rem; color: var(--muted); font-size: .62rem; }
.framework-list-item > span:last-child { display: grid; min-width: 28px; height: 28px; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: .65rem; font-weight: 800; }
.framework-detail { min-height: 350px; padding: 1.5rem; }
.tree-meta { margin: 1rem 0; color: var(--muted); font-size: .66rem; }
.framework-tree { margin: .3rem 0 0; padding-left: 1.15rem; list-style: none; }
.framework-tree .framework-tree { margin-left: .7rem; border-left: 1px solid var(--line); }
.framework-tree li { padding: .18rem 0; }
.framework-tree summary { display: flex; align-items: center; gap: .65rem; border-radius: 8px; padding: .55rem .65rem; cursor: pointer; }
.framework-tree summary:hover { background: #f8f8fe; }
.framework-tree summary strong { font-size: .72rem; }
.framework-tree details > p { margin: .2rem .7rem .6rem 2rem; color: var(--muted); font-size: .68rem; white-space: pre-wrap; }
.framework-tree .element-notes { margin: .3rem .7rem .7rem 2rem; border: 1px solid #e6e1ff; border-radius: 9px; background: #faf9ff; }
.framework-tree .element-notes > summary { padding: .55rem .7rem; color: var(--accent); font-size: .62rem; font-weight: 800; }
.framework-tree .element-notes > div { border-top: 1px solid #e6e1ff; padding: .15rem .75rem .65rem; }
.element-note { border-top: 1px solid var(--line); padding: .65rem 0 0; }
.element-note:first-child { border-top: 0; }
.element-note header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.element-note small { color: #8b94a5; font-size: .57rem; }
.note-edit-button { border: 0; padding: .2rem .35rem; background: transparent; color: var(--accent); font-size: .6rem; font-weight: 800; }
.note-html { margin-top: .4rem; color: #465169; font-size: .68rem; line-height: 1.55; overflow-wrap: anywhere; }
.note-html > :first-child { margin-top: 0; }
.note-html > :last-child { margin-bottom: 0; }
.note-html h2, .note-html h3, .note-html h4 { margin: .75rem 0 .3rem; font-size: .78rem; }
.note-html p, .note-html ul, .note-html ol, .note-html blockquote, .note-html pre { margin: .4rem 0; }
.note-html blockquote { border-left: 3px solid #d9d4ff; padding-left: .7rem; color: var(--muted); }
.note-html pre, .note-html code { border-radius: 5px; background: #f0f2f6; }
.note-html pre { overflow: auto; padding: .6rem; }
.note-html code { padding: .08rem .2rem; }
.note-html a { color: var(--accent); }
.note-editor-dialog { width: min(840px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); border: 0; border-radius: 16px; padding: 0; color: var(--ink); box-shadow: 0 28px 90px #101b3355; }
.note-editor-dialog::backdrop { background: #101b3388; backdrop-filter: blur(2px); }
.note-editor-shell { display: grid; min-height: 520px; grid-template-rows: auto auto 1fr auto auto; }
.note-editor-shell > header, .note-editor-shell > footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.3rem; }
.note-editor-shell > header { border-bottom: 1px solid var(--line); }
.note-editor-shell > header h2 { margin: 0; }
.note-editor-shell > footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.note-close { color: var(--muted); font-size: 1rem; }
.wysiwyg-toolbar { display: flex; flex-wrap: wrap; gap: .35rem; border-bottom: 1px solid var(--line); padding: .65rem 1.3rem; background: #fafbfc; }
.wysiwyg-toolbar button { min-width: 34px; border: 1px solid #dce1e9; border-radius: 7px; padding: .35rem .5rem; background: white; color: #465169; font-size: .68rem; }
.wysiwyg-toolbar button:hover { border-color: var(--accent); color: var(--accent); }
.wysiwyg-editor { min-height: 300px; overflow: auto; outline: none; padding: 1.3rem; color: #354057; font-size: .82rem; line-height: 1.65; }
.wysiwyg-editor:focus { box-shadow: inset 0 0 0 2px #6b5cff22; }
.wysiwyg-editor a { color: var(--accent); }
.editor-help { margin: 0; padding: .65rem 1.3rem; background: #fafbfc; color: var(--muted); font-size: .65rem; }
.tree-reference { min-width: 75px; color: var(--accent); font-size: .6rem; font-weight: 800; text-transform: uppercase; }
.source-chip { margin-left: auto; border-radius: 12px; padding: .2rem .4rem; background: #e7f8f3; color: #14856f; font-size: .52rem; font-weight: 850; }
.health-banner { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; border-radius: 16px; padding: 1.5rem 1.7rem; background: linear-gradient(135deg, #17243f, #213353); color: white; }
.health-banner h2 { margin: 0; text-transform: capitalize; }
.health-banner.degraded { background: linear-gradient(135deg, #6c3d17, #925925); }
.admin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.admin-card { min-height: 140px; padding: 1.35rem; }
.admin-card > span, .admin-card > strong, .admin-card > small { display: block; }
.admin-card > span { color: var(--muted); font-size: .68rem; font-weight: 750; }
.admin-card > strong { margin: .8rem 0 .35rem; font-size: 1.3rem; }
.admin-card > small { color: #929aaa; font-size: .62rem; }
.split-admin { display: grid; grid-template-columns: minmax(270px, .62fr) minmax(480px, 1.38fr); align-items: start; gap: 1.2rem; }
.admin-form, .organization-settings { display: grid; gap: 1rem; padding: 1.5rem; }
.record-list { max-height: 430px; overflow: auto; }
.organization-settings { margin-top: 1.2rem; }
.settings-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.settings-wide { grid-column: 1 / -1; }
.stack-form { display: grid; align-content: start; gap: .85rem; }
.checkbox-line { display: flex; align-items: center; flex-direction: row; gap: .55rem; }
.checkbox-line input { width: auto; }
.inline-form { display: flex; align-items: flex-end; gap: .6rem; }
.inline-form > input, .inline-form > select { flex: 1; }
.compact-record { display: flex; align-items: center; justify-content: space-between; gap: .7rem; border-bottom: 1px solid var(--line); padding: .7rem 0; }
.compact-record strong, .compact-record small { display: block; }
.compact-record strong { font-size: .7rem; }
.compact-record small { margin-top: .2rem; color: var(--muted); font-size: .6rem; }
.icon-button { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--red); }
.membership-grid { display: grid; gap: .5rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.membership-row { display: grid; grid-template-columns: 1fr 180px; align-items: center; gap: 1rem; }
.membership-row select { padding: .55rem .7rem; }
.top-gap { margin-top: .5rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.element-form { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: .8rem; margin: 1rem 0 1.4rem; border: 1px solid var(--line); border-radius: 12px; padding: 1rem; background: #fafbfc; }
.element-form .wide { grid-column: 1 / -1; }

@media (max-width: 1050px) {
    .hero-grid, .two-column, .detail-grid, .account-layout, .framework-layout, .split-admin, .settings-columns, .import-options { grid-template-columns: 1fr; }
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-grid { grid-template-columns: repeat(2, 1fr); }
    .risk-table-head, .risk-row { grid-template-columns: 34px minmax(220px, 2fr) 100px 60px 110px; }
    .risk-table-head > :last-child, .risk-row > :last-child { display: none; }
}

@media (max-width: 760px) {
    .login-layout { grid-template-columns: 1fr; }
    .login-brand { display: none; }
    .login-panel { padding: 1rem; }
    .app-shell { display: block; }
    .sidebar { position: fixed; z-index: 10; right: 0; bottom: 0; left: 0; top: auto; width: 100%; height: 116px; padding: .35rem; }
    .sidebar-brand, .sidebar-foot { display: none; }
    .framework-switcher { margin: 0 .2rem .25rem; }
    .framework-switcher label { display: none; }
    .framework-switcher select { height: 38px; margin: 0; padding: .4rem .65rem; }
    .sidebar nav { display: flex; height: 64px; flex-direction: row; overflow-x: auto; }
    .nav-item { min-width: 72px; flex: 1 0 72px; justify-content: center; flex-direction: column; gap: .1rem; padding: .25rem; font-size: .56rem; }
    .nav-item.active { box-shadow: inset 0 2px var(--accent); }
    .nav-icon { height: 20px; }
    .workspace { padding-bottom: 122px; }
    .topbar { min-height: 75px; padding: .9rem 1rem; }
    .topbar h1 { font-size: 1.35rem; }
    .user-copy, .small-button { display: none; }
    .content { padding: 1rem; }
    .readiness-card { align-items: flex-start; flex-direction: column; gap: 1.2rem; padding: 1.5rem; }
    .score-ring { width: 115px; height: 115px; flex-basis: 115px; align-self: center; }
    .metrics-grid { grid-template-columns: 1fr 1fr; gap: .65rem; }
    .metric { min-height: 105px; padding: 1rem; }
    .risk-table-head { display: none; }
    .risk-row { grid-template-columns: 28px 1fr 60px; gap: .5rem; }
    .risk-row > :nth-child(3), .risk-row > :nth-child(5), .risk-row > :nth-child(6) { display: none; }
    .risk-filter-group { align-items: stretch; flex-direction: column; }
    .risk-filter-group input, .risk-filter-group select { width: 100%; }
    .detail-head { align-items: flex-start; flex-wrap: wrap; }
    .detail-head > div { order: -1; flex-basis: 100%; }
    .form-grid, .risk-detail { grid-template-columns: 1fr; }
    .form-grid .wide, .field.wide, .provenance { grid-column: 1; }
    .source-card { grid-template-columns: 52px 1fr; }
    .source-state { grid-column: 1 / -1; align-items: flex-start; }
    .import-options .checkbox-line { border-top: 1px solid var(--line); border-left: 0; padding-top: 1rem; padding-left: 0; }
    .compact-form { align-items: stretch; flex-direction: column; }
    .button-group { width: 100%; align-items: stretch; flex-direction: column-reverse; }
    .button-group .button { width: 100%; }
    .admin-grid { grid-template-columns: 1fr; }
    .membership-row, .element-form { grid-template-columns: 1fr; }
    .element-form .wide { grid-column: 1; }
}


.framework-picker { margin-top: .2rem; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fafbfc; }
.framework-all-choice { padding: .85rem 1rem; background: white; font-size: .72rem; }
.framework-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; border-top: 1px solid var(--line); padding: .8rem; }
.framework-choice { display: grid; grid-template-columns: 20px 1fr; align-items: start; gap: .6rem; border: 1px solid var(--line); border-radius: 9px; padding: .7rem; background: white; cursor: pointer; }
.framework-choice:hover { border-color: #cfc9ff; }
.framework-choice input { width: 16px; height: 16px; margin-top: .1rem; }
.framework-choice strong, .framework-choice small { display: block; }
.framework-choice strong { color: var(--ink); font-size: .7rem; }
.framework-choice small { margin-top: .18rem; color: var(--muted); font-size: .58rem; font-weight: 500; }
.risk-framework-dialog { width: min(760px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); border: 0; border-radius: 16px; padding: 0; color: var(--ink); box-shadow: 0 28px 90px #101b3355; }
.risk-framework-dialog::backdrop { background: #101b3388; backdrop-filter: blur(2px); }
.risk-framework-shell { display: grid; max-height: calc(100vh - 2rem); grid-template-rows: auto minmax(0, 1fr) auto auto; }
.risk-framework-shell > header, .risk-framework-shell > footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.3rem; }
.risk-framework-shell > header { border-bottom: 1px solid var(--line); }
.risk-framework-shell > header h2 { margin: 0; font-size: 1.1rem; }
.risk-framework-shell > section { overflow: auto; padding: 1.1rem 1.3rem; }
.risk-framework-shell > footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.dialog-help { margin: 0; border-top: 1px solid var(--line); padding: .75rem 1.3rem; background: #fafbfc; color: var(--muted); font-size: .65rem; }
.batch-mode { margin-top: 1rem; }

@media (max-width: 760px) {
    .framework-choice-grid { grid-template-columns: 1fr; }
    .risk-tools { align-items: stretch; flex-direction: column; }
}

/* Configurable risk matrix */
.assessment-callout { display: flex; gap: .25rem; flex-direction: column; border: 1px solid #dcd8ff; border-radius: 11px; padding: .9rem 1rem; background: #f7f5ff; }
.assessment-callout strong { color: var(--accent); font-size: .74rem; }
.assessment-callout span { color: var(--muted); font-size: .68rem; line-height: 1.55; }
.matrix-page-head > div { flex: 1; }
.matrix-page-head > div p:last-child { max-width: 720px; margin: .2rem 0 0; color: var(--muted); font-size: .75rem; }
.matrix-warning { display: grid; grid-template-columns: auto 1fr; gap: .8rem; margin-bottom: 1rem; border: 1px solid #f1c47a; border-radius: 12px; padding: .9rem 1rem; background: #fff8e9; }
.matrix-warning strong { color: #8b5a0c; font-size: .72rem; white-space: nowrap; }
.matrix-warning span { color: #725f3e; font-size: .68rem; line-height: 1.5; }
.risk-matrix-layout { display: grid; grid-template-columns: minmax(620px, 1.15fr) minmax(420px, .85fr); align-items: start; gap: 1rem; }
.matrix-editor-stack { display: grid; gap: 1rem; min-width: 0; }
.matrix-editor-card { padding: 1.25rem; }
.matrix-editor-card .panel-head { align-items: center; }
.matrix-editor-card .panel-head h3 { margin: 0; }
.matrix-editor-card .panel-head > small { max-width: 360px; color: var(--muted); text-align: right; font-size: .62rem; line-height: 1.45; }
.matrix-version { border-radius: 999px; padding: .25rem .5rem; background: var(--accent-soft); color: var(--accent); font-size: .62rem; font-weight: 800; }
.matrix-structure-row { display: grid; grid-template-columns: 135px 155px minmax(200px, 1fr) auto; align-items: end; gap: .7rem; margin-top: .8rem; }
.matrix-help { margin: .8rem 0 0; color: var(--muted); font-size: .64rem; line-height: 1.55; }
.matrix-level-list { display: grid; gap: .65rem; }
.matrix-level-row { display: grid; grid-template-columns: 34px minmax(140px, .35fr) minmax(280px, .65fr); align-items: start; gap: .65rem; border-top: 1px solid var(--line); padding-top: .7rem; }
.matrix-level-row:first-child { border-top: 0; padding-top: 0; }
.matrix-level-number { display: grid; width: 30px; height: 30px; place-items: center; margin-top: 1.35rem; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: .7rem; font-weight: 850; }
.matrix-level-row textarea { min-height: 68px; }
.matrix-band-list { display: grid; gap: .6rem; margin-top: .8rem; }
.matrix-band-row { display: grid; grid-template-columns: minmax(120px, 1fr) 76px 76px minmax(130px, .8fr) minmax(110px, .65fr) 30px; align-items: end; gap: .55rem; border-top: 1px solid var(--line); padding-top: .65rem; }
.matrix-band-row:first-child { border-top: 0; }
.matrix-band-row label { font-size: .67rem; }
.matrix-band-row input { padding: .62rem .65rem; }
.matrix-band-row label > small { margin-top: -.2rem; color: var(--muted); font-size: .55rem; font-weight: 500; }
.matrix-color-field > span { display: grid; grid-template-columns: 46px 1fr; align-items: center; gap: .4rem; }
.matrix-color-field input[type="color"] { width: 46px; height: 39px; padding: 3px; cursor: pointer; }
.matrix-color-field code { overflow: hidden; color: var(--muted); font-size: .61rem; text-overflow: ellipsis; }
.matrix-preview-panel { position: sticky; top: 1rem; overflow: hidden; padding: 1.1rem; }
.matrix-preview-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.matrix-preview-title h3 { margin: 0; }
.matrix-preview-title > span { border-radius: 999px; padding: .3rem .55rem; background: #f1f3f7; color: var(--muted); font-size: .62rem; font-weight: 800; }
.matrix-preview-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fafbfc; }
.matrix-preview-grid { display: grid; min-width: max-content; grid-template-columns: 128px repeat(var(--impact-count), minmax(74px, 1fr)); }
.matrix-preview-row { display: contents; }
.matrix-y-label, .matrix-axis-header { display: flex; min-width: 74px; flex-direction: column; justify-content: center; gap: .15rem; padding: .45rem .5rem; background: #fff; }
.matrix-y-label { min-height: 76px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.matrix-y-label strong, .matrix-axis-header strong { color: var(--accent); font-size: .65rem; }
.matrix-y-label span, .matrix-axis-header span { overflow: hidden; font-size: .58rem; font-weight: 750; line-height: 1.2; text-overflow: ellipsis; }
.matrix-preview-cell { display: flex; min-width: 74px; min-height: 76px; align-items: center; justify-content: center; flex-direction: column; gap: .18rem; border-right: 1px solid #ffffff66; border-bottom: 1px solid #ffffff66; padding: .35rem; text-align: center; }
.matrix-preview-cell strong { font-size: 1rem; }
.matrix-preview-cell small { max-width: 72px; overflow: hidden; font-size: .5rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.matrix-preview-cell input { width: 56px; border-color: #ffffff88; padding: .35rem; background: #ffffffdd; color: var(--ink); text-align: center; font-size: .72rem; font-weight: 800; }
.matrix-x-spacer { border-right: 1px solid var(--line); background: #fff; }
.matrix-axis-header { min-height: 62px; border-right: 1px solid var(--line); text-align: center; }
.matrix-axis-caption { display: flex; justify-content: space-between; margin-top: .6rem; color: var(--muted); font-size: .58rem; font-weight: 800; text-transform: uppercase; }
.matrix-band-legend { display: flex; flex-wrap: wrap; gap: .4rem .75rem; margin-top: .9rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.matrix-band-legend > span { display: flex; align-items: center; gap: .35rem; color: #4d586d; font-size: .58rem; font-weight: 750; }
.matrix-band-legend i { width: 10px; height: 10px; border-radius: 3px; }
.matrix-band-legend small { color: var(--muted); font-size: .52rem; }

/* Risk readings */
.risk-readings-panel { margin-top: 1rem; padding: 1.35rem; }
.risk-readings-panel .panel-head { align-items: center; }
.risk-readings-panel .panel-head p:last-child { max-width: 620px; margin: .25rem 0 0; color: var(--muted); font-size: .68rem; }
.reading-list { display: grid; gap: .65rem; }
.reading-row { display: grid; grid-template-columns: minmax(0, 1fr) 165px; gap: 1rem; border: 1px solid var(--line); border-radius: 12px; padding: 1rem; background: #fff; }
.reading-row.is-draft { border-style: dashed; background: #fbfbfd; }
.reading-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.reading-head > div { display: flex; align-items: center; gap: .45rem; }
.reading-head > small { color: var(--muted); font-size: .57rem; }
.reading-dimensions { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: .7rem; }
.reading-dimensions > div { border-left: 3px solid var(--accent-soft); padding-left: .7rem; }
.reading-dimensions span, .reading-dimensions strong, .reading-dimensions small { display: block; }
.reading-dimensions span { color: var(--muted); font-size: .56rem; font-weight: 800; text-transform: uppercase; }
.reading-dimensions strong { margin-top: .15rem; font-size: .72rem; }
.reading-dimensions small { margin-top: .18rem; color: var(--muted); font-size: .59rem; line-height: 1.45; }
.reading-notes { margin: .75rem 0 0; border-top: 1px solid var(--line); padding-top: .65rem; color: #586379; font-size: .64rem; white-space: pre-wrap; }
.reading-result { display: flex; align-items: stretch; justify-content: center; flex-direction: column; gap: .45rem; border-left: 1px solid var(--line); padding-left: 1rem; }
.reading-result > small { color: var(--muted); font-size: .57rem; text-align: center; }
.reading-actions { display: flex; flex-direction: column; gap: .35rem; }
.reading-score { display: flex; min-height: 54px; align-items: center; justify-content: center; flex-direction: column; border-radius: 10px; padding: .45rem; font-size: .57rem; font-weight: 800; text-transform: uppercase; }
.reading-score strong { font-size: 1.15rem; line-height: 1; }
.reading-score.draft { border: 1px dashed #cfd5de; background: #f1f3f7; color: var(--muted); }
.reading-empty { min-height: 185px; }
.field > small { display: block; margin-top: .25rem; color: var(--muted); font-size: .56rem; }
.field > .field-warning { color: #b47418; font-weight: 750; }

.risk-reading-dialog { width: min(1120px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); border: 0; border-radius: 18px; padding: 0; color: var(--ink); box-shadow: 0 28px 90px #101b3355; }
.risk-reading-dialog::backdrop { background: #101b3388; backdrop-filter: blur(2px); }
.risk-reading-shell { display: grid; max-height: calc(100vh - 2rem); grid-template-columns: minmax(0, 1fr) 310px; grid-template-rows: auto minmax(0, 1fr) auto; }
.risk-reading-shell > header { grid-column: 1 / -1; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); padding: 1.1rem 1.3rem; }
.risk-reading-shell > header h2 { margin: 0; }
.risk-reading-shell > header p:last-child { margin: .25rem 0 0; color: var(--muted); font-size: .65rem; }
.risk-reading-body { overflow: auto; padding: 1.1rem 1.3rem; }
.risk-reading-shell > footer { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: .55rem; border-top: 1px solid var(--line); padding: .9rem 1.3rem; }
.reading-live-preview { display: flex; justify-content: space-between; flex-direction: column; border-left: 1px solid var(--line); padding: 1.2rem; background: #fafbfc; }
.reading-live-preview > small { color: var(--muted); font-size: .58rem; line-height: 1.45; }
.reading-axis-block + .reading-axis-block { margin-top: 1.2rem; border-top: 1px solid var(--line); padding-top: 1.2rem; }
.reading-axis-title { display: flex; align-items: center; gap: .7rem; margin-bottom: .65rem; }
.reading-axis-title > span { display: grid; width: 29px; height: 29px; flex: 0 0 29px; place-items: center; border-radius: 9px; background: var(--accent); color: white; font-size: .66rem; font-weight: 850; }
.reading-axis-title strong, .reading-axis-title small { display: block; }
.reading-axis-title strong { font-size: .76rem; }
.reading-axis-title small { margin-top: .13rem; color: var(--muted); font-size: .58rem; }
.reading-options { display: grid; gap: .45rem; }
.reading-option { display: grid; grid-template-columns: 18px 30px 1fr; align-items: start; gap: .55rem; border: 1px solid var(--line); border-radius: 10px; padding: .65rem .7rem; background: #fff; cursor: pointer; }
.reading-option:hover { border-color: #cfc9ff; }
.reading-option.selected { border-color: var(--accent); box-shadow: 0 0 0 2px #6b5cff12; background: #faf9ff; }
.reading-option input { width: 16px; height: 16px; margin-top: .2rem; }
.reading-option-number { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 8px; background: #f1f3f7; color: var(--accent); font-size: .64rem; font-weight: 850; }
.reading-option strong, .reading-option small { display: block; }
.reading-option strong { color: var(--ink); font-size: .68rem; }
.reading-option small { margin-top: .15rem; color: var(--muted); font-size: .57rem; font-weight: 500; line-height: 1.4; }
.reading-notes-field { margin-top: 1.2rem; border-top: 1px solid var(--line); padding-top: 1.2rem; }
.reading-preview-empty { display: flex; min-height: 150px; align-items: center; justify-content: center; flex-direction: column; gap: .35rem; border: 1px dashed #d5dae3; border-radius: 12px; padding: 1rem; color: var(--muted); text-align: center; }
.reading-preview-empty strong { color: var(--ink); font-size: .7rem; }
.reading-preview-empty span { font-size: .6rem; line-height: 1.45; }
.reading-preview-result { display: flex; align-items: center; gap: .75rem; border: 1px solid var(--line); border-left: 4px solid var(--reading-color); border-radius: 12px; padding: .85rem; background: #fff; }
.reading-preview-score { display: grid; width: 54px; height: 54px; flex: 0 0 54px; place-items: center; border-radius: 10px; font-size: 1.2rem; font-weight: 900; }
.reading-preview-result strong, .reading-preview-result span { display: block; }
.reading-preview-result strong { font-size: .75rem; }
.reading-preview-result span { margin-top: .2rem; color: var(--muted); font-size: .57rem; line-height: 1.4; }

@media (max-width: 1200px) {
    .risk-matrix-layout { grid-template-columns: 1fr; }
    .matrix-preview-panel { position: static; order: -1; }
}

@media (max-width: 850px) {
    .matrix-structure-row, .matrix-level-row, .matrix-band-row { grid-template-columns: 1fr; }
    .matrix-level-number { margin-top: 0; }
    .matrix-band-row .icon-button { justify-self: end; }
    .matrix-warning { grid-template-columns: 1fr; }
    .reading-row { grid-template-columns: 1fr; }
    .reading-result { border-top: 1px solid var(--line); border-left: 0; padding-top: .8rem; padding-left: 0; }
    .risk-reading-shell { grid-template-columns: 1fr; }
    .reading-live-preview { grid-row: 2; border-bottom: 1px solid var(--line); border-left: 0; gap: .8rem; }
    .risk-reading-body { grid-row: 3; }
    .risk-reading-shell > footer { grid-row: 4; }
}

@media (max-width: 600px) {
    .reading-dimensions { grid-template-columns: 1fr; }
    .risk-reading-shell > footer { align-items: stretch; flex-direction: column-reverse; }
    .matrix-preview-grid { grid-template-columns: 105px repeat(var(--impact-count), 66px); }
    .matrix-preview-cell { min-width: 66px; }
}

/* Risk map visualisation and CSP-safe dynamic colours */
.risk-map-overview-panel { margin-bottom: 1rem; padding: 1.25rem; }
.risk-map-overview-head { align-items: flex-start; margin-bottom: 1rem; }
.risk-map-overview-head h3 { margin: 0; }
.risk-map-overview-head p:last-child { max-width: 680px; margin: .25rem 0 0; color: var(--muted); font-size: .68rem; line-height: 1.5; }
.risk-map-summary { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .45rem; }
.risk-map-summary span { display: flex; align-items: baseline; gap: .3rem; border: 1px solid var(--line); border-radius: 999px; padding: .38rem .58rem; background: #fafbfc; color: var(--muted); font-size: .58rem; font-weight: 750; }
.risk-map-summary strong { color: var(--ink); font-size: .72rem; }
.risk-register-panel { margin-top: 1rem; }
.risk-map-footnote { margin: .75rem 0 0; color: var(--muted); font-size: .6rem; line-height: 1.45; }

.risk-map-visual { min-width: 0; }
.risk-map-y-caption, .risk-map-x-caption { color: #69758a; font-size: .58rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.risk-map-y-caption { margin: 0 0 .4rem 118px; }
.risk-map-y-caption span, .risk-map-x-caption span { color: var(--accent); }
.risk-map-x-caption { margin: .45rem 0 0 118px; text-align: center; }
.risk-map-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.risk-map-table { width: 100%; min-width: 560px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.risk-map-table th, .risk-map-table td { border: 0; border-right: 1px solid #ffffff88; border-bottom: 1px solid #ffffff88; padding: 0; text-align: center; text-transform: none; }
.risk-map-table tr:last-child td, .risk-map-table tr:last-child th { border-bottom: 0; }
.risk-map-table td:last-child, .risk-map-table th:last-child { border-right: 0; text-align: center; }
.risk-map-likelihood-label, .risk-map-impact-label, .risk-map-axis-corner { background: #fafbfc; color: var(--ink); }
.risk-map-likelihood-label { width: 118px; padding: .55rem .6rem !important; border-right: 1px solid var(--line) !important; text-align: left !important; }
.risk-map-likelihood-label strong, .risk-map-impact-label strong { display: block; color: var(--accent); font-size: .65rem; }
.risk-map-likelihood-label span, .risk-map-impact-label span { display: block; margin-top: .12rem; overflow: hidden; color: #4c5870; font-size: .57rem; font-weight: 780; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.risk-map-impact-label { min-width: 76px; padding: .5rem .35rem !important; border-top: 1px solid var(--line) !important; }
.risk-map-axis-corner { width: 118px; border-top: 1px solid var(--line) !important; border-right: 1px solid var(--line) !important; }
.risk-map-cell { position: relative; min-width: 76px; height: 82px; overflow: hidden; color: var(--ink); }
.risk-map-cell.has-readings { box-shadow: inset 0 0 0 3px #6b5cff66; }
.risk-colour-fill { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.risk-map-cell-content { position: relative; z-index: 1; display: flex; height: 100%; align-items: center; justify-content: center; flex-direction: column; gap: .12rem; padding: .35rem; }
.risk-map-score { font-size: 1rem; line-height: 1; }
.risk-map-cell-content > small { max-width: 90%; overflow: hidden; font-size: .5rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.risk-map-cell.on-dark .risk-map-score, .risk-map-cell.on-dark .risk-map-cell-content > small { color: #fff; text-shadow: 0 1px 2px #0006; }
.risk-map-cell.on-light .risk-map-score, .risk-map-cell.on-light .risk-map-cell-content > small { color: #17233c; }
.risk-map-cell input[data-custom-score] { width: 58px; border: 1px solid #ffffffaa; border-radius: 8px; padding: .35rem; background: #fffffff0; color: var(--ink); text-align: center; font-size: .72rem; font-weight: 850; }
.risk-map-reading-marker { position: absolute; top: .35rem; right: .35rem; display: grid; min-width: 23px; height: 23px; place-items: center; border: 2px solid #fff; border-radius: 999px; padding: 0 .28rem; background: var(--accent); box-shadow: 0 3px 9px #101b3344; color: #fff; font-size: .55rem; font-weight: 900; }
.risk-map-legend { display: flex; flex-wrap: wrap; gap: .4rem .8rem; margin-top: .75rem; }
.risk-map-legend-item { display: inline-flex; align-items: center; gap: .32rem; color: #4d586d; font-size: .58rem; }
.risk-map-legend-item strong { font-size: .58rem; }
.risk-map-legend-item small { color: var(--muted); font-size: .52rem; }
.risk-map-legend-swatch { position: relative; width: 11px; height: 11px; overflow: hidden; border: 1px solid #d8dde5; border-radius: 3px; }
.matrix-preview-title small { display: block; margin-top: .2rem; color: var(--muted); font-size: .57rem; font-weight: 500; }

.risk-colour-badge { position: relative; display: inline-flex; min-width: 38px; min-height: 30px; overflow: hidden; align-items: center; justify-content: center; border-radius: 8px; vertical-align: middle; }
.risk-colour-badge.neutral { border: 1px solid var(--line); background: #eef1f5; color: #596376; font-size: .68rem; font-weight: 850; }
.risk-colour-badge-content { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: .08rem; padding: .3rem .5rem; }
.risk-colour-badge-content strong { color: inherit; font-size: .76rem; line-height: 1; }
.risk-colour-badge-content small { color: inherit; font-size: .48rem; font-weight: 800; line-height: 1; text-transform: uppercase; }
.risk-colour-badge.on-dark { color: #fff; text-shadow: 0 1px 2px #0005; }
.risk-colour-badge.on-light { color: #17233c; }
.risk-list-score { min-width: 34px; min-height: 28px; }
.risk-list-score .risk-colour-badge-content { padding: .2rem .4rem; }
.risk-list-score .risk-colour-badge-content strong { font-size: .68rem; }
.risk-current-score-badge { min-width: 62px; min-height: 42px; }
.risk-current-score-badge .risk-colour-badge-content strong { font-size: .95rem; }
.risk-current-score-badge .risk-colour-badge-content small { font-size: .5rem; }
.reading-score-badge { width: 100%; min-height: 54px; border-radius: 10px; }
.reading-score-badge .risk-colour-badge-content strong { font-size: 1.15rem; }
.reading-score-badge .risk-colour-badge-content small { font-size: .52rem; }
.reading-preview-score-badge { width: 58px; min-width: 58px; height: 58px; border-radius: 10px; }
.reading-preview-score-badge .risk-colour-badge-content strong { font-size: 1.15rem; }
.reading-preview-result { border-left: 1px solid var(--line); }
.compact-reading-dialog { width: min(680px, calc(100vw - 2rem)); }
.reopen-reading-shell { display: grid; grid-template-columns: 1fr; }
.reopen-reading-shell > header, .reopen-reading-shell > section, .reopen-reading-shell > footer { grid-column: 1; }
.reopen-reading-shell > footer { display: flex; justify-content: flex-end; gap: .6rem; border-top: 1px solid var(--line); padding: 1rem 1.2rem; }

/* Audit trail */
.audit-page-head { margin-bottom: 1rem; }
.audit-filter-panel, .audit-list-panel { padding: 1.15rem; }
.audit-filter-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: .75rem; align-items: end; }
.audit-filter-grid label { font-size: .66rem; }
.audit-filter-actions { display: flex; gap: .5rem; align-items: end; }
.audit-list-panel { margin-top: 1rem; }
.audit-list-panel .panel-head { align-items: center; }
.audit-list-panel .panel-head > strong { color: var(--muted); font-size: .68rem; }
.audit-event { display: grid; grid-template-columns: 190px 190px minmax(220px, 1fr) minmax(180px, .8fr); gap: .8rem; align-items: center; border-top: 1px solid var(--line); padding: .9rem .2rem; }
.audit-event:first-child { border-top: 0; }
.audit-time strong, .audit-time small, .audit-actor strong, .audit-actor small, .audit-action strong, .audit-action small, .audit-object strong, .audit-object small { display: block; }
.audit-time strong, .audit-actor strong, .audit-action strong, .audit-object strong { font-size: .68rem; }
.audit-time small, .audit-actor small, .audit-action small, .audit-object small { margin-top: .15rem; overflow: hidden; color: var(--muted); font-size: .55rem; line-height: 1.35; text-overflow: ellipsis; }
.audit-actor { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.audit-actor > div { min-width: 0; }
.audit-actor-mark { display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: .57rem; font-weight: 900; }
.audit-actor-mark.ai { background: #eee9ff; color: #6248f2; }
.audit-actor-mark.integration { background: #e8f8f4; color: #168b75; }
.audit-details { grid-column: 1 / -1; border-radius: 9px; background: #f8f9fb; padding: .55rem .7rem; }
.audit-reason { grid-column: 1 / -1; margin: 0; border-left: 3px solid var(--amber); padding: .45rem .65rem; background: #fff9ee; color: #725f3e; font-size: .61rem; line-height: 1.45; }
.audit-details summary { cursor: pointer; color: #566176; font-size: .6rem; font-weight: 800; }
.audit-json-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin-top: .6rem; }
.audit-json-grid strong { display: block; margin-bottom: .3rem; font-size: .6rem; }
.audit-json-grid pre { max-height: 280px; overflow: auto; margin: 0; border: 1px solid var(--line); border-radius: 8px; padding: .65rem; background: #fff; color: #445068; font-size: .56rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.audit-pagination { display: flex; justify-content: flex-end; gap: .5rem; border-top: 1px solid var(--line); padding-top: .85rem; }

@media (max-width: 1100px) {
    .audit-filter-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
    .audit-event { grid-template-columns: 160px 180px 1fr; }
    .audit-object { grid-column: 2 / -1; }
}

@media (max-width: 850px) {
    .risk-map-overview-head { align-items: stretch; flex-direction: column; }
    .risk-map-summary { justify-content: flex-start; }
}

@media (max-width: 600px) {
    .risk-map-y-caption { margin-left: 92px; }
    .risk-map-x-caption { margin-left: 92px; }
    .risk-map-likelihood-label, .risk-map-axis-corner { width: 92px; }
    .risk-map-cell { height: 70px; }
}

/* Risk management workflow refinements */
.risk-management-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.risk-management-actions > div:first-child p:last-child { margin: .2rem 0 0; color: var(--muted); font-size: .68rem; }
.risk-batch-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1rem 0; border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; background: #fff; }
.risk-batch-toolbar > div:first-child { display: flex; flex-direction: column; gap: .15rem; }
.risk-batch-toolbar strong { font-size: .68rem; }
.risk-batch-toolbar span { color: var(--muted); font-size: .59rem; }
.risk-sort-button { display: inline-flex; align-items: center; gap: .3rem; border: 0; padding: 0; background: transparent; color: inherit; font: inherit; font-weight: inherit; cursor: pointer; text-align: left; }
.risk-sort-button span { color: #a0a7b4; font-size: .62rem; }
.risk-sort-button:hover, .risk-sort-button.active { color: var(--accent); }
.risk-sort-button.active span { color: var(--accent); }
.risk-detail-title { display: flex; align-items: center; gap: .55rem; }
.risk-detail-title h2 { margin: 0; }
.risk-edit-icon, .reading-edit-icon { display: inline-grid; width: 30px; height: 30px; place-items: center; flex: 0 0 auto; border: 1px solid transparent; border-radius: 8px; padding: 0; background: transparent; color: #727b8d; font-size: .95rem; line-height: 1; cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.risk-edit-icon:hover, .reading-edit-icon:hover { border-color: var(--line); background: #f7f7fb; color: var(--accent); }
.risk-edit-dialog { width: min(760px, calc(100vw - 2rem)); border: 0; border-radius: 18px; padding: 0; color: var(--ink); box-shadow: 0 28px 90px #101b3355; }
.risk-edit-dialog::backdrop { background: #101b3388; backdrop-filter: blur(2px); }
.risk-edit-dialog form { display: grid; max-height: calc(100vh - 2rem); grid-template-rows: auto minmax(0, 1fr) auto; }
.risk-edit-dialog header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); padding: 1.1rem 1.3rem; }
.risk-edit-dialog header h2 { margin: 0; }
.risk-edit-dialog header p:last-child { margin: .25rem 0 0; color: var(--muted); font-size: .64rem; }
.risk-edit-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; overflow: auto; padding: 1.1rem 1.3rem; }
.risk-edit-fields .full-width { grid-column: 1 / -1; }
.risk-edit-dialog footer { display: flex; justify-content: flex-end; gap: .55rem; border-top: 1px solid var(--line); padding: .9rem 1.3rem; }
.review-override-editor { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, .45fr); align-items: end; gap: .7rem; border: 1px solid var(--line); border-radius: 10px; padding: .8rem; background: #fafbfc; }
.review-override-editor .checkbox-line { align-self: center; }
.risk-appetite-current { display: grid; gap: .25rem; }
.risk-appetite-current strong { font-size: .7rem; }
.risk-appetite-current small { color: var(--muted); font-size: .58rem; line-height: 1.5; }
.appetite-action { display: inline-flex; width: fit-content; border-radius: 999px; padding: .22rem .46rem; font-size: .54rem; font-weight: 850; text-transform: uppercase; letter-spacing: .03em; }
.appetite-action.tolerate { background: #e8f7ee; color: #24704a; }
.appetite-action.treat { background: #fff4d9; color: #88610d; }
.appetite-action.escalate { background: #ffe8eb; color: #a12d3c; }

/* Configurable risk appetite & tolerance */
.matrix-appetite-list { display: grid; gap: .65rem; margin-top: .8rem; }
.matrix-appetite-row { display: grid; grid-template-columns: minmax(145px, .9fr) 78px 78px minmax(150px, .8fr) 30px; gap: .55rem; align-items: end; border-top: 1px solid var(--line); padding-top: .65rem; }
.matrix-appetite-row:first-child { border-top: 0; }
.matrix-appetite-row label { font-size: .67rem; }
.matrix-appetite-row input, .matrix-appetite-row select { padding: .62rem .65rem; }
.matrix-appetite-response { grid-column: 1 / -1; }
.matrix-appetite-response textarea { min-height: 82px; }

/* Reading edit controls and appetite context */
.reading-actions { align-items: center; }
.reading-appetite { display: grid; gap: .18rem; border-top: 1px solid var(--line); padding-top: .45rem; text-align: center; }
.reading-appetite strong { font-size: .58rem; }
.reading-appetite span { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: .52rem; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.reading-preview-appetite { display: grid; gap: .2rem; margin-top: .65rem; border-top: 1px solid var(--line); padding-top: .55rem; }
.reading-preview-appetite b { font-size: .62rem; }
.reading-preview-appetite small { color: var(--muted); font-size: .56rem; line-height: 1.45; }

@media (max-width: 850px) {
    .risk-management-actions, .risk-batch-toolbar { align-items: stretch; flex-direction: column; }
    .risk-batch-toolbar .button-group { justify-content: flex-start; }
    .matrix-appetite-row { grid-template-columns: 1fr 1fr; }
    .matrix-appetite-row > :first-child, .matrix-appetite-response { grid-column: 1 / -1; }
    .risk-edit-fields { grid-template-columns: 1fr; }
    .risk-edit-fields .full-width, .review-override-editor { grid-column: auto; }
    .review-override-editor { grid-template-columns: 1fr; }
}
