/* СчётКа — DESIGN.md «Бланк» + UX/UI v3 foundation (D050) */
:root {
  --paper: #F4F6F8;
  --sheet: #FFFFFF;
  --ink: #12151A;
  --muted: #5C6570;
  --rule: #D5DAE0;
  --stamp: #B42318;
  --ink-blue: #1F4B99;
  --desk: #E6EAEF;
  /* aliases used across markup */
  --line: var(--rule);
  --accent: var(--stamp);
  --accent-2: var(--stamp);
  --card: var(--sheet);
  --shadow: 0 12px 40px rgba(18, 21, 26, 0.08);

  /* spacing scale — prefer these over ad-hoc px */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* containers / page shell */
  --container: 1100px;
  --container-wide: 1180px;
  --container-prose: 65ch;
  --container-narrow: 720px;
  --page-gutter: 20px;

  /* type */
  --text-xs: 0.72rem;
  --text-sm: 0.85rem;
  --text-md: 0.95rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.55rem;
  --leading: 1.45;
  --leading-tight: 1.25;

  /* controls */
  --control-pad-y: 8px;
  --control-pad-x: 2px;
  --control-gap: var(--space-2);
  --radius-sheet: 3px;
  --radius-control: 6px;
  --radius: 4px;

  --font-display: "IBM Plex Sans", "PT Sans", "Segoe UI", sans-serif;
  --font-body: "IBM Plex Sans", "PT Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "PT Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: clip; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    linear-gradient(180deg, var(--paper) 0%, var(--desk) 100%);
  min-height: 100vh;
}
body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a { color: var(--ink-blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3);
  max-width: var(--container); margin: 0 auto;
  padding: var(--space-4) var(--page-gutter) var(--space-2);
}
.top-nav {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.top .toolbar { margin: 0; }
.logo {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.35rem; letter-spacing: -0.03em; color: var(--ink);
  display: inline-flex; align-items: center; gap: var(--space-2);
  text-decoration: none;
}
.logo:hover { text-decoration: none; }
.logo span { color: var(--stamp); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule); background: var(--sheet); color: var(--ink);
  border-radius: var(--radius-control); padding: 10px var(--space-4); font-weight: 600; cursor: pointer;
  font-family: inherit; font-size: inherit;
  transition: box-shadow .15s ease, border-color .15s ease;
  text-decoration: none;
}
.btn:hover { box-shadow: var(--shadow); text-decoration: none; border-color: #b8c0c9; }
.btn:focus-visible { outline: 2px solid var(--ink-blue); outline-offset: 2px; }
.btn-primary {
  background: var(--ink); color: #fff; border-color: transparent;
}
.btn-primary:hover { background: #1c222b; }
.btn-accent, .btn-stamp {
  background: var(--stamp); color: #fff; border-color: transparent;
}
.btn-accent:hover, .btn-stamp:hover { background: #961d14; }

/* —— Form grammar (label → control → help/error) —— */
.field {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}
.field-label,
.field > label,
label.field-label {
  display: block;
  margin: 0;
  font-size: var(--text-xs);
  color: var(--muted);
  letter-spacing: .02em;
  line-height: var(--leading-tight);
}
.field-help {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: var(--leading);
}
.field-error,
.err {
  color: var(--stamp);
  font-size: var(--text-sm);
  margin: 0;
}
.field-ok {
  color: var(--ink-blue);
  font-size: var(--text-sm);
  margin: 0;
}
.field-ok[hidden],
.field-ok.is-hidden { display: none; }
.field-compact {
  gap: var(--space-1);
}
.field-compact .field-label,
.field-compact > label { margin: 0; }
.field-group {
  display: grid;
  gap: var(--space-3);
}
.form-section {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
}
.form-section + .form-section {
  margin-top: var(--space-5);
}
.form-section__title,
.form-panel h3.form-section__title {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.field-error-inline {
  color: var(--stamp);
  font-size: var(--text-xs);
  margin: var(--space-1) 0 0;
  min-height: 1.1em;
}
.field-invalid input,
.field-invalid select,
.field-invalid textarea {
  border-bottom-color: var(--stamp);
  box-shadow: 0 1px 0 0 var(--stamp);
}
.req { color: var(--stamp); font-weight: 600; }

/* —— Invoice form steps (UX/UI v3 step 3) —— */
.form-progress {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--rule);
}
.form-progress__step {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: var(--radius);
  background: var(--desk);
  letter-spacing: .02em;
}
.form-progress__step.is-active {
  color: var(--ink);
  background: var(--sheet);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.form-progress__step.is-done {
  color: var(--ink-blue);
  background: #eef3fb;
}
.form-step {
  margin-bottom: var(--space-5);
}
.form-step__head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.form-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius);
  background: var(--desk);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--muted);
  font-family: var(--font-mono);
}
.form-step--done .form-step__num,
.form-step--done .form-step__title { color: var(--ink-blue); }
.form-step__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.form-step--extra { margin-top: 0; }
.items-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.items-total {
  font-size: var(--text-sm);
  color: var(--muted);
  font-family: var(--font-mono);
}
.items-total strong { color: var(--ink); font-weight: 600; }

.item-row {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sheet);
  background: var(--sheet);
}
.item-row + .item-row { margin-top: var(--space-2); }
.item-row__main { display: grid; gap: var(--space-3); }
.item-row__nums {
  display: grid;
  grid-template-columns: 1fr 0.7fr 1fr;
  gap: var(--space-2);
  align-items: end;
}
.item-row__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px dashed var(--rule);
}
.item-row .i-del {
  font-size: var(--text-xs);
  padding: 6px 10px;
  color: var(--muted);
}
.item-row-sum strong { font-family: var(--font-mono); color: var(--ink); }

