/* =============================================================================
   styles.css — Portal Mi RODRITEL
   Paleta: negro + verde (#16a34a) sobre blanco.
   ========================================================================== */

:root {
  --accent: #16a34a;
  --accent-dark: #15803d;
  --accent-soft: #dcfce7;
  --accent-tint: #f0fdf4;

  --ink: #0a0a0a;
  --ink-soft: #262626;
  --muted: #525252;
  --faint: #a3a3a3;

  --bg: #ffffff;
  --surface: #ffffff;
  --line: #e5e5e5;
  --line-soft: #f5f5f5;

  --ok: #16a34a;
  --ok-soft: #f0fdf4;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;

  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 3px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.12);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }
a { color: inherit; }

.hidden { display: none !important; }

/* ----- Utilidades de marca ----- */
.brand-logo {
  height: 38px; width: auto; display: block; object-fit: contain; flex-shrink: 0;
}
.brand-logo-lg { height: 72px; margin: 0 auto 18px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 13px;
  background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 22px; flex-shrink: 0;
}
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: .2px; color: var(--ink); }
.brand-name b { color: var(--accent); font-weight: 800; }

/* =============================================================================
   LOGIN
   ========================================================================== */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: flex-end;
  padding: 24px;
  background: #0a0a0a;
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: "";
  position: absolute;
  inset: -6%;
  background: url("fondo-login.jpg") center center / cover no-repeat;
  z-index: 0;
  opacity: 0;
  transform: scale(1.08);
  animation: bgIntro 2.2s ease-out forwards, bgDrift 40s ease-in-out 2.2s infinite alternate;
  will-change: transform, opacity;
}
@keyframes bgIntro {
  from { opacity: 0; transform: scale(1.14); }
  to   { opacity: 1; transform: scale(1.08); }
}
@keyframes bgDrift {
  0%   { transform: scale(1.08) translate(0, 0); }
  100% { transform: scale(1.12) translate(-1.5%, -1%); }
}
.login-card {
  width: 100%; max-width: 400px;
  margin-right: clamp(16px, 6vw, 90px);
  background: rgba(15, 15, 15, 0.62);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border-radius: 22px;
  padding: 40px 32px 32px;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  border: 1px solid rgba(255, 255, 255, 0.10);
  position: relative;
  z-index: 1;
  animation: cardIn .8s cubic-bezier(.16,1,.3,1) .3s both;
  will-change: transform, opacity;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(28px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.login-brand { text-align: center; margin-bottom: 30px; }
.login-card .login-title { color: #ffffff; }
.login-card .login-sub { color: #a3a3a3; }
.login-card .field label { color: #d4d4d4; }
.login-card .input-shell {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
}
.login-card .input-shell:focus-within {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent);
}
.login-card .input-shell input { color: #ffffff; }
.login-card .input-shell input::placeholder { color: rgba(255,255,255,0.45); }
.login-card .login-foot { color: #8a8a8a; line-height: 1.55; }
.login-card .login-foot b { color: var(--accent); font-weight: 700; white-space: nowrap; }
.login-title { font-size: 26px; font-weight: 700; }
.login-title b { color: var(--accent); font-weight: 800; }
.login-sub { color: var(--muted); font-size: 14.5px; margin-top: 5px; }

.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--ink-soft); margin-bottom: 7px;
}
.input-shell {
  display: flex; align-items: center;
  background: #f3f5f9;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  transition: border-color .15s, background .15s;
}
.input-shell:focus-within {
  border-color: var(--accent);
  background: #fff;
}
.input-shell input {
  flex: 1; border: none; background: none; outline: none;
  height: 50px; font-size: 16px; color: var(--ink);
}
.input-shell .toggle {
  font-size: 13px; font-weight: 600; color: var(--accent); padding-left: 8px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; padding: 0 22px;
  background: var(--accent); color: #fff;
  border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 700;
  transition: background .15s, transform .05s, box-shadow .15s;
  box-shadow: 0 6px 18px rgba(22,163,74,.26);
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: #c4b5fd; box-shadow: none; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-ghost {
  background: var(--surface); color: var(--ink-soft);
  border: 1.5px solid var(--line); box-shadow: none;
}
.btn-ghost:hover { background: var(--line-soft); }
.btn-sm { height: 40px; font-size: 14px; padding: 0 16px; border-radius: 9px; }

.form-msg { font-size: 13.5px; margin-top: 12px; min-height: 18px; }
.form-msg.error { color: var(--danger); }
.form-msg.ok { color: var(--ok); }

.login-foot {
  text-align: center; color: var(--faint); font-size: 12.5px; margin-top: 26px;
}

/* =============================================================================
   APP SHELL
   ========================================================================== */
.app { min-height: 100vh; padding-bottom: 24px; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15, 15, 15, 0.72);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border-bottom: 1px solid rgba(255,255,255,0.10);
  padding: 12px 18px 0;
}
.topbar-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-bottom: 10px;
}
.topbar .brand { display: flex; align-items: center; gap: 11px; }
.topbar .brand-name { font-size: 17px; color: #ffffff; }
.topbar .brand-name b { color: var(--accent); }
.topbar .user {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: rgba(255,255,255,0.75);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}

.container { max-width: 720px; margin: 0 auto; padding: 22px 20px; }

.view-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.view-sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; }

/* ----- Cards ----- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-head h3 { font-size: 16px; font-weight: 700; }
.card-label {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--faint);
}

/* ----- Acordeón de servicios (Inicio) ----- */
.svc-acc { padding: 0; overflow: hidden; }
.svc-acc-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 18px 20px; text-align: left; background: none;
}
.svc-acc-head .t { font-weight: 700; font-size: 16px; color: var(--ink); }
.svc-acc-head .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.svc-acc-head .chev { color: var(--faint); transition: transform .25s ease; }
.svc-acc-head[aria-expanded="true"] .chev { transform: rotate(180deg); }
.svc-acc-body {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .28s ease;
}
.svc-acc-body.open { grid-template-rows: 1fr; }
.svc-acc-body > .detail-grid { overflow: hidden; }
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border-top: 1px solid var(--line-soft);
}
.detail {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.detail:nth-child(odd) { border-right: 1px solid var(--line-soft); }
.detail-wide { grid-column: 1 / -1; border-right: none; }
.dl {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--faint); margin-bottom: 4px;
}
.dv { font-size: 15px; font-weight: 600; color: var(--ink); }

