/* АГА — «Чертёж ГПЗУ»: лист с рамкой, штампом и экспликацией. */
:root {
  --desk: #e6e8e5;
  --sheet: #ffffff;
  --ink: #141517;
  --ink-2: #3b3e42;
  --muted: #5d6166;
  --line: #141517;
  --thin: #a9adb2;
  --hatch: #b9bdc2;
  --red: #c8102e;
  --blue: #1d56a8;
  --blue-soft: #e5edf8;
  --red-soft: #fbe8eb;
  --fill-neigh: #e2e4e6;
  --shadow: 0 1px 2px rgba(20, 21, 23, .06), 0 12px 32px -8px rgba(20, 21, 23, .16);
  --f-sheet: "Jura", "Golos Text", system-ui, sans-serif;
  --f-text: "Golos Text", system-ui, sans-serif;
  --f-num: "JetBrains Mono", ui-monospace, monospace;
  --margin-bind: clamp(14px, 3.2vw, 56px);
  --margin: clamp(8px, 1.2vw, 16px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #0f1113; --sheet: #181b1e; --ink: #e9e8e3; --ink-2: #c9c8c3; --muted: #9ea2a6; --line: #d9d8d3;
    --thin: #50555b; --hatch: #454a50; --red: #ff5a6a; --blue: #7fb2ff; --blue-soft: #1b2a40; --red-soft: #3a1a20;
    --fill-neigh: #202428; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 16px 40px -12px rgba(0,0,0,.7); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --desk: #0f1113; --sheet: #181b1e; --ink: #e9e8e3; --ink-2: #c9c8c3; --muted: #9ea2a6; --line: #d9d8d3;
  --thin: #50555b; --hatch: #454a50; --red: #ff5a6a; --blue: #7fb2ff; --blue-soft: #1b2a40; --red-soft: #3a1a20;
  --fill-neigh: #202428; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 16px 40px -12px rgba(0,0,0,.7); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--desk); scrollbar-color: var(--thin) var(--desk); }
body { margin: 0; background: var(--desk); color: var(--ink); font: 400 15px/1.5 var(--f-text); -webkit-font-smoothing: antialiased; }
::selection { background: var(--blue); color: var(--sheet); }
input, button { font: inherit; color: inherit; caret-color: var(--blue); }
a { color: var(--blue); text-underline-offset: .18em; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.mono, td.mono { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

main { padding: clamp(10px, 2.2vw, 32px); display: grid; gap: clamp(16px, 2.4vw, 36px); max-width: 1560px; margin: 0 auto; }

/* ---------- лист ---------- */
.sheet { background: var(--sheet); box-shadow: var(--shadow); padding: var(--margin) var(--margin) var(--margin) var(--margin-bind); }
#sheet1 .frame { height: calc(100svh - 2 * clamp(10px, 2.2vw, 32px) - 2 * var(--margin)); max-height: 980px; }
.frame {
  border: 2px solid var(--line); min-height: 620px;
  display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(360px, 1fr);
  grid-template-rows: 1fr auto; grid-template-areas: "draw side" "draw stamp";
}
.drawing { grid-area: draw; position: relative; border-right: 2px solid var(--line); min-height: 520px; overflow: hidden; }
#plan { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.side { grid-area: side; padding: clamp(16px, 1.6vw, 26px); display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow: auto; }
h1, h2, h3 { font-family: var(--f-sheet); font-weight: 700; letter-spacing: -.01em; line-height: 1.05; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(28px, 2.5vw, 42px); }
h2 { font-size: clamp(24px, 2.2vw, 36px); }
h3 { font-size: 18px; }
.lede { margin: 0; color: var(--ink-2); max-width: 58ch; font-size: 14.5px; }

/* экспликация */
.expl { width: 100%; border-collapse: collapse; font-size: 14px; }
.expl th { font: 600 11.5px/1 var(--f-sheet); text-align: left; padding: 6px 8px; border: 1px solid var(--line); letter-spacing: .02em; }
.expl td { border: 1px solid var(--line); padding: 6px 8px; vertical-align: top; line-height: 1.35; font-size: 13.5px; }
.expl td:first-child { width: 44px; text-align: center; font-family: var(--f-num); font-size: 13px; }
.expl .v-title { font-weight: 600; display: flex; gap: 8px; align-items: flex-start; }
.expl .v-title svg { flex: none; width: 15px; height: 15px; margin-top: 3px; }
.expl .v-body { margin-top: 2px; }
.expl .v-src { margin-top: 2px; font-size: 12px; color: var(--muted); }
.tone-stop { color: var(--red); } .tone-warn { color: var(--red); } .tone-limit { color: var(--ink); } .tone-ok { color: var(--blue); }
.expl tr.is-stop td { background: var(--red-soft); }
.side-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }

/* ---------- штамп ---------- */
.stamp { grid-area: stamp; border-top: 2px solid var(--line); display: grid; grid-template-columns: 1fr; font-family: var(--f-sheet); position: relative; }
.rev { width: 100%; border-collapse: collapse; font-size: 12px; font-family: var(--f-text); }
.rev th { font: 600 11.5px/1 var(--f-sheet); text-align: left; padding: 5px 7px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.rev td { padding: 4px 7px; border-bottom: 1px solid var(--thin); border-right: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
.rev th:last-child, .rev td:last-child { border-right: 0; width: 86px; }
.rev th:first-child, .rev td:first-child { width: 40px; font-family: var(--f-num); }
.rev tr.fresh td { animation: ink 1.2s cubic-bezier(.16,1,.3,1); }
@keyframes ink { from { background: var(--blue-soft); } to { background: transparent; } }
.title-block { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, .55fr) minmax(0, .75fr) minmax(0, 1.1fr) minmax(158px, 1.3fr); border-top: 2px solid var(--line); }
.cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 9px 7px; display: flex; flex-direction: column; justify-content: space-between; min-height: 54px; position: relative; }
.cell-label { font: 600 11.5px/1.1 var(--f-sheet); color: var(--muted); letter-spacing: .02em; }
.cell-value { font: 700 17px/1.2 var(--f-sheet); }
.cell-value.mono { font: 500 clamp(12.5px, 1vw, 15px)/1.2 var(--f-num); white-space: nowrap; }
body:not([data-mode="order"]) #sheet1 .rev { display: none; }
.cell-value.small { font: 600 13px/1.25 var(--f-sheet); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cell-input { grid-column: 1 / 5; grid-row: 1; min-height: 76px; cursor: text; }
.cell-input input { border: 0; background: transparent; outline: 0; padding: 4px 0 0; font: 500 clamp(18px, 1.7vw, 24px)/1.2 var(--f-num); letter-spacing: -.01em; width: 100%; }
.cell-input input::placeholder { color: var(--muted); opacity: 1; }
.cell-input:focus-within { box-shadow: inset 0 0 0 2px var(--blue); }
.cell-wide { grid-column: 1 / 5; }
.cell-price { grid-column: 4; grid-row: 2; }
.cell-action {
  grid-column: 5; grid-row: 1 / 4; border: 0; border-bottom: 1px solid var(--line); background: var(--ink); color: var(--sheet);
  cursor: pointer; align-items: flex-start; justify-content: flex-end; text-align: left; gap: 4px; padding: 12px;
  transition: background .25s cubic-bezier(.16,1,.3,1);
}
.cell-action #go-label { font: 700 clamp(15px, 1.15vw, 19px)/1.12 var(--f-sheet); overflow-wrap: anywhere; }
.go-sub { font: 500 12px/1.2 var(--f-text); opacity: .8; }
.cell-action:hover { background: var(--blue); }
.cell-action:disabled { background: var(--thin); cursor: progress; }
.form-error { margin: 0; padding: 8px 10px; color: var(--red); font-size: 13.5px; border-top: 1px solid var(--line); }

/* подсказки */
.suggest { position: absolute; left: -1px; right: -1px; top: 100%; z-index: 20; margin: 0; padding: 0; list-style: none; background: var(--sheet); border: 2px solid var(--line); box-shadow: var(--shadow); max-height: 320px; overflow: auto; }
.suggest li { padding: 9px 12px; border-bottom: 1px solid var(--thin); cursor: pointer; display: grid; gap: 2px; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--blue-soft); }
.suggest .s-num { font: 500 14px var(--f-num); }
.suggest .s-addr { font-size: 12.5px; color: var(--muted); }
.suggest .s-empty { color: var(--muted); cursor: default; }

/* ---------- чертёж ---------- */
.plot { fill: none; stroke: var(--line); vector-effect: non-scaling-stroke; }
.plot-site { stroke: var(--red); stroke-width: 3; fill: url(#hatch-red); }
.plot-neigh { stroke: var(--ink-2); stroke-width: 1; fill: var(--fill-neigh); }
.plot-neigh.on-site { fill: var(--sheet); stroke-width: 1.2; }
.plot-rail { stroke-width: 3.2; }
.plot-rail-dash { stroke: var(--sheet); stroke-width: 1.8; stroke-dasharray: 9 9; }
.plot-radius { stroke: var(--blue); stroke-width: 1.3; stroke-dasharray: 14 4 2 4; }
.plot-leader { stroke: var(--blue); stroke-width: 1; }
.plot-dot, .plot-arrow { fill: var(--blue); }
.plot-knock { fill: var(--sheet); stroke: none; }
.plot-label, .plot-small, .plot-callout, .plot-callout-sub { paint-order: stroke; stroke: var(--sheet); stroke-width: calc(4px * var(--k, 1)); stroke-linejoin: round; }
.plot-label { font-family: var(--f-sheet); font-weight: 600; font-size: calc(12.5px * var(--k, 1)); fill: var(--ink); }
.plot-label.blue { fill: var(--blue); }
.plot-small { font-family: var(--f-num); font-weight: 500; font-size: calc(11px * var(--k, 1)); fill: var(--muted); }
.plot-callout { font-family: var(--f-sheet); font-weight: 700; font-size: calc(14px * var(--k, 1)); fill: var(--ink); }
.plot-callout-sub { font-family: var(--f-text); font-weight: 500; font-size: calc(12.5px * var(--k, 1)); fill: var(--ink-2); }
.plot-callout.red { fill: var(--red); }
.plot-scale { stroke: var(--ink); stroke-width: 1.2; }
.north { color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .draw-in .plot { stroke-dasharray: 1; stroke-dashoffset: 1; animation: plot 1.6s cubic-bezier(.16,1,.3,1) forwards; animation-delay: calc(var(--i, 0) * 18ms); }
  .draw-in .plot-neigh, .draw-in .plot-site { fill-opacity: 0; animation: plot 1.6s cubic-bezier(.16,1,.3,1) forwards, fillin .8s ease-out forwards; animation-delay: calc(var(--i, 0) * 18ms), calc(900ms + var(--i, 0) * 10ms); }
  .draw-in .plot-callout, .draw-in .plot-callout-sub, .draw-in .plot-label { opacity: 0; animation: fade .6s ease-out forwards; animation-delay: 1.3s; }
}
@keyframes plot { to { stroke-dashoffset: 0; } }
@keyframes fillin { to { fill-opacity: 1; } }
@keyframes fade { to { opacity: 1; } }

.drawing-state { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in oklab, var(--sheet) 82%, transparent); text-align: center; padding: 24px; }
.drawing-state .ds-box { max-width: 420px; display: grid; gap: 10px; justify-items: center; }
.drawing-state .ds-title { font: 700 24px/1.1 var(--f-sheet); }
.plotter { width: 240px; height: 3px; background: var(--thin); position: relative; overflow: hidden; }
.plotter::after { content: ""; position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--p, .04)); background: var(--blue); transition: transform .6s cubic-bezier(.16,1,.3,1); }

/* поле email у оплаты */
.email { display: grid; gap: 6px; width: 100%; }
.email input { border: 0; border-bottom: 1.5px solid var(--line); background: transparent; padding: 6px 0; outline: 0; font: 500 16px var(--f-text); }
.email input:focus { border-bottom-color: var(--blue); }

/* кнопки */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); background: transparent; padding: 10px 14px; font: 700 14.5px/1 var(--f-sheet); cursor: pointer; text-decoration: none; color: var(--ink); }
.btn:hover { background: var(--ink); color: var(--sheet); }
.btn.primary { background: var(--ink); color: var(--sheet); }
.btn.primary:hover { background: var(--blue); border-color: var(--blue); }

