:root {
  --bg: #f5f3fb; --card: #ffffff; --text: #1c1830; --muted: #77718f; --line: #e8e4f4;
  --accent: #6b4eff; --accent-2: #8f77ff; --accent-soft: #eeeaff; --gold: #c8962e; --gold-soft: #fbf3df;
  --ok: #1f9d63; --warn: #d98a00; --bad: #d64545; --shadow: 0 6px 24px rgba(60, 40, 140, .08);
  --radius: 20px;
}
:root[data-theme="dark"] {
  --bg: #0f0d1a; --card: #1a1730; --text: #f1eefc; --muted: #9a94b8; --line: #2a2646;
  --accent: #8a72ff; --accent-2: #a794ff; --accent-soft: #272248; --gold: #e0b252; --gold-soft: #2e2716;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.45 -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
#view { padding: 18px 16px 8px; }
h1 { font-size: 26px; line-height: 1.15; margin: 4px 0 10px; letter-spacing: -.02em; }
h2 { font-size: 19px; margin: 24px 0 10px; letter-spacing: -.01em; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; border: 1px solid var(--line); }
.card.tap { cursor: pointer; transition: transform .12s; }
.card.tap:active { transform: scale(.985); }
.hero { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: 0; }
.hero p { color: rgba(255, 255, 255, .88); }
.chip { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-bottom: 10px; }
.hero .chip { background: rgba(255, 255, 255, .2); color: #fff; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.price { font-weight: 700; color: var(--gold); white-space: nowrap; }
.price::before { content: "\2605 "; }
.btn { appearance: none; border: 0; width: 100%; padding: 15px 18px; border-radius: 16px; font: inherit; font-weight: 650; background: var(--accent); color: #fff; cursor: pointer; transition: opacity .15s, transform .1s; }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--accent-soft); color: var(--accent); }
.btn.light { background: #fff; color: var(--accent); }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
.btn.ok { background: var(--ok); }
.btn + .btn { margin-top: 10px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 6px 4px; }
input[type=text], input[type=number], textarea { width: 100%; padding: 14px 16px; font: inherit; color: var(--text); background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; outline: none; transition: border-color .15s; }
input:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 120px; resize: vertical; }
textarea.big { min-height: 360px; font-size: 15px; line-height: 1.5; }
.hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0 4px; }
.err { color: var(--bad); font-size: 14px; margin: 8px 0; }
.doc { display: flex; justify-content: space-between; align-items: center; padding: 15px 16px; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; margin-bottom: 10px; font-weight: 600; color: var(--text); text-decoration: none; }
.doc span { color: var(--muted); }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; margin-bottom: 10px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.pill.ok { background: rgba(31, 157, 99, .14); color: var(--ok); }
.pill.warn { background: rgba(217, 138, 0, .14); color: var(--warn); }
.pill.bad { background: rgba(214, 69, 69, .14); color: var(--bad); }
.steps { display: flex; gap: 6px; margin: 14px 0 6px; }
.steps i { flex: 1; height: 6px; border-radius: 6px; background: var(--line); }
.steps i.on { background: var(--accent); }
.steps-l { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); gap: 4px; }
.passport { white-space: pre-wrap; line-height: 1.6; font-size: 16px; }
.nums { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.num { background: var(--gold-soft); color: var(--text); border-radius: 14px; padding: 8px 12px; font-size: 13px; }
.num b { color: var(--gold); font-size: 17px; margin-left: 4px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.stat b { display: block; font-size: 24px; letter-spacing: -.02em; }
.stat span { font-size: 12.5px; color: var(--muted); }
details { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; }
summary { font-weight: 600; cursor: pointer; }
details p { margin: 10px 0 0; color: var(--muted); }
#tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center; gap: 4px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
#tabbar[hidden] { display: none; }
#tabbar button { flex: 1; max-width: 140px; border: 0; background: none; padding: 6px 4px; font: inherit; font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
#tabbar button.on { color: var(--accent); font-weight: 700; }
#tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#toast { position: fixed; left: 50%; top: 14px; transform: translate(-50%, -80px); background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-size: 14px; z-index: 20; transition: transform .25s; max-width: 90vw; text-align: center; }
#toast.show { transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #fff; }
.overlay { position: fixed; inset: 0; background: rgba(10, 8, 30, .55); z-index: 15; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 560px; border-radius: 24px 24px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 36px 10px; }
.link { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; padding: 8px 0; cursor: pointer; }

.cells { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 12px; }
.cell { border: 0; border-radius: 12px; padding: 12px 0; font: inherit; font-weight: 700; cursor: pointer; background: var(--line); color: var(--muted); }
.cell.draft { background: rgba(217, 138, 0, .18); color: var(--warn); }
.cell.approved { background: rgba(31, 157, 99, .18); color: var(--ok); }
.legend { display: flex; gap: 8px; margin-bottom: 14px; }
.legend .cell { padding: 6px 12px; font-size: 12px; cursor: default; }
.warnbox { background: rgba(214, 69, 69, .1); border: 1px solid rgba(214, 69, 69, .35); color: var(--text); border-radius: 14px; padding: 12px 14px; font-size: 14px; margin-bottom: 12px; }
.warnbox b { color: var(--bad); display: block; margin-bottom: 6px; }
select { width: 100%; padding: 14px 16px; font: inherit; color: var(--text); background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; }

.copyrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 8px; font: inherit; color: var(--text); background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; transition: border-color .15s, transform .1s; }
.copyrow:active { transform: scale(.985); border-color: var(--accent); }
.cr-main { display: flex; flex-direction: column; min-width: 0; }
.cr-label { font-size: 12px; color: var(--muted); }
.cr-value { font-weight: 650; font-size: 15px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cr-act { flex: none; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 6px 10px; border-radius: 10px; }
.idchip { display: inline-flex; align-items: center; gap: 8px; border: 1.5px dashed var(--accent); background: var(--accent-soft); color: var(--accent); font: inherit; font-weight: 700; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.idchip span { font-size: 11px; font-weight: 600; opacity: .8; }

.card.reviews { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, var(--gold-soft), var(--card)); border-color: color-mix(in srgb, var(--gold) 35%, var(--line)); }
.rv-icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--gold); }
.rv-icon svg { width: 24px; height: 24px; fill: currentColor; fill-opacity: .25; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rv-go { flex: none; font-size: 12px; font-weight: 700; color: var(--gold); background: color-mix(in srgb, var(--gold) 16%, transparent); padding: 7px 12px; border-radius: 999px; }

.btn.sm { padding: 12px 14px; font-size: 14.5px; border-radius: 14px; }
.row > .btn { margin-top: 0; }
.row > .btn.sm { flex: 1; width: auto; }
.price-rub { font-size: 17px; letter-spacing: -.01em; white-space: nowrap; color: var(--gold); }
.card.product { padding-bottom: 16px; }
.program { list-style: none; margin: 0; padding: 0; }
.program li { position: relative; padding: 8px 0 8px 26px; border-bottom: 1px solid var(--line); }
.program li:last-child { border-bottom: 0; }
.program li::before { content: "\2726"; position: absolute; left: 2px; top: 8px; color: var(--gold); }
.card.example { position: relative; overflow: hidden; max-height: 340px; background: linear-gradient(180deg, var(--card), var(--card)); }
.card.example::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px; background: linear-gradient(180deg, transparent, var(--card)); pointer-events: none; }
.passport.sample { font-size: 14.5px; line-height: 1.55; }

.card.product.free { background: linear-gradient(135deg, color-mix(in srgb, var(--ok) 9%, var(--card)), var(--card)); border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); }

