:root {
  /* ═══════════════════════════════
     Z1NT — Strict Minimalist Light Style
     ═══════════════════════════════ */
  --bg:             #fafafa;
  --bg-page:        #ffffff;
  --surface:        #ffffff;
  --surface-2:      #f5f5f7;
  --surface-3:      #e5e5eb;
  --surface-hover:  #fafafb;
  --surface-solid:  #ffffff;

  /* Strict Indigo-Slate Accent Colors */
  --primary:        #27272a;
  --primary-dark:   #18181b;
  --primary-hover:  #3f3f46;
  --primary-glow:   rgba(39,39,42,0.08);
  --primary-soft:   rgba(39,39,42,0.04);

  --accent:         #18181b;
  --accent-2:       #52525b;

  --border:         #e4e4e7;
  --border-strong:  #d4d4d8;
  --border-focus:   #18181b;

  --text:           #09090b;
  --text-2:         #27272a;
  --text-muted:     #71717a;
  --text-faint:     #a1a1aa;

  --success:        #16a34a;
  --success-bg:     #f0fdf4;
  --danger:         #dc2626;
  --danger-bg:      #fef2f2;
  --warning:        #d97706;
  --warning-bg:     #fffbeb;
  --info:           #2563eb;

  /* Strict Border Radius (Minimal and sharp) */
  --radius-xs:      4px;
  --radius-sm:      4px;
  --radius:         6px;
  --radius-lg:      6px;
  --radius-xl:      8px;

  /* Very subtle flat shadows */
  --shadow-xs:      0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow-sm:      0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow:         0 1px 3px 0 rgba(0,0,0,0.05);
  --shadow-lg:      0 4px 6px -1px rgba(0,0,0,0.05);
  --shadow-xl:      0 10px 15px -3px rgba(0,0,0,0.05);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
  min-height: 100vh;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

::selection { background: var(--primary-soft); color: var(--primary); }

/* Animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pageFade {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes modalScale {
  from { opacity: 0; transform: scale(0.98) translateY(2px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.spin { animation: spin 0.8s linear infinite; }

/* Hide Sidebar */
.sidebar, .sidebar-overlay, .sidebar-toggle { display: none !important; }

/* ────────────────────────────────
   TOPBAR / HEADER
──────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  height: 52px;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 100%;
  max-width: 520px; /* Aligned with compact width */
  margin: 0 auto;
  padding: 0 16px;
}

.topbar-left  { display: flex; align-items: center; gap: 10px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.brand { display: flex; align-items: center; }
.brand img {
  height: 24px;
  width: auto;
  border-radius: var(--radius-xs);
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.1s;
}
.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}
.icon-btn:active { transform: scale(0.97); }

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px 0 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.1s;
  font-family: inherit;
}
.user-pill:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.user-pill-avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-xs);
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-pill-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Notification dot */
.notif-dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 6px; height: 6px;
  background: var(--danger);
  border-radius: 50%;
  border: 1px solid white;
}

.notif-bell-wrap { position: relative; }

.notif-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  overflow: hidden;
  animation: fadeUp 0.12s ease;
}

.notif-panel-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.notif-panel-body { max-height: 240px; overflow-y: auto; }
.notif-empty { padding: 24px; text-align: center; color: var(--text-faint); font-size: 12.5px; }

/* ────────────────────────────────
   APP SHELL + CONTENT (Centered & Compact)
──────────────────────────────── */
.app-shell {
  display: block;
  width: 100%;
}

.app-shell > .content {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 16px 100px;
  position: relative;
}

/* Strictly center and compact size for pages */
.dash-page {
  display: none !important;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.dash-page.active {
  display: block !important;
  animation: pageFade 0.15s ease;
}

/* ────────────────────────────────
   BOTTOM PILL NAVIGATION
──────────────────────────────── */
.pill-tab-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 300;
  background: rgba(255,255,255,0.95);
  border-top: 1px solid var(--border);
  padding: 6px 12px max(8px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 4px;
}

.pill-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  max-width: 90px;
  height: 48px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
  padding: 0 4px;
}

.pill-tab:hover {
  color: var(--text);
  background: var(--surface-2);
}

.pill-tab.active {
  color: var(--text);
  background: var(--surface-3);
}

/* ────────────────────────────────
   PAGE TITLE & HINT
──────────────────────────────── */
.page-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 4px;
}

.page-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0 0 18px;
  line-height: 1.45;
}

