/* Konor Webapp Design System v2.
 * New namespace (no "wa-" prefix). Pages migrated to v2 use these classes;
 * legacy pages keep using the old webapp.css. Once all templates are
 * migrated, webapp.legacy.css.bak can be deleted and the older selectors
 * removed from webapp.css.
 *
 * Palette and type follow «Конор 2.0» (night sky, Unbounded + Manrope).
 */

:root {
  /* canvas — the night sky of «Мир Конора» */
  --bg:        #0B0F24;
  --surface:   #151B3A;
  --surface-2: #1B2350;
  --surface-3: #262E5C;
  --border:    #232B52;
  --border-strong: #2A3360;
  --divider:   #1D2447;

  /* text */
  --text-1: #EEF0FF;
  --text-2: #A9B0D6;
  --text-3: #8A92BE;

  /* warm yellow brand */
  --accent:        #F9C64A;
  --warn:          #FFC46B;  /* «needs a look»: amber dots and counts */
  --accent-soft:   #FFE08A;
  --accent-deep:   #F5B32E;
  --accent-glow:   rgba(249, 198, 74, 0.25);
  --accent-on:     #1A1300;

  /* status */
  --success:      #4ADE80;
  --success-text: #7EE2A0;
  --success-bg:   rgba(74, 222, 128, 0.10);
  --danger:       #F87171;
  --info:         #60A5FA;

  --font-body:    'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Unbounded', 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-card: 22px;
  --radius-btn:  24px;
  --radius-sm:   12px;

  --tabbar-h: 70px;
}

/* ── apply v2 only inside .v2-page wrapper to avoid clashing with legacy ── */

.v2-page,
.v2-page * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

.v2-page {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-1);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  min-height: 100vh;
}
.v2-page a { color: var(--accent); text-decoration: none; }
.v2-page button { font-family: inherit; }
.v2-page [hidden] { display: none !important; }  /* a class's display must not undo hidden */

/* ── topbar ── */
.v2-topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  padding: 14px max(20px, calc((100% - 520px) / 2));
  background: rgba(11, 15, 36, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--divider);
  min-height: 56px;
}
.v2-topbar h1 {
  margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 700;
  letter-spacing: -0.01em;
}
.v2-topbar h1 .em { margin-right: 6px; }
.v2-topbar .spacer { flex: 1; }
.v2-topbar .right { color: var(--text-3); font-size: 13px; }

.v2-back, .v2-icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer; user-select: none;
  flex-shrink: 0;
  transition: background .15s ease;
  color: var(--text-1);
}
.v2-back:active, .v2-icon-btn:active { background: var(--surface-3); }
.v2-back svg, .v2-icon-btn svg {
  width: 18px; height: 18px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* One centred column on wide screens; phones are unaffected. */
.v2-page main { padding: 8px 20px 24px; max-width: 560px; margin: 0 auto; }

/* ── section label ── */
.v2-section-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--text-3); text-transform: uppercase;
  margin: 24px 4px 12px;
}

/* ── card ── */
.v2-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  margin-bottom: 12px;
  position: relative;
}
.v2-card.lifted {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border-color: var(--border-strong);
}
.v2-card.glow {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border-color: var(--border-strong);
  overflow: hidden;
}
.v2-card.glow::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at top right, var(--accent-glow), transparent 40%);
  pointer-events: none;
}
.v2-card-title { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
.v2-card-desc { font-size: 13px; color: var(--text-2); margin: 0 0 12px; line-height: 1.55; }

/* ── status banner ── */
.v2-status-banner {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 14px;
}
.v2-status-banner .pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  box-shadow: 0 0 0 0 var(--success);
  animation: v2-pulse 2s infinite;
}
@keyframes v2-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}
.v2-status-banner .text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.v2-status-banner .l1 { font-size: 13px; color: var(--text-2); }
.v2-status-banner .l2 {
  font-size: 16px; font-weight: 600; color: var(--text-1);
  font-variant-numeric: tabular-nums;
}

/* ── progress ── */
.v2-progress {
  height: 4px; border-radius: 999px; background: var(--surface-3);
  overflow: hidden; margin-top: 10px;
}
.v2-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-deep) 100%);
  border-radius: 999px;
}

