:root {
  color-scheme: dark;
  --bg: #101413;
  --recess: #0d1110;
  --bevel: #080b09;
  --chrome: rgba(15, 20, 17, .96);
  --grid-line: rgba(255, 222, 130, .035);
  --gold-text: #ffda58;
  --surface: #13171f;
  --surface-2: #191f2a;
  --surface-hover: #1f2633;
  --border: #26303f;
  --border-strong: #334155;
  --text: #f3f5f8;
  --muted: #93a1b5;
  --gold: #ffd22f;
  --gold-dark: #c99700;
  --emerald: #22c55e;
  --emerald-dark: #15803d;
  --sky: #38bdf8;
  --sky-dark: #0369a1;
  --primary: #2f81f7;
  --primary-dark: #1d4ed8;
  --amber: #f97316;
  --danger: #ef4444;
  --danger-dark: #991b1b;
  --radius: 14px;
  --radius-sm: 10px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  overscroll-behavior-y: none;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  margin: 0;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.85rem;
}

.center {
  text-align: center;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.gold {
  color: var(--gold-text);
}

.mt-lg {
  margin-top: 28px;
}

/* Tactile Voxel Card */
.voxel-card {
  min-width: 0;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 0 var(--bevel), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.card-pad {
  padding: 20px;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}

.card-title {
  font-size: 1.35rem;
}

.card-subtitle {
  font-size: 1.08rem;
}

.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

/* Buttons with tactile bevel */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease, background-color 0.15s ease;
  color: #fff;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(2px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.82rem;
}

.btn-emerald {
  background: var(--emerald);
  border-color: #4ade80;
  color: #052e16;
  box-shadow: 0 3px 0 var(--emerald-dark);
}

.btn-emerald:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-sky {
  background: var(--primary);
  border-color: #60a5fa;
  color: #fff;
  box-shadow: 0 3px 0 var(--primary-dark);
}

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

.btn-danger {
  background: var(--danger);
  border-color: #f87171;
  color: #fff;
  box-shadow: 0 3px 0 var(--danger-dark);
}

.btn-ghost {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: 0 3px 0 var(--bevel);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
}

.btn-group-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

/* Inputs */
.voxel-input {
  width: 100%;
  background: var(--recess);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 13px;
  font-size: 0.94rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s ease;
}

.voxel-input:focus {
  border-color: var(--gold);
}

.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Tags & Pills */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.tag-gold {
  background: rgba(255, 210, 47, 0.14);
  color: var(--gold-text);
  border: 1px solid rgba(255, 210, 47, 0.35);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 700;
}

.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-pill.online {
  background: rgba(34, 197, 94, 0.14);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.32);
}

.status-pill.online::before {
  background: #4ade80;
}

.status-pill.waiting {
  background: rgba(255, 210, 47, 0.14);
  color: #ffd22f;
  border: 1px solid rgba(255, 210, 47, 0.38);
}

.status-pill.waiting::before {
  background: #ffd22f;
  box-shadow: 0 0 0 0 rgba(255, 210, 47, 0.75);
  animation: status-pulse 1.5s ease-in-out infinite;
}

@keyframes status-pulse {
  0% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(255, 210, 47, 0.75);
  }
  55% {
    opacity: 0.35;
    box-shadow: 0 0 0 5px rgba(255, 210, 47, 0);
  }
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(255, 210, 47, 0);
  }
}

.status-pill.offline {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.28);
}

.status-pill.offline::before {
  background: #f87171;
}

.invoice-amount-tag {
  font-size: 1.05rem;
  padding: 6px 12px;
  border-width: 1.5px;
  letter-spacing: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Auth View */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 470px;
  overflow: hidden;
}