/* ────────────────────────────────
   STATUS CARD
──────────────────────────────── */
.status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.hs-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.hs-hero-left { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hs-hero-right { text-align: right; flex-shrink: 0; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.status-badge.active  { background: var(--success-bg); color: var(--success); border-color: rgba(22,163,74,0.15); }
.status-badge.trial   { background: rgba(37,99,235,0.06); color: var(--info); border-color: rgba(37,99,235,0.15); }
.status-badge.inactive{ background: var(--danger-bg); color: var(--danger); border-color: rgba(220,38,38,0.15); }

.hs-days-wrap { display: flex; align-items: baseline; gap: 4px; }
.hs-days {
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.hs-days-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }

.hs-expires-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 2px;
}
.hs-expires { font-size: 13px; font-weight: 700; color: var(--text-2); }

/* Metrics 2×2 Grid */
.hs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
}

.hs-metric {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  text-align: left;
  font-family: inherit;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  width: 100%;
  border: none;
  transition: background 0.1s;
}
.hs-metric:hover { background: var(--surface-2); }

.hs-metric-ico {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.hs-metric-meta { flex: 1; min-width: 0; }
.hs-metric-lbl {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 2px;
}
.hs-metric-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hs-metric-sub { font-size: 11px; font-weight: 500; color: var(--text-muted); }
.hs-metric-chev { color: var(--text-faint); flex-shrink: 0; }

/* Traffic progress */
.hs-traffic {
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.hs-traffic-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.hs-traffic-lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.hs-traffic-pct { font-size: 13px; font-weight: 800; color: var(--text); }
.hs-traffic-bar { height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.hs-traffic-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 1s ease-out;
}
.hs-traffic-foot { margin-top: 6px; font-size: 11px; color: var(--text-muted); }
.hs-traffic-foot #trafficAvg { font-weight: 700; color: var(--text); }

/* Action Row */
.action-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ────────────────────────────────
   BUTTONS — GLOBAL
──────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.1s;
  border: 1px solid var(--border);
  font-family: inherit;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--surface-2);
}

/* ────────────────────────────────
   NO-SUB CARD (Strict & Centered)
──────────────────────────────── */
.no-sub-card {
  text-align: center;
  padding: 32px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  margin: 12px auto;
  box-shadow: var(--shadow-sm);
}

.no-sub-icon { margin-bottom: 12px; }
.no-sub-icon svg { color: var(--primary); }

.no-sub-card h2 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 6px;
}
.no-sub-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.45;
}

.no-sub-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-direction: column;
}
.no-sub-actions .btn { width: 100%; }

/* ────────────────────────────────
   PROMO CODE
──────────────────────────────── */
.promo-row { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }

.promo-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.1s;
  font-family: inherit;
  width: 100%;
  justify-content: space-between;
}
.promo-toggle:hover { background: var(--surface-2); color: var(--text); }

.promo-box { display: flex; gap: 6px; align-items: stretch; }
.promo-input {
  flex: 1; min-width: 0;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  outline: none;
}
.promo-input::placeholder { color: var(--text-faint); font-family: inherit; font-weight: 500; font-size: 12px; }
.promo-input:focus { border-color: var(--border-focus); }

.promo-apply {
  padding: 0 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.promo-apply:hover { background: var(--primary-hover); }

.promo-msg { font-size: 12px; font-weight: 600; padding: 8px 12px; border-radius: var(--radius-sm); line-height: 1.4; }
.promo-msg.ok  { background: var(--success-bg); color: var(--success); border: 1px solid rgba(22,163,74,0.15); }
.promo-msg.err { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(220,38,38,0.15); }

/* ────────────────────────────────
   FAMILY CARD (widget wrapper)
──────────────────────────────── */
.family-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 14px;
  box-shadow: var(--shadow-sm);
}

.family-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}

.family-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.family-counter {
  font-size: 10px;
  font-weight: 700;
  background: var(--surface-3);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
}

.family-btn-buy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.1s;
  font-family: inherit;
}
.family-btn-buy:hover { background: var(--primary); color: #fff; border-color: transparent; }

.family-list { display: flex; flex-direction: column; gap: 6px; }

/* ────────────────────────────────
   FAMILY / DEVICES WIDGET (.fm-*)
──────────────────────────────── */
.fm-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.1s, background 0.1s;
}
.fm-row:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.fm-row.is-online { border-left: 2px solid var(--success); }

.fm-avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.fm-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fm-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.fm-status {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.fm-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.fm-sub span { white-space: nowrap; }

.fm-dot { color: var(--text-faint); }
.fm-traffic { display: inline-flex; align-items: center; }

.fm-online {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
.fm-offline {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}

.fm-share-warn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--warning);
  margin-top: 2px;
}