.btn.is-loading {
  opacity: .85;
  cursor: wait;
  pointer-events: none;
}

.app-banner__text { flex: 1; min-width: min(240px, 100%); }
.app-banner__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.app-banner.is-dismissed,
.app-banner.is-collapsed { display: none; }
.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  padding: 4px 10px;
}
.btn-quiet:hover { box-shadow: none; color: var(--ink); }

.form-panel--success .form-step--result .form-step__num {
  background: var(--stamp);
  color: #fff;
}
.form-actions {
  display: flex;
  gap: var(--space-2) var(--space-3);
  flex-wrap: wrap;
  align-items: center;
  margin-top: var(--space-5);
}
.section-cta {
  margin-top: var(--space-5);
}
.link-cta {
  color: var(--ink-blue);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 1.02rem;
}
.link-cta:hover { color: var(--ink); }

/* Acquisition panel — one primary path on SEO/blog */
.acq-panel {
  margin: var(--space-5) 0 var(--space-6);
  padding: var(--space-5) var(--space-4);
  max-width: 28rem;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sheet);
  box-shadow: 0 8px 28px rgba(18, 21, 26, 0.06);
}
.acq-panel-title {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-3);
}
.acq-panel-lead {
  margin: 0 0 var(--space-4);
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}
.acq-actions { margin: 0; }
.acq-actions .btn { width: 100%; justify-content: center; padding: 12px 18px; }
.acq-alt {
  margin: var(--space-3) 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
}
.acq-alt a {
  color: var(--ink-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.acq-panel .hero-note { margin-top: var(--space-3); }
.acq-panel .seo-quick { margin: 0; max-width: none; }
.section-guides {
  border-top: 1px solid var(--rule);
  padding-top: var(--space-6);
}

/* —— Landing hero: brand rail + dominant sheet plane —— */
.hero, .hero-desk {
  max-width: var(--container-wide); margin: 0 auto;
  padding: var(--space-3) var(--page-gutter) var(--space-7);
  display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: var(--space-5) 40px; align-items: center;
  min-height: min(78vh, 820px);
}
.hero-rail { max-width: 300px; }
.hero-brand {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 6vw, 3.8rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.045em;
  margin: 0 0 14px;
}
.hero-brand .ka { color: var(--stamp); }
.hero p.lead, .hero-rail .lead {
  font-size: 1.05rem; color: var(--muted); max-width: 18rem;
  margin: 0 0 20px; line-height: 1.45;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 0; }
.hero-actions .btn-stamp { padding: 12px 18px; }
.hero-note { margin-top: 14px; color: var(--muted); font-size: .88rem; line-height: 1.4; }

/* A4 sheet signature */
.sheet {
  position: relative;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sheet);
  box-shadow: var(--shadow);
  padding: clamp(20px, 3.5vw, 34px) clamp(18px, 3vw, 30px);
  aspect-ratio: 210 / 297;
  max-height: min(720px, 82vh);
  width: min(100%, 540px);
  justify-self: end;
  overflow: hidden;
  animation: sheet-in .38s ease both;
}
.hero-sheet {
  width: min(100%, 560px);
  max-height: min(760px, 86vh);
  justify-self: center;
}
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .sheet { animation: none; }
  .stamp { animation: none !important; }
}
.stamp {
  position: absolute;
  top: 16px; right: 16px;
  width: 58px; height: 58px;
  border: 2px solid var(--stamp);
  border-radius: 50%;
  color: var(--stamp);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .65rem;
  letter-spacing: 0.04em;
  display: flex; align-items: center; justify-content: center;
  text-transform: uppercase;
  transform: rotate(-14deg);
  opacity: 0;
  box-shadow: inset 0 0 0 5px rgba(180, 35, 24, 0.12);
  animation: stamp-in .5s ease .25s forwards;
}
@keyframes stamp-in {
  from { opacity: 0; transform: rotate(-14deg) scale(0.92); }
  to { opacity: 0.88; transform: rotate(-14deg) scale(1); }
}
.sheet-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px;
  margin: 0 0 18px; padding-right: 68px;
}
.sheet-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  margin: 0;
}
.sheet-date {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.sheet-parties {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px;
  margin-bottom: 16px;
}
.sheet-party { font-size: .86rem; line-height: 1.4; }
.sheet-party .lbl {
  color: var(--muted); font-size: .72rem; text-transform: uppercase;
  letter-spacing: .04em; margin-bottom: 4px;
}
.sheet-mono, .sheet-bank {
  font-family: var(--font-mono);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  margin-top: 2px;
}
.sheet-bank { line-height: 1.35; }
.sheet-table { margin-top: 4px; border-top: 1px solid var(--rule); }
.sheet-table-head, .sheet-table-row {
  display: grid;
  grid-template-columns: 1.6rem 1fr 2.4rem 5.5rem;
  gap: 8px;
  padding: 7px 0;
  font-size: .82rem;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}
.sheet-table-head {
  color: var(--muted); font-size: .7rem; text-transform: uppercase;
  letter-spacing: .03em; font-weight: 600;
}
.sheet-table-row .sheet-money { text-align: right; }
.sheet-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  font-size: .9rem;
}
.sheet-row .lbl { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.sheet-row .val-mono, .sheet-money, .sheet-total strong {
  font-family: var(--font-mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.sheet-total {
  margin-top: 14px;
  font-size: 1.05rem;
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px;
}
.sheet-meta { color: var(--muted); font-size: .75rem; margin-top: 14px; }

.guides-more {
  margin-top: 18px;
  border-top: 1px solid var(--rule);
  padding-top: 12px;
}
.guides-more summary {
  cursor: pointer; font-weight: 600; color: var(--ink-blue);
  font-size: .95rem; list-style: none;
}
.guides-more summary::-webkit-details-marker { display: none; }
.guides-more[open] summary { margin-bottom: 12px; }
.link-grid-hubs { margin-bottom: 0; }

.section { max-width: var(--container); margin: 0 auto; padding: var(--space-2) var(--page-gutter) var(--space-8); }
.section h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl); letter-spacing: -0.03em; margin: 0 0 var(--space-2); font-weight: 700;
}
.section .sub { color: var(--muted); margin: 0 0 var(--space-5); max-width: 40rem; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; max-width: 40rem; }
.steps li {
  display: grid; grid-template-columns: 2rem 1fr; gap: 12px;
  padding: 0; border: 0; background: none;
}
.steps .n {
  font-family: var(--font-mono); font-weight: 500; color: var(--stamp); font-size: .95rem;
}
.steps strong { display: block; margin-bottom: 2px; }
.steps p { margin: 0; color: var(--muted); line-height: 1.45; font-size: .95rem; }

.link-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 28px;
  margin: 0; padding: 0; list-style: none;
}
.link-grid a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.link-grid li { padding: 6px 0; border-bottom: 1px solid var(--rule); font-size: .95rem; }
.link-grid .hint { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; text-decoration: none; }

