/* Misma línea que SZ.agro: crema, tinta, verde campo. Plano, sin brillos. */
:root {
  --bg: #f6f1e7;
  --card: #fffdf8;
  --card2: #f8f3e9;
  --ink: #2b2a26;
  --muted: #6f6a5f;
  --line: #e3dacb;
  --line2: #cfc4b1;
  --campo: #3f6b3a;
  --campo-osc: #345a30;
  --campo-claro: #8db36b;
  --tierra: #a9743e;
  --paja: #d9b65b;
  --ok: #3f6b3a;
  --warn: #c98a1b;
  --bad: #b5452f;
  --sin: #8c8577;
  /* textos de estado, con contraste AA sobre crema */
  --warn-t: #8f5e10;
  --bad-t: #a13d29;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --nav: 64px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.45 "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
:focus-visible { outline: 2px solid var(--campo); outline-offset: 2px; }
.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(var(--nav) + 28px + env(safe-area-inset-bottom)); }
body.sin-nav .wrap { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font: 600 30px/1.1 "Fraunces", Georgia, serif; letter-spacing: -0.01em; }
h2 { font-size: 20px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.chico { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }
a { color: var(--campo); text-underline-offset: 2px; }

/* --- Pestañas abajo --- */
.pestanas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.pestanas a {
  display: flex; align-items: center; justify-content: center; height: var(--nav);
  color: var(--muted); text-decoration: none; font-weight: 600; position: relative;
}
.pestanas a.on { color: var(--campo); }
.pestanas a.on::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--campo); }
body.sin-nav .pestanas { display: none; }

/* --- Cabecera --- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; min-height: 44px; }
.logo { font: 600 24px/1 "Fraunces", Georgia, serif; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.logo b { font-weight: inherit; color: var(--campo); }
.atras { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--ink); text-decoration: none; font-weight: 600; }

/* --- Botones --- */
.btn {
  appearance: none; border: 1px solid var(--campo); cursor: pointer; font: inherit; font-weight: 600;
  border-radius: 12px; padding: 12px 18px; min-height: 48px;
  color: var(--card); background: var(--campo);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; text-align: center;
  transition-property: transform, background-color, border-color; transition-duration: 140ms; transition-timing-function: var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line2); }
.btn.danger { background: transparent; color: var(--bad-t); border-color: rgba(181, 69, 47, 0.45); }
.btn.chico { min-height: 40px; padding: 8px 14px; font-size: 15px; border-radius: 10px; }
.btn.ancho { width: 100%; }
@media (hover: hover) {
  .btn:hover:not(:disabled) { background-color: var(--campo-osc); border-color: var(--campo-osc); }
  .btn.ghost:hover:not(:disabled) { background-color: var(--card2); border-color: var(--muted); }
  .btn.danger:hover:not(:disabled) { background-color: rgba(181, 69, 47, 0.06); border-color: var(--bad); }
  .persona:hover { border-color: var(--line2); }
}
.fila-btn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.enlace { appearance: none; background: none; border: 0; padding: 8px 0; font: inherit; color: var(--campo); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; min-height: 40px; }
.enlace.rojo { color: var(--bad-t); }

