/* Монохромная тема: тёмная — чёрный фон и белые акценты, светлая — наоборот. */
:root {
  --bg: #000000;
  --card: #0d0d0d;
  --card-2: #141414;
  --border: #222222;
  --border-strong: #3a3a3a;
  --text: #ffffff;
  --muted: #8c8c8c;
  --accent: #ffffff;
  --accent-text: #000000;
  --danger: #ff5c5c;
  --radius: 18px;
  --tabbar: 72px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --shine: rgba(255, 255, 255, .06);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --card: #f6f6f6;
  --card-2: #efefef;
  --border: #e4e4e4;
  --border-strong: #c9c9c9;
  --text: #000000;
  --muted: #6e6e6e;
  --accent: #000000;
  --accent-text: #ffffff;
  --danger: #d92b2b;
  --shine: rgba(0, 0, 0, .05);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; flex: none; }
button { cursor: pointer; }

.page { padding: 28px 20px calc(var(--tabbar) + 32px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
.page h1 { font-size: 32px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 8px; }
.subtitle { color: var(--muted); margin: 0 0 24px; font-size: 16px; }
.section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin: 28px 0 12px; }

/* карточки */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 12px; }
.card h3 { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.card p { margin: 0; color: var(--muted); }
.card .actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat .icon { width: 44px; height: 44px; border-radius: 12px; background: var(--card-2); display: grid;
  place-items: center; margin-bottom: 18px; }
.stat .icon svg { width: 22px; height: 22px; }
.stat .value { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.stat .label { color: var(--muted); margin-top: 8px; }

/* кнопки и поля */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0;
  border-radius: 14px; padding: 13px 20px; font-weight: 600; white-space: nowrap;
  transition: opacity .15s, transform .15s var(--ease), background .2s, color .2s; }
.btn:active { opacity: .8; transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-secondary { background: var(--card-2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--border-strong); }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; }

.add-row { display: flex; gap: 10px; }
.input { flex: 1; min-width: 0; background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 13px 16px; outline: none; }
.input::placeholder { color: var(--muted); }
.input:focus { border-color: var(--border-strong); }

.link-btn { background: none; border: 0; padding: 12px 0 0; color: var(--muted); font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px; text-align: left; }
.link-btn b { color: var(--text); font-weight: 600; }
.link-btn svg { width: 16px; height: 16px; }

.empty { margin-top: 20px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  padding: 40px 24px; text-align: center; color: var(--muted); }

/* список каналов */
.list { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  transition: transform .15s var(--ease), border-color .2s; }
.item:active { transform: scale(.98); border-color: var(--border-strong); }
.item .avatar { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--card-2);
  border: 1px solid var(--border); display: grid; place-items: center; font-weight: 700; }
.item .body { flex: 1; min-width: 0; }
.item .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meta { color: var(--muted); font-size: 14px; margin-top: 2px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.item .chev { color: var(--muted); flex: none; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--muted);
  margin-right: 6px; vertical-align: 0; }
.dot.on { background: var(--text); border-color: var(--text); }
.dot.warn { background: var(--danger); border-color: var(--danger); }

.pill { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 4px 10px; font-size: 13px; color: var(--muted); }

/* экран канала */
.back { background: none; border: 0; padding: 0 0 16px; color: var(--muted); display: inline-flex;
  align-items: center; gap: 4px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row + .row { margin-top: 14px; }
.row .title { font-weight: 600; }
.row .hint { color: var(--muted); font-size: 14px; margin-top: 2px; }

.switch { position: relative; width: 52px; height: 32px; flex: none; border-radius: 999px; border: 0;
  background: var(--border-strong); transition: background .2s; padding: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg); transition: transform .3s var(--ease), width .2s var(--ease); }
.switch:active::after { width: 32px; }
.switch.on:active::after { transform: translateX(14px); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); background: var(--accent-text); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { border: 1px solid var(--border-strong); background: transparent; border-radius: 999px; padding: 8px 14px;
  font-size: 14px; transition: background .2s, color .2s, border-color .2s, transform .15s var(--ease); }
.chip:active, .icon-btn:active, .segmented button:active { transform: scale(.94); }
.chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.custom { display: flex; gap: 8px; margin-top: 10px; }
.custom .input { padding: 9px 14px; font-size: 14px; }
.custom .btn { padding: 9px 16px; font-size: 14px; }