.pricing {
  display: grid; gap: 0; border: 1px solid var(--rule); background: var(--sheet);
  border-radius: 3px; overflow: hidden; max-width: 560px;
}
.price {
  padding: 16px 18px;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: baseline;
  border-bottom: 1px solid var(--rule);
}
.price:last-child { border-bottom: 0; }
.price.featured { background: #fafbfc; box-shadow: inset 3px 0 0 var(--stamp); }
.price .amount {
  font-family: var(--font-mono); font-size: 1.35rem; font-weight: 500;
  letter-spacing: -0.02em; grid-column: 2; grid-row: 1 / span 2; align-self: center;
}
.price .amount small { font-size: .85rem; color: var(--muted); font-weight: 500; }
.price p { margin: 0; color: var(--muted); font-size: .88rem; grid-column: 1; }

.footer {
  border-top: 1px solid var(--rule);
  padding: var(--space-5) var(--page-gutter);
  color: var(--muted);
  text-align: center; font-size: var(--text-sm);
}
.site-footer { display: flex; flex-direction: column; gap: var(--space-3); align-items: center; }
.footer-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; }
.footer-logo, .logo-mark {
  border-radius: 3px;
  vertical-align: middle;
  flex-shrink: 0;
  display: block;
}
.footer-legal { line-height: 1.55; max-width: 640px; }
.footer-pay { margin-top: 4px; }
.robokassa-badge img { display: block; border-radius: 2px; }
.footer-links { margin: 4px 0 0; font-size: .85rem; }
.pay-legal { color: var(--muted); font-size: .8rem; margin: 10px 0 0; line-height: 1.4; }

