/* ══════════════════════════════════════════════════════════════════════════
   CAMPING · Bosque de Gordón
   Tema "bosque": papel cálido, verde pino, ámbar para la luz.
   ══════════════════════════════════════════════════════════════════════════ */
:root {
  --bg:          #f4f1ea;
  --surface:     #fffdf9;
  --surface-2:   #f8f5ee;
  --line:        #e6e0d3;
  --line-2:      #d9d2c2;
  --ink:         #1f2a23;
  --ink-2:       #56625a;
  --ink-3:       #8a948d;

  --pine:        #2d6a4f;
  --pine-strong: #1f5139;
  --pine-soft:   #e2eee6;
  --on-pine:     #ffffff;
  --hero-bg:     #2d6a4f;
  --hero-ink:    #ffffff;
  --hero-btn:    #1f5139;

  --sun:         #a86a12;
  --sun-bright:  #d9982a;
  --sun-soft:    #f6ead2;
  --berry:       #b54708;   /* "peligro" en naranja fuerte, siempre con símbolo */
  --berry-soft:  #fde6d4;
  --ok:          #1c5ea8;   /* "bien" en azul, siempre con ✓ */
  --ok-soft:     #e3edf9;
  --sky:         #35679a;
  --sky-soft:    #e1eaf4;

  --r:    14px;
  --r-lg: 20px;
  --sh:   0 1px 2px rgba(31,42,35,.05), 0 2px 8px rgba(31,42,35,.05);
  --sh-lg:0 16px 40px rgba(31,42,35,.18);

  --font: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Fraunces', Georgia, serif;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
@media (min-width: 900px) { html { font-size: 17.5px; } }
body {
  font-family: var(--font); background: var(--bg); color: var(--ink);
  min-height: 100dvh; -webkit-font-smoothing: antialiased; line-height: 1.45;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: var(--pine); }
a.btn, a.link, a.link-btn, a.nav-item, a.icon-btn { text-decoration: none; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

.ico { width: 1.25em; height: 1.25em; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: middle; }

/* ══ NAVEGACIÓN ══════════════════════════════════════════════════════════ */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.nav-brand, .nav .nav-logout { display: none; }
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: .72rem; font-weight: 600; color: var(--ink-3); text-decoration: none; letter-spacing: .01em;
  -webkit-tap-highlight-color: transparent;
}
.nav-item .ico { width: 23px; height: 23px; }
.nav-item.active { color: var(--pine); }
.nav-item.active .ico { stroke-width: 2.3; }

.main { max-width: 760px; margin: 0 auto; padding: 0 16px calc(var(--nav-h) + var(--safe-b) + 28px); }

@media (min-width: 900px) {
  .nav {
    top: 0; right: auto; width: 232px; height: 100dvh; padding: 22px 14px;
    flex-direction: column; justify-content: flex-start; gap: 4px;
    border-top: 0; border-right: 1px solid var(--line); background: var(--surface);
  }
  .nav-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--pine); color: var(--on-pine); }
  .brand-mark .ico { width: 22px; height: 22px; }
  .brand-name { font-family: var(--display); font-weight: 600; font-size: 1.02rem; line-height: 1.15; }
  .brand-sub { font-size: .7rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
  .nav-item { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: 12px; font-size: .93rem; color: var(--ink-2); }
  .nav-item .ico { width: 20px; height: 20px; }
  .nav-item:hover { background: var(--surface-2); }
  .nav-item.active { background: var(--pine-soft); color: var(--pine-strong); }
  .nav .nav-logout { display: flex; margin-top: auto; }
  .main { margin-left: 232px; margin-right: 0; padding: 8px 40px 48px; max-width: 900px; }
}

/* ══ VISTAS ══════════════════════════════════════════════════════════════ */
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 22px 2px 14px; }
.page-head h1 { font-family: var(--display); font-weight: 600; font-size: 1.85rem; letter-spacing: -.01em; line-height: 1.1; }
.page-head .eyebrow { margin-bottom: 2px; }
.eyebrow { font-size: .72rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .12em; }
.page-head .actions { display: flex; gap: 8px; }
.mobile-logout { display: inline-flex; }
@media (min-width: 900px) { .mobile-logout { display: none; } }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 26px 2px 10px; }
.section-title h2 { font-size: .8rem; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .1em; }
.section-title .link { font-size: .85rem; font-weight: 600; color: var(--pine); }