.auth-banner {
  position: relative;
  height: 156px;
  background: linear-gradient(135deg, #1b2230 0%, #10151d 100%);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.auth-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.auth-banner-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 14, 18, 0.15) 0%, rgba(19, 23, 31, 0.92) 100%);
}

.auth-brand-badge {
  position: absolute;
  left: 16px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  background: rgba(11, 14, 18, 0.85);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.verity-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
}

.auth-body {
  padding: 22px;
}

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

.auth-head h1 {
  font-size: 1.35rem;
}

.mascot-box {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.mascot-mini {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.inline-alert {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 0.86rem;
}

.waiting-box {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
}

.waiting-title {
  font-weight: 600;
  font-size: 0.92rem;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--gold-text);
  border-radius: 50%;
  flex-shrink: 0;
  animation: spin 0.8s linear infinite;
}

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

.auth-footnote {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

.auth-footnote code {
  color: var(--gold-text);
  font-family: var(--font-mono);
}

/* Header & Navigation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding-top: var(--tg-content-safe-area-inset-top, 0px);
  background: var(--chrome);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--text);
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.08rem;
}

.brand-sub {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-tab:hover {
  color: var(--text);
}

.nav-tab.active {
  background: var(--surface-2);
  color: var(--gold-text);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.balance-pill,
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.balance-pill:hover,
.user-pill:hover {
  background: var(--surface-2);
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
}

/* Main Content */
.main-wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 24px 86px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.trial-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  margin-bottom: 18px;
  border-color: rgba(255, 210, 47, 0.35);
  background: linear-gradient(90deg, rgba(255, 210, 47, 0.08), var(--surface) 55%);
}

.trial-strip-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.trial-strip h2 {
  font-size: 1.1rem;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(340px, 1fr);
  gap: 20px;
  align-items: start;
}

.col-main,
.col-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.meta-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--recess);
  border: 1px solid var(--border);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-label {
  font-size: 0.74rem;
  color: var(--muted);
}

.meta-val {
  font-size: 0.88rem;
  font-weight: 600;
}

/* Voxel Progress Bars */
.meters-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.meter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-bottom: 6px;
}

.meter-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.86rem;
  font-weight: 600;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.dot-sky { background: var(--sky); }
.dot-amber { background: var(--amber); }

.voxel-bar {
  height: 12px;
  background: var(--recess);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  padding: 2px;
}

.voxel-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.35s ease;
}

.fill-sky {
  background: repeating-linear-gradient(
    90deg,
    var(--sky) 0 12px,
    rgba(255, 255, 255, 0.25) 12px 13px
  );
}

.fill-amber {
  background: repeating-linear-gradient(
    90deg,
    var(--amber) 0 12px,
    rgba(255, 255, 255, 0.25) 12px 13px
  );
}

/* Keys List */
.keys-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.key-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  background: var(--recess);
  border: 1px solid var(--border);
}

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

.key-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold-text);
  margin-bottom: 2px;
}

.key-code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* QR Card */
.qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.qr-frame {
  width: 196px;
  height: 196px;
  background: #ffffff;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-strong);
}

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

.qr-empty {
  color: #475569;
  padding: 14px;
}

.stat-duo {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.stat-mini {
  background: var(--recess);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
}

.copy-field {
  display: flex;
  gap: 8px;
}

/* Tariffs & BS */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.device-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill-group {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

.pill-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
}

.pill-btn.active {
  background: var(--gold);
  color: #111;
}

.tariffs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.tariff-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  gap: 16px;
}

.tariff-card.current {
  border-color: rgba(34, 197, 94, 0.78);
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.11) 0%, var(--surface) 58%);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25), 0 8px 24px rgba(34, 197, 94, 0.12);
}

.tariff-active-pill:disabled {
  opacity: 1;
  cursor: default;
}

.tag-sky {
  background: rgba(59, 130, 246, 0.16);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.38);
}

.tariff-price {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  margin: 6px 0;
  white-space: nowrap;
}

.tariff-specs {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--muted);
}

.tariff-specs strong {
  color: var(--text);
}

.bs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

/* Topup Layout */
.topup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.pay-amount-box {
  background: var(--recess);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 16px;
}

.amount-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}

.chip {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 8px;
  cursor: pointer;
}

.chip.active {
  border-color: var(--gold);
  color: var(--gold-text);
  background: rgba(255, 210, 47, 0.1);
}

.rate-preview {
  white-space: nowrap;
}