.cookie-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 80;
  max-width: 720px; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px;
  padding: 14px 16px;
  padding-bottom: max(14px, env(safe-area-inset-bottom, 0px));
  background: var(--sheet);
  border: 1px solid var(--rule); border-radius: 4px;
  box-shadow: var(--shadow);
}
.cookie-banner-text { margin: 0; flex: 1 1 240px; font-size: .88rem; color: var(--ink); line-height: 1.45; }
.cookie-banner-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.consent-check {
  display: flex; gap: 8px; align-items: flex-start;
  margin: 8px 0 0; font-size: .82rem; color: var(--muted); line-height: 1.4;
}
.consent-check input { margin-top: 3px; flex-shrink: 0; }

/* I03: cookie owns bottom chrome — suppress stickies while undecided */
body:has(.cookie-banner) .sticky-cta,
body:has(.cookie-banner) .landing-sticky {
  display: none !important;
}
body:has(.cookie-banner).app-page { padding-bottom: 120px; }
body:has(.cookie-banner):has(.landing-sticky) { padding-bottom: 120px; }

/* App */
.app-shell { max-width: var(--container); margin: 0 auto; padding: var(--space-3) var(--page-gutter) var(--space-8); }
.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: var(--space-5);
  align-items: start;
}
.app-grid[hidden] { display: none !important; }
.panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}
.form-panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  display: grid;
  gap: 0;
}
.form-panel > .form-section__title,
.form-panel > h3:not(.form-section__title) {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  margin: var(--space-5) 0 var(--space-2);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-panel > .form-section:first-child .form-section__title,
.form-panel > h3:first-of-type { margin-top: 0; }
label { display: block; font-size: var(--text-xs); color: var(--muted); margin: 0 0 var(--space-1); letter-spacing: .02em; }
input, select, textarea {
  width: 100%; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0;
  padding: var(--control-pad-y) var(--control-pad-x); font: inherit; background: transparent; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-bottom-color: var(--ink-blue);
  box-shadow: 0 1px 0 0 var(--ink-blue);
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.row2:has(> .btn) { align-items: end; }
.row3 { display: grid; grid-template-columns: 2fr 0.7fr 0.7fr 1fr auto; gap: var(--space-2); align-items: end; }
#items.field-group,
#items { display: grid; gap: var(--space-3); margin: 0; }
.toolbar { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: end; margin-bottom: var(--space-4); }
.toolbar.form-meta { margin-bottom: var(--space-5); }
.toolbar .field,
.toolbar label { margin: 0; min-width: 0; }
.pill {
  display: inline-flex; gap: 6px; align-items: center;
  background: var(--desk);
  border-radius: var(--radius); padding: 6px 10px; font-size: var(--text-sm); color: var(--muted);
  font-family: var(--font-mono);
}

/* Monetization — inline step (not modal) */
.pay-nudge {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 16px;
  margin: 0 0 var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--stamp);
}
.pay-nudge[hidden] { display: none !important; }
.pay-nudge__text { margin: 0; flex: 1 1 220px; font-size: var(--text-sm); line-height: 1.45; color: var(--ink); }
.pay-nudge__text strong { display: inline; }

.pay-panel {
  max-width: 36rem;
  margin: 0 0 var(--space-6);
  padding: var(--space-4) 0 var(--space-5);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.pay-panel[hidden] { display: none !important; }
.pay-panel__head {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: var(--space-3); margin-bottom: var(--space-4);
}
.pay-panel__kicker {
  margin: 0 0 4px;
  font-size: var(--text-xs); font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.pay-panel__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  letter-spacing: -0.02em;
}
body.pay-open .sticky-cta { display: none !important; }
body.pay-open .app-banner:not(.app-banner-nudge) { display: none; }

.sku-list { display: grid; gap: 0; margin: 14px 0; border: 1px solid var(--rule); border-radius: 3px; overflow: hidden; }
.sku {
  border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: center; cursor: pointer;
  gap: 12px; background: var(--sheet);
}
.sku:last-child { border-bottom: 0; }
.sku:hover { background: #fafbfc; }
.sku-featured {
  background: #fafbfc;
  box-shadow: inset 3px 0 0 var(--stamp);
}
.sku-badge {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  border-radius: 3px; background: var(--stamp); color: #fff;
  font-size: .68rem; font-weight: 700; text-transform: lowercase; vertical-align: middle;
}
.sku-price { font-family: var(--font-mono); font-weight: 500; white-space: nowrap; }
.pay-steps {
  text-align: left; margin: 0 0 14px; padding-left: 1.2rem;
  color: var(--ink); font-size: .92rem; line-height: 1.45;
}
.pay-steps li { margin: 6px 0; }
.usdt-help {
  text-align: left; margin-top: 14px; padding: 12px 14px;
  border: 1px dashed var(--rule); border-radius: 3px; background: var(--paper);
}
.usdt-help summary { cursor: pointer; font-weight: 700; color: var(--ink-blue); }
.usdt-help ol { margin: 10px 0 0; padding-left: 1.2rem; font-size: .9rem; line-height: 1.45; }
.err { color: var(--stamp); font-size: var(--text-sm); }

.page-shell,
.wrap,
.seo .wrap,
.legal-main {
  max-width: var(--container-prose);
  margin: var(--space-6) auto;
  padding: 0 var(--page-gutter) var(--space-8);
}
.seo h1,
.legal h1,
.utility-title { letter-spacing: -0.03em; font-family: var(--font-display); font-weight: 700; }
.prose .lead,
.not-found .lead { color: var(--muted); font-size: 1.1rem; line-height: 1.5; }
.prose h2 { margin-top: 1.6em; letter-spacing: -0.02em; font-family: var(--font-display); }
.prose details { margin: var(--space-3) 0; padding: var(--space-3) 14px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-sheet); }
.prose summary { cursor: pointer; font-weight: 600; }
.prose a, .prose code, .footer-legal { overflow-wrap: anywhere; }

/* —— Secondary: legal / utility / 404 (D055) —— */
.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: 0 0 var(--space-5);
  padding: 0 0 var(--space-3);
  border-bottom: 1px solid var(--rule);
}
.legal-nav__link {
  color: var(--muted);
  font-weight: 600;
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  text-decoration: none;
  padding: var(--space-1) 0;
  border-bottom: 2px solid transparent;
}
.legal-nav__link:hover { color: var(--ink); text-decoration: none; }
.legal-nav__link.is-active {
  color: var(--ink);
  border-bottom-color: var(--stamp);
}
.legal-sheet {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sheet);
  padding: var(--space-6) var(--space-5);
  box-shadow: 0 8px 28px rgba(18, 21, 26, 0.05);
}
.legal-sheet h1 {
  margin: 0 0 var(--space-4);
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  line-height: var(--leading-tight);
}
.legal-sheet > .muted:first-of-type { margin-top: 0; }
.legal-sheet ul { padding-left: 1.2em; }
.legal-sheet li { margin: var(--space-2) 0; }
.legal-main .section-cta { margin-top: var(--space-5); }

