/* ==========================================================================
   GestIA · Vacaciones: cruces de equipo
   Las animaciones quedan neutralizadas por el bloque prefers-reduced-motion de base.css.
   ========================================================================== */

/* ---------- Avisos de cruce en listas ---------- */
.overlap-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  margin-top: 6px;
  padding: 4px 9px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: normal;
  color: var(--tone-ink);
  background: var(--tone-soft);
  animation: pop .3s var(--spring) both;
}
.overlap-note .i { width: 14px; height: 14px; margin-top: 1px; }
.overlap-note b { font-weight: 800; }
.overlap-slot:empty { display: none; }
.overlap-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 12px 22px 0;
  padding: 6px 6px 6px 12px;
  border-radius: var(--r-sm);
  border: 1px dashed var(--line);
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--ink-2);
  animation: fade .3s var(--ease) both;
}
.overlap-notice > .i { width: 16px; height: 16px; color: var(--tone-ink); }
.toolbar + .overlap-notice { margin: 12px 16px; }

/* ---------- Vista de cruces ---------- */
.ov-head {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px 32px;
  padding: 20px clamp(20px, 2.4vw, 28px);
  border-radius: var(--r-xl);
  color: var(--on-color);
  background: var(--shade-hero), var(--grad-warm);
  box-shadow: var(--shadow-warm);
}
.ov-head::after { content: ""; position: absolute; inset: 0; z-index: -1; background-image: var(--brand-pattern); background-size: 56px 56px; opacity: .08; }
.ov-head :focus-visible { outline-color: var(--on-color); }
.ov-head-copy { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ov-head-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 14px; background: var(--glass); box-shadow: inset 0 0 0 1px var(--glass-line); animation: pop .45s var(--spring) .1s backwards; }
.ov-head-icon .i { width: 22px; height: 22px; }
.ov-head-copy p { max-width: 640px; font-size: 14.5px; font-weight: 600; line-height: 1.5; }
.ov-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ov-stats:empty { display: none; }
.ov-stat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 5px 16px 5px 12px;
  border-radius: 999px;
  background: var(--glass-dark);
  box-shadow: inset 0 0 0 1px var(--glass-line);
  font-size: 13px;
  font-weight: 650;
  color: var(--on-color-2);
  animation: pop .4s var(--spring) backwards;
  animation-delay: calc(100ms + min(var(--i, 0), 8) * 35ms);
}
.ov-stat .i { width: 16px; height: 16px; color: var(--on-color); }
.ov-stat b { font-size: 20px; font-weight: 800; letter-spacing: -.02em; line-height: 1; color: var(--on-color); font-variant-numeric: tabular-nums; }
.ov-head-side { grid-column: 2; grid-row: 1 / span 2; display: grid; justify-items: end; gap: 8px; }
.ov-head-label { font-size: 12px; font-weight: 700; color: var(--on-color-2); }
.ov-head small { font-size: 12.5px; font-weight: 600; color: var(--on-color-2); }
.ov-range { background: var(--glass-dark); border-color: var(--glass-line); }
.ov-range button { height: 38px; padding: 0 14px; color: var(--on-color); transition: transform .2s var(--spring), background-color .2s, color .2s; }
.ov-range button:hover { color: var(--on-color); background: var(--glass); }
.ov-range button:active { transform: scale(.96); }
.ov-range button[aria-pressed="true"] { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-sm); }

.ov-content { display: grid; gap: 20px; transition: opacity .2s var(--ease); }
.ov-content:focus { outline: none; }
.ov-content.is-loading { opacity: .55; pointer-events: none; }
.ov-info { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: var(--r-md); font-size: 13px; color: var(--tone-ink); background: var(--tone-soft); }
.ov-info .i { width: 16px; height: 16px; margin-top: 2px; }
.ov-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 0; padding: 0; list-style: none; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.ov-legend li { display: inline-flex; align-items: center; gap: 7px; }
.ov-key { display: inline-block; width: 22px; height: 11px; border-radius: 4px; }
.ov-key.is-band { background: var(--overlap-band); box-shadow: inset 0 0 0 1px var(--overlap-band-line); }