/* ---------- лист 2 ---------- */
.frame-2 { grid-template-columns: minmax(0, 1.8fr) minmax(320px, 1fr); min-height: min(720px, 90svh); }
.axo { grid-area: draw; position: relative; border-right: 2px solid var(--line); min-height: 460px; background: var(--sheet); }
.axo canvas { outline: none; }
.axo-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font: 600 14px var(--f-sheet); }
.side-2 { gap: 16px; }
.sun-controls { display: grid; gap: 18px; margin-top: 8px; }
.seasons { display: grid; grid-template-columns: repeat(4, 1fr); border: 1.5px solid var(--line); }
.seasons button { border: 0; border-right: 1px solid var(--line); background: transparent; padding: 10px 4px; font: 600 13px var(--f-sheet); cursor: pointer; }
.seasons button:last-child { border-right: 0; }
.seasons button[aria-checked="true"] { background: var(--ink); color: var(--sheet); }
.seasons button:hover:not([aria-checked="true"]) { background: var(--blue-soft); }
.time { display: grid; gap: 6px; }
.time-read { font: 600 15px var(--f-sheet); }
.time-read .mono { font-size: 22px; font-weight: 500; margin-right: 6px; }
.time input[type=range] { width: 100%; accent-color: var(--blue); }
.ticks { display: flex; justify-content: space-between; font: 500 11px var(--f-num); color: var(--muted); padding: 0 2px; }
.stamp-mini { grid-area: stamp; display: grid; grid-template-columns: 1fr 90px; border-top: 2px solid var(--line); }
.stamp-mini .cell:last-child { border-right: 0; }