.utility-main {
  max-width: var(--container-narrow);
  margin: var(--space-6) auto;
  padding: 0 var(--page-gutter) var(--space-8);
}
.utility-title { margin: 0 0 var(--space-2); font-size: var(--text-xl); }
.utility-panel {
  margin-top: var(--space-5);
  padding: var(--space-5) var(--space-4);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sheet);
}
.admin-key-row { grid-template-columns: 1fr auto; }
.admin-out {
  margin: var(--space-4) 0 0;
  padding: var(--space-4);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sheet);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.45;
  max-height: 70vh;
  overflow: auto;
}
.not-found {
  max-width: var(--container-narrow);
  margin: var(--space-8) auto;
  padding: 0 var(--page-gutter) var(--space-8);
  text-align: left;
}
.not-found__code {
  margin: 0 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.not-found h1 {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: -0.03em;
}
.not-found__actions { margin-top: var(--space-5); }
.share-footer {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: var(--space-4) var(--page-gutter) var(--space-7);
  color: var(--muted);
  font-size: var(--text-sm);
}
.muted { color: var(--muted); font-size: var(--text-sm); }
.muted-sm { color: var(--muted); font-size: var(--text-xs); margin: 0; }
.empty-hint { color: var(--muted); font-size: var(--text-sm); margin: 0; }
button.linkish {
  background: none; border: 0; padding: 0; color: var(--ink-blue);
  font: inherit; text-decoration: underline; cursor: pointer;
}
.doc-history { display: grid; gap: 8px; margin-bottom: 18px; }
.hist-row {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--rule); border-radius: 3px; background: var(--sheet);
}
.hist-main { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.hist-kind {
  flex-shrink: 0;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 7px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--muted);
  background: var(--paper);
}
.hist-kind--act {
  color: var(--stamp);
  border-color: color-mix(in srgb, var(--stamp) 35%, var(--rule));
}
.lifecycle-head { margin-bottom: var(--space-3); }
.lifecycle-head h3 { margin-bottom: var(--space-1); }
.lifecycle-head .field-help { margin: 0; }
.share-result-actions {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding-top: 4px;
}
.share-email {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px dashed var(--rule);
  display: grid;
  gap: 8px;
}
.sheet-kicker {
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 4px;
  text-transform: uppercase;
  font-size: .72rem;
  letter-spacing: .06em;
}
.sheet-note {
  margin: 12px 0 0;
  font-size: .88rem;
  color: var(--ink);
  line-height: 1.45;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}