/* ── inputs ── */
.v2-input {
  width: 100%;
  padding: 13px 14px;
  font-size: 14px; line-height: 1.3;
  color: var(--text-1);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s ease;
  font-family: inherit;
  -webkit-appearance: none;
}
.v2-input::placeholder { color: var(--text-3); }
.v2-input:focus { border-color: var(--accent); }

.v2-field-label {
  font-size: 12px; color: var(--text-3); margin-bottom: 6px; display: block;
  letter-spacing: 0.02em;
}

.v2-inline-error {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(248, 113, 113, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(248, 113, 113, 0.10);
  color: var(--danger);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.v2-inline-error[hidden] { display: none; }

/* ── buttons ──
 * Двойные селекторы (`a.v2-btn`, `a.v2-btn-primary`, …) — необходимы потому
 * что `.v2-page a { color: var(--accent); }` имеет specificity (0,1,1) и
 * перебил бы цвет одиночного `.v2-btn-*` (0,1,0). Без этого фикса жёлтая
 * кнопка получала жёлтый текст и тонула в собственном фоне.
 */
.v2-btn,
.v2-page a.v2-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 18px;
  font-size: 14px; font-weight: 500;
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform .1s ease, opacity .15s ease, background .15s ease, box-shadow .15s ease;
  font-family: inherit; letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text-1);
}
.v2-btn:active:not(:disabled) { transform: scale(0.985); }

.v2-btn-primary,
.v2-page a.v2-btn-primary {
  background: var(--accent);
  color: var(--accent-on);
  font-weight: 700;
  box-shadow: 0 6px 20px -8px var(--accent-glow);
}
.v2-btn-primary:disabled {
  background: var(--surface-3); color: var(--text-3);
  cursor: not-allowed; box-shadow: none; opacity: 0.7;
}

.v2-btn-secondary,
.v2-page a.v2-btn-secondary {
  background: var(--surface-2);
  color: var(--text-1);
  border: 1px solid var(--border-strong);
}
.v2-btn-secondary:active:not(:disabled) { background: var(--surface-3); }

.v2-btn-ghost,
.v2-page a.v2-btn-ghost { background: transparent; color: var(--text-2); }

.v2-btn-block { display: flex; width: 100%; padding: 16px; font-size: 16px; font-weight: 600; }

.v2-btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ── consent ── */
.v2-consent {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 12px; line-height: 1.4; color: var(--text-2);
  user-select: none; padding: 4px 0;
}
.v2-consent input[type=checkbox] {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  flex-shrink: 0; margin-top: 1px;
  cursor: pointer; background: var(--surface-2);
  position: relative;
  transition: background .15s ease, border-color .15s ease;
}
.v2-consent input[type=checkbox]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.v2-consent input[type=checkbox]:checked::after {
  content: '';
  position: absolute;
  left: 5px; top: 1px;
  width: 5px; height: 10px;
  border: solid var(--accent-on);
  border-width: 0 1.8px 1.8px 0;
  transform: rotate(45deg);
}