.pay-methods-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.pay-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  transition: transform 0.08s ease, filter 0.15s ease;
}

.pay-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
}

.pay-icon {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  object-fit: contain;
  flex-shrink: 0;
  pointer-events: none;
}

.pay-icon-lg {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  object-fit: contain;
  flex-shrink: 0;
}

.pay-btn:active {
  transform: translateY(2px);
}

.pay-btn.span-3 {
  grid-column: span 3;
}

.pay-btn.style-success {
  background: #2f7d44;
  border-color: #46a35e;
  box-shadow: 0 3px 0 #1b4d29;
}

.pay-btn.style-primary {
  background: #2a5f7a;
  border-color: #3c82a5;
  box-shadow: 0 3px 0 #173747;
}

.pay-btn.style-default {
  background: #1b222c;
  border-color: var(--border-strong);
  box-shadow: 0 3px 0 #0e1218;
}

.pay-btn.style-danger {
  background: #dc2626;
  border-color: #f87171;
  box-shadow: 0 3px 0 #7f1d1d;
  color: #ffffff;
}

.voxel-input.input-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}

.pay-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.invoice-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 12px;
  gap: 10px;
}

.small-mascot {
  width: 58px;
  height: 58px;
}

.invoice-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0;
}

.inv-row {
  background: var(--recess);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Devices, Tx & Guide */
.devices-list,
.tx-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.device-row,
.tx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  background: var(--recess);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.promo-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.guide-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.guide-step {
  background: var(--recess);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(255, 210, 47, 0.14);
  color: var(--gold-text);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  margin-bottom: 10px;
}

/* Toast */
.toast-root {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}

.toast {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  font-size: 0.86rem;
  font-weight: 500;
}

.toast.ok { border-left: 3px solid var(--emerald); }
.toast.err { border-left: 3px solid var(--danger); }

.btn-lg {
  padding: 13px 20px;
  font-size: 0.98rem;
}

.tag-emerald {
  background: rgba(34, 197, 94, 0.16);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.38);
}

/* Onboarding Wizard */
.onb-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.onb-wrap {
  width: 100%;
  max-width: 720px;
}

.onb-welcome-card {
  max-width: 520px;
  margin: 0 auto;
  overflow: hidden;
}

.onb-welcome-body {
  padding: 22px;
}

.onb-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.onb-trial-box {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.12), rgba(255, 210, 47, 0.06));
  border: 1px solid rgba(34, 197, 94, 0.45);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.onb-trial-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.onb-plans-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.onb-plan-item {
  background: var(--recess);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.onb-devices-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.onb-summary-box {
  background: var(--recess);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.onb-connected-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.onb-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

@media (max-width: 720px) {
  .onb-plans-grid,
  .onb-devices-grid,
  .onb-connected-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile Bottom Nav */
.mobile-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: var(--chrome);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}

.m-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 8px 4px;
  border-radius: 8px;
  cursor: pointer;
}

.m-tab.active {
  color: var(--gold-text);
  background: var(--surface);
}

@media (max-width: 920px) {
  .desktop-nav { display: none; }
  .mobile-nav { display: flex; }
  .topbar-inner { padding: 10px 12px; gap: 8px; }
  .brand-sub { display: none; }
  .user-pill { max-width: 112px; overflow: hidden; text-overflow: ellipsis; }
  .main-wrap { padding: 14px 12px 86px; }
  .card-pad { padding: 16px; }
  .card-header-row { flex-wrap: wrap; }
  .overview-grid,
  .topup-layout,
  .tariffs-grid,
  .bs-grid,
  .guide-steps {
    grid-template-columns: 1fr;
  }
  .meta-strip {
    grid-template-columns: 1fr;
  }
  .trial-strip {
    flex-direction: column;
    align-items: flex-start;
  }
  .input-row {
    flex-direction: column;
    align-items: stretch;
  }
  .key-item {
    flex-direction: column;
    align-items: stretch;
  }
  .pay-methods-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pay-btn.span-3 {
    grid-column: span 2;
  }
}

/* Modal Dialog (Tariff Switch Confirmation) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(8, 10, 14, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.warn-box {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: rgba(245, 196, 0, 0.1);
  border: 1px solid rgba(245, 196, 0, 0.42);
  color: #fde68a;
  font-size: 0.85rem;
  line-height: 1.45;
}

.warn-box.danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.42);
  color: #fecaca;
}

/* Support & Tickets */
.tickets-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 16px;
  align-items: start;
}

