:root {
  --accent-start: #8b5cf6;
  --accent-end: #4f6ef7;
  --bg: #07070c;
  --surface: #121218;
  --border: #26262f;
  --text: #f2f2f6;
  --text-dim: #9497a6;
  --error: #f87171;

  /* entrance stagger: N-th element delay = --entrance-stagger * N (login.js order) */
  --entrance-duration: 500ms;
  --entrance-stagger: 120ms;

  /* login.js: transitionCard — popup resizes to the next step, then swaps content */
  --resize-duration: 260ms;
  --card-fade-duration: 150ms;

  /* distance from the viewport edge to any content on the login/info screens —
     every gutter below derives from this so the two sides stay symmetric */
  --page-gutter: 64px;
}

@media (max-width: 860px) {
  :root {
    --page-gutter: 20px;
  }
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  height: 100%;
  /* no background here on purpose: body is a normal in-flow box, painted
     *after* negative z-index descendants (docs Appendix E step 3 vs step 2)
     — an opaque body background would sit on top of and hide .bg-video.
     html's background becomes the canvas background instead, which paints
     behind everything, negative z-index included. */
  color: var(--text);
  font-family:
    "Inter",
    "Manrope",
    system-ui,
    sans-serif;
}

#app {
  min-height: 100vh;
}

.screen-login {
  width: 100%;
  min-height: 100vh;
}

.login-layout {
  display: flex;
  min-height: 100vh;
}

.login-hero {
  position: relative;
  flex: 1 1 60%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--page-gutter);
  overflow: hidden;
}

.hero-wordmark {
  position: absolute;
  top: 40px;
  left: var(--page-gutter);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--text);
}

.wordmark-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.hero-headline {
  margin: 0 0 16px;
  max-width: 620px;
  font-size: clamp(32px, 4vw, 56px);
  font-weight: 800;
  line-height: 1.1;
}

.accent-text {
  background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-tagline {
  margin: 0;
  max-width: 480px;
  font-size: 18px;
  color: var(--text-dim);
}

.hero-highlight {
  margin: 12px 0 0;
  font-size: 18px;
  font-weight: 600;
  background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.secure-badge {
  position: absolute;
  left: var(--page-gutter);
  bottom: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
}

.secure-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-end);
}

.login-panel {
  flex: 0 0 468px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px var(--page-gutter) 24px 24px;
}

.back-to-pricing {
  display: block;
  width: 100%;
  margin-top: 16px;
  text-align: center;
}

@media (max-width: 860px) {
  .login-layout {
    flex-direction: column;
  }

  .login-hero {
    display: none;
  }

  .login-panel {
    flex: 1;
    min-height: 100vh;
    padding: 24px var(--page-gutter);
  }
}

/* ---- screen: info (landing) ---- */

.screen-info {
  width: 100%;
}

.landing-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.landing-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px var(--page-gutter) 0;
}

.nav-logo {
  font-size: 18px;
  font-weight: 800;
}

/* legal + support + locale, pinned bottom-right on every screen (bottom-left is
   taken by .secure-badge). Mounted once by main.js, outside the screen tree, so
   it survives navigation — hence position: fixed rather than in-flow.
   Deliberately quiet, but kept above the dim-text level so it stays legible. */
.site-footer {
  position: fixed;
  right: var(--page-gutter);
  bottom: 24px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  max-width: calc(100% - 2 * var(--page-gutter));
  font-size: 12px;
}

.site-footer a {
  color: #71747f;
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-footer a:hover {
  color: var(--text);
  text-decoration: underline;
}

.lang-switch {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.lang-tab {
  padding: 3px 9px;
  border: none;
  border-radius: 999px;
  background: none;
  color: #71747f;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}

.lang-tab:hover:not(.is-active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.lang-tab.is-active {
  color: #fff;
  background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
}

.landing-layout {
  display: flex;
  flex: 1;
}

.landing-hero {
  position: relative;
  flex: 1 1 60%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--page-gutter);
  overflow: hidden;
}

.feature-list {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 340px;
}

.feature-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.feature-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--accent-end);
}

.feature-label {
  flex: 1;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

.landing-panel {
  flex: 0 0 760px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px var(--page-gutter) 36px 36px;
}

/* pricing-card is ~1.5x the shared .auth-card/.btn baseline and styled after
   docs/front/ph4/screens/info.png — scoped overrides so login's card/buttons (same
   shared classes) aren't affected */
/* .auth-card is defined later in this file, so these two need the extra class
   to win on specificity rather than source order */
.auth-card.pricing-card {
  max-width: 660px;
  padding: 44px 40px;
  border-radius: 28px;
}

.auth-card.pricing-card h1 {
  font-size: 34px;
}

.pricing-card .auth-subtitle {
  font-size: 18px;
  margin-bottom: 4px;
}

.pricing-card .currency-switch {
  gap: 8px;
  margin: 28px 0 0;
}

.pricing-card .currency-tab {
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 15px;
}

/* one row while it fits, wraps instead of overflowing when it doesn't —
   the plan count comes from config, so it can't be hardcoded */
.pricing-card .price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 12px;
  margin: 24px 0 32px;
}

.pricing-card .price-tile {
  gap: 0;
  /* generous top padding reserves the badge row so terms line up across
     tiles whether or not a tile carries a badge (as in the reference) */
  padding: 46px 10px 30px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.02);
}