/* ── plan / product card ── */
.v2-plan {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.v2-plan.primary {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border-color: var(--border-strong);
}
.v2-plan.primary::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at top right, var(--accent-glow), transparent 40%);
  pointer-events: none;
}
.v2-plan-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; position: relative;
}
.v2-plan-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.v2-plan-title .name { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.v2-plan-title .desc { font-size: 13px; color: var(--text-2); }
.v2-plan-price { display: flex; align-items: baseline; gap: 4px; flex-shrink: 0; }
.v2-plan-price .num {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.v2-plan-price .unit { font-size: 13px; color: var(--text-2); }

.v2-features {
  display: grid; gap: 10px;
  margin: 16px 0; padding: 16px 0 0;
  border-top: 1px solid var(--border);
}
.v2-feat {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--text-2);
}
.v2-feat svg {
  width: 16px; height: 16px; flex-shrink: 0;
  stroke: var(--success); fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* promo expandable */
.v2-promo-toggle {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 0;
  font-size: 13px; color: var(--text-3);
  cursor: pointer; user-select: none;
}
.v2-promo-toggle:hover { color: var(--text-2); }
.v2-promo-toggle svg {
  width: 14px; height: 14px; transition: transform .2s ease;
  stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round;
}
.v2-promo-toggle.open svg { transform: rotate(45deg); }
.v2-promo-body { display: none; margin-top: 10px; }
.v2-promo-body.open { display: block; }
.v2-promo-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

/* total + plan-cta */
.v2-total-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 14px 0;
}
.v2-total-row .l { font-size: 14px; color: var(--text-2); }
.v2-total-row .r {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* stepper */
.v2-stepper-row .label { font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.v2-stepper {
  display: grid; grid-template-columns: 44px 1fr 44px auto;
  gap: 6px; align-items: center; margin-top: 14px;
}
.v2-stepper .btn-step {
  width: 44px; height: 44px; padding: 0;
  font-size: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  cursor: pointer; user-select: none;
  font-family: inherit;
}
.v2-stepper .v2-input { text-align: center; padding: 13px 8px; }
.v2-stepper .unit-label {
  font-size: 13px; color: var(--text-2); padding-left: 4px;
}

/* ── grid ── */
.v2-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── chip / pill ── */
.v2-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; font-size: 11px; font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 99px;
  letter-spacing: 0.04em;
}
.v2-pill.success {
  background: var(--success-bg); color: var(--success-text);
  border-color: rgba(74, 222, 128, 0.2);
}
.v2-pill.warn {
  background: rgba(249, 198, 74, 0.10); color: var(--accent);
  border-color: rgba(249, 198, 74, 0.2);
}

/* ── multi-month picker (на /webapp/buy у каждого тарифа) ── */
.v2-months-row {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin: 6px 0 14px;
}
.v2-month-pill {
  /* appearance: none убирает браузерный default-стиль <button> (на Android
     WebView без него остаётся серый системный фон, перебивающий наш темплейт). */
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  outline: none;
  flex: 1 1 auto;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 10px; font-size: 13px; font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  border-radius: 12px;
  cursor: pointer;
  min-width: 64px;
  transition: background 0.15s, border-color 0.15s;
}
.v2-month-pill:hover { border-color: var(--border-strong); }
.v2-month-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}
.v2-month-pill .b {
  font-size: 10px; font-weight: 700;
  padding: 2px 5px; border-radius: 6px;
  background: rgba(0,0,0,0.18); color: inherit;
  letter-spacing: 0.02em;
}
.v2-month-pill:not(.active) .b {
  background: rgba(249, 198, 74, 0.18);
  color: var(--accent);
}

/* ── tabbar ── */
.v2-tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: rgba(11, 15, 36, 0.94);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--divider);
  /* the four tabs sit over the 560 px content column on wide screens */
  padding: 8px max(0px, calc((100% - 560px) / 2)) calc(8px + env(safe-area-inset-bottom));
  z-index: 30;
}
.v2-tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 0; text-decoration: none;
  color: var(--text-3);
  font-size: 11px; font-weight: 500; letter-spacing: 0.01em;
  transition: color .15s ease;
}
.v2-tabbar a.active { color: var(--accent); }
.v2-tabbar a svg {
  width: 22px; height: 22px;
  stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* ── faq ── */
.v2-faq {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 4px 16px;
}
.v2-faq details { border-bottom: 1px solid var(--border); padding: 14px 0; }
.v2-faq details:last-child { border-bottom: none; }
.v2-faq summary {
  list-style: none;
  cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-size: 14px; font-weight: 500;
}
.v2-faq summary::-webkit-details-marker { display: none; }
.v2-faq summary::after {
  content: '';
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--text-3);
  border-bottom: 1.5px solid var(--text-3);
  transform: rotate(45deg);
  transition: transform .2s ease;
  flex-shrink: 0;
}
.v2-faq details[open] summary::after { transform: rotate(225deg); }
.v2-faq details > p,
.v2-faq details > div {
  margin: 8px 0 0; font-size: 13px; line-height: 1.55; color: var(--text-2);
}