.tickets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.ticket-item {
  width: 100%;
  text-align: left;
  background: var(--recess);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  color: var(--text);
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ticket-item:hover,
.ticket-item.active {
  border-color: var(--gold);
  background: rgba(245, 196, 0, 0.07);
}

.ticket-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: clamp(320px, calc(100vh - 340px), 520px);
  max-height: 60vh;
  overflow-y: auto;
  overflow-anchor: none;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  margin: 12px 0;
  background: var(--recess);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.chat-bubble {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 86%;
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.42;
  word-break: break-word;
}

.chat-bubble.user {
  align-self: flex-end;
  border-bottom-right-radius: 2px;
  background: rgba(245, 196, 0, 0.14);
  border: 1px solid rgba(245, 196, 0, 0.35);
}

.chat-bubble.admin {
  align-self: flex-start;
  border-bottom-left-radius: 2px;
  background: rgba(34, 197, 94, 0.11);
  border: 1px solid rgba(34, 197, 94, 0.32);
}

.chat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0;
}

.chat-photo-wrap {
  margin: 2px 0;
}

.chat-photo {
  display: block;
  max-width: 240px;
  max-height: 220px;
  width: auto;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  object-fit: cover;
  cursor: zoom-in;
  background: rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.chat-photo:hover {
  transform: scale(1.015);
  border-color: rgba(16, 185, 129, 0.55);
}

.chat-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.attach-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.attach-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px dashed rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.55);
  color: var(--text, #e2e8f0);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.attach-trigger:hover {
  border-color: rgba(16, 185, 129, 0.65);
  background: rgba(16, 185, 129, 0.08);
}

.attach-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding-inline: 10px;
  cursor: pointer;
}

.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #a7f3d0;
  font-size: 0.78rem;
  max-width: 100%;
}

.ticket-reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ticket-reply-bar input {
  flex: 1;
  min-width: 0;
}

.mobile-only-btn {
  display: none;
}

.attach-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.attach-clear {
  background: transparent;
  border: 0;
  color: #fca5a5;
  font-size: 0.82rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}

.lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lightbox-backdrop.hidden {
  display: none;
}

.lightbox-img {
  max-width: 94vw;
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
  object-fit: contain;
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(15, 23, 42, 0.85);
  color: #f8fafc;
  font-size: 1rem;
  cursor: pointer;
}

.banned-card {
  border-color: rgba(239, 68, 68, 0.48);
}

.banned-badge {
  color: #fecaca;
}

.banned-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
}

.banned-icon-box {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-size: 1.65rem;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.banned-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fecaca;
  font-size: 0.88rem;
}

body.is-banned .desktop-nav,
body.is-banned .mobile-nav,
body.is-banned .topbar-actions {
  display: none !important;
}

/* Spoiler overlays for subscription URLs, VLESS keys and QR codes */
.qr-spoiler {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
}

.qr-spoiler .spoiler-target {
  transition: filter 0.2s ease;
}

.qr-spoiler.is-protected:not(.revealed) .spoiler-target {
  filter: blur(11px);
  user-select: none;
  pointer-events: none;
}

.qr-spoiler-cover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  background: rgba(10, 12, 16, 0.72);
  backdrop-filter: blur(4px);
  color: #f8fafc;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.15s ease;
}

.qr-spoiler-cover:hover {
  background: rgba(15, 23, 42, 0.84);
}

.qr-spoiler-cover.hidden {
  display: none;
}

.qr-spoiler.revealed .qr-spoiler-cover {
  opacity: 0;
  pointer-events: none;
}

.qr-spoiler.is-protected.revealed {
  cursor: pointer;
}

.sub-spoiler-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 14px 0 12px;
}