/* расчёт солнца на участке (лист 2) */
.readout { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 4px; }
.readout th { text-align: left; font: 600 12px/1.2 var(--f-sheet); color: var(--muted); padding: 8px 8px 8px 0; border-top: 1px solid var(--line); width: 44%; vertical-align: top; }
.readout td { padding: 8px 0; border-top: 1px solid var(--line); }
.readout td.mono { font-size: 17px; }
.readout tr:last-child th, .readout tr:last-child td { border-bottom: 1px solid var(--line); }
.meta-note { margin: 0; font-size: 12.5px; color: var(--muted); }

/* ---------- лист 3 ---------- */
.frame-3 { grid-template-columns: minmax(0, 1.8fr) minmax(300px, 1fr); grid-template-areas: "list notes" "list stamp"; min-height: 0; }
.list-col { grid-area: list; padding: clamp(18px, 2vw, 32px); border-right: 2px solid var(--line); display: grid; gap: 18px; align-content: start; }
.notes-col { grid-area: notes; padding: clamp(18px, 2vw, 32px); display: grid; gap: 12px; align-content: start; }
.ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
.ledger th { font: 600 11.5px/1 var(--f-sheet); text-align: left; padding: 7px 9px; border: 1px solid var(--line); }
.ledger td { border: 1px solid var(--line); padding: 9px; vertical-align: top; }
.ledger td:first-child { width: 48px; text-align: center; }
.ledger td:nth-child(2) { font: 700 14.5px/1.25 var(--f-sheet); width: 28%; }
.ledger td:last-child { width: 110px; font: 600 12.5px var(--f-sheet); color: var(--muted); }
.ledger tr.free td:last-child { color: var(--blue); }
.notes { margin: 0; padding-left: 20px; display: grid; gap: 10px; color: var(--ink-2); font-size: 14px; max-width: 62ch; }
.frame-3 .stamp-mini { grid-area: stamp; }

