/* ===========================================================================
   Reparto — sistema de diseño "cuaderno de cuentas de viaje"
   Cálido + limpio. Base hueso, tinta cálida, oliva primario, terracota acento.
   Display: Fraunces (serif con carácter). Datos/UI: Archivo + tabular-nums.
   =========================================================================== */

:root {
  /* superficie */
  --bone:        #f7f3ec;   /* fondo crema */
  --bone-2:      #f1ebe0;   /* crema más profundo */
  --paper:       #fffdf8;   /* tarjetas */
  --line:        #e6ddcd;   /* bordes suaves */
  --line-2:      #d8ccb7;

  /* tinta */
  --ink:         #2c2620;   /* casi negro cálido */
  --ink-soft:    #6b6151;   /* texto secundario */
  --ink-faint:   #a89e8c;   /* texto terciario */

  /* color */
  --olive:       #5b6b3a;   /* primario (verde oliva) */
  --olive-deep:  #45531f;
  --olive-tint:  #e9ecdc;
  --terra:       #b4541f;   /* acento (terracota / óxido) */
  --terra-tint:  #f4e2d6;
  --gold:        #c8922a;   /* dorado mostaza */

  /* semánticos: te deben / debes */
  --pos:         #4f6a2e;   /* verde (te deben) */
  --pos-tint:    #e6ecd8;
  --neg:         #a83a14;   /* óxido (debes) */
  --neg-tint:    #f6e1d6;

  --radius:      18px;
  --radius-sm:   12px;
  --shadow:      0 1px 2px rgba(44,38,32,.04), 0 8px 24px -12px rgba(44,38,32,.18);
  --shadow-lg:   0 24px 60px -20px rgba(44,38,32,.30);
  --ring:        0 0 0 3px rgba(91,107,58,.18);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Archivo", system-ui, sans-serif;
  color: var(--ink);
  background-color: var(--bone);
  /* textura sutil de grano + halos cálidos para dar atmósfera (no blanco plano) */
  background-image:
    radial-gradient(900px 500px at 12% -8%, rgba(200,146,42,.10), transparent 60%),
    radial-gradient(800px 520px at 100% 0%, rgba(180,84,31,.07), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.025'/%3E%3C/svg%3E");
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* tipografía display */
.font-display { font-family: "Fraunces", Georgia, serif; }
h1, h2 { font-family: "Fraunces", Georgia, serif; font-weight: 600; letter-spacing: -.01em; margin: 0; }

/* números tabulares: clave en una app de cuentas */
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; letter-spacing: -.01em; }

/* ---- superficies ---- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---- pestañas ---- */
.tabs { display: flex; gap: .25rem; padding: .35rem; background: var(--bone-2);
        border: 1px solid var(--line); border-radius: 999px; }
.tab {
  flex: 1; text-align: center; padding: .55rem .5rem; border: 0; cursor: pointer;
  border-radius: 999px; font: 600 .92rem/1 "Archivo", sans-serif; color: var(--ink-soft);
  background: transparent; transition: color .2s, background .2s, box-shadow .2s;
}
.tab.active { background: var(--paper); color: var(--olive-deep); box-shadow: var(--shadow); }

/* ---- botones ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border-radius: 999px; padding: .6rem 1.1rem; font: 600 .95rem/1 "Archivo", sans-serif;
  cursor: pointer; border: 1px solid transparent; text-decoration: none;
  transition: transform .12s, box-shadow .2s, background .2s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--olive); color: #fbfaf4; box-shadow: 0 6px 16px -8px rgba(91,107,58,.7); }
.btn-primary:hover { background: var(--olive-deep); }
.btn-ghost { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bone-2); }
.btn-sm { padding: .38rem .7rem; font-size: .8rem; }

/* ---- inputs ---- */
.field {
  width: 100%; background: var(--paper); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: .7rem .85rem; font: 500 1rem "Archivo", sans-serif;
  color: var(--ink); transition: border-color .2s, box-shadow .2s; outline: none;
}
.field:focus { border-color: var(--olive); box-shadow: var(--ring); }
.label { display: block; font: 600 .8rem/1 "Archivo", sans-serif; color: var(--ink-soft);
         margin-bottom: .4rem; letter-spacing: .01em; }

/* ---- chips / puntos de persona ---- */
.chip { display: inline-flex; align-items: center; gap: .45rem; }
.dot  { width: .7rem; height: .7rem; border-radius: 999px; display: inline-block;
        box-shadow: 0 0 0 3px rgba(255,255,255,.7), 0 1px 2px rgba(0,0,0,.15); flex: 0 0 auto; }

/* semánticos */
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--ink-faint); }

/* ---- FAB ---- */
.fab {
  position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: max(1.1rem, env(safe-area-inset-bottom));
  width: 3.75rem; height: 3.75rem; border: 0; cursor: pointer; border-radius: 50%;
  background: var(--terra); color: #fff; font-size: 2rem; line-height: 0;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px -8px rgba(180,84,31,.75); transition: transform .15s, box-shadow .2s;
}
.fab:hover { transform: translateY(-2px) rotate(90deg); box-shadow: 0 16px 32px -8px rgba(180,84,31,.8); }
.fab:active { transform: scale(.94); }

/* ---- barra de progreso (resumen) ---- */
.bar { height: .55rem; background: var(--bone-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--olive), var(--gold)); border-radius: 999px;
           transition: width .6s cubic-bezier(.22,1,.36,1); }

/* ---- entradas escalonadas al cargar ---- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .5s cubic-bezier(.22,1,.36,1) both; }
.d1 { animation-delay: .04s; } .d2 { animation-delay: .10s; }
.d3 { animation-delay: .16s; } .d4 { animation-delay: .22s; }

@media (prefers-reduced-motion: reduce) {
  .rise { animation: none; } .fab:hover { transform: none; } .bar > i { transition: none; }
}

/* overlay del modal */
.overlay { position: fixed; inset: 0; z-index: 30; background: rgba(44,38,32,.45);
           backdrop-filter: blur(3px); display: flex; justify-content: center; }
.sheet {
  background: var(--paper); width: 100%; max-width: 30rem; border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-lg); padding: 1.25rem; max-height: 92vh; overflow-y: auto;
  align-self: flex-end; animation: sheetUp .32s cubic-bezier(.22,1,.36,1);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@media (min-width: 640px) {
  .overlay { align-items: center; }
  .sheet { align-self: center; border-radius: var(--radius); animation: rise .3s ease both; }
}

/* checkbox "entre quiénes" como toggle-pill */
.pick { display: flex; align-items: center; gap: .5rem; cursor: pointer; user-select: none;
        border: 1px solid var(--line-2); border-radius: 999px; padding: .5rem .8rem;
        font: 600 .9rem "Archivo", sans-serif; color: var(--ink-soft); transition: all .15s; }
.pick:has(input:checked) { background: var(--olive-tint); border-color: var(--olive); color: var(--olive-deep); }
.pick input { accent-color: var(--olive); width: 1.05rem; height: 1.05rem; }