/* ----- Tarjetas de pago por servicio ----- */
.pay-card-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.pay-card-top .t { font-weight: 700; font-size: 16px; color: var(--ink); }
.pay-card-top .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.pay-amount {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 16px 0 18px; padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.pay-amount-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.pay-amount-val { font-size: 24px; font-weight: 800; color: var(--ink); }

/* ----- Deuda: la firma visual ----- */
.debt-hero {
  background: linear-gradient(135deg, #111827, #16a34a);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 26px 24px;
  box-shadow: 0 16px 40px rgba(0,0,0,.18);
  position: relative; overflow: hidden;
}
.debt-hero::after {
  content: ''; position: absolute; right: -40px; top: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: rgba(255,255,255,.10);
}
.debt-hero .label {
  font-size: 13px; font-weight: 600; opacity: .9;
  text-transform: uppercase; letter-spacing: .05em;
}
.debt-hero .amount {
  font-size: 42px; font-weight: 800; margin: 6px 0 2px;
  letter-spacing: -.5px;
}
.debt-hero .amount.zero { font-size: 30px; }
.debt-hero .meta { font-size: 13.5px; opacity: .92; }
.debt-hero .pay-btn {
  margin-top: 18px;
  background: #fff; color: var(--accent);
  box-shadow: 0 6px 18px rgba(0,0,0,.14);
}
.debt-hero .pay-btn:hover { background: #f8f7ff; }

/* ----- Listas / filas ----- */
.row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 0; border-bottom: 1px solid var(--line-soft);
}
.row:last-child { border-bottom: none; }
.row .main { min-width: 0; }
.row .t { font-weight: 600; font-size: 14.5px; }
.row .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.row .v { font-weight: 700; font-size: 15px; white-space: nowrap; }

/* ----- Chips de estado ----- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.ok .dot { background: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.warn .dot { background: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.danger .dot { background: var(--danger); }
.chip.muted { background: var(--line-soft); color: var(--muted); }
.chip.muted .dot { background: var(--faint); }

/* ----- Selector de servicio ----- */
.svc-picker {
  display: flex; gap: 9px; overflow-x: auto; padding-bottom: 4px;
  margin-bottom: 18px; -webkit-overflow-scrolling: touch;
}
.svc-pill {
  flex-shrink: 0;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 15px;
  text-align: left;
  transition: all .15s;
  min-width: 120px;
}
.svc-pill.active { border-color: var(--accent); background: var(--accent-tint); }
.svc-pill .nic { font-weight: 700; font-size: 14px; }
.svc-pill .plan { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ----- Top nav (dentro de la barra superior cristal) ----- */
.top-nav {
  display: flex; gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.top-nav::-webkit-scrollbar { display: none; }
.nav-item {
  flex: 1 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 14px 11px;
  color: rgba(255,255,255,0.55);
  font-size: 12px; font-weight: 600;
  border-radius: 12px 12px 0 0;
  position: relative;
  transition: color .18s, background .18s;
  white-space: nowrap;
}
.nav-item svg { width: 21px; height: 21px; }
.nav-item:hover { color: rgba(255,255,255,0.85); }
.nav-item.active {
  color: #fff;
  background: rgba(22,163,74,0.18);
}
.nav-item.active::after {
  content: "";
  position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
}

/* ----- Forms genéricos en vistas ----- */
.form-row { margin-bottom: 14px; }
.form-row label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--ink-soft); margin-bottom: 6px;
}
.form-row input, .form-row select, .form-row textarea {
  width: 100%; height: 48px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-size: 15.5px; color: var(--ink); background: #f3f5f9;
  outline: none; transition: border-color .15s, background .15s;
}
.form-row textarea { height: auto; min-height: 88px; padding: 12px 14px; resize: vertical; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  border-color: var(--accent); background: #fff;
}

/* ----- Estados vacíos ----- */
.empty {
  text-align: center; padding: 36px 20px; color: var(--muted);
}
.empty .icon {
  width: 56px; height: 56px; margin: 0 auto 14px;
  border-radius: 16px; background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
}
.empty .icon svg { width: 26px; height: 26px; color: var(--accent); }
.empty h4 { color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.empty p { font-size: 13.5px; }

/* ----- Skeleton / loading ----- */
.skeleton {
  background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 50%, #eef1f6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: 8px;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
.spinner.dark { border-color: var(--accent-soft); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Modal ----- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15,23,42,.45);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0; animation: fade .2s;
}
@media (min-width: 540px) { .modal-backdrop { align-items: center; padding: 20px; } }
.modal {
  background: var(--surface);
  width: 100%; max-width: 460px;
  border-radius: 22px 22px 0 0;
  padding: 24px 22px calc(24px + env(safe-area-inset-bottom, 0));
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s;
}
@media (min-width: 540px) { .modal { border-radius: 22px; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { font-size: 18px; font-weight: 700; }
.modal-close { font-size: 26px; color: var(--faint); line-height: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: .6; } }

/* ----- Toast ----- */
.toast-wrap {
  position: fixed; left: 0; right: 0; bottom: 28px; z-index: 200;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff;
  padding: 12px 20px; border-radius: 12px;
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s;
  max-width: 90%;
}
.toast.ok { background: var(--ok); }
.toast.error { background: var(--danger); }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } }

/* ----- Responsivo de respaldo ----- */
@media (max-width: 380px) {
  .debt-hero .amount { font-size: 36px; }
  .container { padding: 18px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}