/* Cheburator VPN — Web-ЛК. Tokens 1:1 with app theme (web-portal-ux-spec §2). */

/* ---- self-hosted fonts (variable woff2 — all weights in one file each) ---- */
@font-face {
  font-family: 'Nunito';
  src: url('assets/fonts/Nunito-Variable.woff2') format('woff2');
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('assets/fonts/JetBrainsMono-Variable.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* --- brand --- */
  --cheb-accent: #AA5B2F;
  --cheb-accent-hover: #8F4A24;
  --cheb-accent-light: #C57A45;
  --cheb-hot-red: #C8352A;
  --cheb-graphite: #2A2420;

  /* --- surfaces (warm off-white) --- */
  --cheb-scaffold: #FAF7F2;
  --cheb-bg-deep: #F1ECE4;
  --cheb-surface: #FFFFFF;
  --cheb-border-subtle: #E9E1D6;
  --cheb-border-strong: #9C8D78;

  /* --- text --- */
  --cheb-text-primary: #2A2420;
  --cheb-text-secondary: #6E6357;
  --cheb-text-muted: #756A5D;
  --cheb-on-accent: #FFFFFF;

  /* --- semantic --- */
  --cheb-success: #2F9E5B;
  --cheb-warning: #C98A1E;
  --cheb-danger: #C8352A;

  /* --- active-state fill (design-guidelines §3) --- */
  --cheb-active-fill-a: #FFF7F1;
  --cheb-active-fill-b: #FBEADE;

  /* --- grid / radii (8px) --- */
  --cheb-space-1: 4px;  --cheb-space-2: 8px;  --cheb-space-3: 12px;
  --cheb-space-4: 16px; --cheb-space-6: 24px; --cheb-space-8: 32px;
  --cheb-radius-sm: 10px; --cheb-radius-md: 14px; --cheb-radius-lg: 20px;
  --cheb-radius-pill: 999px;
  --cheb-tap-min: 44px;

  /* --- type --- */
  --cheb-font-display: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --cheb-font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cheb-scaffold);
  color: var(--cheb-text-primary);
  font-family: var(--cheb-font-display);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; }

/* ---------------------------------------------------------------- type ---- */
.h1 { font-size: 28px; font-weight: 900; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
.h2 { font-size: 22px; font-weight: 800; line-height: 1.2; margin: 0; }
.title { font-size: 17px; font-weight: 800; line-height: 1.25; margin: 0; }
.body { font-size: 15px; font-weight: 400; margin: 0; }
.caption { font-size: 12px; font-weight: 600; margin: 0; }
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--cheb-text-muted); margin: 0;
}
.mono {
  font-family: var(--cheb-font-mono);
  font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums;
}
.text-secondary { color: var(--cheb-text-secondary); }
.text-muted { color: var(--cheb-text-muted); }

/* -------------------------------------------------------------- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--cheb-space-2);
  min-height: var(--cheb-tap-min);
  padding: 0 var(--cheb-space-6);
  border-radius: var(--cheb-radius-pill);
  font-size: 15px; font-weight: 800;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .12s ease, color .12s ease, transform .06s ease, box-shadow .12s ease;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

.btn-primary { background: var(--cheb-graphite); color: var(--cheb-scaffold); }
.btn-primary:not(:disabled):hover { background: #1f1a16; }

.btn-outline {
  background: transparent; color: var(--cheb-accent);
  border-color: var(--cheb-accent);
}
.btn-outline:not(:disabled):hover { background: var(--cheb-active-fill-a); }

.btn-text {
  background: transparent; color: var(--cheb-accent);
  border-color: transparent; padding: 0 var(--cheb-space-3);
  font-weight: 700;
}
.btn-text:not(:disabled):hover { color: var(--cheb-accent-hover); text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--cheb-accent);
  outline-offset: 2px;
  border-radius: var(--cheb-radius-sm);
}

/* ---- inline spinner (in-button only, per spec §4.4) ---- */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- shell ---- */
.shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--cheb-space-3) var(--cheb-space-4);
  padding-top: max(var(--cheb-space-3), env(safe-area-inset-top));
  border-bottom: 1px solid var(--cheb-border-subtle);
  background: var(--cheb-scaffold);
}

.content {
  flex: 1 1 auto;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: var(--cheb-space-6) var(--cheb-space-4);
  /* room for the fixed bottom tab-bar on mobile */
  padding-bottom: calc(72px + env(safe-area-inset-bottom) + var(--cheb-space-6));
}