.fm-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.fm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.1s;
}
.fm-icon:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.fm-icon.share:hover { background: var(--primary-soft); color: var(--primary); }
.fm-icon.danger:hover { background: var(--danger-bg); border-color: rgba(220,38,38,0.15); color: var(--danger); }

.fm-bar-wrap {
  width: 100%;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
  margin: 10px 0 12px;
}
.fm-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.fm-bar.tone-ok { background: var(--success); }
.fm-bar.tone-warn { background: var(--warning); }
.fm-bar.tone-crit { background: var(--danger); }

.fm-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.1s;
}
.fm-add:hover { background: var(--surface-2); color: var(--text); border-color: var(--text-faint); }

.fm-full-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--warning-bg);
  border: 1px solid rgba(217,119,6,0.15);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--warning);
}

/* ────────────────────────────────
   VPN KEY PAGE
──────────────────────────────── */
.key-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.1s;
}
.key-card:hover { border-color: var(--primary); }

.key-content {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
  line-height: 1.5;
}

.key-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12.5px;
}

.key-actions { display: flex; gap: 8px; margin-bottom: 16px; }
.key-actions .btn { flex: 1; }

.rotate-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: var(--warning-bg);
  border: 1px solid rgba(217,119,6,0.12);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.rotate-info { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; line-height: 1.45; color: var(--warning); }
.rotate-info svg { flex-shrink: 0; }
.rotate-btn {
  align-self: flex-start;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  background: rgba(217,119,6,0.1);
  border: 1px solid rgba(217,119,6,0.2);
  color: var(--warning);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.rotate-btn:hover { background: var(--warning); color: #fff; border-color: transparent; }

.tip-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.happ-cta {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  margin-bottom: 12px;
  justify-content: center;
}
.happ-cta:hover { background: var(--primary-hover); }

/* ────────────────────────────────
   QR CODE CARD
──────────────────────────────── */
.qr-card.v2 {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-width: 320px;
  margin: 12px auto 0;
  box-shadow: var(--shadow-sm);
}
.qr-card.v2 .qr-frame {
  position: relative;
  background: #fff;
  border-radius: var(--radius-xs);
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border);
}
.qr-card.v2 .qr-container { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; }
.qr-card.v2 .qr-container canvas { display: block; max-width: 100%; max-height: 100%; }
.qr-card.v2 .qr-corner {
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid var(--primary);
  border-radius: 2px;
}
.qr-card.v2 .qr-corner.tl { top: -4px; left: -4px; border-right: none; border-bottom: none; }
.qr-card.v2 .qr-corner.tr { top: -4px; right: -4px; border-left: none; border-bottom: none; }
.qr-card.v2 .qr-corner.bl { bottom: -4px; left: -4px; border-right: none; border-top: none; }
.qr-card.v2 .qr-corner.br { bottom: -4px; right: -4px; border-left: none; border-top: none; }
.qr-card.v2 .qr-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 14px; }
.qr-card.v2 .qr-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 6px 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  cursor: pointer;
}
.qr-card.v2 .qr-btn:hover { background: var(--surface-3); }

