/* ============================================================
   PHASE 0 — Unified design tokens (single source of truth)
   Brand identity: primary #0A2540 (navy), secondary #1d4ed8 (link/focus),
   accent #00C4FF (Most Popular badge only).
   Backend-compatible: pure CSS, no API changes.
   ============================================================ */
:root {
  --brand-primary: #0a2540;
  --brand-primary-hover: #12365f;
  --brand-secondary: #1d4ed8;
  --brand-secondary-hover: #1e40af;
  --brand-accent: #00c4ff;
  --brand-bg-light: #ffffff;
  --brand-bg-dark: #101622;
  --brand-surface-light: #f8fafc;
  --brand-surface-dark: #18181b;
  --brand-border: #e5e7eb;
  --brand-radius: 0.5rem;
  --brand-radius-lg: 0.625rem;
  --btn-min-h: 44px;
}

html.dark {
  --brand-border: #3f3f46;
}

/* Shared UI fixes for the static frontend. Keep this layer small and non-invasive. */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

body {
  min-width: 0;
}

/* Only .sr-only is visually hidden. Visible status uses .visible-status. */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.visible-status {
  position: static !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  clip: auto !important;
  clip-path: none !important;
  white-space: normal !important;
}

.sr-only:focus,
.skip-link:focus {
  position: fixed !important;
  top: max(0.75rem, env(safe-area-inset-top)) !important;
  inset-inline-start: max(0.75rem, env(safe-area-inset-left)) !important;
  width: auto !important;
  height: auto !important;
  padding: 0.625rem 1rem !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  clip-path: none !important;
  white-space: normal !important;
  z-index: 10000 !important;
}

.skip-links {
  position: fixed !important;
  top: 0 !important;
  inset-inline-start: 0 !important;
  z-index: 10000 !important;
}

/* RTL should affect content without forcing every flex/grid container back to LTR. */
html[dir="rtl"] body,
html[dir="rtl"] main,
html[dir="rtl"] section,
html[dir="rtl"] article,
html[dir="rtl"] form,
html[dir="rtl"] .card,
html[dir="rtl"] .modal-content {
  direction: rtl;
}

html[dir="rtl"] .flex:not(.force-ltr),
html[dir="rtl"] .grid:not(.force-ltr) {
  direction: rtl;
}

html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="url"],
html[dir="rtl"] input[type="password"],
html[dir="rtl"] input[type="number"],
html[dir="rtl"] .font-mono,
html[dir="rtl"] .material-symbols-outlined,
html[dir="rtl"] svg,
html[dir="rtl"] img {
  direction: ltr;
}

html[dir="rtl"] input:not([type="email"]):not([type="url"]):not([type="password"]):not([type="number"]),
html[dir="rtl"] textarea {
  text-align: right;
}

