@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

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

:root {
  --bg:          oklch(99.5% 0.003 145);
  --surface:     oklch(99.5% 0.003 145);
  --border:      oklch(90% 0.008 145);
  --text-strong: oklch(18% 0.01 145);
  --text-body:   oklch(38% 0.01 145);
  --text-muted:  oklch(58% 0.008 145);
  --green:       oklch(72% 0.19 145);
  --green-light: oklch(94% 0.06 145);
  --green-dark:  oklch(48% 0.16 145);
  --red:         oklch(58% 0.22 25);
  --red-light:   oklch(96% 0.04 25);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html, body {
  height: 100%;
  background-color: var(--bg);
}

body {
  font-family: 'Outfit', -apple-system, system-ui, sans-serif;
  color: var(--text-strong);
  -webkit-font-smoothing: antialiased;
  font-kerning: normal;
  font-variant-numeric: tabular-nums;
}

a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- keyframes ---------- */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInPlain {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ovalDraw {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes skeletonPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.3; }
}

/* ---------- layout ---------- */
.page {
  min-height: 100vh;
  background-color: var(--bg);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.page.mounted { opacity: 1; }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  animation: fadeIn 0.5s var(--ease) both;
  animation-delay: 0.05s;
}
.header--dashboard {
  border-bottom: 1px solid var(--border);
  background-color: var(--surface);
  animation: fadeInPlain 0.4s var(--ease) both;
}
.header img { height: 80px; }

.header__badge {
  display: flex;
  align-items: center;
  gap: 6px;
}
.header__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background-color: var(--green);
  display: inline-block;
}
.header__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.btn-logout {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}
.btn-logout:hover {
  border-color: var(--text-muted);
  color: var(--text-body);
}

/* ---------- login page ---------- */
.login-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px 80px;
}

.login-logo {
  text-align: center;
  margin-bottom: 56px;
  animation: ovalDraw 0.6s var(--ease) both;
  animation-delay: 0.15s;
}
.login-logo img {
  height: clamp(140px, 30vw, 220px);
  width: auto;
}

.login-form-wrap {
  width: 100%;
  max-width: 600px;
  animation: fadeIn 0.55s var(--ease) both;
  animation-delay: 0.28s;
}

.login-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 10px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field {
  background-color: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 18px 22px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field.focused {
  border-color: var(--green);
  box-shadow: 0 0 0 3px oklch(72% 0.19 145 / 0.12);
}
.field.shake { animation: shake 0.45s var(--ease); }

.field__row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.field__chevron {
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  transition: color 0.2s;
}
.field.focused .field__chevron { color: var(--green); }

.field input {
  border: none;
  outline: none;
  font-size: 17px;
  font-weight: 500;
  color: var(--text-strong);
  background-color: transparent;
  width: 100%;
  font-family: inherit;
  letter-spacing: 0.02em;
}
.field__hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  margin-left: 28px;
}

.form-error {
  background-color: var(--red-light);
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 13px;
  color: var(--red);
  font-weight: 500;
  animation: fadeInPlain 0.25s var(--ease) both;
}

.btn-submit {
  padding: 17px;
  border-radius: 14px;
  border: none;
  background-color: var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: not-allowed;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.1s var(--ease);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-submit.ready {
  background-color: var(--text-strong);
  color: #fff;
  cursor: pointer;
}
.btn-submit.ready:active { transform: scale(0.97); }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.login-footer {
  text-align: center;
  padding: 0 24px 40px;
  animation: fadeInPlain 0.6s var(--ease) both;
  animation-delay: 0.5s;
}
.login-footer a {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition: color 0.15s, border-color 0.15s;
}
.login-footer a:hover {
  color: var(--green);
  border-color: var(--green);
}

/* ---------- dashboard page ---------- */
.dash-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px 80px;
}
.dash-content { width: 100%; max-width: 600px; }

.dash-row {
  animation: fadeUp 0.5s var(--ease) both;
}

.dash-divider {
  height: 1px;
  background-color: var(--border);
  margin: 28px 0;
}

.dash-name {
  position: relative;
  text-align: center;
  margin-bottom: 48px;
  animation-delay: 0.05s;
}
.dash-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.dash-name h1 {
  font-size: clamp(26px, 5vw, 42px);
  font-weight: 900;
  color: var(--text-strong);
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-transform: capitalize;
}

.dash-status { margin-bottom: 8px; animation-delay: 0.12s; }
.dash-status .dash-eyebrow { margin-bottom: 10px; }
.dash-status__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.dash-status__left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dash-status__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dash-status__dot--ok { background-color: var(--green); }
.dash-status__dot--mora {
  background-color: var(--red);
  animation: pulseDot 1.4s ease-in-out infinite;
}
.dash-status__text {
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.dash-status__text--ok { color: var(--green-dark); }
.dash-status__text--mora { color: var(--red); }

.dash-status__extra {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.dash-pill {
  font-size: 14px;
  font-weight: 700;
  color: var(--red);
  background-color: var(--red-light);
  padding: 4px 12px;
  border-radius: 6px;
}
.dash-pill--sm { font-size: 13px; font-weight: 600; }

.dash-cuotas { margin-bottom: 28px; animation-delay: 0.2s; }
.dash-cuotas__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.dash-cuotas__pct { font-size: 12px; font-weight: 700; color: var(--green-dark); }
.dash-cuotas__nums {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 12px;
}
.dash-cuotas__big {
  font-size: clamp(40px, 8vw, 64px);
  font-weight: 900;
  line-height: 1;
  color: var(--text-strong);
  letter-spacing: -0.03em;
}
.dash-cuotas__of {
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 400;
  color: var(--text-muted);
}
.dash-bar {
  height: 6px;
  background-color: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.dash-bar__fill {
  height: 100%;
  width: 0%;
  background-color: var(--green);
  border-radius: 99px;
  transition: width 1s var(--ease);
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 28px;
  animation-delay: 0.28s;
}
.dash-grid__col { padding-right: 24px; }
.dash-grid__col + .dash-grid__col {
  padding-left: 24px;
  padding-right: 0;
  border-left: 1px solid var(--border);
}
.dash-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.dash-money {
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 800;
  color: var(--text-strong);
  letter-spacing: -0.02em;
}
.dash-canje-ok {
  font-size: clamp(16px, 3vw, 20px);
  font-weight: 800;
  color: var(--green);
  letter-spacing: -0.01em;
}
.dash-canje-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.dash-pago { animation-delay: 0.36s; }
.dash-pago-value { font-size: 16px; font-weight: 600; color: var(--text-strong); }

.dash-accesorios { animation-delay: 0.44s; }
.dash-accesorios__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dash-accesorio {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dash-accesorio__tipo { font-size: 13px; font-weight: 700; color: var(--text-strong); margin-bottom: 2px; }
.dash-accesorio__cuotas { font-size: 12px; color: var(--text-muted); }
.dash-accesorio__monto { font-size: 14px; font-weight: 700; color: var(--text-strong); }

.dash-footnote {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 48px;
  letter-spacing: 0.04em;
  animation: fadeInPlain 0.6s var(--ease) both;
  animation-delay: 0.5s;
}

.dash-error {
  background-color: var(--red-light);
  border-radius: 12px;
  padding: 14px 20px;
  color: var(--red);
  font-size: 14px;
  max-width: 600px;
  width: 100%;
  animation: fadeUp 0.4s var(--ease) both;
}

.skeleton { width: 100%; max-width: 600px; }
.skeleton__bar {
  background-color: var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  animation: skeletonPulse 1.4s ease-in-out infinite;
}

[hidden] { display: none !important; }