.colophon { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 4px 4px 24px; font: 600 13px var(--f-sheet); }
.colophon .muted { font: 400 13px var(--f-text); }

/* ---------- справка: текстовые листы ---------- */
.doc-page main { max-width: 1380px; }
.frame-doc {
  grid-template-columns: minmax(0, 1.8fr) minmax(300px, 1fr); grid-template-rows: auto 1fr auto;
  grid-template-areas: "head side" "body side" "body stamp"; min-height: 0;
}
.doc-head { grid-area: head; border-right: 2px solid var(--line); padding: clamp(20px, 2.4vw, 40px) clamp(18px, 2.6vw, 44px) 22px; display: grid; gap: 14px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px 8px; font: 600 12.5px/1.2 var(--f-sheet); color: var(--muted); letter-spacing: .02em; }
.crumbs a { color: var(--blue); }
.doc-head .lede { font-size: 16px; max-width: 60ch; }
.doc-body { grid-area: body; border-right: 2px solid var(--line); padding: 0 clamp(18px, 2.6vw, 44px) clamp(28px, 3vw, 52px); display: grid; gap: 36px; align-content: start; }
.doc-body section { display: grid; gap: 12px; }
.doc-body h2 { font-size: clamp(20px, 1.6vw, 26px); display: flex; gap: 12px; align-items: baseline; padding-top: 16px; border-top: 1px solid var(--line); }
.pos { flex: none; display: inline-grid; place-items: center; min-width: 28px; height: 24px; border: 1px solid var(--line); font: 500 13px/1 var(--f-num); transform: translateY(-3px); }
.doc-body p { margin: 0; max-width: 68ch; }
.doc-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; max-width: 68ch; }
.doc-list li::marker { color: var(--muted); }
.table-wrap { overflow-x: auto; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.35; }
.doc-table th, .doc-table td { border: 1px solid var(--line); padding: 7px 9px; vertical-align: top; text-align: left; }
.doc-table thead th { font: 600 11.5px/1.1 var(--f-sheet); letter-spacing: .02em; }
.doc-table tbody td:first-child, .doc-table tbody th[scope="row"] { font: 700 13.5px/1.25 var(--f-sheet); width: 26%; }
.doc-table td:nth-child(3) { width: 24%; font-size: 12.5px; color: var(--muted); }
.doc-compare td:nth-child(3) { width: auto; font-size: 13.5px; color: var(--ink); }
.doc-compare thead th:not(:first-child) { font: 700 14px/1.1 var(--f-sheet); }
.doc-table caption { caption-side: top; text-align: left; font: 700 15px/1.3 var(--f-sheet); padding-bottom: 8px; }
.doc-example { margin: 0; }
.faq { margin: 0; border-top: 1px solid var(--line); max-width: 76ch; }
.faq dt { font: 700 15.5px/1.3 var(--f-sheet); padding-top: 14px; }
.faq dd { margin: 6px 0 0; padding-bottom: 14px; border-bottom: 1px solid var(--thin); color: var(--ink-2); }