/* ── empty state ── */
.v2-empty { text-align: center; padding: 40px 24px; color: var(--text-3); }
.v2-empty .icon {
  width: 48px; height: 48px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.v2-empty .icon svg {
  width: 22px; height: 22px;
  stroke: var(--text-2); fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.v2-empty h3 {
  font-size: 15px; font-weight: 600;
  color: var(--text-1); margin: 0 0 6px;
}
.v2-empty p { margin: 0; font-size: 13px; }

/* ── news feed ── */
.v2-news-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  margin-bottom: 10px;
}
.v2-news-item .date {
  font-size: 11px; color: var(--text-3);
  letter-spacing: 0.04em; text-transform: uppercase;
  margin-bottom: 8px;
}
.v2-news-item p { margin: 0; font-size: 14px; color: var(--text-1); line-height: 1.55; }
.v2-news-item .more {
  display: inline-block; margin-top: 8px;
  font-size: 12px; color: var(--accent);
}

/* ── shared row item ── */
.v2-row-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .15s ease;
  text-decoration: none;
  color: var(--text-1);
}
.v2-row-item:hover { border-color: var(--border-strong); }
.v2-row-item .icon-circle {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.v2-row-item .icon-circle svg {
  width: 18px; height: 18px;
  stroke: var(--text-1); fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.v2-row-item .body { flex: 1; min-width: 0; }
.v2-row-item .body .t {
  font-size: 14px; font-weight: 500;
  color: var(--text-1); margin-bottom: 2px;
}
.v2-row-item .body .s { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.v2-row-item .arrow { color: var(--text-3); flex-shrink: 0; }
.v2-row-item .arrow svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round;
}

/* hide legacy bottom-nav (.wa-nav) when a v2-page is rendered, since v2 has its own tabbar */
.v2-page ~ .wa-nav,
body:has(.v2-page) > .wa-app > .wa-nav { display: none !important; }

/* Legacy pages (still extending base.html) get the new v2 tabbar via base.html.
 * Reserve room at the bottom of .wa-app so content doesn't slide under it.
 */
.wa-app {
  padding-bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
}

/* ── «Конор 2.0» components (WebHome / WebSupport / WebGift / WebLanding) ── */

/* toasts: showToast() builds .wa-toast; above the tab bar on every page */
.wa-toast {
  position: fixed; left: 50%; z-index: 80;
  top: auto; /* legacy webapp.css pins it to the top */
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  max-width: min(92vw, 480px); padding: 12px 18px; border-radius: 16px;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-1);
  font: 600 14px/1.4 var(--font-body); text-align: center;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .6);
  opacity: 0; transform: translateX(-50%) translateY(12px); pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.wa-toast.show { opacity: 1; transform: translateX(-50%); }
.wa-toast.success { border-color: rgba(74, 222, 128, .4); }
.wa-toast.error { border-color: rgba(248, 113, 113, .45); }

/* page header of the tab pages: mascot, title, one line under it */
.v2-page-head { display: flex; align-items: center; gap: 12px; padding: 16px 0 6px; }
.v2-page-head img { width: 58px; height: 63px; flex-shrink: 0; object-fit: contain; }
.v2-page-head h1 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 24px; line-height: 1.2; }
.v2-page-head p { margin: 3px 0 0; font-size: 13px; line-height: 1.4; color: var(--text-2); }

.v2-h2 { margin: 24px 4px 10px; font-family: var(--font-display); font-weight: 700; font-size: 20px; line-height: 1.25; }

/* tiles: prices, stats; .is-selected is the accent frame of the chosen one */
.v2-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.v2-tile {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 14px;
  text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  color: var(--text-1); font: inherit;
}
button.v2-tile { cursor: pointer; -webkit-appearance: none; appearance: none; }
.v2-tile.is-selected { border: 2px solid var(--accent); padding: 13px; }
.v2-tile .t-label { font-size: 13px; color: var(--text-2); }
.v2-tile .t-price { font-family: var(--font-display); font-weight: 700; font-size: 22px; line-height: 1.2; }
.v2-tile .t-note { min-height: 1.4em; font-size: 12px; font-weight: 700; color: var(--success-text); }

/* chips: topics, platforms */
.v2-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.v2-chip {
  height: 38px; padding: 0 14px; border-radius: 19px; cursor: pointer;
  font: 700 13px var(--font-body); color: var(--text-1);
  background: var(--surface); border: 1px solid var(--border);
  -webkit-appearance: none; appearance: none;
}
.v2-chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-on); }

/* numbered steps */
.v2-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.v2-steps li { counter-increment: step; display: flex; gap: 10px; font-size: 14px; line-height: 1.45; color: var(--text-1); }
.v2-steps li::before {
  content: counter(step); flex-shrink: 0; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--accent); font-size: 12px; font-weight: 700;
}

.v2-btn-outline,
.v2-page a.v2-btn-outline { background: transparent; color: var(--text-1); border: 1px solid var(--border-strong); }

