:root {
    --ink: #102a43;
    --muted: #627d98;
    --line: #d9e2ec;
    --paper: #ffffff;
    --canvas: #f2f7fb;
    --navy: #0b3659;
    --teal: #007c86;
    --sky: #e8f4f8;
    --gold: #e8b84a;
    --danger: #b42318;
    --success: #027a48;
    --shadow: 0 15px 40px rgba(16, 42, 67, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
button, input, select { font: inherit; }
input, select { color: var(--ink); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.18; }
a { color: inherit; }

.eyebrow { margin-bottom: .45rem; color: var(--teal); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.hero-topline { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.hero-topline .eyebrow { margin-bottom: .45rem; }
.language-switcher { display: inline-flex; gap: .28rem; padding: .22rem; border: 1px solid rgba(255, 255, 255, .26); border-radius: 7px; background: rgba(3, 28, 48, .16); }
.language-switcher button { min-width: 52px; padding: .3rem .42rem; border: 0; border-radius: 4px; color: #d8eef4; background: transparent; cursor: pointer; font-size: .72rem; font-weight: 800; letter-spacing: .03em; }
.language-switcher button:hover, .language-switcher button.selected { color: var(--navy); background: #fff; }
.language-switcher.compact { border-color: rgba(255,255,255,.2); }
.language-switcher.compact button { min-width: 0; padding: .28rem .36rem; font-size: .67rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; min-height: 42px; padding: .65rem 1rem; border: 1px solid transparent; border-radius: 7px; cursor: pointer; font-weight: 750; text-decoration: none; transition: transform .15s, background .15s, box-shadow .15s; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--teal); box-shadow: 0 6px 14px rgba(0, 124, 134, .2); }
.button.primary:hover { background: #006872; }
.helper { color: var(--muted); font-size: .88rem; }
.alert { margin: 1rem 0; padding: .85rem 1rem; border-radius: 7px; font-size: .92rem; font-weight: 650; }
.alert.success { color: #065f46; background: #d1fae5; border: 1px solid #6ee7b7; }
.alert.error { color: #7a271a; background: #fef3f2; border: 1px solid #fecdca; }
.tooltip { position: relative; display: inline-flex; vertical-align: middle; }
.tooltip-trigger { display: inline-grid; width: 17px; height: 17px; place-items: center; margin-left: .25rem; padding: 0; border: 1px solid currentColor; border-radius: 50%; color: var(--teal); background: #fff; cursor: help; font-family: Georgia, serif; font-size: .72rem; font-weight: 800; line-height: 1; }
.tooltip-trigger:focus-visible { outline: 3px solid rgba(0, 124, 134, .28); outline-offset: 2px; }
.tooltip-content { position: absolute; z-index: 1000; bottom: calc(100% + .5rem); left: 50%; display: block; width: min(330px, 78vw); padding: .75rem .8rem; border: 1px solid #91b9c1; border-radius: 7px; color: #e9f7fa; background: #113d5e; box-shadow: 0 9px 24px rgba(16, 42, 67, .25); font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: .76rem; font-weight: 500; letter-spacing: normal; line-height: 1.45; opacity: 0; pointer-events: none; text-align: left; text-transform: none; transform: translate(-50%, .3rem); transition: opacity .15s, transform .15s; visibility: hidden; white-space: normal; }
.tooltip:hover .tooltip-content, .tooltip:focus-within .tooltip-content, .tooltip.is-open .tooltip-content { opacity: 1; transform: translate(-50%, 0); visibility: visible; }

/* Home */
.home-page { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; padding: 3.5rem 0 5rem; }
.hero-panel { padding: clamp(2rem, 6vw, 4.5rem); color: #fff; background: radial-gradient(circle at 80% 15%, #087c86 0, #0b3659 44%, #081f33 100%); border-radius: 16px; box-shadow: var(--shadow); }
.hero-panel .eyebrow { color: #b9f1ed; }
.hero-panel h1 { max-width: 680px; margin-bottom: 1rem; font-size: clamp(2rem, 5vw, 3.65rem); }
.hero-copy { max-width: 660px; color: #d6e7f4; font-size: 1.05rem; }
.hero-steps { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 2rem; }
.hero-steps span { padding: .36rem .65rem; border: 1px solid rgba(255,255,255,.24); border-radius: 99px; color: #e7f4fb; font-size: .78rem; font-weight: 700; }
.create-panel, .sessions-panel { margin-top: 1.4rem; padding: clamp(1.25rem, 3vw, 2rem); background: var(--paper); border: 1px solid #e5edf4; border-radius: 12px; box-shadow: 0 4px 16px rgba(16, 42, 67, .04); }
.create-panel > div > p:not(.eyebrow) { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: .85rem; align-items: end; }
.form-grid label, .weight-control { display: grid; gap: .35rem; color: var(--muted); font-size: .82rem; font-weight: 700; }
.form-grid input, .form-grid select { width: 100%; min-height: 42px; padding: .6rem .7rem; border: 1px solid #bcccdc; border-radius: 6px; background: #fff; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.section-heading.compact { margin-bottom: .75rem; }
.section-heading h2 { margin: 0; font-size: 1.35rem; }
.count-chip, .canvas-status { padding: .3rem .6rem; border-radius: 99px; background: var(--sky); color: var(--navy); font-size: .78rem; font-weight: 750; white-space: nowrap; }
.empty-state { padding: 2.5rem 1rem; border: 1px dashed #bcccdc; border-radius: 8px; text-align: center; color: var(--muted); }
.empty-state p { margin-bottom: .25rem; color: var(--ink); font-weight: 750; }
.session-list { display: grid; gap: .65rem; }
.session-card { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; transition: border .15s, transform .15s, box-shadow .15s; }
.session-card:hover { border-color: var(--teal); transform: translateY(-1px); box-shadow: 0 7px 17px rgba(16, 42, 67, .08); }
.session-card h3 { margin-bottom: .25rem; font-size: 1rem; }
.session-card p, .session-meta { margin: 0; color: var(--muted); font-size: .84rem; }
.session-meta { display: flex; align-items: center; gap: 1rem; }
.session-meta span { color: var(--teal); font-size: 1.2rem; }

/* Workspace */
.workspace-header { position: sticky; z-index: 5; top: 0; display: flex; align-items: center; gap: 2rem; min-height: 72px; padding: .75rem clamp(1rem, 4vw, 3rem); color: #fff; background: var(--navy); box-shadow: 0 3px 11px rgba(9, 30, 49, .2); }
.brand { display: grid; color: #fff; font-size: 1.2rem; font-weight: 850; letter-spacing: -.04em; text-decoration: none; }
.brand span { color: #78e0db; }
.brand small { margin-top: -.15rem; color: #b3cde0; font-size: .55rem; letter-spacing: .07em; text-transform: uppercase; }
.workspace-title { min-width: 0; flex: 1; }
.workspace-title p { margin: 0; color: #b3cde0; font-size: .75rem; }
.workspace-title h1 { overflow: hidden; margin: .12rem 0 0; font-size: 1.05rem; text-overflow: ellipsis; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: .65rem; }
.save-top { min-width: 130px; }
.workspace-layout { display: grid; grid-template-columns: 245px minmax(0, 1fr); width: min(1600px, 100%); margin: 0 auto; }
.side-nav { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 72px); padding: 2rem 1.2rem; overflow-y: auto; border-right: 1px solid #dce8f0; }
.side-nav p { margin: 1.2rem .65rem .35rem; color: var(--muted); font-size: .69rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.side-nav a { display: block; padding: .5rem .65rem; border-radius: 5px; color: #486581; font-size: .87rem; font-weight: 700; text-decoration: none; }
.side-nav a:hover, .side-nav a.active { color: var(--navy); background: #dceff3; }
.side-nav a span { display: block; overflow: hidden; margin-top: .08rem; color: var(--muted); font-size: .71rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.workspace-content { min-width: 0; padding: clamp(1rem, 3vw, 2.5rem); }
.assessment-overview { display: flex; align-items: center; justify-content: space-between; gap: 2rem; margin-bottom: 1.2rem; padding: clamp(1.25rem, 3vw, 2rem); border: 1px solid #cde6ec; border-radius: 11px; background: linear-gradient(115deg, #fff, #e9f7f6); }
.assessment-overview h2 { max-width: 700px; margin-bottom: .65rem; font-size: clamp(1.35rem, 2.2vw, 2rem); }
.assessment-overview p:not(.eyebrow) { max-width: 760px; margin-bottom: 0; color: #486581; }
.progress-summary { display: grid; grid-template-columns: auto auto; gap: .25rem .7rem; min-width: 185px; }
.progress-summary span { align-self: center; color: var(--teal); font-size: 1.7rem; font-weight: 800; text-align: right; }
.progress-summary small { align-self: center; color: var(--muted); font-size: .7rem; line-height: 1.25; }
.weights-section, .canvas-section { margin: 1.2rem 0; padding: clamp(1rem, 2.5vw, 1.6rem); border: 1px solid #d8e7ef; border-radius: 10px; background: #fff; }
.weights-section .helper { margin: 0; text-align: right; }
.weight-grid { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: .65rem; }
.weight-control { padding: .7rem; border: 1px solid #d9e2ec; border-radius: 7px; background: #f8fbfd; }
.weight-control span { min-height: 2.55em; color: #486581; font-size: .73rem; line-height: 1.25; }
.weight-control b { color: var(--navy); }
.weight-control input { width: 100%; min-height: 32px; padding: .25rem .4rem; border: 1px solid #9fb3c8; border-radius: 4px; background: #fff; }
.factors-section { display: grid; gap: .8rem; margin: 1.2rem 0; }
.factor-card { position: relative; overflow: visible; border: 1px solid #d8e7ef; border-radius: 9px; background: #fff; }
.factor-card[open] { z-index: 10; border-color: #91cbd1; box-shadow: 0 7px 20px rgba(16, 42, 67, .06); }
.factor-card summary { position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 1rem; padding: 1rem 1.1rem; cursor: pointer; list-style: none; }
.factor-card summary::-webkit-details-marker { display: none; }
.factor-card summary::after { content: '⌄'; grid-column: 3; grid-row: 1; color: var(--teal); font-size: 1.2rem; }
.factor-card[open] summary::after { transform: rotate(180deg); }
.factor-id { display: inline-grid; width: 50px; height: 32px; place-items: center; border-radius: 4px; color: #fff; background: var(--navy); font-size: .78rem; font-weight: 850; }
.factor-heading { min-width: 0; }
.factor-heading b, .factor-heading small { display: block; }
.factor-heading b { font-size: 1rem; }
.factor-heading small { overflow: hidden; margin-top: .16rem; color: var(--muted); font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.factor-count { grid-column: 3; grid-row: 1; margin-right: 3.7rem; color: var(--muted); font-size: .75rem; }
.factor-tooltip { position: absolute; top: 50%; right: 2rem; transform: translateY(-50%); }
.factor-body { position: relative; overflow: visible; padding: .2rem 1.1rem 1.2rem; border-top: 1px solid #e6eff5; }
.factor-body .helper { margin: .9rem 0; }
.factor-inputs { display: grid; gap: .25rem; }
.range-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(150px, 1fr) 30px; align-items: center; gap: 1rem; min-height: 42px; padding: .35rem .5rem; border-radius: 5px; }
.range-row:nth-child(odd), .distribution-row:nth-child(odd), .risk-row:nth-child(odd) { background: #f7fafc; }
.range-row span, .distribution-row span { font-size: .85rem; }
.range-row output { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; color: #fff; background: var(--teal); font-size: .78rem; font-weight: 800; }
input[type="range"] { width: 100%; accent-color: var(--teal); }
.distribution-note { margin: .9rem 0; color: #486581; font-size: .88rem; }
.distribution-total { margin-left: .3rem; color: var(--teal); font-weight: 800; }
.distribution-total.invalid { color: var(--danger); }
.distribution-row { display: grid; grid-template-columns: minmax(220px, 1fr) 82px 16px; align-items: center; gap: 1rem; padding: .42rem .5rem; }
.distribution-row input { width: 100%; min-height: 32px; padding: .25rem .4rem; border: 1px solid #9fb3c8; border-radius: 4px; text-align: right; }
.distribution-row b { color: var(--muted); font-size: .85rem; }
.risk-inputs { gap: .2rem; }
.risk-row { display: grid; grid-template-columns: minmax(270px, 1fr) 92px 105px 100px; align-items: center; gap: .7rem; padding: .55rem .6rem; }
.risk-row p { margin: 0; font-size: .82rem; }
.risk-row label { display: grid; gap: .15rem; color: var(--muted); font-size: .67rem; font-weight: 750; text-transform: uppercase; }
.risk-row input { min-height: 31px; padding: .2rem .35rem; border: 1px solid #9fb3c8; border-radius: 4px; }
.risk-rating { color: var(--muted); font-size: .76rem; }
.risk-rating b { color: var(--teal); font-size: 1.05rem; }
.canvas-section { scroll-margin-top: 90px; }
.canvas-section > .helper { margin: -.5rem 0 1rem; }
.canvas-insights { margin: 1.1rem 0 1rem; padding: 1rem; border: 1px solid #c9e1e6; border-radius: 8px; background: linear-gradient(145deg, #f4fbfc, #fff); }
.canvas-tools { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.canvas-tools h3 { margin: 0 0 .2rem; color: var(--navy); font-size: 1rem; }
.canvas-tools p { max-width: 720px; margin: 0; color: var(--muted); font-size: .78rem; }
.canvas-sort-control { display: grid; flex: 0 0 185px; gap: .25rem; color: var(--navy); font-size: .72rem; font-weight: 800; }
.canvas-sort-control select { min-height: 34px; padding: .3rem .45rem; border: 1px solid #9abdc7; border-radius: 5px; color: var(--navy); background: #fff; font-size: .78rem; font-weight: 700; }
.priority-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; margin: .85rem 0; }
.priority-summary > div { display: grid; gap: .1rem; padding: .5rem .6rem; border: 1px solid #d9e8ee; border-radius: 5px; background: #fff; }
.priority-summary span { color: var(--muted); font-size: .66rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.priority-summary strong { color: var(--navy); font-size: .85rem; }
.priority-chart { display: grid; gap: .28rem; max-height: 400px; margin: 0; padding: .2rem .1rem .2rem 0; overflow-y: auto; list-style: none; scrollbar-color: #9abdc7 transparent; }
.priority-chart-item { display: grid; grid-template-columns: 25px minmax(205px, 1.15fr) minmax(190px, 1fr) 42px; align-items: center; gap: .5rem; min-height: 27px; }
.priority-rank { color: var(--muted); font-size: .68rem; font-variant-numeric: tabular-nums; text-align: right; }
.priority-objective { overflow: hidden; color: #334e68; font-size: .72rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.priority-track { position: relative; display: block; height: 10px; border-radius: 99px; background: linear-gradient(90deg, #f8e6b4 0 49.6%, #c8ebe8 50.4% 100%); }
.priority-track::after { position: absolute; z-index: 1; top: -3px; bottom: -3px; left: 50%; width: 1px; background: #78909c; content: ''; }
.priority-bar { position: absolute; z-index: 2; top: 1px; bottom: 1px; width: var(--bar-size); border-radius: 99px; background: var(--teal); }
.is-positive .priority-bar { left: 50%; }
.is-negative .priority-bar { right: 50%; background: var(--gold); }
.priority-value { color: var(--teal); font-size: .72rem; font-weight: 850; font-variant-numeric: tabular-nums; text-align: right; }
.is-negative .priority-value { color: #9b6a06; }
.table-scroll { overflow: auto; border: 1px solid #d9e2ec; border-radius: 7px; }
.canvas-table { width: 100%; min-width: 1060px; border-collapse: collapse; font-size: .78rem; }
.canvas-table th, .canvas-table td { padding: .52rem .5rem; border-bottom: 1px solid #e6eef4; vertical-align: middle; text-align: left; }
.canvas-table thead th { color: #e9f5fa; background: var(--navy); font-size: .68rem; line-height: 1.15; letter-spacing: .03em; text-transform: uppercase; }
.canvas-table thead th > span[data-i18n] { white-space: pre-line; }
.canvas-table .tooltip-trigger { color: #b9f1ed; background: transparent; }
.canvas-table .tooltip-content { top: calc(100% + .5rem); bottom: auto; }
.canvas-table tbody tr:hover { background: #f7fbfc; }
.canvas-table tbody th { min-width: 245px; font-weight: 500; }
.canvas-table tbody th b, .canvas-table tbody th span { display: block; }
.canvas-table tbody th b { color: var(--navy); font-size: .76rem; }
.canvas-table tbody th span { margin-top: .1rem; color: #627d98; font-size: .71rem; line-height: 1.25; }
.canvas-table input, .canvas-table select { min-height: 30px; border: 1px solid #bcccdc; border-radius: 4px; background: #fff; }
.adjustment-input { width: 73px; padding: .2rem .3rem; text-align: center; }
.reason-input { width: 180px; padding: .2rem .35rem; }
.canvas-table select { width: 78px; padding: .2rem; }
.score { min-width: 52px; color: var(--navy); font-weight: 800; text-align: center !important; }
.priority { color: var(--teal); }
.capability { color: var(--navy); font-weight: 700; white-space: nowrap; }
.save-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.3rem 0 2rem; padding: 1rem 1.2rem; border-radius: 8px; color: #dceff3; background: var(--navy); }
.save-footer p { margin: 0; font-size: .84rem; }

.simple-page { display: grid; min-height: 100vh; place-items: center; padding: 1rem; }
.simple-page main { max-width: 520px; padding: 2.2rem; border-radius: 12px; background: #fff; box-shadow: var(--shadow); }

@media (max-width: 1050px) {
    .form-grid { grid-template-columns: 1fr 1fr; }
    .form-grid .button { grid-column: span 2; }
    .weight-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 780px) {
    .home-page { width: min(100% - 1rem, 1120px); padding-top: .8rem; }
    .workspace-header { gap: .75rem; min-height: 64px; padding: .6rem .75rem; }
    .workspace-title h1 { font-size: .9rem; }
    .brand { font-size: 1rem; }
    .header-actions { gap: .35rem; }
    .save-top { min-width: auto; padding: .55rem .7rem; font-size: .78rem; }
    .workspace-layout { display: block; }
    .side-nav { display: none; }
    .workspace-content { padding: 1rem .75rem; }
    .assessment-overview { display: block; }
    .progress-summary { margin-top: 1.2rem; grid-template-columns: 45px auto; }
    .weight-grid { grid-template-columns: repeat(2, 1fr); }
    .weights-section .helper { text-align: left; }
    .factor-card summary { grid-template-columns: 48px minmax(0, 1fr); gap: .7rem; }
    .factor-card summary::after { display: none; }
    .factor-count { display: none; }
    .factor-tooltip { right: .9rem; }
    .range-row, .distribution-row { grid-template-columns: 1fr; gap: .35rem; padding: .7rem .4rem; }
    .range-row output { grid-column: 1; }
    .distribution-row input { width: 80px; }
    .risk-row { grid-template-columns: 1fr 1fr; gap: .5rem; }
    .risk-row p { grid-column: span 2; }
    .canvas-tools { display: grid; }
    .canvas-sort-control { width: min(100%, 240px); }
    .priority-chart-item { grid-template-columns: 22px minmax(120px, 1fr) minmax(120px, 1fr) 38px; gap: .35rem; }
    .save-footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 520px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .button { grid-column: auto; }
    .weight-grid { grid-template-columns: 1fr; }
    .hero-panel, .create-panel, .sessions-panel { border-radius: 9px; }
}