.sub-spoiler-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--recess);
  border: 1px dashed var(--border-strong);
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.sub-spoiler-box:hover {
  border-color: var(--sky);
}

.spoiler-code {
  filter: blur(6px);
  opacity: 0.45;
  transition: filter 0.2s ease, opacity 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  color: var(--text);
}

#sub-url-spoiler-wrap.revealed .spoiler-code,
.key-code.spoiler-code.revealed {
  filter: none;
  opacity: 1;
  user-select: text;
}

.key-code.spoiler-code {
  cursor: pointer;
  user-select: none;
}

.spoiler-hint {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--gold-text);
  white-space: nowrap;
  flex-shrink: 0;
}

#sub-url-spoiler-wrap.revealed .spoiler-hint {
  color: var(--muted);
}

@media (max-width: 920px) {
  .tickets-layout {
    grid-template-columns: 1fr;
  }

  .mobile-only-btn {
    display: inline-flex;
  }

  .chat-messages {
    height: 52vh;
    max-height: 58vh;
  }

  .ticket-reply-bar {
    flex-wrap: nowrap;
  }
}

/* Public Storefront Landing & Persistent Legal Footer */
.public-landing-card {
  max-width: 780px;
}

.public-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.public-tariffs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.public-tariff-item {
  background: var(--recess);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.public-tariff-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.public-tariff-price {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold-text);
}

.public-support-list {
  margin: 0;
  padding-left: 18px;
  color: #dbe3ee;
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.public-docs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.legal-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 20px;
  font-size: 0.82rem;
  color: var(--muted);
}

.legal-footer a,
.legal-footer-btn {
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  transition: color 0.15s ease;
}

.legal-footer a:hover,
.legal-footer-btn:hover {
  color: var(--gold-text);
  text-decoration: underline;
}

@media (max-width: 720px) {
  .public-tariffs-grid {
    grid-template-columns: 1fr;
  }
}

