/* H4X Shop · Sistema visual. Sin dependencias ni recursos remotos.
   Mobile first. Navegación de escritorio desde 900px.
   Los alias mantienen la compatibilidad con la SPA de public/js/. */

/* 01 · Tokens ----------------------------------------------------------- */
:root {
  color-scheme: dark;
  --bg: #101211;
  --bg-deep: #0c0e0d;
  --field: #121513;
  --surface: #171a18;
  --surface-2: #1d211e;
  --surface-3: #262c27;
  --surface-hover: #2a302b;
  --border: #363e37;
  --border-subtle: #2b302c;
  --border-strong: #6a756b;
  --text: #f2f5f0;
  --text-secondary: #d5ded4;
  --muted: #a6b0a7;
  --accent: #c4f477;
  --accent-hover: #dbffac;
  --accent-strong: #a3d359;
  --accent-soft: #252f20;
  --accent-line: #485e34;
  --on-accent: #14200c;
  --cyan: var(--info);
  --info: #a2d8ed;
  --info-soft: #1c3035;
  --success: #8ce6ad;
  --success-soft: #203829;
  --warning: #f6cf84;
  --warning-soft: #372d1e;
  --danger: #ffa6a9;
  --danger-soft: #3d262a;
  --offline: #b3beb5;
  --focus: var(--accent);
  --radius-sm: 8px;
  --radius-md: 11px;
  --radius-lg: 16px;
  --radius-xl: 23px;
  --radius-pill: 999px;
  --shadow-sm: 0 3px 12px rgb(0 0 0 / 14%);
  --shadow-md: 0 12px 32px rgb(0 0 0 / 22%);
  --shadow-lg: 0 24px 80px rgb(0 0 0 / 45%);
  --shadow-glow: 0 0 28px rgb(194 246 113 / 12%);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --font-sans: Inter, system-ui, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sidebar-width: 232px;
  --topbar-height: 64px;
  --bottom-nav-height: 74px;
  --content-width: 1440px;
  --duration-fast: 140ms;
  --duration: 220ms;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --z-topbar: 30;
  --z-bottomnav: 40;
  --z-backdrop: 60;
  --z-sidebar: 70;
  --z-modal: 100;
  --z-toast: 120;
  /* Alias útiles para componentes nuevos. */
  --color-bg: var(--bg);
  --color-surface: var(--surface);
  --color-text: var(--text);
  --color-muted: var(--muted);
  --color-accent: var(--accent);
  --color-success: var(--success);
  --color-warning: var(--warning);
  --color-danger: var(--danger);
}

/* 02 · Base y accesibilidad -------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  min-width: 280px;
  background: var(--bg);
  scroll-padding-top: calc(var(--topbar-height) + 20px);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(ellipse at 85% 0, rgb(104 126 80 / 7%), transparent 42%), var(--bg);
  font: 400 15px/1.6 var(--font-sans);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: rgb(194 246 113 / 16%);
}
body.modal-open, body.drawer-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { touch-action: manipulation; }
button { color: inherit; cursor: pointer; }
button, input, select, textarea, a { -webkit-tap-highlight-color: transparent; }
button { -webkit-appearance: none; appearance: none; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 4px; }
a:hover { color: var(--accent-hover); }
p { margin: 0 0 var(--space-4); }
p:last-child { margin-bottom: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.25; letter-spacing: -.025em; }
h1 { font-size: clamp(1.65rem, 4vw, 2.25rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.55rem); }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
small { font-size: .8125rem; }
strong, b { font-weight: 650; }
img, svg { max-width: 100%; vertical-align: middle; }
img { height: auto; }
table { border-collapse: collapse; }
hr { margin: var(--space-6) 0; border: 0; border-top: 1px solid var(--border-subtle); }
pre, code, kbd, samp { font-family: var(--font-mono); }
code { color: var(--cyan); font-size: .875em; overflow-wrap: anywhere; }
pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
::selection { color: var(--text); background: var(--accent-line); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }
[hidden] { display: none !important; }
[id] { scroll-margin-top: calc(var(--topbar-height) + 20px); }
.sr-only, .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link { position: fixed; top: -120px; left: 16px; z-index: 150; padding: 12px 20px; color: var(--on-accent); background: var(--accent); border-radius: var(--radius-md); }
.skip-link:focus { top: 12px; }
:is(.ic, .icon) { display: inline-block; width: 20px; height: 20px; flex: 0 0 auto; vertical-align: -.2em; }

/* 03 · Shell, cabecera y navegación ------------------------------------ */
#app, .app-shell, .shell { min-height: 100vh; min-height: 100dvh; }
.app-root { isolation: isolate; }
.app-shell, .shell { position: relative; }
.main-col { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: calc(var(--topbar-height) + env(safe-area-inset-top, 0px));
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--border-subtle);
  background: rgb(15 17 16 / 96%);
}
@supports (backdrop-filter: blur(16px)) {
  .topbar, .bottom-nav, .bottomnav { background: rgb(15 17 16 / 88%); backdrop-filter: blur(16px); }
}
.topbar-title { min-width: 0; flex: 1; overflow: hidden; font-size: 1rem; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); flex-shrink: 0; }
.brand:hover { color: var(--text); }
.logo-mark { display: block; width: 36px; height: 36px; flex-shrink: 0; filter: drop-shadow(0 4px 10px rgb(194 246 113 / 20%)); }
.brand-name { font-size: 1.25rem; font-weight: 800; letter-spacing: -.04em; }
.brand-name b { color: var(--accent); font-weight: 600; }
.brand-logo, .logo-full { display: block; width: 184px; max-width: 100%; height: auto; }
.credit-pill, .balance-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 8px 12px;
  color: var(--text);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.credit-pill :is(.ic, .icon), .balance-pill :is(.ic, .icon) { width: 17px; height: 17px; color: var(--accent); }
.credit-pill b, .balance-pill b { color: var(--text); font-size: .9375rem; font-weight: 750; }
.credit-pill > span, .balance-pill > span { color: var(--text-secondary); font-size: .6875rem; }
.credit-pill:hover, .balance-pill:hover { color: var(--text); background: var(--accent-soft); border-color: var(--accent); }
.avatar { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; flex: 0 0 auto; color: var(--accent-hover); background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius-md); font-size: .875rem; font-weight: 750; }
.avatar-top { display: none; width: 36px; height: 36px; }
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  width: min(320px, calc(100vw - 48px));
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-right: 1px solid var(--border-subtle);
  background: var(--field);
  box-shadow: var(--shadow-lg);
  visibility: hidden;
  transform: translateX(-102%);
  transition: transform var(--duration) var(--ease), visibility var(--duration);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 84px; padding: 18px 20px; }
