/* Sistema de diseño — "Autoridad sobria": azul marino + dorado, EB Garamond (títulos) / Lato (texto).
   Fuentes autoalojadas (sin CDN): funcionan sin internet y no filtran visitas a terceros. */
@font-face { font-family: "EB Garamond"; font-weight: 500; font-style: normal; font-display: swap; src: url(/fonts/eb-garamond-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "EB Garamond"; font-weight: 600; font-style: normal; font-display: swap; src: url(/fonts/eb-garamond-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "EB Garamond"; font-weight: 700; font-style: normal; font-display: swap; src: url(/fonts/eb-garamond-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: Lato; font-weight: 400; font-style: normal; font-display: swap; src: url(/fonts/lato-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Lato; font-weight: 700; font-style: normal; font-display: swap; src: url(/fonts/lato-latin-700-normal.woff2) format("woff2"); }

:root {
  /* Superficies y texto */
  --bg: #f8fafc; --surface: #fff; --surface-2: #f1f5f9; --ink: #0f172a; --muted: #475569;
  --line: #e2e8f0; --line-strong: #7b8798; /* --line-strong: bordes de controles (>= 3:1) */
  /* Marca */
  --accent: #1e3a8a; --accent-hover: #172e6e; --accent-soft: #e6ecfa; --on-accent: #fff;
  --gold: #b45309; --gold-soft: #fdf0dc;
  --pend: #6d28d9; --pend-soft: #efe9fd; /* reserva sin pagar: bloquea el horario pero aún no está confirmada */
  /* Estados */
  --ok: #0b6b49; --ok-soft: #e1f5ec; --warn: #8a4a06; --warn-soft: #fdf0dc; --bad: #b42318; --bad-soft: #fdebe9; --gray-soft: #e8edf3;
  /* Barra lateral */
  --side-bg: #0f1f4a; --side-ink: #e8eefc; --side-muted: #afbcdd; --side-hover: #19306d; --side-active: #1f3578;
  /* Escala */
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 2px 8px rgba(15, 23, 42, .05);
  --shadow-lg: 0 24px 64px rgba(15, 23, 42, .35);
  --radius: 10px; --radius-sm: 8px;
  --ring: #1e3a8a; --scrim: rgba(8, 15, 35, .62);
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --sans: Lato, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --t-fast: 150ms; --t-base: 220ms;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220; --surface: #111a2c; --surface-2: #16213a; --ink: #e8edf5; --muted: #a3b1c6;
    --line: #223049; --line-strong: #5c6b85;
    --accent: #9db8ff; --accent-hover: #bccfff; --accent-soft: #16254a; --on-accent: #0b1220;
    --gold: #e0a24a; --gold-soft: #2e2312;
    --pend: #c4b5fd; --pend-soft: #251c42;
    --ok: #5fd3a3; --ok-soft: #0f2a21; --warn: #f0b466; --warn-soft: #2e2312; --bad: #ff9c93; --bad-soft: #2f1a18; --gray-soft: #1d2740;
    --side-bg: #0a1328; --side-muted: #9fb0d4; --side-hover: #14213f; --side-active: #1a2b57;
    --shadow: none; --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6); --ring: #9db8ff; --scrim: rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220; --surface: #111a2c; --surface-2: #16213a; --ink: #e8edf5; --muted: #a3b1c6;
  --line: #223049; --line-strong: #5c6b85;
  --accent: #9db8ff; --accent-hover: #bccfff; --accent-soft: #16254a; --on-accent: #0b1220;
  --gold: #e0a24a; --gold-soft: #2e2312;
  --pend: #c4b5fd; --pend-soft: #251c42;
  --ok: #5fd3a3; --ok-soft: #0f2a21; --warn: #f0b466; --warn-soft: #2e2312; --bad: #ff9c93; --bad-soft: #2f1a18; --gray-soft: #1d2740;
  --side-bg: #0a1328; --side-muted: #9fb0d4; --side-hover: #14213f; --side-active: #1a2b57;
  --shadow: none; --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6); --ring: #9db8ff; --scrim: rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); color: var(--ink); }
h1 { font-size: 2rem; line-height: 1.15; margin: 0; font-weight: 600; letter-spacing: -.005em; }
h2 { font-size: 1.3rem; line-height: 1.25; margin: 0 0 .75rem; font-weight: 600; }
h3 { font-size: 1.1rem; margin: 0 0 .5rem; font-weight: 600; }
p { margin-block: 0 .75rem; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; } a:hover { text-decoration: underline; }
strong { font-weight: 700; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: .75rem; top: -4rem; z-index: 100; background: var(--accent); color: var(--on-accent); padding: .6rem 1rem; border-radius: var(--radius-sm); font-weight: 700; transition: top var(--t-fast); }
.skip:focus { top: .75rem; text-decoration: none; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.sidebar :focus-visible { outline-color: #fff; }
svg { flex: none; }
.btn svg, .foot svg, .back svg { width: 1.15em; height: 1.15em; vertical-align: -.2em; }
.empty svg { width: 40px; height: 40px; }

/* ───────── Estructura ───────── */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--side-bg); color: var(--side-ink); padding: 1.25rem .75rem 1rem; display: flex; flex-direction: column; gap: .25rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .7rem; padding: .1rem .55rem 1.25rem; margin-bottom: .5rem; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.brand .mark { width: 38px; height: 38px; border-radius: 9px; background: var(--gold); color: #fff; display: grid; place-items: center; flex: none; }
.brand .mark svg { width: 22px; height: 22px; }
.brand .name { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; line-height: 1.1; color: #fff; }
.brand small { display: block; font-family: var(--sans); font-weight: 400; color: var(--side-muted); font-size: .8rem; margin-top: .15rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: .7rem; padding: .62rem .8rem; min-height: 44px; border-radius: var(--radius-sm); color: var(--side-ink); font-weight: 700; font-size: .95rem; transition: background var(--t-fast), color var(--t-fast); }
.nav a:hover { background: var(--side-hover); text-decoration: none; }
.nav a.active { background: var(--side-active); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -.75rem; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold); }
.nav svg { width: 20px; height: 20px; flex: none; opacity: .92; }
.sidebar .foot { margin-top: auto; padding: .9rem .4rem 0; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .875rem; display: flex; flex-direction: column; gap: .15rem; }
.sidebar .foot a, .sidebar .foot .btn.link { color: var(--side-ink); justify-content: flex-start; display: inline-flex; align-items: center; gap: .5rem; min-height: 36px; padding: .2rem .4rem; border-radius: 6px; text-align: left; font-weight: 400; }
.sidebar .foot a:hover, .sidebar .foot .btn.link:hover { background: var(--side-hover); text-decoration: none; }
.main { padding: 2rem 2.5rem 4rem; max-width: 1280px; width: 100%; min-width: 0; outline: none; }
.topbar { display: none; }
.scrim { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.page-head::after { content: none; }
.page-head > div:first-child .muted { margin-top: .2rem; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: .3rem; font-size: .9rem; margin-bottom: .35rem; }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(290px, 86vw); transform: translateX(-102%); transition: transform var(--t-base) ease; visibility: hidden; }
  .sidebar.open { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }
  .scrim.show { display: block; position: fixed; inset: 0; z-index: 35; background: var(--scrim); }
  .topbar { display: flex; align-items: center; gap: .75rem; padding: .5rem 1rem; background: var(--side-bg); color: #fff; position: sticky; top: 0; z-index: 20; font-family: var(--serif); font-weight: 700; font-size: 1.15rem; }
  .topbar .btn { background: transparent; border-color: rgba(255, 255, 255, .35); color: #fff; }
  .topbar .btn:hover { background: var(--side-hover); }
  .main { padding: 1.25rem 1rem 3rem; }
  h1 { font-size: 1.65rem; }
}

/* ───────── Tarjetas, grillas y KPI ───────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.35rem; }
.card + .card { margin-top: 1rem; }
.grid > .card, .grid > .card + .card { margin-top: 0; }
.grid { display: grid; gap: 1rem; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.kpi { display: flex; flex-direction: column; gap: .1rem; border-top: 3px solid var(--accent); }
.kpi .v { font-family: var(--serif); font-size: 2.2rem; line-height: 1.1; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: lining-nums tabular-nums; }
.kpi .l { color: var(--muted); font-size: .9rem; }
.kpi.warn { border-top-color: var(--gold); } .kpi.bad { border-top-color: var(--bad); } .kpi.ok { border-top-color: var(--ok); }
.kpi.warn .v { color: var(--warn); } .kpi.bad .v { color: var(--bad); } .kpi.ok .v { color: var(--ok); }
.card > h2 { padding-bottom: .6rem; border-bottom: 1px solid var(--line); margin-bottom: .5rem; display: flex; align-items: center; gap: .5rem; }

/* ───────── Botones ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 40px; padding: .5rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; font-size: .95rem; line-height: 1.2; cursor: pointer; text-decoration: none; transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast); }
.btn:hover { background: var(--accent-soft); border-color: var(--accent); text-decoration: none; }
.btn:active { background: var(--accent-soft); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .15); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.sm { min-height: 32px; padding: .2rem .7rem; font-size: .85rem; }
.btn.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--accent); font-weight: 700; box-shadow: none; }
.btn.link:hover { background: none; text-decoration: underline; }
.btn.icon { padding: 0; width: 40px; }
.btn:disabled, .btn[aria-busy="true"] { opacity: .6; cursor: not-allowed; }
@media (pointer: coarse) { .btn { min-height: 44px; } .btn.sm { min-height: 44px; padding-inline: .9rem; } .btn.icon { width: 44px; } }

/* ───────── Tablas ───────── */
.table-wrap { overflow-x: auto; margin-inline: -.35rem; padding-inline: .35rem; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: .55rem .75rem; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--t-fast); }
tbody tr.click { cursor: pointer; } tbody tr.click:hover { background: var(--accent-soft); }
tbody tr.click:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; background: var(--accent-soft); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td strong { font-weight: 700; }

/* ───────── Insignias y alertas (siempre con texto: el color no es el único indicador) ───────── */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: .01em; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.gray { background: var(--gray-soft); color: var(--muted); }
.badge.pend { background: var(--pend-soft); color: var(--pend); }
.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .95rem; border-left: 4px solid currentColor; }
.alert.warn { background: var(--warn-soft); color: var(--warn); } .alert.bad { background: var(--bad-soft); color: var(--bad); } .alert.ok { background: var(--ok-soft); color: var(--ok); } .alert.info { background: var(--accent-soft); color: var(--accent); }

/* ───────── Formularios ───────── */
label { display: block; font-weight: 700; font-size: .875rem; margin-bottom: .3rem; }
input, select, textarea { width: 100%; min-height: 42px; padding: .5rem .75rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent); outline: none; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
textarea { min-height: 96px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 1.15rem; height: 1.15rem; min-height: 0; margin: 0 .5rem 0 0; vertical-align: -.2em; accent-color: var(--accent); }
label:has(> input[type=checkbox]) { font-weight: 400; display: flex; align-items: flex-start; gap: 0; }
.field { margin-bottom: .95rem; } .field .hint { color: var(--muted); font-size: .8125rem; margin-top: .25rem; }
.field .err { color: var(--bad); font-size: .8125rem; font-weight: 700; margin-top: .25rem; display: flex; gap: .3rem; align-items: flex-start; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.form-grid .span2 { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.form-error { color: var(--bad); background: var(--bad-soft); border-left: 4px solid var(--bad); padding: .7rem .9rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .92rem; }
.form-error ul { margin: .35rem 0 0; padding-left: 1.1rem; } .form-error a { color: inherit; text-decoration: underline; font-weight: 700; }
.form-error:focus { outline: 2px solid var(--bad); outline-offset: 2px; }
.toolbar { display: flex; gap: .6rem; margin-bottom: 1.1rem; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: min(190px, 100%); max-width: 100%; }
.toolbar input[type=search] { flex: 1 1 240px; max-width: 420px; }

/* ───────── Pestañas, listas, línea de tiempo ───────── */
.tabs { display: flex; gap: .15rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; scrollbar-width: thin; }
.tabs button { background: none; border: 0; padding: .7rem 1rem; min-height: 44px; font: inherit; font-weight: 700; font-size: .95rem; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color var(--t-fast), border-color var(--t-fast); }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--accent); border-color: var(--gold); }
.tabs button:focus-visible { outline-offset: -3px; }
.dl { display: grid; grid-template-columns: 9.5rem 1fr; gap: .45rem .9rem; margin: 0; }
.dl dt { color: var(--muted); font-size: .9rem; } .dl dd { margin: 0; word-break: break-word; }
@media (max-width: 480px) { .dl { grid-template-columns: 1fr; gap: 0; } .dl dd { margin-bottom: .5rem; } }
.list { list-style: none; margin: 0; padding: 0; } .list li { padding: .75rem 0; border-bottom: 1px solid var(--line); display: flex; gap: .75rem; justify-content: space-between; align-items: flex-start; } .list li:last-child { border-bottom: 0; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 1.1rem 1.1rem; }
.timeline li::before { content: ""; position: absolute; left: -1.5rem; top: .4rem; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--surface); }
.timeline li.sistema::before { background: var(--line-strong); }

/* ───────── Estados vacíos, carga ───────── */
.empty { color: var(--muted); padding: 2rem 1rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.empty svg { width: 40px; height: 40px; color: var(--line-strong); opacity: .8; }
.empty .btn { margin-top: .25rem; }
.skeleton { display: grid; gap: .8rem; }
.skeleton i { display: block; height: 1rem; border-radius: 6px; background: linear-gradient(90deg, var(--line) 25%, var(--surface-2) 50%, var(--line) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton i:nth-child(1) { width: 38%; height: 2rem; } .skeleton i:nth-child(2) { width: 72%; } .skeleton i:nth-child(3) { width: 58%; } .skeleton i:nth-child(4) { width: 80%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ───────── Edición de plantillas ───────── */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.editor { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; min-height: 420px; line-height: 1.6; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 6px; padding: .2rem .5rem; min-height: 28px; font: .8rem ui-monospace, monospace; cursor: pointer; color: var(--ink); transition: background var(--t-fast); }
.chip:hover { background: var(--accent-soft); border-color: var(--accent); }
.preview { white-space: pre-wrap; background: #fff; color: #111; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 2rem 2.5rem; font-family: var(--serif); font-size: 1.15rem; line-height: 1.7; max-height: 60vh; overflow: auto; box-shadow: var(--shadow); }
.preview .ptitle { text-align: center; font-weight: 700; margin-bottom: .5rem; }
.preview mark { background: #fdf0dc; color: #8a4a06; padding: 0 .2rem; border-radius: 3px; }

/* ───────── Modal y avisos ───────── */
.overlay { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 1rem 4vh; overflow-y: auto; z-index: 50; animation: fade var(--t-base) ease; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; width: 100%; max-width: 640px; box-shadow: var(--shadow-lg); animation: rise var(--t-base) ease; }
.modal.wide { max-width: 920px; }
.modal header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal header h2 { margin: 0; padding: 0; border: 0; }
.modal header .btn { min-height: 40px; width: 40px; padding: 0; border-radius: 50%; color: var(--muted); }
.modal header .btn:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.modal .body { padding: 1.25rem; } .modal footer { padding: .9rem 1.25rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: .5rem; }
.modal .actions-row { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .75rem; }
@keyframes fade { from { opacity: 0; } } @keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 60; max-width: calc(100vw - 2rem); }
.toast { display: flex; gap: .6rem; align-items: flex-start; background: var(--ink); color: var(--bg); padding: .75rem 1rem; border-radius: var(--radius-sm); box-shadow: 0 8px 28px rgba(0, 0, 0, .3); max-width: 380px; border-left: 4px solid var(--ok); animation: rise var(--t-base) ease; }
.toast.err { background: var(--bad); color: #fff; border-left-color: #fff; }
:root[data-theme="dark"] .toast.err, :root:not([data-theme="light"]) .toast.err { color: #1a0a08; }

/* ───────── Agenda ───────── */
.day h3::first-letter { text-transform: uppercase; }
.slot { display: flex; gap: .75rem; padding: .6rem .8rem; border-radius: var(--radius-sm); border-left: 4px solid var(--accent); background: var(--accent-soft); margin-bottom: .45rem; align-items: center; }
.slot.plazo { border-color: var(--gold); background: var(--warn-soft); } .slot.audiencia { border-color: var(--bad); background: var(--bad-soft); }
.slot.pend { border-left: 4px dashed var(--pend); background: var(--pend-soft); }
.leyenda { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin: 0 0 .75rem; }
.leyenda i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.slot .t { font-weight: 700; min-width: 3.4rem; font-variant-numeric: tabular-nums; } .slot .grow { flex: 1; }

/* ───────── Ingreso ───────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(var(--side-bg) 0 300px, var(--bg) 300px); }
.login { width: 100%; max-width: 410px; padding: 2rem 2rem 1.75rem; box-shadow: var(--shadow-lg); }
.login .mark { width: 48px; height: 48px; border-radius: 11px; background: var(--gold); color: #fff; display: grid; place-items: center; margin-bottom: 1rem; }
.login .mark svg { width: 28px; height: 28px; }
.login h1 { margin-bottom: .25rem; font-size: 1.9rem; }

/* ───────── Páginas públicas (reservas y pagos) ───────── */
.public { max-width: 680px; margin: 0 auto; padding: 0 1rem 3rem; }
.public-head { background: var(--side-bg); color: #fff; padding: .9rem 1rem; margin: 0 0 1.5rem; }
.public-head > div { max-width: 680px; margin: 0 auto; display: flex; align-items: center; gap: .7rem; }
.public-head .mark { width: 34px; height: 34px; border-radius: 8px; background: var(--gold); display: grid; place-items: center; }
.public-head .mark svg { width: 20px; height: 20px; }
.public-head .name { font-family: var(--serif); font-weight: 700; font-size: 1.25rem; }
.public .card { margin-top: 1rem; }
.public h1 { margin-bottom: .35rem; }
.days { display: flex; gap: .45rem; overflow-x: auto; padding: .15rem .15rem .6rem; }
.days button, .slots button { min-height: 44px; padding: .55rem .9rem; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius-sm); cursor: pointer; font: inherit; font-weight: 700; color: var(--ink); text-align: center; transition: background var(--t-fast), border-color var(--t-fast); }
.days button { flex: none; }
.days button:hover, .slots button:hover { background: var(--accent-soft); border-color: var(--accent); }
.days button.sel, .slots button.sel { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: .5rem; margin-top: .75rem; }
.amount { font-family: var(--serif); font-size: 2.6rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.1; margin: .25rem 0 .5rem; font-variant-numeric: lining-nums; }
.hp { position: absolute; left: -9999px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .sidebar, .topbar, .scrim, .skip, .page-head .actions, .toolbar, .tabs, .btn, .toasts { display: none !important; }
  .app { display: block; } .main { padding: 0; max-width: none; } .card { box-shadow: none; border: 0; } body { background: #fff; color: #000; }
}

/* ───────── Agenda estilo calendario (Outlook): grilla de horas, citas como bloques ───────── */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.cal-bar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.cal-bar .rango { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; margin-left: .35rem; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; margin-left: auto; }
.seg button { border: 0; background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; font-weight: 700; padding: .4rem .95rem; min-height: 36px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button:hover { background: var(--accent-soft); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.cal { --gw: 58px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.cal-x { overflow-x: auto; }
.cal-inner { min-width: calc(var(--gw) + var(--n) * 118px); }
.cal-head, .cal-allday, .cal-body { display: grid; grid-template-columns: var(--gw) repeat(var(--n), minmax(0, 1fr)); }
.cal-head { border-bottom: 1px solid var(--line); }
.cal-head .dh { text-align: center; padding: .4rem .25rem .3rem; border-left: 1px solid var(--line); }
.dh .dn { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.dh .dd { display: inline-grid; place-items: center; min-width: 2.2rem; height: 2.2rem; border-radius: 999px; font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }
.dh.hoy .dn { color: var(--accent); } .dh.hoy .dd { background: var(--accent); color: var(--on-accent); }
.cal-allday { border-bottom: 1px solid var(--line-strong); background: var(--surface-2); }
.cal-allday .lbl { padding: .45rem .4rem; color: var(--muted); font-size: .68rem; text-align: right; line-height: 1.1; }
.cal-allday .cell { border-left: 1px solid var(--line); padding: .25rem; display: flex; flex-direction: column; gap: .2rem; min-height: 2rem; min-width: 0; }
.cal-chip { display: block; padding: .12rem .4rem; border-radius: 5px; border-left: 3px solid var(--gold); background: var(--warn-soft); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; font-weight: 700; }
a.cal-chip:hover { text-decoration: none; filter: brightness(.96); }
.cal-chip.audiencia { border-color: var(--bad); background: var(--bad-soft); }
.cal-chip.bloq { border-color: var(--line-strong); background: var(--gray-soft); color: var(--muted); }
.cal-scroll { max-height: 68vh; overflow-y: auto; overscroll-behavior: contain; }
.cal-gutter .hl { height: var(--px); position: relative; }
.cal-gutter .hl span { position: absolute; top: -.6em; right: .45rem; font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-gutter .hl:first-child span { top: .15rem; }
.cal-col { position: relative; border-left: 1px solid var(--line); cursor: cell;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(color-mix(in srgb, var(--line) 45%, transparent) 1px, transparent 1px);
  background-size: 100% var(--px), 100% calc(var(--px) / 2); }
.cal-col.hoy { background-color: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
.cal-off { position: absolute; left: 0; right: 0; pointer-events: none;
  background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--line-strong) 16%, transparent) 6px 7px), color-mix(in srgb, var(--gray-soft) 60%, transparent); }
.ev { position: absolute; z-index: 2; display: flex; flex-direction: column; gap: 0; text-align: left; font: inherit; font-size: .8rem; line-height: 1.25; padding: .18rem .45rem; border: 0; border-left: 4px solid var(--accent); border-radius: 6px;
  background: var(--accent-soft); color: var(--ink); cursor: pointer; overflow: hidden; box-shadow: 0 1px 2px rgba(15, 23, 42, .15); transition: box-shadow var(--t-fast), transform var(--t-fast); }
.ev:hover { box-shadow: 0 3px 10px rgba(15, 23, 42, .25); z-index: 4; }
.ev .en { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .et { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .74rem; }
.ev .em { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .74rem; }
.ev.pend { border-left: 4px dashed var(--pend); background: var(--pend-soft); }
.ev.realizada { border-left-color: var(--ok); background: var(--ok-soft); }
.ev.no_asistio { border-left-color: var(--bad); background: var(--bad-soft); }
.now { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--bad); z-index: 3; pointer-events: none; }
.now::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
@media (max-width: 860px) { .seg { margin-left: 0; } .cal-bar .rango { flex-basis: 100%; margin: 0; } }

/* Modal de detalle de cita */
.cita-head { padding-bottom: .85rem; margin-bottom: .9rem; border-bottom: 1px solid var(--line); }
.cita-fecha { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; }
.cita-hora { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.cita-badges { margin-top: .5rem; display: flex; gap: .4rem; flex-wrap: wrap; }
.callout { margin-top: 1.1rem; padding: .95rem 1.1rem; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: var(--radius-sm); background: var(--surface-2); }
.callout.ok { border-left-color: var(--ok); background: var(--ok-soft); }
.callout h3 { margin: 0 0 .35rem; } .callout p { margin: 0 0 .65rem; }
.inline { display: flex; gap: .5rem; align-items: stretch; } .inline input { flex: 1; min-width: 0; }
.modal footer { flex-wrap: wrap; }
.list li[data-cita] { cursor: pointer; border-radius: var(--radius-sm); transition: background var(--t-fast); }
.list li[data-cita]:hover { background: var(--accent-soft); }
