/*
 * Placard — hoja de estilos del panel.
 * Identidad propia y neutra (docs/identidad-placard.md): papel, tinta y la
 * cinta amarilla del logo; Archivo angosta para lo que se pega, normal para leer.
 * Lo único que cambia por cuenta es el acento (--accent*), que llega en un
 * <style> de base.html desde el perfil de marca.
 */

:root {
  /* Papel y tinta: la base neutra. El único color propio de Placard es la cinta
     amarilla del logo; los botones y lo seleccionado usan el acento de cada negocio. */
  --bg-000: #F4F4F1;        /* papel: fondo de la página */
  --bg-100: #FFFFFF;        /* hoja: superficies, campos, barras */
  --bg-200: #E9E9E4;        /* pliego: miniaturas y huecos de imagen */
  --line: #DCDCD5;          /* divisiones */
  --line-strong: #8C8D86;   /* bordes de controles (3:1 sobre la hoja) */
  --ink: #15171C;           /* tinta */
  --ink-muted: #575A61;     /* tinta suave (6,3:1 sobre el papel) */
  --placeholder: #6E7077;
  --cinta: #FFCB2E;         /* cinta del logo: solo en la marca de Placard */
  --accent: #15171C;
  --accent-text: #15171C;
  --on-accent: #FFFFFF;
  --accent-tint: rgba(21, 23, 28, 0.07);
  --ok: #1F8A55;
  --ok-text: #17663F;
  --warn: #C98A12;
  --warn-text: #7A4A00;
  --warn-tint: #FFF6DC;
  --danger: #B3261E;
  --danger-tint: #FCEDEB;

  /* Una sola familia, Archivo (OFL), en dos anchos: angosta y pesada para lo
     que se pega en la pared (marca, títulos, la cifra), normal para leer. */
  --ui: Archivo, system-ui, -apple-system, "Segoe UI", sans-serif;
  --num: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display-wdth: 72;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --radius-sm: 6px; --radius-md: 10px; --radius-pill: 999px;
  --control-money: 52px; --control: 44px; --control-sm: 28px; --row-min: 44px;
  --tabbar: 62px;
  --maxw: 720px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg-000);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Iconos ──────────────────────────────────────────────────────────────── */
.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none;
       stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 16px; height: 16px; }

/* ── Barra superior ──────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(244, 244, 241, 0.94);
  -webkit-backdrop-filter: saturate(1.2) blur(8px); backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1040px; margin: 0 auto;
  display: flex; align-items: center; gap: var(--space-4);
  height: 56px; padding: 0 var(--space-4);
}
/* Marca de Placard: la hoja con su cinta y el nombre en Archivo angosta. */
.wordmark {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 800; font-stretch: 72%; font-variation-settings: "wdth" var(--display-wdth);
  font-size: 22px; line-height: 1; letter-spacing: -0.01em;
  text-decoration: none; white-space: nowrap; color: var(--ink);
}
.wordmark span { color: var(--ink-muted); font-weight: 500; }
.wordmark .logo { width: 24px; height: 24px; flex: none; }
.topnav { display: none; gap: var(--space-1); margin-left: var(--space-4); }
.topnav a {
  text-decoration: none; color: var(--ink-muted); font-size: 14px;
  padding: 6px 10px; border-radius: var(--radius-sm);
}
.topnav a:hover { color: var(--ink); }
.topnav a[aria-current="page"] { color: var(--ink); background: var(--bg-100); box-shadow: inset 0 0 0 1px var(--line); }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.topbar-mail { display: none; color: var(--ink-muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--control); height: var(--control); margin-right: -10px;
  background: none; border: 0; color: var(--ink-muted); cursor: pointer; border-radius: var(--radius-md);
}
.icon-btn:hover { color: var(--ink); }

/* ── Barra de pestañas (celular) ─────────────────────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg-100); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr);
}
.tabbar a {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--ink-muted); font-size: 12px; font-weight: 500;
}
.tabbar a[aria-current="page"] { color: var(--ink); font-weight: 650; }
.tabbar a[aria-current="page"] .ico { color: var(--accent-text); stroke-width: 2; }
.tabbar a[aria-current="page"]::before {
  content: ""; position: absolute; top: -1px; left: 50%; width: 28px; height: 3px;
  transform: translateX(-50%); border-radius: 0 0 3px 3px; background: var(--accent-text);
}

/* ── Página ──────────────────────────────────────────────────────────────── */
.page {
  max-width: var(--maxw); margin: 0 auto;
  padding: var(--space-5) var(--space-4) calc(var(--tabbar) + var(--space-6));
}
.page.con-pie { padding-bottom: calc(var(--tabbar) + var(--control-money) + 56px); }
.page-wide { max-width: 1040px; }

.head { margin-bottom: var(--space-5); }
.eyebrow {
  font-size: 13px; line-height: 1.3; font-weight: 500;
  color: var(--ink-muted); margin: 0 0 var(--space-1);
}
.title {
  font-size: 32px; line-height: 1.02; font-weight: 800; letter-spacing: -0.01em;
  font-stretch: 72%; font-variation-settings: "wdth" var(--display-wdth);
  margin: 0; overflow-wrap: anywhere; text-wrap: balance;
}
.lead { color: var(--ink-muted); font-size: 14.5px; margin: var(--space-2) 0 0; max-width: 60ch; }

.section { margin-top: var(--space-5); }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3);
  padding-bottom: var(--space-2); border-bottom: 1px solid var(--line);
}
.section-head h2, .section-head .eyebrow {
  margin: 0; color: var(--ink); font-size: 15px; font-weight: 700; letter-spacing: 0;
}
.section-head a { color: var(--accent-text); font-size: 13px; font-weight: 600; text-decoration: none; }

/* ── Cifra protagonista (una por pantalla) ───────────────────────────────── */
.figure-block { display: flex; align-items: baseline; gap: var(--space-3); margin: var(--space-2) 0 var(--space-4); }
.figure {
  font-size: 76px; line-height: 0.85; font-weight: 800; letter-spacing: -0.02em;
  font-stretch: 72%; font-variation-settings: "wdth" var(--display-wdth);
}
.figure-label { color: var(--ink); font-size: 15px; font-weight: 500; max-width: 16ch; line-height: 1.25; }

/* Rejilla de métricas con línea fina */
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric { padding: var(--space-3) var(--space-3) var(--space-3) 0; }
.metric + .metric { border-left: 1px solid var(--line); padding-left: var(--space-3); }
.metric .eyebrow { margin-bottom: 2px; font-size: 12.5px; }
.metric b { font-weight: 700; font-size: 20px; line-height: 1.1; }

/* ── Renglones ───────────────────────────────────────────────────────────── */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 64px; padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
a.row:hover .row-title { color: var(--accent-text); }
.row-thumb {
  width: 48px; height: 48px; border-radius: var(--radius-sm); object-fit: cover; flex: none;
  background: var(--bg-200); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--ink-muted);
}
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 15px; line-height: 1.35; font-weight: 600; margin: 0;
             overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13px; color: var(--ink-muted); margin: 2px 0 0;
           overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.row-time { font-size: 12px; color: var(--ink-muted); white-space: nowrap; }
.row .chev { color: var(--ink-muted); }

/* Opciones (pantalla Crear) */
.option { min-height: 72px; }
.option .row-thumb { background: var(--bg-100); color: var(--accent-text); border-color: var(--line); border-radius: var(--radius-md); }
.option .row-sub { white-space: normal; }

/* ── Pastillas de estado (siempre con palabra) ───────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; line-height: 1; white-space: nowrap;
  padding: 5px 9px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--bg-100); color: var(--ink-muted);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-plain::before { display: none; }
.pill-ok { color: var(--ok-text); border-color: rgba(31, 138, 85, 0.35); }
.pill-warn { color: var(--warn-text); border-color: rgba(201, 138, 18, 0.45); background: var(--warn-tint); }
.pill-danger { color: var(--danger); border-color: rgba(179, 38, 30, 0.35); background: var(--danger-tint); }
.pill-accent { color: var(--accent-text); border-color: var(--accent); background: var(--accent-tint); }
/* Solo «Por revisar» (pide acción) va tintada; lo que está en curso, contorno gris. */
.pill-outline { color: var(--ink-muted); border-color: var(--line-strong); background: transparent; }
.pill-busy::before { animation: latido 1.2s ease-in-out infinite; }
@keyframes latido { 50% { opacity: 0.25; } }

/* ── Botones ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--control); padding: 0 var(--space-4);
  border-radius: var(--radius-md); border: 1px solid var(--line-strong);
  background: var(--bg-100); color: var(--ink);
  font-size: 15px; font-weight: 650; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: background 150ms, border-color 150ms, transform 80ms;
}
.btn:hover { background: var(--bg-000); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: inset 0 0 0 1px rgba(21, 23, 28, 0.12); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-tall { min-height: var(--control-money); }
.btn-block { width: 100%; }
.btn-text { border-color: transparent; background: transparent; color: var(--accent-text); padding: 0 var(--space-2); }
.btn-text:hover { background: transparent; text-decoration: underline; }
.btn-danger { color: var(--danger); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.btn-stack { display: grid; gap: var(--space-2); }

/* Pie fijo con la acción principal */
.footer-action {
  position: fixed; left: 0; right: 0; z-index: 25;
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
  background: rgba(244, 244, 241, 0.96); border-top: 1px solid var(--line);
  padding: var(--space-3) var(--space-4);
}
.footer-action-in { max-width: var(--maxw); margin: 0 auto; display: flex; gap: var(--space-2); align-items: center; }
.footer-action-in .btn-primary { flex: 1; }
.footer-note { font-size: 12px; color: var(--ink-muted); }

/* ── Avisos ──────────────────────────────────────────────────────────────── */
.notice {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3); border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--bg-100);
  font-size: 14px; line-height: 1.45; margin: var(--space-4) 0;
}
.notice .ico { margin-top: 1px; }
.notice p { margin: 0; }
.notice p + p { margin-top: var(--space-1); }
.notice strong { font-weight: 600; }
.notice-warn { border-color: rgba(201, 138, 18, 0.55); background: var(--warn-tint); color: var(--warn-text); }
.notice-danger { border-color: rgba(179, 38, 30, 0.45); background: var(--danger-tint); color: var(--ink); }
.notice-danger .ico { color: var(--danger); }
.notice-ok { border-color: rgba(31, 138, 85, 0.4); background: #EEF8F2; color: var(--ok-text); }
.notice a { color: inherit; font-weight: 600; }
.notice pre { white-space: pre-wrap; font-family: var(--num); font-size: 11.5px; color: var(--ink-muted); margin: var(--space-2) 0 0; }

/* ── Vacíos ──────────────────────────────────────────────────────────────── */
.empty { padding: var(--space-6) 0; border-bottom: 1px solid var(--line); }
.empty h3 { margin: 0 0 var(--space-1); font-size: 17px; font-weight: 700; }
.empty p { margin: 0 0 var(--space-4); color: var(--ink-muted); font-size: 14px; max-width: 46ch; }

/* ── Formularios ─────────────────────────────────────────────────────────── */
.field { margin-bottom: var(--space-4); }
.label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.label small { color: var(--ink-muted); font-weight: 400; }
.hint { font-size: 13px; color: var(--ink-muted); margin: 6px 0 0; }
.input, .select, .textarea {
  width: 100%; min-height: var(--control);
  background: var(--bg-100); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 16px; /* 16px: el celular no hace zoom */
}
.textarea { resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-tint); }
.input::placeholder, .textarea::placeholder { color: var(--placeholder); }
.mono { font-family: var(--num); }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 var(--space-3); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }

.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); border: 0; padding: 0; margin: 0; }
.chips legend { padding: 0; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--ink-muted); background: var(--bg-100);
}
.chip input:checked + span { border-color: var(--accent-text); background: var(--accent); color: var(--on-accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent-text); outline-offset: 2px; }

.switch { display: flex; gap: var(--space-3); align-items: flex-start; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); margin: 1px 0 0; flex: none; }

.color-field { display: flex; align-items: center; gap: var(--space-2); }
.color-field input[type="color"] {
  width: var(--control); height: var(--control); padding: 3px; flex: none;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg-100);
}

.dropzone {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4); border: 1px dashed var(--line-strong); border-radius: var(--radius-md);
  cursor: pointer; color: var(--ink-muted); font-size: 14px; background: var(--bg-100);
}
.dropzone:hover { border-color: var(--accent-text); }
.dropzone input { position: absolute; opacity: 0; width: 1px; height: 1px; }

details.fold { border-bottom: 1px solid var(--line); }
details.fold > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  min-height: 52px; font-size: 15px; font-weight: 600;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary .ico { color: var(--ink-muted); transition: transform 150ms; }
details.fold[open] > summary .ico { transform: rotate(180deg); }
details.fold > .fold-body { padding-bottom: var(--space-4); }

fieldset.group { border: 0; padding: 0; margin: 0 0 var(--space-5); min-width: 0; }
fieldset.group > legend { padding: 0; margin-bottom: var(--space-3); width: 100%; }