/* ══ TARJETAS ════════════════════════════════════════════════════════════ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--sh); }
.card + .card { margin-top: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-2 > .card + .card { margin-top: 0; }
@media (max-width: 380px) { .grid-2 { grid-template-columns: 1fr; } }
.card-label { display: flex; align-items: center; gap: 7px; font-size: .78rem; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .08em; }
.card-label .ico { width: 17px; height: 17px; }
.big { font-family: var(--font); font-weight: 700; font-size: 1.95rem; line-height: 1.05; letter-spacing: -.01em; margin-top: 10px; font-variant-numeric: tabular-nums lining-nums; }
.big small { font-family: var(--font); font-size: .9rem; font-weight: 600; color: var(--ink-3); margin-left: 3px; }
.meta { font-size: .92rem; color: var(--ink-2); margin-top: 6px; }
.meta strong { color: var(--ink); font-weight: 600; }
.muted { color: var(--ink-3); }
.card.tap { cursor: pointer; transition: transform .12s ease, border-color .12s; }
.card.tap:active { transform: scale(.985); }
.card.tap:hover { border-color: var(--line-2); }

/* Portada */
.hero {
  position: relative; overflow: hidden; margin-top: 14px;
  background: var(--hero-bg); color: var(--hero-ink); border: 0; padding: 22px 20px 20px;
}
.hero .eyebrow { color: color-mix(in srgb, var(--hero-ink) 72%, transparent); }
.hero h1 { font-family: var(--display); font-weight: 600; font-size: 2.05rem; line-height: 1.05; letter-spacing: -.015em; margin: 4px 0 2px; }
.hero .fecha { font-size: .9rem; opacity: .82; }
.hero .estados { position: relative; z-index: 1; margin-top: 18px; display: grid; gap: 8px; }
.hero .estado { padding: 12px 12px 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--hero-ink) 12%, transparent); display: flex; align-items: center; gap: 12px; }
.hero .estado > .ico { width: 24px; height: 24px; opacity: .7; }
.hero .estado.dentro { background: color-mix(in srgb, var(--hero-ink) 20%, transparent); }
.hero .estado.dentro > .ico { opacity: 1; color: #ffd36b; }
.hero .estado-txt { flex: 1; min-width: 0; font-size: .9rem; line-height: 1.35; opacity: .95; }
.hero .estado-txt strong { display: block; font-size: 1.02rem; }
.hero .btn { background: var(--hero-ink); color: var(--hero-btn); border-color: transparent; }
.hero .btn.soft { background: color-mix(in srgb, var(--hero-ink) 18%, transparent); color: var(--hero-ink); }
.hero-trees { position: absolute; right: -6px; top: 8px; width: 170px; height: 90px; opacity: .16; pointer-events: none; }
.hero-actions { position: relative; z-index: 1; display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* Avisos */
.aviso { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r); border: 1px solid transparent; margin-top: 12px; }
.aviso .ico { width: 21px; height: 21px; margin-top: 1px; }
.aviso-t { font-weight: 700; font-size: .95rem; }
.aviso-d { font-size: .86rem; margin-top: 2px; opacity: .9; }
.aviso.peligro { background: var(--berry-soft); color: var(--berry); border-color: color-mix(in srgb, var(--berry) 25%, transparent); }
.aviso.aviso   { background: var(--sun-soft);   color: var(--sun); border-color: color-mix(in srgb, var(--sun) 25%, transparent); }
.aviso.info    { background: var(--sky-soft);   color: var(--sky); border-color: color-mix(in srgb, var(--sky) 22%, transparent); }
.aviso .aviso-t, .aviso .aviso-d { color: var(--ink); }
.aviso .btn { margin-top: 10px; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; letter-spacing: .01em; }
.chip .ico { width: 13px; height: 13px; stroke-width: 2.4; }
.chip.ok    { background: var(--ok-soft);    color: var(--ok); }
.chip.warn  { background: var(--sun-soft);   color: var(--sun); }
.chip.bad   { background: var(--berry-soft); color: var(--berry); }
.chip.info  { background: var(--sky-soft);   color: var(--sky); }
.chip.luz   { background: var(--sun-soft);   color: var(--sun); }

/* Barra de progreso (bolsa vs próximo pago) */
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 12px; border: 1px solid var(--line); }
.bar > span { display: block; height: 100%; background: var(--pine); border-radius: 99px; transition: width .5s ease; }
.bar.warn > span { background: var(--sun-bright); }