/* Shared header hardening for app pages. */
header > .flex,
header .layout-content-container > .flex,
header .items-center.justify-between {
  min-width: 0;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

header nav {
  min-width: 0;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem !important;
}

header a,
header button,
header select {
  flex-shrink: 0;
}

#accountName,
#walletBalance {
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  header {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  header nav:not(#mobileMenu) {
    order: 3;
    width: 100%;
  }

  header [role="region"][aria-label="User account information"],
  header .text-right {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  main,
  .layout-content-container,
  .max-w-6xl,
  .max-w-7xl {
    min-width: 0;
  }

  .modal-content {
    width: calc(100vw - 2rem) !important;
    max-width: calc(100vw - 2rem) !important;
  }

  .tab-button {
    white-space: nowrap;
  }
}

/* Ensure hidden panels/modals are also hidden from layout and accessibility tooling. */
[hidden],
[aria-hidden="true"].modal-overlay,
[aria-hidden="true"].modal,
[aria-hidden="true"].tab-panel,
[data-app-hidden="true"] {
  display: none !important;
}

.notification {
  max-width: min(28rem, calc(100vw - 2rem));
  inset-inline-end: 1rem !important;
  inset-inline-start: auto !important;
  z-index: 11000 !important;
}

html[dir="rtl"] .notification {
  inset-inline-start: 1rem !important;
  inset-inline-end: auto !important;
}

/* Simple content pages (support/terms/privacy/forgot-password) keep the same card structure but match the product UI. */
body.simple-page {
  background: #f8fafc !important;
  color: #111827 !important;
}

.simple-page-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.simple-page-card {
  width: min(100%, 56rem);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  padding: clamp(1.5rem, 4vw, 3rem);
}

.simple-page-card h1 {
  color: #0a2540;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1;
  font-weight: 800;
  margin-bottom: 1.25rem;
}

.simple-page-card p,
.simple-page-card li {
  color: #4b5563;
  font-size: 1.05rem;
  line-height: 1.8;
}

.simple-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.simple-page-actions a,
.simple-page-card a.simple-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.65rem 1rem;
  border-radius: 0.625rem;
  font-weight: 700;
  text-decoration: none;
}

.simple-page-actions a.primary {
  background: #0a2540;
  color: #fff;
}

.simple-page-actions a.secondary,
.simple-page-card a.simple-link {
  background: #f3f4f6;
  color: #0a2540;
  border: 1px solid #d1d5db;
}

html.dark body.simple-page {
  background: #101622 !important;
  color: #e5e7eb !important;
}

html.dark .simple-page-card {
  background: #18181b;
  border-color: #3f3f46;
}

html.dark .simple-page-card h1,
html.dark .simple-page-actions a.secondary,
html.dark .simple-page-card a.simple-link {
  color: #fff;
}

html.dark .simple-page-card p,
html.dark .simple-page-card li {
  color: #d1d5db;
}

html.dark .simple-page-actions a.secondary,
html.dark .simple-page-card a.simple-link {
  background: #27272a;
  border-color: #52525b;
}

.admin-guard-pending main,
.admin-guard-pending header,
.admin-guard-pending footer {
  visibility: hidden;
}

.admin-guard-pending::before {
  content: "Checking admin access...";
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #f8fafc;
  color: #0a2540;
  font-weight: 700;
  z-index: 12000;
}

html[dir="rtl"] .admin-guard-pending::before {
  content: "در حال بررسی دسترسی ادمین...";
}

/* ============================================================
   Unified button components — map all legacy onclick styles here.
   Usage: class="btn-primary" / "btn-secondary" / "btn-outline" /
   "btn-ghost" / "btn-danger". All guarantee min-h:44px, rounded-lg,
   font-bold, transition. No JS/API dependency.
   ============================================================ */
.btn-primary,
.btn-secondary,
.btn-outline,
.btn-ghost,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--btn-min-h);
  padding: 0.625rem 1.25rem;
  border-radius: var(--brand-radius-lg);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.25;
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-primary-hover);
  border-color: var(--brand-primary-hover);
  color: #fff;
}
.btn-primary:disabled {
  background: #9ca3af;
  border-color: #9ca3af;
  cursor: not-allowed;
  opacity: 0.8;
}

.btn-secondary {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: var(--brand-primary);
}
.btn-secondary:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
}
html.dark .btn-secondary {
  background: #27272a;
  border-color: #52525b;
  color: #fff;
}
html.dark .btn-secondary:hover {
  background: #3f3f46;
}

.btn-outline {
  background: transparent;
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}
.btn-outline:hover {
  background: rgba(10, 37, 64, 0.06);
}
html.dark .btn-outline {
  border-color: #93c5fd;
  color: #bfdbfe;
}
html.dark .btn-outline:hover {
  background: rgba(147, 197, 253, 0.1);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--brand-secondary);
}
.btn-ghost:hover {
  background: rgba(29, 78, 216, 0.08);
}

.btn-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}
.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn-lg {
  min-height: 48px;
  padding: 0.75rem 1.5rem;
  font-size: 1.05rem;
}
.btn-sm {
  min-height: 36px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
}

/* Unified "Most Popular" treatment: accent ONLY here */
.badge-popular {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--brand-accent);
  color: #0a2540;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  letter-spacing: 0.02em;
}
.plan-card-popular {
  border: 2px solid var(--brand-accent) !important;
  position: relative;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 2px;
}

/* Unified modal hover: subtle bg only, never scale (avoids hierarchy confusion) */
.modal-content .btn-primary:hover,
.modal-content .btn-secondary:hover,
.modal-content .btn-outline:hover {
  transform: none;
}
.modal-card-hover:hover {
  background: rgba(10, 37, 64, 0.04);
}
html.dark .modal-card-hover:hover {
  background: rgba(147, 197, 253, 0.08);
}

