/* Pauta · estilos de la maqueta aprobada (blueprints/pauta/referencia/maqueta.html) sin la barra .demo. */

/* ---------- Tokens ---------- */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #1b1e24;
  --muted: #646b78;
  --line: #e3e6eb;
  --soft: #eef0f3;
  --focus: #2f6fed;
  --danger: #c4372f;
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 18px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  /* Negocios: color de marca, barra (contraste sobre blanco) y tinte de fondo */
  --bl: #38bdf8; --bl-bar: #0ea5e9; --bl-tint: #e3f5fd;
  --sl: #3865f2; --sl-bar: #3865f2; --sl-tint: #e6ecfd;
  --ab: #f9c8c9; --ab-bar: #e79a9e; --ab-tint: #fdeeef;
  --gt: #facc15; --gt-bar: #e0b100; --gt-tint: #fef7d6;
  /* Texto sobre el color de marca (SL en blanco por contraste) */
  --bl-fg: #1b1e24; --sl-fg: #ffffff; --ab-fg: #1b1e24; --gt-fg: #1b1e24;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --surface: #1a1d23; --ink: #eceef2; --muted: #9aa1ad;
    --line: #2a2e36; --soft: #22262d; --focus: #6d9bff;
    --bl-tint: #12303d; --sl-tint: #1a2350; --ab-tint: #3a2729; --gt-tint: #3a3112;
  }
}

/* ---------- Base (mobile-native) ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 "Onest", system-ui, sans-serif;
  min-height: 100dvh;
}
button, a, [role="button"], .chip { touch-action: manipulation; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 14px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: var(--surface); font-weight: 500;
  transition: transform 120ms var(--ease-out), background-color 120ms ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { color: var(--danger); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--soft); }
  .btn-primary:hover { background: var(--ink); opacity: .9; }
  .btn-ghost:hover { background: var(--soft); }
}

/* ---------- Login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; }
.wordmark { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 26px; letter-spacing: -0.02em; }
.wordmark .strip { display: flex; gap: 3px; }
.wordmark .strip i { width: 6px; height: 26px; border-radius: 3px; display: block; }
.login h1 { font-size: 26px; margin: 28px 0 4px; letter-spacing: -0.02em; }
.login p.lead { color: var(--muted); margin: 0 0 24px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 500; font-size: 14px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: var(--surface);
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.field .hint { font-size: 13px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; margin: 4px 0 20px; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }
.login .btn-primary { width: 100%; min-height: 48px; font-size: 16px; }
.login .error { color: var(--danger); font-size: 14px; margin: -4px 0 14px; }
.login .note { margin-top: 18px; font-size: 13px; color: var(--muted); }

/* ---------- App shell ---------- */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.top-row { display: flex; align-items: center; gap: 8px; padding: 10px 16px; }
.top-row .wordmark { font-size: 20px; }
.top-row .wordmark .strip i { height: 20px; width: 5px; }
.spacer { flex: 1; }
.period { font-weight: 600; font-size: 17px; margin: 0 4px; white-space: nowrap; }
.icon-btn { width: 40px; min-height: 40px; padding: 0; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--soft); }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--muted); min-height: 34px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 600; font-size: 14px; border: 0; background: var(--soft);
}
.nav-row { display: flex; align-items: center; gap: 8px; padding: 0 16px 10px; flex-wrap: wrap; }