/* ---- tab bar: fixed bottom on mobile, top row on >=768px (spec §3.3) ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center; gap: var(--cheb-space-1);
  padding: var(--cheb-space-1) var(--cheb-space-2);
  padding-bottom: calc(var(--cheb-space-1) + env(safe-area-inset-bottom));
  background: rgba(250, 247, 242, 0.9);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--cheb-border-subtle);
}
.tab {
  flex: 1 1 0; max-width: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  min-height: var(--cheb-tap-min);
  padding: var(--cheb-space-1) var(--cheb-space-1);
  border: 2px solid transparent; border-radius: var(--cheb-radius-md);
  background: transparent; cursor: pointer;
  color: var(--cheb-text-secondary);
  font-size: 11px; font-weight: 700;
  text-decoration: none;
}
.tab .tab-ico { font-size: 20px; line-height: 1; }
.tab[aria-current='page'] {
  color: var(--cheb-accent);
  background: linear-gradient(180deg, var(--cheb-active-fill-a), var(--cheb-active-fill-b));
  border-color: rgba(170, 91, 47, 0.35);
}
.tab-soon { opacity: 0.72; }
.tab-badge {
  font-size: 9px; font-weight: 800; letter-spacing: .04em;
  color: var(--cheb-accent); text-transform: uppercase;
}

@media (min-width: 768px) {
  .content { padding-bottom: var(--cheb-space-8); }
  .tabbar {
    position: sticky; top: 0; bottom: auto;
    border-top: none; border-bottom: 1px solid var(--cheb-border-subtle);
    padding-bottom: var(--cheb-space-1);
    justify-content: center; gap: var(--cheb-space-2);
  }
  .tab { flex: 0 0 auto; flex-direction: row; gap: var(--cheb-space-2); padding: 0 var(--cheb-space-4); font-size: 14px; }
  .tab .tab-ico { font-size: 16px; }
}

/* ---------------------------------------------------------------- cards ---- */
.card {
  background: var(--cheb-surface);
  border: 1px solid var(--cheb-border-subtle);
  border-radius: var(--cheb-radius-md);
  box-shadow: 0 1px 2px rgba(42, 36, 32, 0.04), 0 8px 20px rgba(42, 36, 32, 0.04);
  padding: var(--cheb-space-6);
}
.card + .card { margin-top: var(--cheb-space-4); }

.stack > * + * { margin-top: var(--cheb-space-4); }
.stack-2 > * + * { margin-top: var(--cheb-space-2); }
.stack-3 > * + * { margin-top: var(--cheb-space-3); }

.divider { height: 1px; background: var(--cheb-border-subtle); border: 0; margin: var(--cheb-space-4) 0; }

.kv { display: flex; align-items: baseline; justify-content: space-between; gap: var(--cheb-space-3); }
.kv .kv-label { color: var(--cheb-text-secondary); font-size: 14px; }
.kv .kv-value { font-weight: 700; text-align: right; }

