/*
 * Расчётная ведомость, редакция оформления 3.2.
 * Палитра задаётся исходным theme.css; расчётные модули не затронуты.
 * Только экранные стили: печатная форма наследуется из версии 3.1.
 */
@media screen {
  :root { --font:"Segoe UI",Arial,sans-serif; --paper:var(--color-window); --ink:var(--color-text); --line:var(--color-border-soft); }
  body { font-size:14px; line-height:1.4; }
  button { border-radius:var(--radius-button); }
  input,select,textarea { border-radius:2px; }
  button { min-height:32px; padding:5px 11px; font-weight:400; }
  input,select { min-height:32px; }
  h1,h2,h3,b,strong { font-weight:600; }
  .link { min-height:24px; padding:2px 0; text-decoration:underline; text-underline-offset:3px; }
  .icon { width:28px; min-height:30px; padding:4px; border-radius:2px; }
  .icon svg { width:16px; height:16px; }
  .topbar { min-height:54px; padding:9px 20px; gap:18px; align-items:center; }
  .brand { gap:0; }
  .title-line { display:flex; gap:10px; align-items:baseline; }
  .title-line h1 { display:flex; align-items:baseline; gap:11px; font-size:16px; line-height:24px; white-space:nowrap; }
  .wordmark { letter-spacing:.35px; font-size:16px; font-weight:700; }
  .title-divider { color:var(--color-text-secondary); font-weight:400; }
  .build-label { font-size:12px; font-weight:400; }
  .toolbar { flex-wrap:nowrap; gap:5px; max-width:none; align-items:center; }
  .toolbar .sep { height:20px; margin:0 6px; }
  .theme-toggle { width:32px; height:32px; }
  .theme-glyph { position:relative; width:16px; height:16px; border:1.5px solid currentColor; border-radius:50%; overflow:hidden; background:none; }
  .theme-glyph::before { content:""; position:absolute; inset:0 50% 0 0; background:currentColor; }
  main { max-width:1380px; padding:32px 20px 12px; }
  .workspace { border:1px solid var(--line); border-radius:8px; background:var(--color-window); overflow:hidden; }
  .workspace-command { padding:0; }
  .workspace-titlebar { display:flex; height:34px; padding-left:12px; border-bottom:1px solid var(--line); background:var(--color-footer); align-items:center; }
  .workspace-command h1 { min-width:0; margin:0; overflow:hidden; color:var(--color-text); font-size:14px; font-weight:700; line-height:20px; text-overflow:ellipsis; white-space:nowrap; }
  .workspace-window-controls { display:flex; height:33px; margin-left:auto; }
  .workspace-window-controls span { position:relative; display:block; width:38px; height:33px; padding:0; color:var(--color-text-secondary); font-size:0; }
  .workspace-window-controls span::before,.workspace-window-controls .workspace-window-close::after { position:absolute; top:50%; left:50%; content:""; }
  .workspace-window-controls .workspace-window-minimize::before { width:10px; height:1px; background:currentColor; transform:translate(-50%,-50%); }
  .workspace-window-controls .workspace-window-maximize::before { width:9px; height:8px; border:1px solid currentColor; transform:translate(-50%,-50%); }
  .workspace-window-controls .workspace-window-close::before,.workspace-window-controls .workspace-window-close::after { width:12px; height:1px; background:currentColor; }
  .workspace-window-controls .workspace-window-close::before { transform:translate(-50%,-50%) rotate(45deg); }
  .workspace-window-controls .workspace-window-close::after { transform:translate(-50%,-50%) rotate(-45deg); }
  .workspace-command .parking-toolbar { display:flex; width:100%; padding:8px 12px 0; align-items:center; justify-content:space-between; gap:8px; }
  .workspace-command .parking-toolbar-group { display:flex; align-items:center; gap:5px; }
  .workspace-command .parking-toolbar-group-right { margin-left:auto; }
  .command-icon-button { display:grid; width:34px; height:34px; min-height:34px; padding:0; border-color:var(--color-accent); background:var(--color-accent); color:var(--color-on-accent); place-items:center; }
  .command-icon-button:hover { border-color:var(--color-accent-hover); background:var(--color-accent-hover); color:var(--color-on-accent); }
  .command-icon-button svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-linecap:round; stroke-linejoin:round; stroke-width:1.5; }
  .region-row { display:grid; margin:0; padding:10px 12px 0; grid-template-columns:minmax(180px,2fr) minmax(170px,1.55fr) minmax(140px,1.1fr) 125px minmax(160px,1.25fr); gap:12px; }
  .region-label { display:grid; width:100%; grid-template-rows:auto 32px; gap:4px; font-size:12px; font-weight:400; }
  .region-label select { display:block; width:100%; min-width:0; height:32px; margin:0; }
  .project-head { border:0; border-radius:0; padding:12px; background:none; gap:12px; grid-template-columns:minmax(180px,2fr) minmax(170px,1.55fr) minmax(140px,1.1fr) 125px minmax(160px,1.25fr); }
  .project-head input { background:var(--color-control); border:1px solid var(--line); border-radius:2px; padding:5px 7px; font-size:14px; }
  .project-head label { font-size:12px; font-weight:400; }
  .basis-line { padding:0 12px 10px; margin:0; gap:20px; align-items:baseline; border-bottom:1px solid var(--line); font-size:12px; }
  .basis-line .link { flex:none; }
  .sheet { border:0; border-radius:0; background:none; }
  .sheet-head { padding:8px 12px; border-bottom:1px solid var(--line); min-height:48px; }
  .sheet-head h2 { font-size:14px; line-height:20px; }
  .sheet-head>div { gap:14px; }
  .table-viewport { max-height:calc(100vh - 405px); min-height:120px; }
  .entry-table { min-width:1060px; }
  .c-index { width:36px; }
  .c-name { width:23%; }
  .c-function { width:28%; }
  .c-input { width:15%; }
  .c-rule { width:11%; }
  .c-result { width:11%; }
  .c-actions { width:68px; }
  .entry-table th { padding:8px; min-height:36px; font-weight:600; font-size:12px; line-height:18px; text-align:center; vertical-align:middle; }
  .entry-table th,.entry-table td { border-right:1px solid var(--line); }
  .entry-table th:last-child,.entry-table td:last-child { border-right:0; }
  .entry-table td { padding:7px 8px; vertical-align:middle; }
  .entry-table td:nth-child(4),.entry-table td:nth-child(5),.entry-table td:nth-child(6) { text-align:center; vertical-align:middle; }
  .entry-table td:nth-child(5) .link { width:100%; text-align:center; }
  .entry-table tr:focus-within { outline:none; background:var(--color-footer); }
  .entry-table tr:hover { background:var(--color-footer); }
  .entry-table td.row-num { padding-top:7px; color:var(--color-text-secondary); }
  .entry-table td input { min-height:32px; }
  .name-input { background:transparent; border-color:transparent; border-bottom-color:var(--line); border-radius:0; padding-left:4px!important; }
  .name-input:hover { border-bottom-color:var(--color-text-secondary); }
  .rule-line { display:flex; min-height:32px; align-items:center; justify-content:center; gap:8px; min-width:0; }
  .rule-trigger { flex:1; min-width:0; min-height:32px; padding:5px 7px; line-height:20px; background:var(--color-window); }
  .rule-trigger .arrow { font-size:12px; padding:0 2px; color:var(--color-text-secondary); }
  .rule-group { display:flex; min-height:32px; flex:none; margin:0; align-items:center; white-space:nowrap; }
  .subline { font-size:12px; margin-top:3px; line-height:16px; }
  .qty-wrap { justify-content:center; gap:7px; }
  .qty-wrap input { max-width:100px; flex:0 1 100px; text-align:center; }
  .qty-wrap span { font-size:12px; line-height:16px; }
  .output { font-size:16px; line-height:24px; font-weight:600; }
  .housing-result { font-size:14px; line-height:22px; }
  .formula { font-size:12px; line-height:16px; margin-top:2px; }
  .cell-actions { padding:5px 4px!important; white-space:nowrap; vertical-align:middle!important; }
  .row-actions { display:flex; align-items:center; justify-content:center; gap:3px; }
  .action-stack { display:grid; gap:3px; }
  .cell-actions .icon { display:grid; width:24px; height:24px; min-height:24px; margin:0; padding:2px; color:var(--color-icon); place-items:center; }
  .cell-actions .icon svg { width:15.4px; height:15.4px; }
  .new-row td { padding:7px 8px!important; border-bottom:1px solid var(--line); text-align:left; }
  .new-picker { display:grid; width:34px; height:34px; min-height:34px; border:1px solid var(--color-accent); border-radius:var(--radius-button); background:var(--color-accent); color:var(--color-on-accent)!important; padding:0; font-size:18px; place-items:center; }
  .inline-plus { position:relative; display:block; width:14px; height:14px; margin:0; color:inherit; font-size:0; }
  .inline-plus::before,.inline-plus::after { position:absolute; top:50%; left:50%; background:currentColor; content:""; transform:translate(-50%,-50%); }
  .inline-plus::before { width:14px; height:2px; }
  .inline-plus::after { width:2px; height:14px; }
  .new-picker:hover { border-color:var(--color-accent-hover); background:var(--color-accent-hover); }
  .sheet-foot { padding:7px 12px; font-size:12px; line-height:18px; gap:14px; }
  kbd { border:0; border-radius:0; padding:0; font-size:12px; }
  .totals { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)) minmax(150px,.9fr); gap:0; margin:0; padding:0; border-top:1px solid var(--line); border-bottom:0; border-radius:0; background:var(--color-footer); }
  .total-item { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:4px 10px; border-right:1px solid var(--line); padding:12px!important; }
  .total-item small { display:inline; font-size:12px; line-height:18px; }
  .total-item strong { display:inline; font-size:18px; line-height:22px; font-weight:600; color:var(--ink); }
  .total-item:last-child { display:flex; text-align:right; justify-content:flex-end; border:0; flex:unset; gap:5px; }
  .total-main small { margin-right:auto; color:var(--ink); font-weight:600; }
  .total-item.total-main strong { font-size:20px; color:var(--ink); }
  .work-progress { margin:0; padding:10px 12px; border-top:1px solid var(--line); }
  .work-progress h2 { margin:0 0 6px; font-size:13px; line-height:18px; }
  .work-progress .status { display:grid; gap:3px; padding:0; }
  .work-progress .status p { margin:0; }
  .status-row { margin:0; padding:0 12px; gap:18px; align-items:flex-start; justify-content:flex-end; }
  .status { padding-top:6px; line-height:18px; font-size:12px; }
  .status.invalid { padding:0 0 0 10px; }
  .bottom-actions { gap:5px; flex-wrap:nowrap; max-width:none; }
  .bottom-actions button { min-height:30px; padding:5px 8px; font-size:12px; }
  .app-footer { justify-content:flex-end; font-size:12px; padding:10px 12px 12px; line-height:18px; }
  .picker,dialog { border-radius:var(--radius-panel); box-shadow:var(--shadow-overlay); }
  .picker-head,.picker-foot,.dialog-head,.dialog-foot { background:var(--color-footer); }
  .dialog-head { padding:10px 14px; }
  .dialog-head h2 { font-size:16px; line-height:22px; font-weight:600; }
  .dialog-body { padding:14px; }
  .dialog-foot { padding:8px 14px; }
  .notice { border-width:2px; }
  .toast { border-radius:var(--radius-card); box-shadow:var(--shadow-raised); }
  html[data-theme="dark"] .link,html[data-theme="dark"] a { color:var(--color-text-secondary); }
  html[data-theme="dark"] .link:hover,html[data-theme="dark"] a:hover { color:var(--color-text); }
  html[data-theme="dark"] .new-picker { color:var(--color-text-secondary); }
  .rule-option { border-radius:0; }
  .picker-group { font-weight:600; }
  #report { box-shadow:none; border-radius:0; }
  .r-head { border-bottom:1px solid var(--line); }
  .r-total { border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
  .r-total strong { font-size:22px; font-weight:600; color:var(--ink); }
}
@media screen and (max-width:1150px) {
  .topbar { padding:9px 14px; }
  main { padding:12px 14px; }
  .title-line { display:flex; }
  .title-line h1 { font-size:15px; gap:8px; }
  .title-line .build-label { display:none; }
  .project-head { grid-template-columns:minmax(140px,1.8fr) minmax(120px,1.5fr) minmax(110px,1.2fr) 120px minmax(140px,1.2fr); gap:10px; }
  .region-row { grid-template-columns:minmax(140px,1.8fr) minmax(120px,1.5fr) minmax(110px,1.2fr) 120px minmax(140px,1.2fr); gap:10px; }
  .table-viewport { max-height:calc(100vh - 405px); }
  .total-item { gap:4px; }
  .total-item small { flex-basis:100%; }
  .total-item:last-child small { flex-basis:auto; }
  .status-row { align-items:flex-start; }
}
@media screen and (max-width:800px) {
  .topbar { gap:9px; padding:10px; flex-wrap:wrap; }
  .title-line h1 { font-size:16px; }
  .toolbar { flex-wrap:wrap; width:100%; gap:4px; justify-content:flex-start; }
  .toolbar .sep { margin:0 3px; }
  .toolbar button { font-size:13px; padding:5px 8px; }
  main { padding:10px; }
  .region-row { grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:9px; padding:10px 10px 0; }
  .region-label { width:100%; min-width:0; grid-column:1/-1; }
  .region-label select { min-width:0; flex:1; }
  .project-head { grid-template-columns:minmax(0,1fr) minmax(0,1fr); padding:10px; gap:9px; }
  .project-head label:nth-child(1),.project-head label:nth-child(2) { grid-column:1/-1; }
  .project-head label:last-child { grid-column:1/-1; }
  .basis-line { padding:0 10px 8px; display:block; }
  .basis-line .link { display:block; margin-top:4px; }
  .sheet-head { padding:8px 10px; }
  .sheet-head>div { gap:9px; }
  .sheet-head h2 { font-size:14px; }
  .sheet-head button { font-size:12px; }
  .table-viewport { max-height:420px; }
  .sheet-foot { padding:6px 10px; }
  .totals { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .total-item { padding:10px!important; gap:4px 10px; }
  .total-item:nth-child(-n+2) { border-bottom:1px solid var(--line); }
  .total-item:nth-child(2) { border-right:0; }
  .total-item small { flex-basis:100%; }
  .total-item:last-child { justify-content:flex-start; }
  .total-item:last-child small { flex-basis:100%; }
  .status-row,.app-footer { display:block; }
  .bottom-actions { margin-top:8px; flex-wrap:wrap; gap:5px; }
  .status { padding-top:0; }
  .app-footer span { display:block; }
  .app-footer span+span { margin-top:4px; }
  .dialog-head h2 { font-size:15px; }
}
@media (forced-colors:active) {
  .workspace,.totals,.sheet-head { border-color:CanvasText; }
  button:focus-visible,input:focus,select:focus,textarea:focus { outline:2px solid Highlight; }
}
@media screen {
  .wordmark { color:var(--color-icon); text-decoration:none; }
  .wordmark:hover { color:var(--color-text); }
}
