/* ==========================================================================
   Calendario de citas
   ========================================================================== */
:root {
  --ct1: #2F5E8C; --ct1-bg: #E9F0F7; --ct1-line: #BCD0E4;
  --ct2: #7A5216; --ct2-bg: #F6EFE3; --ct2-line: #E0CBA6;
  --ct3: #3D6B4F; --ct3-bg: #EAF3ED; --ct3-line: #BBD6C4;
  --ct4: #5E4B8B; --ct4-bg: #F0EDF7; --ct4-line: #CFC6E6;
  --cal-off: rgba(20, 30, 50, .035);
  --cal-now: #C2410C;
}
:root[data-app-theme="dark"] {
  --ct1: #A9C6E6; --ct1-bg: #1C2A3A; --ct1-line: #34506F;
  --ct2: #E2C08C; --ct2-bg: #2E2518; --ct2-line: #5A4526;
  --ct3: #A6D3B6; --ct3-bg: #1B2B22; --ct3-line: #345640;
  --ct4: #C8BCEB; --ct4-bg: #262036; --ct4-line: #4A3F6A;
  --cal-off: rgba(255, 255, 255, .03);
  --cal-now: #FB923C;
}

/* Etiqueta de tipo */
.ctipo { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 999px; font-size: 13px; line-height: 20px; font-weight: 500; white-space: nowrap; border: 1px solid; }
.ctipo.ct1 { color: var(--ct1); background: var(--ct1-bg); border-color: var(--ct1-line); }
.ctipo.ct2 { color: var(--ct2); background: var(--ct2-bg); border-color: var(--ct2-line); }
.ctipo.ct3 { color: var(--ct3); background: var(--ct3-bg); border-color: var(--ct3-line); }
.ctipo.ct4 { color: var(--ct4); background: var(--ct4-bg); border-color: var(--ct4-line); }
.cleg-off { display: inline-block; width: 18px; height: 12px; margin-right: 6px; vertical-align: -1px; border: 1px solid var(--line); border-radius: 3px; background: var(--subtle) var(--cal-off); }

/* Barra de herramientas */
.cal-tb { align-items: center; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-title { margin-left: 6px; font-weight: 600; font-size: 15px; white-space: nowrap; }

/* Rejilla */
.cal { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); overflow-x: auto; box-shadow: var(--shadow-sm); }
.cal-in { min-width: calc(56px + var(--n) * 120px); }
.cal-head, .cal-body { display: grid; grid-template-columns: 56px repeat(var(--n), minmax(120px, 1fr)); }
.cal-head { position: sticky; top: 0; z-index: 3; background: var(--thead); border-bottom: 1px solid var(--line); }
.cdh { display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 8px 10px; border-left: 1px solid var(--line); min-width: 0; }
.cdh span { font-size: 13px; color: var(--text-2); text-transform: capitalize; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.cdh b { font-size: 20px; line-height: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cdh small { font-size: 13px; color: var(--text-3); min-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.cdh.hoy b { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff; }
:root[data-app-theme="dark"] .cdh.hoy b { background: #C9D6E8; color: #0F1722; }
.cdh.fest small { color: var(--danger); }
.choras { border-right: 1px solid var(--line); }
.chora { padding: 0 8px 0 0; text-align: right; font-size: 13px; line-height: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; transform: translateY(-6px); }
.chora:first-child { transform: none; padding-top: 3px; }
.ccol { position: relative; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.ccol.hoy { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.cslot { flex: none; height: 40px; width: 100%; border: 0; border-top: 1px dashed color-mix(in srgb, var(--line) 70%, transparent); background: transparent; padding: 0; cursor: pointer; border-radius: 0; }
.cslot.hr { border-top: 1px solid var(--line); }
.cslot:first-child { border-top: 0; }
.cslot.off { background: var(--subtle) var(--cal-off); cursor: default; }
.cslot:not([disabled]):not(.off):hover { background: var(--hover); }
.cslot:not([disabled]):hover::after { content: "+ Nueva cita"; font-size: 13px; color: var(--link); font-weight: 500; }
.cslot[disabled] { cursor: default; }
.cslot:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; position: relative; z-index: 1; }
.cmark { position: absolute; top: 6px; left: 6px; right: 6px; z-index: 1; padding: 4px 8px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); pointer-events: none; text-align: center; }
.cnow { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--cal-now); z-index: 2; pointer-events: none; }
.cnow::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--cal-now); }

/* Cita en la rejilla */
.cev { position: absolute; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; gap: 0; overflow: hidden; padding: 3px 7px; border: 1px solid; border-radius: 4px; text-align: left; font-size: 13px; line-height: 17px; cursor: pointer; }
.cev:hover { filter: brightness(.97); box-shadow: var(--shadow-sm); z-index: 4; }
.cev:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; z-index: 5; }
.cev.ct1 { color: var(--ct1); background: var(--ct1-bg); border-color: var(--ct1-line); border-left-color: var(--ct1); }
.cev.ct2 { color: var(--ct2); background: var(--ct2-bg); border-color: var(--ct2-line); border-left-color: var(--ct2); }
.cev.ct3 { color: var(--ct3); background: var(--ct3-bg); border-color: var(--ct3-line); border-left-color: var(--ct3); }
.cev.ct4 { color: var(--ct4); background: var(--ct4-bg); border-color: var(--ct4-line); border-left-color: var(--ct4); }
.cev.short { flex-direction: row; align-items: center; gap: 6px; padding-top: 1px; padding-bottom: 1px; }
.cev.short .cev-m { display: none; }
.cev.short .cev-t { flex: none; }
.cev .cev-t span { display: inline; }
.cev span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cev-t { font-weight: 600; font-variant-numeric: tabular-nums; }
.cev-n { color: var(--text); font-weight: 500; }
.cev-m { color: var(--text-2); }
.cev:not(.conf).e-programada { border-style: dashed; border-left-style: solid; }
.cev.e-realizada, .cev.e-no_presentado { border-left-style: double; }
.cev.e-no_presentado .cev-n { text-decoration: line-through; }