/* главный экран: приветствие и подарок */
.hero { padding: 22px 20px 20px; }
.hero-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.hero-top .chip { margin-bottom: 0; }
.hero-spark svg { width: 24px; height: 24px; fill: none; stroke: #ffd98a; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hero-h { font-size: 27px; line-height: 1.12; text-transform: uppercase; letter-spacing: -.01em; margin: 6px 0 12px; }
.gift { margin-top: 18px; padding: 18px 16px 14px; border-radius: 22px; background: #f8efd8; color: #2d2250; text-align: center; box-shadow: 0 10px 28px rgba(30, 20, 80, .25); }
.gift-title { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; font-size: 19px; letter-spacing: .02em; text-transform: uppercase; color: #3b2a78; }
.gift-title svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gift-sub { margin: 6px 0 14px; font-size: 14px; color: #5a4a8a; }
.btn.gift-btn { padding: 17px 18px; font-size: 18px; border-radius: 16px; box-shadow: 0 8px 20px rgba(107, 78, 255, .35); }
.gift-note { margin-top: 10px; font-size: 13px; font-weight: 600; color: #4a3a80; }
.gift-more { margin-top: 6px; background: none; border: 0; font: inherit; font-size: 13px; font-weight: 600; color: #6b4eff; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px 4px; }
.gift.done .gift-sub { margin-bottom: 14px; }

.price-col { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.old { color: var(--muted); font-weight: 600; font-size: 15px; text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: color-mix(in srgb, var(--bad) 70%, var(--muted)); white-space: nowrap; }
