@font-face {
  font-family: "Nighty";
  src: url("/assets/Nighty_DEMO.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Nighty solo trae letras A-Z y a-z; números, tildes y signos caen en Lilita One */
  --display: "Nighty", "Lilita One", "Arial Rounded MT Bold", Impact, sans-serif;
  --orange: #E8602F;
  --cream: #FBE9C6;
  --ink: #24150F;
  --mint: #BFE6CF;
  --wa: #25D366;
  --bg: #E8602F;
  --onbg: #24150F;
  --word: #FBE9C6;
  --word-shadow: #24150F;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #2A1710; --onbg: #FBE9C6; --word: #FBE9C6; --word-shadow: #E8602F;
  }
}
:root[data-theme="dark"] { --bg: #2A1710; --onbg: #FBE9C6; --word: #FBE9C6; --word-shadow: #E8602F; }
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0; background: var(--bg); color: var(--onbg);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 700; line-height: 1.45; min-height: 100vh;
}
.wrap { max-width: 440px; margin: 0 auto; padding: 28px 18px 40px; }
.wrap.ancho { max-width: 720px; }

/* Cabecera */
header { text-align: center; }
.logo {
  width: 128px; height: 128px; border-radius: 50%;
  border: 4px solid var(--ink); box-shadow: 5px 5px 0 var(--ink);
  display: block; margin: 0 auto 14px; background: #fff;
}
.logo.chico { width: 72px; height: 72px; border-width: 3px; box-shadow: 3px 3px 0 var(--ink); margin-bottom: 8px; }
h1 {
  font-family: var(--display);
  font-weight: 400; font-size: 56px; line-height: 1; margin: 0;
  color: var(--word); text-shadow: 3px 3px 0 var(--word-shadow); letter-spacing: .5px;
}
h1.chico { font-size: 38px; text-shadow: 2px 2px 0 var(--word-shadow); }
.tag { margin: 8px 0 0; font-size: 17px; }

/* Tarjetas */
.card {
  margin-top: 26px; background: var(--cream); color: var(--ink);
  border: 4px solid var(--ink); border-radius: 26px; box-shadow: 6px 6px 0 var(--ink);
  padding: 22px 18px 20px;
}
.card h2 {
  font-family: var(--display); font-weight: 400;
  font-size: 28px; line-height: 1.1; margin: 0 0 4px; overflow-wrap: anywhere;
}
.card p { margin: 0; }
.muted { font-size: 15px; opacity: .8; }

/* Formularios */
form { margin: 0; }
.form { margin-top: 16px; display: grid; gap: 12px; }
label { font-size: 14px; display: grid; gap: 5px; }
input[type="text"], input[type="tel"], input[type="password"], input[type="search"] {
  font: inherit; font-size: 16px; font-weight: 700; color: var(--ink);
  padding: 12px 14px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; width: 100%;
}
input::placeholder { color: rgba(36,21,15,.45); }

/* Botones */
.btn {
  font-family: var(--display); font-size: 20px; letter-spacing: .3px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 14px 18px; cursor: pointer; text-decoration: none;
  color: var(--ink); background: var(--orange);
  border: 3px solid var(--ink); border-radius: 16px; box-shadow: 4px 4px 0 var(--ink);
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn.dark { background: var(--ink); color: var(--cream); box-shadow: 4px 4px 0 var(--orange); }
.btn.wa { background: var(--wa); }
.btn.mint { background: var(--mint); }
.btn.small { font-size: 17px; padding: 10px 14px; border-radius: 14px; box-shadow: 3px 3px 0 var(--ink); }
.btn[disabled] { opacity: .4; cursor: not-allowed; box-shadow: none; }
.btn.auto { width: auto; display: inline-flex; }
.link {
  font: inherit; font-size: 14px; font-weight: 800; background: none; border: 0; padding: 6px 0;
  color: inherit; text-decoration: underline; cursor: pointer;
}
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.card :focus-visible { outline-color: var(--orange); }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

/* Avisos */
.aviso {
  margin-top: 14px; padding: 11px 14px; border: 3px solid var(--ink); border-radius: 14px; font-size: 15px;
}
.aviso.ok { background: var(--mint); }
.aviso.error { background: #FFD2C4; }

/* Sellos */
.stamps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0 14px; }
.slot {
  aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  border: 3px dashed rgba(36,21,15,.45); font-family: var(--display); font-size: 26px;
  color: rgba(36,21,15,.35); background: #fff7e4;
}
.slot.on { background: var(--orange); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); color: transparent; }
.slot.on svg { width: 78%; height: 78%; }
.slot.gift {
  border: 3px solid var(--ink); background: var(--mint); color: var(--ink);
  font-size: 17px; line-height: 1; text-align: center; justify-items: center; align-content: center;
}
.slot.gift.ready { background: var(--wa); box-shadow: 3px 3px 0 var(--ink); }
.slot.gift svg { width: 34px; height: 34px; margin-bottom: 2px; }
.status { font-size: 17px; }
.status b { font-family: var(--display); font-weight: 400; font-size: 20px; }
.stack { display: grid; gap: 12px; margin-top: 14px; }
.order { margin-top: 26px; text-align: center; }
.order .muted { margin-top: 10px; color: var(--onbg); opacity: .9; }

/* Administración */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar .marca { display: flex; align-items: center; gap: 12px; text-align: left; }
.topbar .marca h1 { font-size: 30px; }
.topbar .marca small { display: block; font-size: 14px; }
.resumen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.resumen div {
  background: var(--cream); color: var(--ink); border: 3px solid var(--ink); border-radius: 16px;
  padding: 10px 8px; text-align: center; font-size: 13px; line-height: 1.2;
}
.resumen b { display: block; font-family: var(--display); font-weight: 400; font-size: 30px; }
.fila { display: grid; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cli {
  margin-top: 14px; background: var(--cream); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 20px; box-shadow: 4px 4px 0 var(--ink); padding: 14px;
}
.cli header { text-align: left; display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.cli .nombre { font-family: var(--display); font-weight: 400; font-size: 22px; line-height: 1.1; overflow-wrap: anywhere; }
.cli .tel { font-size: 15px; opacity: .85; }
.cli .meta { font-size: 13px; opacity: .75; margin-top: 6px; }
.puntos { display: flex; gap: 5px; margin-top: 4px; justify-content: flex-end; }
.puntos span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); background: #fff7e4; }
.puntos span.on { background: var(--orange); }
.cuenta { text-align: right; font-size: 13px; }
.acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.acciones form { display: contents; }
.acciones .btn { width: auto; flex: 1 1 auto; }
details { margin-top: 12px; }
summary { cursor: pointer; font-size: 14px; font-weight: 800; text-decoration: underline; }
details .form { margin-top: 10px; }
.exportar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.exportar .btn { flex: 1 1 140px; width: auto; }
.buscar { display: flex; gap: 10px; margin-top: 14px; }
.buscar input { flex: 1; }
.buscar .btn { width: auto; }
.sec-titulo { margin: 28px 0 0; font-family: var(--display); font-weight: 400; font-size: 24px; color: var(--word); text-shadow: 2px 2px 0 var(--word-shadow); }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } }
