/* Panel · colores y letras de su marca personal (Marca personal/brand-book.md):
   fondo oscuro, esmeralda, Inter para todo y Barlow Condensed sólo para las cifras.
   Sin sombras: los bloques se separan con borde. */
:root {
  color-scheme: dark;
  --fondo: #111614;
  --superficie: #151B18;
  --superficie-2: #1B2320;
  --borde: #2A322E;
  --borde-fuerte: #3A4540;
  --titulo: #F2F6F4;
  --texto: #C9D1CD;
  --secundario: #9EA7A3;
  --joya: #046B4F;
  --joya-hover: #05805E;
  --resaltado: #2FB585;
  --resaltado-suave: rgba(47, 181, 133, 0.14);
  --gasto: #EE8068;
  --peligro: #F08A7A;
  --peligro-fondo: #7A2A20;

  --radio: 14px;
  --radio-chico: 8px;
  --pildora: 999px;
  --fuente: "Inter", system-ui, "Segoe UI", -apple-system, sans-serif;
  --numeros: "Barlow Condensed", "Arial Narrow", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: var(--fondo);
  color: var(--texto);
  font: 15px/1.45 var(--fuente);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { color: var(--titulo); margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
.secundario { color: var(--secundario); font-size: 13px; }
.vacio { color: var(--secundario); font-size: 14px; padding: 6px 0 10px; }
.error { color: var(--peligro); font-size: 13px; }
.ayuda { margin-top: 4px; }

/* ---------- Botones y campos ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px;
  border-radius: var(--pildora); border: 1px solid transparent;
  background: var(--superficie-2); color: var(--titulo);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}
.boton:active { transform: scale(0.97); }
.boton:focus-visible, input:focus-visible, .celda:focus-visible, .check:focus-visible, summary:focus-visible {
  outline: 2px solid var(--resaltado); outline-offset: 2px;
}
.boton-joya { background: var(--joya); }
.boton-joya:hover { background: var(--joya-hover); }
.boton-fantasma { background: transparent; border-color: var(--borde-fuerte); color: var(--texto); }
.boton-fantasma:hover { border-color: var(--secundario); color: var(--titulo); }
.boton-peligro { background: transparent; border-color: var(--peligro-fondo); color: var(--peligro); }
.boton-chico { min-height: 34px; padding: 0 12px; font-size: 13px; }
.boton-icono { width: 36px; min-height: 36px; padding: 0; background: transparent; border-color: var(--borde); font-size: 18px; }
.boton-icono:hover { border-color: var(--borde-fuerte); }
.boton-ancho { width: 100%; }
.boton-x {
  width: 32px; height: 32px; border: 0; border-radius: var(--pildora); background: transparent;
  color: var(--secundario); cursor: pointer; font-size: 18px; line-height: 1; flex: none;
}
.boton-x:hover { background: var(--superficie-2); color: var(--peligro); }

.campo { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.campo > span { font-size: 13px; color: var(--secundario); font-weight: 600; }
input[type="text"], input[type="password"], input[type="date"] {
  width: 100%; min-height: 42px; padding: 0 12px;
  background: var(--fondo); border: 1px solid var(--borde-fuerte); border-radius: var(--radio-chico);
  font-size: 16px; /* 16 px evita el zoom del iPhone al tocar el campo */
}
input::placeholder { color: #6B7570; }
.fila-campos { display: flex; gap: 12px; align-items: flex-end; }
.crece { flex: 1; min-width: 0; }

.segmentado {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--fondo); border: 1px solid var(--borde); border-radius: var(--pildora);
}
.segmentado button {
  min-height: 30px; padding: 0 12px; border: 0; border-radius: var(--pildora);
  background: transparent; color: var(--secundario); font-size: 13px; font-weight: 600; cursor: pointer;
}
.segmentado button[aria-selected="true"] { background: var(--superficie-2); color: var(--titulo); }
.campo .segmentado { min-height: 42px; align-items: center; }

/* ---------- Entrada ---------- */
.entrada { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.entrada-caja {
  width: 100%; max-width: 360px; padding: 28px 24px;
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio);
}
.entrada-caja .boton { margin-top: 18px; }
.entrada-sub { color: var(--secundario); margin-top: 6px; }

.marca { display: flex; align-items: center; gap: 10px; color: var(--titulo); font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.marca-grande { font-size: 24px; }
.marca-icono {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  background:
    linear-gradient(var(--resaltado), var(--resaltado)) 3px 3px / 7px 7px no-repeat,
    linear-gradient(var(--joya), var(--joya)) 12px 3px / 7px 7px no-repeat,
    linear-gradient(var(--joya), var(--joya)) 3px 12px / 7px 7px no-repeat,
    linear-gradient(var(--joya), var(--joya)) 12px 12px / 7px 7px no-repeat,
    #0E1412;
  border: 1px solid var(--borde);
}

/* ---------- Cabecera ---------- */
.cabecera {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  max-width: 1240px; margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px 6px;
}
.cabecera-izq { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.hoy-largo { color: var(--secundario); font-size: 14px; }
.hoy-largo::first-letter { text-transform: uppercase; }
.cabecera-der { display: flex; align-items: center; gap: 10px; }
.selector-mes { display: flex; align-items: center; gap: 6px; }
.titulo-mes { min-width: 128px; text-align: center; color: var(--titulo); font-weight: 600; font-size: 14px; }
.titulo-mes::first-letter { text-transform: uppercase; }

/* ---------- Tablero ---------- */
.tablero {
  display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr);
  max-width: 640px; margin: 0 auto;
  padding: 10px 16px max(24px, env(safe-area-inset-bottom));
}
@media (min-width: 1040px) {
  .tablero { max-width: 1240px; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; padding-top: 14px; }
  .t-tareas { grid-column: span 5; }
  .t-habitos { grid-column: span 7; }
  .t-ventas { grid-column: span 8; }
  .t-meta { grid-column: span 4; }
  .t-dinero { grid-column: span 12; }
}

.tarjeta {
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 16px; min-width: 0;
}
@media (min-width: 1040px) { .tarjeta { padding: 20px; } }
.tarjeta-cab { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; min-height: 34px; }
.empuja { margin-left: auto; }
.empuja-izq { margin-right: auto; }
.acciones { display: flex; gap: 8px; }
.cuenta { color: var(--secundario); font-size: 13px; font-variant-numeric: tabular-nums; }
.subtitulo { font-size: 13px; color: var(--secundario); font-weight: 600; margin: 18px 0 6px; }

.cifra { font-family: var(--numeros); font-weight: 800; font-size: 44px; line-height: 0.9; color: var(--titulo); font-variant-numeric: tabular-nums; }
.cifra-fila { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }

/* ---------- Tareas ---------- */
.lista-tareas { list-style: none; margin: 0; padding: 0; }
.tarea {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--borde);
}
.tarea:last-child { border-bottom: 0; }
.check {
  width: 24px; height: 24px; flex: none; cursor: pointer;
  border: 2px solid var(--borde-fuerte); border-radius: 7px; background: transparent;
  display: grid; place-items: center; padding: 0;
  transition: background-color 0.15s, border-color 0.15s;
}
.check:hover { border-color: var(--resaltado); }
.check svg { width: 14px; height: 14px; opacity: 0; transition: opacity 0.15s; }
.tarea.hecha .check { background: var(--joya); border-color: var(--joya); }
.tarea.hecha .check svg { opacity: 1; }
.tarea-texto { flex: 1; min-width: 0; color: var(--titulo); overflow-wrap: anywhere; }
.tarea.hecha .tarea-texto { color: var(--secundario); text-decoration: line-through; text-decoration-color: var(--borde-fuerte); }
.chip {
  flex: none; font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  padding: 2px 8px; border-radius: var(--pildora);
  background: var(--resaltado-suave); color: var(--resaltado);
}
.chip-gris { background: var(--superficie-2); color: var(--secundario); }
.chip-gasto { background: rgba(238, 128, 104, 0.12); color: var(--gasto); }
.lista-antes .tarea-texto { color: var(--texto); }
.lista-antes .fecha-antes { color: var(--secundario); font-size: 12px; flex: none; }

.alta-linea { display: flex; gap: 8px; margin-top: 12px; }
.alta-linea input { min-height: 40px; font-size: 15px; }
@media (max-width: 600px) { .alta-linea input { font-size: 16px; } }

/* ---------- Hábitos ---------- */
.habitos { display: flex; flex-direction: column; gap: 18px; }
.habito-cab { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.habito-nombre { color: var(--titulo); font-weight: 600; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.racha { color: var(--secundario); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.racha b { color: var(--resaltado); font-weight: 700; }
.boton-hoy {
  min-height: 34px; padding: 0 14px; border-radius: var(--pildora); cursor: pointer;
  border: 1px solid var(--borde-fuerte); background: transparent; color: var(--texto);
  font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}
.boton-hoy svg { width: 14px; height: 14px; }
.boton-hoy[aria-pressed="true"] { background: var(--joya); border-color: var(--joya); color: var(--titulo); }
.grilla {
  display: grid; gap: 3px;
  grid-template-columns: repeat(14, minmax(0, 1fr));
}
@media (min-width: 560px) { .grilla { grid-template-columns: repeat(28, minmax(0, 1fr)); } }
.celda {
  aspect-ratio: 1; min-width: 0; padding: 0; cursor: pointer;
  border: 1px solid var(--borde); border-radius: 4px; background: var(--superficie-2);
  transition: background-color 0.12s, border-color 0.12s;
}
.celda:hover { border-color: var(--borde-fuerte); }
.celda.si { background: var(--resaltado); border-color: var(--resaltado); }
.celda.hoy { outline: 2px solid var(--titulo); outline-offset: 1px; }
.grilla-pie { display: flex; justify-content: space-between; margin-top: 6px; color: var(--secundario); font-size: 12px; }

/* ---------- Gráfico de ventas ---------- */
.grafico { position: relative; margin-top: 14px; }
.grafico svg { display: block; width: 100%; height: auto; overflow: visible; }
.grafico .eje { stroke: var(--borde-fuerte); stroke-width: 1; }
.grafico .grilla-h { stroke: var(--borde); stroke-width: 1; }
.grafico .rotulo { fill: var(--secundario); font: 12px var(--fuente); }
.grafico .linea { fill: none; stroke: var(--resaltado); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.grafico .area { fill: var(--resaltado-suave); }
.grafico .punto { fill: var(--resaltado); stroke: var(--superficie); stroke-width: 2; }
.grafico .cruz { stroke: var(--secundario); stroke-width: 1; stroke-dasharray: 3 3; }
.grafico .punto-activo { fill: var(--titulo); stroke: var(--superficie); stroke-width: 2; }
.grafico-vacio {
  display: grid; place-items: center; text-align: center;
  min-height: 150px; border: 1px dashed var(--borde-fuerte); border-radius: var(--radio-chico);
  color: var(--secundario); font-size: 14px; padding: 16px;
}

.tooltip {
  position: fixed; z-index: 30; pointer-events: none;
  background: var(--superficie-2); border: 1px solid var(--borde-fuerte); border-radius: var(--radio-chico);
  padding: 8px 10px; font-size: 13px; color: var(--texto); max-width: 240px;
}
.tooltip b { color: var(--titulo); }

/* ---------- Listas de movimientos ---------- */
.detalle-lista { margin-top: 14px; border-top: 1px solid var(--borde); padding-top: 10px; }
.detalle-lista summary { cursor: pointer; color: var(--secundario); font-size: 13px; font-weight: 600; padding: 4px 0; }
.detalle-lista summary:hover { color: var(--titulo); }
.lista-movs { list-style: none; margin: 8px 0 0; padding: 0; }
.mov { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--borde); }
.mov:last-child { border-bottom: 0; }
.mov-fecha { color: var(--secundario); font-size: 12px; width: 44px; flex: none; font-variant-numeric: tabular-nums; }
.mov-detalle { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mov-monto { color: var(--titulo); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mov-monto.negativo { color: var(--gasto); }

/* ---------- Meta ---------- */
.meta-texto { color: var(--titulo); font-weight: 600; font-size: 17px; line-height: 1.3; }
.meta-cifras { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 14px; }
.meta-cifras .cifra { font-size: 56px; }
.barra-meta { height: 10px; border-radius: var(--pildora); background: var(--superficie-2); margin-top: 12px; overflow: hidden; }
.barra-meta > span {
  display: block; width: 100%; height: 100%; border-radius: var(--pildora); background: var(--resaltado);
  transform-origin: left center; transition: transform 0.3s;
}
.meta-botones { display: flex; gap: 8px; margin-top: 14px; }
.meta-botones .boton { flex: 1; }

/* ---------- Dinero ---------- */
.dinero { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .dinero { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.moneda-caja { border: 1px solid var(--borde); border-radius: var(--radio-chico); padding: 14px; }
.moneda-caja h3 { font-size: 13px; color: var(--secundario); font-weight: 600; margin-bottom: 10px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat-rotulo { color: var(--secundario); font-size: 12px; }
.stat-valor { font-family: var(--numeros); font-weight: 800; font-size: 28px; line-height: 1; color: var(--titulo); margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (min-width: 1040px) { .stat-valor { font-size: 34px; } }
/* En el celular cada cifra va en su renglón (rótulo a la izquierda, monto a la derecha) para que no se corte. */
@media (max-width: 559px) {
  .stats { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .stats > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
  .stat-valor { margin-top: 0; font-size: 26px; }
}
.stat-valor.negativo { color: var(--gasto); }
.barra-dinero { display: flex; gap: 2px; height: 8px; margin-top: 12px; border-radius: var(--pildora); overflow: hidden; background: var(--superficie-2); }
.barra-dinero .ing { background: var(--resaltado); }
.barra-dinero .gas { background: var(--gasto); }
.leyenda { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; color: var(--secundario); }
.leyenda i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }

/* ---------- Diálogos ---------- */
.dialogo {
  width: min(440px, calc(100vw - 32px)); padding: 0;
  background: var(--superficie); color: var(--texto);
  border: 1px solid var(--borde-fuerte); border-radius: var(--radio);
}
.dialogo::backdrop { background: rgba(5, 8, 7, 0.7); }
.dialogo form, .dialogo-cuerpo { padding: 22px 20px 20px; }
.dialogo h2 { font-size: 18px; }
.dialogo-pie { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.lista-edit { list-style: none; margin: 14px 0 0; padding: 0; }
.lista-edit li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.lista-edit input { min-height: 38px; font-size: 15px; }

/* ---------- Aviso ---------- */
.aviso {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 40; background: var(--superficie-2); border: 1px solid var(--borde-fuerte);
  border-radius: var(--pildora); padding: 10px 18px; font-size: 14px; color: var(--titulo);
  max-width: calc(100vw - 32px);
}
.aviso.mal { border-color: var(--peligro-fondo); color: var(--peligro); }

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