/* ────────────────────────────────
   INSTRUCTION BLOCK
──────────────────────────────── */
.instr-tabs {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  margin: 16px 0 14px;
  gap: 2px;
}
.instr-tab {
  flex: 1;
  padding: 7px 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-family: inherit;
}
.instr-tab.active { background: var(--primary); color: #fff; }

.instr-cta {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  margin-bottom: 14px;
}
.instr-cta:hover { border-color: var(--border-strong); }
.instr-cta-ico { width: 28px; height: 28px; border-radius: var(--radius-xs); background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 13px; }
.instr-cta-meta { flex: 1; }
.instr-cta-title { font-size: 13px; font-weight: 700; color: var(--text); }
.instr-cta-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.instr-cta-arrow { color: var(--text-faint); }

.instr-apps { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.instr-app {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.instr-app:hover { border-color: var(--border-strong); }
.instr-app-ico { width: 30px; height: 30px; border-radius: var(--radius-xs); display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.instr-app-meta { flex: 1; }
.instr-app-name { font-size: 13px; font-weight: 700; color: var(--text); }
.instr-app-hint { font-size: 11px; color: var(--text-muted); }

.instr-steps-mini {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
}
.instr-step { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.instr-step-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 9.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.instr-key-box {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  cursor: pointer;
}
.instr-key-box:hover { border-color: var(--border-focus); }
.instr-key-val { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.instr-key-btn { font-size: 10px; font-weight: 700; color: #fff; background: var(--primary); padding: 2px 8px; border-radius: var(--radius-xs); }

/* ────────────────────────────────
   PROFILE PAGE (pp-*) — Centered & Strict
──────────────────────────────── */
.pp-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.pp-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xs);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

.pp-avatar--ref {
  background: var(--accent-2);
}

.pp-header-info { min-width: 0; }
.pp-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pp-handle {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pp-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}

.pp-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.pp-section-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.pp-section-body { display: flex; flex-direction: column; gap: 6px; }
.pp-payments-list { gap: 6px !important; }
.pp-loading { font-size: 12px; color: var(--text-faint); padding: 4px 0; }

/* ── Dynamically Loaded Bind Buttons (Fixing Stretched Layout) ── */
.prof-bind-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: left;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  gap: 10px;
  transition: all 0.12s;
}
.prof-bind-btn:hover:not(.active) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
.prof-bind-btn.active {
  cursor: default;
  border-color: var(--border);
  background: var(--surface-2);
}
.prof-bind-btn .ico {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
}
.prof-bind-btn .meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}
.prof-bind-btn .meta .label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prof-bind-btn .meta .hint {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Subscription stat info list style */
.prof-sub-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}
.prof-sub-stat-label {
  font-weight: 600;
  color: var(--text-muted);
}
.prof-sub-stat-val {
  font-weight: 700;
  color: var(--text);
}

.prof-empty {
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
  padding: 10px 0;
}

/* Payment details rows */
.prof-pay-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.prof-pay-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.prof-pay-amount {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text);
}
.prof-pay-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prof-pay-date {
  font-size: 10.5px;
  color: var(--text-faint);
}
.prof-pay-status {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}
.prof-pay-status.paid {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(22,163,74,0.15);
}
.prof-pay-status.pending {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(217,119,6,0.15);
}

/* ────────────────────────────────
   REFERRALS PAGE
──────────────────────────────── */
.rf-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.rf-hero-title { font-size: 14.5px; font-weight: 800; color: var(--text); margin-bottom: 4px; letter-spacing: -0.01em; }
.rf-hero-sub { font-size: 12px; color: var(--text-muted); line-height: 1.45; margin-bottom: 14px; }

.rf-link-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: var(--radius-sm);
}
.rf-link-label { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); margin-bottom: 4px; }
.rf-link-box input {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  outline: none;
  margin-bottom: 8px;
}
.rf-link-actions { display: flex; gap: 6px; }

.rf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.1s;
  border: 1px solid var(--border);
}
.rf-btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.rf-btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.rf-btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.rf-btn-ghost:hover { background: var(--surface-2); }
.rf-link-note { font-size: 11px; color: var(--text-muted); margin-top: 8px; line-height: 1.4; }

.rf-kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0; }
.rf-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.rf-kpi-lbl { font-size: 9px; font-weight: 700; text-transform: uppercase; color: var(--text-faint); letter-spacing: 0.04em; margin-bottom: 2px; }
.rf-kpi-val { font-size: 15px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.rf-kpi-hint { font-size: 10px; color: var(--text-faint); margin-top: 1px; }

.rf-withdraw {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border-strong);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
}
.rf-withdraw:hover:not(:disabled) { border-style: solid; background: var(--primary); color: #fff; border-color: var(--primary); }
.rf-withdraw:disabled { border-color: var(--border); background: transparent; color: var(--text-faint); cursor: not-allowed; }
.rf-withdraw span { font-size: 12.5px; font-weight: 700; }
.rf-withdraw small { font-size: 10.5px; opacity: 0.8; margin-top: 1px; }

.rf-list { display: flex; flex-direction: column; gap: 5px; }
.rf-empty { padding: 20px; text-align: center; font-size: 12.5px; color: var(--text-muted); }

.rf-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.rf-list-item:hover { background: var(--surface-2); }

.li-main { flex: 1; min-width: 0; }
.li-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.li-meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.li-side { text-align: right; flex-shrink: 0; }
.li-amount { font-size: 13px; font-weight: 800; color: var(--text); }
.li-status { font-size: 10.5px; color: var(--text-muted); }

.rf-status { font-size: 9.5px; font-weight: 700; padding: 1px 6px; border-radius: var(--radius-xs); text-transform: uppercase; display: inline-block; }
.rf-status.active, .rf-status.approved, .rf-status.paid { background: var(--success-bg); color: var(--success); }
.rf-status.inactive { background: var(--surface-3); color: var(--text-muted); }
.rf-status.pending { background: var(--warning-bg); color: var(--warning); }
.rf-status.rejected { background: var(--danger-bg); color: var(--danger); }

.rf-faq { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 5px; }
.rf-faq summary { padding: 10px 12px; font-size: 12.5px; font-weight: 600; color: var(--text); cursor: pointer; outline: none; }
.rf-faq summary:hover { color: var(--primary); }
.rf-faq div { padding: 0 12px 10px; font-size: 12px; color: var(--text-muted); line-height: 1.45; }

/* ────────────────────────────────
   TOAST
──────────────────────────────── */
.toast {
  position: fixed;
  bottom: 74px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--surface);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  z-index: 2000;
  opacity: 0;
  transition: all 0.2s;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-2px); }

