/* recargas-gateway panel — premium mobile-native */
:root {
  --bg0: #e8eef2;
  --bg1: #d5e4e0;
  --ink: #102018;
  --muted: #5a6b64;
  --card: rgba(255, 255, 255, 0.82);
  --card-solid: #ffffff;
  --line: rgba(16, 32, 24, 0.08);
  --teal: #0f766e;
  --teal-deep: #0b4f4a;
  --mint: #14b8a6;
  --amber: #d97706;
  --rose: #e11d48;
  --shadow: 0 18px 40px rgba(16, 32, 24, 0.1);
  --radius: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Outfit", system-ui, sans-serif;
  --display: "Syne", "Outfit", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.panel-app {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(20, 184, 166, 0.28), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(15, 118, 110, 0.18), transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1));
  background-attachment: fixed;
}

a { color: var(--teal); text-decoration: none; }

.panel-shell {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 0 16px calc(28px + var(--safe-b));
}

.panel-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 12px;
  backdrop-filter: blur(14px);
  background: linear-gradient(180deg, rgba(232, 238, 242, 0.92), rgba(232, 238, 242, 0.7));
}

.panel-brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.panel-brand span {
  display: block;
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.panel-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.panel-nav a,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.7);
  color: var(--ink);
  font: 600 0.85rem var(--font);
}

.hero {
  margin: 8px 0 18px;
}

.hero h1 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: clamp(1.6rem, 5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.flash {
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.flash-ok { background: #d1fae5; color: #065f46; }
.flash-err { background: #ffe4e6; color: #9f1239; }

.card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.65);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
  backdrop-filter: blur(10px);
}

.card h2, .card h3 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.stack { display: grid; gap: 10px; }

.field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card-solid);
  padding: 0 14px;
  font: 500 1rem var(--font);
  color: var(--ink);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 0 16px;
  font: 700 0.95rem var(--font);
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}

.btn:active { transform: scale(0.98); }
.btn-primary { background: linear-gradient(135deg, var(--mint), var(--teal)); color: #fff; }
.btn-danger { background: linear-gradient(135deg, #fb7185, var(--rose)); color: #fff; }
.btn-soft { background: #ecfdf5; color: var(--teal-deep); }
.btn-sm { min-height: 40px; width: auto; padding: 0 12px; font-size: 0.82rem; border-radius: 12px; }

.client-card {
  padding: 16px;
}

.client-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.client-card-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.client-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.saldo-pill {
  text-align: right;
}

.saldo-pill .lbl {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.saldo-pill .val {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
}

/* Pool de saldo producción */
.pool-card {
  background:
    linear-gradient(145deg, rgba(15, 118, 110, 0.12), rgba(255, 255, 255, 0.88)),
    var(--card);
  border: 1px solid rgba(15, 118, 110, 0.18);
}

.pool-card--compact {
  padding: 14px;
}

.pool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.pool-metric {
  background: rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
}

.pool-metric .lbl {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.pool-metric .val {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.pool-metric--free {
  border-color: rgba(20, 184, 166, 0.35);
  background: rgba(204, 251, 241, 0.55);
}

.pool-metric--free .val {
  color: var(--teal-deep);
}

.pool-error {
  margin: 0 0 8px;
  color: #9f1239;
  font-size: 0.9rem;
  line-height: 1.4;
}

.badge-fact {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.badge-fact.prepago { background: #ccfbf1; color: #0f766e; }
.badge-fact.pospago { background: #ffedd5; color: #c2410c; }

.badge-acceso {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.badge-acceso.api { background: #e0e7ff; color: #3730a3; }
.badge-acceso.app { background: #fce7f3; color: #9d174d; }

@media (min-width: 560px) {
  .pool-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Segmented TEST / PROD — primary control */
.modo-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border-radius: 16px;
  background: rgba(16, 32, 24, 0.06);
  margin: 12px 0;
}

.modo-switch button {
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  font: 700 0.9rem var(--font);
  letter-spacing: 0.06em;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
}

.modo-switch button.is-active.test {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #fff;
  box-shadow: 0 8px 18px rgba(217, 119, 6, 0.28);
}

.modo-switch button.is-active.prod {
  background: linear-gradient(135deg, #fb7185, #e11d48);
  color: #fff;
  box-shadow: 0 8px 18px rgba(225, 29, 72, 0.28);
}

.modo-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.4;
}

.cred-box {
  background: rgba(15, 118, 110, 0.06);
  border-radius: 14px;
  padding: 12px;
  font-size: 0.8rem;
  line-height: 1.55;
  word-break: break-all;
}

.cred-box code {
  background: rgba(255,255,255,0.8);
  padding: 1px 5px;
  border-radius: 6px;
  font-size: 0.78rem;
}

.actions-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}

.inline-saldo {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.inline-saldo input {
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0 12px;
  font: 500 0.9rem var(--font);
}

.product-list { display: grid; gap: 10px; }

.product-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,0.65);
}

.product-item-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-topup, .badge-energy_topup { background: #ccfbf1; color: #0f766e; }
.badge-data_plan { background: #e0e7ff; color: #3730a3; }
.badge-invoice { background: #dcfce7; color: #166534; }
.badge-pin { background: #f3f4f6; color: #374151; }

.product-form {
  display: grid;
  gap: 8px;
}

.product-form .row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.product-form select,
.product-form input {
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0 10px;
  font: 500 0.88rem var(--font);
  background: #fff;
}

.empty {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 18px 8px;
}

.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.login-card {
  width: min(400px, 100%);
}

.login-card h1 {
  font-family: var(--display);
  margin: 0 0 18px;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
}

@media (min-width: 760px) {
  .panel-shell { padding-top: 8px; }
  .create-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .create-grid .full { grid-column: 1 / -1; }
}