/* ---- status pill (always paired with text, spec §10) ---- */
.pill {
  display: inline-flex; align-items: center; gap: var(--cheb-space-2);
  padding: 4px var(--cheb-space-3); border-radius: var(--cheb-radius-pill);
  font-size: 13px; font-weight: 700;
}
.pill-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pill-success { background: rgba(47, 158, 91, 0.12); color: #1f7a44; }
.pill-success .pill-dot { background: var(--cheb-success); }

/* ---- warning / info banners ---- */
.banner {
  display: flex; gap: var(--cheb-space-2); align-items: flex-start;
  padding: var(--cheb-space-3) var(--cheb-space-4);
  border-radius: var(--cheb-radius-sm);
  font-size: 14px; font-weight: 600;
}
.banner-warning { background: rgba(201, 138, 30, 0.12); color: #8a5e13; }
.banner-danger  { background: rgba(200, 53, 42, 0.10); color: #9a2921; }

.field-error {
  color: var(--cheb-danger); font-size: 13px; font-weight: 600;
  margin-top: var(--cheb-space-2);
}

/* ---------------------------------------------------------------- login ---- */
.login-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--cheb-space-6) var(--cheb-space-4);
}
.login-card { width: 100%; max-width: 420px; text-align: center; }
.login-logo { width: 72px; height: 72px; border-radius: var(--cheb-radius-md); margin: 0 auto var(--cheb-space-3); display: block; }

.key-input {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  padding: var(--cheb-space-3);
  background: var(--cheb-bg-deep);
  border: 2px solid var(--cheb-border-strong);
  border-radius: var(--cheb-radius-sm);
  font-family: var(--cheb-font-mono);
  font-size: 14px;
  color: var(--cheb-text-primary);
  line-height: 1.4;
}
.key-input:focus-visible { outline: none; border-color: var(--cheb-accent); box-shadow: 0 0 0 3px rgba(170,91,47,.2); }
.key-input.is-error { border-color: var(--cheb-danger); }

.disclosure { border: 0; padding: 0; margin: 0; text-align: left; }
.disclosure > summary {
  list-style: none; cursor: pointer;
  min-height: var(--cheb-tap-min); display: flex; align-items: center;
  color: var(--cheb-accent); font-weight: 700; font-size: 14px;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: '▸'; margin-right: var(--cheb-space-2); transition: transform .15s ease; }
.disclosure[open] > summary::before { transform: rotate(90deg); }
.disclosure-body { padding: var(--cheb-space-2) 0 0; font-size: 14px; color: var(--cheb-text-secondary); }
.disclosure-body ol { margin: 0 0 var(--cheb-space-3); padding-left: 1.25em; }
.disclosure-body li { margin-bottom: var(--cheb-space-1); }

.fine-print {
  font-size: 12px; font-weight: 600; color: var(--cheb-text-muted);
  line-height: 1.5;
}

/* ---- device rows ---- */
.device {
  display: flex; gap: var(--cheb-space-3); align-items: flex-start;
  padding: var(--cheb-space-3) 0;
}
.device + .device { border-top: 1px solid var(--cheb-border-subtle); }
.device-ico { font-size: 22px; line-height: 1.2; flex: none; }
.device-name { font-weight: 800; font-size: 16px; }
.device-meta { font-size: 13px; color: var(--cheb-text-secondary); }

/* ---------------------------------------------------------------- sheet ---- */
.scrim {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(42, 36, 32, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 520px;
  background: var(--cheb-surface);
  border-radius: var(--cheb-radius-lg) var(--cheb-radius-lg) 0 0;
  padding: var(--cheb-space-6);
  padding-bottom: calc(var(--cheb-space-6) + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(42,36,32,.25);
  animation: sheet-up .18s ease-out;
}
@keyframes sheet-up { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-actions { display: flex; gap: var(--cheb-space-3); margin-top: var(--cheb-space-6); }
.sheet-actions .btn { flex: 1 1 0; }

@media (min-width: 560px) {
  .scrim { align-items: center; }
  .sheet { border-radius: var(--cheb-radius-lg); max-width: 440px; animation: sheet-in .18s ease-out; }
  @keyframes sheet-in { from { transform: scale(.97); opacity: .6; } to { transform: none; opacity: 1; } }
}

/* --------------------------------------------------------- skeletons ---- */
.skel {
  background: linear-gradient(90deg, var(--cheb-bg-deep) 25%, #ece5db 37%, var(--cheb-bg-deep) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: var(--cheb-radius-sm);
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.skel-line { height: 14px; }
.skel-line.sk-60 { width: 60%; }
.skel-line.sk-40 { width: 40%; }
.skel-line.sk-80 { width: 80%; }
.skel-pill { height: 26px; width: 96px; border-radius: var(--cheb-radius-pill); }

@media (prefers-reduced-motion: reduce) {
  .skel, .spinner, .sheet { animation: none; }
  .btn { transition: none; }
}

/* ---------------------------------------------------- centered state ---- */
.state {
  text-align: center;
  padding: var(--cheb-space-8) var(--cheb-space-2);
}
.state .state-title { margin-bottom: var(--cheb-space-2); }
.state .state-body { color: var(--cheb-text-secondary); margin-bottom: var(--cheb-space-6); }
.state .btn { margin: 0 auto; }

.screen-title { margin-bottom: var(--cheb-space-2); }
.screen-lede { color: var(--cheb-text-secondary); margin-bottom: var(--cheb-space-6); }

/* ---- web cabinet: e-mail login, connect/QR, purchase stub (ADR-060) ---- */
.text-input {
  width: 100%; min-height: var(--cheb-tap-min);
  padding: var(--cheb-space-3);
  background: var(--cheb-bg-deep);
  border: 2px solid var(--cheb-border-strong);
  border-radius: var(--cheb-radius-sm);
  font: inherit; font-size: 16px; color: var(--cheb-text-primary);
}
.text-input:focus-visible { outline: none; border-color: var(--cheb-accent); box-shadow: 0 0 0 3px rgba(170,91,47,.2); }
.text-input.is-error { border-color: var(--cheb-danger); }

.step-title { display: flex; align-items: center; gap: var(--cheb-space-2); }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; flex: none;
  border-radius: var(--cheb-radius-pill);
  background: var(--cheb-accent); color: var(--cheb-on-accent);
  font-size: 15px; font-weight: 800;
}

.qr-box {
  background: #fff; padding: var(--cheb-space-2);
  border: 1px solid var(--cheb-border-subtle); border-radius: var(--cheb-radius-md);
  width: min(100%, 320px); margin: 0 auto;
}
.qr-svg { display: block; width: 100%; height: auto; }

.buy-card { text-align: left; }
.buy-card .login-logo, .buy-card .eyebrow, .buy-card .h1 { text-align: center; }
.plan-list { display: flex; flex-direction: column; gap: var(--cheb-space-2); }
.plan-option {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--cheb-space-3);
  min-height: var(--cheb-tap-min); padding: var(--cheb-space-3);
  border: 2px solid var(--cheb-border-subtle); border-radius: var(--cheb-radius-sm);
  background: var(--cheb-surface); cursor: pointer;
}
.plan-option:has(input:checked) { border-color: var(--cheb-accent); background: var(--cheb-active-fill-a); }
.plan-title { font-weight: 700; }
.check-row { display: flex; gap: var(--cheb-space-2); align-items: flex-start; font-size: 14px; color: var(--cheb-text-secondary); }
.check-row input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.check-row a { color: var(--cheb-accent); }
