/* gdebenz Telegram Web App - styles
   Дизайн-токены из Stitch. Tailwind/Google Fonts не используем (CSP запрещает
   внешние хосты). Иконки - инлайн SVG-спрайт, шрифты - system-ui fallback. */

:root {
  --bg: #0F1115;
  --surface: #1A1D24;
  --elevated: #232733;
  --border: #2A2F3A;
  --text-main: #F5F7FA;
  --text-secondary: #8A93A5;
  --primary: #3B82F6;
  --primary-600: #2f6fdd;
  --status-green: #22C55E;   /* есть */
  --status-amber: #F59E0B;   /* мало */
  --status-yellow: #EAB308;  /* очередь */
  --status-red: #EF4444;     /* нет */
  --forecast: #A855F7;

  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --tap: 44px;

  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  --font-headline: "Manrope", var(--font-body);

  --header-h: 56px;
  --nav-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Light-тема (Telegram colorScheme=light). Основная - тёмная. */
body.theme-light {
  --bg: #F1F3F7;
  --surface: #FFFFFF;
  --elevated: #EDEFF4;
  --border: #D9DEE7;
  --text-main: #0F1115;
  --text-secondary: #6B7280;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.4;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-headline); margin: 0; font-weight: 700; }

button { font-family: inherit; color: inherit; cursor: pointer; }

/* ---- Иконки ---- */
.icon {
  width: 24px;
  height: 24px;
  display: inline-block;
  flex-shrink: 0;
  fill: currentColor;
  vertical-align: middle;
}
.icon-sm { width: 18px; height: 18px; }
.icon-lg { width: 30px; height: 30px; }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.hidden { display: none !important; }

/* ---- App shell ---- */
#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */
.app-header {
  position: relative;
  z-index: 40;
  height: calc(var(--header-h) + var(--safe-top));
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 16px;
  padding-right: 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand .icon { color: var(--primary); }
.brand-name { font-family: var(--font-headline); font-weight: 800; font-size: 20px; }
.header-btn {
  width: var(--tap); height: var(--tap);
  min-width: var(--tap);
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: 999px;
  color: var(--text-secondary);
}
.header-btn:active { background: var(--elevated); }
.header-btn.premium { color: var(--forecast); }

/* ---- Screen container ---- */
.screens { position: relative; flex: 1; min-height: 0; }
.screen { position: absolute; inset: 0; display: none; overflow: hidden; }
.screen.active { display: flex; flex-direction: column; }

/* ---- Bottom nav ---- */
.bottom-nav {
  position: relative;
  z-index: 40;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
  flex-shrink: 0;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  min-height: var(--tap);
}
.nav-item.active { color: var(--primary); }
.nav-item:active { opacity: 0.7; }

/* ================= MAP SCREEN ================= */
#screen-map { position: relative; }

.filters {
  position: relative;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 8px 0;
  flex-shrink: 0;
}
.filters-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  overflow-x: auto;
}
.filter-divider { height: 24px; width: 1px; background: var(--border); flex-shrink: 0; margin: 0 2px; }
.chip {
  flex-shrink: 0;
  min-height: 38px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip-icon {
  width: 40px; min-width: 40px; height: 40px;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius);
}

.map-wrap { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; background: #0B0D11; }

/* Leaflet контролы поверх тёмной темы */
.leaflet-container { background: #0B0D11; font: inherit; }
.leaflet-control-attribution {
  background: rgba(15,17,21,0.7) !important;
  color: var(--text-secondary) !important;
}
.leaflet-control-attribution a { color: var(--text-secondary) !important; }
.leaflet-bar a {
  background: var(--surface); color: var(--text-main);
  border-bottom-color: var(--border);
}
.leaflet-bar a:hover { background: var(--elevated); }

/* Кастомный пин-маркер */
.pin {
  width: 30px; height: 30px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid var(--bg);
  box-shadow: 0 3px 8px rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
}
.pin .icon { transform: rotate(45deg); color: #fff; width: 16px; height: 16px; }
.pin.s-yes { background: var(--status-green); }
.pin.s-low { background: var(--status-amber); }
.pin.s-queue { background: var(--status-yellow); }
.pin.s-no { background: var(--status-red); }
.pin.s-unknown { background: var(--text-secondary); }
.pin.selected { outline: 3px solid var(--primary); outline-offset: 1px; }

.user-dot {
  width: 16px; height: 16px;
  background: var(--primary);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 rgba(59,130,246,0.7);
  animation: userpulse 2s infinite;
}
@keyframes userpulse {
  0% { box-shadow: 0 0 0 0 rgba(59,130,246,0.6); }
  70% { box-shadow: 0 0 0 12px rgba(59,130,246,0); }
  100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); }
}

.fab {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 500;
  width: 48px; height: 48px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.fab:active { transform: scale(0.95); }
.fab.fab-list { bottom: 76px; }

/* ---- Bottom sheet: список ближайших ---- */
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 600;
  background: var(--surface);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  max-height: 70%;
  transform: translateY(calc(100% - 128px));
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  touch-action: none;
}
.sheet.expanded { transform: translateY(0); }
.sheet.hidden-sheet { transform: translateY(100%); }
.sheet-handle { display: flex; justify-content: center; padding: 12px 0 8px; cursor: grab; }
.sheet-handle span { width: 40px; height: 5px; background: var(--border); border-radius: 999px; }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px 12px;
}
.sheet-title { font-size: 18px; }
.sheet-title .count { color: var(--text-secondary); font-weight: 400; font-size: 15px; margin-left: 6px; }
.sheet-toggle { background: none; border: none; color: var(--primary); font-size: 14px; font-weight: 500; }
.sheet-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- Карточка станции в списке ---- */
.st-card {
  display: flex;
  align-items: stretch;
  overflow: hidden;
  background: var(--elevated);
  border: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  border-radius: var(--radius);
}
.st-card:active { opacity: 0.85; }
.st-stripe { width: 6px; flex-shrink: 0; }
.st-stripe.s-yes { background: var(--status-green); }
.st-stripe.s-low { background: var(--status-amber); }
.st-stripe.s-queue { background: var(--status-yellow); }
.st-stripe.s-no { background: var(--status-red); }
.st-stripe.s-unknown { background: var(--text-secondary); }
.st-body { flex: 1; padding: 14px; min-width: 0; }
.st-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.st-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.st-brand { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }
.st-price { text-align: right; flex-shrink: 0; }
.st-price .p { font-size: 17px; font-weight: 700; }
.st-price .d { font-size: 12px; color: var(--text-secondary); }
.st-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 8px; }
.fuel-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.fuel-tag {
  padding: 2px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
}

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.badge.s-yes { background: color-mix(in srgb, var(--status-green) 12%, transparent); color: var(--status-green); }
.badge.s-yes .dot { background: var(--status-green); }
.badge.s-low { background: color-mix(in srgb, var(--status-amber) 12%, transparent); color: var(--status-amber); }
.badge.s-low .dot { background: var(--status-amber); }
.badge.s-queue { background: color-mix(in srgb, var(--status-yellow) 12%, transparent); color: var(--status-yellow); }
.badge.s-queue .dot { background: var(--status-yellow); }
.badge.s-no { background: color-mix(in srgb, var(--status-red) 12%, transparent); color: var(--status-red); }
.badge.s-no .dot { background: var(--status-red); }
.badge.s-unknown { background: color-mix(in srgb, var(--text-secondary) 12%, transparent); color: var(--text-secondary); }
.badge.s-unknown .dot { background: var(--text-secondary); }

.forecast-tag {
  background: color-mix(in srgb, var(--forecast) 20%, transparent);
  color: var(--forecast);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
}

/* ================= STATION DETAIL (bottom sheet overlay) ================= */
.detail-overlay {
  position: absolute;
  inset: 0;
  z-index: 700;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: flex-end;
}
.detail-overlay.open { display: flex; }
.detail {
  width: 100%;
  max-height: 92%;
  background: var(--surface);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.detail-overlay.open .detail { transform: translateY(0); }
.detail-scroll { overflow-y: auto; padding: 4px 16px 16px; flex: 1; }

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-top: 20px;
  margin-bottom: 20px;
}
.detail-head .logo {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  background: var(--elevated);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
}
.detail-title h2 { font-size: 18px; font-weight: 800; line-height: 1.15; }
.detail-title p { color: var(--text-secondary); font-size: 14px; margin: 4px 0 0; }
.detail-close {
  width: 40px; height: 40px; min-width: 40px;
  border-radius: 999px;
  background: var(--elevated);
  border: none;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
}
.detail-close:active { transform: scale(0.95); }

.status-row { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px; font-weight: 600;
}
.status-pill.s-yes { background: color-mix(in srgb, var(--status-green) 15%, transparent); color: var(--status-green); border: 1px solid color-mix(in srgb, var(--status-green) 25%, transparent); }
.status-pill.s-low { background: color-mix(in srgb, var(--status-amber) 15%, transparent); color: var(--status-amber); border: 1px solid color-mix(in srgb, var(--status-amber) 25%, transparent); }
.status-pill.s-queue { background: color-mix(in srgb, var(--status-yellow) 15%, transparent); color: var(--status-yellow); border: 1px solid color-mix(in srgb, var(--status-yellow) 25%, transparent); }
.status-pill.s-no { background: color-mix(in srgb, var(--status-red) 15%, transparent); color: var(--status-red); border: 1px solid color-mix(in srgb, var(--status-red) 25%, transparent); }
.status-pill.s-unknown { background: color-mix(in srgb, var(--text-secondary) 15%, transparent); color: var(--text-secondary); }
.status-meta { color: var(--text-secondary); font-size: 12px; }

.info-line { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; font-size: 14px; font-weight: 500; }
.info-line .item { display: flex; align-items: center; gap: 6px; }
.info-line .item .icon { color: var(--primary); }
.info-line .item.muted { color: var(--text-secondary); }
.info-line .item.muted .icon { color: var(--text-secondary); }

.fuels-row { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 24px; padding: 0 16px; }
.fuel-chip {
  flex-shrink: 0;
  min-width: 76px;
  background: var(--elevated);
  padding: 12px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.fuel-chip .grade { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; }
.fuel-chip .grade .dot { width: 8px; height: 8px; border-radius: 50%; }
.fuel-chip .price { color: var(--text-secondary); font-size: 12px; }

/* ---- Forecast block ---- */
.forecast {
  background: color-mix(in srgb, var(--forecast) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--forecast) 30%, transparent);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}
.forecast-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.forecast-head .title { display: flex; align-items: center; gap: 8px; color: var(--forecast); }
.forecast-head .title h3 { font-size: 18px; font-weight: 800; color: var(--forecast); }
.forecast-main { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.ring { position: relative; width: 96px; height: 96px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--border); }
.ring .prog { stroke: var(--forecast); transition: stroke-dashoffset 0.5s; }
.ring .label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800;
}
.forecast-desc .t { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.forecast-desc .s { color: var(--text-secondary); font-size: 12px; }

.confidence { margin-bottom: 20px; }
.confidence-labels {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--text-secondary);
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.confidence-bar { position: relative; height: 6px; background: var(--border); border-radius: 999px; overflow: visible; }
.confidence-fill {
  position: absolute; inset: 0 auto 0 0;
  background: linear-gradient(to right, color-mix(in srgb, var(--forecast) 40%, transparent), var(--forecast));
  border-radius: 999px;
}
.confidence-knob {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 12px; height: 12px;
  background: #fff;
  border: 2px solid var(--forecast);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.eta {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--forecast) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--forecast) 20%, transparent);
  border-radius: var(--radius);
  font-size: 14px; font-weight: 600;
}
.eta .icon { color: var(--forecast); }
.forecast-note { margin: 16px 0 0; text-align: center; font-size: 10px; color: var(--text-secondary); font-style: italic; opacity: 0.6; }

