:root {
  --blue: #005a9c;
  --blue-dark: #003b6f;
  --blue-700: #004a82;
  --blue-light: #dceaf5;
  --blue-pale: #f1f7fb;
  --red: #d52b1e;
  --red-dark: #a81f16;
  --red-light: #fbe5e3;
  --white: #fff;
  --bg: #f5f6f7;
  --border: #d9dee3;
  --gray-50: #fafbfc;
  --gray-100: #f1f3f4;
  --gray-300: #c4ccd3;
  --gray-500: #66717c;
  --gray-700: #43515c;
  --ink: #263238;
  --success: #147a50;
  --success-bg: #e4f4ec;
  --warning: #8a5a00;
  --warning-bg: #fff4d8;
  --danger: #b3261e;
  --shadow: 0 2px 8px rgba(0, 40, 75, .07);
  --sidebar: 270px;
  --radius: 8px;
  --ease: 180ms ease;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg); font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { margin-bottom: 7px; color: var(--blue-dark); font-size: clamp(26px, 2vw, 31px); line-height: 1.18; letter-spacing: -.025em; }
h2 { margin-bottom: 5px; color: var(--blue-dark); font-size: 20px; line-height: 1.25; letter-spacing: -.012em; }
h3 { margin-bottom: 4px; color: var(--ink); font-size: 15px; }
.icon { flex: 0 0 auto; vertical-align: middle; }
.skip-link { position: fixed; z-index: 5000; top: -100px; left: 18px; padding: 10px 16px; color: white; background: var(--blue-dark); border-radius: 0 0 6px 6px; }
.skip-link:focus { top: 0; }
:focus-visible { outline: 3px solid #66b7ec; outline-offset: 2px; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; display: flex; width: var(--sidebar); flex-direction: column; color: white; background: var(--blue-dark); box-shadow: 4px 0 18px rgba(0, 30, 60, .12); }
.brand { position: relative; display: flex; min-height: 92px; align-items: center; gap: 11px; padding: 16px 18px 15px; border-bottom: 1px solid rgba(255,255,255,.14); background: #003663; }
.brand img { width: 55px; height: 55px; border: 2px solid white; border-radius: 50%; object-fit: cover; }
.brand strong { display: block; color: white; font-size: 23px; line-height: 1; letter-spacing: .04em; }
.brand span { display: block; margin-top: 6px; color: #c7dcec; font-size: 10.5px; line-height: 1.28; }
.sidebar-close { display: none; margin-left: auto; padding: 5px; color: white; background: transparent; border: 0; }
.main-nav { flex: 1; padding: 14px 10px; overflow-y: auto; scrollbar-width: thin; }
.nav-link, .nav-parent, .nav-children button { width: 100%; border: 0; text-align: left; transition: background var(--ease), color var(--ease); }
.nav-link, .nav-parent { display: flex; min-height: 44px; align-items: center; gap: 12px; padding: 10px 12px; color: #d7e5ef; background: transparent; border-radius: 5px; font-weight: 600; }
.nav-link:hover, .nav-parent:hover { color: white; background: rgba(255,255,255,.08); }
.nav-link.is-active, .nav-group.is-active > .nav-parent { color: white; background: rgba(255,255,255,.12); box-shadow: inset 3px 0 var(--red); }
.nav-link em { min-width: 22px; margin-left: auto; padding: 1px 6px; color: white; background: var(--red); border-radius: 20px; font-size: 11px; font-style: normal; text-align: center; }
.nav-parent svg:last-child { margin-left: auto; transition: transform var(--ease); }
.nav-parent[aria-expanded="true"] svg:last-child { transform: rotate(180deg); }
.nav-children { display: none; padding: 4px 0 7px 42px; }
.nav-group.is-active .nav-children, .nav-group.is-open .nav-children { display: grid; }
.nav-children button { position: relative; padding: 7px 10px; color: #bed3e2; background: transparent; border-radius: 4px; font-size: 13px; }
.nav-children button::before { position: absolute; left: -11px; top: 14px; width: 5px; height: 5px; background: #6b9abd; border-radius: 50%; content: ""; }
.nav-children button:hover { color: white; background: rgba(255,255,255,.07); }
.nav-separator { height: 1px; margin: 12px 8px; background: rgba(255,255,255,.14); }
.sidebar-meta { padding: 14px 18px 17px; border-top: 1px solid rgba(255,255,255,.14); background: rgba(0,0,0,.09); }
.sidebar-meta span, .sidebar-meta small { display: block; color: #aecaDC; font-size: 10px; text-transform: uppercase; letter-spacing: .055em; }
.sidebar-meta strong { display: block; margin: 3px 0; font-size: 12px; }
.sidebar-meta small { text-transform: none; letter-spacing: 0; }
.sidebar-scrim { display: none; }

.workspace { width: calc(100% - var(--sidebar)); min-height: 100vh; margin-left: var(--sidebar); }
.topbar { position: sticky; z-index: 30; top: 0; display: flex; height: 66px; align-items: center; justify-content: space-between; padding: 0 28px; background: rgba(255,255,255,.98); border-bottom: 1px solid var(--border); }
.topbar__left, .topbar__right, .breadcrumbs, .breadcrumbs span, .last-update, .user-menu > button { display: flex; align-items: center; }
.topbar__right { gap: 8px; }
.breadcrumbs { gap: 4px; color: var(--gray-500); font-size: 13px; }
.breadcrumbs span { gap: 4px; }
.breadcrumbs button { padding: 4px; color: var(--gray-500); background: transparent; border: 0; }
.breadcrumbs button:hover { color: var(--blue); }
.breadcrumbs strong { color: var(--ink); font-weight: 650; }
.last-update { gap: 9px; margin-right: 10px; padding-right: 16px; color: var(--gray-500); border-right: 1px solid var(--border); font-size: 10px; line-height: 1.25; }
.last-update i { width: 8px; height: 8px; background: #22a06b; border-radius: 50%; box-shadow: 0 0 0 4px #e2f4ec; }
.last-update strong { color: var(--gray-700); font-size: 11px; font-weight: 600; }
.icon-btn { position: relative; display: inline-grid; width: 38px; height: 38px; place-items: center; padding: 0; color: var(--gray-700); background: transparent; border: 1px solid transparent; border-radius: 50%; }
.icon-btn:hover { color: var(--blue); background: var(--blue-pale); border-color: var(--blue-light); }
.has-notification::after { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; background: var(--red); border: 2px solid white; border-radius: 50%; content: ""; }
.mobile-menu { display: none; }
.user-menu { position: relative; margin-left: 3px; }
.user-menu > button { gap: 9px; padding: 5px 7px; background: transparent; border: 1px solid transparent; border-radius: 6px; text-align: left; }
.user-menu > button:hover { border-color: var(--border); background: var(--gray-50); }
.avatar { display: grid; width: 35px; height: 35px; place-items: center; color: white; background: var(--blue); border-radius: 50%; font-size: 12px; font-weight: 750; }
.user-copy { display: grid; min-width: 132px; }
.user-copy strong { color: var(--ink); font-size: 12px; }
.user-copy small { color: var(--gray-500); font-size: 10px; }
.user-dropdown { position: absolute; top: calc(100% + 8px); right: 0; display: none; width: 190px; padding: 7px; background: white; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 14px 32px rgba(0, 35, 65, .18); }
.user-menu.is-open .user-dropdown { display: grid; }
.user-dropdown button { display: flex; align-items: center; gap: 9px; padding: 9px; background: transparent; border: 0; border-radius: 5px; text-align: left; }
.user-dropdown button:hover { color: var(--blue); background: var(--blue-pale); }

.main-content { width: 100%; max-width: 1540px; margin: 0 auto; padding: 28px 30px 48px; }
.app-footer { display: flex; justify-content: space-between; padding: 14px 30px; color: var(--gray-500); background: white; border-top: 1px solid var(--border); font-size: 11px; }
.page-header { display: flex; min-height: 61px; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 21px; }
.page-header p { max-width: 780px; margin-bottom: 0; color: var(--gray-500); font-size: 14px; }
.page-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }

.btn { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border: 1px solid transparent; border-radius: 5px; font-weight: 650; line-height: 1.1; transition: background var(--ease), color var(--ease), border-color var(--ease), transform var(--ease); }
.btn:active { transform: translateY(1px); }
.btn--primary { color: white; background: var(--blue); border-color: var(--blue); }
.btn--primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn--secondary { color: var(--blue); background: white; border-color: var(--blue); }
.btn--secondary:hover { background: var(--blue-pale); }
.btn--danger { color: white; background: var(--red); border-color: var(--red); }
.btn--danger:hover { background: var(--red-dark); }
.btn--ghost { color: var(--gray-700); background: white; border-color: var(--border); }
.btn--ghost:hover { color: var(--blue); border-color: var(--blue); }
.btn--text { color: var(--blue); background: transparent; border-color: transparent; }
.btn--text:hover { text-decoration: underline; }
.btn:disabled, button:disabled { cursor: not-allowed; opacity: .48; }
.link-btn { display: inline-flex; align-items: center; gap: 5px; padding: 0; color: var(--blue); background: transparent; border: 0; font-weight: 650; }
.link-btn:hover { text-decoration: underline; }
.icon-action { display: inline-grid; width: 32px; height: 32px; place-items: center; padding: 0; color: var(--gray-700); background: white; border: 1px solid var(--border); border-radius: 5px; }
.icon-action:hover { color: var(--blue); border-color: var(--blue); }

.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi-grid--four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { min-width: 0; padding: 15px 16px 13px; background: white; border: 1px solid var(--border); border-top: 3px solid var(--blue); border-radius: 6px; box-shadow: 0 1px 3px rgba(0,40,75,.035); text-align: left; }
button.kpi { width: 100%; }
button.kpi:hover { border-color: #a9c6db; box-shadow: var(--shadow); }
.kpi--red { border-top-color: var(--red); }
.kpi--green { border-top-color: var(--success); }
.kpi--gray { border-top-color: var(--gray-500); }
.kpi__top { display: flex; align-items: center; gap: 8px; color: var(--gray-500); }
.kpi__icon { display: grid; width: 29px; height: 29px; place-items: center; color: var(--blue); background: var(--blue-pale); border-radius: 5px; }
.kpi--red .kpi__icon { color: var(--red); background: var(--red-light); }
.kpi--green .kpi__icon { color: var(--success); background: var(--success-bg); }
.kpi__label { min-width: 0; font-size: 11px; font-weight: 650; letter-spacing: .01em; }
.kpi__value { display: block; margin-top: 10px; color: var(--blue-dark); font-size: 24px; line-height: 1.1; letter-spacing: -.02em; }
.kpi__meta { display: block; min-height: 17px; margin-top: 5px; color: var(--gray-500); font-size: 11px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(310px, .8fr); gap: 18px; margin-bottom: 18px; }
.grid-2--equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.stack { display: grid; gap: 18px; }
.panel { min-width: 0; margin-bottom: 18px; background: white; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,30,60,.025); }
.panel__header { display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel__header p { margin: 0; color: var(--gray-500); font-size: 12px; }
.panel__body { padding: 18px; }
.panel--flush .panel__body { padding: 0; }
.panel--accent { border-top: 3px solid var(--blue); }
.panel--warning { border-left: 4px solid #d79a1d; }
.panel--danger { border-left: 4px solid var(--red); }
.section-label { display: flex; align-items: center; gap: 8px; margin: 8px 0 12px; color: var(--blue-dark); font-size: 13px; font-weight: 750; text-transform: uppercase; letter-spacing: .045em; }
.section-label::after { height: 1px; flex: 1; background: var(--border); content: ""; }

.badge { display: inline-flex; max-width: 100%; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 30px; font-size: 11px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.badge--success { color: #096641; background: var(--success-bg); }
.badge--warning { color: var(--warning); background: var(--warning-bg); }
.badge--danger { color: var(--danger); background: var(--red-light); }
.badge--neutral { color: var(--gray-700); background: var(--gray-100); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; color: var(--blue-dark); background: var(--blue-light); border-radius: 4px; font-size: 11px; font-weight: 600; }

.filter-panel { margin-bottom: 18px; padding: 14px 15px; background: white; border: 1px solid var(--border); border-radius: 7px; }
.filter-grid { display: grid; grid-template-columns: minmax(190px, 1.25fr) repeat(3, minmax(135px, .8fr)) auto; align-items: end; gap: 10px; }
.field { display: grid; min-width: 0; gap: 5px; }
.field > span { color: var(--gray-700); font-size: 11px; font-weight: 700; }
.field input, .field select, .field textarea, .form-control { width: 100%; min-height: 38px; padding: 8px 10px; background: white; border: 1px solid #b9c2c9; border-radius: 5px; outline: none; transition: border-color var(--ease), box-shadow var(--ease); }
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .form-control:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,90,156,.13); }
.field small { color: var(--gray-500); font-size: 11px; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; top: 10px; left: 10px; color: var(--gray-500); }
.input-icon input { padding-left: 34px; }
.filter-actions { display: flex; align-items: center; gap: 6px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.active-filters[hidden] { display: none; }
.more-filters { display: none; grid-column: 1/-1; grid-template-columns: repeat(4, 1fr); gap: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.filter-panel.is-expanded .more-filters { display: grid; }

.table-card { overflow: hidden; background: white; border: 1px solid var(--border); border-radius: 7px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
caption { padding: 12px 15px; color: var(--gray-500); text-align: left; }
thead { color: white; background: var(--blue-dark); }
th { padding: 0; text-align: left; white-space: nowrap; }
.th-sort { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 7px; padding: 11px 12px; color: inherit; background: transparent; border: 0; font-size: 11px; font-weight: 700; text-align: left; }
.th-sort:hover { background: rgba(255,255,255,.08); }
.sort-mark { opacity: .5; }
td { max-width: 320px; padding: 11px 12px; border-bottom: 1px solid #e8ebed; vertical-align: middle; }
tbody tr { transition: background var(--ease); }
tbody tr:nth-child(even) { background: #fbfcfd; }
tbody tr:hover { background: var(--blue-pale); }
tbody tr:last-child td { border-bottom: 0; }
.table-card--compact td { padding-top: 9px; padding-bottom: 9px; }
.table-primary { display: grid; gap: 2px; min-width: 150px; }
.table-primary strong { color: var(--blue-dark); }
.table-primary small { color: var(--gray-500); }
.table-actions { display: flex; gap: 5px; white-space: nowrap; }
.table-footer { display: flex; min-height: 49px; align-items: center; justify-content: space-between; padding: 8px 13px; color: var(--gray-500); background: var(--gray-50); border-top: 1px solid var(--border); font-size: 11px; }
.pagination { display: flex; gap: 4px; }
.pagination button, .pagination span { display: grid; min-width: 30px; height: 30px; place-items: center; background: white; border: 1px solid var(--border); border-radius: 4px; }
.pagination .is-current { color: white; background: var(--blue); border-color: var(--blue); }
.empty-inline { display: flex; min-height: 150px; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--gray-500); }

.tabs { display: flex; gap: 2px; margin-bottom: 18px; overflow-x: auto; background: white; border-bottom: 1px solid var(--border); }
.tab { position: relative; min-height: 45px; padding: 10px 16px; color: var(--gray-500); background: transparent; border: 0; white-space: nowrap; font-weight: 650; }
.tab:hover { color: var(--blue); background: var(--blue-pale); }
.tab.is-active { color: var(--blue-dark); }
.tab.is-active::after { position: absolute; right: 10px; bottom: -1px; left: 10px; height: 3px; background: var(--red); content: ""; }

.stepper { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 20px; padding: 0; list-style: none; background: white; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.step { position: relative; }
.step:not(:last-child)::after { position: absolute; z-index: 0; top: 24px; right: -50%; left: 50%; height: 2px; background: var(--border); content: ""; }
.step.is-complete:not(:last-child)::after { background: #72b596; }
.step button { position: relative; z-index: 1; display: flex; width: 100%; align-items: center; justify-content: center; gap: 9px; padding: 12px 7px; background: white; border: 0; }
.step button span { display: grid; width: 28px; height: 28px; place-items: center; color: var(--gray-500); background: var(--gray-100); border: 2px solid var(--border); border-radius: 50%; font-size: 11px; font-weight: 750; }
.step button strong { color: var(--gray-500); font-size: 12px; }
.step.is-active button span { color: white; background: var(--blue); border-color: var(--blue); }
.step.is-active button strong { color: var(--blue-dark); }
.step.is-complete button span { color: white; background: var(--success); border-color: var(--success); }
.wizard-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(270px, .65fr); gap: 18px; }
.wizard-layout .panel { margin-bottom: 0; }
.wizard-summary { position: sticky; top: 84px; align-self: start; }
.wizard-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding: 15px 0 0; border-top: 1px solid var(--border); }
.wizard-actions > div { display: flex; gap: 8px; }
.form-section { margin-bottom: 22px; }
.form-section:last-child { margin-bottom: 0; }
.form-section h3 { margin-bottom: 10px; padding-bottom: 7px; color: var(--blue-dark); border-bottom: 1px solid var(--border); font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field--wide { grid-column: 1/-1; }
.required { color: var(--red); }
.validation-message { display: none; color: var(--danger); font-size: 11px; }
.field.has-error input, .field.has-error select { border-color: var(--red); }
.field.has-error .validation-message { display: block; }

.definition-list { margin: 0; }
.definition-list > div { display: grid; grid-template-columns: minmax(110px, .75fr) minmax(0, 1.25fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid #edf0f2; }
.definition-list > div:last-child { border-bottom: 0; }
.definition-list dt { color: var(--gray-500); font-size: 11px; }
.definition-list dd { margin: 0; color: var(--ink); font-size: 12px; font-weight: 650; text-align: right; overflow-wrap: anywhere; }
.metric-row { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.metric { min-width: 0; padding: 14px 16px; background: white; border-right: 1px solid var(--border); }
.metric:last-child { border-right: 0; }
.metric span, .metric small { display: block; color: var(--gray-500); font-size: 11px; }
.metric strong { display: block; margin: 4px 0; color: var(--blue-dark); font-size: 18px; }
.result-hero { display: grid; grid-template-columns: minmax(280px,.7fr) minmax(0,1.3fr); min-height: 294px; margin-bottom: 18px; background: white; border: 1px solid var(--border); border-top: 4px solid var(--blue); border-radius: 8px; overflow: hidden; }
.result-summary { display: flex; flex-direction: column; justify-content: center; padding: 26px 28px; background: linear-gradient(135deg, #f7fbfe, #fff); border-right: 1px solid var(--border); }
.eyebrow { color: var(--gray-500); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .075em; }
.result-number { display: block; margin: 8px 0 0; color: var(--blue-dark); font-size: 46px; line-height: 1; letter-spacing: -.045em; }
.result-unit { display: block; margin: 4px 0 12px; color: var(--gray-700); font-size: 15px; }
.confidence { margin: 0 0 15px; color: var(--gray-500); font-size: 12px; }
.result-mini { display: flex; gap: 22px; margin-top: 18px; }
.result-mini span { color: var(--gray-500); font-size: 10px; }
.result-mini strong { display: block; color: var(--ink); font-size: 14px; }
.result-chart { min-width: 0; padding: 18px; }
.interpretation { display: flex; align-items: flex-start; gap: 12px; padding: 15px 17px; color: var(--blue-dark); background: var(--blue-pale); border-left: 4px solid var(--blue); border-radius: 4px; }
.interpretation p { margin: 0; }
.method-state { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; background: var(--gray-50); border: 1px solid var(--border); border-radius: 6px; }

.chart-card { min-width: 0; margin: 0; padding: 17px 18px 12px; background: white; border: 1px solid var(--border); border-radius: 8px; }
.chart-card figcaption { display: flex; min-height: 42px; align-items: flex-start; justify-content: space-between; gap: 12px; }
.chart-card figcaption p, .chart-note { margin: 0; color: var(--gray-500); font-size: 11px; }
.chart-wrap { position: relative; min-width: 0; }
.chart-svg, .mini-chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-svg { max-height: 330px; }
.mini-chart { height: 118px; }
.grid-line { stroke: #e6eaed; stroke-width: 1; }
.axis-label { fill: #66717c; font-size: 10px; }
.axis-title { fill: #43515c; font-size: 10px; font-weight: 650; }
.line { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.7; }
.line--observed { stroke: var(--blue); }
.line--counter { stroke: #718699; stroke-dasharray: 6 5; }
.post-area { fill: #f5f9fc; }
.confidence-band { fill: #9ec7e3; opacity: .23; }
.area-fill { fill: #c3dced; opacity: .45; }
.intervention-line, .threshold-line { stroke: var(--red); stroke-width: 1.4; stroke-dasharray: 5 4; }
.intervention-label { fill: var(--red-dark); font-size: 9px; font-weight: 700; }
.zero-line { stroke: #7c8790; stroke-width: 1.25; }
.chart-point { stroke: white; stroke-width: 2; transition: r var(--ease); }
.chart-point:hover, .chart-point:focus { r: 7; }
.chart-point--observed { fill: var(--blue); }
.chart-point--counter { fill: #718699; }
.chart-legend { display: flex; justify-content: flex-end; gap: 15px; margin: 0 6px 3px; color: var(--gray-500); font-size: 10px; }
.chart-legend span { display: flex; align-items: center; gap: 5px; }
.legend-line { width: 18px; height: 2px; }
.legend-line.observed { background: var(--blue); }
.legend-line.counter { background: repeating-linear-gradient(90deg,#718699 0 5px,transparent 5px 8px); }
.legend-band { width: 18px; height: 8px; background: rgba(99,164,207,.28); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.before { background: #8393a1; }
.legend-dot.after { background: var(--blue); }
.event-point line { stroke: var(--blue); stroke-width: 1.7; }
.event-point circle { fill: var(--blue); stroke: white; stroke-width: 2; }
.forest-row line { stroke: #4f7896; stroke-width: 2; }
.forest-row circle { fill: var(--blue); stroke: white; stroke-width: 2; }
.segment-label { fill: #43515c; font-size: 10px; font-weight: 600; }
.heat-cell { stroke: white; stroke-width: 1; transition: opacity var(--ease); }
g:hover > .heat-cell { opacity: .82; }
.heat-value { fill: var(--ink); font-size: 11px; font-weight: 750; }
.heat-value.is-light { fill: white; }
.hist-bar { fill: var(--blue); transition: fill var(--ease); }
g:hover > .hist-bar { fill: var(--blue-dark); }
.bar-label { fill: var(--blue-dark); font-size: 10px; font-weight: 700; }
.balance-link { stroke: #bdc6cd; stroke-width: 2; }
.balance-before { fill: #8795a0; }
.balance-after { fill: var(--blue); }
.chart-note { padding: 4px 3px 0; }
.chart-tooltip { position: fixed; z-index: 5000; max-width: 240px; padding: 7px 9px; color: white; background: rgba(25,40,52,.94); border-radius: 4px; box-shadow: 0 5px 16px rgba(0,0,0,.2); font-size: 11px; pointer-events: none; transform: translate(-50%, -115%); }
.hbars { display: grid; gap: 12px; padding: 16px 4px; }
.hbar { display: grid; grid-template-columns: 130px 1fr 28px; align-items: center; gap: 10px; color: var(--gray-700); font-size: 11px; }
.hbar > div { height: 10px; background: var(--gray-100); border-radius: 2px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--blue); border-radius: 2px; }
.hbar strong { color: var(--blue-dark); }

.alert-list { display: grid; gap: 9px; }
.alert-row { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 11px; padding: 10px 11px; background: var(--gray-50); border: 1px solid #e5e9ec; border-radius: 5px; }
.alert-dot { width: 8px; height: 8px; background: #d39823; border-radius: 50%; }
.alert-dot--high { background: var(--red); }
.alert-row strong { display: block; font-size: 12px; }
.alert-row small { color: var(--gray-500); font-size: 10px; }
.timeline { position: relative; display: grid; gap: 0; margin-left: 7px; }
.timeline::before { position: absolute; top: 10px; bottom: 10px; left: 6px; width: 1px; background: var(--border); content: ""; }
.timeline-item { position: relative; display: grid; grid-template-columns: 14px 55px 1fr; gap: 10px; padding: 7px 0 12px; }
.timeline-item > i { z-index: 1; width: 13px; height: 13px; margin-top: 3px; background: white; border: 3px solid var(--blue); border-radius: 50%; }
.timeline-item time { color: var(--gray-500); font-size: 10px; }
.timeline-item strong { display: block; font-size: 11px; }
.timeline-item small { color: var(--gray-500); font-size: 10px; }

.callout { display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px; border: 1px solid #b9d5e8; background: var(--blue-pale); border-radius: 6px; }
.callout--warning { color: #654400; background: var(--warning-bg); border-color: #ead19a; }
.callout--danger { color: var(--danger); background: var(--red-light); border-color: #ebbbb7; }
.callout p { margin: 0; font-size: 12px; }
.check-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.check-list li { display: flex; align-items: flex-start; gap: 8px; }
.check-list svg { margin-top: 1px; color: var(--success); }
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.choice-card { position: relative; display: block; padding: 15px; background: white; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; transition: border-color var(--ease), background var(--ease); }
.choice-card:hover { border-color: var(--blue); }
.choice-card.is-selected { background: var(--blue-pale); border: 2px solid var(--blue); }
.choice-card input { position: absolute; top: 13px; right: 13px; }
.choice-card strong { display: block; padding-right: 24px; color: var(--blue-dark); }
.choice-card small { display: block; margin-top: 5px; color: var(--gray-500); }
.diagnostic-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.diagnostic-card { min-width: 0; padding: 14px; background: white; border: 1px solid var(--border); border-top: 3px solid var(--success); border-radius: 6px; }
.diagnostic-card.warning { border-top-color: #d39823; }
.diagnostic-card strong { display: block; margin: 7px 0 3px; color: var(--blue-dark); font-size: 13px; }
.diagnostic-card small { color: var(--gray-500); font-size: 10px; }
.progress { height: 7px; background: var(--gray-100); border-radius: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--blue); border-radius: inherit; transition: width .4s ease; }

.processing-screen { min-height: 560px; padding: 55px 20px; text-align: center; }
.processing-mark { position: relative; width: 78px; height: 78px; margin: 0 auto 22px; }
.processing-mark::before, .processing-mark::after { position: absolute; inset: 0; border: 4px solid var(--blue-light); border-top-color: var(--blue); border-radius: 50%; content: ""; animation: spin 1.2s linear infinite; }
.processing-mark::after { inset: 12px; border-width: 3px; border-top-color: var(--red); animation-direction: reverse; animation-duration: .8s; }
.processing-screen.is-done .processing-mark::before, .processing-screen.is-done .processing-mark::after { display: none; }
.processing-screen.is-done .processing-mark { display: grid; place-items: center; color: white; background: var(--success); border-radius: 50%; }
.processing-screen h1 { font-size: 26px; }
.processing-screen > p { color: var(--gray-500); }
.processing-progress { max-width: 620px; margin: 28px auto; padding: 20px; background: white; border: 1px solid var(--border); border-radius: 8px; }
.processing-progress__top { display: flex; justify-content: space-between; margin-bottom: 9px; color: var(--gray-700); font-size: 12px; }
.processing-steps { display: grid; max-width: 620px; margin: 22px auto; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.processing-steps span { padding: 8px 4px; color: var(--gray-500); background: var(--gray-100); border-radius: 4px; font-size: 9px; }
.processing-steps span.is-current { color: var(--blue-dark); background: var(--blue-light); font-weight: 700; }
.processing-steps span.is-done { color: var(--success); background: var(--success-bg); }
.skeleton-line { height: 12px; margin: 9px 0; background: linear-gradient(90deg,#edf0f2 25%,#f8f9fa 50%,#edf0f2 75%); background-size: 200% 100%; border-radius: 3px; animation: shimmer 1.4s infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }

.report-catalog { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.report-card { display: flex; min-height: 185px; flex-direction: column; padding: 17px; background: white; border: 1px solid var(--border); border-top: 3px solid var(--blue); border-radius: 7px; }
.report-card.learning { border-top-color: var(--success); }
.report-card .report-icon { display: grid; width: 38px; height: 38px; place-items: center; color: var(--blue); background: var(--blue-pale); border-radius: 5px; }
.report-card h3 { margin: 13px 0 5px; color: var(--blue-dark); }
.report-card p { flex: 1; margin-bottom: 14px; color: var(--gray-500); font-size: 11px; }
.report-meta { display: flex; align-items: center; justify-content: space-between; gap: 7px; padding-top: 10px; border-top: 1px solid var(--border); color: var(--gray-500); font-size: 10px; }

.quality-score { display: flex; align-items: center; gap: 17px; }
.score-ring { --score: 96; position: relative; display: grid; width: 84px; height: 84px; flex: 0 0 auto; place-items: center; background: conic-gradient(var(--blue) calc(var(--score) * 1%), var(--gray-100) 0); border-radius: 50%; }
.score-ring::before { position: absolute; inset: 9px; background: white; border-radius: 50%; content: ""; }
.score-ring strong { z-index: 1; color: var(--blue-dark); font-size: 19px; }
.score-copy p { margin: 4px 0 0; color: var(--gray-500); font-size: 11px; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch i { position: relative; width: 38px; height: 21px; background: #9ba6ae; border-radius: 20px; transition: background var(--ease); }
.switch i::after { position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; background: white; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.25); content: ""; transition: transform var(--ease); }
.switch input:checked + i { background: var(--blue); }
.switch input:checked + i::after { transform: translateX(17px); }
.privacy-value { color: var(--gray-500); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.privacy-value.revealed { color: var(--ink); }

.modal-backdrop { position: fixed; z-index: 2000; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(0,31,57,.56); backdrop-filter: blur(1px); animation: fadeIn var(--ease); }
.modal { width: min(540px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; background: white; border-radius: 9px; box-shadow: 0 24px 70px rgba(0,25,48,.32); }
.modal--wide { width: min(780px, 100%); }
.modal__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 19px 21px 15px; border-bottom: 1px solid var(--border); }
.modal__header p { margin: 3px 0 0; color: var(--gray-500); font-size: 12px; }
.modal__close { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; color: var(--gray-500); background: transparent; border: 0; border-radius: 50%; }
.modal__close:hover { color: var(--blue); background: var(--blue-pale); }
.modal__body { padding: 20px 21px; }
.modal__footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 21px; background: var(--gray-50); border-top: 1px solid var(--border); }
.modal-error { min-height: 20px; margin: 7px 0 0; color: var(--danger); font-size: 11px; }
.drawer { position: fixed; z-index: 1500; top: 0; right: 0; bottom: 0; width: min(430px, 92vw); background: white; box-shadow: -12px 0 35px rgba(0,30,55,.2); animation: slideIn var(--ease); }
.drawer-backdrop { position: fixed; z-index: 1499; inset: 0; background: rgba(0,31,57,.32); }
.drawer__header { display: flex; height: 70px; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--border); }
.drawer__body { height: calc(100% - 70px); padding: 18px 20px; overflow-y: auto; }
.notification-item { display: grid; grid-template-columns: 34px 1fr; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.notification-item > i { display: grid; width: 34px; height: 34px; place-items: center; color: var(--blue); background: var(--blue-pale); border-radius: 50%; }
.notification-item strong { display: block; font-size: 12px; }
.notification-item p { margin: 3px 0; color: var(--gray-500); font-size: 11px; }
.notification-item time { color: var(--gray-500); font-size: 10px; }
.toast-region { position: fixed; z-index: 3500; right: 22px; bottom: 22px; display: grid; gap: 9px; }
.toast { display: grid; min-width: 310px; max-width: 390px; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; padding: 13px 14px; color: white; background: #233540; border-left: 4px solid #55b98a; border-radius: 6px; box-shadow: 0 14px 32px rgba(0,0,0,.24); animation: toastIn .25s ease; }
.toast button { color: white; background: transparent; border: 0; }
.toast strong { display: block; font-size: 12px; }
.toast small { color: #cfdae0; font-size: 10px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideIn { from { transform: translateX(100%); } }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } }

.internal-shell { min-height: 100vh; color: var(--ink); background: #eef2f5; }
.internal-header { position: sticky; z-index: 10; top: 0; display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 16px; padding: 10px max(24px, calc((100vw - 1200px)/2)); color: white; background: var(--blue-dark); }
.internal-header strong { display: block; font-size: 18px; }
.internal-header span { color: #c6dae9; font-size: 11px; }
.internal-main { display: grid; max-width: 1200px; grid-template-columns: 235px minmax(0,1fr); gap: 20px; margin: 0 auto; padding: 24px; }
.guide-nav { position: sticky; top: 92px; align-self: start; padding: 12px; background: white; border: 1px solid var(--border); border-radius: 7px; }
.guide-nav a { display: block; padding: 7px 9px; color: var(--gray-700); border-radius: 4px; font-size: 11px; text-decoration: none; }
.guide-nav a:hover { color: var(--blue); background: var(--blue-pale); }
.guide-content { min-width: 0; }
.guide-content > section { margin-bottom: 18px; padding: 22px; background: white; border: 1px solid var(--border); border-radius: 8px; }
.guide-content h2 { scroll-margin-top: 88px; }
.guide-content h3 { margin-top: 18px; color: var(--blue-dark); }
.guide-content p, .guide-content li { font-size: 12px; }
.flow-diagram { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 15px; background: var(--blue-pale); border: 1px solid var(--blue-light); border-radius: 6px; }
.flow-diagram span { padding: 8px 11px; background: white; border: 1px solid #aac9dd; border-radius: 4px; font-weight: 650; }
.flow-diagram i { color: var(--blue); font-style: normal; }
.route-code { color: var(--blue-dark); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }

.accordion { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.accordion + .accordion { margin-top: 8px; }
.accordion > button { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 12px 14px; background: white; border: 0; font-weight: 700; text-align: left; }
.accordion > button:hover { background: var(--blue-pale); }
.accordion > button svg { transition: transform var(--ease); }
.accordion.is-open > button svg { transform: rotate(180deg); }
.accordion__body { display: none; padding: 0 14px 14px; color: var(--gray-700); }
.accordion.is-open .accordion__body { display: block; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.split-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 10px; }
.split-title h2, .split-title h3 { margin: 0; }
.stat-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.stat-line:last-child { border-bottom: 0; }
.stat-line span { color: var(--gray-500); }
.stat-line strong { color: var(--blue-dark); }
.hidden { display: none !important; }

@media (max-width: 1180px) {
  :root { --sidebar: 244px; }
  .main-content { padding-right: 20px; padding-left: 20px; }
  .filter-grid { grid-template-columns: minmax(170px,1.2fr) repeat(2,minmax(130px,.8fr)); }
  .filter-actions { grid-column: 1/-1; justify-content: flex-end; }
  .kpi-grid { grid-template-columns: repeat(3,1fr); }
  .diagnostic-grid { grid-template-columns: repeat(3,1fr); }
  .report-catalog { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform var(--ease); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-scrim { position: fixed; z-index: 35; inset: 0; display: block; background: rgba(0,24,45,.45); }
  .sidebar-close, .mobile-menu { display: inline-grid; }
  .workspace { width: 100%; margin-left: 0; }
  .topbar { padding: 0 16px; }
  .last-update { display: none; }
  .grid-2, .grid-2--equal, .wizard-layout, .result-hero { grid-template-columns: 1fr; }
  .result-summary { border-right: 0; border-bottom: 1px solid var(--border); }
  .wizard-summary { position: static; }
  .choice-grid { grid-template-columns: 1fr; }
  .internal-main { grid-template-columns: 1fr; }
  .guide-nav { position: static; display: flex; overflow-x: auto; }
  .guide-nav a { white-space: nowrap; }
}

@media (max-width: 680px) {
  .topbar { height: 58px; }
  .breadcrumbs span:not(:last-child), .user-copy, .user-menu > button > svg { display: none; }
  .main-content { padding: 20px 14px 40px; }
  .page-header { flex-direction: column; }
  .page-actions { width: 100%; flex-wrap: wrap; }
  .page-actions .btn { flex: 1; }
  .kpi-grid, .kpi-grid--four, .grid-3, .metric-row, .diagnostic-grid, .report-catalog { grid-template-columns: 1fr 1fr; }
  .filter-grid, .more-filters, .form-grid, .form-grid--three { grid-template-columns: 1fr; }
  .filter-actions { justify-content: stretch; flex-wrap: wrap; }
  .filter-actions .btn { flex: 1; }
  .step button { flex-direction: column; gap: 3px; }
  .step button strong { font-size: 9px; }
  .wizard-actions { align-items: stretch; flex-direction: column-reverse; gap: 9px; }
  .wizard-actions > div { display: grid; grid-template-columns: repeat(2,1fr); }
  .processing-steps { grid-template-columns: repeat(3,1fr); }
  .app-footer { flex-direction: column; gap: 3px; }
}

@media (max-width: 440px) {
  .kpi-grid, .kpi-grid--four, .grid-3, .metric-row, .diagnostic-grid, .report-catalog { grid-template-columns: 1fr; }
  .metric { border-right: 0; border-bottom: 1px solid var(--border); }
  .result-number { font-size: 38px; }
}

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