/* Unified tab styles — capsule (dashboard model) is canonical */
.tab-capsule {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.1rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid var(--brand-border);
  background: transparent;
  color: inherit;
  min-height: var(--btn-min-h);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tab-capsule[aria-selected="true"],
.tab-capsule.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

/* Empty-state illustration block (dashboard) */
.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  border: 1px dashed var(--brand-border);
  border-radius: 1rem;
  background: rgba(10, 37, 64, 0.02);
}
html.dark .empty-state {
  background: rgba(255, 255, 255, 0.03);
}
.empty-state h3 {
  font-weight: 800;
  font-size: 1.15rem;
  margin: 1rem 0 0.5rem;
  color: var(--brand-primary);
}
html.dark .empty-state h3 {
  color: #fff;
}
.empty-state p {
  color: #6b7280;
  font-size: 0.95rem;
}
.empty-state ol {
  display: inline-block;
  text-align: start;
  margin: 1rem auto 0;
  color: #4b5563;
  font-size: 0.9rem;
  line-height: 1.9;
}
html.dark .empty-state p,
html.dark .empty-state ol {
  color: #d1d5db;
}

/* Chat bubble mobile fix */
@media (max-width: 640px) {
  .message-bubble {
    max-width: 88% !important;
  }
}

/* Unified notification (single source; inline copies kept as fallback) */
.notification {
  position: fixed;
  top: 1.25rem;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  background: #fff;
  color: #111827;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
  z-index: 11000 !important;
  font-weight: 500;
  animation: appSlideIn 0.3s ease;
  max-width: min(28rem, calc(100vw - 2rem));
  inset-inline-end: 1rem !important;
  inset-inline-start: auto !important;
}
.notification.success { background-color: #10B981; color: #fff; }
.notification.error { background-color: #EF4444; color: #fff; }
.notification.warning { background-color: #F59E0B; color: #fff; }
@keyframes appSlideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
html[dir="rtl"] .notification {
  inset-inline-start: 1rem !important;
  inset-inline-end: auto !important;
}

/* ============================================================
   PHASE 1-4 UPGRADE (no redesign) — canonical components.
   All pages migrate here; inline <style> copies are deprecated.
   Brand contract: primary #0A2540 = main CTA only,
   secondary #1d4ed8 = links/focus/active accents,
   accent #00C4FF = Most Popular badge only.
   ============================================================ */

/* Canonical tab-button: capsule navy (account model). Overrides
   legacy inline .tab-button copies in dashboard/account. */
.tab-button {
  display: inline-flex !important;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 1.25rem !important;
  font-weight: 600;
  font-size: 0.95rem;
  color: #6b7280;
  border: 1px solid transparent !important;
  border-bottom: 1px solid transparent !important;
  border-radius: 9999px !important;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
  white-space: nowrap;
}
.tab-button:hover {
  color: var(--brand-primary, #0A2540) !important;
  background-color: rgba(10, 37, 64, 0.06) !important;
}
.tab-button.active {
  color: #fff !important;
  background-color: var(--brand-primary, #0A2540) !important;
  border-color: var(--brand-primary, #0A2540) !important;
  font-weight: 700;
}
html.dark .tab-button { color: #a1a1aa !important; }
html.dark .tab-button:hover {
  color: #93c5fd !important;
  background-color: rgba(147, 197, 253, 0.12) !important;
}
html.dark .tab-button.active {
  color: #fff !important;
  background-color: var(--brand-primary, #0A2540) !important;
  border-color: var(--brand-primary, #0A2540) !important;
}

/* Unified form field */
.field,
input.field, select.field, textarea.field {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0.625rem 0.875rem;
  border-radius: var(--brand-radius-lg);
  border: 1px solid #d1d5db;
  background: #fff;
  color: #0a2540;
  font-size: 0.95rem;
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field::placeholder { color: #9ca3af; }
.field:focus {
  outline: none;
  border-color: var(--brand-secondary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
}
html.dark .field,
html.dark input.field, html.dark select.field, html.dark textarea.field {
  background: #27272a;
  border-color: #52525b;
  color: #fff;
}
.field-error-message { min-height: 1.25rem; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: #dc2626 !important;
}

/* Password visibility toggle */
.pw-wrap { position: relative; }
.pw-wrap .field { padding-inline-end: 2.75rem; }
/* Inputs keep direction:ltr (passwords/emails), so the logical property resolves
   against the element, not the document — set the physical side explicitly. */
html[dir="rtl"] .pw-wrap .field { padding-left: 2.75rem; }
html[dir="rtl"] .pw-wrap .field { padding-right: 0.875rem; }
html:not([dir="rtl"]) .pw-wrap .field { padding-right: 2.75rem; }
.pw-toggle {
  position: absolute;
  inset-inline-end: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  min-height: 36px;
  min-width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  color: #6b7280;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.pw-toggle:hover { background: rgba(10, 37, 64, 0.06); color: var(--brand-primary); }
html.dark .pw-toggle:hover { background: rgba(147, 197, 253, 0.12); color: #93c5fd; }

/* Unified card */
.ui-card {
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
html.dark .ui-card { background: #27272a; border-color: #3f3f46; }

/* No-email prominent banner (login page) */
.noemail-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  text-align: center;
  font-size: 0.875rem;
  color: #4b5563;
  background: rgba(10, 37, 64, 0.04);
  border: 1px dashed #cbd5e1;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
  opacity: 1 !important;
}
html.dark .noemail-banner {
  color: #d1d5db;
  background: rgba(147, 197, 253, 0.08);
  border-color: #52525b;
}
.noemail-banner a { font-weight: 700; }

/* Checkout stepper (purchase page) */
.checkout-steps {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #6b7280;
}
.checkout-steps .step {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  border: 1px solid var(--brand-border);
  background: transparent;
}
.checkout-steps .step.is-active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}
.checkout-steps .step.is-done {
  border-color: var(--brand-secondary);
  color: var(--brand-secondary);
}
.checkout-steps .sep { opacity: 0.5; }

/* Region picker: continent tabs + city/country search */
.region-picker {
  border: 1px solid var(--brand-border);
  border-radius: 1rem;
  padding: 1.25rem 1.25rem 1.5rem;
  background: var(--brand-bg-light, #fff);
}
html.dark .region-picker {
  background: var(--brand-surface-dark, #18181b);
}
.region-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}
.region-picker-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
}
html.dark .region-picker-title { color: #f9fafb; }
.region-search {
  position: relative;
  flex: 1 1 14rem;
  max-width: 18rem;
  margin-inline-start: auto;
}
.region-search input {
  width: 100%;
  height: 40px;
  min-height: 40px;
  border: 1px solid var(--brand-border);
  border-radius: 9999px;
  padding: 0 2.5rem 0 1rem;
  background: #fff;
  color: #111827;
  font-size: 0.875rem;
  appearance: none;
  -webkit-appearance: none;
}
.region-search input[type="search"]::-webkit-search-decoration,
.region-search input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
html.dark .region-search input {
  background: #27272a;
  color: #f4f4f5;
}
.region-search input::placeholder { color: #9ca3af; }
.region-search .material-symbols-outlined {
  position: absolute;
  right: 0.75rem;
  left: auto;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: #9ca3af;
  pointer-events: none;
}
html[dir="rtl"] .region-search input {
  padding: 0 1rem 0 2.5rem;
}
html[dir="rtl"] .region-search .material-symbols-outlined {
  right: auto;
  left: 0.75rem;
}
.region-continent-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.15rem 1.1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--brand-border);
  margin: 0.35rem 0 1.15rem;
}
.region-continent-tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0.7rem 0.1rem;
  margin-bottom: -1px;
  color: #6b7280;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
  white-space: nowrap;
  flex-shrink: 0;
}
html.dark .region-continent-tab { color: #9ca3af; }
.region-continent-tab:hover { color: var(--brand-secondary); }
.region-continent-tab.is-active {
  color: var(--brand-secondary);
  border-bottom-color: var(--brand-secondary);
  font-weight: 600;
}
.region-tab-count {
  font-size: 0.7rem;
  vertical-align: super;
  margin-inline-start: 0.12rem;
  opacity: 0.72;
}
.region-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
@media (min-width: 640px) {
  .region-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
  .region-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .region-card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  .region-card-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.region-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: #6b7280;
  padding: 2rem 0.5rem;
}
html.dark .region-empty-state { color: #9ca3af; }
.region-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-align: start;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--brand-border);
  background: #fff;
  min-height: 72px;
  min-width: 0;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
html.dark .region-card { background: #27272a; }
.region-card:hover:not(:disabled) { border-color: var(--brand-secondary); }
.region-card.is-selected {
  border-color: var(--brand-secondary);
  background: #eff6ff;
  box-shadow: 0 0 0 1px var(--brand-secondary);
}
html.dark .region-card.is-selected {
  background: rgba(29, 78, 216, 0.16);
}
.region-card-flag {
  font-size: 1.7rem;
  line-height: 1;
  width: 2.1rem;
  text-align: center;
  flex-shrink: 0;
}
.region-card-flag-img {
  display: block;
  width: 32px;
  height: 24px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}
.region-card-flag-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 24px;
  padding: 0 0.25rem;
  border-radius: 3px;
  background: #e5e7eb;
  color: #374151;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
html.dark .region-card-flag-code {
  background: #3f3f46;
  color: #e4e4e7;
}
.region-card-text {
  min-width: 0;
  flex: 1;
  unicode-bidi: isolate;
}
.region-card-city {
  display: block;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html.dark .region-card-city { color: #f9fafb; }
.region-card-country {
  display: block;
  font-size: 0.75rem;
  color: #9ca3af;
  line-height: 1.3;
}
.region-card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  flex-shrink: 0;
}
.region-card-price {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand-secondary);
}
.region-card-status {
  font-size: 0.7rem;
}
.region-card-check {
  color: var(--brand-secondary);
  font-size: 20px;
  line-height: 1;
}
@media (max-width: 640px) {
  .region-search { max-width: none; }
}

/* Trust bar (index hero) */
.trust-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
}
html.dark .trust-bar { color: #cbd5e1; }
.trust-bar .trust-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--brand-border);
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.7);
}
html.dark .trust-bar .trust-item { background: rgba(255, 255, 255, 0.04); }
.trust-bar .material-symbols-outlined { font-size: 18px; color: #16a34a; }

/* Standalone trust pill (reusable outside .trust-bar: purchase, solana-pay, privacy) */
.trust-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--brand-border);
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
}
html.dark .trust-item { background: rgba(255, 255, 255, 0.04); color: #cbd5e1; }
.trust-item .material-symbols-outlined { font-size: 18px; color: #16a34a; }

/* NO KYC highlight — green accent to stand out among neutral trust pills */
.trust-item-nokyc {
  border-color: rgba(22, 163, 74, 0.45);
  background: rgba(22, 163, 74, 0.08);
  color: #15803d;
}
html.dark .trust-item-nokyc { color: #4ade80; background: rgba(74, 222, 128, 0.08); }
.trust-item-nokyc .material-symbols-outlined { color: #16a34a; }
html.dark .trust-item-nokyc .material-symbols-outlined { color: #4ade80; }
.nokyc-pill {
  border-color: rgba(22, 163, 74, 0.45) !important;
  color: #15803d !important;
}
html.dark .nokyc-pill { color: #4ade80 !important; }
.nokyc-inline {
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
  color: #15803d;
  white-space: nowrap;
}
html.dark .nokyc-inline { color: #4ade80; }

/* FAQ accordion (index) */
.faq-item {
  border: 1px solid var(--brand-border);
  border-radius: 0.75rem;
  background: #fff;
  overflow: hidden;
}
html.dark .faq-item { background: #27272a; }
.faq-item + .faq-item { margin-top: 0.75rem; }
.faq-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  text-align: start;
  padding: 1rem 1.25rem;
  font-weight: 700;
  color: var(--brand-primary);
  background: transparent;
  border: 0;
  cursor: pointer;
  min-height: 44px;
}
html.dark .faq-q { color: #fff; }
.faq-q .material-symbols-outlined { transition: transform 0.2s ease; }
.faq-item[data-open="true"] .faq-q .material-symbols-outlined { transform: rotate(180deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.faq-item[data-open="true"] .faq-a { max-height: 300px; }
.faq-a p { padding: 0 1.25rem 1.1rem; color: #4b5563; line-height: 1.7; }
html.dark .faq-a p { color: #d1d5db; }

/* Responsive tables -> cards on mobile (account page) */
@media (max-width: 640px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td {
    display: block;
    width: 100%;
  }
  .table-cards tr {
    border: 1px solid var(--brand-border);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    background: #fff;
  }
  html.dark .table-cards tr { background: #27272a; }
  .table-cards td {
    border: 0 !important;
    padding: 0.25rem 0 !important;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
  }
  .table-cards td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #6b7280;
    font-size: 0.8rem;
  }
}

/* Client OS tabs: 44px touch target (dashboard fix) */
.client-os-tab {
  min-height: 44px !important;
  height: 44px !important;
  padding: 0 0.9rem !important;
  font-size: 12px !important;
}
.client-os-tab svg { width: 16px !important; height: 16px !important; }

/* Chat contrast + typing */
html.dark .message-admin { background-color: #4b5563 !important; color: #f9fafb !important; }
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  background: #e5e7eb;
  color: #6b7280;
  font-size: 0.8rem;
}
html.dark .typing-indicator { background: #4b5563; color: #e5e7eb; }
.typing-indicator .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  animation: typingBlink 1.2s infinite;
}
.typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBlink { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }

/* Solana status states */
.status-banner { transition: background-color 0.2s ease, border-color 0.2s ease; }
.status-banner.is-loading { border-style: dashed; }
.status-banner.is-waiting {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
}
html.dark .status-banner.is-waiting { background: rgba(29, 78, 216, 0.18); color: #bfdbfe; }
.status-banner.is-success {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}
.status-banner.is-error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

/* Payment method hierarchy */
.pay-option-primary { border-width: 2px; }
.pay-option { min-height: 64px; }
.pay-option:hover { transform: none; }

/* Deposit balance + plan popular polish (keep structure) */
.plan-card-popular { box-shadow: 0 8px 24px rgba(0, 196, 255, 0.18); }
.badge-popular { color: #0a2540 !important; }

/* Plan tagline: deeper cyan on white cards, brand cyan on dark cards. */
.plan-tagline { color: #0E7490; }
html.dark .plan-tagline { color: #00C4FF; }

/* Legacy button hardening: any remaining Tailwind bg-primary/bg-gray
   buttons (including JS-rendered plan/connection/receipt buttons) get
   unified min-height, radius and weight without markup changes. */
button[class*="bg-primary"], a[class*="bg-primary"] {
  min-height: var(--btn-min-h);
  border-radius: var(--brand-radius-lg) !important;
  font-weight: 700;
}
button[class*="bg-gray-200"], a[class*="bg-gray-200"],
button[class*="bg-gray-100"], a[class*="bg-gray-100"] {
  min-height: var(--btn-min-h);
  border-radius: var(--brand-radius-lg) !important;
  font-weight: 600;
}

/* ============================================================
   App header responsive (dashboard/account/chat/purchase/admin-chat).
   Row 1 must never look "wrapped by accident": the account/actions
   cluster hugs the end, and nav drops to a deliberate secondary bar.
   ============================================================ */
.app-header > .flex > div:last-child {
  margin-inline-start: auto;
  min-width: 0;
}
.app-header .text-right { min-width: 0; }
/* Compact row 1 on laptop widths so everything fits one line */
@media (max-width: 1450px) {
  .app-header {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  .app-header nav {
    gap: 0.5rem 1rem !important;
  }
  .app-header #accountName,
  .app-header #walletBalance {
    max-width: 8rem;
  }
}
/* Nav becomes an intentional secondary bar (never a stray wrap) */
@media (max-width: 1330px) {
  .app-header > .flex { row-gap: 0.6rem; }
  .app-header nav {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    border-top: 1px solid var(--brand-border);
    padding-top: 0.6rem;
    overflow-x: auto;
  }
  .app-header nav a { white-space: nowrap; }
}
/* Phones: actions cluster takes its own tidy row, texts truncate */
@media (max-width: 720px) {
  .app-header > .flex > div:last-child {
    flex: 1 1 100%;
    justify-content: space-between;
  }
  .app-header #accountName { max-width: 7rem; }
  .app-header #walletBalance { max-width: 6rem; }
}

/* Dashboard content must never force horizontal scroll */
#serviceDetails, #servicesList { min-width: 0; }
#serviceDetails h1 { overflow-wrap: anywhere; }

/* Simple-page headers wrap on 320px instead of clipping controls */
.site-simple-header {
  flex-wrap: wrap;
  gap: 0.75rem;
  white-space: normal;
}
.site-simple-header > a,
.site-simple-header > div {
  min-width: 0;
}
@media (max-width: 360px) {
  .site-simple-header {
    align-items: flex-start;
  }
  .site-simple-header > div {
    flex-wrap: wrap;
    width: 100%;
  }
}

/* Admin chat: stack rooms + conversation on small screens */
@media (max-width: 768px) {
  .admin-chat-layout {
    flex-direction: column;
  }
  .admin-chat-rooms {
    width: 100% !important;
    max-height: 40vh;
  }
}

/* ==========================================================================
   Shared toast notifications (js/toast.js) — replaces per-page #notification
   ========================================================================== */
.toast-stack {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 24px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(92vw, 480px);
  pointer-events: none;
}

html[dir="rtl"] .toast-stack {
  left: auto;
  right: 50%;
  transform: translateX(50%);
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(2, 12, 27, 0.25);
  font-size: 0.875rem;
  line-height: 1.5;
  color: #fff;
  animation: toast-in 0.22s ease-out;
}

/* accessibility.min.css hides every [aria-live] region off-screen (sr-only live regions);
   toasts must stay visible, so undo that for toasts specifically. */
.toast[aria-live] {
  position: static;
  inset-inline-start: auto;
  left: auto;
  right: auto;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

.toast--success { background-color: #10B981; }
.toast--error   { background-color: #EF4444; }
.toast--warning { background-color: #F59E0B; }
.toast--info    { background-color: #0A2540; }

.toast__icon {
  font-size: 20px;
  line-height: 1.4;
  flex-shrink: 0;
}

.toast__message {
  flex: 1;
  overflow-wrap: anywhere;
  text-align: start;
}

.toast__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: -2px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: currentColor;
  cursor: pointer;
}

.toast__close:hover { background: rgba(255, 255, 255, 0.18); }
.toast__close .material-symbols-outlined { font-size: 18px; }

.toast--leaving {
  opacity: 0;
  transition: opacity 0.2s ease-in;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .toast--leaving { transition: none; }
}

/* Per-field inline form errors (js/forms.js) */
.error-message {
  display: none;
  color: #EF4444;
  font-size: 0.8rem;
  line-height: 1.4;
}

.error-message--visible {
  display: block;
}

/* accessibility.min.css parks every [aria-live] element off-screen as a
   screen-reader-only pattern. Inline field errors, alert/status panels and
   live status text are meant to be seen, so re-anchor them here (this sheet
   loads after the accessibility sheet on every page). */
.error-message--visible,
[role="alert"]:not(.sr-only):not(.toast),
[role="status"]:not(.sr-only):not(.toast),
.visible-status {
  position: static;
  left: auto;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

.field-invalid {
  border-color: #EF4444 !important;
}

.field-invalid:focus {
  border-color: #EF4444 !important;
}

/* Live password requirements checklist (js/auth-errors.js) */
.pw-req-title {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6B7280;
}

.dark .pw-req-title {
  color: #9CA3AF;
}

.pw-req-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pw-req-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  line-height: 1.5;
  color: #9CA3AF;
  transition: color 0.15s ease;
}

.dark .pw-req-item {
  color: #6B7280;
}

.pw-req-item .pw-req-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.pw-req-item--met {
  color: #10B981;
}

.dark .pw-req-item--met {
  color: #34D399;
}

.pw-req-item--unmet {
  color: #6B7280;
}

.dark .pw-req-item--unmet {
  color: #9CA3AF;
}

/* Untouched input: keep the whole list muted until the user starts typing. */
.pw-req-list--empty .pw-req-item {
  color: #9CA3AF;
}

.dark .pw-req-list--empty .pw-req-item {
  color: #6B7280;
}

html[dir="rtl"] .pw-req-title {
  text-align: right;
}

/* ==========================================================================
   Google sign-in blocks (Google Identity Services) — RTL-safe
   ========================================================================== */

/* Blocks are `hidden` in the HTML until js/google-auth.js confirms the
   feature is active; display utilities must not defeat the attribute. */
[data-google-block][hidden],
.google-auth-block [hidden],
#googleCard[hidden],
#googleConnectSection[hidden],
#googleLinkedSection[hidden],
#googlePasswordField[hidden],
#googleReauthBlock[hidden] {
  display: none !important;
}

.google-auth-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.google-auth-compact {
  max-width: 480px;
  margin-inline: auto;
}

/* Skeleton height while GIS renders (GIS buttons are iframes). */
.google-auth-button-host {
  min-height: 44px;
  display: flex;
  justify-content: center;
}

.google-auth-button-host:empty {
  min-height: 44px;
}

.google-auth-caption {
  font-size: 12px;
  line-height: 1.6;
  color: #6B7280;
  text-align: center;
  margin: 0;
}

.dark .google-auth-caption {
  color: #9CA3AF;
}

.google-auth-note {
  font-size: 13px;
  line-height: 1.6;
  color: #6B7280;
  text-align: center;
  margin: 0;
}

.dark .google-auth-note {
  color: #9CA3AF;
}

.google-auth-privacy {
  font-size: 12px;
  line-height: 1.6;
  color: #6B7280;
  text-align: center;
  margin: 0;
}

.dark .google-auth-privacy {
  color: #9CA3AF;
}

/* "or continue with username and password" divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #9CA3AF;
  font-size: 12px;
  margin: 2px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1 1 0;
  height: 1px;
  background: var(--brand-border, #e5e7eb);
}

/* GIS could not load (blocked network): friendly note + retry */
.google-auth-fallback {
  font-size: 13px;
  line-height: 1.6;
  color: #b45309;
  text-align: center;
  margin: 0;
}

.google-auth-retry {
  background: none;
  border: 0;
  padding: 0;
  color: #2563eb;
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
}

/* Inline panel after google_link_requires_password */
.google-link-panel {
  border: 1px solid var(--brand-border, #e5e7eb);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(245, 158, 11, 0.06);
  font-size: 14px;
}

.google-link-panel-title {
  font-weight: 600;
  margin: 0 0 4px;
  color: #b45309;
}

.google-link-panel-body {
  margin: 0 0 8px;
  color: #6B7280;
  line-height: 1.6;
}

.google-link-panel-email {
  direction: ltr;
  unicode-bidi: embed;
}

/* Login-history method badge (Account page) */
.login-method-badge {
  display: inline-block;
  margin-inline-start: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--brand-border, #e5e7eb);
  vertical-align: middle;
}

.login-method-google {
  color: #2563eb;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.login-method-password {
  color: #6B7280;
}

.dark .login-method-google {
  color: #93c5fd;
  border-color: rgba(37, 99, 235, 0.4);
  background: rgba(37, 99, 235, 0.15);
}

.dark .login-method-password {
  color: #9CA3AF;
}

html[dir="rtl"] .google-auth-caption,
html[dir="rtl"] .google-auth-note,
html[dir="rtl"] .google-auth-privacy,
html[dir="rtl"] .google-auth-fallback,
html[dir="rtl"] .google-link-panel-body {
  text-align: center;
  direction: rtl;
}

/* ============================================================
   Mobile site header (index / login / register-no-email /
   verify-email pattern). Keep ONE tidy row on phones:
   brand (truncating) + compact language selector + menu button.
   Account and auth actions are duplicated in the mobile menu,
   so the top bar can drop them instead of wrapping into a
   broken multi-row stack (fixes clipped Logout / nav links).
   ============================================================ */
@media (max-width: 767px) {
  header.flex.items-center.justify-between:not(.site-simple-header) > a {
    flex: 1 1 auto;
    min-width: 0;
  }

  header.flex.items-center.justify-between:not(.site-simple-header) > div.flex {
    flex-wrap: nowrap;
    min-width: 0;
  }

  header [data-brand-name] {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Top-bar account/auth controls are duplicated in the mobile menu */
  header #userHeader,
  header #authButtons,
  header div[role="tablist"],
  header a.btn-secondary[href="login.html"],
  header a.btn-primary[href="register-no-email.html"] {
    display: none !important;
  }

  /* Language selector may shrink on narrow phones (other header
     buttons stay fixed via the shared flex-shrink: 0 rule). */
  header select#languageSelector {
    min-width: 0;
    flex-shrink: 1;
  }

  /* Blog badge stays in the mobile menu on phones */
  header a[href="/blog/"] {
    display: none;
  }

  /* The desktop nav is hidden on phones; drop the (empty) container so
     its legacy <=900px width:100% rule cannot squeeze the controls. */
  header.flex.items-center.justify-between:not(.site-simple-header) nav {
    display: none;
  }
}

/* Very narrow phones: trim the selector's arrow gutter so the
   shrinking select keeps readable text instead of a blank box. */
@media (max-width: 380px) {
  header select#languageSelector {
    padding-right: 1.9rem;
    padding-left: 0.5rem;
  }
}

/* Long words (emails, usernames) must wrap inside headings
   instead of being clipped on phones (e.g. "Welcome back,
   admin@blendinvpn.com!" in the homepage hero). */
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

#heroWelcomeTitle {
  overflow-wrap: anywhere;
}

/* Translated FAQ answers can run longer than the default open
   height on phones; give the accordion room before clipping. */
@media (max-width: 640px) {
  .faq-item[data-open="true"] .faq-a {
    max-height: 560px;
  }
}