/* ────────────────────────────────
   LIGHTBOX
──────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.95);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.lightbox.show { opacity: 1; pointer-events: auto; }

/* ────────────────────────────────
   MODALS
──────────────────────────────── */
.lama-modal, .rf-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 16px;
}
.lama-modal.show, .rf-modal-overlay.show { display: flex; }

.lama-modal-card, .rf-modal {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  position: relative;
  animation: modalScale 0.2s ease;
  text-align: center;
}

.lama-modal-card::before, .rf-modal::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.25), transparent 40%, transparent 60%, rgba(99, 102, 241, 0.15));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.lama-modal-x, .rf-modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}
.lama-modal-x:hover, .rf-modal-close:hover { background: var(--surface-2); color: var(--text); }

.lama-modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.lama-modal-icon.error { background: rgba(239, 68, 68, 0.08); color: #ef4444; border-color: rgba(239, 68, 68, 0.2); }
.lama-modal-icon.success { background: rgba(16, 185, 129, 0.08); color: #10b981; border-color: rgba(16, 185, 129, 0.2); }
.lama-modal-icon.warn { background: rgba(245, 158, 11, 0.08); color: #f59e0b; border-color: rgba(245, 158, 11, 0.2); }
.lama-modal-icon.info { background: rgba(14, 165, 233, 0.08); color: var(--primary); border-color: rgba(14, 165, 233, 0.2); }

.lama-modal-title, .rf-modal-head h3 { font-size: 17px; font-weight: 800; color: var(--text); margin-bottom: 10px; line-height: 1.3; }
.lama-modal-msg { font-size: 13.5px; color: var(--text-muted); line-height: 1.5; margin-bottom: 20px; }

.lama-modal-input-wrap { margin-bottom: 16px; }
.lama-modal-input-wrap input,
.rf-form-row input,
.rf-form-row select,
.rf-form-row textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lama-modal-input-wrap input:focus,
.rf-form-row input:focus,
.rf-form-row select:focus,
.rf-form-row textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.08);
}

.lama-modal-actions, .rf-modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.lama-modal-btn, .rf-modal-actions .rf-btn {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  transition: transform 0.1s, background 0.15s;
}
.lama-modal-btn:active, .rf-modal-actions .rf-btn:active { transform: scale(0.97); }
.lama-modal-btn.ok, .rf-modal-actions .rf-btn-primary { background: var(--primary); color: #fff; }
.lama-modal-btn.ok:hover { background: var(--primary-hover); }
.lama-modal-btn.cancel, .rf-modal-actions .rf-btn-ghost { background: var(--surface-2); border-color: var(--border-strong); color: var(--text-2); }
.lama-modal-btn.cancel:hover, .rf-modal-actions .rf-btn-ghost:hover { background: var(--surface-3); }

.rf-form-row { margin-bottom: 12px; text-align: left; }
.rf-form-row > label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 5px; }

.rf-radio-row { display: flex; gap: 8px; }
.rf-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: var(--radius-sm);
  flex: 1;
  justify-content: center;
}
.rf-radio:hover { background: var(--surface-3); }
.rf-radio input { width: auto; accent-color: var(--primary); margin: 0; cursor: pointer; }
.rf-form-hint { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.rf-form-error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(220,38,38,0.15); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 12px; margin-top: 10px; }

