/* Mediciones Luxol — tokens del sistema "Luxol / Voy" (ver DESIGN.md del proyecto web) */
:root {
  --ink: #19301E;
  --ink-dark: #122215;
  --paper: #F4F1E7;
  --stone: #E4E1D8;
  --white: #FFFFFF;
  --muted: #5B6A5E;
  --peach: #FFA87C;
  --sage: #BECFAF;
  --lime: #BED86B;
  --lavender: #DAD8FA;

  --red: #B3261E;   --red-bg: #FBE9E7;
  --orange: #9A5200; --orange-bg: #FFF1DE;
  --blue: #2F5D8A;  --blue-bg: #E6EEF6;
  --ok: #2E6B3A;    --ok-bg: #E4F0DD;

  --sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --r-lg: 32px; --r-md: 24px; --r-sm: 16px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/24px var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

/* Barra superior */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  min-height: 56px;
  padding: env(safe-area-inset-top, 0px) 16px 0;
  background: var(--ink-dark); color: var(--paper);
}
.brand { font-weight: 500; letter-spacing: -0.01em; flex: 1; }
.brand span { font-weight: 300; opacity: .75; }
.icon-btn {
  width: 44px; height: 44px; margin-left: -10px;
  display: grid; place-items: center;
  border: 0; background: none; border-radius: 50%;
}
.user-chip {
  border: 2px solid rgba(244,241,231,.35); background: none;
  border-radius: 100px; padding: 4px 14px; font-size: 14px; color: var(--paper);
}

.view { max-width: 680px; margin: 0 auto; padding: 8px 8px 24px; }

/* Paneles insertados */
.panel { border-radius: var(--r-lg); padding: 28px 24px; }
.panel-green { background: var(--ink); color: var(--paper); }
.panel h1 {
  margin: 0 0 8px; font-weight: 300; font-size: 40px; line-height: 1.05; letter-spacing: -0.015em;
}
.panel p { margin: 0 0 20px; opacity: .85; }
.hero .btn { width: 100%; }

.section-title { font-size: 14px; font-weight: 500; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); margin: 24px 8px 10px; }

/* Botones pill */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  border-radius: 100px; border: 2px solid var(--ink);
  font-weight: 500; font-size: 16px;
  transition: transform 160ms var(--ease-out), background-color 160ms, opacity 160ms;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .5; }
.btn-green { background: var(--ink); color: var(--paper); }
.btn-outline { background: transparent; color: var(--ink); }
.btn-light { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn-small { min-height: 40px; padding: 0 16px; font-size: 15px; }
.link-btn { border: 0; background: none; padding: 8px; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; font-size: 15px; }

/* Entrada */
.login { margin-top: 8px; }
.user-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.user-list button {
  min-height: 56px; border-radius: var(--r-sm);
  border: 2px solid rgba(244,241,231,.3); background: transparent; color: var(--paper);
  font-weight: 500; font-size: 17px;
}
.user-list button[aria-pressed="true"] { background: var(--paper); color: var(--ink); border-color: var(--paper); }
#pin-form label { display: block; margin-bottom: 8px; }
#pin-form input {
  width: 100%; height: 56px; margin-bottom: 14px;
  border-radius: var(--r-sm); border: 0; padding: 0 18px;
  background: var(--paper); color: var(--ink); font-size: 24px; letter-spacing: .3em;
}
#pin-form .btn { width: 100%; }
.form-error { color: var(--peach); margin: 12px 0 0; min-height: 24px; }

/* Lista */
.draft-list { display: grid; gap: 8px; }
.draft {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  width: 100%; text-align: left;
  background: var(--white); border: 0; border-radius: var(--r-md); padding: 16px 18px;
}
.draft-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-meta { grid-column: 1; color: var(--muted); font-size: 14px; }
.chip { grid-row: 1 / span 2; grid-column: 2; font-size: 13px; font-weight: 500; padding: 4px 10px; border-radius: 100px; background: var(--stone); }
.chip-sent { background: var(--ok-bg); color: var(--ok); }
.chip-checked { background: var(--blue-bg); color: var(--blue); }
.empty { color: var(--muted); text-align: center; padding: 24px; }

