/* Identidad H4X y composición de las pantallas. */
@font-face {
  font-family: Inter;
  src: url("/fonts/inter.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

body { background: var(--bg); }
.app-shell { --shell-inset: clamp(24px, 3.25vw, 52px); }
.view { max-width: 1460px; padding-top: 24px; }
.page > * + * { margin-top: 20px; }
.page-head { margin-bottom: 24px; }
.page-title {
  font-size: clamp(2rem, 4.5vw, 3.35rem);
  font-weight: 730;
  line-height: 1.06;
  letter-spacing: -.063em;
  overflow-wrap: anywhere;
}
:is(.page-header, .page-head) .page-sub { font-size: .9375rem; }
.page-accounts .page-title { font-size: clamp(2rem, 4.5vw, 3.35rem); }
.title-accent, .auth-title > span, .auth-intro h2 > span { color: var(--accent); }

.sidebar { background: #131614; border-color: var(--border-subtle); }
.sidebar-head { min-height: 82px; padding-inline: 23px; }
.logo-mark { width: 38px; height: 38px; filter: none; }
.brand { gap: 10px; }
.brand-name { font-size: 1.2rem; font-weight: 780; letter-spacing: -.055em; }
.brand-name b { color: var(--muted); font-weight: 520; }
.sidebar-create { margin: 1px 16px 14px; justify-content: flex-start; }
.sidebar-balance { padding: 12px; margin: 12px; background: var(--surface-2); }
.sidebar-balance-amount b { font-size: 1.3rem; overflow-wrap: anywhere; }
.sidebar-balance-amount small { flex-shrink: 0; }
.sidebar-foot { padding: 12px; }
.user-chip { gap: 8px; }
.user-chip .avatar { width: 35px; height: 35px; }
.nav { padding: 0 12px 8px; }
.nav-title { font-size: .6875rem; letter-spacing: .1em; padding-top: 15px; padding-bottom: 6px; }
.nav-link { min-height: 41px; margin: 2px 0; font-size: .875rem; }
.nav-link.active, .nav-link[aria-current="page"] { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.nav-link[aria-current="page"]::before { display: block; left: 0; width: 2px; height: 17px; }
.topbar { background: rgb(16 18 17 / 96%); gap: 12px; border-color: var(--border-subtle); }
.topbar-title { font-size: .875rem; font-weight: 700; }
.topbar-context { color: var(--muted); }
.topbar-context::after { content: "/"; margin-left: 14px; color: var(--border-strong); }
.topbar .logo-mark { width: 34px; height: 34px; }
.balance-pill { min-height: 40px; background: var(--surface); }
.avatar, .avatar-top { border-radius: 50%; }
.avatar-top { min-width: 40px; min-height: 40px; }
.bottom-nav {
  min-height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  padding-top: 4px;
  background: rgb(18 21 19 / 96%);
  border-color: var(--border-subtle);
}
.bottom-nav > :is(a, button) { font-size: .6875rem; font-weight: 600; }
.bottom-nav-fab { width: 38px; height: 32px; border-color: var(--accent); border-radius: 9px; }
.bottom-nav .is-primary > span:last-child { color: var(--text); }

.card, .stat, .network-overview, .account-summary {
  background-color: var(--surface);
  border-color: var(--border-subtle);
}
.card-title, .section-title, .card-head h3, .section-head h2 { font-size: 1.0625rem; font-weight: 720; letter-spacing: -.03em; }
.card-title > .icon { color: var(--accent); margin-right: 5px; }
.card-link { font-weight: 660; }
.btn { gap: 8px; border-radius: 9px; }
.btn-primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); box-shadow: none; }
.btn-primary:hover:not(:disabled), .btn-primary:focus-visible { color: var(--on-accent); background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: var(--surface-2); color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-strong); }
.card-link, .btn-copy { min-height: 40px; }
.form-label, .form-field > label { color: var(--text-secondary); font-weight: 600; }
input.input, select.input, textarea.input { min-height: 46px; background-color: var(--field); border-color: var(--border); border-radius: 9px; }
.input:focus, input.input:focus, select.input:focus, textarea.input:focus { border-color: var(--accent-strong); }
.eyebrow { color: var(--accent); letter-spacing: .095em; font-size: .6875rem; }
.badge { font-size: .75rem; }
:is(.badge-ssh, .badge-v2ray, .badge-off) { border-color: var(--border); }
.copy-row { min-height: 64px; }
.copy-row .btn-copy { background: var(--surface-3); }

.home-overview { grid-template-columns: minmax(0, 1fr); gap: 14px; }
.balance-card {
  background: radial-gradient(ellipse at 100% 5%, #323d29, transparent 71%), #1a2119;
  border-color: #3f4d36;
  border-radius: var(--radius-lg);
  padding: 23px;
  min-height: 225px;
}
.balance-card::after {
  width: 243px;
  height: 243px;
  right: -83px;
  bottom: -104px;
  border: 1px solid #c4f47726;
  box-shadow: 0 0 0 19px #c4f4770b, 0 0 0 40px #c4f47709, 0 0 0 63px #c4f47706;
}
.balance-card > * { position: relative; z-index: 1; }
.balance-label { font-size: .875rem; font-weight: 560; }
.balance-label .icon { width: 18px; height: 18px; }
.balance-amount { gap: 10px; margin-top: 15px; }
.balance-amount b { font-size: clamp(2.85rem, 6vw, 4.4rem); line-height: 1; font-weight: 720; letter-spacing: -.075em; }
.balance-usd { color: var(--muted); margin: 9px 0 0; font-size: .8125rem; }
.balance-actions { margin-top: 21px; }
.network-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: end;
  min-height: 180px;
  background: #111410;
  padding: 20px;
}
.network-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(90deg, #111410 4%, #111410e0 27%, #11141022 76%),
    url("/img/red-h4x.webp") right 49% / auto 142% no-repeat;
}
.network-card-content { position: relative; width: 63%; min-width: min(175px, 100%); }
.network-status {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 22px;
  color: var(--text-secondary);
  font-size: .75rem;
  font-weight: 550;
}
.network-dot { display: block; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px #c4f47768; }
.network-card h3 { margin: 4px 0 14px; font-size: clamp(1.45rem, 3.3vw, 2.35rem); line-height: 1.1; letter-spacing: -.055em; }
.network-card .btn { min-height: 40px; background: #191f19e6; }
.overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.overview-metrics > :last-child { grid-column: 1 / -1; }
.overview-metrics .stat { gap: 10px; padding: 14px; border-radius: var(--radius-lg); }
.overview-metrics .stat-body { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.overview-metrics .stat-label { color: var(--text-secondary); font-size: .8125rem; font-weight: 600; }
.overview-metrics .stat-value { font-size: clamp(1.5rem, 2.7vw, 2rem); }
.overview-metrics .stat-sub { color: var(--muted); font-size: .75rem; }
.overview-metrics > :last-child .stat-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; width: 100%; }
.overview-metrics > :last-child .stat-value { grid-column: 2; grid-row: 1 / 3; align-self: center; }
.stat-icon { width: 35px; height: 35px; border: 1px solid #ffffff0d; }
.home-columns { gap: 16px; }
.home-columns .inset-head { padding: 13px 18px; }
.home-account { flex-wrap: nowrap; padding: 14px 18px; }
.home-account .grow { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.home-account-side { width: auto; padding: 0; flex-direction: column; }
.home-account-side small { font-size: .75rem; }
.home-account-location .flag { min-width: 18px; }
.home-columns .quiet-empty { min-height: 144px; }
.admin-stats { padding-top: 8px; }

.network-overview { position: relative; isolation: isolate; overflow: hidden; min-height: 105px; }
.network-overview > div { justify-content: center; }
.network-overview > div:first-child b { color: var(--accent); }
:is(.network-overview, .account-summary) b { font-variant-numeric: tabular-nums; }
:is(.network-overview, .account-summary) span { font-size: .8125rem; }
.server-grid { gap: 15px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 285px), 1fr)); }
.server-card { padding: 18px; border-color: var(--border-subtle); }
.server-card-head { padding-bottom: 13px; border-bottom: 1px solid var(--border-subtle); }
.server-card .server-availability { margin-top: -7px; }
.server-availability .badge:not(.badge-off)::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.server-speed { padding: 12px; }
.server-metric-label, .server-capacity-head { font-size: .75rem; }
.server-mbps { font-variant-numeric: tabular-nums; }
.server-card .btn-block { min-height: 44px; }
.page-servers .legend { margin-top: 12px; }

.account-toolbar, .page-admin-users .toolbar, .page-transactions .toolbar {
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.segmented { background: var(--field); border-color: transparent; }
.segmented > button.is-active { color: var(--accent-hover); border-color: var(--accent-line); }
.account-hero, .profile-card, .topup-hero { background: linear-gradient(130deg, #222b20, var(--surface) 76%); border-color: var(--accent-line); }
.account-title { font-size: clamp(1.65rem, 4vw, 2.55rem); letter-spacing: -.055em; }
.account-essential { border-color: var(--border); }
.account-tabs { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 4px; gap: 3px; background: var(--surface); }
.account-tabs > button { border: 1px solid transparent; border-radius: 7px; min-height: 44px; }
.account-tabs > button[aria-selected="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.connection-guide { background: linear-gradient(135deg, var(--info-soft), var(--surface) 74%); }
.profile-layout, .profile-side { display: grid; gap: 16px; align-items: start; }
.profile-password { min-width: 0; }
.profile-card .fact-grid { grid-template-columns: minmax(0, 1fr); }
.purchase-layout { grid-template-columns: minmax(0, 1fr); }
.stepper {
  padding: 12px 4px 6px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.stepper-label { font-size: .75rem; }
.option-card.is-selected { border-color: var(--accent-strong); }
.purchase-summary { border-color: var(--accent-line); }
.wizard-footer { background: var(--surface-2); padding: 12px 14px; }
.package-grid { gap: 10px; }
.package.is-selected { box-shadow: inset 0 0 0 1px var(--accent); }
.package.is-selected .package-usd { color: var(--accent); }
.topup-request { border-color: var(--accent-line); background: var(--accent-soft); }
.topup-hero .copy-list { max-width: 430px; }
.pricing-preview { background: var(--surface-2); }
.page-admin-pricing .split { align-items: start; }
.admin-server-card .server-badges { padding-top: 2px; }
.table th { font-size: .75rem; }
.modal { border-color: var(--border-strong); background: var(--surface); }
.modal-head { background: var(--surface-2); }

.auth-page {
  display: flex;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(17px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(17px, env(safe-area-inset-left, 0px));
  max-width: none;
  margin: 0;
  gap: 17px;
  background: radial-gradient(ellipse at 50% 2%, #263321 0%, transparent 54%), var(--bg-deep);
}
.auth-page::before { background-image: radial-gradient(#a6afaa25 .6px, transparent .6px); background-size: 22px 22px; }
.auth-intro { display: none; }
.auth-card.card { max-width: 440px; padding: clamp(22px, 5vw, 40px); background: var(--surface); border-color: var(--border); border-radius: var(--radius-xl); }
.auth-brand { align-items: flex-start; text-align: left; gap: 9px; padding: 0; margin-bottom: 23px; }
.auth-brand .logo-mark { width: 36px; height: 36px; }
.auth-mobile-brand { margin-bottom: 16px; }
.auth-card .auth-title { font-size: clamp(2.1rem, 5vw, 2.8rem); font-weight: 740; line-height: 1.1; letter-spacing: -.066em; }
.auth-sub { font-size: .875rem; }
.auth-card form { gap: 15px; }
.auth-card .auth-foot { text-align: left; padding-top: 16px; margin-top: 18px; }
.auth-legal { font-size: .75rem; }

@media (min-width: 600px) {
  .home-overview { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
  .balance-card, .network-card { padding: 23px; }
  .overview-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .overview-metrics > :last-child { grid-column: auto; }
  .overview-metrics > :last-child .stat-body { display: flex; width: auto; }
  .overview-metrics > :last-child .stat-value { align-self: auto; }
  .overview-metrics .stat { height: 100%; }
  .profile-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); }
}
@media (min-width: 900px) {
  .topbar { padding: 10px var(--shell-inset); }
  .view { padding: 25px var(--shell-inset) 54px; }
  .home-overview { grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr); }
  .balance-card, .network-card { padding: 24px; min-height: 238px; }
  .network-card::before {
    background:
      linear-gradient(90deg, #111410 0%, #111410ce 21%, transparent 69%),
      url("/img/red-h4x.webp") right 52% / auto 153% no-repeat;
  }
  .overview-metrics .stat { padding: 15px; gap: 10px; align-items: flex-start; }
  .overview-metrics .stat-body { display: flex; }
  .network-overview > div { z-index: 1; }
  .network-overview::after {
    content: "";
    position: absolute;
    inset: 0 0 0 auto;
    width: 35%;
    background: linear-gradient(90deg, var(--surface), transparent), url("/img/red-h4x.webp") right 48% / cover;
    opacity: .54;
  }
}
@media (min-width: 1000px) {
  .purchase-layout { grid-template-columns: minmax(0, 1fr) minmax(218px, 27%); gap: 16px; }
  .auth-page {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(392px, .85fr);
    grid-template-rows: 1fr auto 1fr;
    column-gap: clamp(45px, 7vw, 110px);
    padding: 22px clamp(29px, 4.5vw, 72px) 22px 22px;
  }
  .auth-intro {
    position: relative;
    isolation: isolate;
    grid-row: 1 / -1;
    display: flex;
    min-height: max(570px, calc(100dvh - 44px));
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    padding: clamp(28px, 4vw, 55px);
    border: 1px solid var(--border);
    border-radius: 21px;
    background:
      linear-gradient(180deg, #101411 0%, transparent 20% 53%, #111511 83%),
      url("/img/red-h4x.webp") 59% 35% / auto 86% no-repeat #111410;
  }
  .auth-intro .brand { margin: 0; }
  .auth-intro h2 { font-size: clamp(3rem, 6vw, 6rem); line-height: .96; letter-spacing: -.08em; margin: 0 0 16px; }
  .auth-intro-copy > p { max-width: 42ch; color: var(--text-secondary); margin: 0; font-size: .9375rem; }
  .auth-card.card { grid-column: 2; grid-row: 2; justify-self: center; margin: 0; max-width: 450px; }
  .auth-mobile-brand { display: none; }
  .auth-legal { grid-row: 3; align-self: start; }
}
@media (min-width: 1200px) {
  .overview-metrics .stat { padding: 17px; gap: 12px; }
  .overview-metrics .stat-value { font-size: 2rem; }
  .balance-card, .network-card { padding: 26px; }
}
@media (max-width: 599px) {
  .view { padding-inline: max(15px, env(safe-area-inset-left, 0px)) max(15px, env(safe-area-inset-right, 0px)); }
  .topbar { gap: 9px; }
  .balance-pill { padding: 5px 9px; }
  .balance-pill > span { font-size: .6875rem; }
  .page > * + * { margin-top: 16px; }
  .page-head { margin-bottom: 18px; }
  .page-head .page-actions { max-width: 100%; }
  .network-overview, .account-summary { border-radius: 12px; }
  :is(.network-overview, .account-summary) > div { padding: 12px 8px; }
  :is(.network-overview, .account-summary) span { font-size: .75rem; }
  :is(.network-overview, .account-summary) b { font-size: 1.35rem; }
  .home-account { gap: 9px; }
  .account-toolbar { gap: 7px; }
  .account-toolbar [data-seg="status"] { flex-basis: 100%; }
  .stepper-label { font-size: .6875rem; }
}
@media (max-width: 350px) {
  .balance-pill > span { display: none; }
  .nav-link { min-height: 40px; }
  .account-tabs .icon { display: none; }
}

/* Mantiene los controles de compra a mano en pantallas estrechas. */
@media (max-width: 899px) {
  .sidebar-balance { order: 3; }
  .wizard-footer {
    position: sticky;
    z-index: 5;
    bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 6px);
    box-shadow: 0 -3px 18px #0005;
  }
}
.topup-layout { display: grid; gap: 16px; min-width: 0; }
@media (min-width: 1100px) {
  .topup-layout {
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.35fr);
    grid-template-areas: "overview amounts" "steps amounts" "pricing pricing";
    grid-template-rows: auto 1fr auto;
    align-items: start;
  }
  .topup-hero { grid-area: overview; }
  .topup-amounts { grid-area: amounts; }
  .topup-steps { grid-area: steps; }
  .topup-prices { grid-area: pricing; }
}

.view .page { animation: h4x-page-in 180ms var(--ease) both; }
@keyframes h4x-page-in {
  from { opacity: .68; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}