/* feature list with Konor's paw */
.v2-paws { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.v2-paws li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.v2-paws li::before { content: ""; width: 18px; height: 18px; flex-shrink: 0; background: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23F9C64A"%3E%3Cellipse cx="12" cy="16" rx="5.5" ry="4.5"/%3E%3Ccircle cx="5.5" cy="10" r="2.4"/%3E%3Ccircle cx="9.5" cy="6" r="2.4"/%3E%3Ccircle cx="14.5" cy="6" r="2.4"/%3E%3Ccircle cx="18.5" cy="10" r="2.4"/%3E%3C/svg%3E') center / contain no-repeat; }

/* status line used by «Купить» (the cabinet has its own copy in cabinet.css) */
.v2-row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.v2-muted { font-size: 13px; color: var(--text-2); }
.v2-left { font-size: 13px; font-weight: 700; }
.v2-tone-ok { color: var(--success-text); }
.v2-tone-soon { color: var(--accent); }
.v2-tone-last { color: var(--danger); }
.v2-until { margin-top: 4px; font-family: var(--font-display); font-weight: 700; font-size: 20px; }

/* «Купить»: the period tiles keep the .v2-month-pill hooks of the checkout script */
.v2-plan-paws { margin-top: 14px; }
.v2-months-row.v2-tiles { display: grid; margin: 6px 0 16px; }
.v2-month-pill.v2-tile {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 2px;
  min-width: 0; padding: 14px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-1);
  font-size: inherit; font-weight: inherit; text-align: left;
}
.v2-month-pill.v2-tile.active { background: var(--surface); color: var(--text-1); }
.v2-month-pill.v2-tile.is-selected { border: 2px solid var(--accent); padding: 13px; }

/* «Подключить»: two numbered steps */
.v2-connect-step { scroll-margin-top: 12px; }
.v2-connect-step .v2-h2 { display: flex; align-items: center; gap: 10px; }
.v2-step-no {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-on); font-size: 15px;
}
.v2-connect-step .v2-chips { margin-bottom: 12px; }
.v2-app-card[hidden] { display: none; }
.v2-app-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.v2-app-head img { width: 44px; height: 48px; flex-shrink: 0; }
.v2-app-icon {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 44px; height: 44px; border-radius: 14px; background: var(--surface-2); color: var(--accent);
}
.v2-app-icon svg { width: 24px; height: 24px; }
.v2-app-card code {
  padding: 1px 6px; border-radius: 6px; background: var(--surface-2); color: var(--text-1);
  font-size: 12px; word-break: break-word;
}
.v2-tv-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--border);
}
.v2-tv-row div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.v2-tv-row b { font-size: 14px; }
.v2-tv-row span { font-size: 12px; color: var(--text-2); }
.v2-tv-row .v2-btn, .v2-page .v2-tv-row a.v2-btn { flex-shrink: 0; height: 40px; padding: 0 16px; font-size: 14px; }
[data-only][hidden] { display: none !important; }

/* /apps — the public «Где работает»: no tab bar, a brand and «Войти» on top */
.v2-public-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(18px + env(safe-area-inset-top)) 20px 6px; max-width: 560px; margin: 0 auto;
}
.v2-page a.v2-public-brand { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--accent); }
.v2-page a.v2-public-login {
  padding: 8px 16px; border: 1px solid var(--border-strong); border-radius: 999px;
  color: var(--text-1); font-size: 14px; font-weight: 700;
}
.v2-public-foot { margin: 22px 0 calc(28px + env(safe-area-inset-bottom)); text-align: center; font-size: 13px; color: var(--text-2); }

/* the download pages of our apps */
.v2-apphero { display: flex; flex-direction: column; align-items: center; text-align: center; margin: 6px 0 18px; }
.v2-apphero img { width: 120px; height: auto; }
.v2-apphero h1 { margin: 10px 0 4px; font-family: var(--font-display); font-weight: 700; font-size: 24px; line-height: 1.2; }
.v2-apphero p { margin: 0; font-size: 14px; color: var(--text-2); }
.v2-btn.v2-btn-big, .v2-page a.v2-btn.v2-btn-big { height: 58px; font-size: 17px; }
.v2-apphint { margin: 10px 0 18px; text-align: center; font-size: 13px; color: var(--text-2); }
.v2-plain-list { margin: 4px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.55; color: var(--text-2); }
.v2-plain-list li + li { margin-top: 6px; }
.v2-plain-list b { color: var(--text-1); }
.v2-pre { white-space: pre-line; }
.v2-other-device { display: flex; gap: 12px; align-items: flex-start; border-color: var(--accent); margin-bottom: 14px; }
.v2-other-device b { display: block; font-size: 15px; }
.v2-other-device p { margin: 4px 0 12px; font-size: 13px; line-height: 1.45; color: var(--text-2); }
.v2-other-device .v2-btn, .v2-page .v2-other-device a.v2-btn { height: 44px; padding: 0 18px; font-size: 14px; }
.v2-device-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.v2-page a.v2-device-link {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  color: var(--text-1); font-size: 13px; font-weight: 700; text-align: center;
}
.v2-device-link svg { width: 22px; height: 22px; color: var(--accent); }