/* --- Tarjetas --- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.grande { font: 700 40px/1.05 "Source Sans 3", system-ui, sans-serif; letter-spacing: -0.01em; margin: 2px 0; font-variant-numeric: tabular-nums; }

/* --- Dólar hoy --- */
.tasas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.tasas .card { margin: 0; padding: 14px; }
.tasas .grande { font-size: 30px; }
.tasas .l { color: var(--muted); font-size: 15px; }
.cambio { font-size: 14px; margin-top: 4px; }
.cambio.sube { color: var(--bad-t); }
.cambio.baja { color: var(--campo); }
.vigencia { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 15px; margin: 2px 0 14px; }
.vigencia.mal { color: var(--warn-t); }
.punto { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.mal .punto { background: var(--warn); }
.calc .fila { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.calc .res { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.calc .res .grande { font-size: 32px; overflow-wrap: anywhere; }
.calc .copiar { margin-top: 8px; }
.grafico svg { display: block; width: 100%; height: auto; }
.grafico .ejes { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 4px; }
.fuente { color: var(--muted); font-size: 14px; text-align: center; margin-top: 8px; }
.puente { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; color: var(--ink); }
.puente b { display: block; color: var(--campo); }
.puente .flecha { font-size: 22px; color: var(--campo); }

/* --- Me deben --- */
.tasa-linea {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px;
  font: inherit; color: inherit; text-align: left; cursor: pointer; min-height: 48px;
}
.tasa-linea .estado { font-size: 14px; color: var(--muted); white-space: nowrap; }
.tasa-linea .estado.mal { color: var(--warn-t); }
.total { padding: 18px 16px; }
.total .l { color: var(--muted); }
.total .bs { font-size: 18px; }
.total .pie { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.total .pie b { color: var(--bad-t); font-weight: 600; }
.acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.lista-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 10px; flex-wrap: wrap; }
.orden { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  appearance: none; font: inherit; font-size: 14px; cursor: pointer; border-radius: 999px; padding: 6px 12px; min-height: 36px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line2);
}
.chip.on { background: var(--ink); color: var(--card); border-color: var(--ink); }
.buscar { margin-bottom: 10px; }
.persona {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 14px 19px; margin-bottom: 10px;
  color: var(--ink); text-decoration: none; position: relative; overflow: hidden; min-height: 64px;
  transition: border-color 180ms var(--ease-out);
}
.persona::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--c, var(--sin)); }
[data-n="ok"] { --c: var(--campo-claro); }
[data-n="atencion"] { --c: var(--warn); }
[data-n="vieja"] { --c: var(--bad); }
[data-n="aldia"] { --c: var(--line2); }
.persona .izq { min-width: 0; }
.persona .nom { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.persona .der { text-align: right; flex-shrink: 0; }
.persona .m { font-weight: 700; }
.persona .sub { font-size: 14px; color: var(--muted); }
[data-n="atencion"] .cuando { color: var(--warn-t); }
[data-n="vieja"] .cuando { color: var(--bad-t); }
.vacio { text-align: center; padding: 28px 16px; color: var(--muted); border: 1.5px dashed var(--line2); border-radius: 14px; }
details.aldia { margin-top: 14px; }
details.aldia summary { cursor: pointer; color: var(--muted); padding: 10px 0; min-height: 44px; }
.plan { text-align: center; margin-top: 22px; color: var(--muted); font-size: 14px; }

/* --- Ficha de persona --- */
.ficha h1 { overflow-wrap: anywhere; }
.ficha .tel { margin: 4px 0 14px; }
.saldo { border-left: 4px solid var(--c, var(--line2)); }
.saldo .cuando { margin-top: 6px; font-size: 15px; }
.cobrar { margin-bottom: 10px; }
.historial { margin-top: 22px; }
.historial h2 { margin-bottom: 8px; }
.mov {
  display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line);
  width: 100%; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.mov:last-child { border-bottom: 0; }
.mov .izq { min-width: 0; }
.mov .que { font-weight: 600; overflow-wrap: anywhere; }
.mov .der { text-align: right; flex-shrink: 0; }
.mov .m { font-weight: 700; }
.mov.abono .m { color: var(--campo); }

/* --- Formularios --- */
label.campo { display: grid; gap: 6px; font-size: 15px; color: var(--muted); margin-bottom: 14px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--card); border: 1px solid #9a8f7a; border-radius: 12px;
  padding: 11px 13px; min-height: 48px; width: 100%; outline: none;
}
input:focus, select:focus { border-color: var(--campo); box-shadow: 0 0 0 1px var(--campo); }
.monto { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.monto input { font-size: 26px; font-weight: 700; min-width: 0; }
.moneda { display: inline-flex; border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; background: var(--card); }
.moneda button { appearance: none; border: 0; background: transparent; font: inherit; font-weight: 600; padding: 0 14px; min-width: 52px; min-height: 48px; cursor: pointer; color: var(--muted); }
.moneda button.on { background: var(--ink); color: var(--card); }
.equiv { min-height: 1.45em; margin: -6px 0 14px; color: var(--muted); font-size: 15px; }
.sugeridos { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.err { color: var(--bad-t); min-height: 1.45em; margin: -4px 0 10px; font-size: 15px; }

/* --- Hoja que sube desde abajo --- */
.hoja { position: fixed; inset: 0; z-index: 20; display: grid; align-items: end; }
.hoja[hidden] { display: none; }
.hoja-fondo { position: absolute; inset: 0; background: rgba(43, 42, 38, 0.38); animation: aparecer 180ms var(--ease-out); }
.hoja-caja {
  position: relative; background: var(--bg); border-radius: 18px 18px 0 0; max-height: 92dvh; overflow: auto;
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); width: 100%; max-width: 560px; margin: 0 auto;
  animation: subir 240ms var(--ease-out);
}
.hoja-caja::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line2); margin: 0 auto 12px; }
.hoja-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.cerrar { appearance: none; border: 0; background: none; font: inherit; color: var(--muted); min-width: 44px; min-height: 44px; cursor: pointer; font-size: 26px; line-height: 1; }
@keyframes subir { from { transform: translateY(24px); opacity: 0; } }
@keyframes aparecer { from { opacity: 0; } }

/* --- Aviso abajo --- */
.aviso {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav) + 12px + env(safe-area-inset-bottom)); z-index: 30;
  max-width: 528px; margin: 0 auto; background: var(--ink); color: var(--card); border-radius: 12px; padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; animation: subir 200ms var(--ease-out);
}
.aviso[hidden] { display: none; }
.aviso button { appearance: none; border: 0; background: none; color: var(--paja); font: inherit; font-weight: 700; cursor: pointer; min-height: 40px; white-space: nowrap; }

/* --- Bienvenida del fiao --- */
.hero { text-align: center; padding: 20px 4px 4px; }
.hero h1 { font-size: 32px; }
.hero h1::after { content: ""; display: block; width: 44px; height: 3px; border-radius: 2px; background: var(--paja); margin: 14px auto 0; }
.hero p.lema { font-size: 19px; margin: 16px 0 4px; }
.rasgos { display: grid; gap: 10px; margin: 20px 0; }
.rasgo { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.rasgo b { display: block; color: var(--campo); margin-bottom: 2px; }
.rasgo p { color: var(--muted); font-size: 15px; }
.demo-banda { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #f3e7c4; border: 1px solid #e6d29a; border-radius: 12px; padding: 8px 8px 8px 14px; margin-bottom: 14px; font-size: 15px; }

.ajustes h2 { margin: 6px 0 12px; }
.ajustes .card > p { margin-bottom: 10px; }

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