.sheet-note[hidden] { display: none; }
#cloneStatus:not(.is-hidden) {
  display: block;
  margin-top: 10px;
  color: var(--ink-blue);
  font-weight: 600;
}
.usdt-box { text-align: left; margin: 12px 0; }
.usdt-box .addr { word-break: break-all; font-size: .85rem; font-family: var(--font-mono); }
.pay-embed {
  display: block;
  width: 100%;
  max-width: 420px;
  height: 420px;
  margin: 0;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: #fff;
}
@media (max-width: 520px) {
  .pay-embed { height: 360px; }
}
.usdt-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; margin: 12px 0; }
.hist-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }

.share-result {
  margin-top: 14px; padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--rule); border-radius: 3px;
  display: grid; gap: 8px;
}
.share-result[hidden] { display: none; }
.share-result strong { font-size: 1.02rem; }
.share-result > span { color: var(--muted); font-size: .9rem; }
.share-result-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.share-result-row input { flex: 1; min-width: 160px; font-size: .85rem; border: 1px solid var(--rule); border-radius: 3px; padding: 8px 10px; background: #fff; }

.share-page .share-wrap {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: var(--space-3) var(--page-gutter) var(--space-8);
}
.share-page .sheet.share-doc {
  aspect-ratio: auto;
  max-height: none;
  margin-bottom: 24px;
}
.share-kicker { color: var(--muted); font-weight: 600; margin: 0 0 4px; text-transform: uppercase; font-size: .75rem; letter-spacing: .06em; }
.share-page .sheet-kicker { margin-bottom: 6px; }
.share-page .sheet-note { margin-top: 14px; }
.share-page h1 { font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: -0.03em; margin: 0 0 22px; font-family: var(--font-display); }
.share-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 22px; }
.party { background: transparent; border: 0; border-radius: 0; padding: 0; font-size: .95rem; line-height: 1.45; }
.party-label { color: var(--muted); font-size: .78rem; font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.share-table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 0; background: #fff; }
.share-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.share-table th, .share-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--rule); }
.share-table th { background: var(--paper); font-size: .78rem; color: var(--muted); font-weight: 600; }
.share-table td:nth-child(n+3) { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.share-total { font-size: 1.25rem; margin: 18px 0 10px; }
.share-total strong { font-family: var(--font-mono); font-weight: 500; }
.share-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 28px; }
.share-cta {
  padding: 18px; border-radius: 3px; border: 1px dashed var(--rule);
  background: var(--paper);
}
.share-cta p { color: var(--muted); margin: 6px 0 14px; }
.seo-quick { margin: 0; max-width: none; }
.seo-related { margin: 8px 0 0; padding-left: 1.2em; line-height: 1.7; }
.seo-related a { text-decoration: underline; text-underline-offset: 2px; }
body.seo .top .btn:not(.btn-primary):not(.btn-stamp) {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}
.app-banner-nudge {
  background: var(--paper);
  border-color: var(--stamp);
}

