:root {
  --bg: #F4F7FB;
  --card: #FFFFFF;
  --ink: #0F172A;
  --muted: #5B6B82;
  --accent: #2563EB;
  --accent-dark: #1D4ED8;
  --line: #DCE4EF;
  --ok: #16A34A;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(15, 23, 42, .07);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 28px; height: 60px; }
.logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 19px; color: var(--ink); text-decoration: none;
}
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 800;
}
.nav-links { display: flex; gap: 22px; margin-left: auto; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 15px; }
.nav-links a:hover { color: var(--accent); }
.badge-free {
  background: #E8F7EE; color: var(--ok);
  font-size: 13px; font-weight: 700;
  padding: 4px 12px; border-radius: 999px;
}

/* ---------- hero ---------- */
.hero { padding: 64px 0 56px; text-align: center; }
.hero h1 { font-size: clamp(28px, 4.5vw, 46px); line-height: 1.15; margin: 0 auto 16px; max-width: 820px; letter-spacing: -.5px; }
.hero .sub { font-size: 18px; color: var(--muted); max-width: 720px; margin: 0 auto 22px; }
.badges {
  list-style: none; display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center; padding: 0; margin: 0 0 28px;
}
.badges li {
  background: var(--card); border: 1px solid var(--line);
  padding: 7px 14px; border-radius: 999px; font-size: 14px; color: var(--ink);
}
.mini { color: var(--muted); font-size: 14px; margin-top: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 11px; cursor: pointer;
  font-size: 15px; font-weight: 600; padding: 11px 20px;
  text-decoration: none; transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-lg { font-size: 17px; padding: 14px 30px; border-radius: 13px; }
.btn-outline { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.btn-outline:hover { background: #EFF4FE; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); }
.btn-clear { margin-left: auto; font-size: 13px; }

/* ---------- app ---------- */
.app-section { padding: 8px 0 56px; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  font-size: 15px; font-weight: 600; padding: 10px 22px;
  border-radius: 999px; cursor: pointer;
}
.tab.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.workspace {
  display: grid; grid-template-columns: minmax(380px, 460px) 1fr;
  gap: 24px; align-items: start;
}
.workspace > * { min-width: 0; }
.forms { display: flex; flex-direction: column; gap: 16px; }
.card input, .card select, .card textarea { min-width: 0; }
.grid2 > label, .grid3 > label { min-width: 0; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 18px 20px; margin: 0;
  box-shadow: var(--shadow);
  /* fieldset по умолчанию имеет min-inline-size: min-content и не сжимается */
  min-inline-size: 0; min-width: 0;
}
.card legend {
  font-weight: 700; font-size: 15px; padding: 0 8px; margin-left: -8px;
}
.card label { display: block; font-size: 13px; color: var(--muted); margin-top: 12px; font-weight: 600; }
.card input, .card select, .card textarea {
  display: block; width: 100%; margin-top: 5px;
  border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; font-size: 14.5px; color: var(--ink);
  background: #FBFDFF; font-family: inherit;
}
.card input:focus, .card select:focus, .card textarea:focus {
  outline: 2px solid rgba(37, 99, 235, .35); border-color: var(--accent);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.hint-inline { font-weight: 400; color: var(--muted); font-size: 12px; }
.field-note { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }
.bank-details { margin-top: 14px; }
.bank-details summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--accent); }

/* items table */
.items-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.items-table th {
  text-align: left; font-size: 12px; color: var(--muted);
  font-weight: 600; padding: 0 6px 6px 0;
}
.items-table td { padding: 0 6px 8px 0; vertical-align: top; }
.items-table input, .items-table select {
  margin-top: 0; padding: 7px 9px; font-size: 13.5px;
}
.col-qty { width: 64px; } .col-unit { width: 78px; } .col-price { width: 104px; } .col-x { width: 30px; }
.item-del {
  border: 0; background: none; color: #C2410C; font-size: 16px;
  cursor: pointer; padding: 6px 2px;
}
.items-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.items-total { font-size: 14px; color: var(--ink); }

/* preview */
.preview-wrap { position: sticky; top: 76px; }
.preview-actions { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.paper {
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 48px 52px; min-height: 600px;
  font-family: "Times New Roman", Georgia, serif;
  font-size: 14px; line-height: 1.45; color: #111;
  overflow-wrap: break-word;
}
.paper table { page-break-inside: avoid; width: 100% !important; table-layout: fixed; }
.paper td { overflow-wrap: break-word; word-break: break-word; }
.privacy-note { font-size: 12.5px; color: var(--muted); margin-top: 12px; text-align: center; }

/* ---------- how ---------- */
.how-section { padding: 48px 0; background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.how-section h2, .faq-section h2 { font-size: 28px; margin: 0 0 22px; }
.steps { max-width: 760px; padding-left: 22px; margin: 0; }
.steps li { margin-bottom: 12px; color: var(--muted); }
.steps li b { color: var(--ink); }

/* ---------- pricing ---------- */
.pricing-section { padding: 48px 0 24px; }
.pricing-section h2 { font-size: 28px; margin: 0 0 22px; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.price-card {
  position: relative;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 24px 22px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.price-card.featured { border: 2px solid var(--accent); }
.featured-badge {
  position: absolute; top: -12px; left: 22px;
  background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 3px 12px; border-radius: 999px;
}
.price-card h3 { margin: 0 0 4px; font-size: 18px; }
.price { font-size: 32px; font-weight: 800; margin-bottom: 12px; }
.price-once { font-size: 14px; font-weight: 400; color: var(--muted); }
.pricing-grid-2 { grid-template-columns: repeat(2, 1fr); max-width: 820px; }
.price-card ul { list-style: none; padding: 0; margin: 0 0 18px; flex: 1; }
.price-card li { color: var(--muted); font-size: 14.5px; padding: 5px 0 5px 24px; position: relative; }
.price-card li::before { content: '✓'; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.pricing-note { color: var(--muted); font-size: 13.5px; margin-top: 16px; }
.pro-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  margin-top: 22px; padding: 20px 24px;
  background: linear-gradient(135deg, #1E3A8A, #2563EB);
  border-radius: 16px; color: #DBEAFE; text-decoration: none;
  font-size: 15.5px; line-height: 1.5;
}
.pro-banner b { color: #fff; }
.pro-banner .btn { white-space: nowrap; background: #fff; color: var(--accent); }
.pro-banner:hover .btn { background: #EFF4FE; }
@media (max-width: 700px) { .pro-banner { flex-direction: column; align-items: flex-start; } }

/* ---------- order modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, .5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  position: relative;
  background: #fff; border-radius: 16px;
  padding: 26px 26px 22px; width: 100%; max-width: 440px;
  box-shadow: 0 18px 60px rgba(15, 23, 42, .25);
  max-height: 92vh; overflow-y: auto;
}
.modal h3 { margin: 0 0 6px; font-size: 20px; }
.modal label { display: block; font-size: 13px; color: var(--muted); margin-top: 12px; font-weight: 600; }
.modal input, .modal textarea {
  display: block; width: 100%; margin-top: 5px;
  border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; font-size: 14.5px; font-family: inherit;
}
.modal .btn { width: 100%; margin-top: 16px; }
.modal-close {
  position: absolute; top: 12px; right: 14px;
  border: 0; background: none; font-size: 17px;
  color: var(--muted); cursor: pointer; padding: 4px;
}
.hp { position: absolute; left: -5000px; width: 1px; height: 1px; opacity: 0; }
.order-hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }
.order-status { font-size: 14px; font-weight: 600; margin: 8px 0 0; min-height: 18px; }
.order-status.ok { color: var(--ok); }
.order-status.err { color: #C2410C; }

/* ---------- FAQ ---------- */
.faq-section { padding: 48px 0 56px; }
.faq-section details {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 20px; margin-bottom: 10px;
  max-width: 860px;
}
.faq-section summary { cursor: pointer; font-weight: 600; font-size: 15.5px; }
.faq-section details p { color: var(--muted); margin: 12px 0 2px; }

/* ---------- footer ---------- */
.footer { padding: 28px 0 40px; border-top: 1px solid var(--line); }
.footer p { margin: 0 0 8px; font-size: 14px; }
.disclaimer { color: var(--muted); font-size: 12.5px; max-width: 820px; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .preview-wrap { position: static; }
  .paper { padding: 28px 22px; }
  .nav-links { display: none; }
  .grid3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .hero { padding: 40px 0 36px; }
  .preview-actions .btn { flex: 1 1 auto; }
}
@media (max-width: 860px) {
  .pricing-grid { grid-template-columns: 1fr; }
}

/* ---------- print: only the document ---------- */
@media print {
  body * { visibility: hidden; }
  .paper, .paper * { visibility: visible; }
  .paper {
    position: absolute; left: 0; top: 0; width: 100%;
    border: 0; box-shadow: none; border-radius: 0;
    padding: 0; min-height: auto; font-size: 12pt;
  }
}