.pricing-card .price-term {
  width: 74%;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 16px;
  /* explicit, so the line box can't vary with font metrics (see .price-amount) */
  line-height: 1.25;
  text-align: center;
}

.pricing-card .price-amount {
  padding-top: 20px;
  font-size: 26px;
  letter-spacing: -0.01em;
  /* No webfont is bundled, so ₽ / $ / € can each be served by a *different*
     fallback font. With line-height:normal the line box takes that font's
     metrics, which made tiles differ in height per currency — an explicit
     line-height makes the box depend only on font-size. */
  line-height: 1.2;
  /* uniform digit widths so amounts don't jitter when switching currency */
  font-variant-numeric: tabular-nums;
}

/* highlighted plan: same box as every other tile (box-sizing keeps the outer
   size identical despite the thicker border) — it stands out purely through
   the gradient border and glow. The gradient needs the padding-box/border-box
   double background; a plain border can't hold a gradient. */
.pricing-card .price-tile-best {
  border: 2px solid transparent;
  background:
    linear-gradient(rgba(20, 20, 28, 0.92), rgba(20, 20, 28, 0.92)) padding-box,
    linear-gradient(150deg, var(--accent-start), #37b6f6) border-box;
  box-shadow: 0 0 34px rgba(139, 92, 246, 0.32);
}

.pricing-card .price-badge {
  top: 20px;
  padding: 5px 14px;
  font-size: 13px;
  letter-spacing: 0.06em;
}

.pricing-card .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  font-size: 21px;
  border-radius: 16px;
}

.pricing-card .btn-primary {
  box-shadow: 0 0 34px rgba(79, 110, 247, 0.4);
}

.pricing-card .btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 42px rgba(79, 110, 247, 0.55);
}

.pricing-card .btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 0 24px rgba(79, 110, 247, 0.35);
}

.pricing-card .btn:hover:not(:disabled) .btn-chevron {
  transform: translateX(4px);
}

.btn-chevron {
  display: inline-block;
  font-size: 0.85em;
  opacity: 0.8;
  transition: transform 0.18s ease;
}

.currency-switch {
  display: flex;
  gap: 6px;
  margin: 16px 0 4px;
}

.currency-tab {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background-color 0.15s ease,
    transform 0.15s ease;
}

.currency-tab:hover:not(.is-active) {
  color: var(--text);
  border-color: #34343f;
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-1px);
}

.currency-tab:active {
  transform: translateY(0) scale(0.97);
}

.currency-tab.is-active {
  color: var(--text);
  border-color: var(--accent-end);
  background: rgba(79, 110, 247, 0.12);
}

.currency-tab.is-active:hover {
  box-shadow: 0 0 18px rgba(79, 110, 247, 0.25);
}

.price-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 20px 0 24px;
}

.price-tile {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 4px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.price-tile:hover {
  border-color: #34343f;
  transform: translateY(-2px);
}

.price-tile-best {
  border-color: var(--accent-end);
  box-shadow: 0 0 24px rgba(79, 110, 247, 0.25);
}

/* user's chosen term (pay.js planHTML) — a distinct accent from -best's
   marketing badge so a selected-but-not-best tile still reads as selected */
.price-tile.is-selected {
  border-color: var(--accent-start);
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.28);
}

.price-badge {
  position: absolute;
  top: -11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
}