.donor { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.donor:first-child { border-top: 0; padding-top: 0; }
.donor .body { flex: 1; min-width: 0; }
.donor .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donor .meta { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donor .err { color: var(--danger); font-size: 13px; margin-top: 2px; }
.icon-btn { width: 36px; height: 36px; flex: none; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; display: grid; place-items: center; color: var(--muted); padding: 0;
  transition: background .2s, color .2s, transform .15s var(--ease); }
.icon-btn svg { width: 16px; height: 16px; }

.plan { display: flex; flex-wrap: wrap; gap: 8px; }
.plan span { border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; font-size: 14px;
  font-variant-numeric: tabular-nums; }
.plan .done { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.plan .failed { color: var(--danger); border-color: var(--danger); }
.plan .skipped { color: var(--muted); text-decoration: line-through; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--card-2);
  border: 1px solid var(--border); border-radius: 14px; padding: 4px; gap: 4px; }
.segmented button { border: 0; background: transparent; border-radius: 10px; padding: 9px 4px; font-size: 13px;
  color: var(--muted); transition: background .25s var(--ease), color .25s, transform .15s var(--ease); }
.segmented button.on { background: var(--accent); color: var(--accent-text); font-weight: 600; }

.status { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--card-2); font-size: 14px;
  white-space: pre-line; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong);
  border-top-color: var(--text); animation: spin .8s linear infinite; display: inline-block; vertical-align: -3px;
  margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading { display: grid; place-items: center; min-height: 60vh; color: var(--muted); }

/* нижняя панель */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(5, 1fr); padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  z-index: 10; }
.tabbar > .tab-ind { position: absolute; top: -1px; left: 4px; width: calc((100% - 8px) / 5); height: 3px;
  display: flex; justify-content: center; transition: transform .4s var(--ease), opacity .2s; pointer-events: none; }
.tabbar > .tab-ind::after { content: ""; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--text); }
.tabbar > .tab-ind.dim { opacity: 0; }
.tab { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--muted); font-size: 11px; padding: 6px 0; min-width: 0; transition: color .2s; }
.tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab svg { width: 24px; height: 24px; transition: transform .35s var(--ease); }
.tab:active svg { transform: scale(.85); }
.tab.on { color: var(--text); font-weight: 600; }
.tab.on svg { transform: translateY(-1px) scale(1.08); }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom));
  max-width: 528px; margin: 0 auto; background: var(--accent); color: var(--accent-text); border-radius: 14px;
  padding: 14px 16px; font-size: 15px; z-index: 20; box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  transform: translateY(20px); opacity: 0; transition: all .2s; pointer-events: none; }
.toast.show { transform: none; opacity: 1; }
.toast.error { background: var(--danger); color: #fff; }

/* сворачиваемые списки и справка */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.caret { color: var(--muted); display: inline-flex; transition: transform .2s; }
details[open] > summary .caret { transform: rotate(90deg); }
.group + .group { margin-top: 12px; }
.group > summary { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); font-weight: 600; }
.group > summary .count { margin-left: auto; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.group > .list { margin-top: 10px; }
.help details { border-top: 1px solid var(--border); }
.help details:first-child { border-top: 0; }
.help summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0;
  font-weight: 600; }
.help details:first-child summary { padding-top: 0; }
.help details p { padding-bottom: 14px; font-size: 15px; }
.help details:last-child p { padding-bottom: 0; }
.card .title svg { width: 18px; height: 18px; vertical-align: -3px; }

/* выращивание */
.progress { height: 8px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--border);
  overflow: hidden; margin-top: 12px; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .6s var(--ease);
  position: relative; overflow: hidden; }
.progress.live span::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(127, 127, 127, .45), transparent);
  animation: sweep 1.6s ease-in-out infinite; }
.progress.thin { height: 6px; margin-top: 6px; }
.progress.endless span { opacity: .35; }
.progress.full span { background: var(--danger); }
.grow-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.grow-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.grow-form .input { width: 100%; color: var(--text); }
.grow-form textarea { resize: vertical; min-height: 80px; font: inherit; line-height: 1.4; }
.grow-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.found .donor:first-child { border-top: 0; padding-top: 0; }
.icon-btn.picked { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 700; }
.found .donor .meta { white-space: normal; }
.segmented.two-col { grid-template-columns: 1fr 1fr; }
.phone-form { display: flex; flex-direction: column; gap: 10px; }
.phone-form select { width: 100%; appearance: none; -webkit-appearance: none; color: var(--text); }
.phone-form .input { width: 100%; }
.phone-hint { margin: 0 !important; font-size: 14px; }
.phone-hint.ok { color: var(--text) !important; font-weight: 600; }