.doc-side { grid-area: side; align-self: start; position: sticky; top: 0; padding: clamp(16px, 1.6vw, 26px); display: grid; gap: 14px; }
.doc-cta { display: grid; border: 2px solid var(--line); }
.doc-cta .cell-input { grid-column: auto; grid-row: auto; border-right: 0; }
.doc-cta .cell-input input { font-size: clamp(18px, 1.5vw, 22px); }
.doc-cta .cell-action { grid-column: auto; grid-row: auto; min-height: 76px; border: 0; justify-content: center; gap: 4px; }
.doc-cta .go-label { font: 700 19px/1.1 var(--f-sheet); }
.doc-cta-note { margin: 0; font-size: 13px; color: var(--ink-2); }
.doc-index-table { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.3; }
.doc-index-table th { font: 600 11.5px/1.1 var(--f-sheet); letter-spacing: .02em; text-align: left; padding: 7px 9px; border: 1px solid var(--line); }
.doc-index-table td { border: 1px solid var(--line); padding: 8px 9px; vertical-align: top; }
.doc-index-table td:first-child { width: 52px; text-align: center; font-size: 12.5px; }
.doc-index-table tr[aria-current="page"] td { background: var(--ink); color: var(--sheet); font-weight: 600; }
.frame-doc .stamp-mini { grid-area: stamp; }
.colophon-nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
@media (max-width: 980px) {
  .frame.frame-doc { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "head" "side" "body" "stamp"; }
  .doc-head, .doc-body { border-right: 0; }
  .doc-side { position: static; border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); margin-bottom: 20px; }
  .doc-cta .cell-action { flex-direction: column; align-items: flex-start; }
  .doc-body section:first-child h2 { border-top: 0; padding-top: 4px; }
  .doc-index { display: none; }
  .doc-body { padding-bottom: 28px; }
}
@media (max-width: 560px) {
  .doc-table tbody td:first-child, .doc-table tbody th[scope="row"] { width: 34%; }
  .doc-table td:nth-child(3) { width: auto; }
}