.price-check {
  position: absolute;
  top: -10px;
  right: -8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.price-term {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.price-amount {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .landing-layout {
    flex-direction: column;
  }

  .landing-hero {
    display: none;
  }

  .landing-panel {
    flex: 1;
    padding: 24px var(--page-gutter);
  }
}

/* ---- entrance: page-load stagger, form last ---- */

@keyframes entrance-fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-wordmark,
.hero-headline,
.hero-tagline,
.hero-highlight,
.secure-badge,
.login-panel .auth-card,
.nav-logo,
.nav-signin,
.feature-list,
.landing-panel .pricing-card {
  animation: entrance-fade-up var(--entrance-duration) ease both;
}

.hero-wordmark,
.nav-logo,
.nav-signin {
  animation-delay: calc(var(--entrance-stagger) * 1);
}
.hero-headline {
  animation-delay: calc(var(--entrance-stagger) * 2);
}
.hero-tagline {
  animation-delay: calc(var(--entrance-stagger) * 3);
}
.hero-highlight,
.feature-list {
  animation-delay: calc(var(--entrance-stagger) * 4);
}
.secure-badge {
  animation-delay: calc(var(--entrance-stagger) * 5);
}
.login-panel .auth-card,
.landing-panel .pricing-card {
  animation-delay: calc(var(--entrance-stagger) * 6);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.08);
}

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 24px;
  text-align: center;
}

.auth-subtitle {
  margin: 0 0 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---- component: input (components/input.js) ---- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
}

.field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s ease;
}

.field input::placeholder {
  color: var(--text-dim);
}

.field input:hover:not(:disabled) {
  border-color: #34343f;
}

.field input:focus {
  outline: none;
  border-color: var(--accent-end);
}

.field input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.field-error input {
  border-color: var(--error);
}

.field-error-text {
  margin: 0;
  font-size: 12px;
  color: var(--error);
}

.field-input-wrap {
  position: relative;
}

.field-input-wrap:has(.field-toggle) input {
  padding-right: 40px;
}

.field-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 6px;
  font-size: 15px;
  line-height: 1;
  color: var(--text-dim);
  cursor: pointer;
}

.field-toggle:hover {
  color: var(--text);
}

.auth-email-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
}

.link-inline {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  cursor: pointer;
}

.link-inline:hover {
  color: var(--text);
  text-decoration: underline;
}

.auth-form .link-inline {
  align-self: flex-end;
  margin-top: -8px;
}

.form-error {
  margin: 0;
  font-size: 13px;
  color: var(--error);
}

.form-info {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 0;
  color: var(--text-dim);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-telegram {
  display: block;
  margin-top: 16px;
  text-align: center;
  text-decoration: none;
}

/* ---- component: button (components/button.js) ---- */

.btn {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  /* .btn is used on <a> too (Connect now, Telegram) — keep them unadorned */
  text-align: center;
  text-decoration: none;
  transition:
    filter 0.15s ease,
    opacity 0.15s ease,
    background-color 0.15s ease,
    border-color 0.15s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-primary {
  background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn-primary:active:not(:disabled) {
  filter: brightness(0.92);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  border-color: #34343f;
  background: rgba(255, 255, 255, 0.03);
}

.btn-secondary:active:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
}

/* ---- screen: proxy (persistent authenticated chrome) ---- */

.screen-proxy {
  width: 100%;
  position: relative;
}

.bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 7, 12, 0);
  transition: background-color 0.4s ease;
  z-index: -1;
}

/* dashboard reads busier (menu, panels) — dim the background behind it;
   info/login stay on the plain, undimmed video (screens/proxy.js enter/exit) */
body.is-authenticated .bg-overlay {
  background: rgba(7, 7, 12, 0.55);
}

/* desktop: topbar full-width on top, sidebar (vertical menu) + content below,
   both topbar and sidebar stay put — only .dash-content scrolls internally.
   mobile: sidebar mirrors into a horizontal icon bar pinned under the topbar
   (docs/front/ph4/screens/proxy.png etc. for desktop; no mobile reference — this is our
   own adaptation, same visual language rotated 90°). */
.dash-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  /* bottom padding clears the fixed .site-footer instead of running under it */
  padding: 28px 36px 60px;
}

.dash-topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* unpaid-invoice indicator, next to the account menu (docs/front/ph4/screens/pay.png
   moved here from PaySection's own header — it needs to be visible from any
   section, not just while Pay is open; see .dash-menu-clock for its sidebar
   counterpart) */
.unpaid-topbar-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid rgba(230, 176, 46, 0.4);
  border-radius: 999px;
  background: rgba(230, 176, 46, 0.12);
  color: #e6b02e;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  opacity: 1;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    opacity 0.2s ease,
    transform 0.2s ease;
}