/* «Привязать роутер» */
.v2-input.v2-code-input { height: 58px; font-size: 22px; text-align: center; letter-spacing: 4px; text-transform: uppercase; }
.v2-router-status { margin-top: 10px; min-height: 20px; text-align: center; font-size: 14px; color: var(--text-2); }
.v2-router-status.is-ok { color: var(--success-text); }
.v2-router-status.is-error { color: var(--danger); }
.v2-app-head p { margin: 2px 0 0; font-size: 13px; line-height: 1.45; color: var(--text-2); }
.v2-app-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.v2-app-card .v2-steps { margin: 4px 0 14px; }
.v2-note { margin: 10px 0 12px; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.v2-app-card .v2-note:last-child { margin-bottom: 0; }
.v2-key-warning { display: flex; gap: 12px; align-items: flex-start; font-size: 13px; line-height: 1.55; color: var(--text-2); background: rgba(249, 198, 74, .05); border-color: rgba(249, 198, 74, .18); }
.v2-key-warning svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; stroke: var(--accent); fill: none; stroke-width: 2; stroke-linecap: round; }
.v2-key-warning b { color: var(--text-1); }
.v2-keybox {
  margin-bottom: 14px; padding: 14px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5;
  color: var(--text-2); word-break: break-all;
}
.v2-qr { margin-top: 12px; }
.v2-qr summary { cursor: pointer; font-size: 13px; color: var(--text-2); }
.v2-qr-box { max-width: 260px; margin-top: 10px; padding: 12px; border-radius: var(--radius-sm); background: #FFFFFF; }
.v2-qr p { margin: 8px 0 0; font-size: 12px; color: var(--text-3); }
.v2-faq details > div p { margin: 0 0 8px; }
.v2-faq details > div p:last-child { margin-bottom: 0; }

/* nested pages: invite, news */
.v2-ref-hero { display: flex; align-items: center; gap: 14px; overflow: hidden; }
.v2-ref-hero img { width: 120px; height: auto; flex-shrink: 0; margin: -6px -6px -10px -8px; }
.v2-ref-big { font-family: var(--font-display); font-weight: 700; font-size: 20px; line-height: 1.2; }
.v2-ref-hero p { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.v2-accent-text { color: var(--accent); }
.v2-ref-code summary { cursor: pointer; font-size: 13px; color: var(--text-2); }
.v2-ref-code #ref-code {
  margin: 12px 0 10px; padding: 14px; border-radius: var(--radius-sm); text-align: center;
  background: var(--bg); border: 1px solid var(--border-strong);
  font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: 3px; color: var(--accent);
}
.v2-steps li a { color: var(--accent); }
.v2-channel, .v2-page a.v2-channel { display: flex; align-items: center; gap: 12px; color: var(--text-1); }
.v2-channel-icon { width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); }
.v2-channel-icon svg { width: 20px; height: 20px; stroke: var(--accent); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.v2-channel-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.v2-channel-body b { font-size: 15px; }
.v2-channel-body span { font-size: 12px; color: var(--text-2); }
.v2-channel-arrow { width: 16px; height: 16px; stroke: var(--text-3); fill: none; stroke-width: 2; }
.v2-page a.v2-news-item { display: block; color: var(--text-1); }

/* ---------- «Помощь»: check first, then topics, then the chat (mockup WebSupport) ---------- */
.hp-check { padding: 16px; }
.hp-check-title { margin: 0; font-family: var(--font-body); font-size: 13px; font-weight: 700; color: var(--text-2); }
.hp-row { display: flex; align-items: center; gap: 10px; padding-top: 10px; }
.hp-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--text-3); }
.hp-tone-ok .hp-dot { background: var(--success); }
.hp-tone-warn .hp-dot { background: var(--warn); }
.hp-tone-bad .hp-dot { background: var(--danger); }
.hp-row-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.hp-row-text b { font-size: 14px; }
.hp-row-text span { font-size: 12px; line-height: 1.4; color: var(--text-2); }
.hp-row-action { flex-shrink: 0; font-size: 13px; font-weight: 700; color: var(--accent); text-decoration: none; }
.hp-topics { margin: 14px 0 12px; }
.hp-answer { padding: 16px; }
.hp-answer-title { margin: 0; font-family: var(--font-body); font-size: 15px; font-weight: 700; }
.hp-steps { list-style: none; margin: 0; padding: 0; }
.hp-steps li { display: flex; gap: 10px; padding-top: 10px; font-size: 14px; line-height: 1.4; }
.hp-steps li span {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface-2); color: var(--accent); font-size: 12px; font-weight: 700;
}
.hp-answer-actions { display: flex; gap: 8px; margin-top: 12px; }
.hp-answer-actions .v2-btn { flex: 1; min-height: 42px; padding: 8px 12px; border-radius: 21px; }
.hp-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; font-size: 12px; color: var(--text-3); }
.hp-divider::before, .hp-divider::after { content: ""; flex: 1; height: 1px; background: var(--divider); }
.hp-divider span { text-align: center; }
.hp-messages { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; padding: 2px 0 12px; }
.hp-chat-note { margin: 6px auto; font-size: 13px; color: var(--text-3); text-align: center; }
.hp-msg { display: flex; align-items: flex-end; gap: 8px; }
.hp-msg-user { justify-content: flex-end; }
.hp-msg-system { justify-content: center; }
.hp-msg-sys { font-size: 12px; color: var(--text-3); }
.hp-avatar { width: 30px; height: 33px; flex-shrink: 0; object-fit: contain; }
.hp-bubble { max-width: 80%; padding: 10px 14px; font-size: 14px; line-height: 1.4; }
.hp-msg-user .hp-bubble { background: var(--accent); color: var(--accent-on); border-radius: 18px 18px 4px 18px; }
.hp-msg-support .hp-bubble { background: var(--surface); border: 1px solid var(--border); border-radius: 18px 18px 18px 4px; }
.hp-sender { margin-bottom: 2px; font-size: 12px; font-weight: 700; color: var(--accent); }
.hp-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.hp-time { margin-top: 4px; font-size: 11px; text-align: right; opacity: .7; }
.hp-msg-support .hp-time { color: var(--text-3); opacity: 1; }
.hp-attachment { display: block; max-width: 100%; max-height: 260px; border-radius: 12px; cursor: zoom-in; }
/* The message box stays in reach above the tab bar, as in any chat: on a phone the tips above
   used to push it below the first screen, under «Напишите, что случилось». */