/* Editor */
.status-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px; }
.status { font-size: 14px; color: var(--muted); }
#ed-text {
  display: block; width: 100%; min-height: 46dvh;
  border: 2px solid transparent; border-radius: var(--r-md);
  background: var(--white); padding: 18px;
  font-size: 17px; line-height: 1.5; resize: vertical;
}
#ed-text:focus { outline: none; border-color: var(--ink); }
.hint { font-size: 14px; color: var(--muted); margin: 6px 10px 0; }

.photos-head { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 0 0; }
.photos-head .section-title { margin-bottom: 10px; }
.photo-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--stone); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo span { position: absolute; left: 8px; bottom: 6px; color: #fff; font-size: 13px; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.photo button {
  position: absolute; top: 4px; right: 4px; width: 32px; height: 32px;
  border-radius: 50%; border: 0; background: rgba(18,34,21,.75); color: #fff; font-size: 18px; line-height: 1;
}

.stale { margin: 16px 0 0; padding: 12px 16px; border-radius: var(--r-sm); background: var(--orange-bg); color: var(--orange); font-size: 15px; }

/* Resultado de la comprobación */
.result { margin-top: 16px; display: grid; gap: 8px; animation: rise 280ms var(--ease-out); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.result-head {
  border-radius: var(--r-md); padding: 18px 20px;
  background: linear-gradient(104deg, var(--sage), var(--lavender));
}
.result-head.has-red { background: linear-gradient(104deg, #FFC9B0, var(--peach)); }
.result-head.all-ok { background: linear-gradient(104deg, var(--lime), var(--sage)); }
.result-head h2 { margin: 0 0 4px; font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
.result-head p { margin: 0; }
.counts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.count { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 100px; background: rgba(255,255,255,.7); }

.avisos { display: grid; gap: 6px; }
.aviso { display: grid; grid-template-columns: 12px 1fr; gap: 12px; padding: 14px 16px; border-radius: var(--r-sm); font-size: 15px; line-height: 1.4; }
.aviso::before { content: ""; width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; }
.aviso-rojo { background: var(--red-bg); } .aviso-rojo::before { background: var(--red); }
.aviso-naranja { background: var(--orange-bg); } .aviso-naranja::before { background: var(--orange); }
.aviso-azul { background: var(--blue-bg); } .aviso-azul::before { background: var(--blue); }

.card { background: var(--white); border-radius: var(--r-md); padding: 18px 20px; }
.card h3 { margin: 0 0 10px; font-size: 14px; font-weight: 500; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.card dt { color: var(--muted); }
.card dd { margin: 0; overflow-wrap: anywhere; }
.missing { color: var(--red); }
.line { padding: 10px 0; border-top: 1px solid var(--stone); }
.line:first-of-type { border-top: 0; padding-top: 0; }
.line-top { font-weight: 500; }
.line-sub { color: var(--muted); font-size: 15px; }

.bottom-spacer { height: calc(96px + var(--safe-b)); }
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: rgba(244,241,231,.94); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-top: 1px solid var(--stone);
}
@media (min-width: 720px) { .action-bar { left: 50%; width: 680px; transform: translateX(-50%); border-radius: var(--r-md) var(--r-md) 0 0; } }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Hoja de envío */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(18,34,21,.45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 200ms var(--ease-out);
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 680px;
  background: var(--paper); border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 24px 20px calc(20px + var(--safe-b));
  animation: up 280ms var(--ease-out);
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet h2 { margin: 0 0 16px; font-size: 24px; font-weight: 500; letter-spacing: -0.01em; }
.sheet label { display: block; font-size: 14px; color: var(--muted); margin: 14px 0 6px; }
.sheet input, .sheet textarea {
  width: 100%; border: 2px solid var(--stone); border-radius: var(--r-sm);
  background: var(--white); padding: 12px 14px; font-size: 16px;
}
.sheet input:focus, .sheet textarea:focus { outline: none; border-color: var(--ink); }
.subject-preview { font-size: 14px; color: var(--muted); margin: 6px 4px 0; }
.sheet-warn { padding: 12px 16px; border-radius: var(--r-sm); background: var(--red-bg); color: var(--red); font-size: 15px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; margin-top: 20px; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(96px + var(--safe-b)); z-index: 30;
  max-width: 560px; margin: 0 auto;
  background: var(--ink-dark); color: var(--paper);
  padding: 14px 18px; border-radius: var(--r-sm); font-size: 15px;
  animation: up 240ms var(--ease-out);
}

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