/* Filum: estilos base. Sin estilos en línea (la CSP los bloquea).
   Estética base: la de TRAMA et FILUM, un tramado de tela de alta costura. Papel claro con cuadrillé fino, azul tinta,
   vainilla y líneas rectas. Cada comercio puede cambiar el color principal y el diseño de su tarjeta (ver /c/<comercio>/theme.css). */

/* Hanken Grotesk y Newsreader (SIL OFL 1.1, ver /fonts/OFL-*.txt), servidas desde el Worker. */
@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/hanken-grotesk-latin-wght-normal.woff2) format("woff2-variations"), url(/fonts/hanken-grotesk-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/fonts/newsreader-latin-wght-normal.woff2) format("woff2-variations"), url(/fonts/newsreader-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-display: swap;
  font-weight: 200 800;
  src: url(/fonts/newsreader-latin-wght-italic.woff2) format("woff2-variations"), url(/fonts/newsreader-latin-wght-italic.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Schibsted Grotesk (SIL OFL 1.1, ver /fonts/OFL-schibsted-grotesk.txt): una de las tipografías a elegir para la tarjeta. */
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url(/fonts/schibsted-grotesk-latin-wght-normal.woff2) format("woff2-variations"), url(/fonts/schibsted-grotesk-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  /* Paleta de la marca: papel, tinta, índigo, vainilla y urdimbre (el azul claro del hilo). */
  --papel: #FBFAF5;
  --tinta: #1F2A56;
  --indigo: #3C4E8C;
  --vainilla: #F1E3A6;
  --urdimbre: #D7DBE6;
  --bg: #FBFAF5;
  /* Cuadrillé fino sobre el papel. Un fondo propio del comercio lo apaga (--grid: transparent). */
  --grid: rgba(31, 42, 86, .07);
  --grid-size: 28px;
  --surface: #FFFFFF;
  --text: #1F2A56;
  --text-2: #566079;
  --line: #D7DBE6;
  --line-strong: #7C86A6;
  --muted-bg: #F3F1E8;
  --track: #E6E8EF;
  --dash: #8089A6;
  --prize: #E7CC6A;
  --prize-bg: #FAF1CB;
  --prize-ink: #8A6D1C;
  --danger: #B42318;
  --danger-bg: #FEF3F2;
  /* --accent y --on-accent los define /c/<comercio>/theme.css */
  --accent: #3C4E8C;
  --on-accent: #FFFFFF;
  --on-prize: #1F2A56;
  /* Líneas rectas: esquinas casi vivas. Lo puede cambiar el diseño de la marca. */
  --radius-card: 2px;
  --radius-panel: 2px;
  --radius-knot: 2px;
  --radius: 2px;
  /* Texto sobre el fondo de la página (afuera de las tarjetas). Lo puede cambiar el diseño de la marca. */
  --page-text: #1F2A56;
  --page-text-2: #566079;
  --card-border: 1px solid var(--line);
  --card-shadow: none;
  --font-display: "Newsreader", Georgia, "Times New Roman", Times, serif;
  font-family: var(--font, "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  font-size: 16px;
  line-height: 1.4;
  color: var(--page-text);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; }

/* Hilo: franja con los tres hilos de la marca (tinta, vainilla y azul claro), como un orillo tejido. */
.weave { height: 6px; background: repeating-linear-gradient(90deg, var(--tinta) 0 14px, var(--vainilla) 14px 20px, var(--urdimbre) 20px 34px); }
/* Puntada: línea de costura entre secciones. */
.stitch { border: 0; border-top: 1.5px dashed var(--line-strong); margin: 0; }

:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
  /* Anillo doble: se ve tanto sobre la tarjeta como sobre un fondo de página oscuro. */
  box-shadow: 0 0 0 2px var(--surface);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  background: var(--surface);
  padding: 12px 16px;
  border-radius: var(--radius);
  z-index: 10;
}
.skip-link:focus { top: 16px; }

/* --- Contenedor del cliente --- */

.page {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 16px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sheet {
  background: var(--surface);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  color: var(--text);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Portada de la tarjeta (imagen de la marca): el texto nunca va encima, así el contraste no depende de la foto. */
.cover { margin: -24px -20px 0; height: 120px; overflow: hidden; border-radius: var(--radius-card) var(--radius-card) 0 0; background: var(--muted-bg); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 400px) { .cover { margin: -28px -24px 0; } }

@media (min-width: 400px) {
  .sheet { padding: 28px 24px; }
}

.biz {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.biz-mark {
  width: 44px; height: 44px;
  flex: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.biz-mark img { width: 100%; height: 100%; object-fit: cover; }
.biz-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.biz-name { font-family: var(--font-display); font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
.biz-sub { font-size: 14px; color: var(--text-2); }

.hello { display: flex; flex-direction: column; gap: 4px; }
.hello h1 { font-size: 32px; line-height: 1.1; font-weight: 600; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.hello p { color: var(--text-2); }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.status {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--muted-bg);
}
.status.is-ready { background: var(--prize-bg); }

/* --- Sellos: nudos sobre un hilo --- */

.knots { display: flex; flex-direction: column; gap: 26px; }
.knot-row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  justify-items: center;
  align-items: center;
}
.knot-row::before {
  content: "";
  position: absolute;
  left: 12.5%;
  top: 50%;
  border-top: 2px dashed var(--dash);
}
.knot-row.n2::before { width: 25%; }
.knot-row.n3::before { width: 50%; }
.knot-row.n4::before { width: 75%; }

.knot {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-2);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .25s ease, border-color .25s ease;
}
.shape-square .knot { border-radius: var(--radius-knot); }
.knot.is-prize.is-done { color: var(--on-prize); }
/* Sello propio de la marca (imagen subida): se ve sobre el fondo de la tarjeta, con el borde del color principal. */
.knot.has-img { background: var(--surface); border: 2px solid var(--accent); color: var(--text); overflow: hidden; }
.knot .stamp-img { width: 72%; height: 72%; object-fit: contain; }
.knot.is-done { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.knot.is-prize { background: var(--prize-bg); border-color: var(--prize-ink); color: var(--text); }
.knot.is-prize.is-done { background: var(--prize); }
.knot svg { width: 20px; height: 20px; }

/* --- Puntos --- */

.points-big { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.points-big strong { font-family: var(--font-display); font-size: 56px; line-height: 1; font-weight: 600; letter-spacing: -0.02em; }
.points-big span { font-size: 17px; font-weight: 600; color: var(--text-2); }
.rule { font-size: 14px; color: var(--text-2); }

progress.bar {
  appearance: none;
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: var(--radius);
  background: var(--track);
  overflow: hidden;
}
progress.bar::-webkit-progress-bar { background: var(--track); border-radius: var(--radius); }
progress.bar::-webkit-progress-value { background: var(--accent); border-radius: var(--radius); transition: width .3s ease; }
progress.bar::-moz-progress-bar { background: var(--accent); border-radius: var(--radius); }

/* --- QR --- */

.qr { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.qr-code { width: 180px; height: 180px; padding: 6px; background: #FFFFFF; border: 1px solid var(--line); border-radius: var(--radius); }
.qr p { font-size: 14px; color: var(--text-2); }

/* --- Botones y formularios --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--radius);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-outline { border-color: var(--accent); }
.btn-block { width: 100%; }
.btn-link {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label, .field legend { font-size: 14px; font-weight: 600; color: var(--text-2); }
fieldset.field { border: 0; margin: 0; padding: 0; }
.help { font-size: 14px; color: var(--text-2); }

input[type="text"], input[type="tel"], input[type="password"], input[type="number"], select, textarea {
  height: 48px;
  width: 100%;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0 14px;
  font: inherit;
  font-size: 17px;
  color: var(--text);
  background: var(--surface);
}
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
.field-error { font-size: 14px; font-weight: 600; color: var(--danger); }
.row-2 { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }

.check {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 15px;
}
.check input { width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--accent); }
.check label { min-height: 28px; }

.alert {
  border-radius: var(--radius);
  padding: 12px 14px;
  font-weight: 600;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
}
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.notice { border-radius: var(--radius); padding: 12px 14px; font-weight: 600; background: var(--muted-bg); color: var(--text); }

details.disclosure { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); }
details.disclosure > summary {
  min-height: 48px;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
  list-style-position: inside;
}
details.disclosure > .body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.legal-text { font-size: 14px; color: var(--text-2); white-space: pre-wrap; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-size: 14px; }

/* --- Menú --- */

.menu-list { list-style: none; margin: 0; padding: 0; }
.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--track);
}
.menu-item:first-child { border-top: 0; }
.menu-name { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.menu-points { font-size: 13px; font-weight: 600; color: var(--text-2); }
.menu-price { font-size: 16px; font-weight: 700; flex: none; }
.tag { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: var(--radius); background: var(--prize-bg); color: var(--text); font-size: 12px; font-weight: 700; }

.foot { font-size: 13px; color: var(--page-text-2); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.back { align-self: flex-start; }

/* --- Mostrador --- */

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.topbar-title { font-size: 28px; line-height: 1.15; font-weight: 600; letter-spacing: -0.015em; }
.badge { font-size: 13px; font-weight: 600; background: var(--muted-bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px; overflow-wrap: anywhere; }

.flash { border-radius: var(--radius); padding: 12px 14px; font-weight: 600; }
.flash-ok { background: var(--muted-bg); border: 1px solid var(--line); }

.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}
.choice input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice-sub { font-weight: 500; color: var(--text-2); font-size: 14px; }

.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.result {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 56px;
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
}
.result-name { font-size: 17px; font-weight: 700; }
.result-sub { font-size: 14px; color: var(--text-2); }

.customer { border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.customer-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.customer-name { font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.customer-sub { font-size: 15px; font-weight: 600; color: var(--text-2); }
.customer-points { font-size: 17px; }
.customer-points strong { font-size: 24px; font-weight: 800; }

.actions { display: flex; flex-direction: column; gap: 14px; }
.btn-xl { min-height: 64px; padding-top: 10px; padding-bottom: 10px; font-size: 20px; }
.btn-prize { background: var(--prize); border-color: var(--prize); color: var(--on-prize); }
.btn:disabled { background: var(--track); border-color: var(--track); color: var(--text-2); cursor: default; }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: 14px; flex: none; }
.limit { display: flex; flex-direction: column; gap: 10px; }
.qty-row { display: grid; grid-template-columns: 1fr 88px; gap: 10px; align-items: center; font-size: 15px; }

.log { display: flex; flex-direction: column; gap: 6px; }
.log-title { font-size: 16px; font-weight: 700; }
.log-list { list-style: none; margin: 0; padding: 0; }
.log-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--track); font-size: 15px; }
.log-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.log-item.is-undone .dot { background: var(--dash); }
.log-item.is-undone .log-text > span:first-child { color: var(--text-2); text-decoration: line-through; }
.log-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.log-sub { font-size: 13px; color: var(--text-2); }

/* --- Panel del dueño --- */

.page:has(> .owner) { max-width: 960px; }
.owner { display: flex; flex-direction: column; gap: 14px; }
textarea { height: auto; min-height: 72px; padding: 10px 14px; line-height: 1.35; resize: vertical; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
}
.tab.is-current { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { border: 1px solid var(--line); border-top: 3px solid var(--tinta); border-radius: var(--radius); background: var(--surface); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 14px; color: var(--text-2); }
.stat-value { font-family: var(--font-display); font-size: 40px; line-height: 1; font-weight: 600; }

.block { display: flex; flex-direction: column; gap: 10px; }
.block-title { font-size: 21px; font-weight: 600; margin-top: 8px; }

.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--track); flex-wrap: wrap; }
.row-stack { flex-direction: column; align-items: stretch; }
.row-stack .row-text { flex: none; }
.row-actions:empty { display: none; }
.row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 180px; }
.row-name { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.row-sub { font-size: 14px; color: var(--text-2); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.fact { background: var(--muted-bg); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.fact span { font-size: 13px; color: var(--text-2); }
.fact strong { font-size: 16px; overflow-wrap: anywhere; }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #FFFFFF; }
.inline-form { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.menu-admin { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.menu-admin-item { border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 14px; display: flex; flex-direction: column; gap: 12px; }

.choices-row { flex-direction: row; flex-wrap: wrap; }
.choices-row .choice { flex: 1 1 140px; }
.choice-tall { align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }
.choice-tall input { margin-top: 2px; }
.choice-help { display: block; margin-top: 4px; font-size: 14px; font-weight: 500; color: var(--text-2); }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 48px; height: 48px; margin: 0; }
.swatch-color { display: block; width: 48px; height: 48px; border-radius: var(--radius); border: 3px solid transparent; box-shadow: inset 0 0 0 2px #FFFFFF; }
.swatch input:checked + .swatch-color { border-color: var(--text); }
.swatch input:focus-visible + .swatch-color { outline: 3px solid var(--text); outline-offset: 2px; }
.sw-3C4E8C { background: #3C4E8C; }
.sw-1F2A56 { background: #1F2A56; }
.sw-2447F5 { background: #2447F5; }
.sw-0F766E { background: #0F766E; }
.sw-B42318 { background: #B42318; }
.sw-6941C6 { background: #6941C6; }
.sw-B54708 { background: #B54708; }
.sw-101828 { background: #101828; }
input[type="color"] { width: 64px; height: 48px; padding: 2px; border: 1.5px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
input[type="file"] { font: inherit; font-size: 15px; min-height: 44px; }
.logo-preview { width: 96px; height: 96px; object-fit: contain; border: 1px solid var(--line); border-radius: var(--radius); background: #FFFFFF; }

/* --- Texto legal --- */

.legal-doc { display: flex; flex-direction: column; gap: 12px; font-size: 15px; line-height: 1.5; color: var(--text); }
.legal-doc h2 { font-size: 22px; font-weight: 600; margin-top: 10px; }
.legal-doc h3 { font-size: 18px; font-weight: 600; margin-top: 8px; }
.legal-doc h4 { font-size: 15px; font-weight: 700; }
.legal-doc ul, .legal-doc ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.legal-doc blockquote { margin: 0; padding: 10px 14px; border-left: 4px solid var(--accent); background: var(--muted-bg); border-radius: var(--radius); }
.legal-doc hr { border: 0; border-top: 1px solid var(--line); width: 100%; }
.legal-doc a { text-decoration: underline; }
.legal-table { overflow-x: auto; }
.legal-table table { border-collapse: collapse; width: 100%; font-size: 14px; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 8px 10px; border: 1px solid var(--line); }
.legal-table th { background: var(--muted-bg); }

/* --- Diseño por marca (panel del dueño) --- */

.font-trama { font-family: "Hanken Grotesk", system-ui, sans-serif; }
.font-schibsted { font-family: "Schibsted Grotesk", system-ui, sans-serif; }
.font-system { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.font-serif { font-family: Georgia, "Times New Roman", Times, serif; }

.icon-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-choice { position: relative; cursor: pointer; }
.icon-choice input { position: absolute; opacity: 0; width: 48px; height: 48px; margin: 0; }
.icon-choice > span {
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.icon-choice svg { width: 24px; height: 24px; }
.icon-choice img { width: 28px; height: 28px; object-fit: contain; }
.icon-choice input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.icon-choice input:focus-visible + span { outline: 3px solid var(--text); outline-offset: 2px; }
.color-field { display: flex; align-items: center; gap: 10px; }
.color-field input[type="text"] { max-width: 140px; }
.image-preview { max-width: 100%; max-height: 140px; object-fit: contain; border: 1px solid var(--line); border-radius: var(--radius); background: #FFFFFF; }

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

/* --- Cartel imprimible --- */
.poster-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.poster {
  display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center;
  background: #FFFFFF; color: #101828; border: 3px solid var(--accent); border-radius: 2px; padding: 32px 20px;
}
.poster-name { font-family: var(--font-display); font-size: 36px; line-height: 1.1; font-weight: 600; overflow-wrap: anywhere; }
.poster-lead { font-size: 20px; font-weight: 600; max-width: 28ch; }
.poster-qr { width: min(80vw, 380px); background: #FFFFFF; }
.poster-qr svg { display: block; width: 100%; height: auto; }
.poster-step { font-size: 18px; max-width: 30ch; }
.poster-url { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; color: #344054; }
@media print {
  .no-print, .skip-link { display: none !important; }
  body { background: #FFFFFF; }
  .page { padding: 0; max-width: none; }
  .poster { border-width: 6px; padding: 40mm 16mm; min-height: 250mm; justify-content: center; gap: 12mm; }
  .poster-name { font-size: 48pt; }
  .poster-lead { font-size: 24pt; }
  .poster-qr { width: 120mm; }
  .poster-step { font-size: 20pt; }
  .poster-url { font-size: 16pt; }
}

/* --- Reportes --- */
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 36px; align-items: center; gap: 10px; font-size: 15px; }
.bar-n { text-align: right; font-weight: 700; }
.bar { width: 100%; height: 14px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 7px; background: var(--track); overflow: hidden; }
.bar::-webkit-progress-bar { background: var(--track); border-radius: 7px; }
.bar::-webkit-progress-value { background: var(--accent); border-radius: 7px; }
.bar::-moz-progress-bar { background: var(--accent); border-radius: 7px; }

/* --- Niveles e invitaciones (tarjeta del cliente) --- */
.level-name { font-family: var(--font-display); font-size: 20px; font-weight: 600; }

fieldset.step { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; gap: 14px; }
fieldset.step legend { padding: 0 6px; font-weight: 700; }

/* --- Agenda y turnos --- */
.agenda-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.agenda-day { display: flex; flex-direction: column; align-items: center; text-align: center; font-size: 18px; }
.appts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.appt { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.appt-completed { background: var(--muted-bg); }
.appt-no_show, .appt-cancelled_by_client, .appt-cancelled_by_business { background: var(--muted-bg); color: var(--text-2); }
.appt-time { display: flex; flex-direction: column; min-width: 56px; font-size: 18px; font-weight: 800; }
.appt-end { font-size: 13px; font-weight: 500; color: var(--text-2); }
.appt-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.appt-status { font-size: 14px; font-weight: 700; }
.time-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.time-choice { display: block; cursor: pointer; }
.time-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.time-choice > span { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 48px; padding: 4px; border: 1.5px solid var(--line-strong); border-radius: var(--radius); font-weight: 700; text-align: center; }
.time-choice:has(input:checked) > span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--muted-bg); }
.time-choice input:focus-visible + span { outline: 3px solid var(--text); outline-offset: 2px; }
fieldset.hours-day { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
input[type="date"], input[type="time"] { min-height: 48px; font: inherit; padding: 0 12px; border: 1.5px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); width: 100%; }
/* Campo trampa contra programas que completan formularios: fuera de pantalla, no se ve ni recibe foco. */
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Las secciones extra del panel del dueño se acomodan en filas, no en una columna. */
details.disclosure > nav.tabs.body { flex-direction: row; flex-wrap: wrap; gap: 8px; }

/* El atributo hidden tiene que ganarle a cualquier display de una clase (botones que solo aparecen si el navegador soporta passkeys). */
[hidden] { display: none !important; }

/* Bloques con texto de ayuda y botones: aire entre uno y otro (revisado a 360 px). */
section[aria-label="Entrada del dueño con passkey"], section[aria-label="Tu opinión"] { display: flex; flex-direction: column; gap: 12px; }

/* Direcciones largas (enlaces de un solo uso): se parten en vez de ensanchar la página en el celular. */
.url { overflow-wrap: anywhere; word-break: break-all; }

/* --- Página de venta --- */
.page-wide { max-width: 720px; }
.landing { display: flex; flex-direction: column; gap: 16px; }
.landing-top { padding: 4px 4px 0; }
.landing-brand { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.hero h1 { font-size: 44px; line-height: 1.02; font-weight: 600; letter-spacing: -0.025em; }
.hero-lead { font-size: 18px; line-height: 1.45; color: var(--text-2); }
.hero-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.landing .sheet { display: flex; flex-direction: column; gap: 14px; }
.landing h2 { font-size: 26px; line-height: 1.15; font-weight: 600; }
.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { background: var(--muted-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; font-weight: 600; font-size: 15px; }
.steps, .features { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; }
.steps { counter-reset: paso; }
.steps li { counter-increment: paso; display: grid; grid-template-columns: 36px 1fr; column-gap: 12px; }
.steps li::before { content: counter(paso); grid-row: span 2; width: 36px; height: 36px; border-radius: var(--radius); background: var(--accent); color: var(--on-accent); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.steps li span, .features li span { color: var(--text-2); line-height: 1.45; }
.steps li strong, .features li strong { font-size: 17px; }
.features li { display: flex; flex-direction: column; gap: 2px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.landing-foot { text-align: center; color: var(--text-2); font-size: 14px; padding: 4px 0 8px; }
@media (min-width: 640px) {
  .hero-actions { flex-direction: row; }
  .hero-actions .btn { width: auto; }
  .features { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
}

/* --- Panel del dueño: barra lateral (en el celular, un cajón que se abre con «Menú») --- */

.page:has(> .shell) { max-width: none; padding: 0; gap: 0; }
.shell { position: relative; min-height: 100vh; }

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 6px 12px;
  background: var(--tinta);
  color: #EEF0F6;
  border-bottom: 1px solid rgba(238, 240, 246, .2);
}
.nav-open {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1.5px solid rgba(238, 240, 246, .6);
  border-radius: var(--radius);
  font-weight: 700;
  cursor: pointer;
}
.nav-open::before { content: ""; width: 18px; height: 12px; background: linear-gradient(#EEF0F6 0 2px, transparent 2px 5px, #EEF0F6 5px 7px, transparent 7px 10px, #EEF0F6 10px 12px); }
.appbar-name { font-family: var(--font-display); font-size: 19px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nav-toggle:focus-visible ~ .appbar .nav-open { outline: 3px solid var(--vainilla); outline-offset: 2px; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: min(86vw, 320px);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background-color: var(--tinta);
  background-image: linear-gradient(rgba(238, 240, 246, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(238, 240, 246, .06) 1px, transparent 1px);
  background-size: 28px 28px;
  color: #EEF0F6;
  transform: translateX(-102%);
  visibility: hidden;
  transition: transform .2s ease, visibility 0s linear .2s;
}
.nav-toggle:checked ~ .sidebar { transform: none; visibility: visible; transition-delay: 0s; }
.scrim { display: none; position: fixed; inset: 0; z-index: 30; background: rgba(15, 20, 45, .55); }
.nav-toggle:checked ~ .scrim { display: block; }

.sidebar :focus-visible, .appbar :focus-visible { outline: 3px solid var(--vainilla); outline-offset: 2px; box-shadow: none; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; }
.side-mark {
  width: 44px; height: 44px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid rgba(238, 240, 246, .75);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  overflow: hidden;
}
.side-mark img { width: 100%; height: 100%; object-fit: cover; }
.side-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.side-name { font-family: var(--font-display); font-size: 20px; line-height: 1.15; font-weight: 600; overflow-wrap: anywhere; }
.side-sub { font-size: 13px; color: #B9C1DE; }
.sidebar .weave { opacity: .9; }
.side-nav { flex: 1; display: flex; flex-direction: column; gap: 18px; padding: 18px 12px; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-title { padding: 0 10px 6px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #B9C1DE; }
.side-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  border-left: 3px solid transparent;
  color: #EEF0F6;
  font-weight: 500;
  text-decoration: none;
}
.side-link:hover { background: rgba(238, 240, 246, .08); }
.side-link.is-current { border-left-color: var(--vainilla); background: rgba(238, 240, 246, .13); font-weight: 700; }
.side-foot { display: flex; flex-direction: column; gap: 2px; padding: 12px 12px 20px; border-top: 1px solid rgba(238, 240, 246, .2); font-size: 14px; }
.side-foot .side-link { min-height: 40px; font-size: 14px; }
.side-who { padding: 6px 10px 8px; color: #B9C1DE; font-size: 13px; overflow-wrap: anywhere; }
.side-foot form { gap: 0; }
.side-foot .btn-link { color: #EEF0F6; padding: 0 10px; min-height: 40px; text-align: left; width: 100%; }

.owner-main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.owner-head { display: flex; flex-direction: column; gap: 6px; }
.owner-kicker { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--page-text-2); }
.owner-main > .sheet { padding: 20px 16px; gap: 20px; }
.owner-main .topbar-title { font-size: 34px; }

/* Resumen: paneles en cuadrícula */
.panels { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.tile { border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tile > .block-title { margin-top: 0; }
.tile .block { gap: 12px; }
.tile .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (min-width: 640px) {
  .owner-main > .sheet { padding: 28px 28px; }
}

@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 276px minmax(0, 1fr); align-items: start; }
  .appbar, .scrim, .nav-toggle:checked ~ .scrim { display: none; }
  .sidebar { position: sticky; inset: auto; top: 0; height: 100vh; width: auto; transform: none; visibility: visible; transition: none; z-index: auto; }
  .owner-main { padding: 36px 40px 56px; gap: 22px; }
  .owner-main .topbar-title { font-size: 40px; }
  .panels.two { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
}