/* toggled by ProxyScreen.syncUnpaidBadge() — a class (not the `hidden`
   attribute) specifically so appearing/disappearing actually animates;
   `hidden` forces display:none immediately, which can't transition. Stays
   in normal flow (no display:none) so the fade is visible; pointer-events
   keeps it from intercepting clicks while invisible. */
.unpaid-topbar-badge.is-hidden {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
}

.unpaid-topbar-badge:hover {
  background: rgba(230, 176, 46, 0.2);
  border-color: rgba(230, 176, 46, 0.6);
  transform: translateY(-1px);
}

/* the account chip is the way into Settings (ProxyScreen's data-goto="settings") */
.dash-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.dash-account:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
}

.dash-avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.dash-account-name {
  font-size: 14px;
  font-weight: 600;
}

.dash-account-lines {
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* line-height fixed so the single-line (email only) and two-line (email +
     telegram) chips keep the same 30px avatar-height rhythm */
  line-height: 1.25;
}

.dash-account-email {
  font-size: 14px;
  font-weight: 600;
}

/* with a telegram line below, the email shrinks and rides above it */
.dash-account-stacked .dash-account-email {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
}

.dash-account-tg {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
}

.dash-account-tg svg {
  flex: none;
  color: #29a9eb;
}

.dash-account-login {
  color: var(--text-dim);
  font-weight: 500;
}

.dash-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* decorative gap between menu and content (docs/front/ph4/screens/proxy.png — the ghost
   silhouette bleeds through here). No generative particle canvas yet
   (docs/front/ph4/brandbook.md §6 — separate, bigger task). */
.dash-figure-gap {
  flex: none;
  width: 250px;
  position: relative;
  overflow: hidden;
}

.dash-sidebar {
  flex: none;
  width: 220px;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  background: linear-gradient(160deg, rgba(18, 18, 24, 0.25) 0%, rgba(18, 18, 24, 0.05) 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow-y: auto;
}

.dash-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background-color 0.15s ease;
}

.dash-menu-item:hover {
  color: var(--text);
}

.dash-menu-item.is-active {
  color: var(--text);
  border-color: var(--accent-end);
  background: rgba(79, 110, 247, 0.12);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
}

.dash-menu-icon {
  display: inline-flex;
  flex: none;
}

/* unpaid-invoice marker on the sidebar's Pay item (docs/front/ph4/screens/pay.png
   analogue — mirrors .unpaid-topbar-badge, visible regardless of which
   section is currently open) — visibility toggled by ProxyScreen.syncUnpaidBadge().
   A normal flex child (not absolutely positioned) pushed to the row's
   trailing edge via margin-left:auto — .dash-menu-item's own
   align-items:center then centers it vertically for free, no corner-anchor
   math to get wrong. */