/* Ficha */
.cita-when { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--thead); }
.cita-when b { font-size: 16px; }
.cita-when span { color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- Página de reserva ---------- */
.rb-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 32px; align-items: start; }
.rb-layout .form-sec { margin: 0; }
.rb-prev { position: sticky; top: 16px; }
.rb-prev-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.rb-prev-h h2 { margin: 0; font-size: 16px; }
.rb-frame { margin: 0 auto; border: 1px solid var(--line-strong); background: var(--subtle); box-shadow: var(--shadow-float); overflow: hidden; }
.rb-frame.movil { max-width: 380px; border-radius: 28px; padding: 10px; }
.rb-frame.escritorio { max-width: 100%; border-radius: 12px; }
.rb-bar { display: flex; justify-content: center; padding: 6px 10px 10px; }
.rb-frame.escritorio .rb-bar { justify-content: flex-start; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.rb-url { font-size: 13px; color: var(--text-2); padding: 3px 12px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-page { background: var(--bg); padding: 20px 18px 16px; border-radius: 20px; min-height: 520px; display: flex; flex-direction: column; gap: 14px; }
.rb-frame.escritorio .rb-page { border-radius: 0; padding: 24px 32px; }
.rb-brand { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.rb-intro { margin: 0; color: var(--text-2); }
.rb-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; counter-reset: rb; }
.rb-steps li { counter-increment: rb; font-size: 13px; color: var(--text-3); padding-top: 8px; border-top: 3px solid var(--line); }
.rb-steps li::before { content: counter(rb) ". "; }
.rb-steps li.done { color: var(--text-2); border-top-color: var(--accent-line); }
.rb-steps li.on { color: var(--text); font-weight: 600; border-top-color: var(--accent); }
.rb-tipos { display: grid; gap: 8px; }
.rb-frame.escritorio .rb-tipos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rb-tipo { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); text-align: left; }
.rb-tipo:hover { border-color: var(--line-strong); background: var(--hover); }
.rb-back { align-self: flex-start; font-size: 14px; }
.rb-cal { border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.rb-mes { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.rb-mes b { font-size: 15px; }
.rb-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.rb-dow { font-size: 13px; color: var(--text-3); padding: 2px 0; }
.rb-day { height: 36px; border-radius: 8px; border: 1px solid transparent; background: var(--accent-soft); color: var(--link); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; display: grid; place-items: center; }
button.rb-day:hover { border-color: var(--accent-line); }
.rb-day.on { background: var(--accent); color: #fff; }
:root[data-app-theme="dark"] .rb-day.on { background: #C9D6E8; color: #0F1722; }
.rb-day.off { background: none; color: var(--text-3); font-weight: 400; }
.rb-slots p { margin: 0 0 8px; }
.rb-slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.rb-slot { height: 38px; border: 1px solid var(--accent-line); border-radius: 8px; background: var(--bg); color: var(--link); font-weight: 600; font-variant-numeric: tabular-nums; }
.rb-slot:hover { background: var(--accent-soft); }
.rb-slot.on { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-app-theme="dark"] .rb-slot.on { background: #C9D6E8; border-color: #C9D6E8; color: #0F1722; }
.rb-hint { margin: 0; }
.rb-next { width: 100%; justify-content: center; height: 42px; }
.rb-form { display: flex; flex-direction: column; gap: 4px; }
.rb-form label:not(.check) { font-size: 14px; font-weight: 500; margin-top: 8px; }
.rb-form input:not([type=checkbox]), .rb-form select { height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; width: 100%; }
.rb-form [aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.rb-tel { display: flex; }
.rb-tel span { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--line-strong); border-right: 0; border-radius: 8px 0 0 8px; background: var(--subtle); color: var(--text-2); }
.rb-tel input { border-radius: 0 8px 8px 0 !important; }
.rb-check { align-items: flex-start; margin-top: 10px; font-size: 14px; line-height: 20px; color: var(--text-2); }
.rb-check input { margin-top: 3px; }
.rb-error { margin: 8px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 14px; }
.rb-form .rb-next { margin-top: 14px; }
.rb-ok { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.rb-ok h3 { margin: 0; font-size: 18px; }
.rb-okicon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; background: var(--accent-soft); color: var(--link); }
.rb-okicon.off { background: var(--danger-soft); color: var(--danger); }
.rb-sum { width: 100%; margin: 4px 0; display: grid; gap: 0; border: 1px solid var(--line); border-radius: 10px; text-align: left; }
.rb-sum div { display: grid; grid-template-columns: 96px 1fr; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); }
.rb-sum div:first-child { border-top: 0; }
.rb-sum dt { color: var(--text-2); font-size: 14px; }
.rb-sum dd { margin: 0; font-size: 14px; font-weight: 500; }
.rb-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.rb-legal { margin: auto 0 0; padding-top: 8px; font-size: 13px; color: var(--text-3); text-align: center; }
.rb-layout .checklist { display: grid; gap: 6px; }

@media (max-width: 1100px) { .rb-layout { grid-template-columns: minmax(0, 1fr); } .rb-prev { position: static; } }
@media (max-width: 700px) { .cal-title { width: 100%; margin: 4px 0 0; } .cal-nav { flex-wrap: wrap; } }