.sidebar-close { flex-shrink: 0; }
.sidebar-balance { display: block; padding: 15px 16px; margin: 4px 18px 18px; border: 1px solid var(--accent-line); border-radius: var(--radius-md); color: var(--text); background: linear-gradient(125deg, var(--accent-soft), var(--surface)); }
.sidebar-balance:hover { border-color: var(--accent); color: var(--text); }
:is(.sb-label, .sidebar-balance-label) { display: block; margin-bottom: 5px; color: var(--text-secondary); font-size: .75rem; }
:is(.sb-amount, .sidebar-balance-amount) { display: flex; align-items: baseline; gap: 7px; }
:is(.sb-amount, .sidebar-balance-amount) :is(.ic, .icon) { align-self: center; color: var(--accent); }
:is(.sb-amount, .sidebar-balance-amount) b { font-size: 1.65rem; font-weight: 750; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
:is(.sb-amount, .sidebar-balance-amount) small { color: var(--muted); font-size: .75rem; }
.nav { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 12px 20px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.nav-title { padding: 17px 14px 9px; color: var(--muted); font-size: .625rem; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.nav-link { position: relative; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 11px 14px; margin: 3px 0; color: var(--text-secondary); border: 1px solid transparent; border-radius: var(--radius-sm); font-size: .875rem; font-weight: 500; transition: background var(--duration-fast), color var(--duration-fast); }
.nav-link :is(.ic, .icon) { width: 19px; height: 19px; color: var(--muted); }
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active, .nav-link[aria-current="page"] { color: var(--accent-hover); background: var(--accent-soft); border-color: var(--accent-line); }
.nav-link.active :is(.ic, .icon), .nav-link[aria-current="page"] :is(.ic, .icon) { color: var(--accent); }
.nav-link.active::before { content: ""; position: absolute; left: -1px; width: 3px; height: 18px; border-radius: 2px; background: var(--accent); }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 18px; border-top: 1px solid var(--border-subtle); }
.user-chip { display: flex; min-width: 0; align-items: center; gap: 10px; }
:is(.uc-text, .user-chip-text) { display: flex; min-width: 0; flex-direction: column; line-height: 1.5; }
:is(.uc-text, .user-chip-text) b { overflow: hidden; font-size: .8125rem; text-overflow: ellipsis; white-space: nowrap; }
:is(.uc-text, .user-chip-text) small { color: var(--muted); font-size: .6875rem; }
.drawer-backdrop { position: fixed; inset: 0; z-index: var(--z-backdrop); background: rgb(4 6 5 / 75%); opacity: 0; visibility: hidden; transition: opacity var(--duration), visibility var(--duration); }
.drawer-open .sidebar { visibility: visible; transform: translateX(0); }
.drawer-open .drawer-backdrop { visibility: visible; opacity: 1; }
.bottom-nav, .bottomnav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: var(--z-bottomnav);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  min-height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  padding: 6px max(6px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
  border-top: 1px solid var(--border);
  background: rgb(18 20 19 / 97%);
}
:is(.bn-link, .bottom-nav-link), .bottom-nav > a, .bottom-nav > button { display: flex; position: relative; flex: 1 1 0; min-width: 0; min-height: 56px; align-items: center; justify-content: center; flex-direction: column; gap: 5px; padding: 5px 2px; border: 0; border-radius: var(--radius-sm); color: var(--muted); background: transparent; font-size: .625rem; line-height: 1.2; font-weight: 600; text-align: center; }
:is(.bn-link, .bottom-nav-link) :is(.ic, .icon) { width: 21px; height: 21px; }
:is(.bn-link, .bottom-nav-link).active, .bottom-nav > [aria-current="page"] { color: var(--accent-hover); background: rgb(194 246 113 / 7%); }
:is(.bn-fab, .bottom-nav-fab) { display: flex; width: 38px; height: 32px; justify-content: center; align-items: center; margin-top: -2px; border: 1px solid var(--accent); border-radius: 10px; color: var(--on-accent); background: var(--accent); box-shadow: 0 4px 14px rgb(194 246 113 / 22%); }
.bn-main.active :is(.bn-fab, .bottom-nav-fab) { background: var(--accent-hover); }
.bn-main > span:last-child { color: var(--text-secondary); }
.main, .view-wrap, .view { width: 100%; max-width: var(--content-width); min-width: 0; margin: 0 auto; padding: var(--space-6) max(16px, env(safe-area-inset-right, 0px)) calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 32px) max(16px, env(safe-area-inset-left, 0px)); }
.page { min-width: 0; animation: page-in 240ms var(--ease) both; }
.page-home, .page-servers, .page-accounts, .page-admin-users, .page-admin-pricing, .page-transactions { width: 100%; min-width: 0; }
.page-account, .page-topup { max-width: 1120px; margin-right: auto; margin-left: auto; }
.page-profile { max-width: 920px; margin-right: auto; margin-left: auto; }
.page > * + * { margin-top: var(--space-6); }
:is(.page-header, .page-head) { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: var(--space-6); }
:is(.page-header, .page-head) h1, :is(.page-header, .page-head) h2 { margin-bottom: 6px; }
:is(.page-header, .page-head) p, :is(.page-subtitle, .page-sub) { max-width: 64ch; color: var(--muted); font-size: .875rem; }
:is(.page-header, .page-head) :is(.actions, .page-actions) { margin-left: auto; }
.eyebrow { display: block; margin-bottom: 8px; color: var(--accent); font-size: .6875rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.section-head, .card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.section-head h2, .card-head h2, .card-head h3 { font-size: 1.0625rem; }
.section-head a { min-height: 32px; display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; }

/* 04 · Rejillas, superficies y resúmenes -------------------------------- */
.grid, .card-grid, .stat-grid { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
.grid > *, .card-grid > *, .stat-grid > *, .flex > * { min-width: 0; }
.grid-stats, .stats-grid, .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { min-width: 0; padding: var(--space-5); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.card > h2, .card > h3 { margin-bottom: 16px; }
.card-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--border-subtle); }
.card-body { min-width: 0; }
.card-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 18px; margin-top: 20px; border-top: 1px solid var(--border-subtle); }
.card-flush { padding: 0; }
.card-soft { background: var(--surface-2); box-shadow: none; }
.card-accent { border-color: var(--accent-line); background: linear-gradient(120deg, var(--accent-soft), var(--surface)); }
.stat { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; padding: 18px; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.stat-label, .stat > small { color: var(--muted); font-size: .75rem; }
.stat-value, .stat-number { font-size: clamp(1.65rem, 4vw, 2.2rem); line-height: 1.12; font-weight: 750; letter-spacing: -.055em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-value small { margin-left: 4px; color: var(--muted); font-size: .75rem; font-weight: 500; letter-spacing: 0; }
.stat-icon { display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center; color: var(--accent); background: var(--accent-soft); border-radius: 10px; }
.stat-foot, .stat-hint { color: var(--muted); font-size: .6875rem; }
.stat-primary { border-color: var(--accent-line); background: linear-gradient(140deg, var(--accent-soft), var(--surface)); }
.stat-primary .stat-value { color: var(--accent-hover); }
.hero, .welcome-card { position: relative; overflow: hidden; padding: 24px; border: 1px solid var(--accent-line); border-radius: var(--radius-xl); background: radial-gradient(ellipse at 100% 0, rgb(194 246 113 / 20%), transparent 65%), linear-gradient(120deg, var(--accent-soft), var(--surface)); }
.hero h1, .hero h2, .welcome-card h1, .welcome-card h2 { max-width: 26ch; margin-bottom: 10px; }
.hero p, .welcome-card p { max-width: 54ch; color: var(--text-secondary); }
.hero :is(.actions, .page-actions), .welcome-card :is(.actions, .page-actions) { margin-top: 20px; }
.list { padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 16px 18px; min-width: 0; }
.list-row + .list-row { border-top: 1px solid var(--border-subtle); }
.list-title { color: var(--text); font-size: .875rem; font-weight: 600; }
.list-sub { color: var(--muted); font-size: .75rem; }
.list-row .amount { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list-row > :is(.ic, .icon) { color: var(--muted); }

/* 05 · Botones, chips y estados ---------------------------------------- */
.btn, .btn-icon, .btn-copy {
  display: inline-flex;
  position: relative;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: var(--surface-2);
  font-size: .875rem;
  line-height: 1.4;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background var(--duration-fast), border-color var(--duration-fast), color var(--duration-fast), box-shadow var(--duration-fast), transform var(--duration-fast);
}
.btn-primary { color: var(--on-accent); border-color: var(--accent); background: linear-gradient(110deg, var(--accent), var(--accent-hover)); box-shadow: 0 3px 12px rgb(194 246 113 / 16%); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-danger { color: var(--danger); border-color: #864859; background: var(--danger-soft); }
.btn-sm { min-height: 36px; padding: 7px 11px; border-radius: var(--radius-sm); font-size: .75rem; }
.btn-lg { min-height: 50px; padding: 13px 22px; }
.btn-block, .btn-full { display: flex; width: 100%; }
.btn-icon, .btn-copy { width: 44px; height: 44px; min-width: 44px; padding: 10px; flex-shrink: 0; background: transparent; border-color: transparent; }
.btn-copy { color: var(--muted); }
.btn :is(.ic, .icon) { width: 18px; height: 18px; }
.btn:active:not(:disabled), .btn-icon:active:not(:disabled), .btn-copy:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn-icon:disabled, .btn-copy:disabled, .btn[aria-disabled="true"] { color: var(--muted); border-color: var(--border); background: var(--surface-3); box-shadow: none; cursor: not-allowed; opacity: .7; transform: none; }
a.btn[aria-disabled="true"] { pointer-events: none; }
.btn-copy :is(.ic-ok, .icon-copied) { display: none; }
.btn-copy:is(.copied, .is-copied) { color: var(--success); background: var(--success-soft); }
.btn-copy:is(.copied, .is-copied) :is(.ic-copy, .icon-copy) { display: none; }
.btn-copy:is(.copied, .is-copied) :is(.ic-ok, .icon-copied) { display: block; }
.is-loading { cursor: progress; }
.btn.is-loading::before { content: ""; width: 15px; height: 15px; flex-shrink: 0; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 800ms linear infinite; }
.btn.is-loading > :is(.ic, .icon) { display: none; }
:is(.actions, .page-actions), .btn-group, .chip-group, .chips { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.actions-end { justify-content: flex-end; }
.chip { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 28px; padding: 4px 9px; color: var(--text-secondary); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .6875rem; line-height: 1.5; font-weight: 500; }
button.chip, a.chip, label.chip { min-height: 44px; padding: 9px 13px; cursor: pointer; transition: background var(--duration-fast), border-color var(--duration-fast); }
.chip.active, .chip.selected, .chip.is-active, .chip.is-selected, .chip[aria-pressed="true"], .chip[aria-selected="true"] { color: var(--accent-hover); border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgb(194 246 113 / 12%); }
.chip:disabled { opacity: .5; cursor: not-allowed; }
.badge { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 4px 8px; color: var(--text-secondary); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); font-size: .6875rem; line-height: 1.4; font-weight: 650; vertical-align: middle; }
.badge-ok, .badge-good { color: var(--success); background: var(--success-soft); border-color: #2f6652; }
.badge-warn { color: var(--warning); background: var(--warning-soft); border-color: #6c572f; }
.badge-bad, .badge-error { color: var(--danger); background: var(--danger-soft); border-color: #804555; }
.badge-info, .badge-ssh { color: var(--info); background: var(--info-soft); border-color: #315e70; }
:is(.badge-v2, .badge-v2ray), .badge-accent { color: var(--accent-hover); background: var(--accent-soft); border-color: var(--accent-line); }
.badge-off, .badge-offline { color: var(--offline); background: var(--surface-3); border-color: var(--border-strong); }
.badge-type { border-radius: 6px; }
:is(.dot, .badge-dot) { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge .sep { opacity: .7; }
.text-good, .text-success, .positive { color: var(--success); }
.text-warn, .text-warning { color: var(--warning); }
.text-bad, .text-danger, .negative { color: var(--danger); }
.text-info { color: var(--cyan); }
.text-accent { color: var(--accent); }
.text-muted, .muted { color: var(--muted); }
.text-off { color: var(--offline); }

/* 06 · Servidores ------------------------------------------------------- */
.server-card { display: flex; min-width: 0; flex-direction: column; gap: 20px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: linear-gradient(145deg, var(--surface), var(--field) 70%); box-shadow: var(--shadow-sm); transition: border-color var(--duration), box-shadow var(--duration); }
.server-card.selected, .server-card.is-selected, .server-card[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px rgb(194 246 113 / 16%), var(--shadow-glow); }
.server-card.offline, .server-card.is-offline { background: var(--surface); }
:is(.server-head, .server-card-head), :is(.server-heading, .server-card-heading) { display: flex; align-items: flex-start; gap: 13px; }
:is(.server-head, .server-card-head) > :not(.flag), :is(.server-heading, .server-card-heading) > :not(.flag) { min-width: 0; }
.flag { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 0 0 auto; vertical-align: middle; }
.flag-emoji { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 1.375rem; line-height: 1.2; }
.flag-code { padding: 2px 4px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; font-size: .5625rem; font-weight: 650; letter-spacing: .04em; }
.flag-lg { flex-direction: column; gap: 3px; min-width: 48px; }
.flag-lg .flag-emoji { font-size: 2rem; }
.flag-lg .flag-code { font-size: .5rem; line-height: 1; }
.server-title, .server-country, .server-card h3 { margin: 0 0 6px; font-size: 1.3rem; line-height: 1.25; font-weight: 750; letter-spacing: -.03em; }
.server-meta, .server-location { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: .75rem; line-height: 1.6; }
.server-latency { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.latency-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; color: var(--offline); background: currentColor; border-radius: 50%; vertical-align: .05em; }
.latency-dot.good, .latency-dot.medium, .latency-dot.bad { animation: signal-pulse 3s ease-out infinite; }
.latency-dot.good { color: var(--success); }
.latency-dot.medium { color: var(--warning); }
.latency-dot.bad { color: var(--danger); }
.latency-dot.offline, .latency-dot.off { color: var(--offline); animation: none; }
.server-speed { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 11px 13px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); color: var(--text-secondary); background: rgb(7 9 16 / 36%); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.server-speed > :is(.ic, .icon) { color: var(--cyan); width: 17px; height: 17px; }
.speed-label { font-size: .75rem; font-weight: 650; }
.speed-label.good, .speed-label.fast, .speed-label.rapido, .speed-label[data-speed="Rápido"] { color: var(--success); }
.speed-label.info, .speed-label.stable, .speed-label.estable, .speed-label[data-speed="Estable"] { color: var(--cyan); }
.speed-label.warn, .speed-label.medium, .speed-label.moderado, .speed-label[data-speed="Moderado"] { color: var(--warning); }
.speed-label.bad, .speed-label.saturated, .speed-label.saturado, .speed-label[data-speed="Saturado"] { color: var(--danger); }
.speed-label.off, .speed-label.offline, .speed-label[data-speed="Sin conexión"] { color: var(--offline); }
.server-protocols { display: grid; gap: 10px; }
:is(.protocols-title, .server-protocols-title), .server-protocols > h4 { color: var(--muted); font-size: .625rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.protocol-group { display: flex; align-items: flex-start; gap: 8px; }
:is(.protocol-label, .protocol-group-name) { flex: 0 0 42px; padding-top: 5px; color: var(--text-secondary); font-size: .6875rem; font-weight: 650; }
.protocol-chips { display: flex; flex: 1; flex-wrap: wrap; gap: 5px; }
.protocol-chips .chip { min-height: 25px; padding: 3px 7px; font-size: .625rem; background: var(--surface-2); border-color: var(--border); }
:is(.capacity, .server-capacity) { margin-top: auto; }
:is(.capacity-meta, .server-capacity-head) { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; color: var(--muted); font-size: .6875rem; font-variant-numeric: tabular-nums; }
.capacity-bar, .progress { height: 6px; overflow: hidden; border-radius: var(--radius-pill); background: var(--border-subtle); }
.capacity-fill, .progress-fill, .progress-bar { display: block; height: 100%; max-width: 100%; width: var(--progress, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--accent-strong), var(--accent)); transition: width 500ms var(--ease); }
.capacity-fill.warn, .progress-fill.warn { background: var(--warning); }
.capacity-fill.bad, .progress-fill.bad { background: var(--danger); }
:is(.server-foot, .server-card-foot) { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
:is(.server-foot, .server-card-foot) > .btn { flex: 1; }
.server-card > .btn:last-child { width: 100%; }
:is(.server-foot, .server-card-foot) small { color: var(--muted); font-size: .6875rem; }

/* 07 · Formularios ------------------------------------------------------ */
.form, .form-stack { display: grid; gap: var(--space-5); }
.field, .form-field { display: flex; min-width: 0; flex-direction: column; gap: 7px; }
.field > label, .form-field > label, .field-label { display: block; color: var(--text-secondary); font-size: .8125rem; font-weight: 600; }
.field input, .field select, .field textarea, .form-field input, .form-field select, .form-field textarea, .input, .select, .textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 11px 13px;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--field);
  font-size: 16px;
  line-height: 1.4;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast), background var(--duration-fast);
}
.field input::placeholder, .form-field input::placeholder, .input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.field textarea, .form-field textarea, .textarea { min-height: 120px; resize: vertical; }
.field select, .form-field select, .select { padding-right: 38px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23ccd5e7' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.8'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-position: right 12px center; background-repeat: no-repeat; }
select option, select optgroup { color: var(--text); background: var(--surface); }
.field input:focus, .field select:focus, .field textarea:focus, .form-field input:focus, .form-field select:focus, .form-field textarea:focus, .input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(194 246 113 / 14%); }
.field-help, .field-hint, .form-help, .help { color: var(--muted); font-size: .75rem; line-height: 1.6; }
.field-error, .form-error { color: var(--danger); font-size: .75rem; line-height: 1.6; }
.field-error:empty, .form-error:empty { display: none; }
.has-error input, .has-error select, .has-error textarea, [aria-invalid="true"] { border-color: var(--danger); }
.field input:disabled, .field select:disabled, .field textarea:disabled, .form-field input:disabled, .form-field select:disabled, .form-field textarea:disabled, .input:disabled { color: var(--muted); background: var(--surface-2); cursor: not-allowed; opacity: .7; }
.field input[readonly], .form-field input[readonly] { color: var(--text-secondary); background: var(--surface); }
.field input[type="checkbox"], .field input[type="radio"], .form-field input[type="checkbox"], .form-field input[type="radio"], .check input, .checkbox input { display: inline-block; width: 20px; height: 20px; min-height: 20px; margin: 0; padding: 0; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.field input[type="range"], .form-field input[type="range"] { padding: 0; accent-color: var(--accent); }
.check, .checkbox, .check-row { display: flex; min-height: 44px; align-items: center; gap: 10px; color: var(--text-secondary); font-size: .8125rem; cursor: pointer; }
.input-wrap, .password-wrap, .input-group { display: flex; position: relative; min-width: 0; align-items: center; }
.input-wrap > input, .password-wrap > input { padding-right: 50px; }
.input-wrap > .btn-icon, .password-wrap > .btn-icon { position: absolute; top: 1px; right: 2px; }
.input-group { gap: 8px; }
.input-group > input { flex: 1; width: 0; }
.input-group > .btn { flex-shrink: 0; }
.search { position: relative; flex: 1; min-width: min(100%, 200px); }
.search > :is(.ic, .icon) { position: absolute; top: 13px; left: 13px; color: var(--muted); }
.search > input { padding-left: 42px; }
.filters, .toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.filters select, .toolbar select { width: auto; max-width: 100%; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: 10px; color: var(--text-secondary); font-size: .8125rem; font-weight: 650; }
input:-webkit-autofill { -webkit-text-fill-color: var(--text); caret-color: var(--text); box-shadow: 0 0 0 1000px var(--surface) inset; }

/* 08 · Tabs y asistente de compra -------------------------------------- */
.tabs { display: flex; max-width: 100%; align-items: center; gap: 4px; padding: 5px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--field); overflow-x: auto; scrollbar-width: thin; }
.tab, .tabs > button, .tabs > a { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; flex: 1 0 auto; gap: 7px; padding: 10px 14px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: .8125rem; font-weight: 600; white-space: nowrap; cursor: pointer; }
.tab.active, .tab[aria-selected="true"], .tabs > .active, .tabs > [aria-selected="true"] { color: var(--accent-hover); border-color: var(--accent-line); background: var(--accent-soft); box-shadow: var(--shadow-sm); }
.tab:disabled, .tabs > button:disabled { color: var(--muted); opacity: .5; cursor: not-allowed; }
.stepper { display: flex; width: 100%; gap: 6px; margin: 0; padding: 0; list-style: none; counter-reset: purchase-step; }
.step { display: flex; position: relative; flex: 1 1 0; min-width: 0; align-items: center; flex-direction: column; gap: 8px; color: var(--muted); font-size: .6875rem; text-align: center; counter-increment: purchase-step; }
.step:not(:last-child)::after { content: ""; position: absolute; top: 17px; left: calc(50% + 22px); width: calc(100% - 38px); height: 1px; background: var(--border); }
.step-num, .step-number { display: flex; position: relative; z-index: 1; width: 36px; height: 36px; flex-shrink: 0; align-items: center; justify-content: center; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface); font-size: .8125rem; font-weight: 700; }
.step-label { display: block; max-width: 100%; overflow-wrap: anywhere; }
.step.active, .step.is-active, .step[aria-current="step"] { color: var(--accent-hover); }
.step.active .step-num, .step.active .step-number, .step.is-active .step-num, .step[aria-current="step"] .step-num { color: var(--on-accent); border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 5px rgb(194 246 113 / 8%); }
.step.done, .step.complete, .step.is-complete { color: var(--success); }
.step.done .step-num, .step.complete .step-num, .step.is-complete .step-num { color: var(--success); border-color: #4e9276; background: var(--success-soft); }
.step.done::after, .step.complete::after, .step.is-complete::after { background: #4e9276; }
.wizard, .purchase-wizard { display: grid; gap: 24px; }
.wizard-body { min-width: 0; }
.wizard-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border-subtle); }
.wizard-actions .btn { flex: 1; }
.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.option-card { display: flex; min-height: 76px; flex-direction: column; justify-content: center; gap: 5px; padding: 15px; text-align: left; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; }
.option-card.selected, .option-card.active, .option-card[aria-pressed="true"], .option-card[aria-checked="true"] { color: var(--accent-hover); background: var(--accent-soft); border-color: var(--accent); }
.option-card small { color: var(--muted); font-size: .75rem; }
.quote, .purchase-summary { padding: 20px; border: 1px solid var(--accent-line); border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--accent-soft), var(--surface)); }
.quote-total, .summary-total { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--accent-line); }
.quote-total strong, .summary-total strong { color: var(--accent-hover); font-size: 1.75rem; font-weight: 750; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.summary-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 7px 0; font-size: .8125rem; }
.summary-row > :first-child { color: var(--muted); }
.summary-row > :last-child { min-width: 0; text-align: right; overflow-wrap: anywhere; }

/* 09 · Tablas: cada fila es una tarjeta en móvil ------------------------ */
.table-wrap { min-width: 0; max-width: 100%; overflow-x: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--surface); }
.table { width: 100%; color: var(--text-secondary); font-size: .8125rem; text-align: left; }
.table th, .table td { padding: 15px 18px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.table th { color: var(--muted); background: var(--surface); font-size: .625rem; line-height: 1.4; letter-spacing: .07em; font-weight: 700; text-transform: uppercase; }
.table th:first-child { border-top-left-radius: var(--radius-lg); }
.table th:last-child { border-top-right-radius: var(--radius-lg); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td { overflow-wrap: anywhere; }
.table td b, .table td strong { color: var(--text); }
.table :is(.actions, .page-actions) { flex-wrap: nowrap; }
.table caption { padding: 16px 18px; color: var(--text); font-weight: 600; text-align: left; }
.table .cell-sub { display: block; margin-top: 3px; color: var(--muted); font-size: .6875rem; }
.table .cell-user { display: flex; align-items: center; gap: 10px; }
.table .cell-user .avatar { width: 32px; height: 32px; font-size: .75rem; }
.table-empty { padding: 32px; color: var(--muted); text-align: center; }
.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 0; color: var(--muted); font-size: .75rem; }
@media (max-width: 699px) {
  .table-wrap { border: 0; border-radius: 0; background: transparent; overflow-x: auto; }
  .table, .table tbody { display: block; }
  /* Encabezado disponible para lectores de pantalla. */
  .table thead { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .table tbody tr { display: grid; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
  .table tbody tr + tr { margin-top: 12px; }
  .table td { display: grid; grid-template-columns: minmax(82px, .8fr) minmax(0, 1.4fr); align-items: center; gap: 12px; padding: 9px 0; border: 0; font-size: .8125rem; }
  .table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .75rem; font-weight: 500; }
  .table td:not([data-label]), .table td[colspan] { display: block; }
  .table td[data-label="Acciones"] { grid-template-columns: 1fr; }
  .table td[data-label="Acciones"]::before { display: none; }
  .table td :is(.actions, .page-actions) { justify-content: flex-start; flex-wrap: wrap; }
  .table td .btn-sm, .table td .btn-icon { min-height: 44px; }
  .table td .badge { justify-self: start; }
  .table td[data-label] > .cell-sub { grid-column: 2; }
  .card > .table-wrap { margin: 0; }
}

/* 10 · Credenciales, QR y terminal ------------------------------------- */
.copy-row { display: flex; min-width: 0; align-items: center; gap: 10px; padding: 12px 13px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--field); }
.copy-row + .copy-row { margin-top: 10px; }
.copy-content, .copy-data { flex: 1; min-width: 0; }
.copy-label { display: block; margin-bottom: 3px; color: var(--muted); font-size: .6875rem; font-weight: 500; }
.copy-value, .copy-row code { display: block; max-width: 100%; color: var(--text); font: 400 .8125rem/1.65 var(--font-mono); overflow-wrap: anywhere; white-space: pre-wrap; user-select: text; }
.copy-row > code { flex: 1; min-width: 0; }
.copy-row .btn-copy { align-self: center; border-color: var(--border); background: var(--surface-2); }
.copy-row .btn { flex-shrink: 0; }
.credentials { display: grid; gap: 10px; }
.credentials .copy-row + .copy-row { margin-top: 0; }
.qr { display: inline-flex; align-items: center; justify-content: center; width: fit-content; max-width: 100%; padding: 16px; border: 1px solid #fff; border-radius: var(--radius-lg); color: var(--surface); background: #fff; box-shadow: var(--shadow-md); }
.qr img, img.qr { display: block; width: 220px; max-width: 100%; height: auto; }
img.qr { box-sizing: content-box; max-width: calc(100% - 34px); }
.qr-grid { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 24px; }
.qr-item { max-width: 100%; text-align: center; }
.qr-item > p, .qr-caption { margin-top: 12px; color: var(--muted); font-size: .75rem; }
.console { min-height: 180px; max-height: 420px; padding: 18px; overflow: auto; overscroll-behavior: contain; border: 1px solid #35433d; border-radius: var(--radius-md); color: #91edbd; background: var(--bg-deep); font: 400 .75rem/1.85 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-width: thin; scrollbar-color: #35433d transparent; tab-size: 2; }
.console .log-time { color: #a4bcb6; }
.console .log-error { color: var(--danger); }
.console .log-warn { color: var(--warning); }
.console-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; color: var(--muted); background: var(--info-soft); border: 1px solid #35433d; border-bottom: 0; border-radius: var(--radius-md) var(--radius-md) 0 0; font: 400 .6875rem var(--font-mono); }
.console-head + .console { border-top-left-radius: 0; border-top-right-radius: 0; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.detail-list { display: grid; gap: 0; margin: 0; }
.detail-list > div { display: grid; grid-template-columns: minmax(90px, .8fr) minmax(0, 1.2fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-subtle); }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); font-size: .75rem; }
.detail-list dd { margin: 0; font-size: .8125rem; overflow-wrap: anywhere; }

/* 11 · Modales y avisos ------------------------------------------------- */
.modal-root { display: flex; position: fixed; inset: 0; z-index: var(--z-modal); align-items: flex-end; justify-content: center; padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)); visibility: hidden; opacity: 0; transition: opacity 200ms var(--ease), visibility 200ms; }
.modal-backdrop { position: absolute; inset: 0; background: rgb(3 5 11 / 80%); }
.modal { position: relative; width: 100%; max-width: 560px; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--border-strong); border-radius: var(--radius-xl); color: var(--text); background: var(--surface); box-shadow: var(--shadow-lg); transform: translateY(18px); transition: transform 200ms var(--ease); }
.modal-root.show, .modal-root.is-open { visibility: visible; opacity: 1; }
.modal-root.show .modal, .modal-root.is-open .modal { transform: translateY(0); }
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 800px; }
.modal-head { display: flex; position: sticky; top: 0; z-index: 1; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border-subtle); background: var(--surface); }
.modal-head h3 { font-size: 1rem; }
.modal-body { padding: 20px; }
.modal-body > * + * { margin-top: 16px; }
.modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 20px; margin-top: 24px; border-top: 1px solid var(--border-subtle); }
.modal-actions > .btn { flex: 1; }
:is(.confirm-ic, .confirm-icon) { display: inline-flex; width: 48px; height: 48px; align-items: center; justify-content: center; border-radius: var(--radius-md); color: var(--accent); background: var(--accent-soft); }
.confirm-ic-danger { color: var(--danger); background: var(--danger-soft); }
.confirm-msg { color: var(--text-secondary); font-size: .875rem; }
#toasts, .toast-container, .toast-stack { display: flex; position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 16px); left: max(16px, env(safe-area-inset-left, 0px)); z-index: var(--z-toast); flex-direction: column; align-items: stretch; gap: 10px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 14px 16px; color: var(--text); border: 1px solid #4b635c; border-left: 3px solid var(--success); border-radius: var(--radius-md); background: #16251f; box-shadow: var(--shadow-lg); font-size: .8125rem; line-height: 1.5; opacity: 0; transform: translateY(10px); transition: opacity 200ms, transform 200ms var(--ease); pointer-events: auto; }
.toast.show, .toast.is-visible { opacity: 1; transform: translateY(0); }
:is(.toast-ic, .toast-icon) { display: inline-flex; color: var(--success); flex-shrink: 0; }
.toast-msg { min-width: 0; overflow-wrap: anywhere; }
.toast-error, .toast-bad { border-color: #824c59; border-left-color: var(--danger); background: #321e29; }
.toast-error :is(.toast-ic, .toast-icon), .toast-bad :is(.toast-ic, .toast-icon) { color: var(--danger); }
.toast-info { border-color: #3a697a; border-left-color: var(--cyan); background: var(--info-soft); }
.toast-info :is(.toast-ic, .toast-icon) { color: var(--cyan); }
.toast-warn { border-color: #786039; border-left-color: var(--warning); background: #302919; }
.toast-warn :is(.toast-ic, .toast-icon) { color: var(--warning); }
.alert, .notice { display: flex; align-items: flex-start; gap: 11px; padding: 15px 16px; border: 1px solid #315e70; border-radius: var(--radius-md); color: var(--info); background: var(--info-soft); font-size: .8125rem; }
.alert > :is(.ic, .icon), .notice > :is(.ic, .icon) { margin-top: 2px; }
.alert-warn, .notice-warn { color: var(--warning); border-color: #6c572e; background: var(--warning-soft); }
.alert-bad, .alert-error, .notice-error { color: var(--danger); border-color: #804555; background: var(--danger-soft); }
.alert-ok, .alert-success, .notice-success { color: var(--success); border-color: #2f6652; background: var(--success-soft); }
.alert a, .notice a { color: inherit; text-decoration: underline; }

/* 12 · Carga, vacío y errores ------------------------------------------ */
.spinner { display: inline-block; width: 26px; height: 26px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 800ms linear infinite; vertical-align: middle; }
.spinner-sm { width: 16px; height: 16px; }
.boot, .boot-error { display: flex; min-height: 100vh; min-height: 100dvh; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 24px; }
.boot-error > .logo-mark { width: 52px; height: 52px; }
.skeleton, .sk { position: relative; overflow: hidden; border-radius: var(--radius-sm); background: var(--surface-3); }
.skeleton::after, .sk::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 10%, rgb(176 187 219 / 8%) 50%, transparent 90%); transform: translateX(-100%); animation: shimmer 1.8s ease-in-out infinite; }
:is(.sk-line, .skeleton-line) { height: 12px; margin: 8px 0; }
:is(.sk-block, .skeleton-block) { height: 72px; margin-top: 20px; }
:is(.sk-circle, .skeleton-circle) { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; }
.skeleton-card { min-height: 166px; }
:is(.sk-row, .skeleton-row) { min-height: 80px; }
:is(.w15, .w-15) { width: 15%; }
:is(.w30, .w-30) { width: 30%; }
:is(.w40, .w-40) { width: 40%; }
:is(.w50, .w-50) { width: 50%; }
:is(.w70, .w-70) { width: 70%; }
.empty, .empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 260px; padding: 40px 20px; text-align: center; }
:is(.empty-ic, .empty-icon), .empty-state-icon { display: inline-flex; width: 64px; height: 64px; align-items: center; justify-content: center; margin-bottom: 4px; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 20px; }
:is(.empty-ic, .empty-icon) :is(.ic, .icon), .empty-state-icon :is(.ic, .icon) { width: 28px; height: 28px; }
.empty h3, .empty-state h3 { font-size: 1.125rem; }
.empty p, .empty-state p { max-width: 44ch; color: var(--muted); font-size: .8125rem; }
.empty .btn, .empty-state .btn { margin-top: 6px; }
.empty-error :is(.empty-ic, .empty-icon) { color: var(--danger); border-color: #754151; background: var(--danger-soft); }

/* 13 · Login ----------------------------------------------------------- */
.login, .login-page, .auth-page { display: flex; position: relative; isolation: isolate; min-height: 100vh; min-height: 100dvh; align-items: center; justify-content: center; flex-direction: column; gap: 24px; padding: max(28px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) max(28px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px)); background: radial-gradient(ellipse at 15% 15%, rgb(194 246 113 / 15%), transparent 52%), radial-gradient(ellipse at 90% 90%, rgb(130 165 110 / 8%), transparent 45%), var(--bg-deep); }
.login::before, .login-page::before, .auth-page::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(rgb(166 175 168 / 12%) .7px, transparent .7px); background-size: 24px 24px; pointer-events: none; }
.login-card, .auth-card { width: 100%; max-width: 420px; padding: 28px; border: 1px solid var(--accent-line); border-radius: var(--radius-xl); background: linear-gradient(145deg, var(--surface), var(--field) 70%); box-shadow: var(--shadow-lg), 0 0 80px rgb(194 246 113 / 5%); animation: page-in 400ms var(--ease) both; }
.login-brand, .auth-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 28px; }
.login-brand .logo-mark, .auth-brand .logo-mark { width: 46px; height: 46px; }
.login-brand .brand-name { font-size: 1.6rem; }
.login-head, .auth-head { margin-bottom: 26px; text-align: center; }
.login-head h1, .auth-head h1 { margin-bottom: 10px; font-size: 1.65rem; }
.login-head p, .auth-head p { color: var(--muted); font-size: .8125rem; }
.login-card form, .auth-card form { display: grid; gap: 20px; }
.login-card form > .btn, .auth-card form > .btn { width: 100%; margin-top: 4px; min-height: 48px; }
.login-foot, .login-footer, .auth-footer { color: var(--muted); font-size: .75rem; text-align: center; }
.login-card .login-foot { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border-subtle); }
.login-secure { display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); font-size: .6875rem; }
.login-secure :is(.ic, .icon) { width: 14px; height: 14px; color: var(--success); }