/* тариф на «Обзоре» */
.plan-summary .plan-name { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; display: flex; align-items: center; gap: 6px; }
.plan-summary .hint, .hint { color: var(--muted); font-size: 14px; }
.usages { display: grid; gap: 12px; margin-top: 16px; }
.usage-top { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.usage-top span:last-child { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack > .card + .card { margin-top: 0; }
.center { text-align: center; }

/* тарифы */
.plan-card { position: relative; overflow: hidden; }
.plan-card .plan-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.plan-card .plan-name { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.plan-card .price { font-size: 24px; font-weight: 800; white-space: nowrap; letter-spacing: -0.01em; }
.plan-card .price small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.plan-card > .hint { margin-top: 4px; }
.plan-card.featured { border-color: var(--text); }
.plan-card.featured::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, var(--shine) 50%, transparent 70%);
  background-size: 250% 100%; animation: shine 4s ease-in-out infinite; }
.plan-card.current { border-color: var(--border-strong); }
.badge { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 4px 9px; border-radius: 999px; background: var(--accent); color: var(--accent-text); margin-bottom: 10px; }
.features { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.features li { display: flex; gap: 8px; align-items: flex-start; font-size: 15px; }
.features svg { width: 18px; height: 18px; margin-top: 1px; }
.pay-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.pay-row .btn { flex: 1 1 140px; }
.email-card .title { font-weight: 600; margin-bottom: 10px; }
.email-card .input { width: 100%; }
.pending .title { display: flex; align-items: center; font-weight: 600; }

/* магазин */
.listing-head { display: flex; align-items: center; gap: 12px; }
.listing-head .avatar { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--card-2);
  border: 1px solid var(--border); display: grid; place-items: center; font-weight: 700; }
.listing-head .body { flex: 1; min-width: 0; }
.listing-head .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.listing-head .meta { color: var(--muted); font-size: 14px; }
.listing-head .price { font-weight: 800; font-size: 18px; white-space: nowrap; }
.listing .desc { margin-top: 12px; white-space: pre-line; font-size: 15px; }
.pill.active { color: var(--text); border-color: var(--text); }
.pill.sold { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.status.ok { display: flex; gap: 8px; align-items: flex-start; }
.status.ok svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.empty svg { width: 36px; height: 36px; margin-bottom: 10px; opacity: .6; }

/* аккаунты выращивания */
.accs { margin-top: 12px; }
.acc { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.acc:first-child { border-top: 0; }
.acc .avatar { width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--card-2);
  border: 1px solid var(--border); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.acc .body { flex: 1; min-width: 0; }
.acc .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc .meta { color: var(--muted); font-size: 13px; }
.grow-form select { appearance: none; -webkit-appearance: none; color: var(--text); }
.dot.pulse { animation: pulse 1.6s ease-in-out infinite; }

/* загрузка */
.skeleton { border-radius: var(--radius); border: 1px solid var(--border); background: var(--card);
  position: relative; overflow: hidden; }
.skeleton + .skeleton { margin-top: 12px; }
.skeleton::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--shine), transparent); animation: sweep 1.3s ease-in-out infinite; }

/* ---------------------------------------------------------------- анимации */
.page.enter { animation: page-fade .35s var(--ease) both; }
.page.enter-forward { animation-name: page-forward; }
.page.enter-back { animation-name: page-back; }
.page.enter-right { animation-name: page-right; }
.page.enter-left { animation-name: page-left; }
.enter .rise { animation: rise .45s var(--ease) both; animation-delay: var(--d, 0ms); }
.enter .progress span { animation: bar .9s var(--ease) both; animation-delay: .15s; }
details.opening > :not(summary) { animation: unfold .3s var(--ease) both; }
.toast { transition: transform .35s var(--ease), opacity .25s; }

.burst { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 30; }
.burst-ring { position: absolute; width: 96px; height: 96px; border-radius: 50%; border: 3px solid var(--text);
  animation: ring 1s var(--ease) both; }
.burst-check { width: 72px; height: 72px; border-radius: 50%; background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center; animation: pop 1.3s var(--ease) both; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }
.burst-check svg { width: 36px; height: 36px; stroke-width: 2.6; stroke-dasharray: 30; stroke-dashoffset: 30;
  animation: draw .45s .2s ease-out forwards; }

@keyframes page-fade { from { opacity: 0; } }
@keyframes page-forward { from { opacity: 0; transform: translateX(28px); } }
@keyframes page-back { from { opacity: 0; transform: translateX(-28px); } }
@keyframes page-right { from { opacity: 0; transform: translateX(14px); } }
@keyframes page-left { from { opacity: 0; transform: translateX(-14px); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes bar { from { width: 0; } }
@keyframes unfold { from { opacity: 0; transform: translateY(-6px); } }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes shine { 0%, 60% { background-position: 150% 0; } 100% { background-position: -100% 0; } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes ring { from { transform: scale(.4); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 25% { transform: scale(1.08); opacity: 1; }
  40% { transform: scale(1); } 80% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(.9); } }
@keyframes draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important;
    animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.plan-card .plan-used { margin-top: 16px; }