/* оплата по коду: один лист на столе */
.pay-desk { min-height: 100svh; display: grid; place-items: center; padding: clamp(10px, 2.2vw, 32px); max-width: none; }
.pay-sheet { width: min(560px, 100%); }
.pay-frame { border: 2px solid var(--line); padding: clamp(18px, 2.4vw, 32px); display: grid; gap: 16px; }
.pay-summary tbody th[scope="row"] { width: 30%; }
.pay-back { margin: 0; font-size: 14px; }

/* тестовая оплата */
.mock-pay { min-height: 100svh; display: grid; place-items: center; padding: 24px; }
.mock-pay .card { background: var(--sheet); box-shadow: var(--shadow); border: 2px solid var(--line); padding: 28px; display: grid; gap: 14px; max-width: 420px; width: 100%; }
.mock-pay .eyebrow { margin: 0; font: 600 12px var(--f-sheet); color: var(--red); }
.mock-pay h1 { font-family: var(--f-num); font-weight: 500; }
.mock-pay form { display: contents; }

/* ---------- адаптив ---------- */
@media (max-width: 980px) {
  #sheet1 .frame { height: auto; max-height: none; }
  .side { overflow: visible; }
  .frame, .frame-2, .frame-3 { grid-template-columns: 1fr; grid-template-rows: auto; }
  .frame { grid-template-areas: "side" "stamp" "draw"; }
  .frame-2 { grid-template-areas: "draw" "side" "stamp"; }
  .frame-3 { grid-template-areas: "list" "notes" "stamp"; }
  .drawing, .axo, .list-col { border-right: 0; }
  .drawing { border-top: 2px solid var(--line); min-height: 64svh; }
  .axo { min-height: 60svh; border-bottom: 2px solid var(--line); }
  .list-col { border-bottom: 2px solid var(--line); }
  .stamp { border-top: 0; }
  .frame > .stamp { border-top: 2px solid var(--line); }
}
@media (max-width: 980px) {
  /* телефон и планшет: заголовок → штамп с вводом → выводы → чертёж */
  #sheet1 .frame { display: flex; flex-direction: column; }
  #sheet1 .side { display: contents; }
  #sheet1 .side > * { margin-left: clamp(14px, 4vw, 24px); margin-right: clamp(14px, 4vw, 24px); }
  #title1 { order: 1; margin-top: 18px; margin-bottom: 14px; }
  #sheet1 .drawing { order: 2; min-height: 0; height: 56svh; border-bottom: 0; }
  #sheet1 .stamp { order: 3; }
  #lede { order: 4; margin-top: 16px; }
  #expl { order: 5; margin-top: 12px; width: auto; }
  #side-actions { order: 6; margin-top: 12px; margin-bottom: 16px; }
  #sheet1 .rev { display: none; }
}
@media (max-width: 560px) {
  .title-block { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cell-input { grid-column: 1 / 4; }
  .cell-action { grid-column: 1 / 4; grid-row: auto; min-height: 64px; flex-direction: row; justify-content: space-between; align-items: center; }
  .cell-wide { grid-column: 1 / 3; }
  .cell-price { grid-column: 3 / 4; grid-row: auto; }
  .rev tbody tr:nth-child(n+4) { display: none; }
  #ledger td:nth-child(3) { display: none; }
  #ledger th:nth-child(3) { display: none; }
  .seasons { grid-template-columns: repeat(2, 1fr); }
  .seasons button:nth-child(2) { border-right: 0; }
  .seasons button:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