/* Mapa del periodo */
.ov-map-card .card-head { flex-wrap: wrap; align-items: center; }
.ov-map { --team: 240px; display: grid; padding: 10px 22px 16px; }
.ov-map-axis { position: relative; height: 28px; margin-left: calc(var(--team) + 14px); }
.ov-map-today { position: absolute; top: 4px; left: -1px; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 800; color: var(--on-color); background: var(--blue-600); }
.ov-map-tick { position: absolute; top: 6px; transform: translateX(-50%); font-size: 11px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; color: var(--ink-3); }
.ov-map-rows { display: grid; margin: 0; padding: 0; list-style: none; }
.ov-map-row { display: grid; grid-template-columns: var(--team) minmax(0, 1fr); align-items: center; gap: 14px; min-height: 50px; border-top: 1px dashed var(--line); }
.ov-map-team { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 13px; font-weight: 700; }
.ov-map-team > span:last-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ov-map-team .avatar { --s: 28px; }
.ov-map-track { position: relative; align-self: stretch; min-height: 50px; container-type: inline-size; }
.ov-map-track::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 2px; background: var(--blue-600); }
.ov-map-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line-soft); }
.ov-map-mark {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 24px;
  height: 32px;
  margin-top: -16px;
  padding-right: 2px;
  border-radius: 8px;
  color: var(--tone-ink);
}
.ov-map-mark.is-flip { flex-direction: row-reverse; padding: 0 0 0 2px; }
.ov-map-bar {
  display: block;
  flex: none;
  width: max(10px, calc(var(--w) * 1cqw));
  height: 16px;
  border-radius: 6px;
  background: var(--tone);
  box-shadow: var(--shadow-overlap);
  transform-origin: left center;
  animation: bar-grow .45s var(--spring) backwards;
  animation-delay: calc(120ms + min(var(--i, 0), 8) * 35ms);
  transition: transform .2s var(--ease);
}
.ov-map-mark.is-flip .ov-map-bar { transform-origin: right center; }
.ov-map-label {
  padding: 2px 8px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  background: var(--tone-soft);
  animation: fade .3s var(--ease) backwards;
  animation-delay: calc(200ms + min(var(--i, 0), 8) * 35ms);
  transition: transform .2s var(--ease);
}
.ov-map-mark:hover .ov-map-bar, .ov-map-mark:focus-visible .ov-map-bar { transform: scaleY(1.3); }
.ov-map-mark:hover .ov-map-label { transform: translateX(2px); }
.ov-map-mark.is-flip:hover .ov-map-label { transform: translateX(-2px); }
.ov-map-mark:active .ov-map-bar { transform: scale(.94); }
@keyframes bar-grow { from { opacity: 0; transform: scaleX(0); } to { opacity: 1; transform: scaleX(1); } }

/* Equipos */
.ov-teams { display: grid; gap: 20px; }
.ov-team { scroll-margin-top: calc(var(--topbar) + 16px); }
.ov-team:focus { outline: none; }
.ov-team-head { flex-wrap: wrap; }
.ov-team-meta { display: flex; align-items: center; gap: 6px; }
.card-head p.ov-team-meta { color: var(--ink-2); }
.ov-team-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ov-team-body { display: grid; gap: 14px; padding: 16px 22px 22px; }

/* Cruce: encabezado, calendario día a día y decisiones */
.ov-cross {
  position: relative;
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
  scroll-margin-top: calc(var(--topbar) + 16px);
  animation: rise .45s var(--ease) backwards;
  animation-delay: calc(120ms + var(--i, 0) * 70ms);
}
.ov-cross:focus { outline: none; }
.ov-cross::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; box-shadow: 0 0 0 3px var(--overlap-band-line); opacity: 0; pointer-events: none; }
.ov-cross.is-flash::after { animation: ov-flash 1.6s var(--ease); }
@keyframes ov-flash { 0%, 100% { opacity: 0; } 15%, 60% { opacity: 1; } }
.ov-cross-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.ov-cross-title { flex: 1 1 220px; min-width: 0; }
.ov-cross-title h4 { font-size: 15px; font-weight: 800; }
.ov-cross-title p { margin-top: 1px; font-size: 12.5px; color: var(--ink-2); }
.ov-cross-title p b { font-weight: 750; color: var(--ink); }