/* ══ BOTONES ═════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 0 16px; border-radius: 12px; font-weight: 600; font-size: .92rem;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  transition: filter .12s, transform .12s; white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn .ico { width: 18px; height: 18px; }
.btn.primary { background: var(--pine); color: var(--on-pine); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.luz { background: var(--sun-soft); color: var(--sun); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.danger { background: transparent; color: var(--berry); border-color: transparent; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: .84rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn-row .btn { flex: 1; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn .ico { width: 21px; height: 21px; }
.link-btn { color: var(--pine); font-weight: 600; font-size: .86rem; display: inline-flex; align-items: center; gap: 4px; }
.link-btn .ico { width: 15px; height: 15px; }

/* ══ LISTAS ══════════════════════════════════════════════════════════════ */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.row + .row { border-top: 1px solid var(--line); }
.row.tap { cursor: pointer; }
.row.tap:hover { background: var(--surface-2); }
.row-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); color: var(--ink-2); }
.row-ico .ico { width: 20px; height: 20px; }
.row-ico.pine { background: var(--pine-soft); color: var(--pine-strong); }
.row-ico.sun  { background: var(--sun-soft);  color: var(--sun); }
.row-ico.berry{ background: var(--berry-soft);color: var(--berry); }
.row-ico.sky  { background: var(--sky-soft);  color: var(--sky); }
.row-main { flex: 1; min-width: 0; }
.row-t { font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; }
.row-s { font-size: .88rem; color: var(--ink-3); margin-top: 1px; }
.row-end { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row-amt { font-weight: 700; font-variant-numeric: tabular-nums; font-size: .98rem; }
.row-amt.pos { color: var(--ok); }
.row-amt.neg { color: var(--ink); }
.row-amt.zero { color: var(--ink-3); text-decoration: line-through; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 14px 68px; margin-top: -4px; }
.empty { padding: 26px 18px; text-align: center; color: var(--ink-3); font-size: .92rem; }
.empty .ico { width: 30px; height: 30px; margin: 0 auto 8px; display: block; opacity: .7; }

/* Grupos por año */
.year-head { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 16px 10px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.year-head strong { font-size: 1.12rem; font-weight: 700; }
.year-head span { font-size: .82rem; color: var(--ink-3); font-weight: 600; }
.row + .year-head, .row-actions + .year-head { border-top: 1px solid var(--line); }

/* Estancias */
.stay { padding: 14px 16px; }
.stay + .stay { border-top: 1px solid var(--line); }
.stay-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stay-dates { font-weight: 700; font-size: .98rem; }
.stay-dates .arrow { color: var(--ink-3); margin: 0 4px; font-weight: 500; }
.stay-read { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.read-box { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; }
.read-box .lbl { font-size: .7rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }
.read-box .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.read-box .thumb { margin-left: auto; }
.thumb { width: 42px; height: 42px; border-radius: 9px; object-fit: cover; cursor: zoom-in; border: 1px solid var(--line); flex-shrink: 0; }
.stay-notes { font-size: .84rem; color: var(--ink-2); margin-top: 8px; }
.stay-lect { margin-top: 10px; border-left: 2px solid var(--line-2); padding-left: 12px; display: grid; gap: 6px; }
.stay-lect .l { display: flex; align-items: center; gap: 10px; font-size: .86rem; }
.stay-lect .l .thumb { width: 32px; height: 32px; }
.stay-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* Resumen de luz */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--sh); }
.stat .lbl { font-size: .7rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }
.stat .val { font-family: var(--font); font-weight: 700; font-size: 1.25rem; margin-top: 4px; font-variant-numeric: tabular-nums lining-nums; line-height: 1.15; }
.stat .sub { font-size: .78rem; color: var(--ink-3); margin-top: 1px; }
.stat.tap { cursor: pointer; }
.stat.tap .sub { color: var(--pine); font-weight: 600; }
@media (max-width: 420px) { .stat .val { font-size: 1.12rem; } .stat { padding: 11px 11px; } }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { padding: 7px 14px; border-radius: 9px; font-size: .86rem; font-weight: 600; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--sh); }

