/* SagBalCalc · readable planning workspace. Calculation rules live in engine.js. */
@media screen {
  :root {
    --bg:#f2f5f4; --paper:#fff; --ink:#18323d; --muted:#526772;
    --line:#d5dfe0; --green:#086673; --green-dark:#064e58; --soft:#eaf3ee;
    --navy:#132f3b; --lime:#d7ecab; --radius:18px;
    font-family:Inter,"Avenir Next",system-ui,-apple-system,sans-serif;
    font-size:16px;
  }
  html { scroll-padding-top:110px; }
  body { font-size:1rem; line-height:1.6; }
  button,a,input,select,textarea,summary { -webkit-tap-highlight-color:transparent; }
  button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,
  textarea:focus-visible,summary:focus-visible,[tabindex="0"]:focus-visible {
    outline:3px solid #006a7a; outline-offset:4px; box-shadow:0 0 0 2px white;
  }
  button:disabled { opacity:.6; }
  .skip { border:2px solid var(--ink);border-radius:10px;font-size:1rem;z-index:150; }
  .workspace { padding-left:264px; }
  .sidebar { width:264px;padding:20px 16px; background:var(--navy); }
  .brand { display:block;width:100%;padding:4px 14px 20px;margin-bottom:24px;background:transparent;border:0;border-bottom:1px solid #ffffff26;border-radius:0; }
  .brand img { display:block;width:100%;height:auto;filter:brightness(0) invert(1);opacity:.96; }
  .brand-caption { display:block;font-size:.625rem;letter-spacing:.18em;text-align:center;color:var(--lime);margin-top:2px; }
  .brand:hover { background:#ffffff05;border-bottom-color:#d7ecab80; }
  .nav-label { color:#b4ccd4;font-size:.6875rem;letter-spacing:.12em;margin-bottom:14px; }
  .nav-item { gap:12px;min-height:54px;padding:14px 12px;font-size:.875rem;line-height:1.4;color:#d4e2e7;border:1px solid transparent;border-radius:12px; }
  .nav-item svg { width:20px;height:20px; }
  .nav-item small { font-size:.6875rem;opacity:1;color:#b4ccd4; }
  .nav-item.active { background:#254b54;color:#e3f1bc;border-color:#789e82; }
  .nav-item.active small { color:#e3f1bc; }
  .sidebar-note { padding:28px 12px 12px; }
  .sidebar-note .tiny-label { color:#c2d8c0;font-size:.6875rem;letter-spacing:.08em; }
  .sidebar-note p { font-size:.9375rem;line-height:1.75;color:#e0ebee; }
  .sidebar-note small { color:#bccfd5;font-size:.8125rem; }
  .family { padding-top:24px; }
  .family a { min-height:44px;font-size:.875rem;color:#d7e5e8; }
  .family a svg { opacity:1;width:16px; }
  .sidebar-footer { font-size:.75rem;color:#b9ced6; }
  .topbar { min-height:80px;height:auto;padding:14px 36px;position:sticky;top:0;z-index:25;gap:14px;background:#ffffffed;backdrop-filter:blur(16px); }
  .icon-button { min-width:44px;min-height:44px;border-color:#bdccce;border-radius:10px; }
  .icon-button svg { width:20px;height:20px; }
  .header-brand { display:none;flex:none; }
  .header-brand img { display:block;width:155px;height:auto; }
  .breadcrumb { font-size:.8125rem;gap:10px; }
  .breadcrumb strong { font-weight:600; }
  .breadcrumb span { color:var(--muted); }
  .save-status { font-size:.75rem;color:#4f6970;line-height:1.5; }
  .save-status:before { background:#477258;width:7px;height:7px; }
  .language { padding:3px;border-color:#bdccce;margin:0;border-radius:11px; }
  .language button { min-width:44px;min-height:40px;padding:8px;font-size:.8125rem; }
  .language button[aria-pressed=true] { color:#154c48;background:#e7efe5; }
  .display-settings { position:relative;flex:none; }
  .display-settings>summary { list-style:none;min-width:44px;min-height:44px;display:grid;place-items:center;border:1px solid #bdccce;border-radius:11px;background:#fff;color:var(--ink);font-size:1rem; }
  .display-settings>summary::-webkit-details-marker { display:none; }
  .display-settings[open]>summary { margin:0;background:var(--soft); }
  .display-options { position:absolute;right:0;top:54px;width:270px;max-width:calc(100vw - 32px);border:1px solid #b6c8cb;border-radius:14px;padding:16px;background:#fff;box-shadow:0 16px 48px #102b3926; }
  .display-options strong { display:block;font-size:.875rem;margin-bottom:12px; }
  .display-options button { display:flex;width:100%;align-items:center;justify-content:space-between;text-align:left;min-height:48px;border:1px solid var(--line);padding:10px 12px;margin-top:8px;border-radius:8px;font-size:.875rem; }
  .display-options button[aria-pressed=true] { background:var(--soft);border-color:var(--green); }
  .display-options button[aria-pressed=true]::after { content:'✓';font-weight:750;margin-left:10px; }
  main { max-width:1600px;padding:36px clamp(24px,3vw,48px) 24px; }
  .page-heading { margin-bottom:30px;align-items:flex-end;gap:24px; }
  h1 { font-size:clamp(2rem,3.2vw,2.75rem);letter-spacing:-.045em;line-height:1.15;margin:10px 0 14px;font-weight:650; }
  h2 { font-size:1.3125rem;line-height:1.35;letter-spacing:-.025em; }
  h3 { font-size:1rem;line-height:1.45; }
  .eyebrow,.step,.tiny-label { font-size:.6875rem;letter-spacing:.105em;color:#4a6c65;line-height:1.6; }
  .page-heading p { font-size:.9375rem;color:var(--muted);line-height:1.7;max-width:660px; }
  .button,.text-button { min-height:44px;font-size:.8125rem;line-height:1.45;padding:11px 16px;white-space:normal; }
  .button { border-radius:10px; }
  .button.quiet { border-color:#b9cacc; }
  .button.primary { box-shadow:0 3px 8px #08667317; }
  .text-button { padding:9px 4px; }
  .metric-grid { gap:16px;margin-bottom:26px; }
  .metric { min-height:142px;padding:20px 23px;box-shadow:0 2px 6px #122f3a04; }
  .metric>span { font-size:.8125rem;color:#455f69;font-weight:600; }
  .metric strong { font-size:2.25rem;letter-spacing:-.04em;margin:5px 0; }
  .metric small { font-size:.75rem;line-height:1.5;color:#536d74; }
  .metric.completion { background:#e8f0e2;border-color:#c9d9c3; }
  .metric-denominator { font-size:1.25rem;color:#4c6b5a; }
  .work-grid { gap:24px;grid-template-columns:minmax(0,1.6fr) minmax(290px,1fr); }
  .panel { padding:26px;margin-bottom:22px;border-radius:18px;box-shadow:0 5px 20px #102e3904; }
  .panel-heading { margin-bottom:24px;align-items:flex-start; }
  .panel-heading>svg { color:#517f76; }
  .form-grid { gap:22px; }
  .field { gap:8px; }
  .field>span { font-size:.875rem;line-height:1.45;color:#304d57;font-weight:600; }
  .field small { color:#576f76;font-size:.75rem;line-height:1.6; }
  .field input,.field textarea,.field select,.correction-row input,.correction-row select { border-color:#aebfc3;background:#fcfdfc;border-radius:9px;font-size:1rem;min-height:48px;padding:11px 12px;line-height:1.5; }
  .field textarea { min-height:116px; }
  .field input::placeholder,.correction-row input::placeholder { color:#617a80; }
  .input-unit input { padding-right:48px; }
  .input-unit>span { top:13px;font-size:.875rem;color:#526e76; }
  .field .field-error { color:#9a3229;font-size:.8125rem;font-weight:600; }
  .field-error:empty { display:none; }
  .field input[aria-invalid=true],.correction-row [aria-invalid=true] { border:2px solid #aa3e31;background:#fff5f1; }
  .badge { font-size:.75rem;padding:5px 9px; }
  .notice { font-size:.875rem;line-height:1.7;padding:14px 16px;border-radius:11px; }
  .notice p+p { margin-top:8px; }
  .notice.error { color:#8d2c24;border-color:#cb8175; }
  .notice.warning,.warn-text { color:#795014; }
  .notice.success { color:#2d613e; }
  summary { min-height:44px;padding:9px 0;font-size:.875rem;line-height:1.5;color:#245a59; }
  details[open]>summary { margin-bottom:20px; }
  .caption,.check-inline { font-size:.8125rem;color:#506970;line-height:1.7; }
  .check-inline { min-height:44px; }
  input[type=checkbox] { width:20px;height:20px; }
  .toolbar { gap:12px 22px; }
  .data-toolbar { justify-content:flex-start; }
  .alignment-visual { gap:18px;grid-template-columns:94px minmax(0,1fr); }
  .alignment-visual>svg { width:94px;height:156px; }
  .alignment-visual .tiny-label { color:#47665d;font-size:.6875rem; }
  .grade-row { font-size:.875rem;padding:10px 0; }
  .small-heading { font-size:.9375rem; }
  .reference-values { flex-wrap:wrap;gap:16px; }
  .reference-values>span { font-size:.75rem; }
  .reference-values b { font-size:1.375rem; }
  .muted { font-size:.875rem; }
  .next-card { padding:26px; }
  .next-card .tiny-label { font-size:.6875rem;color:#d0e4bd; }
  .next-card h3 { font-size:1.375rem;line-height:1.3;margin:12px 0; }
  .next-card p { font-size:.875rem;color:#d0dee3;max-width:none; }
  .next-card button { min-height:48px;padding:12px 14px;font-size:.875rem; }
  .page-footer { align-items:center;font-size:.75rem;color:#546c74;margin-top:32px;padding:22px 0;flex-wrap:wrap; }
  .page-footer button,.page-footer a { font-size:.8125rem;min-height:44px;display:flex;align-items:center; }
  .page-footer>span { max-width:560px; }
  .example-banner { font-size:.8125rem;line-height:1.65;padding:14px 18px; }
  .example-banner .text-button { font-size:.8125rem; }
  .mobile-nav button { min-height:52px;padding:12px 14px;font-size:.8125rem;line-height:1.45; }
  .mobile-nav button.active { color:#124f53;border-color:#5b8b83;background:#e7f0e8;font-weight:650; }
  .mobile-nav svg { width:20px;height:20px; }
  .target-layout { grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:28px; }
  .target-layout .form-grid { grid-template-columns:minmax(0,1fr); }
  .scenario-grid { gap:22px; }
  .scenario { padding:24px;border-top-width:4px; }
  .scenario.selected { border-color:#72a49a;border-top-color:#086673; }
  .scenario-title h2 { font-size:1.25rem; }
  .scenario-title small { font-size:.75rem;color:#516c70;max-width:none; }
  .scenario-letter { min-width:40px;height:44px;font-size:1.125rem; }
  .scenario .button { font-size:.8125rem;padding:10px 12px; }
  .row-labels { display:none; }
  .correction-row { grid-template-columns:minmax(0,1fr) minmax(0,1.15fr) minmax(70px,.65fr) 44px;align-items:end;gap:10px;padding:16px 0;border-top:1px solid var(--line);margin:0; }
  .correction-row label { min-width:0; }
  .correction-row .sr-only { position:static;clip:auto;overflow:visible;white-space:normal;display:block;width:auto;height:auto;font-size:.75rem;color:#48636d;line-height:1.5;margin-bottom:6px; }
  .correction-row input,.correction-row select { font-size:.875rem;padding:10px 7px;height:48px; }
  .remove-row { width:44px;min-height:48px;font-size:1.5rem;border:1px solid #d6b1ac;border-radius:9px;color:#953d30;background:#fff8f5; }
  .add-row { min-height:44px;padding:10px 0;font-size:.875rem;gap:8px; }
  .add-row svg { width:18px;height:18px; }
  .scenario-result { padding:18px;gap:16px; }
  .scenario-result small { font-size:.75rem;color:#506b5a; }
  .scenario-result strong { font-size:1.875rem;color:#235c53; }
  .table-scroll { border:1px solid var(--line);border-radius:12px; }
  table { font-size:.9375rem; }
  thead,thead th,tbody th,tbody tr:last-child td { font-size:.8125rem; }
  thead th { color:#395b63;font-weight:650; }
  th,td { padding:15px 16px; }
  tbody td { color:#245950; }
  .plan-grid { grid-template-columns:minmax(0,1.5fr) minmax(300px,1fr); }
  .checklist { gap:10px; }
  .checklist label { min-height:44px;padding:8px 0;font-size:.9375rem;color:#395c55;gap:12px;line-height:1.6; }
  .checklist input { margin-top:3px; }
  .gaps { font-size:.875rem;color:#795014; }
  .family-link { min-height:48px;font-size:.875rem; }
  .report-preview pre { font-size:.8125rem;line-height:1.9; }
  .method-list h3 { font-size:1rem;color:#294f49; }
  .method-list p { font-size:.9375rem;color:#4c665d;line-height:1.8; }
  .source-list small { font-size:.8125rem;color:#526c5d; }
  .source-list a { font-size:.9375rem;line-height:1.65;color:#08616d;text-decoration:underline;text-underline-offset:3px;overflow-wrap:anywhere; }
  .source-list p { font-size:.875rem;color:#526c5d;line-height:1.75; }
  .source-number { font-size:.8125rem;color:#506c5d; }
  #extra-context p,.source-version p { font-size:.875rem;color:#526c5d; }
  #toast { font-size:.9375rem;padding:16px 22px;bottom:24px;border-radius:12px; }
  .sidebar-hidden { padding-left:0; }
  .sidebar-hidden .header-brand { display:block; }
  .sidebar-hidden .breadcrumb { display:none; }
  .sidebar-hidden .mobile-nav { display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px; }
  html[data-text-size=large] { font-size:19px; }
  html[data-contrast=high] { --bg:#edf1ed;--ink:#082831;--muted:#244b54;--line:#526e76; }
  html[data-contrast=high] .panel,html[data-contrast=high] .metric { border-color:#526e76;box-shadow:none; }
  html[data-contrast=high] .field small,html[data-contrast=high] .caption,
  html[data-contrast=high] .page-heading p,html[data-contrast=high] .metric small { color:#244b54; }
  html[data-contrast=high] input,html[data-contrast=high] select,html[data-contrast=high] textarea { border-color:#335961; }
  @media(max-width:1250px) {
    .workspace{padding-left:240px}.sidebar{width:240px}.sidebar-hidden{padding-left:0}
    main{padding:28px 24px}.topbar{padding:14px 24px}.breadcrumb{display:none}
    .metric{padding:18px}.metric-grid{gap:12px}.work-grid{grid-template-columns:minmax(0,1.3fr) minmax(270px,1fr);gap:18px}
    .panel{padding:22px}.form-grid{gap:18px}.scenario-grid{grid-template-columns:minmax(0,1fr)}
  }
  @media(max-width:1050px) {
    .workspace{padding-left:0}.sidebar{display:none}.topbar .icon-button{display:none}.header-brand{display:block}
    .mobile-nav,.sidebar-hidden .mobile-nav{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-bottom:24px}
    .mobile-nav button{flex-direction:row;justify-content:flex-start;gap:8px}
    .scenario-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
    .correction-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
    .remove-row{justify-self:end}.scenario .panel-heading{flex-wrap:wrap}
  }
  @media(max-width:760px) {
    .topbar{padding:8px 16px;min-height:76px;gap:8px;flex-wrap:wrap;backdrop-filter:none;background:white}
    .header-brand img{width:138px}.language{margin-left:auto}.language button{min-width:38px;min-height:42px;font-size:.8125rem}
    .save-status{width:100%;order:5;margin:0;font-size:.75rem;text-align:left;max-width:none}.save-status:before{display:block}
    .display-options{right:0}.display-settings>summary{min-width:44px}
    main{padding:26px 16px 16px}.page-heading{align-items:flex-start;flex-wrap:wrap;gap:16px;margin-bottom:24px}
    .page-heading .button{font-size:.8125rem;min-height:44px;padding:10px 14px}
    h1{font-size:2rem}.eyebrow{font-size:.6875rem;letter-spacing:.08em}.page-heading p{font-size:.9375rem;line-height:1.7}
    .mobile-nav,.sidebar-hidden .mobile-nav{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
    .mobile-nav button{font-size:.8125rem;flex-direction:row;line-height:1.5;padding:12px;min-height:54px}
    .metric-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-bottom:22px}.metric{padding:18px;min-height:136px}
    .metric strong{font-size:2rem}.metric>span{font-size:.8125rem}.metric small{font-size:.75rem}
    .work-grid,.plan-grid,.target-layout,.scenario-grid{grid-template-columns:minmax(0,1fr);gap:0}
    .panel{padding:22px;margin-bottom:20px}.panel-heading{flex-wrap:wrap;gap:16px}.panel-heading>div{min-width:0}.form-grid,.form-grid.three{grid-template-columns:minmax(0,1fr);gap:22px}
    .field>span{font-size:.875rem}.field small{font-size:.8125rem}.field input,.field textarea,.field select,.correction-row input,.correction-row select{font-size:1rem}
    .target-layout>div+div{margin-top:22px;padding-top:22px;border-top:1px solid var(--line)}
    .target-layout .full{grid-column:auto}.scenario .panel-heading{flex-wrap:wrap;gap:16px}
    .correction-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;align-items:end}
    .alignment-visual{grid-template-columns:94px minmax(0,1fr);gap:22px}.alignment-visual .tiny-label{font-size:.6875rem}.grade-row{font-size:.875rem}
    .reference-values b{font-size:1.375rem}.next-card{margin-bottom:20px}.check-inline{width:100%;font-size:.8125rem}
    .example-banner{flex-wrap:wrap;font-size:.8125rem}.example-banner .text-button{font-size:.8125rem;min-height:44px}
    .page-footer{font-size:.75rem;align-items:flex-start;gap:12px}.page-footer button{font-size:.8125rem}
    .report-preview pre{font-size:.8125rem}.end-actions .button{width:100%;min-height:48px}
    .source-list article{gap:12px}.source-list a{font-size:.9375rem}.source-list small{font-size:.8125rem}
    .display-options button{font-size:.875rem}.breadcrumb{display:none}
  }
  @media(prefers-contrast:more) {.panel,.metric{border-color:#688187}.field input,.field select,.field textarea{border-color:#43656f}}
  @media(forced-colors:active) {
    .nav-item.active,.mobile-nav button.active,.scenario.selected { outline:2px solid Highlight; }
    button:focus-visible,a:focus-visible,input:focus-visible,summary:focus-visible { outline:3px solid Highlight; }
    .brand{background:white;forced-color-adjust:none}.brand img{filter:none;opacity:1}.brand-caption{color:#18323d}.badge,.notice,.metric{border:1px solid CanvasText}
  }
}
@media print {.display-settings,.header-brand,#calculation-status{display:none!important}}