.ov-cal-scroll { overflow-x: auto; overscroll-behavior-x: contain; border-radius: var(--r-sm); border: 1px solid var(--line-soft); background: var(--surface); }
.ov-cal {
  --name: 220px;
  position: relative;
  display: grid;
  grid-template-columns: var(--name) repeat(var(--days), minmax(38px, 1fr));
  grid-template-rows: 24px 46px repeat(var(--rows), 54px) 40px;
  /* El ancho sigue al contenido para que la columna de nombres quede fija durante todo el desplazamiento. */
  width: max-content;
  min-width: 100%;
  padding-right: 6px;
}
.ov-cal-corner { grid-column: 1; grid-row: 1 / 3; position: sticky; left: 0; z-index: 3; background: var(--surface); border-right: 1px solid var(--line-soft); }
.ov-cal-month { grid-row: 1; align-self: end; padding: 0 0 2px 8px; border-left: 1px solid var(--line); font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; color: var(--ink-3); }
.ov-cal-col { grid-row: 2 / -1; border-left: 1px solid var(--line-soft); }
.ov-cal-col.is-weekend { background: var(--surface-2); }
.ov-cal-band { grid-row: 2 / -1; margin: 0 2px; border-radius: 8px; background: var(--overlap-band); box-shadow: inset 0 0 0 1px var(--overlap-band-line); pointer-events: none; animation: fade .4s var(--ease) .12s backwards; }
.ov-cal-day { grid-row: 2; z-index: 1; display: grid; place-content: center; justify-items: center; gap: 2px; line-height: 1.1; }
.ov-cal-day small { font-size: 10.5px; font-weight: 650; color: var(--ink-3); }
.ov-cal-day b { display: grid; place-items: center; min-width: 26px; height: 22px; padding: 0 5px; border-radius: 999px; font-size: 13px; font-weight: 750; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ov-cal-day.is-cross small, .ov-cal-day.is-cross b { color: var(--tone-ink); }
.ov-cal-day.is-today b { color: var(--on-color); background: var(--blue-600); }
.ov-cal-line { grid-column: 1 / -1; align-self: start; border-top: 1px dashed var(--line); pointer-events: none; }
.ov-cal-person {
  grid-column: 1;
  position: sticky;
  left: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 12px 0 14px;
  border-top: 1px dashed var(--line);
  border-right: 1px solid var(--line-soft);
  background: var(--surface);
}
.ov-cal-person .avatar { --s: 28px; }
.ov-cal-who { display: grid; min-width: 0; line-height: 1.3; }
.ov-cal-who strong, .ov-cal-who small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ov-cal-who strong { font-size: 13px; font-weight: 700; }
.ov-cal-who small { font-size: 11.5px; color: var(--ink-3); }
.ov-cal-who small b { font-weight: 750; color: var(--tone-ink); }
.ov-cal-total { font-size: 12px; font-weight: 750; color: var(--ink-2); background: var(--surface-2); }
.ov-cal-bar {
  z-index: 2;
  align-self: center;
  height: 26px;
  margin: 0 3px;
  border-radius: 8px;
  transform-origin: left center;
  animation: bar-grow .45s var(--spring) backwards;
  animation-delay: calc(180ms + var(--i, 0) * 80ms);
}
.ov-cal-bar.is-approved, .ov-key.is-approved { background: var(--tone); }
.ov-cal-bar.is-pending, .ov-key.is-pending { background: repeating-linear-gradient(135deg, var(--tone) 0 5px, var(--tone-soft) 5px 10px); box-shadow: inset 0 0 0 1.5px var(--tone); }
.ov-cal-bar.clip-start { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.ov-cal-bar.clip-end { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.ov-cal-count { grid-row: -2; z-index: 1; display: grid; place-items: center; }
.ov-cal-count b { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; font-size: 12px; font-weight: 800; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ov-cal-count.is-cross b { color: var(--on-color); background: var(--tone-ink); animation: pop .35s var(--spring) backwards; animation-delay: calc(300ms + var(--i, 0) * 25ms); }

.ov-decide { display: grid; gap: 8px; }
.ov-decide ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ov-decide-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  padding: 8px 10px 8px 14px;
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--amber-500), var(--shadow-xs);
  animation: pop .35s var(--spring) backwards;
  animation-delay: 260ms;
}
.ov-decide-row.leaving { animation: leave .45s var(--ease) forwards; pointer-events: none; }
.ov-decide-who { display: flex; align-items: center; gap: 10px; flex: 1 1 280px; min-width: 0; }
.ov-decide-who > span { display: grid; min-width: 0; line-height: 1.35; }
.ov-decide-who strong { font-size: 13.5px; font-weight: 700; }
.ov-decide-who small { font-size: 12px; color: var(--ink-3); }
.ov-decide-actions { display: flex; gap: 6px; }
.ov-cross-ok { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 650; color: var(--tone-ink); }
.ov-cross-ok .i { width: 16px; height: 16px; }

@media (max-width: 900px) {
  .ov-head { grid-template-columns: minmax(0, 1fr); }
  .ov-head-side { grid-column: auto; grid-row: auto; justify-items: start; }
}
@media (max-width: 720px) {
  .ov-head { padding: 18px; }
  .ov-head-icon { width: 38px; height: 38px; border-radius: 12px; }
  .ov-head-copy p { font-size: 13.5px; }
  .ov-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ov-stat { flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px 12px; border-radius: var(--r-md); font-size: 11.5px; line-height: 1.25; }
  .ov-stat .i { display: none; }
  .ov-head-side { width: 100%; }
  .ov-range { width: 100%; }
  .ov-range button { flex: 1; justify-content: center; padding: 0 8px; }
  .ov-map { padding: 6px 16px 14px; }
  .ov-map-axis { margin-left: 0; }
  .ov-map-row { grid-template-columns: minmax(0, 1fr); gap: 2px; padding-top: 10px; }
  .ov-map-track { min-height: 42px; }
  .ov-team-body { padding: 14px 16px 16px; }
  .ov-cross { padding: 12px; }
  .ov-cal { --name: 128px; }
  .ov-cal-person { padding: 0 8px 0 10px; }
  .ov-cal-person .avatar { display: none; }
}
@media (max-width: 520px) {
  .ov-decide-actions { flex: 1 1 100%; }
  .ov-decide-actions .btn { flex: 1; }
}

/* ---------- Organigrama ---------- */
.org-alert {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 24px;
  padding: 0 8px 0 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--tone-ink);
  background: var(--tone-soft);
  box-shadow: 0 0 0 2px var(--surface), var(--shadow-sm);
}
.org-alert .i { width: 13px; height: 13px; stroke-width: 2.6; }
.org-card.enter .org-alert { animation: pop .4s var(--spring) .2s backwards; }
.org-overlaps-link { transition: transform .2s var(--ease); }
.org-overlaps-link:hover:not(:disabled) { transform: translateY(-1px); }
.insp-overlaps { display: grid; gap: 8px; padding: 12px; border-radius: var(--r-md); border: 1px solid var(--line-soft); background: var(--surface-2); }
.insp-overlaps ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.insp-overlaps li { display: grid; gap: 1px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 3px 0 0 var(--amber-500); }
.insp-overlaps strong { font-size: 13px; font-weight: 750; }
.insp-overlaps small { font-size: 12px; line-height: 1.4; color: var(--ink-2); }
.insp-overlaps .btn { justify-self: start; }
