/* ---------- Marca ----------
   Manual de normas de Estancia Caleufu: Rich Gold #c8aa78 y Warm Black #140a0a como
   institucionales; verde #233223 y bordó #2d0000 de la paleta secundaria.
   Georgia para titulares, Roboto para web. El manual no admite otras familias.
   Todo el branding se cambia sólo en este bloque. */
:root {
  --gold: #c8aa78;
  --warm-black: #140a0a;
  --green: #233223;
  --burgundy: #2d0000;

  --bg: #f7f3ec;            /* Rich Gold al ~10% */
  --surface: #ffffff;
  --ink: var(--warm-black);
  --ink-soft: #675d59;
  --line: #e4dccd;
  --accent: var(--warm-black);
  --accent-ink: #ffffff;
  --accent-soft: #efe6d6;   /* Rich Gold al ~25% */
  --warn: #6b4a12;
  --warn-soft: #f4ead8;
  --ok: var(--green);
  --ok-soft: #e2e8e1;
  --danger: #8a1f17;
  --danger-soft: #f7e8e6;
  --font-display: Georgia, 'Times New Roman', serif;
  --font-body: Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --radius: 6px;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--ink-soft); }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px max(16px, env(safe-area-inset-left));
  background: var(--warm-black);
  border-bottom: 2px solid var(--gold);
}
.brand img { display: block; height: 30px; width: auto; }
.topbar .link { color: #fff; text-decoration-color: var(--gold); }

main { max-width: 720px; margin: 0 auto; padding: 32px 16px 64px; }

/* ---------- Controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  border: 1px solid var(--accent); border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover:not(:disabled) { background: #2b1e1b; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.secondary:hover:not(:disabled) { background: var(--accent-soft); }
.btn.block { width: 100%; }
.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 8px; text-decoration: underline; }

label.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field .req { color: var(--danger); margin-left: 2px; }
.field small { display: block; color: var(--ink-soft); font-size: .8rem; margin-top: 4px; }
input[type=text], input[type=password], input[type=search], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: inherit;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.field.invalid small.error { color: var(--danger); }

label.check {
  display: flex; gap: 12px; align-items: center;
  min-height: 44px; margin-bottom: 8px; cursor: pointer;
}
label.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.error-box { background: var(--danger-soft); color: var(--danger); padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; }

/* ---------- Login ----------
   Foto panorámica de la estancia a pantalla completa, con un velo Warm Black para que el texto
   se lea, y todo centrado: imagotipo en negativo, saludo y formulario. */
body.on-login {
  background: var(--warm-black) url('/img/login-hero.jpg') 68% center / cover no-repeat fixed;
  min-height: 100dvh;
}
body.on-login::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(20, 10, 10, .55) 0%, rgba(20, 10, 10, .35) 45%, rgba(20, 10, 10, .75) 100%);
}
@media (max-width: 760px) {
  body.on-login { background-image: url('/img/login-hero-1200.jpg'); background-attachment: scroll; background-position: 72% center; }
}
body.on-login .topbar { display: none; }
body.on-login main { position: relative; max-width: none; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; }
.login { width: 100%; max-width: 420px; margin: 0 auto; text-align: center; }
.login-logo { display: block; width: min(280px, 72%); height: auto; margin: 0 auto 28px; }
.login h1 { color: #fff; font-size: 1.8rem; margin-bottom: 8px; }
.login .intro { color: #efe7dc; margin: 0 auto 24px; max-width: 34ch; }
.login .card { padding: 28px; border: 0; border-top: 3px solid var(--gold); text-align: left; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }
.login-help { color: #d9cfc3; font-size: .85rem; margin: 18px 0 0; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.trip-card { margin: 24px 0; border-top: 3px solid var(--gold); }
.trip-card .eyebrow { font-size: .75rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.trip-card .eyebrow::before { content: ""; display: inline-block; width: 24px; height: 2px; background: var(--gold); vertical-align: middle; margin-right: 10px; }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.dates div { border-top: 1px solid var(--line); padding-top: 12px; }
.dates dt { font-size: .8rem; color: var(--ink-soft); }
.dates dd { margin: 4px 0 0; font-family: var(--font-display); font-size: 1.15rem; }

.guests { list-style: none; margin: 0; padding: 4px 20px; }
.guest {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.guest:last-child { border-bottom: 0; }
.guest .who { min-width: 0; }
.guest .name { font-weight: 600; overflow-wrap: anywhere; }
.pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; margin-top: 4px; }
.pill.not_started { background: #eee8e3; color: var(--ink-soft); }
.pill.in_progress { background: var(--accent-soft); color: var(--warn); }
.pill.completed { background: var(--ok-soft); color: var(--ok); }
.tag { font-size: .75rem; color: var(--ink-soft); margin-left: 6px; font-weight: 400; }

/* Avisos dentro de la tarjeta del viaje y del formulario. */
.trip-card .notice { margin: 16px 0 20px; }
.notice.permit strong { font-weight: 600; }

/* ---------- Formulario (modal) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 10, 10, .6);
  display: flex; align-items: flex-end; justify-content: center; z-index: 10;
}
.modal {
  background: var(--bg); width: 100%; max-width: 760px;
  height: 100dvh; display: flex; flex-direction: column;
}
@media (min-width: 760px) {
  .modal-backdrop { align-items: center; padding: 24px; }
  .modal { height: min(92dvh, 900px); border-radius: var(--radius); overflow: hidden; }
}
.modal-head { padding: 16px; background: var(--surface); border-bottom: 1px solid var(--line); border-top: 3px solid var(--gold); }
.modal-head .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-head h2 { margin: 0; font-size: 1.25rem; }
.close { font-size: 1.6rem; line-height: 1; background: none; border: 0; cursor: pointer; color: var(--ink-soft); min-width: 44px; min-height: 44px; }
.save-state { font-size: .8rem; color: var(--ink-soft); min-height: 1.2em; }
.save-state.error { color: var(--danger); }

.stepper { display: flex; gap: 6px; margin-top: 12px; }
.stepper button {
  flex: 1; height: 6px; border: 0; padding: 0; border-radius: 3px;
  background: var(--line); cursor: pointer;
}
.stepper button.done { background: var(--gold); opacity: .45; }
.stepper button.current { background: var(--gold); }
.step-label { font-size: .8rem; color: var(--ink-soft); margin-top: 8px; }

.modal-body { flex: 1; overflow-y: auto; padding: 20px 16px; }
.notice { background: var(--accent-soft); color: var(--ink); border-left: 3px solid var(--gold); border-radius: var(--radius); padding: 12px 14px; font-size: .9rem; margin-bottom: 20px; }
.grid { display: grid; grid-template-columns: 1fr; column-gap: 16px; }
@media (min-width: 600px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .grid .wide, .grid .check, .grid .textarea { grid-column: 1 / -1; }
}
.modal-foot {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
}
.modal-foot .btn { flex: 1; }
@media (min-width: 600px) { .modal-foot .btn { flex: 0 0 auto; min-width: 140px; } }

/* Sí/no y elección múltiple: botones grandes, cómodos en el teléfono. */
fieldset.field { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
fieldset.field legend { font-weight: 600; font-size: .9rem; margin-bottom: 8px; padding: 0; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 500;
}
.choice input:checked + span { background: var(--warm-black); border-color: var(--warm-black); color: #fff; }
.choice input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.grid .choices { grid-column: 1 / -1; }

.done-view { text-align: center; padding: 40px 8px; }
.done-view h2 { font-size: 1.8rem; }
.done-view h2::after { content: ""; display: block; width: 48px; height: 2px; background: var(--gold); margin: 14px auto 0; }
.loading { color: var(--ink-soft); padding: 40px 0; text-align: center; }