@media (max-width: 860px) {
  .share-parties { grid-template-columns: 1fr; }
}

.app-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  margin-bottom: 16px; padding: 0 0 14px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule); border-radius: 0;
}
.app-banner strong { font-size: 1.02rem; display: block; }
.app-banner span { color: var(--muted); font-size: .92rem; display: block; margin-top: 4px; }
.more-fields {
  margin-top: var(--space-4); padding: var(--space-3) 14px;
  border: 1px dashed var(--rule); border-radius: var(--radius-sheet); background: var(--paper);
}
.more-fields summary {
  cursor: pointer; font-weight: 700; color: var(--ink-blue); list-style: none;
}
.more-fields summary::-webkit-details-marker { display: none; }
.more-fields .field-group { margin-top: var(--space-3); }
.gen-row {
  margin-top: var(--space-5);
  display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center;
}
.aside-soft {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--rule);
}
.aside-soft h3 { font-size: var(--text-base); margin: 0 0 var(--space-3); }

.sticky-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: none; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 18px;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  padding-left: max(18px, env(safe-area-inset-left, 0px));
  padding-right: max(18px, env(safe-area-inset-right, 0px));
  background: rgba(244, 246, 248, 0.96);
  border-top: 1px solid var(--rule); box-shadow: 0 -8px 30px rgba(18, 21, 26, 0.06);
  backdrop-filter: blur(8px);
}
.sticky-cta.is-hidden,
.sticky-cta.is-keyboard { display: none !important; }
.sticky-hint { color: var(--muted); font-weight: 600; }
.app-page { padding-bottom: 24px; }

.btn-add-item { margin-top: var(--space-3); justify-self: start; }
.quick-form {
  display: grid; gap: var(--space-3); margin-top: var(--space-5); max-width: 28rem;
}
.quick-form .field { gap: var(--space-1); }
.quick-form input {
  width: 100%; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0;
  padding: 10px var(--control-pad-x); font: inherit; background: transparent;
}
.quick-form .btn { width: 100%; justify-content: center; padding: 12px 18px; margin-top: var(--space-1); }

.landing-sticky {
  position: fixed; left: 12px; right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: none; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 4px;
  background: rgba(255, 255, 255, 0.97); border: 1px solid var(--rule);
  box-shadow: var(--shadow);
}
.landing-sticky span { font-weight: 700; font-size: .95rem; }

/* live app sheet: fill height naturally */
.app-sheet {
  aspect-ratio: 210 / 297;
  max-height: min(760px, 88vh);
  width: 100%;
  justify-self: stretch;
  position: sticky;
  top: 12px;
}