/* Gráfico de la bolsa */
.chart { width: 100%; height: auto; display: block; margin-top: 14px; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.chart .area { fill: var(--pine-soft); }
.chart .lineP { stroke: var(--pine); stroke-width: 2.2; fill: none; stroke-linejoin: round; }
.chart .pay { fill: var(--surface); stroke: var(--sun-bright); stroke-width: 2.2; }
.chart .now { fill: var(--pine); }
.legend { display: flex; gap: 14px; font-size: .78rem; color: var(--ink-3); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

/* Documentos */
.drop {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); padding: 16px; background: var(--surface);
}
.drop:hover { border-color: var(--pine); }
.drop .row-ico { background: var(--pine-soft); color: var(--pine-strong); }

/* ══ FORMULARIOS ═════════════════════════════════════════════════════════ */
.field { margin-bottom: 14px; }
.field > label, .field-label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 13px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 1rem; outline: none;
  transition: border-color .12s, box-shadow .12s; -webkit-appearance: none; appearance: none;
}
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.input:focus { border-color: var(--pine); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pine) 18%, transparent); }
.hint { display: block; font-size: .86rem; color: var(--ink-3); margin-top: 5px; }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 52px; }
.input-suffix span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-weight: 600; font-size: .9rem; pointer-events: none; }
.lectura { display: flex; align-items: center; gap: 8px; }
.lectura .input:first-child { flex: 1; font-size: 1.35rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.lectura .input:last-of-type { width: 64px; flex: 0 0 64px; font-size: 1.35rem; font-weight: 700; text-align: center; color: var(--berry); }
.lectura .sep { font-size: 1.3rem; color: var(--ink-3); font-weight: 700; }
.lectura .unit { color: var(--ink-3); font-weight: 600; }
.field > label.photo { display: flex; }
.field > label.photo, .field > label.check { margin-bottom: 0; font-size: inherit; color: inherit; }
.photo { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 88px; border: 1.5px dashed var(--line-2); border-radius: 14px; background: var(--surface-2); color: var(--ink-2); font-weight: 600; font-size: .9rem; cursor: pointer; overflow: hidden; position: relative; }
.photo img { width: 100%; max-height: 220px; object-fit: cover; }
.photo input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.field > label.check, .check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--pine); margin-top: 1px; flex-shrink: 0; }
.check .t { font-weight: 600; font-size: .92rem; }
.check .d { font-size: .82rem; color: var(--ink-3); }
.summary { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: .9rem; }
.summary .r { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.summary .r span { color: var(--ink-2); }
.summary .r strong { font-variant-numeric: tabular-nums; }
.summary .r.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; font-size: 1.05rem; }
.summary.luz { background: var(--sun-soft); border-color: transparent; }
.info-box { background: var(--pine-soft); color: var(--pine-strong); border-radius: 12px; padding: 11px 14px; font-size: .88rem; margin-bottom: 14px; font-weight: 500; }
.info-box.warn { background: var(--sun-soft); color: var(--sun); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Ajustes */
.set-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--sh); margin-bottom: 14px; }
.set-card h3 { display: flex; align-items: center; gap: 9px; font-size: 1.02rem; font-weight: 700; margin-bottom: 4px; }
.set-card h3 .ico { width: 19px; height: 19px; color: var(--pine); }
.set-card > p { font-size: .86rem; color: var(--ink-3); margin-bottom: 14px; }
.plazo-row { display: grid; grid-template-columns: 2.1fr .8fr .9fr 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.plazo-head { font-size: .72rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.plazo-sum { font-size: .85rem; font-weight: 600; margin: 4px 0 12px; }
.plazo-sum.bad { color: var(--berry); } .plazo-sum.ok { color: var(--ok); }
.copy-row { display: flex; gap: 8px; }
.copy-row .input { font-size: .82rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ══ HOJA INFERIOR ═══════════════════════════════════════════════════════ */
.sheet-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(16,22,18,.45); display: flex; align-items: flex-end; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .2s; }
.sheet-overlay.open { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--sh-lg);
  transform: translateY(24px); transition: transform .24s cubic-bezier(.2,.8,.2,1);
}
.sheet-overlay.open .sheet { transform: none; }
.sheet-grip { width: 42px; height: 5px; border-radius: 9px; background: var(--line-2); margin: 9px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 6px 20px; }
.sheet-head h3 { font-family: var(--display); font-weight: 600; font-size: 1.3rem; }
.sheet-body { padding: 8px 20px 6px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-foot { display: flex; gap: 10px; padding: 12px 20px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1; min-height: 48px; }
@media (min-width: 700px) {
  .sheet-overlay { align-items: center; }
  .sheet { border-radius: 22px; }
  .sheet-grip { display: none; }
}

/* Lightbox y toast */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.88); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 92dvh; border-radius: 10px; }
.toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 14px); transform: translate(-50%, -20px); z-index: 120; background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: .9rem; opacity: 0; pointer-events: none; transition: all .25s; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--berry); color: #fff; }
@media (min-width: 900px) { .toast { left: calc(50% + 116px); } }