.dash-menu-clock {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  color: #e6b02e;
  opacity: 1;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

/* see .unpaid-topbar-badge.is-hidden — same reasoning: a class instead of
   `hidden` so the fade actually plays */
.dash-menu-clock.is-hidden {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
}

.dash-menu-clock svg {
  width: 28px;
  height: 28px;
}

/* Subscription sidebar item's "link your Telegram" nudge — same
   show/hide mechanics as .dash-menu-clock (an always-present element,
   opacity/transform toggled via .is-hidden so it can animate) */
.dash-menu-tg-badge {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  color: #2ba0e2;
  opacity: 1;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.dash-menu-tg-badge.is-hidden {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
}

.dash-menu-tg-badge svg {
  width: 22px;
  height: 22px;
}

/* pushed to the opposite end of the sidebar from .dash-menu — bottom on
   desktop (column), right edge on mobile (row, see media query below) */
.dash-logout {
  margin-top: auto;
}

.dash-logout:hover {
  color: var(--error);
}

.dash-content {
  flex: 1;
  padding: 40px 48px;
  background: linear-gradient(160deg, rgba(18, 18, 24, 0.45) 0%, rgba(18, 18, 24, 0.45) 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow-y: auto;
}

/* ---- proxy: Connection section (docs/front/ph4/screens/proxy.png) ---- */

.dash-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 64px 0;
  color: var(--text-dim);
}

.dash-retry {
  width: auto;
  padding: 10px 20px;
}

.section-head h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
}

.section-sub {
  margin: 6px 0 0;
  color: var(--text-dim);
  font-size: 15px;
}

.block-label {
  margin: 26px 0 10px;
  color: var(--text-dim);
  font-size: 15px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  padding: 22px 24px;
}

.panel-title {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 700;
}

/* account */

.account-panel {
  margin-top: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.account-id {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.account-avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  color: #fff;
  font-size: 22px;
  font-weight: 700;
}

.account-lines {
  min-width: 0;
}

.account-name {
  font-size: 22px;
  font-weight: 700;
}

.account-email {
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.account-meta {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--text-dim);
  font-size: 14px;
}

.status-badge {
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid currentColor;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.status-active {
  color: #2ee6a6;
}

.status-expired {
  color: var(--error);
}

.status-limited {
  color: #e6b02e;
}

.status-disabled {
  color: var(--text-dim);
}

.account-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.account-actions .btn {
  width: auto;
  padding: 14px 22px;
  font-size: 15px;
}

/* traffic */

.traffic-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.traffic-used {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.traffic-dim {
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 400;
}

.traffic-bar {
  margin-top: 14px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.traffic-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-start), #37b6f6);
  transition: width 0.4s ease;
}

.traffic-left {
  margin: 12px 0 0;
  color: var(--text-dim);
  font-size: 14px;
}

/* key + how-to, side by side */

.conn-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.key-body {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.qr-box {
  flex: none;
  text-align: center;
}

.qr {
  width: 146px;
  height: 146px;
  padding: 8px;
  border-radius: 10px;
  background: #fff;
  color: #000;
}

.qr svg {
  width: 100%;
  height: 100%;
  display: block;
}

.qr-caption {
  margin: 10px 0 0;
  max-width: 146px;
  color: var(--text-dim);
  font-size: 12px;
}

.key-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.key-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-dim);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
}

.key-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  align-self: flex-start;
  padding: 8px 14px;
  font-size: 14px;
}

.key-copy-icon {
  display: inline-flex;
}

.key-hint {
  margin: 0;
  color: var(--text-dim);
  font-size: 12px;
}

/* how to connect */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.steps + .link-inline {
  display: inline-block;
  margin-top: 16px;
}

.step {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 15px;
}

.step-num {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
}

.step-num-1 {
  color: var(--accent-start);
  border-color: rgba(139, 92, 246, 0.5);
}

.step-num-2 {
  color: #37b6f6;
  border-color: rgba(55, 182, 246, 0.5);
}

/* telegram link banner */

.tg-panel {
  margin-top: 26px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.tg-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #2ba0e2;
  color: #fff;
}

.tg-lines {
  flex: 1;
  min-width: 200px;
}

.tg-lines strong {
  font-size: 18px;
  font-weight: 700;
}

.tg-lines p {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 14px;
}

.tg-panel .btn {
  width: auto;
  padding: 12px 20px;
  font-size: 15px;
}

.tg-waiting {
  color: var(--text-dim);
  font-size: 14px;
}

.tg-panel-linked .tg-icon {
  background: #2ee6a6;
}

/* ---- Subscription section: connected devices (screens/proxy.js
   devicesPanelHTML()) ---- */

.devices-panel {
  margin-top: 20px;
}

.devices-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.devices-head .panel-title {
  margin-bottom: 0;
}

.devices-quota {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
}

.devices-quota-empty {
  color: #e6b02e;
}

.devices-quota-reset {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-dim);
}

.devices-empty {
  margin: 18px 0 0;
  color: var(--text-dim);
  font-size: 14px;
}

.device-list {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.device-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.device-item:first-child {
  border-top: none;
  padding-top: 0;
}

.device-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
}

.device-info {
  flex: 1;
  min-width: 0;
}

.device-name {
  font-size: 15px;
  font-weight: 600;
}

.device-meta {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-remove-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.device-remove-btn:hover:not(:disabled) {
  color: var(--error);
  border-color: var(--error);
  background: rgba(230, 62, 62, 0.08);
}

.device-remove-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.devices-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--text-dim);
  animation: devices-spin 0.7s linear infinite;
}

@keyframes devices-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 860px) {
  .section-head h1 {
    font-size: 26px;
  }

  .key-body {
    flex-direction: column;
    align-items: stretch;
  }

  .qr-box {
    align-self: center;
  }

  .account-actions .btn {
    flex: 1;
  }
}

.dash-placeholder {
  margin: 0;
  padding: 48px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 22px;
}

