/* Agenda IA — estilos base.
   Los colores de marca (--base, --accent y sus textos) vienen de /brand.css,
   generado desde Configuración. Aquí solo hay valores por defecto. */

@font-face {
  font-family: "DM Sans";
  src: url("/static/fonts/dm-sans-400.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Barlow;
  src: url("/static/fonts/barlow-condensed-800.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}

:root {
  --base: #050505;
  --on-base: #ffffff;
  --accent: #ff0083;
  --on-accent: #ffffff;
  --whatsapp: #0a8a3a;
  --whatsapp-dark: #076e2e;
  --surface: #ffffff;
  --page: #f3f3f5;
  --text: #17191c;
  --muted: #5d6068;
  --line: #e0e0e4;
  --danger: #c4002f;
  --ok: #0a7a35;
  --radius: 14px;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: Barlow, "Arial Narrow", var(--font);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 8px; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* ---------- Marca ---------- */
.brand-logo { display: block; max-height: 40px; max-width: 180px; object-fit: contain; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 1.5rem; letter-spacing: 0.01em; text-transform: uppercase; }

/* ---------- Tarjetas y formularios ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card.empty { text-align: center; padding: 32px 20px; }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: 0.95rem; }
.hint { color: var(--muted); font-size: 0.85rem; }
.field-error { color: var(--danger); font-size: 0.875rem; margin: 0; }

input, select, textarea {
  font: inherit;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  color: var(--text);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
input[type="color"] { padding: 4px; height: 48px; cursor: pointer; }
input[type="file"] { padding: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 12px 22px;
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
}
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-dark { background: var(--base); color: var(--on-base); }
.btn-ghost { background: transparent; color: var(--text); border: 1.5px solid var(--line); }
/* Verde reservado para acciones de WhatsApp. */
.btn-whatsapp { background: var(--whatsapp); color: #fff; }
.btn-whatsapp:hover { background: var(--whatsapp-dark); }
.btn-block { width: 100%; }

.link-button {
  font: inherit;
  background: none;
  border: 0;
  padding: 8px 0;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.link-button.danger { color: var(--danger); }

.notice { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.notice-ok { background: #e6f6ec; color: var(--ok); }
.notice-error { background: #fde8ee; color: var(--danger); }

.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- Público ---------- */
body.public { background: var(--base); color: var(--text); min-height: 100vh; }
.public-header { padding: 20px 16px; display: flex; justify-content: center; color: var(--on-base); }
.public-main { width: min(560px, 100% - 32px); margin: 0 auto; padding-bottom: 40px; }


/* ---------- Panel ---------- */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--base);
  color: var(--on-base);
}
.admin-brand { text-decoration: none; }
.admin-user { display: flex; align-items: center; gap: 14px; font-size: 0.9rem; min-width: 0; }
.admin-email { opacity: 0.75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 559px) { .admin-email { display: none; } }
.admin-header .brand-logo { max-height: 32px; }
.admin-nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  color: var(--muted);
  font-weight: 600;
}
.admin-nav a[aria-current="page"] { background: var(--base); color: var(--on-base); }
/* En celular las secciones caben sin desplazamiento: ícono sobre texto. */
@media (max-width: 559px) {
  .admin-nav { display: grid; grid-template-columns: repeat(3, 1fr); padding: 6px; }
  .admin-nav a { flex-direction: column; gap: 2px; padding: 8px 2px; border-radius: 10px; font-size: 0.72rem; }
}
.admin-main { width: min(960px, 100% - 32px); margin: 20px auto 48px; }
.page-title { font-size: 1.4rem; }
.logo-preview { display: block; max-height: 64px; max-width: 220px; margin-bottom: 12px; padding: 10px; border-radius: 10px; background: var(--base); }

/* ---------- Formulario público ---------- */
.intro { color: var(--on-base); text-align: center; margin: 4px 0 20px; }
.intro h1 { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: clamp(1.8rem, 7vw, 2.4rem); letter-spacing: 0.01em; margin-bottom: 6px; }
.intro p { opacity: 0.8; }
abbr[title="obligatorio"] { color: var(--accent); text-decoration: none; }
.required-note { color: var(--on-base); opacity: 0.7; text-align: center; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.js-only { display: none !important; }
.js .js-only { display: inline-flex !important; }
.js .step { display: none; }
.js .step.active { display: block; }
.step h2 { font-size: 1.2rem; }
.step-actions { display: flex; gap: 12px; margin-top: 20px; }
.step-actions .btn-primary { flex: 1; }

.progress { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 16px; padding: 0; color: var(--on-base); }
.progress li { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 0.8rem; opacity: 0.55; position: relative; text-align: center; }
.progress li.current, .progress li.done { opacity: 1; }
.progress-dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; border: 2px solid currentColor; }
.progress li.current .progress-dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.progress li.done .progress-dot { background: var(--on-base); color: var(--base); border-color: var(--on-base); }
.progress-label { line-height: 1.2; }
html:not(.js) .progress { display: none; }

.choices { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
.choices legend { font-weight: 600; font-size: 0.95rem; margin-bottom: 8px; padding: 0; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; line-height: 1.3; }
.choice input { width: 20px; height: 20px; min-height: 0; margin: 0; flex-shrink: 0; accent-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, #fff); font-weight: 600; }
.choice:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.choices[aria-invalid="true"] .choice { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }

.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; line-height: 1.4; }
.check input { width: 22px; height: 22px; min-height: 0; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--accent); }
.check a { color: var(--accent); font-weight: 600; }
.cf-turnstile { min-height: 65px; }

/* ---------- Confirmación ---------- */
.confirmation { text-align: center; }
.confirmation-icon { width: 56px; height: 56px; margin: 4px auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; font-weight: 700; background: var(--accent); color: var(--on-accent); }
.summary { text-align: left; margin: 20px 0; border: 1px solid var(--line); border-radius: 12px; }
.summary > div { padding: 12px 14px; border-top: 1px solid var(--line); }
.summary > div:first-child { border-top: 0; }
.summary dt { font-size: 0.8rem; color: var(--muted); }
.summary dd { margin: 2px 0 0; font-weight: 600; }
.summary .code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.25rem; letter-spacing: 0.04em; }
.redirect-status { margin: 8px 0 12px; min-height: 1.5em; }
.prose p { margin-bottom: 12px; white-space: pre-line; }

/* ---------- Bandeja de solicitudes ---------- */
.search { display: flex; gap: 8px; margin-bottom: 12px; }
.search input { flex: 1; min-width: 0; }
.search .btn { min-height: 48px; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: thin; }
.filters a { flex-shrink: 0; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.filters a span { opacity: 0.7; margin-left: 2px; }
.filters a[aria-current="true"] { background: var(--base); color: var(--on-base); border-color: var(--base); }

.request-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.request-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
}
.request-row:hover { border-color: var(--accent); }
.rr-main { display: grid; }
.rr-main span, .rr-need, .rr-meta { color: var(--muted); font-size: 0.875rem; }
.rr-need { grid-column: 1 / -1; }
.rr-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.8rem; }
.request-row .badge { grid-row: 1; grid-column: 2; align-self: start; }
@media (min-width: 760px) {
  .request-row { grid-template-columns: 1.4fr 1.3fr 1.3fr auto; align-items: center; }
  .rr-need, .rr-meta { grid-column: auto; }
  .rr-meta { display: grid; gap: 0; }
  .request-row .badge { grid-row: auto; grid-column: auto; align-self: center; }
}
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 0.02em; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; white-space: nowrap; background: #eceef1; color: #3c4049; }
.badge-pendiente { background: #fff3d6; color: #8a5a00; }
.badge-aprobada, .badge-invitacion_preparada { background: color-mix(in srgb, var(--accent) 12%, #fff); color: color-mix(in srgb, var(--accent) 80%, #000); }
.badge-reunion_agendada { background: #e3ecff; color: #1d4ed8; }
.badge-reunion_realizada { background: #e6f6ec; color: var(--ok); }
.badge-no_asistio, .badge-descartada { background: #eceef1; color: #5d6068; }

/* ---------- Detalle ---------- */
.back { margin-bottom: 12px; }
.back a { color: var(--muted); text-decoration: none; font-weight: 600; }
.detail-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.detail-head .mono { font-size: 1.1rem; font-weight: 700; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions form { display: contents; }
@media (max-width: 559px) { .actions .btn { flex: 1 1 100%; } }
.invitation { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.invitation .stack, .invitation form { margin-top: 12px; }
.copy-field { display: flex; gap: 8px; margin: 12px 0; }
.copy-field input { flex: 1; min-width: 0; font-size: 0.85rem; background: var(--page); }
.copy-field .btn { min-height: 48px; flex-shrink: 0; }
.subhead { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 18px 0 6px; }
.answers { margin: 0; display: grid; gap: 0; }
.answers > div { padding: 10px 0; border-top: 1px solid var(--line); display: grid; gap: 2px; }
@media (min-width: 640px) { .answers > div { grid-template-columns: 220px 1fr; gap: 16px; } }
.answers dt { color: var(--muted); font-size: 0.875rem; }
.answers dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.notes { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.notes li { padding: 10px 12px; border-radius: 10px; background: var(--page); }
.notes li p:first-child { white-space: pre-line; margin-bottom: 4px; }

/* ---------- Agenda del prospecto ---------- */
.js-only-block { display: none; }
.js .js-only-block { display: block; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.facts { list-style: none; padding: 0; margin: 16px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.facts li { background: var(--page); border-radius: 10px; padding: 10px; display: grid; gap: 2px; min-width: 0; }
.facts span { font-size: 0.72rem; color: var(--muted); }
.facts strong { font-size: 0.85rem; overflow-wrap: anywhere; }
.instructions { background: var(--page); border-radius: 10px; padding: 12px 14px; white-space: pre-line; font-size: 0.95rem; }
#booking-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin-top: 8px; }
.day-picker, .times { border: 0; padding: 0; margin: 0; min-width: 0; }
.day-picker legend, .time-picker .legend { font-weight: 700; margin-bottom: 10px; padding: 0; }
.day-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
.day-chip { flex: 0 0 64px; scroll-snap-align: start; display: grid; justify-items: center; gap: 0; padding: 10px 4px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; text-transform: capitalize; }
.day-chip span { font-size: 0.75rem; color: var(--muted); }
.day-chip strong { font-size: 1.3rem; line-height: 1.2; }
.day-chip input, .time-chip input { position: absolute; opacity: 0; pointer-events: none; }
.day-chip:has(input:checked) { background: var(--base); border-color: var(--base); color: var(--on-base); }
.day-chip:has(input:checked) span { color: inherit; opacity: 0.8; }
.day-chip:has(input:focus-visible), .time-chip:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.times legend { font-weight: 600; font-size: 0.9rem; margin-bottom: 8px; }
.times + .times { margin-top: 16px; }
.js .times + .times { margin-top: 0; }
.time-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.time-chip { position: relative; display: grid; place-items: center; min-height: 48px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 600; background: #fff; }
.time-chip:has(input:checked) { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.booking-summary { border: 1.5px solid var(--accent); border-radius: 12px; padding: 12px 14px; }
.summary-when { font-weight: 700; font-size: 1.05rem; margin: 2px 0; }

/* ---------- Calendario ---------- */
.day-group { margin-bottom: 18px; }
.day-title { font-size: 0.95rem; color: var(--muted); margin: 0 0 8px; }
.meeting-row { display: grid; grid-template-columns: 76px 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; }
.meeting-row:hover { border-color: var(--accent); }
.mr-time { font-weight: 700; font-size: 0.95rem; }
.meeting-when { font-weight: 700; font-size: 1.15rem; margin: 0; }
.badge-m-agendada { background: #e3ecff; color: #1d4ed8; }
.badge-m-realizada { background: #e6f6ec; color: var(--ok); }
.badge-m-no_asistio, .badge-m-cancelada { background: #eceef1; color: #5d6068; }
.badge-m-pendiente { background: #fff3d6; color: #8a5a00; }
.danger-text { color: var(--danger); }
.weekday-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.blocked-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.blocked-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 12px; background: var(--page); border-radius: 10px; }

.block-form { display: grid; gap: 12px; align-items: end; }
@media (min-width: 640px) { .block-form { grid-template-columns: 180px 1fr auto; } }
select { appearance: auto; }
/* Fechas largas: solo la primera letra en mayúscula ("Miércoles, 28 de octubre"). */
.times legend::first-letter, .summary-when::first-letter, .summary dd::first-letter, .day-title::first-letter, .meeting-when::first-letter { text-transform: uppercase; }
.prose h2 { font-size: 1.05rem; margin: 22px 0 8px; }
.prose ul { margin: 0 0 12px; padding-left: 20px; }
.prose li { margin-bottom: 4px; }
.prose .updated { color: var(--muted); font-size: 0.875rem; }