/* ────────────────────────────────
   KEY SUBTABS
──────────────────────────────── */
.key-subtabs {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  margin-bottom: 14px;
  gap: 2px;
}
.key-subtab {
  flex: 1;
  padding: 6px 8px;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.key-subtab:hover { color: var(--text); }
.key-subtab.active { background: var(--primary); color: #fff; }

.key-subpanel { display: none; }
.key-subpanel.active { display: block; }

/* ────────────────────────────────
   SERVERS MODAL
──────────────────────────────── */
.server-list { display: flex; flex-direction: column; gap: 5px; max-height: 280px; overflow-y: auto; }
.server-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
}
.server-item:hover { border-color: var(--primary); }
.server-item.active { border-color: var(--primary); background: var(--surface-2); }
.server-flag { font-size: 18px; flex-shrink: 0; }
.server-meta { flex: 1; min-width: 0; }
.server-name { font-size: 12.5px; font-weight: 700; color: var(--text); }
.server-load { font-size: 11px; color: var(--text-muted); }
.server-active-badge { font-size: 9px; font-weight: 700; background: var(--primary); color: #fff; padding: 1px 6px; border-radius: var(--radius-xs); flex-shrink: 0; }

/* ────────────────────────────────
   EXPIRY WARNING BANNER
──────────────────────────────── */
#expiryWarning {
  background: var(--danger-bg);
  border: 1px solid rgba(220,38,38,0.15);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--danger);
  font-size: 12px;
}

/* ────────────────────────────────
   SITE NOTIFICATIONS
──────────────────────────────── */
#siteNotifications > * {
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

/* ────────────────────────────────
   RESPONSIVE
──────────────────────────────── */
@media (max-width: 640px) {
  .app-shell > .content { padding: 16px 12px 90px; }
  .topbar-inner { padding: 0 12px; }

  .hs-days { font-size: 34px; }
  .rf-kpi-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .rf-kpi-val { font-size: 14px; }
}

@media (min-width: 768px) {
  .pill-tab-bar { max-width: 480px; left: 50%; transform: translateX(-50%); border-radius: var(--radius) var(--radius) 0 0; border: 1px solid var(--border); border-bottom: none; }
}

/* ────────────────────────────────
   SITE-WIDE NOTIFICATION BANNERS
──────────────────────────────── */
.site-notif-banner {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 12px;
  line-height: 1.4;
  border: 1px solid;
}
.site-notif-banner.info { background: rgba(37,99,235,0.06); border-color: rgba(37,99,235,0.15); color: var(--info); }
.site-notif-banner.warning { background: var(--warning-bg); border-color: rgba(217,119,6,0.15); color: var(--warning); }
.site-notif-banner.danger { background: var(--danger-bg); border-color: rgba(220,38,38,0.15); color: var(--danger); }

/* ────────────────────────────────
   REFRESH BUTTON ANIMATIONS
──────────────────────────────── */
.refresh-btn svg.spin { pointer-events: none; }
.rb-label { transition: opacity 0.1s; }

/* ────────────────────────────────
   UTILITY
──────────────────────────────── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ────────────────────────────────
   MISSING STYLES: prof-card & notif-modal
──────────────────────────────── */
.prof-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.prof-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.prof-card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.prof-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.prof-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}
.prof-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Notification Modal */
.notif-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 16px;
}
.notif-modal-overlay.show {
  display: flex !important;
}
.notif-modal-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-xl);
  position: relative;
  animation: modalScale 0.15s ease;
}
.notif-modal-close {
  position: absolute;
  top: 10px; right: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
}
.notif-modal-close:hover {
  background: var(--surface-3);
  color: var(--text);
}
.notif-modal-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}
.notif-modal-body {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}


/* ────────────────────────────────
   MOBILE HEADER ADJUSTMENTS
──────────────────────────────── */
@media (max-width: 640px) {
  .user-pill-name { display: none !important; }
  .user-pill { padding: 0 !important; border: none !important; background: transparent !important; }
  .topbar-right { gap: 4px !important; }
}

/* Hide promo code row on main page (moved to purchase modal) */
#promoRow {
  display: none !important;
}

/* ────────────────────────────────
   PAYMENT & PLANS MODAL STYLING
──────────────────────────────── */
.pay-method-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9100;
  opacity: 0;
  transition: opacity 0.2s ease;
  padding: 16px;
}
.pay-method-overlay.open {
  opacity: 1;
}

.pay-method-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  position: relative;
  animation: modalScale 0.15s ease;
}

.pay-method-close {
  position: absolute;
  top: 10px; right: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.1s;
}
.pay-method-close:hover {
  background: var(--surface-3);
  color: var(--text);
}

.pay-method-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.pay-method-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 16px;
}

/* Plan grid selector */
.ppm-plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.ppm-plan {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.1s;
  text-align: center;
  position: relative;
  width: 100%;
  font-family: inherit;
}
.ppm-plan:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
.ppm-plan.ppm-plan--selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.ppm-plan-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ppm-plan-price {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text);
}

.ppm-plan-permonth {
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 2px;
}