/* ══ LOGIN ═══════════════════════════════════════════════════════════════ */
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: var(--pine); position: relative; overflow: hidden; }
.login-trees { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 34vh; color: var(--on-pine); opacity: .12; }
.login-card { position: relative; width: 100%; max-width: 380px; background: var(--surface); border-radius: 24px; padding: 30px 24px 24px; box-shadow: var(--sh-lg); }
.login-mark { width: 52px; height: 52px; border-radius: 15px; background: var(--pine); color: var(--on-pine); display: grid; place-items: center; margin-bottom: 16px; }
.login-mark .ico { width: 28px; height: 28px; }
.login-card h1 { font-family: var(--display); font-weight: 600; font-size: 1.7rem; line-height: 1.1; }
.login-card .sub { color: var(--ink-3); font-size: .92rem; margin: 4px 0 22px; }
.login-error { background: var(--berry-soft); color: var(--berry); border-radius: 12px; padding: 10px 13px; font-size: .88rem; font-weight: 600; margin-bottom: 14px; }

/* ══ v4 ══════════════════════════════════════════════════════════════════ */
.state-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--sh); }
.state-card > .ico { width: 26px; height: 26px; color: var(--ink-3); }
.state-card.on { background: var(--sun-soft); border-color: color-mix(in srgb, var(--sun) 25%, transparent); }
.state-card.on > .ico { color: var(--sun); }
.aviso-ico { display: grid; place-items: center; }
.radios { display: grid; gap: 8px; }
.radios .check input { border-radius: 50%; }
.input-code { font-size: 1.7rem !important; letter-spacing: .3em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.codes code { font: 700 1.05rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 8px; text-align: center; letter-spacing: .06em; }
.qr { width: 200px; max-width: 70%; margin: 12px auto 6px; background: #fff; border-radius: 12px; padding: 8px; border: 1px solid var(--line); }
.qr svg { width: 100%; height: auto; display: block; }
.pasos { padding-left: 1.2em; display: grid; gap: 14px; margin-bottom: 10px; font-size: .95rem; }
.pasos li::marker { font-weight: 700; color: var(--pine); }
.paso2 { font-size: .95rem; color: var(--ink-2); margin-bottom: 14px; }
.login-links { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 16px; }
.login-links .link-btn { font-size: .9rem; }
.clave { margin-top: 6px; font: 700 1rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; word-break: break-all; user-select: all; }