/* ── Vista de la pieza ───────────────────────────────────────────────────── */
.media { position: relative; margin: 0 calc(-1 * var(--space-4)); background: var(--bg-200); }
.media-track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.media-track::-webkit-scrollbar { display: none; }
.media-track img { flex: 0 0 100%; width: 100%; height: auto; scroll-snap-align: center; object-fit: contain; max-height: 72vh; background: var(--bg-200); }
.media-count {
  position: absolute; top: var(--space-3); right: var(--space-3);
  font-family: var(--num); font-size: 11.5px; padding: 4px 8px; border-radius: var(--radius-pill);
  background: rgba(21, 23, 28, 0.82); color: #FFFFFF;
}
.media-dots { display: flex; justify-content: center; gap: 6px; padding: var(--space-3) 0 0; }
.media-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.media-dots span.on { background: var(--ink); }
.media-empty { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); color: var(--ink-muted); font-size: 13.5px; }

.steps { list-style: none; margin: var(--space-4) 0 0; padding: 0; }
.steps li { display: flex; gap: var(--space-3); align-items: center; min-height: var(--row-min); border-bottom: 1px solid var(--line); font-size: 14.5px; }
.steps .dot { width: 20px; height: 20px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--ink-muted); }
.steps .done { color: var(--ok-text); }
.steps .now { color: var(--accent-text); }
.steps li.pending-step { color: var(--ink-muted); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent-text); animation: gira 0.9s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

.trace pre { white-space: pre-wrap; font-family: var(--num); font-size: 11px; color: var(--ink-muted); background: var(--bg-200); border-radius: var(--radius-sm); padding: var(--space-3); max-height: 320px; overflow: auto; margin: var(--space-2) 0 0; }

.share-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); margin-top: var(--space-3); }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; z-index: 50; transform: translate(-50%, 16px);
  bottom: calc(var(--tabbar) + var(--control-money) + 40px + env(safe-area-inset-bottom));
  max-width: calc(100vw - 32px); width: max-content;
  background: var(--ink); color: #FFFFFF; box-shadow: 0 8px 24px rgba(21, 23, 28, 0.18);
  padding: 12px 16px; border-radius: var(--radius-md); font-size: 14px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity 200ms, transform 200ms;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── Ingreso: el cartel pegado en la pared ──────────────────────────────── */
.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: var(--space-6) var(--space-4); }
.auth-in { width: 100%; max-width: 400px; margin: 0 auto; }
.auth .wordmark { font-size: 26px; margin-bottom: var(--space-6); }
.auth .wordmark .logo { width: 30px; height: 30px; }
.cartel {
  position: relative; margin: 0 0 var(--space-5);
  background: var(--ink); color: #FFFFFF;
  padding: 34px 22px 22px; border-radius: 4px;
  transform: rotate(-1.2deg);
  box-shadow: 0 1px 0 rgba(21, 23, 28, 0.06), 0 14px 28px -18px rgba(21, 23, 28, 0.55);
}
.cartel::before {  /* la cinta */
  content: ""; position: absolute; top: -11px; left: 50%; width: 92px; height: 24px;
  transform: translateX(-50%) rotate(-3deg);
  background: var(--cinta); opacity: 0.95;
}
.cartel .title { font-size: 40px; color: #FFFFFF; }
.cartel p { margin: var(--space-3) 0 0; color: #C9CBD0; font-size: 14.5px; max-width: 34ch; }
.auth form { margin-top: var(--space-5); }
.auth-foot { margin-top: var(--space-5); font-size: 14px; color: var(--ink-muted); }
.auth-foot a { color: var(--accent-text); font-weight: 600; }

/* ── Escritorio ──────────────────────────────────────────────────────────── */
@media (min-width: 820px) {
  .tabbar { display: none; }
  .topnav { display: flex; }
  .topbar-mail { display: block; }
  .page { padding-bottom: var(--space-6); }
  .page.con-pie { padding-bottom: calc(var(--control-money) + 64px); }
  .footer-action { bottom: 0; }
  .toast { bottom: calc(var(--control-money) + 48px); }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .media { margin: 0; border-radius: var(--radius-md); overflow: hidden; }
  .detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-6); align-items: start; }
  .detail-grid .media { position: sticky; top: 76px; }
  .title { font-size: 40px; }
}

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

/* Probar fuentes (Marca → Noticias) */
.pruebas { list-style: none; margin: var(--space-2) 0 0; padding: 0; }
.prueba { padding: var(--space-2) 0; border-top: 1px solid var(--line); font-size: 14px; overflow-wrap: anywhere; }
.prueba small { display: block; color: var(--ink-muted); margin-top: 2px; }
.prueba-bien { color: var(--ok-text); }
.prueba-mal { color: var(--danger); }