/* Gold and emerald pixels echo the bot artwork at the edges of the interface. */
.verity-dot {
  border-radius: 1px;
  box-shadow: 3px 3px 0 #957219;
}
.auth-banner::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  pointer-events: none;
  background: linear-gradient(90deg, var(--gold) 0 32px, #b18b25 32px 40px, #3d935b 40px 48px, transparent 48px);
}
.auth-brand-badge { color: #fff8df; }
.voxel-card { border-radius: 10px; }
.voxel-input:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--gold-text);
  outline-offset: 2px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f5ed;
  --surface: #fffef9;
  --surface-2: #f0eee3;
  --surface-hover: #e7e5d7;
  --recess: #f4f2e9;
  --border: #d7d4c5;
  --border-strong: #aaa996;
  --text: #222820;
  --muted: #565f54;
  --bevel: #dad6c5;
  --chrome: rgba(253, 252, 245, .97);
  --grid-line: rgba(83, 91, 52, .065);
  --gold-text: #785600;
  --primary: #205faf;
  --danger: #b3232e;
}
[data-theme="light"] .status-pill.online,
[data-theme="light"] .tag-emerald,
[data-theme="light"] .attach-chip { color: #17613a; }
[data-theme="light"] .status-pill.waiting,
[data-theme="light"] .warn-box { color: var(--gold-text); }
[data-theme="light"] .status-pill.offline,
[data-theme="light"] .inline-alert,
[data-theme="light"] .warn-box.danger,
[data-theme="light"] .banned-badge,
[data-theme="light"] .banned-strip,
[data-theme="light"] .attach-clear { color: #922c32; }
[data-theme="light"] .tag-sky { color: #215a98; }
[data-theme="light"] .attach-trigger,
[data-theme="light"] .pay-btn.style-default { background: var(--surface-2); color: var(--text); }
[data-theme="light"] .public-support-list { color: var(--text); }
[data-theme="light"] .toast { box-shadow: 0 6px 20px #55482324; }

/* The public storefront shares Verity's subscription-page artwork. */
.store { width:min(100%,1040px); margin:auto; padding:0 clamp(16px,4vw,48px) 48px; }
.store-head,.store-head nav,.store-heading,.store-foot nav { display:flex;align-items:center;gap:clamp(12px,3vw,30px); }
.store-head,.store-heading { justify-content:space-between; }
.store-head { padding:22px 0; }
.store-head strong { font:900 24px/1 var(--font-display);letter-spacing:-.07em; }
.store-head strong span { color:#231d10;background:#ffd02a;border-radius:4px;padding:0 4px;margin-left:2px; }
.store a:not(.store-cta):hover { text-decoration:underline;text-underline-offset:4px; }
.store-head nav,.store-heading a,.store-foot { font-size:.9rem; }
.store-hero { position:relative;isolation:isolate;overflow:hidden;display:grid;grid-template-columns:1.3fr 1fr;align-items:center;
  gap:12px;padding:clamp(24px,5vw,62px);color:#242016;background:linear-gradient(112deg,#ffdf5b,#ffcb21 70%,#f8bc13);border-radius:24px; }
.store-hero::before { content:"";position:absolute;inset:0 0 0 38%;z-index:-1;pointer-events:none;
  background:repeating-radial-gradient(circle at 65% 60%,transparent 0 43px,#99700e39 44px 45px,transparent 46px 62px); }
.store-hero h1 { font-size:clamp(41px,7vw,86px);font-weight:750;letter-spacing:-.07em;line-height:.98; }
.store-hero h1 span { color:#fff6cb; }
.store-hero p { margin:18px 0 22px;max-width:36ch;line-height:1.45; }
.store-cta { display:inline-flex;align-items:center;gap:16px;padding:13px 20px;background:#232019;color:#fff9e8;font-weight:650;border-radius:10px; }
.store-cta span { color:#ffda4b; }
.store-mascot { width:100%;height:auto;max-height:300px;object-fit:contain;filter:drop-shadow(0 10px 8px #88600038); }
.store-section { padding:34px 0 22px; }
.store-heading h2 { font-size:clamp(28px,4vw,39px);line-height:1.1;letter-spacing:-.045em; }
.store-intro,.store-trial { margin:10px 0 18px;color:var(--muted); }
.store-trial { margin:16px 0 0;border-left:3px solid #deb024;padding:3px 12px;font-size:.92rem; }
.store-trial strong { color:var(--text); }
.store .public-tariff-item { background:var(--surface);padding:clamp(16px,2.4vw,26px);border-radius:15px; }
.store .public-tariff-price { color:var(--text);font:700 clamp(25px,3.8vw,38px)/1.3 var(--font-display);letter-spacing:-.05em; }
.store .public-tariff-price span { letter-spacing:0;font:400 .85rem var(--font-sans); }
.store-foot { padding:18px 0;border-top:1px solid var(--border-strong); }
.store-foot summary { cursor:pointer;font-weight:650;padding:4px 0; }
.store-foot ul { margin:12px 0; }
.store-foot nav { margin-top:16px;flex-wrap:wrap;color:var(--muted); }
@media(max-width:640px) {
  .store-head { padding:16px 0; }
  .store-hero { grid-template-columns:1.7fr 1fr;padding:24px 18px;gap:0; }
  .store-hero p { font-size:.91rem; }
  .store-mascot { width:120%;margin-left:-10%; }
  .store .public-tariffs-grid { grid-template-columns:1fr;gap:8px; }
  .store .public-tariff-item { display:grid;grid-template-columns:1fr auto;align-items:baseline; }
  .store .public-tariff-item > .muted { grid-column:1/-1; }
  .store-cta { padding:12px 13px;font-size:.9rem;gap:8px; }
}

#tab-overview .overview-stack { display:grid;gap:16px; }
.overview-qr { border-top:1px solid var(--border);margin-top:16px;padding-top:10px; }
.overview-qr summary { cursor:pointer;font-weight:600;padding:8px 0; }
.overview-qr .qr-spoiler { margin:8px 0; }
#sub-actions-active.hidden + .overview-qr { display:none; }
@media(min-width:840px) {
  #tab-overview .meters-stack { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px; }
  #tab-overview .meter-head { flex-wrap:wrap; }
}