@media (max-width: 860px) {
  .dash-shell {
    gap: 12px;
    padding: 16px;
  }

  .dash-body {
    flex-direction: column;
    gap: 12px;
  }

  .dash-figure-gap {
    display: none;
  }

  .dash-sidebar {
    width: auto;
    flex-direction: row;
    align-items: center;
    background: none;
    border: none;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
    padding: 0 0 12px;
    overflow-x: auto;
    overflow-y: visible;
  }

  .dash-menu {
    flex-direction: row;
    gap: 4px;
  }

  .dash-menu-item {
    padding: 8px 12px;
    border-radius: 999px;
  }

  .dash-menu-label {
    display: none;
  }

  .dash-logout {
    margin-top: 0;
    margin-left: auto;
  }

  .dash-content {
    padding: 24px 20px;
    background: none;
    border: none;
    border-radius: 0;
  }

  /* a long email must not push the logo out of the topbar */
  .dash-account-email,
  .dash-account-tg-name {
    max-width: 38vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ---- proxy: Pay section (docs/front/ph4/screens/pay.png) ---- */

/* wraps each render()'s dynamic body (pay.js and invoices.js both use this) —
   every render fully replaces its content with fresh DOM nodes, so reusing
   the existing entrance-fade-up keyframe here just means "whatever appears,
   fades in" — snappier than the page-load entrance since this fires on
   ordinary interaction (term/currency pick, phase change), not first paint */
.pay-fade {
  animation: entrance-fade-up 200ms ease both;
}

.back-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 20px;
  background: none;
  border: none;
  padding: 0;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: var(--text);
}

.section-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.pay-history-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.history-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  padding: 10px 16px;
  font-size: 14px;
}

.history-btn-icon {
  display: inline-flex;
}

.pay-method-hint {
  margin: 0 0 12px;
  color: var(--text-dim);
  font-size: 13px;
}

.pay-methods {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pay-method {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    transform 0.15s ease;
}

.pay-method:hover:not(:disabled) {
  border-color: var(--accent-end);
  background: rgba(79, 110, 247, 0.08);
  transform: translateY(-1px);
}

.pay-method:disabled {
  opacity: 0.5;
  cursor: default;
}

.pay-method-chevron {
  color: var(--text-dim);
  font-size: 18px;
}

.pay-creating {
  padding: 24px 0;
}

/* active/expired invoice card — centered (unlike the plan/method grids above
   it, which stay left-aligned and full-width) */
.pay-card {
  margin: 26px auto 0;
  max-width: 460px;
}

.pay-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(79, 110, 247, 0.15);
  color: #8fb3ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.pay-card-expired .pay-badge {
  background: rgba(248, 113, 113, 0.15);
  color: var(--error);
}

.pay-amount {
  margin: 14px 0 20px;
  font-size: 36px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.pay-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.pay-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}

.pay-row-label {
  color: var(--text-dim);
}

.pay-timer {
  color: #37b6f6;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pay-expired-badge {
  color: var(--error);
  font-weight: 700;
}

.pay-expired-note {
  margin: 16px 0 0;
  color: var(--text-dim);
  font-size: 13px;
}