/* Locked forecast (не premium) */
.forecast-locked { text-align: center; }
.forecast-locked p { color: var(--text-secondary); font-size: 13px; margin: 8px 0 16px; }
.btn-unlock {
  width: 100%; height: 48px;
  border-radius: var(--radius);
  border: none;
  background: linear-gradient(135deg, var(--forecast), var(--primary));
  color: #fff; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* ---- Detail buttons (sticky footer) ---- */
.detail-actions {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 12px 16px calc(12px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}
.route-links { display: flex; gap: 10px; }
.btn {
  height: 52px;
  border-radius: var(--radius);
  border: none;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 16px;
  flex: 1;
  text-decoration: none;
  color: var(--text-main);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: transparent; border: 2px solid var(--border); }
.btn-outline .icon { color: var(--text-secondary); }
.btn-block { width: 100%; }

/* ================= REMINDERS SCREEN ================= */
.screen-scroll { flex: 1; overflow-y: auto; padding: 16px; }
.screen-subtitle { color: var(--text-secondary); font-size: 14px; margin: 0 0 16px; }

.rem-list { display: flex; flex-direction: column; gap: 12px; }
.rem-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  position: relative;
}
.rem-card.zone { border-left: 4px solid color-mix(in srgb, var(--forecast) 40%, transparent); }
.rem-ic {
  width: 40px; height: 40px;
  border-radius: 999px;
  background: var(--elevated);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.rem-body { flex: 1; min-width: 0; }
.rem-title { font-family: var(--font-headline); font-weight: 600; font-size: 15px; line-height: 1.2; padding-right: 32px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rem-tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.rem-tag { padding: 2px 8px; background: var(--border); color: var(--text-secondary); font-size: 11px; font-weight: 700; border-radius: 6px; }
.rem-sub { color: var(--text-secondary); font-size: 13px; margin: 0; }
.rem-del {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  background: none; border: none;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
}
.rem-del:active { color: var(--status-red); }
.priority-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 6px;
  background: color-mix(in srgb, var(--forecast) 20%, transparent);
  color: var(--forecast);
  font-size: 10px; font-weight: 700;
  border-radius: 4px; text-transform: uppercase;
}

.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 48px 24px;
  gap: 20px;
}
.empty .ic-wrap { position: relative; color: var(--text-secondary); opacity: 0.4; }
.empty h2 { font-size: 20px; }
.empty p { color: var(--text-secondary); font-size: 14px; max-width: 280px; margin: 8px auto 0; }

.add-btn {
  width: 100%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-headline);
  font-weight: 700;
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 20%, transparent);
  margin-top: 16px;
}
.add-btn:active { transform: scale(0.98); }

