:root {
  color-scheme: light dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --background: #f3f5f8;
  --surface: #ffffff;
  --surface-muted: #f7f8fa;
  --text: #151922;
  --muted: #697386;
  --line: #e3e7ee;
  --accent: #5a43e6;
  --accent-2: #7c68f2;
  --accent-soft: #eeeafd;
  --positive: #12815b;
  --shadow: 0 16px 36px rgba(37, 42, 55, 0.08);
}

:root[data-telegram-theme="dark"] {
  --background: #101319;
  --surface: #191d25;
  --surface-muted: #20252f;
  --text: #f6f7fb;
  --muted: #9aa5b5;
  --line: #303744;
  --accent: #8b78ff;
  --accent-2: #a99cff;
  --accent-soft: #2a2547;
  --positive: #48c594;
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 85% -10%, rgba(124, 104, 242, 0.22), transparent 36%),
    var(--background);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

main {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 16px 112px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 4px 24px;
}

.compact-hero {
  padding-bottom: 12px;
}

.eyebrow,
.section-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 520px;
  margin-bottom: 10px;
  font-size: clamp(30px, 7vw, 46px);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
  letter-spacing: -0.025em;
}

.hero p {
  max-width: 570px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.limit-badge,
.free-label {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
}

.panel,
.plan-card {
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow);
}

.section-heading,
.plan-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.example-list {
  display: grid;
  gap: 8px;
}

.example-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-muted);
  text-align: left;
  cursor: pointer;
}

.example-card strong,
.example-card small {
  display: block;
}

.example-card small {
  margin-top: 4px;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid label > span,
fieldset legend {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  background: var(--surface-muted);
  color: var(--text);
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

fieldset {
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: var(--surface-muted);
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: block;
  padding: 10px 8px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
  cursor: pointer;
}

.segmented input:checked + span {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 3px 12px rgba(28, 35, 49, 0.08);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-muted);
}

.toggle-row span,
.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row small {
  margin-top: 3px;
  color: var(--muted);
}

.toggle-row input {
  width: 24px;
  min-height: 24px;
  accent-color: var(--accent);
}

.primary-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 24px color-mix(in srgb, var(--accent) 28%, transparent);
}

.price-block {
  padding: 22px;
  border-radius: 18px;
  background: linear-gradient(135deg, #171b26, #30286e);
  color: #fff;
  text-align: center;
}

.price-block span,
.price-block small,
.price-block strong {
  display: block;
}

.price-block span,
.price-block small {
  opacity: 0.72;
}

.price-block strong {
  margin: 5px 0;
  font-size: 40px;
  letter-spacing: -0.04em;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.metrics div {
  padding: 13px;
  border-radius: 14px;
  background: var(--surface-muted);
}

.metrics span,
.metrics strong {
  display: block;
}

.metrics span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.metrics strong {
  font-size: 17px;
}

.breakdown {
  margin-top: 14px;
  padding: 4px 0;
}

.breakdown div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.details-grid div {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.details-grid span,
.details-grid strong {
  display: block;
}

.details-grid span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.details-grid strong {
  font-size: 13px;
}

.highlight-line {
  margin-top: 4px;
  padding-inline: 10px !important;
  border: 1px solid color-mix(in srgb, #f2a93b 45%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, #f2a93b 12%, var(--surface));
  color: color-mix(in srgb, #b66e00 85%, var(--text));
}

.client-button,
.secondary-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.client-button {
  margin-top: 14px;
}

.secondary-button {
  margin-top: 8px;
}

.client-quote pre {
  margin: 0 0 16px;
  padding: 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-muted);
  cursor: pointer;
}

.lock-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 16px;
  background: var(--accent-soft);
}

.lock-banner > span {
  font-size: 22px;
}

.lock-banner strong,
.lock-banner small {
  display: block;
}

.lock-banner small {
  margin-top: 3px;
  color: var(--muted);
}

.lock-banner button,
.catalog-row button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 750;
  cursor: pointer;
}

.catalog-list,
.printer-editor-list {
  display: grid;
  gap: 9px;
}

.catalog-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.catalog-row:last-child {
  border-bottom: 0;
}

.catalog-row strong,
.catalog-row small {
  display: block;
}

.catalog-row small,
.muted-copy {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.catalog-row button:disabled {
  color: var(--muted);
  cursor: default;
  opacity: 0.65;
}

.printer-editor {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-muted);
}

.printer-editor > strong {
  display: block;
  margin-bottom: 12px;
}

.form-grid.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.formula-card > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.formula-card p {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.subscriptions-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.price-option {
  position: relative;
  min-height: 150px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-muted);
  text-align: left;
  cursor: pointer;
}

.price-option small,
.price-option strong,
.price-option b,
.price-option span {
  display: block;
}

.price-option small,
.price-option span {
  color: var(--muted);
  font-size: 11px;
}

.price-option strong {
  margin-top: 8px;
  font-size: 16px;
}

.price-option b {
  margin: 10px 0 4px;
  color: var(--accent);
  font-size: 24px;
}

.price-option.featured {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.price-option em {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-style: normal;
}

.retention-note {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.locked-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.locked-actions button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-muted);
  color: var(--muted);
  cursor: pointer;
}

.plan-card {
  padding: 24px;
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
}

.plan-title span {
  color: var(--accent);
  font-size: 24px;
  font-weight: 900;
}

.plan-title strong {
  max-width: 220px;
  text-align: right;
}

.plan-card ul {
  display: grid;
  gap: 10px;
  margin: 20px 0;
  padding: 0;
  list-style: none;
}

.plan-card li::before {
  content: "✓";
  margin-right: 9px;
  color: var(--positive);
  font-weight: 900;
}

.plan-card > small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  text-align: center;
}

.bottom-nav {
  position: fixed;
  z-index: 10;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 16px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
}

.bottom-nav button {
  flex: 0 0 88px;
  min-height: 54px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.bottom-nav button span {
  display: block;
  margin-bottom: 2px;
  font-size: 18px;
}

.bottom-nav button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

@media (max-width: 620px) {
  .hero {
    display: block;
  }

  .limit-badge {
    display: inline-block;
    margin-top: 16px;
  }

  .panel {
    padding: 16px;
    border-radius: 18px;
  }

  .form-grid {
    gap: 10px;
  }

  .form-grid.three-columns,
  .pricing-grid,
  .subscriptions-grid {
    grid-template-columns: 1fr;
  }

  .bottom-nav {
    justify-content: flex-start;
  }

  .lock-banner {
    grid-template-columns: auto 1fr;
  }

  .lock-banner button {
    grid-column: 1 / -1;
  }

  .segmented span {
    padding-inline: 4px;
    font-size: 11px;
  }
}