.pay-card .btn,
.pay-go {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ---- proxy: data table + pagination (docs/front/ph4/screens/invoice.png) ----
   shared visual system: invoices history today, payouts history reuses the
   same .data-table/.pagination classes when it's built */

.invoices-filters {
  margin: 24px 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.filter-select:hover {
  border-color: #34343f;
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent-end);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
}

.icon-btn:hover {
  border-color: #34343f;
  color: var(--text);
}

.data-table {
  display: flex;
  flex-direction: column;
}

.table-row {
  display: grid;
  grid-template-columns:
    minmax(100px, 1fr) minmax(80px, 0.9fr) minmax(130px, 1.3fr) minmax(120px, 1fr)
    minmax(90px, 0.9fr);
  align-items: center;
  gap: 12px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.table-row:last-child {
  border-bottom: none;
}

.table-head {
  padding-top: 0;
  padding-bottom: 12px;
  color: var(--text-dim);
  font-size: 13px;
}

.table-row-highlight {
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
  border-radius: 10px;
  background: rgba(79, 110, 247, 0.06);
}

.invoice-amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.invoice-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.invoice-status.is-new {
  background: rgba(79, 110, 247, 0.15);
  color: #8fb3ff;
}

.invoice-status.is-paid {
  background: rgba(46, 230, 166, 0.15);
  color: #2ee6a6;
}

.invoice-status.is-partially-paid {
  background: rgba(230, 176, 46, 0.15);
  color: #e6b02e;
}

.invoice-status.is-expired {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}

.invoice-status.is-canceled {
  background: rgba(248, 113, 113, 0.15);
  color: var(--error);
}

.table-action {
  text-align: right;
}

.invoice-action {
  display: inline-flex;
  width: auto;
  padding: 8px 16px;
  font-size: 13px;
}

.pagination {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.pagination-range {
  color: var(--text-dim);
  font-size: 13px;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background-color 0.15s ease;
}

.page-btn:hover:not(:disabled):not(.is-active) {
  border-color: #34343f;
  background: rgba(255, 255, 255, 0.04);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.page-btn.is-active {
  border-color: var(--accent-end);
  color: #fff;
  background: rgba(79, 110, 247, 0.15);
  box-shadow: 0 0 14px rgba(79, 110, 247, 0.25);
}

.page-nav {
  color: var(--text-dim);
}

.page-ellipsis {
  padding: 0 4px;
  color: var(--text-dim);
  font-size: 13px;
}

.page-size-select {
  width: auto;
}

@media (max-width: 860px) {
  .section-head-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .pay-history-nav {
    align-items: flex-start;
  }

  .data-table {
    overflow-x: auto;
  }

  .table-row {
    min-width: 640px;
  }
}

/* ---- proxy: Referrals + Payouts (docs/front/ph4/screens/refferal.png, payouts.png) ----
   buttons/links here are the same .btn/.link-inline/.key-copy classes used on
   the Pay screen, so hover/active feel identical by construction rather than
   by copy-pasting transitions */

.ref-links-panel {
  margin-top: 26px;
}

.ref-link-row + .ref-link-row {
  margin-top: 18px;
}

.ref-link-label {
  margin: 0 0 8px;
}

.ref-link-value-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ref-link-value {
  flex: 1;
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-links-panel .key-hint {
  margin-top: 16px;
}

.ref-stats-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.ref-stat {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ref-stat-amount {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ref-stat-balance .btn {
  width: auto;
  align-self: flex-start;
  padding: 10px 20px;
  font-size: 14px;
}

.ref-level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: 50%;
  border: 1px solid var(--accent-end);
  color: var(--accent-end);
  font-size: 12px;
  font-weight: 700;
}

/* levels table (ref.js) and withdrawal history (payouts.js) are both 4
   columns, unlike invoices' 5 — override .table-row's grid just for these */
.ref-levels-table .table-row {
  grid-template-columns: minmax(110px, 1.3fr) minmax(70px, 0.8fr) minmax(90px, 0.9fr) minmax(110px, 1fr);
}

.invoice-status.is-pending {
  background: rgba(79, 110, 247, 0.15);
  color: #8fb3ff;
}

.invoice-status.is-done {
  background: rgba(46, 230, 166, 0.15);
  color: #2ee6a6;
}

/* withdrawal request form (payouts.js) */

.wd-form-panel {
  margin-top: 26px;
}

.wd-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.wd-form-head .panel-title {
  margin: 0;
}

.wd-form-row {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

.wd-form-balance {
  flex: 1;
  min-width: 160px;
}

.wd-form-amount {
  flex: 1;
  min-width: 160px;
}

.wd-amount-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  transition: border-color 0.15s ease;
}

.wd-amount-input-wrap:focus-within {
  border-color: var(--accent-end);
}

.wd-amount-prefix {
  color: var(--text-dim);
  font-size: 14px;
}

.wd-amount-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  padding: 10px 0;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.wd-amount-input:focus {
  outline: none;
}

.wd-form-row .btn {
  width: auto;
  padding: 12px 24px;
  font-size: 15px;
}

.wd-form-panel .form-error,
.wd-form-panel .key-hint {
  margin-top: 16px;
}

@media (max-width: 860px) {
  .ref-levels-table .table-row {
    min-width: 480px;
  }

  .wd-form-row {
    align-items: stretch;
  }

  .wd-form-row .btn {
    width: 100%;
  }
}

/* ---- Connection section (screens/proxy.js connectionHTML()): apps table +
   FAQ below the key/how-to grid, rendered inside the dashboard's regular
   .panel cards ---- */

.apps-panel {
  margin-top: 20px;
}

.apps-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.apps-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

.apps-table th,
.apps-table td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.apps-table th {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.apps-table tr:last-child td {
  border-bottom: none;
}

.apps-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.apps-os {
  font-weight: 700;
  white-space: nowrap;
}

.apps-os-icon {
  display: inline-block;
  margin-right: 8px;
}

.apps-dl {
  display: inline-flex;
  width: auto;
  padding: 8px 16px;
  font-size: 13px;
}

.faq-panel {
  margin-top: 20px;
}

.faq-item {
  border-top: 1px solid var(--border);
  padding: 16px 0;
}

.faq-item:first-of-type {
  border-top: none;
  padding-top: 0;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::before {
  content: "+";
  display: inline-block;
  width: 18px;
  color: var(--text-dim);
}

.faq-item[open] summary::before {
  content: "\2212";
}

.faq-item p {
  margin: 10px 0 0 18px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
}

/* ---- proxy: Settings section (screens/settings.js) ---- */

.settings-panel {
  margin-top: 20px;
  max-width: 560px;
}

.settings-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.settings-head .panel-title {
  margin: 0 0 4px;
}

.settings-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-dim);
}

/* the address / hint under a card's title */
.settings-current {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  word-break: break-all;
}

.settings-note {
  margin: 0 0 4px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.5;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* buttons sit side by side, each only as wide as it needs to be — .btn is
   full-width by default (the login card is a single column of them) */
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-actions .btn {
  width: auto;
  min-width: 150px;
}

.settings-panel .form-error,
.settings-panel .form-info {
  margin-top: 14px;
}

/* why the other card's start button is disabled while a flow is running */
.settings-blocked {
  margin-top: 12px;
}

/* ---- proxy: Support section (dashboard tab, screens/support.js) ---- */

/* fills the dash-content box exactly (see .dash-content's flex sizing inside
   .dash-body) so only .support-messages scrolls, not the whole section —
   the input row stays pinned at the bottom instead of scrolling away */
.support-section {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 20px;
}

.support-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.support-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.support-messages-center {
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

.support-message {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 3px;
  /* every status below only ever changes background/border/color/filter —
     one transition list covers hover *and* a sending -> failed status flip */
  transition:
    filter 0.15s ease,
    background-color 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}

.support-message p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* delivered (the default, no status modifier) — same hover language as
   .dash-menu-item/.btn-secondary: a touch of background/border, a small lift */
.support-message.is-support {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.support-message.is-support:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #34343f;
  transform: translateY(-1px);
}

.support-message.is-user {
  align-self: flex-end;
  background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* .btn-primary's own hover: brighten instead of recolor, so it still reads
   as "the same gradient" rather than a status change */
.support-message.is-user:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* sending — a soft, slightly desaturated breathing pulse instead of a flat
   opacity so "in flight" reads as active rather than merely dimmed */
.support-message.is-pending {
  animation: support-message-pulse 1.4s ease-in-out infinite;
}

.support-message.is-pending:hover {
  animation-play-state: paused;
  filter: brightness(1.08);
}

@keyframes support-message-pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 0.85;
  }
}

.support-message.is-failed {
  background: rgba(248, 113, 113, 0.14);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: var(--text);
}

.support-message.is-failed:hover {
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(248, 113, 113, 0.65);
  transform: translateY(-1px);
}

.support-message-time {
  align-self: flex-end;
  font-size: 10px;
  opacity: 0.7;
}

.support-message-error {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--error);
}

.support-retry,
.support-dismiss {
  border: none;
  background: none;
  color: inherit;
  padding: 2px;
  cursor: pointer;
  display: inline-flex;
  border-radius: 6px;
  transition: background-color 0.15s ease;
}

.support-retry:hover:not(:disabled),
.support-dismiss:hover {
  background: rgba(255, 255, 255, 0.15);
}

.support-retry:disabled {
  opacity: 0.6;
  cursor: default;
}

.support-retry .support-cooldown {
  font-size: 10px;
}

.support-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease;
}

.support-attachment:hover {
  background: rgba(255, 255, 255, 0.2);
}

.support-form {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border);
}

.support-attach-btn,
.support-send-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.support-attach-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.support-send-btn {
  background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
  color: #fff;
}

.support-send-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.support-cooldown {
  font-size: 11px;
  font-weight: 700;
}

.support-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13px;
}

.support-input:disabled {
  opacity: 0.6;
}

.support-input:focus {
  outline: none;
  border-color: var(--accent-end);
}

.support-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: currentColor;
  animation: devices-spin 0.7s linear infinite;
}

/* sidebar unread indicator — plain dot rather than a numeric badge, matching
   the notification-dot idiom instead of .unpaid-topbar-badge's pill+count
   (that one names an amount; this only ever means "there's something new") */
.dash-menu-support-badge {
  display: inline-flex;
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--error);
  opacity: 1;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.dash-menu-support-badge.is-hidden {
  opacity: 0;
  transform: scale(0.5);
  pointer-events: none;
}