/* ================= PREMIUM SCREEN ================= */
#screen-premium .screen-scroll { padding: 20px 16px 24px; }
.premium-hero {
  text-align: center;
  position: relative;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 28px;
  background: linear-gradient(to bottom, var(--surface), transparent);
}
.premium-hero .halo {
  width: 56px; height: 56px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--forecast) 10%, transparent);
  color: var(--forecast);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.premium-hero h2 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
.premium-hero p { color: var(--text-secondary); font-size: 14px; margin: 0; }
.premium-active {
  margin-top: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: color-mix(in srgb, var(--status-green) 15%, transparent);
  color: var(--status-green);
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
}

.features { display: flex; flex-direction: column; gap: 16px; margin-bottom: 32px; }
.feature { display: flex; align-items: flex-start; gap: 12px; }
.feature .icon { color: var(--forecast); margin-top: 2px; }
.feature .t { font-weight: 500; }
.feature .s { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.plan {
  text-align: left;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}
.plan:active { background: var(--elevated); }
.plan.selected { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }
.plan .tagline { color: var(--text-secondary); font-size: 12px; }
.plan .title { font-weight: 700; line-height: 1.2; }
.plan .price { display: flex; align-items: center; gap: 4px; color: var(--primary); font-weight: 700; margin-top: 4px; }
.plan .price .icon { color: var(--primary); }
.plan.popular {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border: 2px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, var(--forecast), var(--primary)) border-box;
  box-shadow: 0 0 20px color-mix(in srgb, var(--primary) 15%, transparent);
}
.plan.popular.selected { box-shadow: 0 0 24px color-mix(in srgb, var(--primary) 30%, transparent); }
.plan .hit {
  position: absolute; top: 0; right: 0;
  padding: 3px 12px;
  background: linear-gradient(to left, var(--primary), var(--forecast));
  color: #fff; font-size: 10px; font-weight: 700;
  border-bottom-left-radius: var(--radius);
}
.plan.popular .title { font-family: var(--font-headline); font-size: 18px; }
.plan.popular .price .big { font-size: 20px; font-weight: 900; }

.premium-footer {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(10px);
  padding: 16px 16px calc(16px + var(--safe-bottom));
  flex-shrink: 0;
}
.premium-footer .note { text-align: center; font-size: 10px; color: var(--text-secondary); margin: 12px 0 0; }
.btn-pay {
  width: 100%; height: 52px;
  border: none; border-radius: var(--radius);
  background: var(--primary); color: #fff;
  font-weight: 700; font-size: 16px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 20%, transparent);
}
.btn-pay:active { transform: scale(0.98); }

/* ================= TOAST ================= */
.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  transform: translateX(-50%);
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: max-content;
  max-width: 90%;
  pointer-events: none;
}
.toast {
  background: var(--elevated);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { border-color: var(--status-red); }

/* ---- Loading / states ---- */
.loading, .list-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Блокирующий экран ошибки (401 и т.п.) */
.fatal {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  display: none;
  flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 32px;
  gap: 12px;
}
.fatal.show { display: flex; }
.fatal .icon { color: var(--status-red); width: 48px; height: 48px; }
.fatal h2 { font-size: 20px; }
.fatal p { color: var(--text-secondary); font-size: 14px; max-width: 320px; }
