/* Panel de jornada. Sigue Modern Web Guidance: color-scheme + light-dark(), :focus-visible,
   <dialog> nativo con @starting-style, tablas con encabezados fijos y container queries,
   Forced Colors Mode y prefers-reduced-motion. */

:root {
  color-scheme: light dark;

  --bg: light-dark(#f6f5f2, #161615);
  --surface: light-dark(#ffffff, #1f1f1d);
  --surface-2: light-dark(#fafaf8, #242422);
  --line: light-dark(#e6e3dd, #2f2e2b);
  --line-strong: light-dark(#8f8a80, #6b6964); /* bordes de controles: 3:1 contra el fondo */
  --text: light-dark(#1d1c1a, #ecebe7);
  --muted: light-dark(#5f5c55, #a3a097);
  --faint: light-dark(#76726a, #8d8a82);
  --accent: light-dark(#2f6f5e, #7cc4ad);
  --accent-text: light-dark(#ffffff, #0f211c);
  --accent-soft: light-dark(#e3efe9, #1f3530);
  --over: light-dark(#8a4b00, #f0b35c);
  --over-bg: light-dark(#fdf0dc, #3a2b14);
  --under: light-dark(#34508c, #9db6ea);
  --under-bg: light-dark(#e8eef9, #1f2a40);
  --bad: light-dark(#b3261e, #f28b82);
  --bad-bg: light-dark(#fbe7e5, #3d1f1c);
  --away: light-dark(#5f5c55, #a3a097);
  --away-bg: light-dark(#efede8, #2a2927);
  --shadow: light-dark(0 1px 2px rgb(0 0 0 / 0.04), none);
  --radius: 10px;

  accent-color: var(--accent);
  scrollbar-color: var(--faint) transparent;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
ul[role="list"] { list-style: none; margin: 0; padding: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
.num, .cell-hours, .kpi-value, .tpl-time { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); font-weight: 500; }
.nowrap { white-space: nowrap; }
.warn-text { color: var(--over); }

/* Texto solo para lectores de pantalla (receta canónica, no display:none) */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Foco visible en todo lo interactivo */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute; inset-inline-start: 16px; inset-block-start: -100px;
  background: var(--surface); border: 1px solid var(--line-strong); padding: 8px 12px; border-radius: 8px; z-index: 50;
}
.skip-link:focus-visible { inset-block-start: 12px; }

/* Encabezado ------------------------------------------------------------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap;
  padding: 18px 28px 0;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  mask: radial-gradient(circle at 50% 50%, #000 0 6px, transparent 6.5px), linear-gradient(#000 0 0);
  mask-composite: exclude;
}
.brand-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.brand-sub { color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 3px; max-width: 100%; overflow-x: auto; }
.tabs a {
  text-decoration: none; padding: 6px 12px; min-block-size: 32px; display: inline-flex; align-items: center;
  border-radius: 6px; color: var(--muted); font-weight: 500; white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.me { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.me form { display: contents; }
.me .who { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.local-banner { background: var(--over-bg); color: var(--over); padding: 3px 10px; border-radius: 999px; font-weight: 600; font-size: 12px; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: var(--surface); font-size: 11px; font-weight: 700; margin-inline-start: 4px; }

main { padding: 0 28px 48px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 16px 0; }
.period { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#view-title { font-size: 20px; margin: 0 6px; letter-spacing: -0.015em; }
#view-title:focus { outline: none; }
#view-title:focus-visible { outline: 2px solid var(--accent); }
.period small { color: var(--muted); font-size: 13px; }

.btn {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 7px; padding: 5px 10px; cursor: pointer;
  min-block-size: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; text-decoration: none;
}
.btn:hover { border-color: var(--text); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn.icon { inline-size: 32px; padding: 0; font-size: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.danger { border-color: var(--bad); color: var(--bad); font-weight: 600; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters input[type="search"], .filters select {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 7px; padding: 6px 10px; min-block-size: 32px; min-width: 0;
}
.filters input[type="search"] { inline-size: 220px; }
.check { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); cursor: pointer; user-select: none; min-block-size: 24px; }

.banner { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad); border-radius: 8px; padding: 10px 12px; margin-block-end: 12px; }
.banner::before { content: "⚠ " / ""; }

/* KPIs -------------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-block-end: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.kpi-label { color: var(--muted); font-size: 12px; }
.kpi-value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin-block-start: 2px; }
.kpi-value small { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi.warn .kpi-value { color: var(--over); }

/* Tablas ------------------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.table-wrap {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: max(420px, 78vh); /* encabezados fijos dentro de la tabla al desplazarse */
  container-type: inline-size;
}
.table-wrap.spaced { margin-block-end: 28px; }
table { border-collapse: separate; border-spacing: 0; inline-size: 100%; }
th, td { padding: 8px 10px; border-block-end: 1px solid var(--line); text-align: start; vertical-align: middle; }
thead { position: sticky; inset-block-start: 0; z-index: 2; }
thead th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
thead th small { display: block; font-weight: 500; color: var(--faint); font-size: 12px; }
thead th.holiday small { color: var(--accent); }
tbody th { font-weight: 400; }
tbody tr:last-child > * { border-block-end: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover > * { background: var(--surface-2); }
.sticky { position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; }
thead .sticky { background: var(--surface-2); z-index: 3; }
.person-link {
  border: 0; background: none; padding: 0; font-weight: 600; text-align: start; cursor: pointer; white-space: nowrap;
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px;
}
.person-link:hover { text-decoration-color: currentColor; }
.person-name { font-weight: 600; white-space: nowrap; display: block; }
.person-area { color: var(--muted); font-size: 12px; display: block; font-weight: 400; }
td.num, th.num { text-align: end; white-space: nowrap; }
.weekend { background: color-mix(in oklab, var(--surface-2) 60%, transparent); }
tr.inactive .person-link, tr.inactive .person-name { color: var(--muted); font-weight: 500; }
.row-actions { text-align: end; white-space: nowrap; }

/* Celdas de día */
.day { min-inline-size: 104px; }
th.day.holiday { min-inline-size: 96px; inline-size: 96px; white-space: normal; }
td.holiday-cell { min-inline-size: 96px; background: var(--surface-2); }
.cell { display: flex; flex-direction: column; gap: 1px; border-radius: 7px; padding: 4px 7px; margin: -2px -4px; border: 1px solid transparent; }
.week-cell .cell { align-items: flex-end; }
.cell-hours { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.week-cell .cell-hours { font-size: 14px; }
.cell-sub { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-tag { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.cell.over { background: var(--over-bg); }
.cell.over .cell-hours { color: var(--over); }
.cell.under { background: var(--under-bg); }
.cell.under .cell-hours { color: var(--under); }
.cell.bad { background: var(--bad-bg); }
.cell.bad .cell-label { color: var(--bad); }
.cell.away { background: var(--away-bg); }
.cell.away .cell-label { color: var(--away); }
.cell.live .cell-hours { color: var(--accent); }
.cell-label { font-size: 12px; font-weight: 600; }
.cell.empty { color: var(--faint); }
.dot { display: inline-block; inline-size: 6px; block-size: 6px; border-radius: 50%; background: var(--over); margin-inline-start: 4px; vertical-align: middle; }

.diff.pos { color: var(--over); }
.diff.neg { color: var(--under); }
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--away-bg); color: var(--away); white-space: nowrap;
}
.pill.warn { background: var(--over-bg); color: var(--over); }
.pill.bad, .pill.recurring { background: var(--bad-bg); color: var(--bad); }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pills { display: flex; gap: 4px; flex-wrap: wrap; }
.note { color: var(--muted); font-size: 13px; margin-block: 12px; max-inline-size: 64ch; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 12.5px; margin: 0 0 10px; max-inline-size: 64ch; }
.legend b { color: var(--text); }
.legend .dot { margin-inline: 0 2px; }
.loading, .empty-state, .loading-state, .error { padding: 40px; text-align: center; color: var(--muted); }
/* Mientras llegan los datos de otra vista o periodo, lo que se ve queda atenuado (no parece el periodo nuevo) */
main[aria-busy="true"] #view { opacity: 0.45; transition: opacity 0.2s ease-out 0.12s; }
.sheet-error { color: var(--bad); margin-block: 8px 16px; }
.sheet-error::before { content: "⚠ " / ""; }
.error { color: var(--bad); }

/* Tablas angostas (contenedor < 640px): cada fila se vuelve tarjeta con etiquetas */
@container (width < 640px) {
  .stackable :is(table, thead, tbody, tr, th, td) { display: block; }
  .stackable thead { display: none; }
  .stackable tr { border-block-end: 1px solid var(--line-strong); padding-block: 6px; }
  .stackable tbody th { position: sticky; inset-block-start: 0; z-index: 1; background: var(--surface-2); border: 0; }
  .stackable td { border: 0; padding-block: 4px; display: flex; justify-content: space-between; gap: 12px; text-align: start; }
  .stackable td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; }
  .stackable .cell { margin: 0; align-items: flex-end; }
  .stackable td:empty, .stackable td:has(> .pills:empty:only-child) { display: none; }
  .stackable td.holiday-cell { display: none; }
}
/* El detalle de una persona: las etiquetas de alerta pueden ocupar varias líneas */
.detail-table .pills .pill { white-space: normal; }

/* Hoy --------------------------------------------------------------------- */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px; align-items: start; }
.lane h2 { font-size: 13px; display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-block-end: 1px solid var(--line); }
.lane h2 .count { color: var(--muted); font-weight: 500; }
.lane ul { padding-block: 4px; }
.lane-item { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; inline-size: 100%; padding: 7px 14px; min-block-size: 32px; font-weight: 500; text-align: start; white-space: normal; }
.lane-item:hover { background: var(--surface-2); }
.lane-item .t { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 400; }
.empty-lane { color: var(--faint); padding: 10px 14px; }
.lane-urgent { grid-column: span 1; }
.lane-urgent.tone-bg-bad h2 { background: var(--bad-bg); color: var(--bad); border-radius: var(--radius) var(--radius) 0 0; }
.lane-urgent.tone-bg-over h2 { background: var(--over-bg); color: var(--over); border-radius: var(--radius) var(--radius) 0 0; }
.lane-urgent h2 .count { color: inherit; font-weight: 700; }
.lane-ok { color: var(--muted); }
.lane-more summary { padding: 8px 14px; cursor: pointer; color: var(--accent); font-weight: 600; min-block-size: 32px; }
.lane-more[open] summary { border-block-end: 1px solid var(--line); }
.lane-dot { inline-size: 8px; block-size: 8px; border-radius: 50%; display: inline-block; margin-inline-end: 8px; }
.tone-accent { background: var(--accent); }
.tone-over { background: var(--over); }
.tone-faint { background: var(--faint); }
.tone-bad { background: var(--bad); }
.tone-away { background: var(--line-strong); }

/* Resumen ----------------------------------------------------------------- */
.summary-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (width < 900px) { .summary-grid { grid-template-columns: 1fr; } }
.section-title { font-size: 13px; font-weight: 600; padding: 10px 14px; border-block-end: 1px solid var(--line); }
.section-title.divided { border-block-start: 1px solid var(--line); }
.review-list li { padding: 12px 14px; border-block-end: 1px solid var(--line); display: grid; gap: 6px; }
.review-list li:last-child { border-block-end: 0; }
.review-top { display: flex; justify-content: space-between; gap: 8px; }
.review-why { color: var(--muted); font-size: 12.5px; }
.slack-card { margin-block-start: 16px; }
.slack-card summary { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; padding: 12px 14px; cursor: pointer; min-block-size: 44px; }
.slack-card .slack-title { font-weight: 600; }
.slack-card[open] summary { border-block-end: 1px solid var(--line); }
.email-cell { color: var(--muted); font-size: 12.5px; }
.schedule-set { display: grid; gap: 12px; border-block-start: 1px solid var(--line); padding-block-start: 12px; }
.schedule-set > legend { font-size: 13px; float: inline-start; inline-size: 100%; margin: 0; }
.slack-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; border-block-end: 1px solid var(--line); }
.slack-head h2 { font-size: 14px; }
.slack-head span { color: var(--muted); font-size: 12px; }
.slack-preview { padding: 16px 18px; white-space: pre-wrap; font-size: 14px; line-height: 1.55; }
.card-actions { padding: 0 14px 14px; }
.callout { padding: 12px 14px; margin-block-end: 12px; display: grid; gap: 4px; }
.callout h2 { font-size: 14px; }

/* Horarios ---------------------------------------------------------------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-block: 8px 12px; }
.section-head h2 { font-size: 15px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-block-end: 28px !important; }
.tpl { padding: 14px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.tpl-top { display: flex; gap: 8px; align-items: center; justify-content: space-between; inline-size: 100%; }
.tpl-top h3 { font-size: 14px; }
.tpl-time { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.tpl-meta { color: var(--muted); font-size: 12.5px; }
.tpl .btn { margin-block-start: 8px; }
.access-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.access-actions select { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 7px; padding: 5px 8px; min-block-size: 32px; }

/* Diálogos (nativos) ----------------------------------------------------------- */
dialog {
  border: 1px solid var(--line-strong); border-radius: 14px; padding: 0; background: var(--bg); color: var(--text);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.25);
  /* Animación de entrada/salida en la capa superior */
  opacity: 0;
  transition-property: opacity, transform, translate, display, overlay;
  transition-duration: 0.2s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
  @media (prefers-reduced-motion: no-preference) { transform: scale(0.97); }
  @media (prefers-reduced-motion: reduce) { transition-duration: 0.1s; }
}
dialog[open] {
  opacity: 1;
  @starting-style { opacity: 0; }
  @media (prefers-reduced-motion: no-preference) {
    transform: scale(1);
    @starting-style { transform: scale(0.97); }
  }
}
dialog::backdrop {
  background-color: rgb(0 0 0 / 0);
  transition-property: background-color, display, overlay;
  transition-duration: 0.2s;
  transition-behavior: allow-discrete;
  overflow: hidden; /* el scroll dentro del diálogo no mueve la página de atrás */
  overscroll-behavior: contain;
}
dialog[open]::backdrop {
  background-color: rgb(0 0 0 / 0.35);
  @starting-style { background-color: rgb(0 0 0 / 0); }
}
dialog:modal { overscroll-behavior: contain; max-block-size: calc(100dvh - 32px); }

#dlg, #confirm { inline-size: min(500px, calc(100vw - 32px)); }
.dlg-form { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.dlg-form h1 { font-size: 18px; letter-spacing: -0.01em; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dlg-error { color: var(--bad); background: var(--bad-bg); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.dlg-error::before { content: "⚠ " / ""; }

/* Panel lateral con el detalle de una persona */
dialog.sheet {
  margin: 0 0 0 auto; block-size: 100dvh; max-block-size: 100dvh; inline-size: min(720px, 100vw);
  border-radius: 0; border-block: 0; border-inline-end: 0; padding: 24px; overflow-y: auto;
  @media (prefers-reduced-motion: no-preference) { transform: none; translate: 40px 0; }
}
dialog.sheet[open] {
  @media (prefers-reduced-motion: no-preference) {
    transform: none;
    translate: 0 0;
    @starting-style { translate: 40px 0; }
  }
}
.sheet-close {
  position: absolute; inset-block-start: 12px; inset-inline-end: 14px; border: 0; background: none; font-size: 24px; line-height: 1;
  cursor: pointer; color: var(--muted); min-inline-size: 32px; min-block-size: 32px; border-radius: 6px;
}
.sheet h1 { font-size: 20px; letter-spacing: -0.015em; padding-inline-end: 40px; }
.sheet .meta { color: var(--muted); margin-block: 2px 16px; }
.chart { margin: 0 0 16px; }
.bars { display: flex; align-items: flex-end; gap: 3px; block-size: 90px; padding: 12px 14px 0; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; block-size: 100%; }
.bar i { display: block; inline-size: 100%; border-radius: 3px 3px 0 0; background: var(--accent); opacity: 0.85; min-block-size: 2px; }
.bar.over i { background: var(--over); }
.bar.away i { background: var(--line); }
.bars-wrap { position: relative; }
.bars-target { position: absolute; inset-inline: 14px; border-block-start: 1px dashed var(--faint); }
.bars-legend { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; padding: 4px 14px 10px; }
.msgs { color: var(--faint); font-size: 11.5px; margin: 4px 0 0; padding-inline-start: 16px; }

/* Formularios -------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.field .req { color: var(--muted); font-weight: 500; }
.field small { color: var(--muted); font-size: 12px; }
.field input, .field select {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 7px; padding: 7px 9px; inline-size: 100%;
  font-size: max(1rem, 1em); min-block-size: 36px;
}
.field input[readonly] { background: var(--surface-2); color: var(--muted); }
.field input:user-invalid, .field select:user-invalid { border-color: var(--bad); border-width: 2px; background: var(--bad-bg); }
.field-error { display: none; color: var(--bad); font-size: 12.5px; }
.field:has(:user-invalid) .field-error { display: block; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (width < 480px) { .row3 { grid-template-columns: 1fr; } }
fieldset { border: 0; margin: 0; padding: 0; min-inline-size: 0; }
legend { font-size: 12.5px; font-weight: 600; padding: 0; margin-block-end: 6px; }
.daypicker { display: flex; gap: 6px; flex-wrap: wrap; }
.daypicker label { cursor: pointer; position: relative; }
.daypicker input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.daypicker span[aria-hidden] {
  display: inline-grid; place-items: center; inline-size: 36px; block-size: 36px; border-radius: 8px; border: 1px solid var(--line-strong);
  font-weight: 600; color: var(--muted); background: var(--surface);
}
.daypicker input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.daypicker input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.daypicker-set:has(:user-invalid) .daypicker span[aria-hidden] { border-color: var(--bad); }
.daypicker-set:has(:user-invalid) .field-error { display: block; margin-block-start: 6px; }
legend .req { color: var(--muted); font-weight: 500; }
.seg { display: flex; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg label { flex: 1; text-align: center; padding: 7px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 500; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg label:has(input:checked) { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 0 0 0 1.5px var(--accent); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Horario distinto por día */
.perday-set { display: grid; gap: 8px; }
.perday { display: grid; grid-template-columns: minmax(5.5rem, 1fr) repeat(2, minmax(5.75rem, 1fr)) 4rem 3rem; gap: 6px 8px; align-items: center; }
.perday-lunch { display: flex; gap: 6px; align-items: center; justify-content: center; min-block-size: 36px; cursor: pointer; font-size: 13px; }
.perday-h { font-size: 12px; color: var(--muted); font-weight: 600; }
.perday-day { display: flex; gap: 8px; align-items: center; font-weight: 500; min-block-size: 36px; cursor: pointer; }
.perday input[type="time"], .perday input[type="number"] {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 7px; padding: 6px 8px; inline-size: 100%;
  font-size: max(1rem, 1em); min-block-size: 36px;
}
.perday input:disabled { opacity: 0.45; }
.perday input:user-invalid { border-color: var(--bad); border-width: 2px; background: var(--bad-bg); }
.perday-set:has(:user-invalid) .field-error { display: block; }
.perday-set small { color: var(--muted); font-size: 12px; }
@media (width < 480px) {
  .perday { grid-template-columns: 1fr 1fr 4rem 3rem; }
  .perday-day { grid-column: 1 / -1; }
  .perday-h:first-child { display: none; }
}
.baja-set { display: grid; gap: 10px; border-block-start: 1px solid var(--line); padding-block-start: 12px; }
.baja-set > legend { float: inline-start; inline-size: 100%; margin: 0; font-size: 13px; }
.history { border-block-start: 1px solid var(--line); padding-block-start: 10px; font-size: 12.5px; display: grid; gap: 6px; }
.history h2 { font-size: 13px; }
.history ul { display: grid; gap: 6px; }
.history-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 8px; color: var(--muted); }

/* Alto contraste (Windows): los fondos de estado desaparecen, así que se refuerzan con bordes */
@media (forced-colors: active) {
  .cell.over, .cell.under, .cell.bad, .cell.away, .pill, .banner, .dlg-error, .kpi, .card { border: 1px solid CanvasText; }
  .dot, .lane-dot, .bar i, .badge { background: CanvasText; forced-color-adjust: none; }
  .tabs a[aria-current="page"] { outline: 2px solid Highlight; }
  .daypicker input:checked + span, .seg label:has(input:checked) { outline: 2px solid Highlight; }
  .field input:user-invalid { border-style: dashed; }
}

/* Pantallas angostas */
@media (width < 700px) {
  .top { padding-inline: 16px; }
  main { padding: 0 16px 40px; }
  .filters input[type="search"] { inline-size: 100%; }
  .filters { inline-size: 100%; }
}
@media (pointer: coarse) {
  .perday input, .perday-day, .perday-lunch { min-block-size: 44px; }
  .btn, .tabs a, .filters input[type="search"], .filters select, .access-actions select,
  .field input, .field select, .seg label, .sheet-close, .lane-item, .lane-more summary { min-block-size: 44px; }
  .btn.icon, .sheet-close { min-inline-size: 44px; inline-size: 44px; }
  .person-link { min-block-size: 44px; display: inline-flex; align-items: center; }
  .daypicker span[aria-hidden] { inline-size: 44px; block-size: 44px; }
  button.link { padding-block: 12px; }
}