/* Plan Badges */
.ppm-badge {
  position: absolute;
  top: -8px; left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 800;
  background: var(--surface-3);
  color: var(--text-2);
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.ppm-badge.ppm-badge--hot {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(22,163,74,0.15);
}

.ppm-continue {
  width: 100%;
  padding: 10px;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}
.ppm-continue:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.ppm-continue:disabled {
  background: var(--surface-3);
  border-color: var(--border);
  color: var(--text-faint);
  cursor: not-allowed;
}

.ppm-back {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: underline;
  margin-top: 12px;
  display: inline-block;
}

/* Payment Methods Step */
.pay-method-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pay-method-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
  transition: all 0.1s;
  text-align: left;
  font-family: inherit;
}
.pay-method-item:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.pay-method-icon {
  width: 26px; height: 26px;
  flex-shrink: 0;
}

.pay-method-meta {
  flex: 1; min-width: 0;
}

.pay-method-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.pay-method-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.pay-method-arrow {
  color: var(--text-faint);
  flex-shrink: 0;
}

/* Promo Wrap in Purchase Modal */
.pmm-promo {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--surface-2);
}

.pmm-promo-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-family: inherit;
  padding: 0;
}

.pmm-promo-box {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

#pmmPromoInput {
  flex: 1; min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  outline: none;
  background: var(--surface);
}

#pmmPromoApply {
  padding: 0 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

#pmmPromoMsg {
  font-size: 11px;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  margin-top: 8px;
}
#pmmPromoMsg.ok {
  background: var(--success-bg);
  color: var(--success);
}
#pmmPromoMsg.err {
  background: var(--danger-bg);
  color: var(--danger);
}

.pay-method-discount-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  background: var(--success-bg);
  color: var(--success);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

/* Hide sliding indicator to fix empty gap on left of bottom navigation */
.pill-tab-indicator {
  display: none !important;
}


/* ═══════════════════════════════════════════════════════════
   Семья (Family) — строгий светлый монохром, под стиль кабинета
   ═══════════════════════════════════════════════════════════ */

.pp-avatar--fam {
  background: linear-gradient(135deg, #3f3f46, #18181b);
  color: #fff;
}

/* Карточки вкладки */
.fam-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-top: 14px;
  box-shadow: var(--shadow-sm);
}
.fam-card-head { margin-bottom: 14px; }
.fam-card-title { font-size: 15px; font-weight: 700; color: var(--text); }
.fam-card-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

/* Плашка общей подписки */
.fam-plan { padding: 0; overflow: hidden; }
.fam-plan-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 18px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.fam-plan-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.fam-plan-status { font-size: 14px; font-weight: 650; color: var(--text); margin-top: 3px; }
.fam-plan-days { text-align: right; line-height: 1; white-space: nowrap; }
.fam-plan-days b { font-size: 26px; font-weight: 800; color: var(--text); }
.fam-plan-days small { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.fam-slots { padding: 16px 18px 4px; }
.fam-slots-top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-muted); margin-bottom: 8px; }
.fam-slots-top span:last-child { font-weight: 700; color: var(--text); }
.fam-slots-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 7px; }
.fam-slots-hint.fam-slots-warn { color: var(--warning); font-weight: 600; margin-top: 0; }