@media (max-width: 860px) {
  .hero, .hero-desk, .app-grid, .link-grid { grid-template-columns: 1fr; }
  .hero, .hero-desk {
    min-height: 0; align-items: start; gap: 24px; padding-top: 8px;
  }
  .hero-rail { max-width: none; }
  .hero p.lead, .hero-rail .lead { max-width: 28rem; }
  .sheet { justify-self: stretch; width: 100%; }
  .sheet-parties { grid-template-columns: 1fr; gap: 12px; }
  .row3 {
    grid-template-columns: 1fr 1fr 1fr auto;
    align-items: end;
  }
  .row3 > div:first-child { grid-column: 1 / -1; }
  .sheet.hero-sheet {
    aspect-ratio: auto;
    max-height: none;
    min-height: 0;
    width: 100%;
  }
  .app-sheet {
    position: static;
    aspect-ratio: auto;
    max-height: none;
    min-height: 220px;
    width: 100%;
    /* Form first on phone — sheet follows (I04 / step 3) */
    order: 2;
    padding: 16px 14px 18px;
  }
  .form-panel { order: 1; }
  .app-grid { display: flex; flex-direction: column; gap: 20px; }
  .sticky-cta:not(.is-hidden):not(.is-keyboard) { display: flex; }
  .app-page { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  .landing-sticky { display: flex; }
  body:has(.landing-sticky) { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .hist-row { flex-wrap: wrap; }
  .top { flex-wrap: wrap; gap: 10px 14px; }
  .top nav, .top-nav { gap: 8px; font-size: .92rem; }
  /* Thumb: progress chips jump to sections */
  .form-progress__step {
    cursor: pointer;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .form-progress__step:focus-visible {
    outline: 2px solid var(--ink-blue);
    outline-offset: 2px;
  }
  .share-actions { gap: 8px; }
  .share-actions .btn { flex: 1 1 calc(50% - 4px); justify-content: center; min-height: 44px; }
  .share-actions .btn-stamp,
  .share-actions .btn-accent { flex: 1 1 100%; min-height: 48px; }
  .hist-actions .btn { min-height: 40px; }
}

/* Tablet: quieter chrome than desktop, still room for secondary nav */
@media (max-width: 768px) and (min-width: 521px) {
  body { --page-gutter: 16px; }
  .top-nav a:not(.btn) { font-size: .88rem; }
  .hero-actions .btn-stamp { min-height: 48px; padding-inline: 20px; }
  .form-panel > .toolbar.form-meta {
    display: grid;
    grid-template-columns: 1.4fr 0.7fr 1fr;
    gap: 10px 12px;
    align-items: end;
  }
}

@media (max-width: 520px) {
  body { --page-gutter: 14px; }
  .row2 { grid-template-columns: 1fr; }
  /* Quiet first chrome: brand + primary only (SEO links live below fold / footer) */
  body:not(.app-page):not(.share-page):not(.legal) .top-nav a:not(.btn) { display: none; }
  body:not(.app-page) .top { flex-wrap: nowrap; align-items: center; gap: 10px; }
  body:not(.app-page) .top-nav { margin-left: auto; }
  .app-page .top .toolbar {
    width: 100%;
    justify-content: space-between;
  }
  .pill { font-size: .78rem; padding: 5px 10px; max-width: 58%; }
  .app-banner span { min-width: 0; }
  .app-banner__actions { width: 100%; }
  .app-banner__actions .btn:not(.btn-quiet) { flex: 1; min-height: 44px; }
  .form-progress__step { flex: 1 1 calc(50% - var(--space-2)); text-align: center; }
  .item-row__nums { grid-template-columns: 1fr 1fr; }
  .item-row__nums .field:last-child { grid-column: 1 / -1; }
  .item-row__foot { flex-direction: column; align-items: stretch; }
  .item-row .i-del { width: 100%; min-height: 40px; }
  .items-footer { flex-direction: column; align-items: stretch; }
  .items-total { text-align: center; }
  .panel > .toolbar, .form-panel > .toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
    align-items: end;
  }
  .panel > .toolbar label:first-child,
  .form-panel > .toolbar label:first-child { grid-column: 1 / -1; }
  .sticky-hint { display: none; }
  .sticky-cta { justify-content: stretch; }
  .sticky-cta .btn { flex: 1; min-height: 48px; }
  .share-result-row { flex-direction: column; align-items: stretch; }
  .share-result-row input { min-width: 0; width: 100%; }
  .share-result-row .btn { width: 100%; min-height: 44px; }
  .landing-sticky { left: 10px; right: 10px; }
  .landing-sticky span { font-size: .88rem; }
  .landing-sticky .btn { min-height: 44px; }
  .hero-brand { font-size: clamp(2.2rem, 11vw, 3rem); }
  .hero-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .hero-actions .btn { width: 100%; justify-content: center; min-height: 48px; }
  .pay-embed { height: 320px; }
  .pay-nudge .btn { min-height: 44px; }
  .link-grid { grid-template-columns: 1fr; }
  /* Share table: drop Цена — keep Сумма (readable blank @390) */
  .share-table th:nth-child(5),
  .share-table td:nth-child(5) { display: none; }
  .share-table th, .share-table td { padding: 8px 6px; font-size: .82rem; }
  .share-table { font-size: .82rem; }
  .sheet-table-head, .sheet-table-row {
    grid-template-columns: 1.4rem minmax(0, 1fr) 2rem 4.8rem;
    gap: 6px;
    font-size: .78rem;
  }
  input, select, textarea { font-size: 16px; }
  .btn:not(.btn-quiet) { min-height: 44px; }
  .acq-panel .btn, .seo-quick .btn { min-height: 48px; width: 100%; justify-content: center; }
}