.hp-composer-wrap {
  position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 5;
  margin-top: 4px; padding: 8px 0; scroll-margin-bottom: calc(var(--tabbar-h) + 16px);
  background: linear-gradient(to bottom, rgba(11, 15, 36, 0), var(--bg) 14px);
}
.hp-composer {
  display: flex; align-items: flex-end; gap: 6px; padding: 6px 6px 6px 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
}
.hp-input {
  flex: 1; min-height: 40px; max-height: 120px; padding: 10px 4px; resize: none;
  background: transparent; border: none; outline: none; color: var(--text-1); font: 15px/1.4 var(--font-body);
}
.hp-input::placeholder { color: var(--text-3); }
.hp-attach, .hp-send {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 40px; height: 40px; border: none; border-radius: 50%; cursor: pointer;
}
.hp-attach { background: transparent; color: var(--text-2); }
.hp-attach svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hp-send { background: var(--accent); color: var(--accent-on); }
.hp-send:disabled { opacity: .45; cursor: default; }
.hp-send svg { width: 18px; height: 18px; fill: currentColor; }
.hp-file {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 8px 10px; font-size: 13px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.hp-file img { width: 36px; height: 36px; object-fit: cover; border-radius: 8px; }
.hp-file span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-file-remove { background: none; border: none; color: var(--text-2); font-size: 16px; cursor: pointer; }

/* «Покажи друзьям»: the story card page and its entry on «Пригласить друга» */
.st-card { display: flex; justify-content: center; margin: 8px 0 14px; }
.st-preview { width: min(270px, 70vw); height: auto; border-radius: 22px; box-shadow: 0 16px 40px -18px rgba(0, 0, 0, .7); }
.st-note { margin: 0 4px 14px; font-size: 13px; line-height: 1.45; color: var(--text-2); text-align: center; }
.st-actions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.v2-page a.v2-story-link { display: flex; flex-direction: column; gap: 2px; color: var(--text-1); }
.v2-story-link b { font-size: 15px; }
.v2-story-link span { font-size: 13px; line-height: 1.4; color: var(--text-2); }

/* ---------- gifts: the card (mockup WebGift) ---------- */
.gc { position: relative; overflow: hidden; width: 100%; aspect-ratio: 350 / 200; border-radius: 24px; background: #0D1230; }
.gc-day { background: #58B4F0; }
.gc-scene { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
.gc-night .gc-night-only, .gc-day .gc-day-only, .gc-party .gc-party-only { display: block; }
.gc-party .gc-night-only { display: block; }
.gc-party .gc-night-only circle[r="210"] { display: none; }
.gc-konor { position: absolute; right: 10px; bottom: 0; height: 78%; width: auto; }
.gc-text { position: absolute; left: 18px; top: 18px; display: flex; flex-direction: column; gap: 4px; max-width: 58%; }
.gc-kicker { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--accent); }
.gc-title { font-family: var(--font-display); font-weight: 700; font-size: 20px; line-height: 1.15; color: var(--text-1); }
.gc-line { font-size: 14px; color: #B9BEE0; }
.gc-day .gc-title { color: #0B1B33; }
.gc-day .gc-line { color: #1F3B63; }
.gc-day .gc-kicker { color: #7A4B00; }

/* ---------- gifts: the buyer's form ---------- */
.gf-head { padding: 18px 0 14px; }
.gf-head h1 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 26px; }
.gf-head p { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.gf-label { display: block; margin: 16px 0 8px; font-family: var(--font-body); font-size: 13px; font-weight: 700; color: var(--text-2); }
.gf-months .gf-month { min-height: 64px; padding: 8px; align-items: center; justify-content: center; text-align: center; }
.gf-months .gf-month .t-label { font-size: 15px; font-weight: 700; color: var(--text-1); }
.gf-months .gf-month .t-sub { font-size: 12px; color: var(--text-2); }
.gf-months .gf-month.is-selected { padding: 7px; background: #1F1A0C; }
.gf-months .gf-month.is-selected .t-label, .gf-months .gf-month.is-selected .t-sub { color: var(--accent); }
.gf-designs .v2-chip { flex: 1; justify-content: center; min-height: 44px; border-radius: 14px; }
.gf-field { display: block; }
.gf-message { min-height: 78px; resize: none; }
.gf-counter { display: block; margin-top: 4px; font-size: 12px; color: var(--text-3); text-align: right; }
.gf-consent { margin: 14px 0 12px; }
.gf-note { margin: 10px 0 0; font-size: 12px; color: var(--text-3); text-align: center; }
.gf-sent-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; color: var(--text-1); }
.gf-sent-row + .gf-sent-row { border-top: 1px solid var(--divider); }
.gf-sent-row > span { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.gf-sent-row b { font-size: 14px; }
.gf-sent-row span span { font-size: 12px; color: var(--text-2); }
.gf-sent-row .gf-sent-meta { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gf-sent-row svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: var(--text-3); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- gifts: the buyer's sent gift ---------- */
.gs-message { margin: 12px 4px 0; font-size: 14px; line-height: 1.45; color: var(--text-2); font-style: italic; }
.gs-state { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.gs-state b { font-size: 15px; }
.gs-state > span { font-size: 13px; line-height: 1.45; color: var(--text-2); }
.gs-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.gs-actions .v2-btn { flex: 1; min-width: 150px; }
.gs-qr { margin-top: 6px; }

/* a known e-mail on the payment forms: shown, not edited — see webapp._save_receipt_email */
.v2-input[readonly] { color: var(--text-2); cursor: default; }
.v2-field-note { display: block; margin-top: 4px; font-size: 12px; color: var(--text-3); }


/* «Привязать почту» in the cabinet */
#link-email-form { display: grid; gap: 10px; margin-top: 12px; }
#link-email-form[hidden] { display: none; }
#link-email-status { margin-top: 10px; }
.v2-ref-contest p { margin: 6px 0 0; }