.fam-bar-wrap { height: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.fam-bar { height: 100%; border-radius: 4px; background: var(--accent); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.fam-bar.tone-warn { background: var(--warning); }
.fam-bar.tone-crit { background: var(--danger); }

.fam-plan-actions { display: flex; gap: 10px; padding: 16px 18px 18px; flex-wrap: wrap; }

/* Кнопки */
.fam-btn {
  appearance: none; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 13.5px; font-weight: 650; font-family: inherit;
  padding: 10px 16px; border-radius: 10px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
}
.fam-btn:hover { background: var(--surface-2); }
.fam-btn:active { transform: translateY(1px); }
.fam-btn.sm { padding: 7px 12px; font-size: 12.5px; border-radius: 8px; }
.fam-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; flex: 1; }
.fam-btn-primary:hover { background: var(--primary-hover); }
.fam-btn-ghost { background: var(--surface); }
.fam-btn.danger { color: var(--danger); border-color: var(--border-strong); }
.fam-btn.danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.fam-leave { width: 100%; margin-top: 14px; }

/* Приглашение (входящее) */
.fam-invite-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent); border-radius: 12px;
  padding: 14px 16px; margin-top: 14px; box-shadow: var(--shadow-sm);
  animation: fadeUp .3s ease both;
}
.fam-invite-ico {
  flex: none; width: 40px; height: 40px; border-radius: 10px;
  background: var(--surface-2); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.fam-invite-body { flex: 1; min-width: 0; }
.fam-invite-title { font-size: 14px; font-weight: 700; color: var(--text); }
.fam-invite-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.fam-invite-actions { display: flex; gap: 8px; flex: none; }
.fam-invite-actions .fam-btn { padding: 8px 14px; }
.fam-invite-actions .fam-btn-primary { flex: none; }

@media (max-width: 560px) {
  .fam-invite-card { flex-wrap: wrap; }
  .fam-invite-actions { width: 100%; }
  .fam-invite-actions .fam-btn { flex: 1; }
}

/* Участники */
.fam-members { display: flex; flex-direction: column; gap: 4px; }
.fam-role {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  padding: 2px 7px; border-radius: 20px; margin-left: 6px; vertical-align: middle;
  background: var(--surface-3); color: var(--text-muted);
}
.fam-role.owner { background: var(--accent); color: #fff; }

/* Отправленные приглашения */
.fam-pending-wrap { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.fam-pending-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); margin-bottom: 8px; }
.fam-pending {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 0;
}
.fam-pending-main { min-width: 0; }
.fam-pending-name { font-size: 13.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.fam-pending-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

/* Форма приглашения */
.fam-add-row { display: flex; gap: 10px; margin-top: 16px; }
.fam-input {
  flex: 1; min-width: 0; font-family: inherit; font-size: 13.5px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 14px; border-radius: 10px; outline: none;
  transition: border-color .15s, background .15s;
}
.fam-input:focus { border-color: var(--border-focus); background: var(--surface); }
.fam-input::placeholder { color: var(--text-faint); }
.fam-add-row .fam-btn-primary { flex: none; }

.fam-add-device {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 10px; padding: 11px; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; color: var(--text-muted);
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 10px;
  transition: background .15s, color .15s, border-color .15s;
}
.fam-add-device:hover { background: var(--surface-2); color: var(--text); border-color: var(--text-faint); }

/* Ключ участника */
.fam-key-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.fam-key-label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 6px; }
.fam-key-val {
  font-family: 'SF Mono', ui-monospace, Menlo, Consolas, monospace; font-size: 12px;
  color: var(--text-2); word-break: break-all; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; line-height: 1.5;
}
.fam-key-actions { display: flex; gap: 10px; margin-top: 12px; }

/* Пустое состояние / CTA */
.fam-empty { text-align: center; color: var(--text-muted); font-size: 13.5px; padding: 26px 12px; }
.fam-cta { text-align: center; padding: 30px 20px; }
.fam-cta-ico {
  width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 16px;
  background: var(--surface-2); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.fam-cta-title { font-size: 17px; font-weight: 750; color: var(--text); }
.fam-cta-sub { font-size: 13px; color: var(--text-muted); margin: 8px auto 18px; max-width: 340px; line-height: 1.55; }
.fam-cta .fam-btn { display: inline-block; padding: 11px 24px; }

/* Бейдж «ожидают приглашения» на пункте навигации */
.fam-nav-badge {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.side-nav-item .fam-nav-badge { margin-left: auto; }
.pill-tab { position: relative; }
.pill-tab .fam-nav-badge { position: absolute; top: 3px; right: 50%; transform: translateX(16px); }

/* Появление карточек — под стиль кабинета */
#page-family.active .fam-card { animation: fadeUp .34s ease both; }
#page-family.active .fam-card:nth-child(2) { animation-delay: .04s; }
#page-family.active .fam-card:nth-child(3) { animation-delay: .08s; }

@media (prefers-reduced-motion: reduce) {
  #page-family.active .fam-card,
  .fam-invite-card { animation: none; }
  .fam-bar { transition: none; }
}


/* Семья: настройки участника (лимит + сервера) — Фаза 2 */
.fam-set-field { margin-top: 16px; text-align: left; }
.fam-set-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.fam-set-gb { display: flex; align-items: center; gap: 8px; }
.fam-set-gb .fam-input { width: 130px; flex: none; }
.fam-set-gb span { font-size: 13px; color: var(--text-muted); }
.fam-set-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 7px; line-height: 1.45; }
.fam-set-servers { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.fam-set-srv {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
  font-size: 13.5px; color: var(--text); transition: background .15s, border-color .15s;
}
.fam-set-srv:hover { background: var(--surface-2); border-color: var(--border-strong); }
.fam-set-srv input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; margin: 0; }

.fam-mylimit {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 14px;
}
.fam-mylimit span { font-size: 12.5px; color: var(--text-muted); }
.fam-mylimit b { font-size: 13.5px; color: var(--text); font-weight: 700; }
.fam-mylimit.capped { border-color: var(--danger); background: var(--danger-bg); }
.fam-mylimit.capped b { color: var(--danger); }
