@layer base, components, responsive, print;

@layer base {
  :root {
    color-scheme: light;
    --ink:#142839;
    --muted:#526778;
    --line:#dce5eb;
    --surface:#fff;
    --page:#f1f5f7;
    --navy:#112737;
    --teal:#0b6a69;
    --teal-dark:#075553;
    --pale:#e8f3f3;
    --red:#a72f42;
    --va:#17805f;
    --nnva:#9b5a04;
    --nva:#bd4450;
    --unclassified:#69778b;
    font:14px/1.45 "Segoe UI",system-ui,sans-serif;
    color:var(--ink);
    background:var(--page);
  }
  * { box-sizing:border-box }
  body { margin:0 }
  h1,h2,h3,p { margin:0 }
  h1,h2,h3 { line-height:1.19 }
  h1 { font-size:clamp(1.55rem,2.25vw,2.35rem); letter-spacing:-.035em; overflow-wrap:anywhere }
  h2 { font-size:1.15rem; letter-spacing:-.02em; overflow-wrap:anywhere }
  h3 { font-size:.96rem }
  a { color:var(--teal-dark); text-underline-offset:3px }
  button,input,textarea,select { font:inherit; color:inherit }
  button,summary,select { cursor:pointer }
  button:disabled { cursor:default }
  svg { flex:none; vertical-align:middle }
  :focus-visible { outline:2px solid #268d96; outline-offset:3px }
  [hidden] { display:none!important }
  .muted { color:var(--muted) }
  .skip { position:fixed; left:12px; top:0; z-index:20; background:white; padding:8px; transform:translateY(-110%) }
  .skip:focus { transform:none }
}

@layer components {
  .topbar { display:flex; justify-content:space-between; align-items:center; gap:14px; padding:9px 22px; min-height:62px; background:var(--surface); border-bottom:1px solid var(--line) }
  .brand { display:inline-flex; align-items:flex-start; gap:9px; min-width:0; max-width:100%; line-height:1.15; color:var(--ink); cursor:pointer; text-decoration:none }
  .brand-name { display:grid; min-width:0; gap:2px }
  .brand strong { font-size:1.4rem; line-height:1.05; font-weight:720; letter-spacing:-.02em }
  .brand small { color:var(--teal-dark); font-size:.78rem; font-weight:650 }
  .adaptive-mark { display:block; flex:none; width:36px; height:35px }
  .toolbar,.workspace-actions,.chart-controls,.form-actions,.welcome-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap }
  .toolbar { gap:5px; justify-content:flex-end }
  .button { display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:36px; padding:6px 11px; border:1px solid var(--line); border-radius:6px; background:var(--surface); font-weight:650; white-space:nowrap }
  .button:hover:not(:disabled) { background:#f0f6f8; border-color:#bacdd7 }
  .button:disabled { opacity:.42 }
  .button.primary { background:var(--teal); color:white; border-color:var(--teal) }
  .button.primary:hover { background:var(--teal-dark); border-color:var(--teal-dark) }
  .button.quiet,.button.icon { background:transparent; border-color:transparent }
  .button.icon { width:36px; padding:0 }
  .button.danger-outline { color:var(--red) }
  .button.danger { background:var(--red); border-color:var(--red); color:white }
  .button.danger:hover { background:#872736; border-color:#872736 }
  .divider { height:24px; width:1px; background:var(--line); margin-inline:4px }
  .shell { --nav-width:216px; display:grid; grid-template-columns:var(--nav-width) minmax(0,1fr); min-height:calc(100vh - 62px) }
  .shell.collapsed { --nav-width:59px }
  .shell.welcome-shell { display:block }
  .sidebar { position:sticky; top:0; align-self:start; display:flex; flex-direction:column; gap:12px; background:var(--navy); color:#e6f2f4; padding:22px 12px 17px; min-height:calc(100vh - 62px) }
  .shell { background:linear-gradient(90deg,var(--navy) 0 var(--nav-width),var(--page) var(--nav-width)) }
  .welcome-shell,.expanded .shell { background:var(--page) }
  .nav-heading { margin:0 9px; font-size:.7rem; letter-spacing:.14em; color:#adc4cf; font-weight:730 }
  .sidebar nav { display:grid; gap:4px }
  .nav-link { width:100%; border:1px solid transparent; background:transparent; color:#e3eff4; padding:9px 8px; min-height:40px; text-align:left; display:flex; align-items:center; gap:9px; border-radius:6px }
  .nav-link[aria-current],.nav-link:hover { background:#204252; border-color:#31586c }
  .nav-link[aria-current] { color:#c5f3ed; font-weight:700 }
  .sidebar-footer { margin-top:auto; padding:16px 7px 0; display:grid; gap:8px; border-top:1px solid #365061 }
  .sidebar-footer a { color:#cde2e9; text-decoration:none; font-size:.84rem }
  .sidebar-footer a:hover { text-decoration:underline }
  .local-banner { display:flex; gap:7px; align-items:center; color:#d9ecee; font-size:.75rem; margin-bottom:5px }
  .live-dot { background:#65d4ab; width:7px; height:7px; flex:none; border-radius:50% }
  .collapsed .nav-heading,.collapsed .nav-link span,.collapsed .sidebar-footer { display:none }
  .collapsed .sidebar { padding-inline:7px }
  .collapsed .nav-link { justify-content:center }
  .expanded .sidebar { display:none }
  .expanded .shell { display:block }
  #main { min-width:0; padding:20px clamp(12px,2vw,28px) 30px }
  .welcome-shell #main { padding:0 }
  .workspace-header { display:flex; justify-content:space-between; align-items:end; gap:14px; margin-bottom:16px }
  .workspace-header .muted { margin-top:4px }
  .eyebrow { display:block; color:var(--teal-dark); font-size:.7rem; font-weight:800; letter-spacing:.12em; margin-bottom:6px }
  .workspace-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(260px,290px); gap:14px; align-items:start }
  .workspace-grid:has(.editor) { grid-template-columns:minmax(0,1fr) minmax(290px,340px) }
  .workspace-grid.solo { grid-template-columns:minmax(0,1fr) }
  .workspace-primary { display:grid; gap:14px; min-width:0 }
  .card { min-width:0; border:1px solid var(--line); background:var(--surface); border-radius:10px; box-shadow:0 2px 4px #20445907 }
  .metrics { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:8px }
  .metric { min-width:0; display:grid; align-content:start; gap:8px; padding:10px 12px; min-height:76px; background:var(--surface); border:1px solid var(--line); border-radius:8px }
  .metric-label { display:flex; align-items:center; gap:5px; font-weight:650; color:var(--muted); font-size:.79rem; line-height:1.2 }
  .metric-icon { display:inline-grid; place-items:center; color:var(--teal); background:var(--pale); padding:3px; border-radius:4px; flex:none }
  .metric-icon svg { width:13px; height:13px }
  .metric strong { font-size:clamp(1.02rem,1.45vw,1.55rem); line-height:1.12; letter-spacing:-.035em; overflow-wrap:anywhere; font-variant-numeric:tabular-nums }
  .metric-issue strong { color:var(--red) }
  .performance-more { margin:5px 0 10px }
  summary { list-style-position:inside; color:var(--teal-dark); font-weight:650 }
  .performance-more summary { padding:4px 2px; font-size:.82rem }
  .extra-metrics { margin-block:4px 9px }
  .extra-metrics .metric { min-height:64px }
  .panel-header { padding:14px 15px 11px }
  .panel-header p { font-size:.86rem; margin-top:4px }
  .chart-header { display:flex; justify-content:space-between; align-items:start; gap:8px; flex-wrap:wrap }
  .chart-controls { gap:6px }
  input:not([type=checkbox]),select,textarea { width:100%; min-width:0; background:white; border:1px solid #bfcdd6; border-radius:5px; padding:7px 8px; min-height:35px }
  .chart-controls select { width:auto; max-width:140px; font-size:.84rem }
  .zoom-controls { display:flex; align-items:center; border:1px solid var(--line); border-radius:6px }
  .zoom-controls .button { min-height:33px; font-size:.82rem; border:0 }
  .zoom-controls .button.icon { width:31px }
  .zoom-controls .zoom-readout { padding-inline:5px }
  .legend { display:flex; gap:6px 13px; flex-wrap:wrap; padding:0 15px 10px; color:var(--muted); font-size:.76rem }
  .legend span,.class-chip,.class-line span { display:inline-flex; align-items:center; gap:5px }
  .legend-dot,.swatch { width:10px; height:10px; border-radius:2px; flex:none }
  .takt-swatch { display:block; width:14px; border-top:2px dashed #344f6b }
  .chart-scroll { min-width:0; overflow:auto; margin-inline:10px; scrollbar-color:#a9bbca transparent; min-height:270px }
  .chart-svg { display:block; max-width:none }
  .chart-svg text { font-family:"Segoe UI",system-ui,sans-serif }
  .axis-label { font-size:10px; fill:#506777 }
  .gridline { stroke:#e4eaef }
  .baseline { stroke:#9badbc }
  .drop-zone { fill:transparent; pointer-events:all }
  .drop-zone.valid { fill:#e5f5ef; stroke:#add5c4; stroke-dasharray:3 3 }
  .drop-zone.invalid { fill:#fbedee }
  .drop-zone.hover { fill:#d1ede2; stroke:#4da68e; stroke-width:2 }
  .activity-block,.station-label[tabindex] { cursor:pointer }
  .activity-block { touch-action:none }
  .activity-block:focus-visible .block-fill,.activity-block:hover .block-fill,.activity-block.selected .block-fill { stroke:#102b43; stroke-width:2 }
  .activity-block.dragging { opacity:.64 }
  .block-text,.block-time { fill:white; font-size:10px; font-weight:720; pointer-events:none }
  .block-time { font-size:9.5px; font-weight:600 }
  .station-total,.station-name { fill:#182f41; font-weight:750; font-size:13px; pointer-events:none }
  .station-name,.station-detail,.bottleneck { pointer-events:auto }
  .station-detail { font-size:10px; fill:#526778 }
  .station-total.above,.station-detail.above,.bottleneck { fill:var(--red) }
  .bottleneck { font-size:9px; font-weight:800; letter-spacing:.08em }
  .takt-line { stroke:#284b70; stroke-width:1.5; stroke-dasharray:5 4; pointer-events:none }
  .takt-tag { fill:#e8eff7 }
  .takt-tag,.takt-text { pointer-events:none }
  .takt-text { fill:#1f4567; font-size:10px; font-weight:800 }
  .insertion { stroke:#142839; stroke-width:3; pointer-events:none }
  .drag-status { color:var(--teal-dark); font-weight:660; font-size:.82rem; padding-inline:15px; min-height:1.2em }
  .pool { margin:3px 13px 13px; padding:9px 10px; border:1px dashed #bacad5; border-radius:6px; background:#f7fafb; min-height:52px }
  .pool.valid { background:#e5f5ef; border-color:#72b69e }
  .pool.invalid { background:#fbedee }
  .pool.hover { background:#d1ede2; border-color:#39866f }
  .pool-heading { display:flex; align-items:center; gap:6px; color:#28485c }
  .pool .muted { font-size:.8rem; margin-top:4px }
  .pool-items { display:flex; gap:5px; flex-wrap:wrap; max-height:120px; overflow:auto; margin-top:6px; padding:4px }
  .pool-item { background:white; border:1px solid var(--line); border-radius:4px; padding:5px 7px; font-size:.78rem; text-align:left; touch-action:pan-y }
  .pool-item:hover,.pool-item.dragging { border-color:var(--teal); background:var(--pale) }
  .empty-chart { min-height:240px; display:grid; justify-items:center; align-content:center; gap:10px; color:#33556b; border:1px dashed var(--line); border-radius:6px; text-align:center; padding:12px }
  .empty-chart>svg { width:35px; height:35px }
  .side-heading { padding:12px 13px; display:flex; align-items:center; justify-content:space-between; gap:8px; border-bottom:1px solid var(--line) }
  .counter { display:inline-grid; place-items:center; min-width:22px; min-height:20px; padding:1px 5px; border-radius:4px; background:var(--pale); color:var(--teal-dark); font-size:.73rem; font-weight:750 }
  .insight-part { padding:11px 13px }
  .insight-part+.insight-part { border-top:1px solid var(--line) }
  .insight-part h3 { margin-bottom:8px }
  .alert-list { display:grid; gap:6px; padding:0; margin:0; list-style:none }
  .alert-link { width:100%; display:flex; align-items:flex-start; gap:7px; text-align:left; padding:7px; background:#fff7e9; color:#674a19; border:1px solid #f0dfbf; border-radius:5px; font-size:.79rem; line-height:1.32 }
  .alert-link svg { width:14px; height:14px; margin-top:1px }
  .alert-link:hover { filter:brightness(.97) }
  .severity-error .alert-link { background:#fff2f3; color:#802639; border-color:#efd3d8 }
  .severity-info .alert-link { background:#f0f6fa; color:#35566a; border-color:#d9e7ee }
  .healthy { display:flex; gap:6px; align-items:center; color:var(--teal-dark); font-size:.85rem }
  .more-alerts { margin-top:7px; font-size:.82rem }
  .more-alerts ul { max-height:220px; overflow:auto; margin-top:6px }
  .classification-bar>svg { display:block; height:8px; width:100%; margin:8px 0; background:var(--line); border-radius:4px }
  .class-line { display:flex; justify-content:space-between; align-items:center; gap:6px; padding-top:5px; font-size:.78rem; color:var(--muted) }
  .class-line strong { color:var(--ink); white-space:nowrap }
  .swatch.va { background:var(--va) } .fill-va { fill:var(--va) }
  .swatch.nnva { background:var(--nnva) } .fill-nnva { fill:var(--nnva) }
  .swatch.nva { background:var(--nva) } .fill-nva { fill:var(--nva) }
  .swatch.unclassified { background:var(--unclassified) } .fill-unclassified { fill:var(--unclassified) }
  .work-table summary { padding:12px 14px; border-bottom:1px solid var(--line); color:var(--ink) }
  .table-scroll { overflow:auto }
  table { border-collapse:collapse; text-align:left; width:100%; font-size:.85rem }
  th,td { padding:8px 10px; border-bottom:1px solid var(--line); vertical-align:top }
  th { background:#f5f8fa; color:#456073; font-size:.76rem; white-space:nowrap }
  td { overflow-wrap:anywhere }
  tr:last-child td { border-bottom:0 }
  .text-button { border:0; padding:0; background:none; color:var(--teal-dark); text-align:left; text-decoration:underline; text-underline-offset:2px; font-weight:650 }
  .pagination { display:flex; justify-content:flex-end; align-items:center; gap:8px; padding:8px 10px; color:var(--muted); font-size:.85rem }
  .empty-state { padding:15px; color:var(--muted) }
  .standalone>.panel-header { border-bottom:1px solid var(--line) }
  .standalone .record-form { max-width:770px }
  .record-form { padding:12px 14px 15px }
  .form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; gap:10px 12px }
  .field { display:grid; gap:4px; font-size:.83rem; font-weight:650 }
  .field.wide,.multi-field { grid-column:1/-1 }
  textarea { resize:vertical }
  .check-field { display:flex; align-items:flex-start; gap:6px; font-size:.84rem; min-height:27px }
  .check-field input { accent-color:var(--teal); flex:none; margin:3px 1px 0 0; width:15px; height:15px }
  .multi-field { border:1px solid var(--line); border-radius:5px; padding:6px 8px; min-width:0 }
  .multi-field summary { font-size:.8rem }
  .multi-options { max-height:140px; overflow:auto; padding:7px 3px 0 }
  .advanced-fields { margin-top:9px; padding:7px 0; border-top:1px solid var(--line); border-bottom:1px solid var(--line) }
  .advanced-fields>.form-grid { margin-top:8px }
  .form-actions { margin-top:12px }
  .form-error,.notice { padding:8px 10px; margin-top:10px; border:1px solid #efd3d8; color:#802639; background:#fff2f3; border-radius:5px }
  .notice { margin-bottom:10px }
  .editor-time { margin:9px 14px 0; font-size:.87rem; color:var(--muted) }
  .editor-time strong { color:var(--ink) }
  .local-settings { border-top:1px solid var(--line); padding:12px 14px; display:grid; justify-items:start; gap:7px }
  .toast { z-index:8; position:fixed; inset:auto 16px 16px auto; max-width:min(430px,calc(100vw - 32px)); padding:10px 14px; border-radius:7px; background:var(--navy); color:white; box-shadow:0 6px 18px #10354446 }
  dialog { max-width:min(530px,calc(100vw - 24px)); width:100%; padding:0; border:1px solid var(--line); border-radius:9px; color:var(--ink); box-shadow:0 18px 55px #152d4c44 }
  dialog::backdrop { background:#10243291 }
  .dialog-header { display:flex; justify-content:space-between; align-items:center; padding:10px 14px; border-bottom:1px solid var(--line) }
  .dialog-body { padding:14px }
  .dialog-body .record-form { padding-inline:0 }
  .help-body p+p { margin-top:9px }
  .example-list { display:grid; gap:10px }
  .example-option { padding:8px 10px; background:#f5f9fa; border:1px solid var(--line); border-radius:5px }
  .example-choice { border:0; background:none; padding:0; color:var(--teal-dark); font-weight:750; text-decoration:underline; text-underline-offset:3px }
  .example-option p { margin-top:4px }
  .welcome { max-width:1120px; margin:auto; padding:clamp(16px,4vw,50px) clamp(12px,3vw,38px) }
  .welcome-intro { position:relative; isolation:isolate; overflow:hidden; min-height:265px; display:flex; align-items:center; color:white; border-radius:12px; background:linear-gradient(110deg,#102b3d,#18555b); padding:clamp(19px,4.8vw,56px) }
  .hero-copy .eyebrow { color:#aeeae2; margin-bottom:9px }
  .hero-copy h1 { font-size:clamp(2rem,4.2vw,3.3rem) }
  .hero-copy>p { margin:9px 0 21px; color:#dcf2f2; font-size:clamp(.92rem,1.7vw,1.17rem) }
  .hero-copy .primary { color:#073436; background:#afe9de; border-color:#afe9de }
  .hero-copy .primary:hover { background:#d1f7ef }
  .hero-copy .button:not(.primary) { background:#173c49; color:white; border-color:#65969c }
  .hero-art { position:absolute; z-index:-1; right:0; inset-block:12% 0; width:48%; display:flex; align-items:end; justify-content:center; gap:5%; opacity:.59; background:repeating-linear-gradient(0deg,transparent 0 41px,#8cd5cd3b 42px 43px) }
  .hero-art i { display:block; width:11%; border-radius:6px 6px 0 0; background:linear-gradient(0deg,#5eaaa5 0 32%,#90cebd 32% 62%,#a0d1d0 62% 79%,#d0eed2 79%) }
  .hero-art i:nth-child(1) { height:56% } .hero-art i:nth-child(2) { height:70% } .hero-art i:nth-child(3) { height:88% } .hero-art i:nth-child(4) { height:65% } .hero-art i:nth-child(5) { height:75% }
  .hero-art span { border-top:2px dashed #d4fcf8; position:absolute; inset:27% 0 auto }
  .welcome-examples { margin-block:24px 15px }
  .welcome-examples header { margin-bottom:10px }
  .welcome-examples header p { margin-top:4px }
  .example-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px }
  .example-card { display:flex; flex-direction:column; align-items:flex-start; gap:8px; padding:15px }
  .example-symbol { display:grid; place-items:center; width:34px; height:34px; border-radius:6px; color:var(--teal-dark); background:var(--pale) }
  .example-card .button { margin:auto 0 0 -7px; color:var(--teal-dark) }
  .welcome-footer { display:flex; align-items:center; gap:10px 16px; flex-wrap:wrap; padding-top:8px; border-top:1px solid var(--line); font-size:.84rem }
  .welcome-footer .muted { margin-right:auto }
  #report { display:none }
}

@layer responsive {
  @media(max-width:1220px) {
    .metrics { grid-template-columns:repeat(3,minmax(0,1fr)) }
    .shell { --nav-width:194px }
  }
  @media(max-width:1050px) {
    .workspace-grid,.workspace-grid:has(.editor) { grid-template-columns:minmax(0,1fr) }
    .workspace-grid>.editor { grid-row:1 }
    .editor .record-form { max-width:800px }
  }
  @media(max-width:740px) {
    .topbar { align-items:start; padding:8px 10px; gap:6px; flex-wrap:wrap }
    .toolbar { justify-content:start }
    .shell,.shell.collapsed { display:block }
    .shell { background:var(--page) }
    .sidebar { position:static; min-height:0; padding:7px 9px; gap:0 }
    .sidebar .nav-heading,.sidebar-footer,.collapsed .sidebar { display:none }
    .sidebar nav { display:flex; gap:4px; overflow:auto }
    .nav-link { flex:none; width:auto; min-height:35px; padding:4px 7px }
    .workspace-header { align-items:start; flex-direction:column; gap:8px }
    .example-grid { grid-template-columns:minmax(0,1fr) }
    .hero-art { opacity:.22; width:75% }
  }
  @media(max-width:390px) {
    .metrics { grid-template-columns:repeat(2,minmax(0,1fr)) }
    .form-grid { grid-template-columns:minmax(0,1fr) }
    .toolbar .button { padding-inline:6px }
    .toolbar .button.icon { width:30px }
  }
  @media(prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto!important } }
}

@layer print {
  @page { size:A4 landscape; margin:12mm }
  @media print {
    html,body { background:white; color:#182431; font-size:9pt; print-color-adjust:exact; -webkit-print-color-adjust:exact }
    .topbar,.shell,.skip,.toast,.feedback-tab,dialog,noscript { display:none!important }
    #report { display:block }
    .report-header { display:flex; justify-content:space-between; border-bottom:1px solid #9db0bf; padding-bottom:3mm; margin-bottom:3mm }
    #report h1 { font-size:20pt }
    #report h2 { font-size:13pt; margin:4mm 0 2mm }
    .report-info,.report-metrics { display:grid; gap:1.5mm 4mm; margin:2mm 0 }
    .report-info { grid-template-columns:auto 1fr auto 1fr }
    .report-metrics { grid-template-columns:repeat(5,minmax(0,1fr)) }
    .report-info dd,.report-metrics dd { margin:0; overflow-wrap:anywhere }
    .report-info dt,.report-metrics dd { font-weight:bold }
    .report-chart { break-inside:avoid }
    .report-chart svg { width:100%; height:72mm }
    .report-method { margin-top:3mm }
    .report-work { break-before:page }
    #report table { font-size:8pt }
    #report table th,#report table td { padding:2mm }
    #report tr { break-inside:avoid }
    #report thead { display:table-header-group }
  }
}


@layer components {
  .scenario-bar { display:flex; flex-wrap:wrap; align-items:flex-end; gap:10px 14px; padding:12px 14px; margin-bottom:14px }
  .scenario-bar>.field { flex:0 1 245px }
  .scenario-actions { display:flex; align-items:center; flex-wrap:wrap; gap:6px }
  .scenario-actions .button { min-height:35px }
  .scenario-menu { position:relative }
  .scenario-menu>summary { display:block; padding:7px 10px; min-height:35px; border:1px solid var(--line); border-radius:6px; background:var(--surface); white-space:nowrap }
  .scenario-menu>summary::-webkit-details-marker { display:none }
  .scenario-menu>summary::after { content:'⌄'; display:inline-block; padding-left:6px }
  .scenario-menu-items { position:absolute; z-index:6; inset:calc(100% + 4px) auto auto 0; display:grid; min-width:178px; gap:3px; padding:5px; background:var(--surface); border:1px solid var(--line); border-radius:6px; box-shadow:0 7px 16px #14283924 }
  .scenario-menu-items .button { justify-content:flex-start; text-align:left; border-color:transparent }
  .scenario-bar>.analysis-note { flex-basis:100%; margin-top:0 }
  .analysis-stack,.comparison-content { display:grid; gap:14px; min-width:0 }
  .analysis-card { padding:13px 14px; display:grid; align-content:start; justify-items:start; gap:8px }
  .analysis-card>* { min-width:0; max-width:100% }
  .analysis-card>.table-scroll,.analysis-card>.metrics,.analysis-card>.record-form { width:100% }
  .analysis-card>.record-form { padding:3px 0 0 }
  .analysis-card>.advanced-fields { width:100%; margin:0 }
  .analysis-card .analysis-note { margin:0 }
  .analysis-card .form-actions { margin-top:4px }
  .analysis-controls { display:flex; align-items:flex-end; flex-wrap:wrap; gap:8px 12px }
  .analysis-controls>.field { flex:0 1 220px }
  .analysis-controls>.check-field { align-self:center }
  .analysis-note { font-size:.84rem; color:var(--muted); margin-block:5px }
  .analysis-list { margin:0; padding-left:18px }
  .analysis-inputs { width:100%; grid-template-columns:repeat(auto-fit,minmax(min(185px,100%),1fr)); padding:3px 0 6px }
  .comparison-charts,.sensitivity-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; gap:12px }
  .comparison-chart { min-width:0; margin:0; padding:10px; background:white; border:1px solid var(--line); border-radius:8px }
  .comparison-chart figcaption { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:6px; padding:1px 4px 7px; font-weight:750; color:var(--teal-dark); overflow-wrap:anywhere }
  .comparison-chart figcaption>span:first-child { flex:1 1 135px; min-width:0 }
  .comparison-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:5px; margin-left:auto }
  .comparison-actions .button { min-height:31px; padding:4px 7px; font-size:.79rem }
  .comparison-scroll { max-width:100%; overflow:auto }
  .mini-card { min-width:0; border:1px solid var(--line); border-radius:6px; padding:8px }
  .mini-card h3 { margin-bottom:6px }
  .sensitivity-grid { width:100%; grid-template-columns:repeat(auto-fit,minmax(min(235px,100%),1fr)) }
  .sensitivity-chart { display:block; width:100%; height:auto }
  .sensitivity-curve { stroke:var(--teal); stroke-width:2.5; fill:none }
  .pareto-chart { width:min(700px,100%); min-width:390px; height:auto }
  .pareto-bar { fill:var(--nva) }
  .pareto-point { fill:var(--teal) }
  .positive { color:#086653; font-weight:690 }
  .negative { color:var(--red); font-weight:690 }
  .optimisation-running progress { width:min(420px,100%); accent-color:var(--teal) }
  .solution-summary,.pair-settings { display:grid; width:100%; gap:8px }
  .solution-summary .field { max-width:300px }
  .pair-group { padding:9px 2px 2px }
  .pair-row { display:grid; grid-template-columns:1fr 1fr auto; gap:8px; align-items:end; margin-block:6px }
  .field-caption { display:flex; align-items:center; align-self:start; flex-wrap:wrap; gap:4px }
  .field-hint { position:relative; width:15px; height:15px; display:inline-grid; place-items:center; vertical-align:middle; margin-inline:2px; font-size:11px; color:var(--teal-dark); cursor:help; flex:none }
  .information-symbol { width:14px; height:14px; display:grid; place-items:center; border:1px solid #77a4ac; border-radius:50%; line-height:1; font-weight:750 }
  .field-tooltip { display:none; position:absolute; z-index:10; width:min(230px,65vw); inset:auto 0 calc(100% + 5px) auto; padding:7px 8px; border-radius:5px; background:var(--navy); color:white; box-shadow:0 4px 10px #14283936; font:500 .78rem/1.35 "Segoe UI",system-ui,sans-serif; text-align:left; white-space:normal; pointer-events:none }
  .field-hint:hover .field-tooltip,.field-hint:focus .field-tooltip { display:block }
  .sidebar-footer .legal-link { color:#cde2e9; font-size:.84rem; justify-self:start }
  .welcome-footer .legal-link { order:-1 }
  .feedback-dialog { display:grid; gap:8px }
  .feedback-dialog .record-form { padding:0 }
  .feedback-dialog a.button { text-decoration:none }
  #access-dialog { max-width:min(570px,calc(100vw - 24px)); max-height:calc(100% - 24px) }
  #access-dialog .dialog-header { padding:14px 16px; background:var(--page) }
  .access-form { display:grid; gap:16px; padding:16px }
  .access-section { display:grid; gap:7px }
  .access-terms { padding:8px 10px; border:1px solid var(--line); border-radius:6px }
  .access-terms summary { cursor:pointer; font-weight:650 }
  .access-terms[open] summary { margin-bottom:9px }
  .access-choice { display:flex; align-items:center; gap:7px; width:fit-content; min-height:30px; cursor:pointer }
  .access-choice input { width:1rem; height:1rem; margin:0; accent-color:var(--teal) }
  .access-analytics { min-width:0; margin:0; padding:8px 10px; border:1px solid var(--line); border-radius:6px }
  .access-analytics legend { padding-inline:4px; font-weight:700 }
  .access-options,.access-footer { display:flex; flex-wrap:wrap; align-items:center; gap:8px 16px }
  .access-footer { justify-content:space-between; border-top:1px solid var(--line); padding-top:12px }
  #main { padding-inline-end:max(36px,2vw) }
  .welcome-shell #main { padding-inline-end:0 }
  .welcome { padding-inline-end:max(36px,3vw) }
  .feedback-tab { position:fixed; z-index:7; top:72%; right:0; transform:translateY(-50%); display:flex; align-items:center; justify-content:center; gap:5px; writing-mode:vertical-rl; min-height:88px; width:28px; padding:6px 4px; border:0; border-radius:7px 0 0 7px; background:var(--teal); color:white; box-shadow:0 2px 8px #14283936; font-size:.78rem; font-weight:750 }
  .feedback-tab svg { width:14px; height:14px }
  .feedback-tab:hover,.feedback-tab:focus-visible { background:var(--teal-dark) }
  .feedback-tab:focus-visible { outline:2px solid #ffdb79; outline-offset:-3px }
  .workspace-footer { display:none }
  .drag-ghost { position:fixed; z-index:25; left:0; top:0; max-width:min(240px,70vw); display:flex; align-items:center; gap:7px; padding:7px 9px; pointer-events:none; background:#fff; border:1px solid #80aeb1; border-radius:6px; box-shadow:0 7px 18px #17384936; color:var(--ink); font-size:.82rem; font-weight:700; transform-origin:0 0; will-change:transform,opacity }
  .drag-ghost-block { display:block; max-width:none; padding:0; border:0; border-radius:4px; background:transparent; font-family:"Segoe UI",system-ui,sans-serif }
  .drag-ghost-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
  .drag-ghost-time { color:var(--muted); flex:none; white-space:nowrap }
  .drag-ghost-mark { width:6px; height:19px; flex:none; border-radius:2px; background:var(--unclassified) }
  .drag-ghost-mark.va { background:var(--va) } .drag-ghost-mark.nnva { background:var(--nnva) } .drag-ghost-mark.nva { background:var(--nva) }
}
@layer responsive {
  @media(max-width:740px) {
    .scenario-bar { padding:11px 12px; gap:8px }
    .scenario-bar>.field { flex-basis:100% }
    .scenario-actions { width:100%; gap:5px }
    .scenario-actions>.button,.scenario-menu>summary { font-size:.81rem; min-height:34px; padding-inline:8px }
    .comparison-charts { grid-template-columns:minmax(0,1fr) }
    .pair-row { grid-template-columns:minmax(0,1fr) }
    .workspace-footer { display:flex; flex-wrap:wrap; gap:12px; padding-top:12px }
    .field-tooltip { right:auto; left:-12px }
  }
}
@layer print {
  @media print {
    .printed-comparison { gap:3mm }
    .printed-comparison .comparison-charts { grid-template-columns:1fr 1fr }
    .printed-comparison .comparison-chart { break-inside:avoid; padding:3mm 1mm }
    .printed-comparison .comparison-scroll { overflow:visible }
    .printed-comparison svg { display:block; width:100%; height:auto; max-height:70mm }
    .printed-comparison .analysis-card { display:block; padding:2mm 0; box-shadow:none; border:0 }
    .printed-comparison .analysis-card table { width:100% }
    #report .printed-comparison th,#report .printed-comparison td { padding:1.5mm 2mm }
  }
}
