/* Panel de deuda — estilos */
:root {
  --bg: #eef1f7;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #5b6472;
  --line: #e6e9f0;
  --accent: #2456d6;
  --accent-deep: #12349c;
  --good: #0e9f6e;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 28px rgba(16, 24, 40, .07);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: linear-gradient(180deg, #f5f7fb 0%, #e9edf6 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 30px 16px 56px;
  padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
}

/* ---------- Encabezado ---------- */
.head { margin-bottom: 18px; }
.eyebrow {
  margin: 0;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #58627a;
}
.head h1 {
  margin: 6px 0 4px;
  font-size: 1.65rem;
  letter-spacing: -.02em;
}
.sub { margin: 0; color: var(--muted); font-size: .95rem; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 14px;
}
.card h2 {
  margin: 0 0 12px;
  font-size: 1.02rem;
  letter-spacing: -.01em;
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(140deg, #2456d6 0%, #12349c 100%);
  color: #fff;
  padding: 24px 24px 22px;
}
.hero-label {
  margin: 0;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .78);
}
.hero-amount {
  margin: 6px 0 10px;
  font-size: clamp(2.1rem, 7vw, 2.8rem);
  font-weight: 750;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.08;
}
.hero-amount .cur {
  font-size: .42em;
  font-weight: 700;
  letter-spacing: .04em;
  color: rgba(255, 255, 255, .75);
}
.hero-meta {
  margin: 0 0 10px;
  font-size: .84rem;
  color: rgba(255, 255, 255, .78);
}
.hero-delta {
  display: inline-block;
  margin: 0;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  font-size: .86rem;
  font-weight: 600;
}
.hero-delta.done { background: rgba(23, 201, 132, .28); }

/* ---------- Resumen ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.stat { margin-bottom: 0; padding: 16px 18px; }
.stat-label {
  margin: 0 0 6px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #7b8496;
}
.stat-value {
  margin: 0 0 4px;
  font-size: 1.06rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.stat-note { margin: 0; font-size: .76rem; color: var(--muted); }

/* ---------- Gráfica ---------- */
.chart { margin-top: 4px; }
.chart svg { display: block; width: 100%; height: auto; }
.gridline { stroke: #e8ecf4; stroke-width: 1; }
.axis-text { font-size: 11px; fill: #7b8496; }
.line-real { stroke: var(--accent); stroke-width: 2.5; fill: none; }
.line-proj { stroke: #9aa7bd; stroke-width: 2; stroke-dasharray: 6 6; fill: none; }
.area { fill: rgba(36, 86, 214, .07); stroke: none; }
.dot-today { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.dot-pay { fill: var(--good); stroke: #fff; stroke-width: 2; }
.lbl {
  font-size: 11px;
  font-weight: 650;
  fill: #10233b;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 4px;
  stroke-linejoin: round;
}
.lbl-pay { fill: #0b6b4b; }
.legend { margin: 10px 0 0; font-size: .8rem; color: var(--muted); }
.lg {
  display: inline-block;
  width: 18px; height: 3px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}
.lg-real { background: var(--accent); }
.lg-proj { background: repeating-linear-gradient(90deg, #9aa7bd 0 5px, transparent 5px 9px); }

/* ---------- Tabla ---------- */
.movs { width: 100%; border-collapse: collapse; }
.movs th {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #7b8496;
  text-align: left;
  padding: 4px 8px 8px;
  border-bottom: 1px solid var(--line);
}
.movs td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  font-size: .92rem;
  vertical-align: top;
}
.movs tr:last-child td { border-bottom: none; }
.movs .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt-neg { color: var(--good); font-weight: 650; }
.amt-pos { color: #3a4a63; font-weight: 650; }

/* ---------- Simulador ---------- */
.hint { margin: 0 0 14px; color: var(--muted); font-size: .9rem; }
.sim-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.sim-inputs label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #7b8496;
}
.sim-inputs input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 13px;
  font-size: 1.02rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: #fbfcfe;
  border: 1px solid #d8dfeb;
  border-radius: 10px;
  outline: none;
}
.sim-inputs input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(36, 86, 214, .14);
  background: #fff;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chips button {
  padding: 7px 14px;
  font: inherit;
  font-size: .87rem;
  font-weight: 600;
  color: #253352;
  background: #fff;
  border: 1px solid #d5dcea;
  border-radius: 999px;
  cursor: pointer;
}
.chips button:hover { border-color: var(--accent); color: var(--accent); }
.chips button:active { transform: scale(.97); }

.sim-results { min-height: 64px; }
.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.mini {
  background: #f7f9fd;
  border-radius: 12px;
  padding: 11px 13px;
}
.mini-label {
  margin: 0 0 5px;
  font-size: .74rem;
  font-weight: 650;
  color: #6b7385;
}
.mini-value {
  margin: 0 0 3px;
  font-size: 1.04rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.mini-note { margin: 0; font-size: .74rem; color: #8a92a3; }

.sim-ok {
  margin: 12px 0 0;
  padding: 11px 13px;
  border-radius: 12px;
  background: #e6f7f0;
  border: 1px solid #bfe8d6;
  color: #0b6b4b;
  font-weight: 650;
  font-size: .93rem;
}
.sim-note { margin: 12px 0 0; color: var(--muted); font-size: .9rem; }
.sim-error { margin: 0; color: #b42318; font-weight: 650; }

/* ---------- Pie ---------- */
.foot {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid #dde3ee;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.6;
}
.foot p { margin: 0 0 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Móvil ---------- */
@media (max-width: 600px) {
  .wrap { padding-top: 22px; }
  .card { padding: 18px 16px; }
  .hero { padding: 20px 18px; }
  .hero-amount { font-size: clamp(2rem, 10vw, 2.6rem); }
  .stat-value { font-size: 1rem; }
  .sim-inputs { grid-template-columns: 1fr; }
  .mini-grid { grid-template-columns: 1fr; }

  /* Tabla de movimientos → tarjetas apiladas */
  .movs thead { display: none; }
  .movs, .movs tbody { display: block; }
  .movs tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "concepto monto"
      "fecha    saldo";
    column-gap: 10px;
    row-gap: 3px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .movs tr:last-child { border-bottom: 0; }
  .movs td { border: 0; padding: 0; font-size: .93rem; }
  .movs td:nth-child(1) {
    grid-area: fecha;
    align-self: center;
    font-size: .8rem;
    font-weight: 400;
    color: var(--muted);
  }
  .movs td:nth-child(2) { grid-area: concepto; font-weight: 650; }
  .movs td:nth-child(3) { grid-area: monto; text-align: right; font-weight: 650; white-space: nowrap; }
  .movs td:nth-child(4) {
    grid-area: saldo;
    text-align: right;
    font-size: .8rem;
    font-weight: 400;
    color: var(--muted);
    white-space: nowrap;
  }
  .movs td:nth-child(4)::before { content: "Saldo "; }

  /* Gráfica: textos más grandes para pantalla pequeña */
  .chart .axis-text { font-size: 17px; }
  .chart .lbl { font-size: 16px; stroke-width: 5px; }
}