/* Filtro de negocios: el elemento memorable, una cinta de colores que es filtro y leyenda */
.ribbon { display: flex; gap: 6px; padding: 0 16px 12px; overflow-x: auto; scrollbar-width: none; }
.ribbon::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 36px;
  padding: 0 12px 0 6px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 14px; font-weight: 500; color: var(--muted);
  transition: background-color 150ms ease, color 150ms ease, transform 120ms var(--ease-out);
}
.chip:active { transform: scale(0.97); }
.chip .tag { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--brand-fg, #1b1e24); }
.chip[aria-pressed="true"] { color: var(--ink); border-color: transparent; background: var(--chip-tint, var(--soft)); }
.chip[aria-pressed="false"] .tag { opacity: .45; }
.chip.all { padding: 0 14px; }
.scope { padding: 0 16px 12px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }

main { padding: 12px 8px calc(96px + env(safe-area-inset-bottom)); max-width: 1280px; margin: 0 auto; }
#calendar { background: var(--surface); border-radius: var(--radius-m); border: 1px solid var(--line); overflow: hidden; }

/* FullCalendar, ajustado a la paleta */
#calendar { --fc-classic-border: var(--line); --fc-classic-background: var(--surface); --fc-classic-foreground: var(--ink); --fc-classic-muted-foreground: var(--muted); --fc-classic-faint-foreground: var(--muted); --fc-classic-today: var(--soft); --fc-classic-highlight: color-mix(in oklab, var(--focus) 12%, transparent); --fc-classic-now: var(--danger); --fc-classic-event: transparent; --fc-classic-primary: var(--ink); --fc-classic-primary-foreground: var(--surface); }
.fc { font-size: 14px; }
.fc-daygrid-day-number, .fc-col-header-cell-cushion { color: var(--muted); text-decoration: none; }

/* Agenda semanal en el teléfono */
#calendar[data-view="listWeek"] .ev { font-size: 15px; padding: 8px 10px 8px 8px; gap: 10px; }
#calendar[data-view="listWeek"] .ev .tag { font-size: 11px; padding: 2px 6px; }
#calendar[data-view="listWeek"] .ev .st { width: 16px; height: 16px; }
#calendar[data-view="listWeek"] .ev .t { white-space: normal; }

/* Pieza en el calendario */
.ev {
  display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0;
  padding: 3px 6px 3px 4px; border-radius: 6px; background: var(--tint);
  border-left: 3px solid var(--bar); color: var(--ink); font-size: 12.5px; line-height: 1.25;
}
.ev .tag { flex: none; font-size: 9.5px; font-weight: 700; padding: 1px 4px; border-radius: 4px; background: var(--brand); color: var(--brand-fg, #1b1e24); }
.ev .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .st { flex: none; width: 14px; height: 14px; }
.ev.idea { background: transparent; border: 1px dashed var(--bar); border-left-width: 3px; border-left-style: solid; color: var(--muted); }
.ev.publicada .t { color: var(--muted); }
.fc-event-dragging .ev { box-shadow: 0 8px 24px rgb(0 0 0 / .18); transform: scale(1.03); }

.fab {
  position: fixed; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 6;
  height: 56px; padding: 0 20px 0 16px; border-radius: 28px; border: 0;
  background: var(--ink); color: var(--surface); font-weight: 600; font-size: 16px;
  display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 6px 20px rgb(0 0 0 / .2);
  transition: transform 140ms var(--ease-out);
}
.fab:active { transform: scale(0.96); }

/* ---------- Ficha (bottom sheet en móvil, panel lateral en escritorio) ---------- */
.scrim { position: fixed; inset: 0; background: rgb(10 12 16 / .38); z-index: 20; opacity: 0; pointer-events: none; transition: opacity 240ms ease; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: 21; left: 0; right: 0; bottom: 0; max-height: 92dvh;
  background: var(--surface); border-radius: var(--radius-l) var(--radius-l) 0 0;
  transform: translateY(100%); transition: transform 360ms var(--ease-drawer), visibility 0s 360ms;
  display: flex; flex-direction: column;
  visibility: hidden; /* cerrada: fuera del orden de Tab; se oculta al terminar de salir */
}
.sheet.open { transform: translateY(0); visibility: visible; transition: transform 360ms var(--ease-drawer); }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px 8px; }
.sheet-head h2 { font-size: 18px; margin: 0; flex: 1; letter-spacing: -0.01em; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 16px; }
.sheet-foot {
  display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.sheet-foot .btn-primary { flex: 1; min-height: 46px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.status-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.status-pick button {
  min-height: 44px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 500; display: grid; place-items: center; gap: 2px; padding: 6px 2px;
  transition: transform 120ms var(--ease-out);
}
.status-pick button:active { transform: scale(0.97); }
.status-pick .st { width: 16px; height: 16px; }
.status-pick button[aria-pressed="true"] { border-color: var(--ink); background: var(--soft); }
.meta { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.biz-lock { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-s); background: var(--soft); font-weight: 500; }
.count { text-align: right; }

@media (min-width: 900px) {
  .sheet {
    left: auto; top: 0; bottom: 0; width: 440px; max-height: none;
    border-radius: 0; border-left: 1px solid var(--line);
    transform: translateX(100%);
  }
  .sheet.open { transform: translateX(0); }
  .sheet-handle { display: none; }
  .fab { right: 24px; bottom: 24px; }
  main { padding: 16px 24px 40px; }
}

/* ---------- Usuarios ---------- */
.users { display: none; padding: 16px; max-width: 760px; margin: 0 auto; }
body.view-users .users { display: block; }
body.view-users main, body.view-users .ribbon, body.view-users .nav-row, body.view-users .fab, body.view-users .scope, body.view-users .seg { display: none; }
.users h2 { margin: 4px 0 4px; font-size: 22px; letter-spacing: -0.02em; }
.users > p { color: var(--muted); margin: 0 0 16px; }
.ulist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.urow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.urow:first-child { border-top: 0; }
.urow .who { flex: 1; min-width: 160px; }
.urow .who b { display: block; font-weight: 600; }
.urow .who span { color: var(--muted); font-size: 14px; }
.pill { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--soft); font-weight: 500; }
.pill i { width: 10px; height: 10px; border-radius: 50%; }
.newuser { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px; }
.newuser h3 { margin: 0 0 12px; font-size: 17px; }

/* ---------- Avisos ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 30;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: 10px; font-size: 14px;
  display: flex; gap: 14px; align-items: center; max-width: calc(100vw - 32px);
  transition: transform 220ms var(--ease-out), opacity 220ms ease;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast button { border: 0; background: transparent; color: inherit; font-weight: 600; text-decoration: underline; padding: 4px; }

/* Menú de cuenta */
.menu { position: absolute; right: 16px; top: 56px; z-index: 9; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-m); box-shadow: 0 10px 30px rgb(0 0 0 / .12); min-width: 220px; padding: 6px;
  transform-origin: top right; transform: scale(0.96); opacity: 0; pointer-events: none;
  transition: transform 160ms var(--ease-out), opacity 160ms ease; }
.menu.open { transform: scale(1); opacity: 1; pointer-events: auto; }
.menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .who span { display: block; color: var(--muted); font-size: 13px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px; border-radius: 8px; }
@media (hover: hover) and (pointer: fine) { .menu button:hover { background: var(--soft); } }

@media (max-width: 560px) {
  .hide-s { display: none !important; }
  /* Mes en el teléfono: solo la etiqueta del negocio; el estado se lee por el relleno */
  #calendar[data-view="dayGridMonth"] .ev { justify-content: center; padding: 2px; border-left-width: 0; gap: 0; }
  #calendar[data-view="dayGridMonth"] .ev .t,
  #calendar[data-view="dayGridMonth"] .ev .st { display: none; }
  #calendar[data-view="dayGridMonth"] .ev.idea { border-width: 1px; }
  .period { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet, .toast, .menu, .scrim { transition-property: opacity; }
  .sheet { transform: none; opacity: 0; pointer-events: none; }
  .sheet.open { opacity: 1; pointer-events: auto; }
}

/* ---------- Añadidos del producto ---------- */
.tag { color: var(--brand-fg, #1b1e24); }
.skip {
  position: absolute; left: 16px; top: 8px; z-index: 40; padding: 10px 14px; border-radius: var(--radius-s);
  background: var(--ink); color: var(--surface); font-weight: 600; transform: translateY(-200%);
}
.skip:focus { transform: none; }
.field-error { color: var(--danger); font-size: 14px; margin: 0 0 14px; }
.urow.inactivo { opacity: .6; }

/* Diálogo Cambiar contraseña */
#claveDialog {
  width: min(400px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface); color: var(--ink); box-shadow: 0 10px 30px rgb(0 0 0 / .12);
}
#claveDialog::backdrop { background: rgb(10 12 16 / .38); }
#claveDialog h2 { font-size: 18px; margin: 0 0 12px; letter-spacing: -0.01em; }
#claveDialog .acciones { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
