:root {
  --blue-950: #0b2f51;
  --blue-900: #103e69;
  --blue-800: #165f9e;
  --blue-700: #2d7bbb;
  --blue-100: #e9f2fb;
  --blue-50: #f7fbff;
  --green-700: #1a7d5b;
  --green-600: #27a16c;
  --green-100: #e7f6ef;
  --amber-700: #b27708;
  --amber-100: #fff1c5;
  --red-700: #be4150;
  --red-100: #fee8ea;
  --ink: #1d344a;
  --muted: #708595;
  --line: #d9e5ee;
  --surface: rgba(255,255,255,.94);
  --surface-solid: #ffffff;
  --shadow: 0 20px 45px rgba(18, 63, 103, .10);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 100% 0%, rgba(39,161,108,.12), transparent 28%),
    radial-gradient(circle at 0% 12%, rgba(45,123,187,.14), transparent 30%),
    linear-gradient(180deg, #eff5f8 0%, #f7fbfd 100%);
  min-height: 100vh;
}
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.page-shell { width: min(1560px, calc(100% - 32px)); margin: 0 auto; padding: 22px 0 36px; }

.topbar {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) auto;
  gap: 26px;
  align-items: center;
  padding: 22px 24px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(216,228,236,.95);
  border-radius: 26px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; }
.brand img { display: block; width: 220px; max-width: 100%; height: auto; }
.heading-block h1 {
  margin: 0;
  color: var(--blue-950);
  font-size: clamp(28px, 2.3vw, 38px);
  line-height: 1.05;
  letter-spacing: -.05em;
}
.heading-block p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.eyebrow {
  color: var(--green-700);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green-600); box-shadow: 0 0 0 5px rgba(39,161,108,.12); }
.actions { display: flex; align-items: center; gap: 12px; }
.sync-box {
  min-width: 150px;
  border-right: 1px solid var(--line);
  padding-right: 16px;
  text-align: right;
}
.sync-box span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
}
.sync-box strong { display: block; margin-top: 5px; color: var(--blue-800); font-size: 13px; }
.refresh-btn, .secondary-btn {
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue-800), var(--blue-700));
  color: #fff;
  font-weight: 800;
  padding: 12px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 10px 24px rgba(22,95,158,.20);
}
.refresh-btn.loading .refresh-icon { animation: spin .8s linear infinite; }

.hero-strip {
  margin: 22px 0 18px;
  padding: 28px 30px;
  border-radius: 24px;
  background: linear-gradient(110deg, rgba(11,47,81,.98), rgba(22,95,158,.96) 66%, rgba(39,161,108,.90));
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  box-shadow: 0 24px 48px rgba(11,47,81,.18);
  position: relative;
  overflow: hidden;
}
.hero-strip::after {
  content: "";
  position: absolute;
  right: -90px;
  top: -130px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  border: 36px solid rgba(255,255,255,.08);
}
.hero-kicker { display: block; font-size: 11px; letter-spacing: .12em; font-weight: 800; opacity: .82; }
.hero-strip h2 { margin: 8px 0 8px; font-size: clamp(26px, 3vw, 40px); letter-spacing: -.05em; }
.hero-strip p { margin: 0; opacity: .84; max-width: 760px; font-size: 14px; }
.auto-refresh {
  min-width: 220px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255,255,255,.11);
  border: 1px solid rgba(255,255,255,.16);
  position: relative;
  z-index: 1;
}
.auto-refresh span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; opacity: .82; }
.auto-refresh strong { display: block; margin-top: 5px; font-size: 24px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 18px; }
.stat-card {
  width: 100%;
  position: relative;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px 18px 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  box-shadow: 0 12px 30px rgba(23,64,101,.06);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: linear-gradient(180deg, var(--blue-700), var(--green-600));
  opacity: .45;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 18px 36px rgba(23,64,101,.10); }
.stat-card.active { border-color: #9cc9b3; box-shadow: 0 0 0 3px rgba(39,161,108,.10), 0 16px 36px rgba(23,64,101,.12); }
.stat-card.active::before { opacity: 1; }
.stat-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 18px; font-weight: 800; flex: 0 0 auto; }
.stat-icon.blue { background: var(--blue-100); color: var(--blue-700); }
.stat-icon.green, .stat-icon.mint { background: var(--green-100); color: var(--green-700); }
.stat-icon.amber { background: var(--amber-100); color: var(--amber-700); }
.stat-card span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
.stat-card strong { display: block; margin-top: 3px; color: var(--blue-950); font-size: 26px; letter-spacing: -.05em; }

