:root {
  --bg: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #0f1115);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --accent: var(--tg-theme-button-color, #2f80ed);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, var(--accent));
  --danger: var(--tg-theme-destructive-text-color, #ff453a);
  --header: var(--tg-theme-section-header-text-color, var(--hint));
  --sep: var(--tg-theme-section-separator-color, rgba(127, 127, 127, .18));
  --ok: #30d158;
  --warn: #ff9f0a;
  --radius: 14px;
  --safe-bottom: max(env(safe-area-inset-bottom), var(--tg-safe-area-inset-bottom, 0px));
  --tabbar-h: 64px;
  --tabbar-gap: 10px;
  --spring: cubic-bezier(.3, 1.35, .5, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--tg-theme-secondary-bg-color, #0e1117);
    --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #1b1f27));
    --text: var(--tg-theme-text-color, #f2f3f5);
  }
}

:root[data-theme="dark"] {
  --bg: var(--tg-theme-secondary-bg-color, #0e1117);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #1b1f27));
  --text: var(--tg-theme-text-color, #f2f3f5);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { touch-action: manipulation; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.38 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body { padding-bottom: calc(var(--tabbar-h) + var(--tabbar-gap) * 2 + var(--safe-bottom) + 8px); }

svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
svg.ph { fill: currentColor; stroke: none; }

.tile {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 82%, #fff), var(--c));
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.tile .ph { width: 18px; height: 18px; }

main { padding: 0 14px; max-width: 640px; margin: 0 auto; }

/* ---------- Заголовок страницы ---------- */

.page-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 4px 10px;
}
.page-head h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.page-head .sub { color: var(--hint); font-size: 13px; margin-top: 2px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--hint) 16%, transparent); color: var(--hint);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.running { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill.running::before { animation: pulse 1.6s ease-in-out infinite; }
.pill.paused { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.pill.off { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Карточки ---------- */

.section-title {
  margin: 22px 16px 7px; font-size: 13px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .03em; color: var(--header);
  display: flex; justify-content: space-between; align-items: center;
}
.section-title button { text-transform: none; letter-spacing: 0; font-size: 14px; }

.card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.card.flush { padding: 0; overflow: hidden; }

/* Статус рассылки */
.status-card { background: var(--card); border-radius: 18px; padding: 16px; }
.status-head { display: flex; align-items: center; gap: 12px; }
.status-icon {
  width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #7c6cf6, #2f80ed);
}
.status-icon.running { background: linear-gradient(135deg, #34c759, #00a383); }
.status-icon.paused { background: linear-gradient(135deg, #ffb340, #ff8a00); }
.status-icon svg { width: 22px; height: 22px; }
.status-title { font-size: 18px; font-weight: 700; }
.status-sub { font-size: 13px; color: var(--hint); }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin: 16px 0 14px; padding: 12px 0;
  border-top: 1px solid var(--sep); border-bottom: 1px solid var(--sep);
}
.stat { text-align: center; }
.stat + .stat { border-left: 1px solid var(--sep); }
.stat b { display: block; font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--hint); }
.stat.err b { color: var(--danger); }

.actions { display: flex; gap: 8px; }
.actions > * { flex: 1 1 0; min-width: 0; }

/* Списки */
.row {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; min-height: 50px;
}
.row + .row::before {
  content: ""; position: absolute; top: 0; right: 0; left: 16px;
  border-top: 1px solid var(--sep);
}
.row.has-avatar + .row::before, .row.has-avatar + .row.has-avatar::before { left: 68px; }
.row.has-tile + .row::before { left: 58px; }
.row.tap { cursor: pointer; }
.row.tap { transition: background .2s, transform .2s var(--spring); }
.row.tap:active { background: color-mix(in srgb, var(--text) 7%, transparent); transform: scale(.985); transition-duration: .08s; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { color: var(--hint); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.row-sub.wrap { white-space: normal; }
.chev { color: var(--hint); width: 17px; height: 17px; opacity: .7; }

/* Аккаунт в рассылке */
.acc-card { background: var(--card); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.acc-head { display: flex; align-items: center; gap: 12px; }
.acc-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px;
}
.acc-stats span {
  display: flex; flex-direction: column; align-items: center; padding: 7px 4px; border-radius: 10px;
  background: var(--bg); font-size: 11.5px; color: var(--hint);
}
.acc-stats b { color: var(--text); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.acc-stats .bad b { color: var(--danger); }
.acc-flood { margin: 10px 2px 0; font-size: 12.5px; color: var(--warn); }
.acc-actions { display: flex; gap: 8px; margin-top: 12px; }
.acc-actions .btn { flex: 1; }
.acc-hint { margin: 10px 2px 0; font-size: 12.5px; color: var(--hint); }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(135deg, #6c7bff, #a66cff); color: #fff; font-weight: 600; font-size: 16px;
}
.avatar .ph { width: 22px; height: 22px; }
.avatar img.fresh { animation: fade-in .3s ease both; }
@keyframes fade-in { from { opacity: 0; } }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 92px; height: 92px; font-size: 34px; margin: 0 auto; }
.avatar.big .ph { width: 44px; height: 44px; }

.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--hint) 15%, transparent); color: var(--hint);
}
.badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.badge.err { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 14px; }
.kv + .kv { border-top: 1px solid var(--sep); }
.kv span:first-child { color: var(--hint); }
.kv span:last-child { text-align: right; word-break: break-word; }

.empty { text-align: center; color: var(--hint); padding: 28px 16px; font-size: 14px; }
.empty svg { width: 34px; height: 34px; opacity: .45; margin-bottom: 6px; }

.note {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13.5px; padding: 11px 14px; border-radius: var(--radius); margin-top: 10px;
  background: color-mix(in srgb, var(--accent) 10%, var(--card)); color: var(--text);
}
.note svg { width: 18px; height: 18px; color: var(--accent); margin-top: 1px; }
.note.warn { background: color-mix(in srgb, var(--warn) 12%, var(--card)); }
.note.warn svg { color: var(--warn); }

/* ---------- Кнопки и поля ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 46px; padding: 0 16px; border: 0; border-radius: 12px;
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  background: var(--accent); color: var(--accent-text);
  transition: transform .35s var(--spring), opacity .15s, filter .2s;
}
.btn:active { transform: scale(.95); filter: brightness(.92); transition-duration: .1s; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 17px; height: 17px; }
.btn.light { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); }
.btn.danger { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.btn.small { height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.fit { flex: 0 0 auto; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 500; color: var(--link); cursor: pointer; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--hint); margin: 0 2px 6px; }
.field .help { font-size: 12px; color: var(--hint); margin: 6px 2px 0; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid transparent; border-radius: 11px;
  background: var(--bg); color: var(--text);
  font: inherit; padding: 11px 12px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.input:focus { border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 96px; }
select.input {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.group-label { font-size: 14px; font-weight: 600; margin: 2px 2px 8px; }

.segment { --seg: 0; position: relative; display: flex; background: var(--bg); border-radius: 11px; padding: 3px; }
.segment::before {
  content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px);
  border-radius: 9px; background: var(--card); box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
  transform: translateX(calc(var(--seg) * 100%)); transition: transform .45s var(--spring);
}
.segment button {
  position: relative; flex: 1; border: 0; background: none; color: var(--hint); font: inherit; font-size: 14px; font-weight: 600;
  padding: 8px; border-radius: 9px; cursor: pointer; transition: color .25s;
}
.segment button.on { color: var(--text); }

.switch { position: relative; width: 51px; height: 31px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px; cursor: pointer;
  background: color-mix(in srgb, var(--hint) 32%, transparent); transition: background .3s ease;
}
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px;
  border-radius: 999px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .22);
  transition: transform .4s var(--spring), width .2s ease;
}
.switch:active span::after { width: 33px; }
.switch input:checked:active + span::after { transform: translateX(14px); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(20px); }

.toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.search { position: relative; flex: 1; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--hint); }
.search .input { padding-left: 36px; background: var(--card); height: 40px; }
.toolbar select.input { background-color: var(--card); height: 40px; padding-top: 0; padding-bottom: 0; }
.icon-btn:active { transform: scale(.9); transition-duration: .1s; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 11px; border: 0; flex-shrink: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--card); color: var(--accent);
  transition: transform .35s var(--spring);
}
.icon-btn.primary { background: var(--accent); color: var(--accent-text); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- Плавающий таб-бар ---------- */

.tabs {
  --i: 0;
  position: fixed; z-index: 20;
  left: var(--tabbar-gap); right: var(--tabbar-gap);
  bottom: calc(var(--tabbar-gap) + var(--safe-bottom));
  max-width: 520px; margin: 0 auto;
  height: var(--tabbar-h); padding: 6px;
  display: flex;
  border-radius: 24px;
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: blur(22px) saturate(1.7);
  -webkit-backdrop-filter: blur(22px) saturate(1.7);
  border: 1px solid color-mix(in srgb, var(--text) 9%, transparent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28), 0 1px 3px rgba(0, 0, 0, .14), inset 0 1px 0 rgba(255, 255, 255, .05);
  animation: tabbar-in .6s var(--spring) both .1s;
}
@keyframes tabbar-in { from { transform: translateY(140%); opacity: 0; } }

/* Плавающая «капсула» под активной вкладкой */
.tabs-brand, .tabs-foot { display: none; }
.tabs-list { position: relative; display: flex; flex: 1; }

.tab-indicator {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: calc(100% / 5);
  border-radius: 18px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
  transform: translateX(calc(var(--i) * 100%));
  transition: transform .38s var(--spring);
}
.tabs.no-anim .tab-indicator { transition: none; }

.tabs button {
  position: relative; z-index: 1;
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none; cursor: pointer;
  color: var(--hint); font: inherit;
  transition: color .3s ease;
}
.tabs button.active { color: var(--accent); }

.tab-ico { position: relative; width: 25px; height: 25px; }
.tab-ico .ph { position: absolute; inset: 0; width: 25px; height: 25px; transition: opacity .15s ease, transform .3s var(--spring); }
.tab-ico .f { opacity: 0; transform: scale(.5) rotate(-12deg); }
.tabs button.active .tab-ico .r { opacity: 0; transform: scale(1.3); }
.tabs button.active .tab-ico .f { opacity: 1; transform: none; }
.tabs button:active .tab-ico { transform: scale(.86); transition: transform .12s; }
.tabs button.bump .tab-ico { animation: bump .38s var(--spring); }
@keyframes bump {
  0% { transform: scale(1); }
  30% { transform: scale(.82) translateY(1px); }
  65% { transform: scale(1.14) translateY(-2px); }
  100% { transform: scale(1); }
}

.tab-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  transition: transform .3s var(--spring);
}
.tabs button.active .tab-label { transform: translateY(-1px); }

/* ---------- Анимации экранов ---------- */

#view.enter > * {
  animation: view-in .3s var(--ease-out) both;
  animation-delay: calc(var(--d, 0) * 22ms);
}
#view.enter[data-dir="left"] > * { animation-name: view-in-left; }
@keyframes view-in { from { opacity: 0; transform: translateX(14px); } }
@keyframes view-in-left { from { opacity: 0; transform: translateX(-14px); } }

.tick { animation: tick .6s var(--spring); }
@keyframes tick { 40% { transform: scale(1.18); color: var(--accent); } }

/* Иконка статуса: волна и «летящий» самолётик во время рассылки */
.status-icon { position: relative; }
.status-icon.running::before, .status-icon.running::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  border: 2px solid var(--ok); animation: ripple 2.2s ease-out infinite;
}
.status-icon.running::after { animation-delay: 1.1s; }
@keyframes ripple { from { transform: scale(1); opacity: .7; } to { transform: scale(1.7); opacity: 0; } }
.status-icon .plane { display: grid; place-items: center; }
.status-icon.running .plane { animation: fly 2.4s ease-in-out infinite; }
.status-icon.paused .plane { animation: breathe 2.4s ease-in-out infinite; }
@keyframes fly {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  50% { transform: translate(2px, -3px) rotate(-6deg); }
}
@keyframes breathe { 50% { opacity: .55; transform: scale(.92); } }

/* ---------- Нижний лист ---------- */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31;
  max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 18px 18px 0 0;
  padding: 6px 14px calc(20px + var(--safe-bottom));
  transform: translateY(105%); transition: transform .5s cubic-bezier(.32, .72, 0, 1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .3);
  max-width: 640px; margin: 0 auto;
}
.sheet.open { transform: none; }
.sheet.open .sheet-body > * { animation: sheet-item .5s var(--ease-out) both; animation-delay: calc(var(--d, 0) * 40ms + 80ms); }
@keyframes sheet-item { from { opacity: 0; transform: translateY(14px); } }
.sheet-grip { width: 36px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--hint) 45%, transparent); margin: 4px auto 10px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin: 0 2px 12px; gap: 12px; }
.sheet-head h2 { margin: 0; font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet .section-title { margin-left: 14px; }
.close-btn { border: 0; background: color-mix(in srgb, var(--hint) 18%, transparent); color: var(--hint); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.close-btn svg { width: 15px; height: 15px; stroke-width: 2.6; }

.result { display: flex; gap: 8px; padding: 8px 0; font-size: 14px; }
.result + .result { border-top: 1px solid var(--sep); }

.toast {
  position: fixed; left: 50%; z-index: 50;
  bottom: calc(var(--tabbar-h) + var(--tabbar-gap) * 2 + var(--safe-bottom) + 6px);
  transform: translate(-50%, 18px) scale(.92);
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px;
  background: rgba(28, 28, 32, .94); color: #fff; font-size: 14px; font-weight: 500; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .5s var(--spring);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast.err { background: rgba(215, 45, 55, .96); }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { height: 60px; border-radius: var(--radius); margin-bottom: 10px; background: linear-gradient(90deg, var(--card), color-mix(in srgb, var(--card) 65%, var(--bg)), var(--card)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 360px) {
  .tabs button span { font-size: 9.5px; }
  .page-head h1 { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Правила и тарифы ---------- */

.tabs.hidden { transform: translateY(160%); opacity: 0; visibility: hidden; pointer-events: none; transition: transform .4s var(--ease-out), opacity .3s; }

.gate-hero { text-align: center; padding: 28px 12px 18px; }
.gate-hero h1 { margin: 14px 0 6px; font-size: 26px; letter-spacing: -.02em; }
.gate-hero p { margin: 0; color: var(--hint); font-size: 14.5px; }
.gate-icon {
  width: 76px; height: 76px; margin: 0 auto; border-radius: 22px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #7c6cf6, #2f80ed);
  box-shadow: 0 12px 30px color-mix(in srgb, #5b6cf6 45%, transparent);
  animation: float 3.2s ease-in-out infinite;
}
.gate-icon .ph { width: 40px; height: 40px; }
@keyframes float { 50% { transform: translateY(-5px) rotate(-3deg); } }
.rules-text { white-space: pre-wrap; font-size: 14.5px; line-height: 1.5; }

.plan-card {
  position: relative; background: var(--card); border-radius: 16px; padding: 14px; margin-bottom: 10px;
  border: 1px solid transparent;
}
.sheet .plan-card { background: var(--card); }
.plan-card.featured { border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: 0 6px 22px color-mix(in srgb, var(--accent) 18%, transparent); }
.plan-card.trial { border-style: dashed; border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.plan-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.plan-name { font-size: 17px; font-weight: 700; }
.plan-sub { font-size: 13px; color: var(--hint); margin-top: 2px; }
.plan-price { font-size: 20px; font-weight: 800; white-space: nowrap; }
.plan-badge {
  position: absolute; top: -9px; right: 14px; padding: 2px 9px; border-radius: 999px;
  background: var(--accent); color: var(--accent-text); font-size: 11.5px; font-weight: 700;
}

.sub-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.usage { display: flex; justify-content: space-between; font-size: 13px; color: var(--hint); margin-top: 10px; }
.usage span:last-child { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #8e5cf7)); transition: width .6s var(--ease-out); }

/* ================= ПК: широкое окно / полный экран ================= */

html.desk { --side-w: 248px; }
html.desk body { padding: 0 0 32px calc(var(--side-w) + 24px); }
html.desk main { max-width: 1180px; margin: 0; padding: 8px 32px 0 8px; }
html.desk .page-head { padding: 28px 4px 14px; }
html.desk .page-head h1 { font-size: 32px; }

/* Боковое меню вместо нижнего таб-бара */
html.desk .tabs {
  left: 16px; right: auto; top: 16px; bottom: 16px; width: var(--side-w);
  height: auto; max-width: none; margin: 0; padding: 14px 10px;
  flex-direction: column; gap: 6px; border-radius: 22px;
  animation: side-in .55s var(--spring) both .05s;
}
@keyframes side-in { from { transform: translateX(-120%); opacity: 0; } }
html.desk .tabs-brand { display: flex; align-items: center; gap: 11px; padding: 6px 10px 16px; border-bottom: 1px solid var(--sep); margin-bottom: 8px; }
html.desk .brand-logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #7c6cf6, #2f80ed); }
html.desk .brand-logo .ph { width: 22px; height: 22px; }
html.desk .brand-text { display: flex; flex-direction: column; min-width: 0; }
html.desk .brand-text b { font-size: 16px; }
html.desk .brand-text span { font-size: 12.5px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.desk .tabs-list { flex-direction: column; flex: 0 0 auto; gap: 4px; }
html.desk .tabs button { flex: 0 0 48px; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px; border-radius: 14px; }
html.desk .tabs button:hover:not(.active) { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
html.desk .tab-label { font-size: 14.5px; font-weight: 600; }
html.desk .tabs button.active .tab-label { transform: none; }
html.desk .tab-ico, html.desk .tab-ico .ph { width: 22px; height: 22px; }
html.desk .tab-indicator { width: 100%; height: 48px; bottom: auto; border-radius: 14px; transform: translateY(calc(var(--i) * (48px + 4px))); }
html.desk .tabs-foot { display: block; margin-top: auto; padding: 12px 10px 2px; border-top: 1px solid var(--sep); font-size: 12.5px; color: var(--hint); }
html.desk .tabs.hidden { transform: translateX(-130%); }
html.desk body:has(.tabs.hidden) { padding-left: 24px; }
html.desk body:has(.tabs.hidden) main { margin: 0 auto; max-width: 980px; }

/* Переходы между разделами на ПК — снизу вверх */
html.desk #view.enter > * { animation-name: view-up; }
@keyframes view-up { from { opacity: 0; transform: translateY(10px); } }

/* Рассылка: статус и аккаунты сеткой */
html.desk .status-card { display: grid; grid-template-columns: minmax(220px, 1fr) 2fr auto; align-items: center; gap: 24px; padding: 20px 24px; }
html.desk .status-card .stats { margin: 0; border: 0; padding: 0; }
html.desk .status-card .actions, html.desk .status-card > .btn { min-width: 260px; }
html.desk .acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
html.desk .acc-card { margin: 0; }

/* Списки: двумя колонками, когда места много */
@media (min-width: 1280px) {
  html.desk #view > .card.flush { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1px; background: var(--sep); }
  html.desk #view > .card.flush > .row { background: var(--card); }
  html.desk #view > .card.flush > .row::before { display: none; }
}
html.desk .toolbar { max-width: 720px; }

/* Настройки — две колонки */
html.desk .settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; align-items: start; }

/* Тарифы — сеткой */
html.desk .plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: stretch; }
html.desk .plans-grid .plan-card { margin: 0; display: flex; flex-direction: column; }
html.desk .plans-grid .plan-card .btn { margin-top: auto; }
html.desk .gate-hero { padding-top: 40px; }

/* Нижний лист → панель справа */
html.desk .sheet {
  left: auto; right: 16px; top: 16px; bottom: 16px; width: 460px; max-width: calc(100vw - 32px); max-height: none;
  margin: 0; border-radius: 22px; padding: 18px 20px 24px;
  transform: translateX(calc(100% + 24px)); transition: transform .45s cubic-bezier(.32, .72, 0, 1);
}
html.desk .sheet.open { transform: none; }
html.desk .sheet-grip { display: none; }
html.desk .toast { bottom: 28px; left: calc(50% + var(--side-w) / 2); }

/* Наведение мышью */
html.desk .row.tap:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
html.desk .btn:hover { filter: brightness(1.08); }
html.desk .icon-btn:hover { filter: brightness(1.15); }
html.desk .acc-card, html.desk .plan-card { transition: transform .25s var(--spring), box-shadow .25s; }
html.desk .acc-card:hover, html.desk .plan-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
html.desk ::-webkit-scrollbar { width: 10px; }
html.desk ::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--hint) 35%, transparent); border-radius: 10px; border: 3px solid var(--bg); }

/* Карточка аккаунта ведёт к его настройкам */
.acc-card.tap { cursor: pointer; transition: transform .3s var(--spring), background .2s; }
.acc-card.tap:active { transform: scale(.985); transition-duration: .08s; }
.acc-head .chev { margin-left: -4px; }
.kv.tap { cursor: pointer; }
.kv .link { color: var(--link); font-weight: 500; }
.row.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0%, 35% { background: color-mix(in srgb, var(--accent) 22%, transparent); } }
html.desk .acc-card.tap:hover { background: color-mix(in srgb, var(--card) 92%, var(--text)); }

/* Звезда Telegram Premium */
.premium-star {
  width: 15px; height: 15px; margin-left: 5px; vertical-align: -2px; flex-shrink: 0;
  fill: url(#premium-grad); stroke: url(#premium-grad); stroke-width: 1.4; stroke-linejoin: round;
  filter: drop-shadow(0 0 4px color-mix(in srgb, #976fff 45%, transparent));
}
.sheet-head h2 .premium-star { width: 18px; height: 18px; vertical-align: -3px; }
#view.enter .row-title .premium-star { animation: star-in .5s var(--spring) both; }
@keyframes star-in { from { transform: scale(0) rotate(-40deg); } }

/* Индивидуальные настройки чата в списке */
.chat-rules { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chat-rules .badge { height: 20px; font-size: 11px; background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); }