/* 14 · Vistas y nombres emitidos por la SPA ---------------------------- */
/* .main contiene la cabecera; .view lleva el espaciado del contenido. */
.app-shell > .main { width: 100%; max-width: none; min-width: 0; margin: 0; padding: 0; }
.view-root, .stat-body { min-width: 0; }
.page-title { font-size: clamp(1.55rem, 4vw, 2rem); }
.section-title, .card-title { display: flex; align-items: center; gap: 9px; }
.section-title .icon, .card-title .icon { color: var(--accent); width: 18px; height: 18px; }
.card-link, .back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-size: .8125rem; }
.card-link .icon, .back-link .icon { width: 16px; height: 16px; }
.back-link { min-height: 44px; }
.card-hint, .form-hint { margin-bottom: 16px; color: var(--muted); font-size: .75rem; line-height: 1.7; }
.form-field .form-hint { margin-bottom: 0; }
.form-label { color: var(--text-secondary); font-size: .8125rem; font-weight: 600; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding-top: 4px; }
.auth-form { width: 100%; }
.form-alert { padding: 12px 14px; border: 1px solid #804555; border-radius: var(--radius-sm); color: var(--danger); background: var(--danger-soft); font-size: .8125rem; }
.input-icon { position: absolute; top: 0; left: 13px; bottom: 0; display: flex; align-items: center; color: var(--muted); pointer-events: none; }
.input-icon + .input { padding-left: 42px; }
.input-wrap:not(.has-toggle) > .input { padding-right: 13px; }
.input-toggle { display: inline-flex; position: absolute; top: 1px; right: 2px; width: 44px; min-height: 44px; align-items: center; justify-content: center; padding: 10px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; }
.input-toggle:hover { color: var(--text); background: var(--surface-2); }
.input-mono { font-family: var(--font-mono); }
.input-inline { display: flex; min-width: 0; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: .75rem; }
.input-inline .input { flex: 0 1 110px; width: 110px; }
.form-label-inline { color: var(--text-secondary); }
.select-wrap { display: block; min-width: 0; }
.input-sm { min-height: 44px; }
select.input { padding-right: 38px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23ccd5e7' stroke-width='1.8'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.search-box { display: flex; position: relative; flex: 1 1 220px; min-width: 0; align-items: center; }
.search-box > .icon { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.search-box > .input { padding-left: 42px; }
.segmented { display: flex; max-width: 100%; align-items: stretch; gap: 3px; padding: 4px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--field); overflow-x: auto; scrollbar-width: thin; }
.segmented > button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 6px; padding: 9px 12px; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--muted); background: transparent; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.segmented > button.is-active, .segmented > button[aria-pressed="true"] { color: var(--accent-hover); background: var(--accent-soft); border-color: var(--accent-line); }
.segmented > button:hover:not(:disabled) { color: var(--text); }
.segmented > button:disabled { opacity: .5; cursor: not-allowed; }
.seg-count { min-width: 16px; padding: 1px 4px; border-radius: 4px; background: rgb(166 175 168 / 12%); font-size: .625rem; font-variant-numeric: tabular-nums; }
.chip-row, .badge-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.chip-select { gap: 8px; }
.chip-option { font-variant-numeric: tabular-nums; }
.chip-protocol { font-size: .625rem; min-height: 25px; padding: 3px 7px; background: var(--surface-2); border-color: var(--border); }
.chip[aria-checked="true"] { color: var(--accent-hover); background: var(--accent-soft); border-color: var(--accent); }
.badge-status { white-space: nowrap; }
.badge-sep { opacity: .7; }
.btn-danger-ghost { color: var(--danger); border-color: #804555; background: transparent; }
.btn-danger-ghost:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.btn-pay { min-width: 160px; }
.bottom-nav-link.active { color: var(--accent-hover); background: rgb(194 246 113 / 7%); }
.bottom-nav-link.is-primary > span:last-child { color: var(--text-secondary); }
.sidebar-balance-amount { flex-wrap: wrap; }
.auth-brand { flex-direction: column; gap: 12px; text-align: center; }
.auth-title { font-size: 1.8rem; font-weight: 800; }
.auth-title b { color: var(--accent); font-weight: 650; }
.auth-sub { color: var(--muted); font-size: .8125rem; }
.auth-foot { padding-top: 20px; margin-top: 24px; border-top: 1px solid var(--border-subtle); color: var(--muted); font-size: .75rem; text-align: center; }
.auth-legal { color: var(--muted); font-size: .6875rem; text-align: center; }
.profile-card { background: linear-gradient(130deg, var(--accent-soft), var(--surface) 70%); }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.avatar-lg { width: 60px; height: 60px; border-radius: var(--radius-lg); font-size: 1.5rem; }
.profile-id { min-width: 0; }
.profile-name { margin-bottom: 8px; overflow-wrap: anywhere; }
.fact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.fact { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.fact-label { color: var(--muted); font-size: .6875rem; }
.fact-value { color: var(--text-secondary); font-size: .8125rem; font-weight: 600; overflow-wrap: anywhere; }
.fact-sub { color: var(--muted); font-size: .6875rem; }
.balance-card { position: relative; overflow: hidden; padding: 26px; border-color: var(--accent-line); border-radius: var(--radius-xl); background: radial-gradient(ellipse at 95% 0, rgb(194 246 113 / 22%), transparent 60%), linear-gradient(110deg, var(--accent-soft), var(--surface)); box-shadow: var(--shadow-sm), var(--shadow-glow); }
.balance-label { display: flex; align-items: center; gap: 9px; color: var(--text-secondary); font-size: .8125rem; }
.balance-label .icon { color: var(--accent); }
.balance-amount { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; margin: 10px 0 4px; }
.balance-amount b { font-size: clamp(2.75rem, 9vw, 4rem); line-height: 1.12; font-weight: 750; letter-spacing: -.055em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.balance-unit { color: var(--text-secondary); font-size: .875rem; }
.balance-usd { margin-top: 12px; color: var(--text-secondary); font-size: .75rem; }
.balance-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.stat-body { display: grid; gap: 7px; }
.stat-sub { color: var(--muted); font-size: .6875rem; }
.stat-ok .stat-icon { color: var(--success); background: var(--success-soft); }
.stat-warn .stat-icon { color: var(--warning); background: var(--warning-soft); }
.stat-info .stat-icon { color: var(--cyan); background: var(--info-soft); }
.stat-accent .stat-icon { color: var(--accent); background: var(--accent-soft); }
.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.quick-action { display: flex; min-width: 0; min-height: 138px; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); color: var(--text); background: var(--surface); transition: background var(--duration-fast), border-color var(--duration-fast); }
.quick-action-icon { display: flex; width: 34px; height: 34px; align-items: center; justify-content: center; margin-bottom: 7px; color: var(--accent); background: var(--accent-soft); border-radius: 10px; }
.quick-action-label { font-size: .8125rem; font-weight: 650; }
.quick-action small { color: var(--muted); font-size: .6875rem; }
.quick-action:hover { color: var(--text); border-color: var(--accent-line); background: var(--surface-2); }
.server-card-title { min-width: 0; flex: 1; }
.server-badges { display: flex; flex-basis: 100%; flex-wrap: wrap; gap: 5px; }
.server-card-head { flex-wrap: wrap; }
.server-card-head .server-name { margin-top: 0; }
.server-city { overflow-wrap: anywhere; }
.server-sep { color: var(--muted); }
.server-mbps { display: inline-flex; align-items: center; gap: 6px; }
.server-mbps .icon { color: var(--cyan); width: 15px; height: 15px; }
.latency-good .server-latency { color: var(--success); }
.latency-medium .server-latency { color: var(--warning); }
.latency-bad .server-latency { color: var(--danger); }
.latency-offline .server-latency { color: var(--offline); }
.protocol-empty { font-size: .75rem; }
.protocol-group .chip-row { flex: 1; min-width: 0; }
.server-card.is-unavailable { border-style: dashed; }
.server-card.is-full .server-capacity-head b { color: var(--warning); }
.server-grid-select { align-items: stretch; }
.progress.is-warn .progress-bar { background: var(--warning); }
.progress.is-bad .progress-bar { background: var(--danger); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 12px 16px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .6875rem; }
.legend .latency-dot { animation: none; }
.refresh-info { font-size: .6875rem; }
.stepper-step { position: relative; flex: 1 1 0; min-width: 0; }
.stepper-step:not(:last-child)::after { content: ""; position: absolute; top: 22px; left: calc(50% + 21px); width: calc(100% - 42px); height: 1px; background: var(--border); }
.stepper-btn { display: flex; position: relative; width: 100%; min-height: 70px; flex-direction: column; align-items: center; justify-content: flex-start; gap: 8px; padding: 4px 1px 8px; border: 0; border-radius: var(--radius-sm); color: var(--muted); background: transparent; }
.stepper-num { display: flex; width: 36px; height: 36px; align-items: center; justify-content: center; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface); font-size: .8125rem; font-weight: 700; }
.stepper-num .icon { width: 17px; height: 17px; }
.stepper-label { font-size: .625rem; font-weight: 600; }
.stepper-btn:disabled { cursor: not-allowed; opacity: .6; }
.stepper-step.is-current .stepper-btn { color: var(--accent-hover); }
.stepper-step.is-current .stepper-num { color: var(--on-accent); border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px rgb(194 246 113 / 10%); }
.stepper-step.is-done .stepper-num { color: var(--success); border-color: #4e9276; background: var(--success-soft); }
.stepper-step.is-done::after { background: #4e9276; }
.page-create [data-root] > * + * { margin-top: 24px; }
.wizard-body > * + * { margin-top: 20px; }
.wizard-title { margin: 0 0 20px; }
.wizard-subtitle { margin-top: 28px; margin-bottom: 14px; color: var(--text-secondary); font-size: .875rem; }
.wizard-context { color: var(--muted); font-size: .8125rem; }
.wizard-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.wizard-total { display: flex; flex-direction: column; gap: 3px; font-variant-numeric: tabular-nums; }
.wizard-total-label { color: var(--muted); font-size: .6875rem; }
.wizard-total b { color: var(--accent-hover); font-size: 1.125rem; }
.wizard-total small { color: var(--text-secondary); font-size: .6875rem; font-weight: 500; }
.wizard-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.option-title { color: var(--text); font-size: 1rem; font-weight: 700; }
.option-desc { color: var(--muted); font-size: .75rem; line-height: 1.65; }
.option-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-bottom: 8px; color: var(--accent); border-radius: var(--radius-md); background: var(--accent-soft); }
.option-card.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.option-card:disabled { opacity: .5; cursor: not-allowed; }
.option-card-sm { min-height: 92px; }
.summary-list { margin: 0; }
.summary-row dd { margin: 0; }
.summary-row + .summary-row { border-top: 1px solid var(--border-subtle); }
.price-box { padding: 18px; border: 1px solid var(--accent-line); border-radius: var(--radius-md); background: linear-gradient(130deg, var(--accent-soft), var(--surface)); }
.price-box-lg { padding: 22px; }
.price-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 7px 0; color: var(--text-secondary); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.price-row > :last-child { min-width: 0; text-align: right; overflow-wrap: anywhere; }
.price-total { padding-top: 0; margin-bottom: 6px; color: var(--text); }
.price-total b { color: var(--accent-hover); font-size: 1.5rem; letter-spacing: -.03em; }
.price-total small { color: var(--text-secondary); font-size: .6875rem; font-weight: 500; letter-spacing: 0; }
.price-breakdown { margin-bottom: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--accent-line); color: var(--muted); font-size: .75rem; }
.price-breakdown.is-error, .is-negative { color: var(--danger); }
.is-positive { color: var(--success); }
.creating-block { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--info-soft); }
.loading-block { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 64px; color: var(--muted); font-size: .8125rem; }
.list-main { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 4px; }
.account-row { flex-wrap: wrap; color: var(--text); transition: background var(--duration-fast); }
.account-row-icon, .account-hero-icon, .tx-icon { display: inline-flex; width: 40px; height: 40px; flex: 0 0 auto; align-items: center; justify-content: center; color: var(--cyan); border-radius: var(--radius-md); background: var(--info-soft); }
.type-v2ray { color: var(--accent-hover); background: var(--accent-soft); }
.type-ssh { color: var(--cyan); background: var(--info-soft); }
.account-row-main { flex-basis: calc(100% - 64px); }
.account-row-title { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.account-row-title > b { max-width: 100%; color: var(--text); font-size: .8125rem; overflow-wrap: anywhere; }
.account-row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; color: var(--muted); font-size: .6875rem; line-height: 1.7; }
.account-row-meta .flag-emoji { font-size: 1rem; }
.account-row-meta .flag-code { display: none; }
.account-owner { display: inline-flex; align-items: center; gap: 4px; }
.account-owner .icon { width: 12px; height: 12px; }
.account-row-side { display: flex; flex-basis: 100%; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-left: 52px; }
.account-days { color: var(--muted); font-size: .6875rem; }
.account-days.is-soon { color: var(--warning); }
.account-list, .user-list { overflow: hidden; }
.row-chevron { display: none; color: var(--muted); }
.meta-sep { color: var(--muted); }
.account-hero { border-color: var(--accent-line); background: linear-gradient(135deg, var(--accent-soft), var(--surface) 65%); }
.account-hero.is-expired { border-color: #6c572f; }
.account-hero.is-error { border-color: #804555; }
.account-hero-top { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.account-hero-icon { width: 52px; height: 52px; }
.account-hero-icon .icon { width: 26px; height: 26px; }
.account-hero-title { flex: 1; min-width: 0; }
.account-title { margin-bottom: 10px; font-size: 1.4rem; overflow-wrap: anywhere; }
.account-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 22px; margin-top: 24px; border-top: 1px solid var(--accent-line); }
.account-actions > .btn:first-child { flex: 1 1 100%; }
.copy-row-text { flex: 1; min-width: 0; }
.copy-list { display: grid; gap: 10px; }
.copy-list .copy-row + .copy-row { margin-top: 0; }
.copy-row.is-secret .copy-value { color: var(--accent-hover); }
.v2ray-links, .code-blocks { display: grid; gap: 20px; }
.v2ray-link { display: flex; min-width: 0; flex-direction: column; align-items: center; gap: 20px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--field); }
.v2ray-link .qr { flex: 0 0 auto; padding: 12px; border-radius: var(--radius-md); }
.v2ray-link .qr img { width: 180px; }
.v2ray-link-body { width: 100%; min-width: 0; }
.v2ray-link-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.v2ray-link-name { color: var(--text-secondary); font-size: .8125rem; overflow-wrap: anywhere; }
.v2ray-link-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.code { padding: 14px; color: var(--text-secondary); background: var(--bg); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); font: 400 .75rem/1.8 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
.code-wrap { max-height: 200px; overflow-y: auto; }
.code-block { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.code-block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 8px 5px 16px; color: var(--muted); background: var(--surface-2); font-size: .75rem; }
.code-block > .code { border: 0; border-top: 1px solid var(--border); border-radius: 0; }
.qr-lg { display: flex; width: fit-content; margin-right: auto; margin-left: auto; }
.qr-lg img { width: 320px; }
.notes-text { color: var(--text-secondary); font-size: .8125rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.notes-card { border-color: var(--border); }
.tx-title { color: var(--text); font-size: .8125rem; font-weight: 600; }
.tx-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; color: var(--muted); font-size: .6875rem; }
.tx-note { overflow-wrap: anywhere; }
.tx-account { color: var(--accent); }
.tx-date { font-variant-numeric: tabular-nums; }
.tx-list > .tx-row:first-child { padding-top: 0; }
.tx-list > .tx-row:last-child { padding-bottom: 0; }
.tx-side { display: flex; max-width: 42%; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; font-variant-numeric: tabular-nums; }
.tx-amount { font-size: .875rem; overflow-wrap: anywhere; }
.tx-balance { color: var(--muted); font-size: .625rem; }
.tx-in .tx-icon { color: var(--success); background: var(--success-soft); }
.tx-out .tx-icon { color: var(--accent); background: var(--accent-soft); }
.list-more { display: flex; justify-content: center; padding: 20px 0 4px; }
.topup-hero { border-color: var(--accent-line); background: linear-gradient(130deg, var(--accent-soft), var(--surface)); }
.topup-rate { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; font-size: clamp(1.5rem, 5vw, 2rem); line-height: 1.3; font-weight: 750; letter-spacing: -.04em; }
.topup-rate-eq { color: var(--muted); font-weight: 400; }
.topup-rate-usd { color: var(--text); }
.topup-rate-cr { color: var(--accent-hover); }
.topup-balance { margin-bottom: 24px; color: var(--text-secondary); font-size: .8125rem; }
.topup-hero > .copy-list { margin-top: 20px; }
.package-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.package { display: flex; min-width: 0; flex-direction: column; gap: 7px; padding: 20px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-2); }
.package-usd { font-size: 1.375rem; line-height: 1.3; font-weight: 750; letter-spacing: -.035em; }
.package-cr { color: var(--accent-hover); font-size: .8125rem; font-weight: 600; }
.package-hint { color: var(--muted); font-size: .6875rem; }
.price-cr { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.price-usd { display: block; margin-top: 2px; color: var(--muted); font-size: .6875rem; }
.price-table { text-align: center; }
.price-table th { white-space: nowrap; }
.price-table + .form-hint { margin: 16px 0 0; }
.steps-list { display: grid; gap: 16px; margin: 0; padding-left: 22px; color: var(--text-secondary); font-size: .8125rem; }
.steps-list li { padding-left: 6px; }
.steps-list li::marker { color: var(--accent); font-weight: 750; }
.confirm-icon.danger { color: var(--danger); background: var(--danger-soft); }
.skeleton-lg { height: 28px; }
.skeleton-xl { height: 52px; }
.w-20 { width: 20%; }
.w-60 { width: 60%; }
.empty-state.is-error .empty-icon { color: var(--danger); border-color: #754151; background: var(--danger-soft); }
.noscript { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; color: var(--text); background: var(--bg); text-align: center; }
.speed-label.moderate { color: var(--warning); }
.input-group > .input-wrap { flex: 1; min-width: 0; }
.form-grid, .form-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.form-field-wide { grid-column: 1 / -1; }
.input-lg { min-height: 52px; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.input-with-addon { display: flex; min-width: 0; align-items: stretch; }
.input-addon { display: flex; min-width: 64px; align-items: center; justify-content: center; padding: 6px 10px; border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--radius-md) 0 0 var(--radius-md); background: var(--surface-2); }
.input-with-addon > .input { flex: 1; width: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.switch-field { display: flex; position: relative; min-height: 44px; align-items: center; gap: 12px; cursor: pointer; }
.switch-field > input { position: absolute; left: 0; width: 44px; height: 26px; margin: 0; opacity: 0; cursor: pointer; }
.switch { position: relative; display: inline-flex; width: 44px; height: 26px; flex: 0 0 auto; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); background: var(--surface-3); pointer-events: none; transition: background var(--duration-fast); }
.switch::before { content: ""; position: absolute; top: 4px; left: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-secondary); transition: transform var(--duration-fast); }
.switch-field > input:checked + .switch { border-color: var(--accent); background: var(--accent); }
.switch-field > input:checked + .switch::before { transform: translateX(18px); background: var(--on-accent); }
.switch-field > input:focus-visible + .switch { outline: 3px solid var(--focus); outline-offset: 3px; }
.switch-field > input:disabled + .switch, .switch-field > input:disabled ~ .switch-label { opacity: .6; }
.switch-label { color: var(--text-secondary); font-size: .8125rem; }
.switch-label small { display: block; font-size: .6875rem; }
.segmented-block > button { flex: 1; }
.quick-amounts { gap: 8px; }
.credit-current { padding: 15px; color: var(--text-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-2); font-size: .8125rem; }
.credit-current b { color: var(--accent-hover); font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.user-row { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; }
.user-row-title { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .875rem; }
.user-row-title b { overflow-wrap: anywhere; }
.user-row-meta { display: flex; flex-wrap: wrap; gap: 3px 6px; color: var(--muted); font-size: .6875rem; }
.user-note { overflow-wrap: anywhere; }
.user-credits { display: flex; grid-column: 2; flex-wrap: wrap; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.user-credits b { color: var(--text); font-size: 1.125rem; font-weight: 700; }
.user-credits small { color: var(--muted); font-size: .6875rem; }
.row-actions { display: flex; grid-column: 1 / -1; flex-wrap: wrap; gap: 6px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.row-actions > .btn, .admin-server-actions > .btn { min-height: 44px; }
.btn-icon-only { min-width: 44px; width: 44px; padding: 10px; flex: 0 0 auto; }
.user-row.is-inactive { background: var(--surface); }
.is-off { color: var(--warning); }
.admin-server-card.is-disabled { border-style: dashed; }
.badge-provision .spinner { width: 12px; height: 12px; border-top-color: currentColor; }
.admin-facts { display: grid; gap: 8px; margin: 0; }
.admin-fact { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; font-size: .75rem; }
.admin-fact dt { color: var(--muted); }
.admin-fact dd { min-width: 0; margin: 0; color: var(--text-secondary); overflow-wrap: anywhere; }
.admin-fact .icon { width: 13px; height: 13px; }
.text-ok { color: var(--success); }
.admin-server-actions { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--border-subtle); }
.admin-server-actions > .btn { flex: 1 1 auto; }
.admin-server-actions > .btn:first-child { flex-basis: 100%; }
.console-head { flex-wrap: wrap; overflow-wrap: anywhere; }
.console-updated { flex-basis: 100%; font-family: var(--font-sans); font-size: .6875rem; }
.modal-body .console-head + .console { margin-top: 0; }
.modal-text { color: var(--text-secondary); font-size: .8125rem; }
.split { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 24px; }
.split > * { min-width: 0; }
.pricing-form > .card-title { margin: 0; }
.pricing-form > .card-title:not(:first-child) { padding-top: 18px; border-top: 1px solid var(--border-subtle); }
.pricing-preview { min-width: 0; }
.example-list { display: grid; gap: 8px; margin-bottom: 20px; }
.example { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 12px 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--surface-2); font-size: .75rem; }
.example > span { color: var(--text-secondary); }
.example > b { color: var(--accent-hover); font-variant-numeric: tabular-nums; }
.example > small { grid-column: 2; justify-self: end; font-size: .625rem; }
.skeleton-server { min-height: 300px; }
.skeleton-row .list-main { min-height: 32px; }
.section, .admin-stats { min-width: 0; }
.notice-info { color: var(--info); background: var(--info-soft); border-color: #315e70; }
.protocol-ssh .chip { color: var(--info); }
.protocol-v2ray .chip { color: var(--accent-hover); }
.protocol-udp .chip { color: #a6e9c9; }

@media (max-width: 599px) {
  .option-grid { grid-template-columns: minmax(0, 1fr); }
  .option-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .option-grid-3 .option-card { padding: 12px 9px; }
  .option-grid-3 .option-title { font-size: .8125rem; }
  .option-grid-3 .option-desc { font-size: .6875rem; }
  .wizard-buttons { flex: 1 1 100%; }
  .wizard-buttons .btn { flex: 1; }
  .stat-grid > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .tx-row { gap: 10px; padding-right: 0; padding-left: 0; }
  .tx-icon { width: 32px; height: 32px; border-radius: 9px; }
  .tx-icon .icon { width: 16px; height: 16px; }
}
/* La matriz de precios conserva ambos ejes; las tablas de registros son tarjetas. */
@media (max-width: 699px) {
  .table-wrap:has(> .price-table) { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
  .price-table { display: table; min-width: 480px; }
  .price-table thead { display: table-header-group; position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal; }
  .price-table tbody { display: table-row-group; }
  .price-table tbody tr { display: table-row; padding: 0; border: 0; border-radius: 0; }
  .price-table td { display: table-cell; padding: 12px; border-bottom: 1px solid var(--border-subtle); text-align: center; }
  .price-table th { padding: 14px 12px; }
  .price-table tbody th { position: sticky; left: 0; border-right: 1px solid var(--border); background: var(--surface); }
}

/* 15 · Utilidades pequeñas -------------------------------------------- */

/* 15 · Utilidades pequeñas -------------------------------------------- */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.grow { flex: 1; min-width: 0; }
.min-w-0 { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.mono { font-family: var(--font-mono); }
.numeric { font-variant-numeric: tabular-nums; }
.text-sm { font-size: .8125rem; }
.text-xs { font-size: .6875rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break-all { overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.p-0 { padding: 0; }
.divider { height: 1px; margin: 20px 0; background: var(--border-subtle); }

/* 15 · Interacciones y breakpoints ------------------------------------ */
@media (hover: hover) {
  .btn:hover:not(:disabled):not([aria-disabled="true"]), .btn-icon:hover:not(:disabled), .btn-copy:hover:not(:disabled) { color: var(--text); background: var(--surface-hover); border-color: var(--border-strong); }
  .btn-primary:hover:not(:disabled):not([aria-disabled="true"]) { color: var(--on-accent); background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 5px 20px rgb(194 246 113 / 25%); }
  .btn-danger:hover:not(:disabled) { color: #ffe1e7; border-color: var(--danger); background: #552c3b; }
  .btn-copy:is(.copied, .is-copied):hover { color: var(--success); background: var(--success-soft); }
  button.chip:hover:not(:disabled), a.chip:hover, label.chip:hover { color: var(--accent-hover); border-color: var(--accent); background: var(--accent-soft); }
  .server-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-md); }
  .server-card.offline:hover, .server-card.is-offline:hover { border-color: var(--border-strong); }
  :is(.bn-link, .bottom-nav-link):hover, .bottom-nav > a:hover, .bottom-nav > button:hover { color: var(--text); background: var(--surface-2); }
  .tab:hover:not(:disabled), .tabs > button:hover:not(:disabled), .tabs > a:hover { color: var(--text); background: var(--surface-2); }
  .option-card:hover { border-color: var(--accent); }
  .table tbody tr:hover { background: var(--surface); }
}
@media (min-width: 400px) {
  .avatar-top { display: inline-flex; }
  .topbar-title { font-size: 1.0625rem; }
}
@media (min-width: 600px) {
  .main, .view-wrap, .view { padding-right: 28px; padding-left: 28px; padding-top: 32px; }
  .topbar { padding-right: 28px; padding-left: 28px; }
  .grid-2, .form-grid, .card-grid, .grid-cards, .server-grid, .servers-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { display: grid; gap: 20px; }
  .span-2 { grid-column: 1 / -1; }
  .card { padding: 24px; }
  .card-flush, .card.list { padding: 0; }
  .stat { padding: 22px; }
  .modal-root { align-items: center; padding: 24px; }
  .modal { max-height: calc(100dvh - 48px); }
  .modal-body { padding: 24px; }
  .modal-actions > .btn { flex: 0 1 auto; }
  #toasts, .toast-container, .toast-stack { right: 24px; left: auto; width: min(420px, calc(100vw - 48px)); }
  .hero, .welcome-card { padding: 32px; }
  .wizard-actions .btn { flex: 0 1 auto; min-width: 140px; }
  .step { font-size: .75rem; }
  .option-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .qr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .auth-card.card { padding: 32px; }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quick-actions { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .copy-list-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-row { flex-wrap: nowrap; }
  .account-row-main { flex-basis: 0; }
  .account-row-side { flex-basis: auto; flex-shrink: 0; flex-direction: column; align-items: flex-end; padding-left: 0; }
  .row-chevron { display: inline-flex; }
  .account-actions > .btn:first-child { flex: 0 1 auto; }
  .package-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stepper-label { font-size: .75rem; }
  .v2ray-link { align-items: flex-start; flex-direction: row; }
  .v2ray-link-body { flex: 1; }
  .option-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .option-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .balance-card { padding: 32px; }
}
@media (min-width: 900px) {
  body.drawer-open { overflow: auto; }
  .shell, .app-shell { padding-left: var(--sidebar-width); }
  .sidebar { width: var(--sidebar-width); visibility: visible; transform: none; box-shadow: none; z-index: 35; }
  .sidebar-head { min-height: 96px; padding-right: 24px; padding-left: 24px; }
  .sidebar-close, .brand-mobile, .bottom-nav, .bottomnav, .drawer-backdrop, .drawer-open .drawer-backdrop { display: none; }
  .topbar { gap: 18px; padding: 16px 36px; }
  .topbar-title { font-size: 1.125rem; }
  .balance-pill, .credit-pill { padding-right: 15px; padding-left: 13px; }
  .balance-pill > span, .credit-pill > span { font-size: .75rem; }
  .avatar-top { display: inline-flex; }
  .main, .view-wrap, .view { padding: 36px 36px 56px; }
  .grid-stats, .stats-grid, .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); align-items: start; }
  .detail-grid { grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); align-items: start; }
  .purchase-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 24px; }
  .purchase-layout > .purchase-summary { position: sticky; top: calc(var(--topbar-height) + 24px); }
  #toasts, .toast-container, .toast-stack { right: 28px; bottom: 28px; }
  :is(.page-header, .page-head) { align-items: center; }
  .stepper { max-width: 700px; }
  .fact-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .user-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .user-credits { grid-column: 3; grid-row: 1; align-items: flex-end; flex-direction: column; }
}
@media (min-width: 1240px) {
  .card-grid, .grid-cards, .server-grid, .servers-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .main, .view-wrap, .view { padding-right: 44px; padding-left: 44px; }
  .topbar { padding-right: 44px; padding-left: 44px; }
  .server-card { padding: 24px; }
  .split { grid-template-columns: minmax(0, 1fr) minmax(340px, 1fr); }
  .pricing-preview { position: sticky; top: calc(var(--topbar-height) + 24px); }
  .page-admin-servers .server-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-row { grid-template-columns: 40px minmax(0, 1fr) auto auto; }
  .row-actions { grid-column: 4; grid-row: 1; padding-top: 0; border-top: 0; justify-content: flex-end; }
}
@media (max-width: 359px) {
  .topbar { gap: 8px; padding-right: 12px; padding-left: 12px; }
  .topbar .logo-mark { width: 28px; height: 28px; }
  .topbar-title { font-size: .875rem; }
  .balance-pill, .credit-pill { gap: 5px; padding: 7px 9px; }
  .balance-pill :is(.ic, .icon), .credit-pill :is(.ic, .icon) { display: none; }
  .server-card, .card { padding: 16px; }
  .card.list, .card-flush { padding: 0; }
  .login-card, .auth-card { padding: 22px; }
  .stat { padding: 14px; }
  .modal-actions { flex-wrap: wrap; }
}

/* 16 · Movimiento y preferencias -------------------------------------- */
@media (pointer: coarse) {
  .btn-sm { min-height: 44px; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes signal-pulse { 0%, 100% { box-shadow: 0 0 0 0 currentColor; } 50% { box-shadow: 0 0 0 4px transparent; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .skeleton::after, .sk::after { display: none; }
  .spinner, .btn.is-loading::before { border-style: dotted; }
}
@media (prefers-contrast: more) {
  :root { --border: var(--muted); --border-subtle: var(--border-strong); --muted: var(--text-secondary); --border-strong: var(--muted); }
}
@media (forced-colors: active) {
  .btn, .chip, .badge, .card, .server-card, .modal, .toast { border: 1px solid ButtonText; }
  .nav-link.active, :is(.bn-link, .bottom-nav-link).active, .chip.active, .chip.selected, .tab.active { outline: 2px solid Highlight; outline-offset: -3px; }
  .latency-dot, :is(.dot, .badge-dot), .capacity-fill { background: CanvasText; }
  .qr, .qr img, img.qr { forced-color-adjust: none; background: #fff; }
}
