/* Snapi Mini App — палітра Mint Noir.
   Логіка: чорне тло й білий текст як у логотипі, м'ята — єдиний акцент (CTA,
   перемикачі, активна вкладка, «онлайн»). Картки — тонкі шари поверх тла, без тіней.
   Шрифти: Manrope — заголовки й цифри (геометрія як у «Snapi»), Onest — текст. */
:root {
  color-scheme: dark;
  --bg: #0A0A0B;
  --surface: #141416;
  --surface-2: #1C1D21;
  --surface-3: #24252A;
  --line: #26272C;
  --ink: #F2F2F4;
  --muted: #8B8D95;
  --faint: #5D5F66;
  --accent: #2EF5C4;
  --accent-ink: #03140F;
  --accent-soft: rgba(46, 245, 196, .12);
  --warn: #FFB547;
  --warn-soft: rgba(255, 181, 71, .12);
  --danger: #FF5C6C;
  --danger-soft: rgba(255, 92, 108, .12);
  --display: "Manrope", "Segoe UI", system-ui, sans-serif;
  --body: "Onest", "Segoe UI", system-ui, sans-serif;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --ease: cubic-bezier(.3, .7, .2, 1);
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); }
body { font: 400 15px/1.45 var(--body); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
body.sheet-open { overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
p { margin: 0; }
svg { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.noscript { padding: 24px; }
[hidden] { display: none !important; }

.app { min-height: 100%; }

/* ------------------------------------------------------------------ екрани */
.screen { min-height: 100dvh; padding: calc(var(--safe-top) + 24px) var(--gutter-r) calc(var(--safe-bottom) + 28px) var(--gutter-l); }
.screen-center { display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; justify-items: center; gap: 14px; text-align: center; max-width: 440px; margin: 0 auto; }
.screen-form { max-width: 480px; margin: 0 auto; display: grid; gap: 22px; align-content: start; }
.enter { animation: rise .45s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.boot-logo { width: 72px; height: 72px; animation: breathe 1.6s ease-in-out infinite; }
.boot-bar { width: 120px; height: 3px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.boot-bar i { display: block; width: 40%; height: 100%; background: var(--accent); border-radius: 3px; animation: slide 1.1s var(--ease) infinite; }
@keyframes breathe { 50% { transform: scale(.94); opacity: .8; } }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

.hero { display: grid; gap: 10px; justify-items: start; }
.hero-logo { width: 56px; height: 56px; }
.hero h1 { font-size: 28px; font-weight: 800; line-height: 1.1; }
.hero p, .lead { color: var(--muted); max-width: 42ch; }

.connect-art { position: relative; width: 120px; height: 120px; display: grid; place-items: center; margin-bottom: 8px; }
.connect-art img { width: 84px; height: 84px; position: relative; z-index: 1; }
.pulse { position: absolute; inset: 0; border-radius: 34px; border: 2px solid var(--accent); opacity: 0; animation: pulse 2.2s var(--ease) infinite; }
@keyframes pulse { 0% { transform: scale(.7); opacity: .6; } 100% { transform: scale(1.25); opacity: 0; } }
.screen-center h1 { font-size: 26px; font-weight: 800; }

/* ------------------------------------------------------------------ стани */
.state { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 36px 12px; }
.state-icon { width: 56px; height: 56px; border-radius: 18px; background: var(--surface); display: grid; place-items: center; color: var(--accent); }
.state-icon svg { width: 26px; height: 26px; }
.state h3 { font-size: 19px; font-weight: 800; }
.state p { color: var(--muted); max-width: 36ch; }
.state .btn { margin-top: 6px; }

/* ------------------------------------------------------------------ оболонка */
.shell { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-top) + 12px) var(--gutter-r) 8px var(--gutter-l); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 30px; height: 30px; }
.brand b { font: 800 19px/1 var(--display); letter-spacing: -0.02em; }
.brand b span { font-weight: 600; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--surface-2); display: grid; place-items: center; font: 700 13px var(--display); color: var(--muted); flex: none; }
.avatar svg { width: 18px; height: 18px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; color: var(--accent); background: var(--accent-soft); }

.view { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.page { padding: 6px var(--gutter-r) 28px var(--gutter-l); display: grid; gap: 14px; align-content: start; max-width: 640px; margin: 0 auto;
  opacity: 0; transform: translateY(8px); transition: opacity .28s var(--ease), transform .32s var(--ease); }
.page[data-dir="1"] { transform: translateX(18px); }
.page[data-dir="-1"] { transform: translateX(-18px); }
.page.in { opacity: 1; transform: none; }
.page-title { font-size: 26px; font-weight: 800; padding: 6px 2px 0; }

.tabbar { position: relative; display: grid; grid-template-columns: repeat(var(--tabs), 1fr); background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(var(--safe-bottom) + 8px) max(8px, env(safe-area-inset-left, 0px)); }
.tab { border: 0; background: none; display: grid; justify-items: center; gap: 4px; padding: 7px 0 4px; color: var(--muted); font: 600 11px/1 var(--body); transition: color .2s; }
.tab svg { width: 23px; height: 23px; transition: transform .25s var(--ease); }
.tab[aria-selected="true"] { color: var(--accent); }
.tab[aria-selected="true"] svg { transform: translateY(-1px) scale(1.06); }
.tab:active svg { transform: scale(.9); }
.tab-indicator { position: absolute; top: -1px; left: max(8px, env(safe-area-inset-left, 0px)); width: calc((100% - max(8px, env(safe-area-inset-left, 0px)) - max(8px, env(safe-area-inset-right, 0px))) / var(--tabs)); height: 2px;
  display: flex; justify-content: center; transition: transform .35s var(--ease); pointer-events: none; }
.tab-indicator::after { content: ""; width: 24px; height: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 12px rgba(46, 245, 196, .6); }

/* ------------------------------------------------------------------ панелі й картки */
.panel { background: var(--surface); border-radius: var(--r-lg); padding: 14px; display: grid; gap: 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.panel-head b { font: 800 18px var(--display); font-variant-numeric: tabular-nums; }
.status-kicker { font: 600 11.5px/1 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.status-kicker.warn { color: var(--warn); }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }

.notify { gap: 10px; padding: 10px; }
.notify .row.between { padding: 0 4px; }
.notify-label { font-size: 13px; }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--accent-soft); border: 0; color: var(--ink); text-align: left; width: 100%; }
.banner > svg:first-child { color: var(--accent); width: 22px; height: 22px; }
.banner div { display: grid; gap: 2px; flex: 1; }
.banner b { font: 700 14px var(--display); }
.banner span { font-size: 13px; color: var(--muted); }
.banner-warn { background: var(--warn-soft); }
.banner-warn > svg:first-child { color: var(--warn); }
.banner > svg:last-child { color: var(--muted); width: 18px; }

.list-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px 0; }
.list-head h1 { font-size: 24px; font-weight: 800; }
.list-head small { font: 500 13px var(--body); color: var(--muted); margin-left: 6px; letter-spacing: 0; }

.cards { display: grid; gap: 10px; }
.card { border: 0; text-align: left; background: var(--surface); border-radius: var(--r-lg); padding: 14px; display: grid; gap: 10px; width: 100%;
  transition: transform .15s var(--ease), background .2s; animation: rise .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
.card:active { transform: scale(.985); background: var(--surface-2); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card h3 { font-size: 16px; font-weight: 700; line-height: 1.3; min-width: 0; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); background: var(--surface-2); padding: 6px 8px; border-radius: 9px; }
.chip svg { width: 13px; height: 13px; }
.count { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; color: var(--muted); }
.count b { font: 800 18px/1 var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }

.pill { flex: none; display: inline-flex; align-items: center; gap: 6px; font: 600 11px/1 var(--body); padding: 6px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); white-space: nowrap; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.pill.off { background: var(--surface-2); color: var(--muted); }
.pill.off i { background: var(--faint); box-shadow: none; }
.pill.warn { background: var(--warn-soft); }
.pill.warn i { background: var(--warn); box-shadow: none; }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { background: var(--surface); border-radius: var(--r-md); padding: 12px; display: grid; gap: 4px; align-content: start; min-width: 0; }
.tile b { font: 800 20px/1.1 var(--display); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile span { font-size: 12px; color: var(--muted); line-height: 1.3; }
.tile.accent b { color: var(--accent); }

.rows { gap: 0; padding: 4px 14px; }
.rows .status-kicker { padding: 10px 0 4px; }
.info-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); background: none; width: 100%; text-align: left; font-size: 14px; }
.info-row:last-child { border-bottom: 0; }
.info-row > svg:first-child { color: var(--muted); width: 18px; height: 18px; }
.info-row span { flex: 1; color: var(--muted); }
.info-row b { font-weight: 600; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.info-row.link span { color: var(--ink); }
.info-row.link > svg:last-child { color: var(--faint); width: 16px; }
.info-row.warn b { color: var(--warn); }
.mini-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.mini-row:last-child { border-bottom: 0; }
.mini-row span { color: var(--muted); min-width: 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ підписка */
.status-card { gap: 6px; }
.status-card b { font: 800 22px/1.2 var(--display); }
.status-card.warn { box-shadow: inset 0 0 0 1px rgba(255, 181, 71, .25); }
.meter { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; width: var(--p); background: var(--accent); border-radius: 6px; transform-origin: left; animation: grow .8s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.price-card { gap: 14px; }
.price-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.price { font: 800 44px/1 var(--display); letter-spacing: -0.03em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.price small { font-size: 18px; color: var(--muted); font-weight: 700; }
.price-old { color: var(--faint); text-decoration: line-through; margin-right: 8px; font-size: 14px; }
.tag { display: inline-block; font: 600 11.5px var(--body); color: var(--accent-ink); background: var(--accent); padding: 4px 8px; border-radius: 8px; margin-top: 6px; }
.term-slot:not(:empty) { margin-bottom: 14px; }
.per-day { display: block; margin-top: 6px; font-size: 13px; }
.price-logo { width: 54px; height: 54px; opacity: .9; }
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.features li { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.cmp { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.35; table-layout: fixed; }
.cmp th, .cmp td { text-align: left; vertical-align: top; padding: 8px 6px 8px 0; border-top: 1px solid var(--line); }
.cmp thead th { border-top: 0; padding-top: 0; font: 600 12px var(--body); color: var(--muted); }
.cmp thead th:last-child { color: var(--accent); }
.cmp tbody th { font-weight: 500; color: var(--muted); width: 34%; }
.cmp td:last-child { font-weight: 600; }
.features svg { color: var(--accent); width: 18px; height: 18px; }

/* ------------------------------------------------------------------ друзі */
.link-box { background: var(--surface-2); border-radius: var(--r-sm); padding: 12px; overflow-x: auto; }
.link-box code { font: 500 13px/1.4 ui-monospace, "Cascadia Mono", monospace; color: var(--ink); white-space: nowrap; }
.code-box { background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 8px 8px 14px; margin: 8px 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.code-box b { font: 800 22px/1 var(--display); letter-spacing: .06em; color: var(--accent); font-variant-numeric: tabular-nums; }
.link-btn { border: 0; background: none; color: var(--accent); font: 600 13px var(--body); padding: 4px 0; cursor: pointer; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }
.rewards { display: grid; gap: 14px; }
.reward { display: grid; gap: 6px; font-size: 13px; }
.reward-head { display: flex; justify-content: space-between; gap: 10px; }
.reward-head b { font: 700 15px var(--display); }
.reward-head span { color: var(--accent); font-weight: 600; }
.reward.done .meter i { background: linear-gradient(90deg, var(--accent), #8BFFE1); }
.how ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--muted); font-size: 14px; }

/* ------------------------------------------------------------------ профіль */
.profile-head { display: flex; gap: 14px; align-items: center; padding: 6px 2px; }
.name-row { display: flex; align-items: center; gap: 6px; }
.display-name { font-size: 22px; font-weight: 800; overflow-wrap: anywhere; }
.faq { gap: 0; }
.faq .status-kicker { padding-bottom: 6px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:last-child { border-bottom: 0; }
.faq summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; font-weight: 500; cursor: pointer; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary svg { width: 16px; color: var(--faint); transition: transform .25s var(--ease); }
.faq details[open] summary svg { transform: rotate(90deg); }
.faq details p { color: var(--muted); font-size: 14px; padding: 0 0 12px; }

/* ------------------------------------------------------------------ кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: var(--r-md); padding: 13px 18px; font: 700 15px/1.1 var(--display);
  text-decoration: none; transition: transform .14s var(--ease), background .2s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 22px rgba(46, 245, 196, .25); }
.btn-secondary { background: var(--surface-2); color: var(--ink); }
.btn-ghost { background: none; color: var(--muted); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 13px; font-size: 13px; border-radius: 12px; }
.icon-btn { border: 0; background: none; color: var(--muted); padding: 6px; border-radius: 10px; display: grid; place-items: center; }
.icon-btn:active { background: var(--surface-2); }

/* ------------------------------------------------------------------ форми */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field-label { font: 600 13px var(--body); color: var(--muted); }
input:not([type="checkbox"]):not([type="file"]), textarea {
  width: 100%; background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r-md); padding: 13px 14px; color: var(--ink); outline: none;
  transition: border-color .2s, background .2s; }
input:focus, textarea:focus { border-color: rgba(46, 245, 196, .55); background: var(--surface-3); }
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { resize: vertical; min-height: 84px; line-height: 1.4; }
input[type="file"] { color: var(--muted); font-size: 13px; }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.readonly { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: var(--r-md); padding: 13px 14px; min-height: 48px; }
.readonly.verified svg { color: var(--accent); }
.readonly.pending { color: var(--muted); }
.form-error { color: var(--danger); font-size: 13.5px; background: var(--danger-soft); padding: 10px 12px; border-radius: var(--r-sm); }
.pair { display: flex; gap: 8px; align-items: center; }
.pair input { min-width: 0; }
.pair .btn { flex: none; }
.dash { color: var(--faint); }
.group { display: grid; background: var(--surface); border-radius: var(--r-lg); padding: 2px 14px; }
.group .toggle-row { border-bottom: 1px solid var(--line); padding: 12px 0; }
.group .toggle-row:last-child { border-bottom: 0; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.toggle-row > div { display: grid; gap: 3px; }
.toggle-row b { font-weight: 600; font-size: 14.5px; }
.field.toggle-row { background: var(--surface); border-radius: var(--r-lg); padding: 12px 14px; }

.check { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 14.5px; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box { width: 24px; height: 24px; border-radius: 8px; background: var(--surface-2); border: 1.5px solid var(--faint); display: grid; place-items: center; flex: none; transition: background .2s, border-color .2s; }
.check .box svg { width: 15px; height: 15px; color: var(--accent-ink); opacity: 0; transform: scale(.5); transition: opacity .2s, transform .25s var(--ease); }
.check input:checked + .box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .box svg { opacity: 1; transform: none; }
.check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.rules-link { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.rules-link.disabled { color: var(--muted); text-decoration: none; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: var(--r-md); padding: 0 12px; }
.search svg { color: var(--muted); width: 18px; }
.search input { background: none !important; border: 0 !important; padding-left: 0 !important; }

/* ------------------------------------------------------------------ перемикачі */
.switch { flex: none; border: 0; width: 46px; height: 28px; border-radius: 999px; background: var(--surface-3); position: relative; transition: background .25s; padding: 0; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .28s var(--ease), background .25s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: var(--accent-ink); }
.switch:active::after { width: 24px; }
.switch[aria-checked="true"]:active::after { transform: translateX(14px); }

.seg { position: relative; display: grid; grid-template-columns: repeat(var(--n), 1fr); background: var(--surface-2); border-radius: 13px; padding: 3px; width: 100%; }
.seg button { position: relative; z-index: 1; border: 0; background: none; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 4px; border-radius: 10px; color: var(--muted); font: 600 13px/1 var(--body); transition: color .2s; min-width: 0; }
.seg button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg button svg { width: 15px; height: 15px; }
.seg button[aria-checked="true"] { color: var(--ink); }
.seg-thumb { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / var(--n)); background: var(--bg); border-radius: 10px; transition: transform .3s var(--ease); box-shadow: inset 0 0 0 1px var(--line); }

/* ------------------------------------------------------------------ лист, діалог, тост */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0); display: flex; align-items: flex-end; justify-content: center; transition: background .25s; }
.sheet-backdrop.open { background: rgba(0, 0, 0, .6); }
.sheet { width: 100%; max-width: 640px; max-height: calc(100dvh - var(--safe-top) - 24px); background: var(--bg); border-radius: 24px 24px 0 0; border-top: 1px solid var(--line);
  display: grid; grid-template-rows: auto minmax(0, 1fr); transform: translateY(100%); transition: transform .32s var(--ease); }
.sheet-backdrop.open .sheet { transform: none; }
.sheet-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px var(--gutter-r) 10px var(--gutter-l); }
.sheet-head h2 { font-size: 20px; font-weight: 800; overflow-wrap: anywhere; }
.sheet-grip { position: absolute; top: 7px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--surface-3); }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px var(--gutter-r) calc(var(--safe-bottom) + 24px) var(--gutter-l); }
.sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sheet-actions .btn { flex: 1 1 140px; }

.dialog-backdrop { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; background: rgba(0, 0, 0, 0); transition: background .2s; }
.dialog-backdrop.open { background: rgba(0, 0, 0, .6); }
.dialog { background: var(--surface); border-radius: var(--r-lg); padding: 18px; max-width: 340px; display: grid; gap: 16px; transform: scale(.94); opacity: 0; transition: transform .2s var(--ease), opacity .2s; }
.dialog-backdrop.open .dialog { transform: none; opacity: 1; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }

.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(var(--safe-bottom) + 86px); transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 8px; max-width: min(92vw, 420px); background: var(--surface-3); color: var(--ink); padding: 11px 14px; border-radius: 14px;
  font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); transition: transform .3s var(--ease), opacity .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast svg { color: var(--accent); width: 18px; height: 18px; }
.toast-error svg { color: var(--danger); }

/* ------------------------------------------------------------------ завантаження */
.skeleton-list { display: grid; gap: 10px; }
.skeleton { position: relative; overflow: hidden; background: var(--surface); border-radius: var(--r-lg); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .045), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.card-skel { height: 108px; padding: 14px; display: grid; gap: 10px; align-content: start; }
.card-skel i { display: block; height: 12px; border-radius: 6px; background: var(--surface-2); }
.card-skel i:nth-child(1) { width: 55%; height: 15px; }
.card-skel i:nth-child(2) { width: 75%; }
.card-skel i:nth-child(3) { width: 35%; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ адмінка */
.admin-content { display: grid; gap: 14px; }
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font: 500 9px var(--body); }
.chart .bar { fill: var(--accent); }
.chart .bar-zero { fill: var(--surface-3); }
.chart .area { fill: var(--accent-soft); stroke: none; }
.chart .line-a { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart .line-b { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 3; opacity: .7; }
.chart .dot-a { fill: var(--accent); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 2px; display: inline-block; }
.lg-a { background: var(--accent); }
.lg-b { background: var(--ink); opacity: .7; }
.hbar { display: grid; grid-template-columns: 80px minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 13px; }
.hbar small { grid-column: 3; color: var(--muted); text-align: right; margin-top: -8px; }
.hbar-track { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.hbar-track i { display: block; height: 100%; width: var(--p); background: var(--accent); border-radius: 8px; }
.hbar b { font-variant-numeric: tabular-nums; }
.rows-list { display: grid; gap: 8px; }
.user-row { display: flex; align-items: center; gap: 12px; border: 0; background: var(--surface); border-radius: var(--r-md); padding: 12px; text-align: left; width: 100%; transition: background .2s; }
.user-row:active { background: var(--surface-2); }
.user-row .grow { display: grid; gap: 2px; }
.user-row b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row .muted { font-size: 12.5px; }
.receipt { width: 100%; border-radius: var(--r-md); display: block; min-height: 140px; }
.quick { margin-top: -4px; }
.bc-preview { display: grid; gap: 10px; }
.bubble { background: var(--surface-2); border-radius: 16px 16px 16px 4px; padding: 10px 12px; display: grid; gap: 8px; max-width: 92%; }
.bubble img { border-radius: 10px; max-height: 260px; object-fit: cover; width: 100%; }
.bubble p { white-space: pre-wrap; overflow-wrap: anywhere; }
.bc-file { display: flex; gap: 8px; align-items: center; color: var(--muted); }

@media (min-width: 560px) {
  .tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
.warn-count { color: var(--warn); }
.comp-result { display: grid; gap: 10px; }

/* ------------------------------------------------------------------ аудит користувача */
.chip-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.chip-tabs::-webkit-scrollbar { display: none; }
.chip-tabs button { flex: none; border: 0; background: var(--surface-2); color: var(--muted); font: 600 13px/1 var(--body); padding: 9px 12px; border-radius: 999px; transition: background .2s, color .2s; }
.chip-tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.flag { display: inline-flex; align-items: center; gap: 5px; font: 600 11.5px/1.2 var(--body); padding: 5px 8px; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.flag svg { width: 13px; height: 13px; }
.flag.warn { background: var(--warn-soft); color: var(--warn); }
.flag.info { background: var(--accent-soft); color: var(--ink); }
.audit-row .grow { display: grid; gap: 3px; }
.sheet.sheet-full { height: calc(100dvh - var(--safe-top) - 12px); }
.audit-wrap { display: grid; gap: 12px; }
.audit-head { display: flex; gap: 12px; align-items: center; }
.audit-head .grow { display: grid; gap: 6px; justify-items: start; }
.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.action-grid .btn { justify-content: flex-start; }
.audit-tab { display: grid; gap: 12px; }
.table-wrap { overflow-x: auto; }
.ad-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.ad-table th, .ad-table td { padding: 8px 6px; text-align: right; border-bottom: 1px solid var(--line); }
.ad-table thead th { color: var(--muted); font-weight: 600; font-size: 12px; }
.ad-table tbody th { text-align: left; color: var(--muted); font-weight: 500; }
.ad-table tr:last-child th, .ad-table tr:last-child td { border-bottom: 0; }
.events { display: grid; gap: 0; }
.event { display: grid; gap: 3px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.event-time { font: 600 11.5px var(--body); color: var(--muted); font-variant-numeric: tabular-nums; }
.event-text { font-size: 14px; overflow-wrap: anywhere; }
.event-actor { color: var(--accent); font-size: 12.5px; }
.note p { white-space: pre-wrap; overflow-wrap: anywhere; }
.m-preview { display: grid; gap: 8px; }

/* --- новий пошук: форма */
.add-sheet { display: grid; gap: 16px; }
.add-sheet .form[hidden] { display: none; }
.picker { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 0; background: var(--surface-2); color: var(--ink); border-radius: var(--r-sm); padding: 13px 14px; font: 500 15px var(--body); text-align: left; min-width: 0; }
.picker span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.loc-field { position: relative; }
.loc-wrap { position: relative; }
.loc-wrap input { width: 100%; padding-right: 40px; }
.loc-clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.suggest { display: grid; background: var(--surface-2); border-radius: var(--r-sm); overflow: hidden; max-height: 260px; overflow-y: auto; }
.suggest-row { display: grid; gap: 2px; text-align: left; border: 0; background: none; color: var(--ink); padding: 11px 14px; border-bottom: 1px solid var(--line); font: 500 14.5px var(--body); }
.suggest-row:last-child { border-bottom: 0; }
.suggest-row .muted, .cat-row .muted { font-size: 12.5px; }
.suggest-empty { padding: 12px 14px; margin: 0; }
.preview { display: grid; gap: 10px; background: var(--surface); border-radius: var(--r-lg); padding: 14px; }
.preview-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.preview-head b { font: 700 15px var(--display); }
.warn-note { margin: 0; font-size: 13px; color: var(--warn, #FFB547); }
.ad-mini { display: flex; gap: 12px; align-items: center; color: var(--ink); text-decoration: none; min-width: 0; }
.ad-mini img, .ad-ph { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--surface-2); flex: none; }
.ad-mini .grow { display: grid; gap: 3px; min-width: 0; }
.ad-mini b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-mini .muted { font-size: 12.5px; }
.cat-picker { display: grid; gap: 12px; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: var(--r-sm); padding: 0 12px; }
.search-box svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.search-box input { border: 0; background: none; flex: 1; padding: 12px 0; min-width: 0; }
.cat-list { display: grid; }
.cat-row { display: flex; align-items: center; gap: 10px; border: 0; background: none; color: var(--ink); text-align: left; padding: 12px 2px; border-bottom: 1px solid var(--line); font: 500 15px var(--body); min-width: 0; }
.cat-row .grow { display: grid; gap: 2px; min-width: 0; }
.cat-row b { font-weight: 500; }
.cat-row svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.cat-row.back { color: var(--accent); }
.cat-row.back svg { color: var(--accent); }

/* --- розсилка: групи, вибрані люди, кнопка */
.chip-tabs.aud, .chip-tabs.btns { flex-wrap: wrap; overflow: visible; }
.people { gap: 10px; }
.people-list { display: grid; max-height: 320px; overflow-y: auto; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.person input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.person .grow { display: grid; gap: 2px; min-width: 0; }
.person b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .muted { font-size: 12.5px; }
.picked .chip { border: 0; color: var(--ink); cursor: pointer; }
.link-fields { gap: 8px; }
.bubble-btn { max-width: 92%; text-align: center; background: var(--surface-2); border-radius: 10px; padding: 10px; font: 600 14px var(--body); color: var(--accent); }

/* --- аватарки */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-edit { position: relative; border: 0; background: none; padding: 0; border-radius: 50%; flex: none; cursor: pointer; }
.avatar-badge { position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 0 0 3px var(--bg); }
.avatar-badge svg { width: 12px; height: 12px; }

/* --- воронка */
.funnel { display: grid; gap: 12px; }
.fn-row { display: grid; gap: 5px; }
.fn-head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.fn-head b { font: 700 15px var(--display); font-variant-numeric: tabular-nums; }
.fn-bar { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.fn-bar i { display: block; height: 100%; width: var(--p); background: linear-gradient(90deg, var(--accent), #8BFFE1); border-radius: 6px; }
.fn-row .muted { font-size: 12px; }
.fn-table td small { display: block; color: var(--faint); font-size: 10.5px; }
.fn-table th:first-child { text-align: left; white-space: nowrap; }
.seg-tight button { padding: 9px 1px; font-size: 12px; letter-spacing: -.01em; }

/* --- майданчики */
.src-badge { display: inline-block; vertical-align: 2px; margin-right: 6px; font: 700 10.5px/1 var(--body); letter-spacing: .02em; color: var(--accent); background: var(--accent-soft); padding: 4px 6px; border-radius: 6px; }
.add-form .olx-fields[hidden], .add-form .ria-fields[hidden], .add-form .dom-fields[hidden], .add-form .vin-fields[hidden], .add-form .lun-fields[hidden], .add-form .rem-fields[hidden], .lun-rooms[hidden], .dom-rooms[hidden] { display: none; }
.dom-cur-slot { margin-top: 8px; max-width: 160px; }
.dom-kind { flex-wrap: wrap; overflow: visible; }
.picker:disabled { opacity: .5; }

.vin-host, .vin-status { flex-wrap: wrap; overflow: visible; }
.platform-slot .seg button { font-size: 12px; padding: 9px 1px; }
.lun-kind { flex-wrap: wrap; overflow: visible; }
.platform-slot .seg { grid-template-columns: repeat(4, 1fr); }
.platform-slot .seg-thumb { display: none; }
.platform-slot .seg button[aria-checked="true"] { background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------------------------------------------------------------- «Маєте код?» і подарунки */
.code-field { margin: 4px 0 12px; }
.code-toggle { display: inline-flex; align-items: center; gap: 6px; }
.code-toggle svg { width: 18px; height: 18px; }
.code-input-row { display: flex; gap: 8px; }
.code-input-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .04em; }
.code-input-row .btn { flex: none; width: auto; padding-inline: 14px; }
.code-msg { min-height: 1.2em; margin-top: 6px; }
.code-msg.ok { color: var(--accent); }
.code-msg.error { color: var(--danger); }
.invited-by { margin: 0 0 10px; }
.gift-panel .buy svg { width: 18px; height: 18px; }
.gift-list { display: grid; gap: 10px; margin-top: 14px; }
.gift-row { padding: 12px; border-radius: 14px; background: var(--surface-2); display: grid; gap: 8px; }
.gift-row-main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.gift-row-main code { font-size: 13px; letter-spacing: .04em; }
.gift-row .chip { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: rgba(255,255,255,.08); }
.gift-row .chip.ok { color: var(--accent); }
.gift-row .chip.warn { color: var(--warn); }
.gift-row .chip.off { opacity: .6; }
.gift-row .muted { width: 100%; font-size: 13px; }
.gift-row .claim { justify-self: start; }
.gift-price { font: 800 34px/1 var(--display); margin: 2px 0 12px; }
.gift-price small { font-size: 16px; font-weight: 600; opacity: .7; }
.gift-received { text-align: center; display: grid; gap: 10px; }
.gift-received .gift-logo img { width: 72px; height: 72px; }
.gift-received blockquote { margin: 0; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.05); font-style: italic; }
/* адмінка: 6 розділів — два рядки по три */
.seg.seg-tight { grid-template-columns: repeat(3, 1fr); row-gap: 3px; }
.seg.seg-tight .seg-thumb { display: none; }
.seg.seg-tight button[aria-checked="true"] { background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.seg.seg-tight button { font-size: 13px; padding: 9px 2px; }