.controls-card {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 12px 28px rgba(23,64,101,.05);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
  margin-bottom: 18px;
}
.control-label, .search-wrap label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
  margin-bottom: 8px;
}
.month-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.month-tab {
  border: 1px solid #c3d5e2;
  background: var(--blue-50);
  color: var(--blue-800);
  padding: 11px 18px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 13px;
  transition: .18s ease;
}
.month-tab.active { background: linear-gradient(135deg, var(--blue-800), var(--blue-700)); color: #fff; border-color: var(--blue-800); box-shadow: 0 10px 22px rgba(22,95,158,.18); }
.search-wrap { flex: 0 0 320px; }
.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfe;
  padding: 0 12px;
}
.search-field span { color: var(--blue-700); font-size: 20px; }
.search-field input { border: 0; outline: 0; background: transparent; width: 100%; height: 42px; color: var(--ink); }

.workspace {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #f8fbff 0%, #fdfefe 75%, #f3fbf7 100%);
}
.panel-kicker { display: block; color: var(--green-700); font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; margin-bottom: 6px; }
.panel-header h3 { margin: 0; color: var(--blue-950); font-size: clamp(24px, 2vw, 30px); letter-spacing: -.04em; }
.panel-header p { margin: 8px 0 0; color: var(--muted); font-size: 13px; max-width: 760px; }
.panel-meta { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.panel-chip {
  border-radius: 999px;
  padding: 10px 12px;
  background: var(--blue-100);
  color: var(--blue-800);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.panel-chip.subtle { background: var(--green-100); color: var(--green-700); }
.panel-body { padding: 22px 24px 24px; }

.mini-kpis { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }
.mini-kpi {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  padding: 16px 18px;
}
.mini-kpi span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
.mini-kpi strong { display: block; margin-top: 6px; color: var(--blue-950); font-size: 22px; letter-spacing: -.03em; }

.overview-layout { display: grid; grid-template-columns: minmax(0, 1.9fr) 360px; gap: 18px; align-items: start; }
.subsection-heading { margin-bottom: 14px; }
.subsection-heading.compact { margin-bottom: 10px; }
.subsection-heading h4 { margin: 0; color: var(--blue-950); font-size: 20px; letter-spacing: -.03em; }
.subsection-heading p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.profiles-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.profile-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fafdfd 100%);
  padding: 16px;
  box-shadow: 0 10px 22px rgba(23,64,101,.04);
}
.profile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.profile-top h4 { margin: 0; font-size: 18px; color: var(--blue-950); line-height: 1.15; letter-spacing: -.03em; }
.profile-subtitle { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.profile-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.profile-tag { border-radius: 999px; padding: 5px 8px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.profile-tag.dark { background: #183247; color: #fff; }
.profile-tag.soft { background: var(--amber-100); color: var(--amber-700); }
.profile-tag.red { background: var(--red-100); color: var(--red-700); }
.profile-metrics { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-bottom: 12px; }
.profile-metrics span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.profile-metrics strong { display: block; margin-top: 4px; color: var(--blue-950); font-size: 13px; line-height: 1.3; }
.profile-footer { border-top: 1px solid #eef2f5; padding-top: 10px; color: var(--muted); font-size: 11px; }

.side-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #fbfdff 0%, #f8fcfb 100%);
  padding: 16px;
  height: 100%;
}
.compact-week-list { display: grid; gap: 10px; }
.compact-week-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 8px 12px;
  padding: 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #e9eff4;
}
.compact-code { color: var(--blue-800); font-size: 18px; font-weight: 800; align-self: start; }
.compact-title { color: var(--blue-950); font-weight: 700; }
.compact-note { color: var(--muted); font-size: 12px; grid-column: 2; }

.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.week-summary-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  padding: 16px;
}
.week-summary-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.week-summary-code { color: var(--blue-800); font-size: 20px; font-weight: 800; letter-spacing: -.03em; }
.week-summary-badge { border-radius: 999px; background: var(--green-100); color: var(--green-700); padding: 6px 9px; font-size: 10px; font-weight: 800; }
.week-summary-card h4 { margin: 0; color: var(--blue-950); font-size: 17px; letter-spacing: -.03em; }
.week-summary-card > p { margin: 6px 0 14px; color: var(--muted); font-size: 12px; }
.week-summary-details { display: grid; gap: 10px; }
.week-summary-details span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
.week-summary-details strong { display: block; margin-top: 4px; color: var(--blue-950); font-size: 13px; }

.emergency-panel-app { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.emergency-table { display: grid; }
.emergency-row {
  display: grid;
  grid-template-columns: 90px minmax(220px, 1fr) minmax(260px, 1.2fr);
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border-top: 1px solid #edf2f5;
}
.emergency-row:first-child { border-top: 0; }
.emergency-code { color: var(--blue-700); font-size: 28px; font-weight: 800; letter-spacing: -.04em; }
.emergency-dates { color: #657a89; font-size: 14px; font-weight: 600; }
.emergency-person { justify-self: end; text-align: right; color: var(--blue-950); font-size: 14px; line-height: 1.55; }
.emergency-person strong { font-weight: 800; position: relative; }
.emergency-person strong::before { content: '✦ '; color: var(--blue-700); }

.table-shell { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.turnos-table { width: 100%; border-collapse: collapse; min-width: 880px; }
.turnos-table.compact { min-width: 760px; }
.turnos-table th {
  text-align: left;
  padding: 12px 14px;
  background: #f8fbfd;
  border-bottom: 1px solid var(--line);
  color: var(--blue-800);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.turnos-table td { padding: 12px 14px; border-bottom: 1px solid #edf2f5; font-size: 12px; vertical-align: middle; }
.turnos-table tbody tr:last-child td { border-bottom: 0; }
.turnos-table tbody tr:hover { background: #fbfdff; }
.agent-cell { font-weight: 800; color: var(--blue-950); }
.table-week-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  border-radius: 999px;
  padding: 6px 8px;
  background: var(--blue-100);
  color: var(--blue-800);
  font-weight: 800;
  font-size: 11px;
}
.badge { display: inline-flex; align-items: center; justify-content: center; gap: 5px; border-radius: 999px; padding: 6px 9px; font-size: 10px; font-weight: 800; line-height: 1.25; }
.badge-blue { background: var(--blue-100); color: var(--blue-800); }
.badge-green { background: var(--green-100); color: var(--green-700); }
.badge-amber { background: var(--amber-100); color: var(--amber-700); }
.badge-red { background: var(--red-100); color: var(--red-700); }
.badge-neutral { background: #eef3f6; color: #647987; }
.muted-value { color: #9aacb8; }

.app-empty, .state-card {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 12px 30px rgba(23,64,101,.05);
  color: var(--muted);
  padding: 30px;
}
.state-card strong, .app-empty strong { color: var(--blue-950); font-size: 18px; }
.state-card span, .app-empty span { max-width: 620px; font-size: 13px; line-height: 1.5; }
.spinner { width: 36px; height: 36px; border: 4px solid #ddeaf4; border-top-color: var(--blue-700); border-radius: 50%; animation: spin .85s linear infinite; margin-bottom: 5px; }
.error-mark, .empty-mark { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; font-size: 20px; }
.error-mark { background: var(--red-100); color: var(--red-700); }
.empty-mark { background: var(--blue-100); color: var(--blue-700); }
.secondary-btn { margin-top: 8px; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 4px 0;
  color: #8294a2;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1280px) {
  .overview-layout { grid-template-columns: 1fr; }
  .profiles-grid, .summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 1080px) {
  .topbar { grid-template-columns: 200px 1fr; }
  .brand img { width: 180px; }
  .actions { grid-column: 1 / -1; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 12px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .mini-kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .panel-header { flex-direction: column; }
  .panel-meta { justify-content: flex-start; }
  .emergency-row { grid-template-columns: 80px 1fr; }
  .emergency-person { grid-column: 1 / -1; justify-self: start; text-align: left; }
}
@media (max-width: 780px) {
  .page-shell { width: min(100% - 18px, 1560px); padding-top: 10px; }
  .topbar { display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding: 16px; }
  .brand { justify-content: center; }
  .brand img { width: 205px; }
  .heading-block { text-align: center; }
  .eyebrow { justify-content: center; }
  .actions { border-top: 1px solid var(--line); justify-content: space-between; }
  .sync-box { text-align: left; border-right: 0; padding-right: 0; }
  .refresh-btn span:last-child { display: none; }
  .hero-strip { flex-direction: column; align-items: flex-start; padding: 22px; }
  .auto-refresh { width: 100%; min-width: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .controls-card { flex-direction: column; align-items: stretch; }
  .search-wrap { flex: 1 1 auto; width: 100%; }
  .mini-kpis, .profiles-grid, .summary-grid { grid-template-columns: 1fr; }
  .profile-metrics { grid-template-columns: 1fr; }
  .compact-week-row { grid-template-columns: 1fr; }
  .compact-note { grid-column: auto; }
  footer { flex-direction: column; text-align: center; }
}

/* ===== Vista general: calendario semanal ===== */
.calendar-kpis { grid-template-columns: repeat(4, minmax(0,1fr)); }
.calendar-section {
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}
.calendar-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 15px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #f7fbff 0%, #ffffff 68%, #f1fbf6 100%);
}
.calendar-heading h4 { font-size: 22px; }
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.calendar-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.legend-dot.normal { background: #9bb9cf; }
.legend-dot.emergency { background: #e5aa2d; box-shadow: 0 0 0 3px rgba(229,170,45,.15); }
.legend-dot.leave { background: var(--green-600); box-shadow: 0 0 0 3px rgba(39,161,108,.12); }

.weekly-calendar-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #b9ccda #eef4f7;
}
.weekly-calendar {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.weekly-calendar th,
.weekly-calendar td {
  border-right: 1px solid #e8eff4;
  border-bottom: 1px solid #e8eff4;
  vertical-align: top;
}
.weekly-calendar tr:last-child th,
.weekly-calendar tr:last-child td { border-bottom: 0; }
.weekly-calendar th:last-child,
.weekly-calendar td:last-child { border-right: 0; }
.calendar-corner {
  position: sticky;
  left: 0;
  z-index: 5;
  width: 190px;
  min-width: 190px;
  padding: 16px 15px;
  background: #eef5fa;
  color: var(--blue-900);
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.calendar-week-head {
  width: 205px;
  min-width: 205px;
  padding: 14px 14px 13px;
  background: linear-gradient(180deg, #f7fbfe 0%, #f0f7fb 100%);
  text-align: left;
}
.calendar-week-head:nth-child(even) { background: linear-gradient(180deg, #f5fbf8 0%, #eef8f3 100%); }
.calendar-week-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: var(--blue-800);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
}
.calendar-week-head strong {
  display: block;
  color: var(--blue-950);
  font-size: 12px;
  line-height: 1.35;
}
.calendar-week-head small {
  display: block;
  margin-top: 7px;
  color: var(--green-700);
  font-size: 10px;
  line-height: 1.35;
  font-weight: 700;
}
.calendar-agent-head {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 190px;
  min-width: 190px;
  padding: 15px;
  background: #fff;
  text-align: left;
  box-shadow: 8px 0 18px rgba(26,71,108,.03);
}
.calendar-agent-head strong {
  display: block;
  color: var(--blue-950);
  font-size: 13px;
  line-height: 1.25;
}
.calendar-agent-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.calendar-cell {
  padding: 13px;
  background: #fff;
  transition: background .15s ease, box-shadow .15s ease;
}
.calendar-cell:hover { background: #fafdff; box-shadow: inset 0 0 0 1px rgba(45,123,187,.12); }
.calendar-cell.has-emergency {
  background: linear-gradient(180deg, #fffaf0 0%, #fffdf8 100%);
  box-shadow: inset 4px 0 0 #e5aa2d;
}
.calendar-cell.has-leave {
  background: linear-gradient(180deg, #f4fbf7 0%, #fbfefc 100%);
  box-shadow: inset 4px 0 0 var(--green-600);
}
.calendar-cell.has-emergency.has-leave {
  background: linear-gradient(135deg, #fffaf0 0%, #f4fbf7 100%);
  box-shadow: inset 4px 0 0 #e5aa2d, inset -4px 0 0 var(--green-600);
}
.calendar-cell-empty {
  text-align: center;
  color: #b2c0ca;
  background: #fafcfd;
  vertical-align: middle !important;
}
.calendar-cell-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}
.calendar-time {
  color: var(--blue-950);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 800;
}
.calendar-flags { display: flex; gap: 5px; flex: 0 0 auto; }
.calendar-flag {
  width: 23px;
  height: 23px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
}
.calendar-flag.emergency { background: var(--amber-100); color: var(--amber-700); }
.calendar-flag.leave { background: var(--green-100); color: var(--green-700); }
.calendar-detail {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 6px;
  align-items: baseline;
  margin-top: 6px;
}
.calendar-detail span {
  color: #8b9aa5;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
}
.calendar-detail strong {
  color: #526a7d;
  font-size: 10px;
  line-height: 1.3;
  font-weight: 700;
}
.calendar-leave-note {
  margin-top: 9px;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(39,161,108,.10);
  color: var(--green-700);
  font-size: 10px;
  line-height: 1.35;
  font-weight: 700;
}

@media (max-width: 1080px) {
  .calendar-kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .calendar-heading { align-items: flex-start; flex-direction: column; }
  .calendar-legend { justify-content: flex-start; }
}
@media (max-width: 780px) {
  .calendar-kpis { grid-template-columns: 1fr 1fr; }
  .calendar-heading { padding: 16px; }
  .weekly-calendar { min-width: 1040px; }
  .calendar-corner, .calendar-agent-head { width: 165px; min-width: 165px; }
  .calendar-week-head { width: 175px; min-width: 175px; }
}

/* ===== Refinamiento corporativo: celdas más definidas ===== */
.panel-body {
  background: #f8fbfd;
}

.calendar-section,
.defined-table-shell,
.table-shell {
  border: 1px solid #cddbe6;
  box-shadow: 0 8px 20px rgba(24,63,99,.05);
}

.weekly-calendar {
  border-collapse: separate;
  border-spacing: 0;
}

.weekly-calendar th,
.weekly-calendar td {
  border-right: 1px solid #cfdce6;
  border-bottom: 1px solid #cfdce6;
}

.calendar-corner {
  background: #e6f0f7;
  border-right: 1px solid #bfcfdb !important;
  border-bottom: 1px solid #bfcfdb !important;
}

.calendar-week-head {
  background: linear-gradient(180deg, #f5f9fc 0%, #eaf3f8 100%);
  border-bottom: 1px solid #bfcfdb !important;
  padding: 16px 15px 14px;
}

.calendar-week-head:nth-child(even) {
  background: linear-gradient(180deg, #f1f9f5 0%, #e6f4ed 100%);
}

.calendar-agent-head {
  background: #fbfdff;
  border-right: 1px solid #bfcfdb !important;
  padding: 16px 15px;
}

.calendar-agent-head strong {
  font-size: 13.5px;
}

.calendar-cell {
  padding: 10px;
  background: #ffffff;
}

.calendar-cell:nth-child(even) {
  background: #fcfeff;
}

.calendar-cell-top {
  min-height: 24px;
  margin-bottom: 8px;
}

.calendar-flags {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.calendar-flag {
  width: auto;
  height: 24px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 9px;
  letter-spacing: .01em;
}

.calendar-cell-grid {
  display: grid;
  grid-template-columns: 1fr;
  border: 1px solid #d7e2ea;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.calendar-field {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 9px;
  border-top: 1px solid #e3ebf0;
}

.calendar-field:first-child {
  border-top: 0;
}

.calendar-field.primary {
  background: #f4f9fd;
}

.calendar-field span {
  color: #8193a1;
  font-size: 8.5px;
  line-height: 1.2;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .055em;
}

.calendar-field strong {
  color: #29485f;
  font-size: 10.5px;
  line-height: 1.3;
  font-weight: 750;
}

.calendar-field.primary strong {
  color: var(--blue-950);
  font-size: 11.5px;
}

.calendar-leave-note {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 7px;
  align-items: start;
  border: 1px solid #bfe2cf;
  background: #edf9f3;
  border-radius: 9px;
  padding: 8px 9px;
}

.calendar-leave-note span {
  color: #53826b;
  font-size: 8px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: .05em;
}

.calendar-leave-note strong {
  color: var(--green-700);
  font-size: 9.5px;
  line-height: 1.35;
}

.calendar-cell.has-emergency {
  background: #fffdf7;
  box-shadow: inset 4px 0 0 #e5aa2d;
}

.calendar-cell.has-leave {
  background: #fbfefc;
  box-shadow: inset 4px 0 0 var(--green-600);
}

.calendar-cell.has-emergency.has-leave {
  box-shadow: inset 4px 0 0 #e5aa2d, inset -4px 0 0 var(--green-600);
}

/* Tablas de las vistas Semanas / Emergencias / Permisos */
.defined-table-shell {
  width: 100%;
  overflow-x: auto;
  border-radius: 16px;
  background: #fff;
}

.defined-table {
  width: 100%;
  min-width: 880px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.defined-table th,
.defined-table td {
  border-right: 1px solid #d5e0e8;
  border-bottom: 1px solid #d5e0e8;
}

.defined-table th:last-child,
.defined-table td:last-child {
  border-right: 0;
}

.defined-table tbody tr:last-child td {
  border-bottom: 0;
}

.defined-table th {
  padding: 12px 14px;
  background: linear-gradient(180deg, #eef5fa 0%, #e7f0f6 100%);
  color: var(--blue-900);
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 800;
}

.defined-table th:nth-child(even) {
  background: linear-gradient(180deg, #eff8f4 0%, #e8f4ee 100%);
}

.defined-table td {
  padding: 14px;
  background: #fff;
  color: #4a6274;
  font-size: 12px;
  vertical-align: middle;
}

.defined-table tbody tr:nth-child(even) td {
  background: #fbfdfe;
}

.defined-table tbody tr:hover td {
  background: #f7fbfd;
}

.cell-code {
  width: 90px;
  text-align: center;
}

.cell-period {
  width: 31%;
}

.cell-period strong {
  color: var(--blue-950);
  font-size: 12.5px;
}

.cell-center {
  text-align: center;
}

.cell-emergency {
  width: 32%;
}

.cell-status {
  text-align: center;
}

.count-cell {
  display: inline-flex;
  min-width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--blue-100);
  color: var(--blue-800);
  font-weight: 800;
}

.count-cell.green {
  background: var(--green-100);
  color: var(--green-700);
}

.name-chip {
  display: inline-flex;
  align-items: center;
  margin: 3px 5px 3px 0;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 750;
  line-height: 1.25;
}

.emergency-name {
  color: #77560c;
  background: #fff4cf;
  border: 1px solid #f1d888;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 118px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

.status-pill.active {
  background: var(--green-100);
  color: var(--green-700);
  border: 1px solid #c4e6d4;
}

.status-pill.pending {
  background: #f0f3f5;
  color: #788a97;
  border: 1px solid #dce4e9;
}

.status-empty {
  color: #9aaaB6;
  font-style: italic;
  font-size: 11px;
}

/* Permisos / vacaciones: bordes verticales más visibles */
.turnos-table th,
.turnos-table td {
  border-right: 1px solid #d5e0e8;
}

.turnos-table th:last-child,
.turnos-table td:last-child {
  border-right: 0;
}

.turnos-table th {
  background: linear-gradient(180deg, #eef5fa 0%, #e8f1f7 100%);
}

.table-shell {
  border-color: #cddbe6;
}

@media (max-width: 780px) {
  .calendar-field {
    grid-template-columns: 56px 1fr;
  }
  .defined-table {
    min-width: 760px;
  }
}

/* ===== Tarjetas de contenido con tablas más definidas ===== */
.content-section-card {
  border: 1px solid #c9d8e4;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 12px 28px rgba(20,56,92,.06);
}

.content-section-head {
  padding: 18px 20px 16px;
  border-bottom: 1px solid #d9e4ec;
  background: linear-gradient(90deg, #f6fbff 0%, #ffffff 70%, #f0faf5 100%);
}

.content-section-kicker {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--green-700);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .10em;
}

.content-section-head h4 {
  margin: 0;
  color: var(--blue-950);
  font-size: 24px;
  letter-spacing: -.03em;
}

.content-section-head p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.content-section-card .defined-table-shell {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.defined-table {
  min-width: 960px;
}

.defined-table th,
.defined-table td {
  border-right: 1px solid #cfdae3;
  border-bottom: 1px solid #cfdae3;
}

.defined-table thead th {
  padding: 14px 15px;
  background: linear-gradient(180deg, #eaf2f8 0%, #e3edf5 100%);
  color: #27435b;
  font-size: 10px;
  letter-spacing: .08em;
  font-weight: 800;
}

.defined-table thead th:nth-child(even) {
  background: linear-gradient(180deg, #edf7f2 0%, #e5f1eb 100%);
}

.defined-table tbody td {
  padding: 14px 15px;
  background: #fff;
  font-size: 12px;
  line-height: 1.45;
}

.defined-table tbody tr:nth-child(even) td {
  background: #fbfdff;
}

.defined-table tbody tr:hover td {
  background: #f6fbfe;
}

.leave-defined-table td:last-child {
  min-width: 260px;
}

.leave-defined-table .badge {
  justify-content: flex-start;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 10.5px;
}

.content-section-card + .content-section-card {
  margin-top: 16px;
}
