/* agenda.css - reglas especificas de Agenda */

/* controles (fecha, buscador, boton registrar) */
.agenda-save-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(2px);
  pointer-events: auto;
}

.agenda-save-overlay[hidden] {
  display: none;
}

/* El progreso lo muestra el boton (saveFx): el overlay solo bloquea clics. */
.agenda-save-overlay.is-silent {
  background: transparent;
  backdrop-filter: none;
  cursor: progress;
}

.agenda-save-overlay.is-silent .agenda-save-overlay-card {
  display: none;
}

.agenda-save-overlay-card {
  min-width: 280px;
  max-width: min(92vw, 420px);
  padding: 20px 22px;
  border-radius: 16px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  background: var(--bg-white, #fff);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  display: flex;
  align-items: center;
  gap: 14px;
}

.agenda-save-overlay-spinner {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 3px solid rgba(37, 99, 235, 0.18);
  border-top-color: #2563eb;
  animation: agenda-save-spin 0.85s linear infinite;
  flex: 0 0 auto;
}

.agenda-save-overlay-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  letter-spacing: 0.01em;
}

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

body.agenda-save-busy {
  overflow: hidden;
}

.agenda-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  max-width: 100%;
}

.agenda-controls input[type="date"],
.agenda-controls input[type="text"],
.agenda-controls input[type="search"] {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #e5e7eb);
  background: var(--bg-white, #fff);
}

.agenda-toggle-numeracion,
.agenda-toggle-sms,
.agenda-toggle-llamada,
.agenda-toggle-presente {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted, #64748b);
  user-select: none;
}

.agenda-toggle-numeracion input[type="checkbox"],
.agenda-toggle-sms input[type="checkbox"],
.agenda-toggle-llamada input[type="checkbox"],
.agenda-toggle-presente input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #2563eb;
}

.agenda-controls .autofill-trap {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.agenda-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border-color, #d8e0ea);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.92);
}

.agenda-view-btn {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted, #64748b);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.agenda-view-btn .agenda-action-icon {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.agenda-view-btn:hover {
  color: var(--text-color, #0f172a);
  background: rgba(226, 232, 240, 0.68);
}

.agenda-view-btn.is-active {
  background: var(--success, #16a34a);
  border-color: var(--success, #16a34a);
  color: #fff;
  box-shadow: 0 5px 14px rgba(22, 163, 74, 0.18);
}

.agenda-view-btn.is-active:hover {
  background: var(--success-hover, #15803d);
  color: #fff;
  transform: translateY(-1px);
}

.agenda-btn-reprogramar-pegar {
  background: #0f766e;
}

.agenda-btn-reprogramar-cancelar {
  background: #b91c1c;
}

.agenda-controls .btn-cobrar:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.1);
}

.agenda-search-scope-alert {
  margin-top: 8px;
  margin-bottom: 6px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid #ef4444;
  background: #fee2e2;
  color: #991b1b;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.agenda-filter-estado-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.agenda-reprograma-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
}

body.agenda-ina-open {
  overflow: hidden;
}

body.agenda-day-summary-open {
  overflow: hidden;
}

.agenda-btn-inasistencia {
  background: #92400e;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.agenda-btn-inasistencia .agenda-action-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  pointer-events: none;
}

.agenda-btn-inasistencia:hover {
  background: #78350f;
}

.agenda-btn-day-summary {
  background: #0f766e;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.agenda-btn-day-summary .agenda-action-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  pointer-events: none;
}

.agenda-btn-day-summary:hover {
  background: #0f5f59;
}

.agenda-ina-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: block;
}

.agenda-ina-modal[hidden] {
  display: none !important;
}

.agenda-ina-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.agenda-ina-dialog {
  position: relative;
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 56px);
  margin: 28px auto;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #d9e2ec;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.26);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.agenda-ina-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.agenda-ina-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text-main, #0f172a);
}

.agenda-ina-close-btn {
  background: #334155;
}

.agenda-ina-close-btn:hover {
  background: #1e293b;
}

.agenda-ina-meta {
  padding: 8px 16px 0;
  color: var(--text-muted, #64748b);
  font-size: 12px;
  font-weight: 600;
}

.agenda-ina-kpis {
  padding: 10px 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.agenda-ina-kpi {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 8px;
  padding: 8px 10px;
}

.agenda-ina-kpi.is-muted {
  border-color: #e2e8f0;
  background: #f8fafc;
}

.agenda-ina-kpi span {
  display: block;
  font-size: 12px;
  color: #475569;
}

.agenda-ina-kpi strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  line-height: 1;
  color: #0f172a;
}

.agenda-ina-status {
  min-height: 24px;
  padding: 0 16px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.agenda-ina-status.is-muted {
  color: #64748b;
}

.agenda-ina-status.is-info {
  color: #1d4ed8;
}

.agenda-ina-status.is-success {
  color: #047857;
}

.agenda-ina-status.is-error {
  color: #b91c1c;
}

.agenda-ina-toolbar {
  padding: 0 16px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.agenda-ina-select-all {
  background: #2563eb;
}

.agenda-ina-select-all:hover {
  background: #1d4ed8;
}

.agenda-ina-clear-all {
  background: #6b7280;
}

.agenda-ina-clear-all:hover {
  background: #4b5563;
}

.agenda-ina-apply {
  background: #b91c1c;
}

.agenda-ina-apply:hover {
  background: #991b1b;
}

.agenda-day-summary-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: block;
}

.agenda-day-summary-modal[hidden] {
  display: none !important;
}

.agenda-day-summary-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.agenda-day-summary-dialog {
  position: relative;
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 56px);
  margin: 28px auto;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #d9e2ec;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.26);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.agenda-day-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.agenda-day-summary-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text-main, #0f172a);
}

.agenda-day-summary-close-btn {
  background: #334155;
}

.agenda-day-summary-close-btn:hover {
  background: #1e293b;
}

.agenda-day-summary-meta {
  padding: 8px 16px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  color: var(--text-muted, #64748b);
  font-size: 12px;
  font-weight: 600;
}

.agenda-day-summary-kpis-wrap {
  padding: 10px 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.agenda-day-summary-kpi {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 8px;
  padding: 8px 10px;
}

.agenda-day-summary-kpi.is-muted {
  border-color: #e2e8f0;
  background: #f8fafc;
}

.agenda-day-summary-kpi span {
  display: block;
  font-size: 12px;
  color: #475569;
}

.agenda-day-summary-kpi strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  line-height: 1;
  color: #0f172a;
}

.agenda-day-summary-estados {
  padding: 0 16px 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.agenda-day-summary-estado {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 8px;
  padding: 8px 10px;
}

.agenda-day-summary-estado span {
  display: block;
  font-size: 12px;
  color: #475569;
}

.agenda-day-summary-estado strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  line-height: 1;
  color: #0f172a;
}

.agenda-day-summary-estado.is-highlight.is-confirmado {
  border-color: #86efac;
  background: #ecfdf5;
}

.agenda-day-summary-estado.is-highlight.is-cancelado {
  border-color: #fca5a5;
  background: #fef2f2;
}

.agenda-day-summary-estado.is-highlight.is-reprogramado {
  border-color: #c4b5fd;
  background: #f3e8ff;
}

.agenda-day-summary-empty {
  margin: 0;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  color: #64748b;
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  font-weight: 600;
}

.agenda-day-summary-view-toggle {
  margin: 0 16px 12px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.agenda-day-summary-view-btn {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.agenda-day-summary-view-btn:hover {
  border-color: #93c5fd;
  color: #1e3a8a;
}

.agenda-day-summary-view-btn.is-active {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1e3a8a;
}

.agenda-day-summary-treatment-wrap {
  margin: 0 16px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: auto;
}

.agenda-day-summary-treatment-table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
  table-layout: fixed;
}

.agenda-day-summary-treatment-table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #334155;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 10px;
  text-align: left;
}

.agenda-day-summary-treatment-table tbody td {
  border-bottom: 1px solid #eef2f7;
  padding: 8px 10px;
  font-size: 12px;
  color: #1f2937;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.agenda-day-summary-treatment-table tbody tr:last-child td {
  border-bottom: none;
}

.agenda-day-summary-hours-wrap {
  margin: 0 16px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: auto;
}

.agenda-day-summary-hours-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  table-layout: fixed;
}

.agenda-day-summary-hours-table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #334155;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 10px;
  text-align: left;
}

.agenda-day-summary-hours-table tbody td {
  border-bottom: 1px solid #eef2f7;
  padding: 8px 10px;
  font-size: 12px;
  color: #1f2937;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.agenda-day-summary-hours-table tbody tr:last-child td {
  border-bottom: none;
}

.agenda-day-summary-hours-table tbody tr.is-no-hour td {
  background: #fff7ed;
  color: #9a3412;
}

.agenda-ina-toolbar .btn-cobrar:disabled,
.agenda-ina-close-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.15);
}

.agenda-ina-table-wrap {
  margin: 0 16px 16px;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 10px;
  overflow: auto;
  background: #fff;
}

.agenda-ina-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 12px;
}

.agenda-ina-table thead th {
  text-align: left;
  background: #f1f5f9;
  color: #334155;
  border-bottom: 1px solid #cbd5e1;
  padding: 8px 10px;
}

.agenda-ina-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  color: #0f172a;
}

.agenda-ina-table tbody tr:last-child td {
  border-bottom: none;
}

.agenda-ina-check {
  width: 14px;
  height: 14px;
  accent-color: #b91c1c;
}

.agenda-month-view {
  margin-top: 14px;
  border: 1px solid var(--border-color, #d8e0ea);
  border-radius: 8px;
  background: var(--bg-white, #fff);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  transform-origin: top center;
}

.agenda-month-view[hidden] {
  display: none !important;
}

.agenda-month-view.is-entering {
  animation: agenda-month-enter 0.34s ease both;
}

@keyframes agenda-month-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.agenda-month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--border-color, #d8e0ea);
  background: rgba(248, 250, 252, 0.72);
}

.agenda-month-header h2 {
  margin: 0;
  color: var(--text-color, #0f172a);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0;
}

.agenda-month-header p {
  margin: 4px 0 0;
  color: var(--text-muted, #64748b);
  font-size: 12px;
  font-weight: 700;
}

.agenda-month-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.agenda-month-nav-btn,
.agenda-month-today-btn {
  min-width: 34px;
  min-height: 34px;
  border: 1px solid var(--border-color, #d8e0ea);
  border-radius: 8px;
  background: var(--bg-white, #fff);
  color: var(--text-color, #0f172a);
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.agenda-month-today-btn {
  padding: 0 12px;
  color: var(--success, #16a34a);
}

.agenda-month-nav-btn:hover,
.agenda-month-today-btn:hover {
  transform: translateY(-1px);
  border-color: var(--success, #16a34a);
  background: rgba(220, 252, 231, 0.72);
}

.agenda-month-total {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(22, 163, 74, 0.24);
  background: rgba(220, 252, 231, 0.78);
  color: #047857;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.agenda-month-weekdays,
.agenda-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.agenda-month-weekdays {
  padding: 10px 12px 8px;
  gap: 8px;
  color: var(--text-muted, #64748b);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.agenda-month-grid {
  gap: 8px;
  padding: 0 12px 14px;
}

.agenda-month-day {
  position: relative;
  min-height: 108px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: #fff;
  color: var(--text-color, #0f172a);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 4px;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
  /* Sin animacion fija: se animaba en CADA pintado (doble "pop" al cargar el mes).
     Ahora la pone agenda.js segun el caso (fx-cell-in de tableFx / fx-month-changed). */
}

/* Mes cargando: skeleton en vez de "0 tratamientos" */
.agenda-month-day.is-loading {
  cursor: progress;
}

.agenda-month-sk {
  background: linear-gradient(90deg, #edf2f7 0%, #f8fafc 40%, #edf2f7 80%) !important;
  background-size: 300% 100% !important;
  color: transparent !important;
  animation: agenda-month-sk 1.3s ease-in-out infinite;
}

.agenda-month-sk-line {
  width: 70px;
  height: 10px;
  border-radius: 6px;
}

@keyframes agenda-month-sk {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}

.dark-mode .agenda-month-sk {
  background: linear-gradient(90deg, #1e293b 0%, #273449 40%, #1e293b 80%) !important;
  background-size: 300% 100% !important;
}

/* Busqueda/filtro en vista mes: el conteo que cambia hace "pop" */
.agenda-month-count.fx-month-changed {
  animation: agenda-month-count-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes agenda-month-count-pop {
  40% { transform: scale(1.25); }
}

@media (prefers-reduced-motion: reduce) {
  .agenda-month-sk,
  .agenda-month-count.fx-month-changed {
    animation: none;
  }
}

.agenda-month-day.is-empty {
  min-height: 108px;
  border-style: dashed;
  background: rgba(248, 250, 252, 0.62);
}

.agenda-month-day.has-items {
  cursor: pointer;
  border-color: rgba(22, 163, 74, 0.34);
  background: rgba(240, 253, 244, 0.84);
}

.agenda-month-day.has-items:hover {
  transform: translateY(-2px);
  border-color: var(--success, #16a34a);
  box-shadow: 0 10px 18px rgba(22, 163, 74, 0.14);
}

.agenda-month-day:not(.has-items):not(.is-empty):hover {
  transform: translateY(-2px);
  border-color: #2563eb;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.12);
}

.agenda-month-day.is-selected {
  border-color: #2563eb;
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.16);
}

.agenda-month-day.is-today::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #2563eb;
}

.agenda-month-day-number {
  color: var(--text-color, #0f172a);
  font-size: 16px;
  font-weight: 900;
}

.agenda-month-count {
  justify-self: start;
  min-width: 32px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--success, #16a34a);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.agenda-month-day:not(.has-items) .agenda-month-count {
  background: #e5e7eb;
  color: #64748b;
}

.agenda-month-count-label {
  color: var(--text-muted, #64748b);
  font-size: 11px;
  font-weight: 800;
}

.agenda-month-samples {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-self: end;
}

.agenda-month-samples em {
  min-width: 0;
  color: #166534;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-month-status {
  padding: 0 16px 14px;
  color: var(--text-muted, #64748b);
  font-size: 12px;
  font-weight: 800;
}

.agenda-month-status[hidden] {
  display: none !important;
}

.agenda-month-status.is-error {
  color: #dc2626;
}

.agenda-month-status.is-loading::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-top-color: #2563eb;
  border-radius: 999px;
  display: inline-block;
  vertical-align: -1px;
  animation: agenda-save-spin 0.75s linear infinite;
}

/* area de tabla con scroll interno */
.agenda-table-wrap {
  overflow-y: auto;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin-top: 12px;
  transform-origin: top center;
}

.agenda-table-wrap.is-entering {
  animation: agenda-table-enter 0.28s ease both;
}

@keyframes agenda-table-enter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* tabla */
.agenda-table {
  min-width: 940px;
  font-size: 12px;
}

.agenda-table thead th,
.agenda-table tbody td {
  padding: 3px 6px;
  line-height: 1.1;
}

.agenda-table tbody tr {
  height: 26px;
}

.agenda-col-num {
  width: 52px;
  text-align: center;
  font-weight: 700;
  color: var(--text-muted, #64748b);
}

.agenda-col-contacto {
  width: 132px;
  text-align: center;
  white-space: nowrap;
}

.agenda-contacto-flags {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.agenda-contacto-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 5px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  transition: filter 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.agenda-contacto-flag:hover {
  filter: brightness(0.98);
}

.agenda-contacto-flag input[type="checkbox"] {
  width: 12px;
  height: 12px;
  margin: 0;
  accent-color: #2563eb;
}

.agenda-contacto-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.agenda-contacto-icon .agenda-action-icon {
  width: 12px;
  height: 12px;
  stroke-width: 2;
}

.agenda-contacto-flag.is-sms {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1e40af;
}

.agenda-contacto-flag.is-llamada {
  background: #dcfce7;
  border-color: #4ade80;
  color: #166534;
}

.agenda-contacto-flag.is-presente {
  background: #ede9fe;
  border-color: #a78bfa;
  color: #5b21b6;
}

.agenda-contacto-flag input[type="checkbox"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.agenda-table.hide-numeracion .agenda-col-num {
  display: none;
}

.agenda-table.hide-contactado .agenda-col-contacto {
  display: none;
}

.agenda-table.hide-contacto-sms .agenda-contacto-flag.is-sms {
  display: none;
}

.agenda-table.hide-contacto-llamada .agenda-contacto-flag.is-llamada {
  display: none;
}

.agenda-table.hide-contacto-presente .agenda-contacto-flag.is-presente {
  display: none;
}

/* Hover de fila segun estado */
.agenda-table tbody tr.agenda-row:hover td {
  transition: background-color 0.12s ease;
}

.agenda-table tbody tr.agenda-row-estado-confirmado:hover td {
  background: #86efac;
}

.agenda-table tbody tr.agenda-row-estado-cancelado:hover td {
  background: #fca5a5;
}

.agenda-table tbody tr.agenda-row-estado-reprogramado:hover td {
  background: #c4b5fd;
}

.agenda-table tbody tr.agenda-row-estado-no-contesta:hover td {
  background: #cbd5e1;
}

.agenda-table tbody tr.agenda-row-estado-igs:hover td {
  background: #fb923c;
}

.agenda-table tbody tr.agenda-row-estado-pendiente:hover td {
  background: #d1d5db;
}

.agenda-table thead th {
  position: sticky;
  top: 0;
  background: transparent;
  z-index: 2;
}

/* Refuerzo visual por hora */
.agenda-hora-cell {
  text-align: center;
  font-weight: 800;
  color: #1f2937;
  border-left: 4px solid rgba(15, 23, 42, 0.22);
}

.agenda-hora-slot-0 { background: #fecaca; }
.agenda-hora-slot-1 { background: #bbf7d0; }
.agenda-hora-slot-2 { background: #bfdbfe; }
.agenda-hora-slot-3 { background: #fde68a; }
.agenda-hora-slot-4 { background: #fed7aa; }
.agenda-hora-slot-5 { background: #fcd34d; }
.agenda-hora-slot-6 { background: #99f6e4; }
.agenda-hora-slot-7 { background: #ddd6fe; }
.agenda-hora-slot-default { background: #e5e7eb; }

/* Refuerzo visual por estado en Nombre */
.agenda-nombre-cell {
  font-weight: 700;
  border-left: 3px solid transparent;
}

.agenda-nombre-duplicado .agenda-duplicate-name {
  font-weight: 800;
  color: #991b1b;
}

.agenda-nombre-estado-confirmado {
  background: #dcfce7;
  border-left-color: #16a34a;
  color: #14532d;
}

.agenda-nombre-estado-cancelado {
  background: #fee2e2;
  border-left-color: #dc2626;
  color: #7f1d1d;
}

.agenda-nombre-estado-reprogramado {
  background: #f3e8ff;
  border-left-color: #7c3aed;
  color: #5b21b6;
}

.agenda-nombre-estado-no-contesta {
  background: #e2e8f0;
  border-left-color: #475569;
  color: #1e293b;
}

.agenda-nombre-estado-igs {
  background: #fdba74;
  border-left-color: #ea580c;
  color: #7c2d12;
}

.agenda-nombre-estado-pendiente {
  background: #e5e7eb;
  border-left-color: #6b7280;
  color: #1f2937;
}

/* columna cobrar -> boton */
.btn-cobrar {
  background: #0879e9;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.14s var(--btn-ease-standard), box-shadow 0.2s var(--btn-ease-standard), filter 0.18s ease, opacity 0.18s ease;
}

.btn-cobrar:hover {
  opacity: 0.95;
}

.agenda-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.agenda-action-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 700;
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: transform 0.14s var(--btn-ease-standard), box-shadow 0.2s var(--btn-ease-standard), filter 0.18s ease;
}
.agenda-action-btn .agenda-action-icon {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  pointer-events: none;
}

.agenda-action-btn.is-cobrar {
  background: #0879e9;
}

.agenda-action-btn.is-open {
  background: #2563eb;
}

.agenda-action-btn.is-cola {
  background: #7c3aed;
}

.agenda-action-btn.is-eliminar {
  background: #dc2626;
}

.agenda-action-btn.is-crear {
  background: #16a34a;
}

.agenda-action-btn.is-reprogramar {
  background: #0f766e;
}

.agenda-action-btn:hover {
  filter: brightness(0.95);
}

.btn-cobrar:focus-visible,
.agenda-action-btn:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

/* estado select estilizado */
.select-estado {
  padding: 0 22px 0 6px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.06);
  font-weight: 600;
  min-height: 22px;
  height: 22px;
  font-size: 12px;
  line-height: 1;
}

.estado-confirmado {
  background: #bbf7d0;
  color: #14532d;
  border-color: #16a34a;
}

.estado-cancelado {
  background: #fecaca;
  color: #7f1d1d;
  border-color: #dc2626;
}

.estado-reprogramado {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #a78bfa;
}

.estado-no-contesta {
  background: #cbd5e1;
  color: #0f172a;
  border-color: #64748b;
}

.estado-igs {
  background: #fb923c;
  color: #c2410c;
  border-color: #ea580c;
}

.estado-pendiente {
  background: #d1d5db;
  color: #111827;
  border-color: #6b7280;
}

/* comentario editable */
.comment-text {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
}

.comment-edit {
  width: 100%;
  padding: 2px 4px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.agenda-col-comentario {
  width: 22%;
  max-width: 280px;
}

.agenda-container {
  width: 98%;
  max-width: 100%;
  margin: 20px auto;
}

.filter-estado {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-white);
  font-weight: 600;
  cursor: pointer;
  min-width: 120px;
}

.filter-estado.filter-estado-active {
  border-width: 2px;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
}

.filter-estado.filter-estado-no-results {
  border-color: #d97706;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.22);
}

.agenda-filter-estado-alert {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  max-width: 320px;
  width: fit-content;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #2563eb;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 6px rgba(37, 99, 235, 0.12);
  flex: 0 1 auto;
}

.agenda-filter-estado-alert[hidden] {
  display: none !important;
}

.agenda-filter-estado-alert.is-warning {
  border-color: #d97706;
  background: #ffedd5;
  color: #9a3412;
  box-shadow: 0 1px 8px rgba(217, 119, 6, 0.18);
}

.agenda-modal-buscador {
  position: relative;
}

.agenda-modal-buscador input {
  margin-bottom: 8px;
}

.agenda-modal-buscador .autocomplete-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 4px);
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
  display: none;
  z-index: 4500;
}

.agenda-modal-comentario-wrap {
  position: relative;
}

.agenda-modal-comentario-wrap input {
  margin-bottom: 8px;
}

.agenda-modal-comentario-wrap .autocomplete-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 4px);
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
  display: none;
  z-index: 4500;
}

/* boton guardar en modal agenda */
#modal-guardar {
  background: #16a34a;
  border: none;
  padding: 10px 22px;
  color: #fff;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
}

#modal-guardar:hover {
  background: #15803d;
}

/* =====================================================
   AGENDA - AJUSTE FINO TABLET / ESCRITORIO BAJO
===================================================== */
@media (max-width: 1400px) and (min-width: 1024px) {
  .agenda-container {
    padding: 20px;
  }

  .agenda-title {
    font-size: 16px;
  }

  .agenda-controls {
    gap: 8px;
  }

  .agenda-controls input,
  .agenda-controls select {
    max-width: 220px;
  }

  .agenda-controls button {
    font-size: 13px;
    padding: 6px 10px;
  }

  .agenda-table thead th,
  .agenda-table tbody td {
    padding: 3px 6px;
    font-size: 12px;
  }
}

/* =====================================================
   AGENDA - COMPACTACION REAL DE TEXTO
===================================================== */
@media (max-width: 1366px) {
  .agenda-container {
    padding: 16px;
  }

  .agenda-container .agenda-title {
    font-size: 15px;
  }

  .agenda-container .agenda-controls input,
  .agenda-container .agenda-controls select,
  .agenda-container .agenda-controls button {
    font-size: 12px;
    padding: 6px 8px;
  }

  .agenda-container .agenda-view-toggle {
    padding: 2px;
  }

  .agenda-container .agenda-view-btn {
    min-height: 28px;
    padding: 5px 8px;
    font-size: 11px;
  }

  .agenda-container .agenda-month-header {
    padding: 12px;
  }

  .agenda-container .agenda-month-day,
  .agenda-container .agenda-month-day.is-empty {
    min-height: 92px;
    padding: 8px;
  }

  .agenda-container .agenda-month-grid {
    gap: 6px;
    padding: 0 10px 12px;
  }

  .agenda-container .agenda-table {
    font-size: 12px;
  }

  .agenda-container .agenda-table thead th {
    font-size: 12px;
    padding: 3px 6px;
  }

  .agenda-container .agenda-table tbody td {
    font-size: 12px;
    padding: 3px 6px;
  }

  .agenda-container .btn-cobrar {
    font-size: 11px;
    padding: 6px 10px;
  }

  .agenda-container .agenda-action-btn {
    width: 23px;
    height: 23px;
    font-size: 11px;
    border-radius: 5px;
  }

  .agenda-container .select-estado {
    font-size: 11px;
    padding: 0 20px 0 6px;
    min-height: 22px;
    height: 22px;
  }

  .agenda-container .comment-text,
  .agenda-container .comment-edit {
    font-size: 11px;
  }
}

/* =====================================================
   AGENDA - DARK MODE (ajuste Nombre/Hora sin fondos de color)
===================================================== */
.dark-mode .agenda-table tbody tr.agenda-row-estado-confirmado:hover td {
  background: rgba(22, 163, 74, 0.42);
}

.dark-mode .agenda-search-scope-alert {
  border-color: #dc2626;
  background: rgba(127, 29, 29, 0.45);
  color: #fecaca;
}

.dark-mode .agenda-view-toggle {
  background: rgba(15, 23, 42, 0.62);
  border-color: rgba(148, 163, 184, 0.28);
}

.dark-mode .agenda-view-btn:hover {
  background: rgba(51, 65, 85, 0.72);
}

.dark-mode .agenda-month-view {
  background: var(--bg-white, #111827);
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22);
}

.dark-mode .agenda-month-header {
  background: rgba(15, 23, 42, 0.58);
  border-bottom-color: rgba(148, 163, 184, 0.22);
}

.dark-mode .agenda-month-nav-btn,
.dark-mode .agenda-month-today-btn {
  background: rgba(15, 23, 42, 0.76);
  border-color: rgba(148, 163, 184, 0.28);
}

.dark-mode .agenda-month-nav-btn:hover,
.dark-mode .agenda-month-today-btn:hover {
  background: rgba(22, 101, 52, 0.24);
}

.dark-mode .agenda-month-total {
  background: rgba(22, 101, 52, 0.28);
  color: #86efac;
  border-color: rgba(134, 239, 172, 0.22);
}

.dark-mode .agenda-month-day {
  background: rgba(15, 23, 42, 0.78);
  border-color: rgba(148, 163, 184, 0.22);
}

.dark-mode .agenda-month-day.is-empty {
  background: rgba(15, 23, 42, 0.36);
}

.dark-mode .agenda-month-day.has-items {
  background: rgba(20, 83, 45, 0.24);
  border-color: rgba(134, 239, 172, 0.24);
}

.dark-mode .agenda-month-day:not(.has-items) .agenda-month-count {
  background: rgba(71, 85, 105, 0.76);
  color: #cbd5e1;
}

.dark-mode .agenda-month-samples em {
  color: #bbf7d0;
}

.dark-mode .agenda-save-overlay {
  background: rgba(2, 6, 23, 0.54);
}

.dark-mode .agenda-save-overlay-card {
  background: #0f172a;
  border-color: rgba(96, 165, 250, 0.22);
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
}

.dark-mode .agenda-save-overlay-text {
  color: #e2e8f0;
}

.dark-mode .filter-estado.filter-estado-no-results {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.28);
}

.dark-mode .agenda-filter-estado-alert {
  border-color: rgba(59, 130, 246, 0.85);
  background: rgba(30, 64, 175, 0.35);
  color: #bfdbfe;
  box-shadow: 0 2px 10px rgba(30, 64, 175, 0.35);
}

.dark-mode .agenda-filter-estado-alert.is-warning {
  border-color: rgba(245, 158, 11, 0.85);
  background: rgba(146, 64, 14, 0.4);
  color: #fed7aa;
  box-shadow: 0 2px 12px rgba(146, 64, 14, 0.42);
}

.dark-mode .agenda-table tbody tr.agenda-row-estado-cancelado:hover td {
  background: rgba(220, 38, 38, 0.4);
}

.dark-mode .agenda-table tbody tr.agenda-row-estado-reprogramado:hover td {
  background: rgba(124, 58, 237, 0.44);
}

.dark-mode .agenda-table tbody tr.agenda-row-estado-no-contesta:hover td {
  background: rgba(100, 116, 139, 0.42);
}

.dark-mode .agenda-table tbody tr.agenda-row-estado-igs:hover td {
  background: rgba(249, 115, 22, 0.42);
}

.dark-mode .agenda-table tbody tr.agenda-row-estado-pendiente:hover td {
  background: rgba(107, 114, 128, 0.4);
}

.dark-mode .agenda-hora-cell {
  color: #dbeafe;
  border-left-color: rgba(148, 163, 184, 0.32);
}

.dark-mode .agenda-hora-slot-0,
.dark-mode .agenda-hora-slot-1,
.dark-mode .agenda-hora-slot-2,
.dark-mode .agenda-hora-slot-3,
.dark-mode .agenda-hora-slot-4,
.dark-mode .agenda-hora-slot-5,
.dark-mode .agenda-hora-slot-6,
.dark-mode .agenda-hora-slot-7,
.dark-mode .agenda-hora-slot-default {
  background: transparent;
}

.dark-mode .agenda-nombre-cell {
  color: #e2e8f0;
}

.dark-mode .agenda-nombre-duplicado .agenda-duplicate-name {
  color: #fca5a5;
}

.dark-mode .agenda-nombre-estado-confirmado,
.dark-mode .agenda-nombre-estado-cancelado,
.dark-mode .agenda-nombre-estado-reprogramado,
.dark-mode .agenda-nombre-estado-no-contesta,
.dark-mode .agenda-nombre-estado-igs,
.dark-mode .agenda-nombre-estado-pendiente {
  background: transparent;
  color: #e2e8f0;
}

.dark-mode .agenda-toggle-numeracion,
.dark-mode .agenda-toggle-sms,
.dark-mode .agenda-toggle-llamada,
.dark-mode .agenda-toggle-presente {
  color: #cbd5e1;
}

.dark-mode .agenda-contacto-flag {
  background: rgba(15, 23, 42, 0.4);
  border-color: rgba(148, 163, 184, 0.4);
  color: #e2e8f0;
}

.dark-mode .agenda-contacto-flag.is-sms {
  background: rgba(30, 64, 175, 0.24);
  border-color: rgba(96, 165, 250, 0.55);
  color: #bfdbfe;
}

.dark-mode .agenda-contacto-flag.is-llamada {
  background: rgba(21, 128, 61, 0.22);
  border-color: rgba(74, 222, 128, 0.5);
  color: #bbf7d0;
}

.dark-mode .agenda-contacto-flag.is-presente {
  background: rgba(91, 33, 182, 0.24);
  border-color: rgba(167, 139, 250, 0.5);
  color: #ddd6fe;
}

@media (max-width: 900px) {
  .agenda-ina-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 18px);
    margin: 9px auto;
  }

  .agenda-day-summary-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 18px);
    margin: 9px auto;
  }

  .agenda-ina-kpis {
    grid-template-columns: 1fr;
  }

  .agenda-day-summary-kpis-wrap {
    grid-template-columns: 1fr;
  }

  .agenda-ina-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .agenda-ina-toolbar .btn-cobrar {
    width: 100%;
  }

  .agenda-day-summary-estados {
    grid-template-columns: 1fr;
  }

  .agenda-month-header {
    align-items: stretch;
    flex-direction: column;
  }

  .agenda-month-actions {
    justify-content: flex-start;
  }

  .agenda-month-weekdays,
  .agenda-month-grid {
    gap: 5px;
  }

  .agenda-month-day,
  .agenda-month-day.is-empty {
    min-height: 78px;
    padding: 7px;
  }

  .agenda-month-count {
    min-width: 28px;
    height: 24px;
    font-size: 14px;
  }

  .agenda-month-samples {
    display: none;
  }
}

.dark-mode .agenda-ina-backdrop {
  background: rgba(2, 6, 23, 0.72);
}

.dark-mode .agenda-day-summary-backdrop {
  background: rgba(2, 6, 23, 0.72);
}

.dark-mode .agenda-ina-dialog {
  background: #0f172a;
  border-color: #334155;
  box-shadow: 0 24px 50px rgba(2, 6, 23, 0.7);
}

.dark-mode .agenda-day-summary-dialog {
  background: #0f172a;
  border-color: #334155;
  box-shadow: 0 24px 50px rgba(2, 6, 23, 0.7);
}

.dark-mode .agenda-ina-header {
  border-bottom-color: #334155;
}

.dark-mode .agenda-day-summary-header {
  border-bottom-color: #334155;
}

.dark-mode .agenda-ina-header h3 {
  color: #e2e8f0;
}

.dark-mode .agenda-day-summary-header h3 {
  color: #e2e8f0;
}

.dark-mode .agenda-ina-meta {
  color: #94a3b8;
}

.dark-mode .agenda-day-summary-meta {
  color: #94a3b8;
}

.dark-mode .agenda-ina-kpi {
  border-color: #334155;
  background: #1e293b;
}

.dark-mode .agenda-day-summary-kpi {
  border-color: #334155;
  background: #1e293b;
}

.dark-mode .agenda-ina-kpi.is-muted {
  border-color: #475569;
  background: #111827;
}

.dark-mode .agenda-day-summary-kpi.is-muted {
  border-color: #475569;
  background: #111827;
}

.dark-mode .agenda-ina-kpi span {
  color: #94a3b8;
}

.dark-mode .agenda-day-summary-kpi span {
  color: #94a3b8;
}

.dark-mode .agenda-ina-kpi strong {
  color: #f8fafc;
}

.dark-mode .agenda-day-summary-kpi strong {
  color: #f8fafc;
}

.dark-mode .agenda-ina-status {
  color: #cbd5e1;
}

.dark-mode .agenda-ina-status.is-muted {
  color: #94a3b8;
}

.dark-mode .agenda-ina-status.is-info {
  color: #93c5fd;
}

.dark-mode .agenda-ina-status.is-success {
  color: #86efac;
}

.dark-mode .agenda-ina-status.is-error {
  color: #fca5a5;
}

.dark-mode .agenda-ina-table-wrap {
  border-color: #334155;
  background: #0f172a;
}

.dark-mode .agenda-day-summary-hours-wrap {
  border-color: #334155;
  background: #0f172a;
}

.dark-mode .agenda-day-summary-treatment-wrap {
  border-color: #334155;
  background: #0f172a;
}

.dark-mode .agenda-ina-table thead th {
  background: #1e293b;
  color: #cbd5e1;
  border-bottom-color: #334155;
}

.dark-mode .agenda-day-summary-treatment-table thead th {
  background: #1e293b;
  color: #cbd5e1;
  border-bottom-color: #334155;
}

.dark-mode .agenda-day-summary-hours-table thead th {
  background: #1e293b;
  color: #cbd5e1;
  border-bottom-color: #334155;
}

.dark-mode .agenda-ina-table tbody td {
  color: #e2e8f0;
  border-bottom-color: #1f2937;
}

.dark-mode .agenda-day-summary-hours-table tbody td {
  color: #e2e8f0;
  border-bottom-color: #1f2937;
}

.dark-mode .agenda-day-summary-treatment-table tbody td {
  color: #e2e8f0;
  border-bottom-color: #1f2937;
}

.dark-mode .agenda-day-summary-estado {
  border-color: #334155;
  background: #111827;
}

.dark-mode .agenda-day-summary-estado span {
  color: #94a3b8;
}

.dark-mode .agenda-day-summary-estado strong {
  color: #f8fafc;
}

.dark-mode .agenda-day-summary-view-btn {
  border-color: #334155;
  background: #111827;
  color: #94a3b8;
}

.dark-mode .agenda-day-summary-view-btn:hover {
  border-color: #3b82f6;
  color: #bfdbfe;
}

.dark-mode .agenda-day-summary-view-btn.is-active {
  border-color: #3b82f6;
  background: #1d4f91;
  color: #dbeafe;
}

.dark-mode .agenda-day-summary-estado.is-highlight.is-confirmado {
  border-color: #166534;
  background: #052e20;
}

.dark-mode .agenda-day-summary-estado.is-highlight.is-cancelado {
  border-color: #7f1d1d;
  background: #3f1212;
}

.dark-mode .agenda-day-summary-estado.is-highlight.is-reprogramado {
  border-color: #6d28d9;
  background: #2e1065;
}

.dark-mode .agenda-day-summary-empty {
  border-color: #334155;
  background: #0f172a;
  color: #94a3b8;
}

.dark-mode .agenda-day-summary-hours-table tbody tr.is-no-hour td {
  background: #3b2210;
  color: #fed7aa;
}

/* =====================================================
   AGENDA - PATRON MODERNO AZUL CLINICO
===================================================== */
.agenda-container {
  --agenda-primary: #2775f5;
  --agenda-primary-dark: #185ed1;
  --agenda-secondary: #18bfd0;
  --agenda-background: #f3f8fd;
  --agenda-surface: #ffffff;
  --agenda-border: #dde8f3;
  --agenda-text: #16263d;
  --agenda-muted: #66778d;
  --agenda-success: #19a765;
  --agenda-warning: #f39a3c;
  --agenda-danger: #e5484d;

  width: min(var(--app-view-max-width, 1760px), 100%);
  margin: 0 auto;
  padding: 0;
  background: transparent;
  box-shadow: none;
  color: var(--agenda-text);
}

.agenda-modern-hero {
  position: relative;
  display: block;
  min-height: 0;
  margin-bottom: 4px;
  padding: 0 8px 0;
  overflow: hidden;
}

.agenda-modern-hero::before {
  display: none;
}

.agenda-hero-copy,
.agenda-hero-metrics {
  position: relative;
}

.agenda-hero-copy {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.agenda-hero-copy h1 {
  margin: 0;
  color: var(--agenda-text);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0;
  white-space: nowrap;
}

.agenda-hero-copy p {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--agenda-primary-dark);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

#agenda-hero-date .agenda-action-icon {
  width: 14px;
  height: 14px;
}

.agenda-hero-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 132px));
  justify-content: end;
  gap: 6px;
}

.agenda-control-metrics {
  flex: 1 1 720px;
  max-width: 960px;
  margin-left: auto;
}

.agenda-metric-card {
  min-height: 34px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 6px;
  align-items: center;
  padding: 5px 8px;
  border: 1px solid var(--agenda-border);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 4px 10px rgba(22, 38, 61, 0.04);
  backdrop-filter: blur(14px);
  cursor: pointer;
  user-select: none;
  transition:
    transform 0.14s var(--btn-ease-standard, ease),
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.agenda-metric-card[hidden] {
  display: none !important;
}

.agenda-metric-card:hover {
  transform: translateY(-1px);
  border-color: rgba(39, 117, 245, 0.35);
  box-shadow: 0 8px 18px rgba(22, 38, 61, 0.09);
}

.agenda-metric-card:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.agenda-metric-card.is-highlight-active {
  border-color: var(--agenda-primary);
  background: #eef6ff;
  box-shadow: 0 0 0 2px rgba(39, 117, 245, 0.14), 0 10px 20px rgba(22, 38, 61, 0.09);
}

.agenda-metric-icon {
  grid-row: 1 / span 2;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--agenda-primary);
  background: #eaf3ff;
}

.agenda-metric-icon .agenda-action-icon {
  width: 12px;
  height: 12px;
}

.agenda-metric-card strong {
  color: var(--agenda-text);
  font-size: 16px;
  line-height: 1;
  font-weight: 900;
}

.agenda-metric-card small {
  color: var(--agenda-muted);
  font-size: 9px;
  font-weight: 700;
}

.agenda-metric-card.is-confirmed .agenda-metric-icon {
  color: #0f8d55;
  background: #dcf8e9;
}

.agenda-metric-card.is-canceled .agenda-metric-icon {
  color: #dc2626;
  background: #fee2e2;
}

.agenda-metric-card.is-rescheduled .agenda-metric-icon {
  color: #7c3aed;
  background: #ede9fe;
}

.agenda-metric-card.is-no-answer .agenda-metric-icon {
  color: #475569;
  background: #e2e8f0;
}

.agenda-metric-card.is-igs .agenda-metric-icon {
  color: #c2410c;
  background: #ffedd5;
}

.agenda-metric-card.is-pending .agenda-metric-icon {
  color: #7c3aed;
  background: #f0e7ff;
}

.agenda-primary-btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #2fa8ff, var(--agenda-primary));
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(39, 117, 245, 0.22);
}

.agenda-filter-primary-btn {
  flex: 0 0 auto;
  min-width: 132px;
  margin-left: auto;
}

.agenda-primary-btn .agenda-action-icon {
  width: 15px;
  height: 15px;
}

.agenda-header {
  display: block;
  margin: 0 0 8px;
}

.agenda-controls {
  display: grid;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--agenda-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 22px rgba(22, 38, 61, 0.06);
  backdrop-filter: blur(18px);
}

.agenda-control-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.agenda-control-row-primary {
  justify-content: flex-start;
}

.agenda-control-row-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.agenda-control-row-flags {
  gap: 22px;
}

.agenda-container.agenda-is-month-view .agenda-modern-hero,
.agenda-container.agenda-is-month-view .agenda-control-row-filters,
.agenda-container.agenda-is-month-view .agenda-control-row-flags,
.agenda-container.agenda-is-month-view .agenda-control-metrics,
.agenda-container.agenda-is-month-view #agenda-review-ina,
.agenda-container.agenda-is-month-view #agenda-day-summary-open {
  display: none !important;
}

.agenda-container.agenda-is-month-view .agenda-header {
  margin-bottom: 6px;
}

.agenda-container.agenda-is-month-view .agenda-controls {
  gap: 0;
  padding: 8px 10px;
}

.agenda-container.agenda-is-month-view .agenda-control-row-primary {
  justify-content: flex-start;
}

.agenda-container.agenda-is-month-view .agenda-month-view {
  margin-top: 6px;
}

.agenda-date-today,
.agenda-view-btn,
.agenda-date-nav-btn,
.agenda-soft-icon-btn {
  border: 1px solid var(--agenda-border);
  background: #fff;
  color: var(--agenda-text);
  cursor: pointer;
}

.agenda-date-today {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2fa8ff, var(--agenda-primary));
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(39, 117, 245, 0.22);
}

.agenda-view-toggle {
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
}

.agenda-view-btn {
  min-height: 34px;
  min-width: 64px;
  padding: 0 14px;
  border-radius: 9px;
  color: var(--agenda-muted);
  font-size: 13px;
}

.agenda-view-btn.is-active {
  background: #edf5ff;
  border-color: #bfd8ff;
  color: var(--agenda-primary-dark);
  box-shadow: 0 10px 22px rgba(39, 117, 245, 0.12);
}

.agenda-date-nav {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--agenda-border);
  border-radius: 9px;
  background: #fff;
}

.agenda-date-nav-btn {
  width: 36px;
  height: 34px;
  border: 0;
  border-radius: 0;
  color: var(--agenda-text);
}

.agenda-date-nav-btn .agenda-action-icon {
  width: 16px;
  height: 16px;
}

.agenda-date-field {
  position: relative;
  min-width: 170px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border-inline: 1px solid var(--agenda-border);
  color: var(--agenda-text);
  font-size: 13px;
  font-weight: 900;
}

.agenda-date-field .agenda-action-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  pointer-events: none;
}

.agenda-date-field input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.agenda-date-field span {
  pointer-events: none;
}

.agenda-search-field,
.agenda-select-shell {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--agenda-border);
  border-radius: 9px;
  background: #fff;
  color: var(--agenda-muted);
  font-size: 13px;
  font-weight: 700;
}

.agenda-search-field {
  flex: 1 1 380px;
  max-width: 720px;
}

.agenda-filter-estado-wrap,
.agenda-contact-filter {
  flex: 0 0 220px;
  min-width: 0;
}

.agenda-control-row-filters > .agenda-select-shell {
  flex: 0 0 210px;
  min-width: 0;
}

.agenda-select-shell {
  width: 100%;
}

.agenda-search-field .agenda-action-icon,
.agenda-select-shell .agenda-action-icon {
  width: 15px;
  height: 15px;
  color: #7892ad;
}

.agenda-search-field input,
.agenda-select-shell select,
.agenda-controls input[type="date"],
.agenda-controls input[type="text"],
.agenda-controls input[type="search"] {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--agenda-text);
  font-size: 13px;
  font-weight: 700;
}

.agenda-select-shell select {
  appearance: auto;
  cursor: pointer;
}

.agenda-filter-clear-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--agenda-border);
  border-radius: 9px;
  background: #fff;
  color: var(--agenda-muted);
  cursor: pointer;
}

.agenda-filter-clear-btn[hidden] {
  display: none;
}

.agenda-filter-clear-btn .agenda-action-icon {
  width: 15px;
  height: 15px;
}

.agenda-filter-clear-btn:hover,
.agenda-filter-clear-btn:focus-visible {
  color: var(--agenda-danger);
  border-color: rgba(220, 38, 38, 0.36);
  outline: 0;
}

.agenda-select-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--agenda-success);
}

.agenda-toggle-numeracion,
.agenda-toggle-sms,
.agenda-toggle-llamada,
.agenda-toggle-presente {
  min-height: 24px;
  gap: 6px;
  color: var(--agenda-muted);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

.agenda-toggle-numeracion input[type="checkbox"],
.agenda-toggle-sms input[type="checkbox"],
.agenda-toggle-llamada input[type="checkbox"],
.agenda-toggle-presente input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--agenda-primary);
}

.agenda-soft-icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
}

.agenda-soft-icon-btn .agenda-action-icon {
  width: 15px;
  height: 15px;
}

.agenda-table-wrap {
  margin-top: 10px;
  border: 1px solid var(--agenda-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(22, 38, 61, 0.06);
  overflow: auto;
}

.agenda-table {
  --agenda-contactado-width: 0px;
  --agenda-num-width: 0px;
  --agenda-hora-width: 94px;
  --agenda-fecha-width: 128px;
  --agenda-telefono-width: 104px;
  --agenda-estado-width: 178px;
  --agenda-acciones-width: 210px;
  --agenda-flex-width: calc(
    100%
    - var(--agenda-contactado-width)
    - var(--agenda-num-width)
    - var(--agenda-hora-width)
    - var(--agenda-fecha-width)
    - var(--agenda-telefono-width)
    - var(--agenda-estado-width)
    - var(--agenda-acciones-width)
  );

  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--agenda-text);
  font-size: 11px;
}

.agenda-table.contactado-count-1 {
  --agenda-contactado-width: 58px;
}

.agenda-table.contactado-count-2 {
  --agenda-contactado-width: 104px;
}

.agenda-table.contactado-count-3 {
  --agenda-contactado-width: 146px;
}

.agenda-table.num-visible {
  --agenda-num-width: 42px;
}

.agenda-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 6px 9px;
  border-bottom: 1px solid var(--agenda-border);
  background: rgba(248, 251, 255, 0.96);
  color: var(--agenda-muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.agenda-table tbody td {
  padding: 2px 7px 3px;
  border-bottom: 1px solid #edf3fa;
  background: #fff;
  color: var(--agenda-text);
  vertical-align: middle;
}

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

.agenda-table tbody tr:hover td {
  background: #f2f7ff !important;
}

.agenda-table tbody tr.agenda-empty-row td.agenda-empty-cell,
.agenda-table tbody tr.agenda-empty-row:hover td.agenda-empty-cell {
  padding: 24px 16px;
  background: #f8fbff !important;
  color: var(--agenda-muted);
  font-weight: 800;
  text-align: center;
}

.agenda-table tbody tr.agenda-row-metric-highlight td {
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), inset 0 -1px 0 rgba(15, 23, 42, 0.08);
}

.agenda-table tbody tr.agenda-row-metric-highlight td:first-child {
  border-left: 6px solid var(--agenda-primary);
}

.agenda-table tbody tr.agenda-row-metric-confirmado td,
.agenda-table tbody tr.agenda-row-metric-confirmado:hover td {
  background: #d1fae5 !important;
}

.agenda-table tbody tr.agenda-row-metric-confirmado td:first-child {
  border-left-color: #16a34a;
}

.agenda-table tbody tr.agenda-row-metric-cancelado td,
.agenda-table tbody tr.agenda-row-metric-cancelado:hover td {
  background: #fee2e2 !important;
}

.agenda-table tbody tr.agenda-row-metric-cancelado td:first-child {
  border-left-color: #dc2626;
}

.agenda-table tbody tr.agenda-row-metric-reprogramado td,
.agenda-table tbody tr.agenda-row-metric-reprogramado:hover td {
  background: #f3e8ff !important;
}

.agenda-table tbody tr.agenda-row-metric-reprogramado td:first-child {
  border-left-color: #7c3aed;
}

.agenda-table tbody tr.agenda-row-metric-no-contesta td,
.agenda-table tbody tr.agenda-row-metric-no-contesta:hover td {
  background: #e2e8f0 !important;
}

.agenda-table tbody tr.agenda-row-metric-no-contesta td:first-child {
  border-left-color: #475569;
}

.agenda-table tbody tr.agenda-row-metric-igs td,
.agenda-table tbody tr.agenda-row-metric-igs:hover td {
  background: #fed7aa !important;
}

.agenda-table tbody tr.agenda-row-metric-igs td:first-child {
  border-left-color: #f97316;
}

.agenda-table tbody tr.agenda-row-metric-pendiente td,
.agenda-table tbody tr.agenda-row-metric-pendiente:hover td {
  background: #ede9fe !important;
}

.agenda-table tbody tr.agenda-row-metric-pendiente td:first-child {
  border-left-color: #7c3aed;
}

.agenda-table tbody tr.agenda-row {
  height: 30px;
}

.agenda-col-num {
  width: var(--agenda-num-width);
  color: var(--agenda-muted);
  text-align: center;
  overflow: hidden;
}

.agenda-col-contacto {
  width: var(--agenda-contactado-width);
  min-width: 0;
  overflow: visible;
}

.agenda-col-nombre {
  width: calc(var(--agenda-flex-width) * 0.62);
  min-width: 0;
}

/* Arrastrar cita desde el espacio libre a la derecha del nombre */
.agenda-table td.agenda-col-nombre.is-drag-zone { cursor: grab; }
body.agenda-row-dragging,
body.agenda-row-dragging * { cursor: grabbing !important; user-select: none; }
.agenda-table tbody tr.is-dragging { opacity: 0.45; }
.agenda-table tbody tr.is-drop-before > td { box-shadow: inset 0 3px 0 var(--agenda-primary); }
.agenda-table tbody tr.is-drop-after > td { box-shadow: inset 0 -3px 0 var(--agenda-primary); }
.agenda-month-day.is-drop-target { outline: 3px solid var(--agenda-primary) !important; outline-offset: -3px; animation: none !important; }

/* Menu de click derecho en el nombre */
.agenda-name-menu { position: fixed; z-index: 1200; display: grid; min-width: 130px; padding: 5px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; box-shadow: 0 10px 28px rgba(15, 23, 42, .2); }
.agenda-name-menu button { border: 0; border-radius: 6px; background: transparent; padding: 8px 11px; text-align: left; color: #172033; cursor: pointer; font-size: 12px; }
.agenda-name-menu button:hover { background: #dbeafe; color: var(--agenda-primary); }

.agenda-col-fecha {
  width: var(--agenda-fecha-width);
  min-width: 0;
}

.agenda-col-estado {
  width: var(--agenda-estado-width);
  min-width: 0;
  text-align: center;
}

.agenda-col-telefono {
  width: var(--agenda-telefono-width);
  min-width: 0;
}

.agenda-col-comentario {
  width: calc(var(--agenda-flex-width) * 0.38);
  max-width: none;
}

.agenda-col-acciones {
  width: var(--agenda-acciones-width);
  min-width: 0;
}

.agenda-col-hora,
.agenda-hora-cell {
  width: var(--agenda-hora-width);
  min-width: 0;
  text-align: center;
  border-left: 0;
  background: transparent !important;
}

.agenda-time-pill {
  width: 66px;
  min-height: 22px;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 8px;
  background: #eaf3ff;
  color: var(--agenda-primary-dark);
  font-weight: 900;
  box-shadow: inset 0 0 0 1px #cae0ff;
}

.agenda-time-pill strong {
  font-size: 11px;
  line-height: 1;
}

.agenda-time-pill small {
  font-size: 9px;
  line-height: 1;
  color: currentColor;
  opacity: 0.86;
}

.agenda-hora-slot-0 .agenda-time-pill { background: #ffe5e5; color: #9f1239; box-shadow: inset 0 0 0 1px #fecdd3; }
.agenda-hora-slot-1 .agenda-time-pill { background: #e2fbe9; color: #047857; box-shadow: inset 0 0 0 1px #bbf7d0; }
.agenda-hora-slot-2 .agenda-time-pill { background: #e5f0ff; color: #1d4ed8; box-shadow: inset 0 0 0 1px #bfdbfe; }
.agenda-hora-slot-3 .agenda-time-pill { background: #fff4ce; color: #92400e; box-shadow: inset 0 0 0 1px #fde68a; }
.agenda-hora-slot-4 .agenda-time-pill { background: #ffecd9; color: #9a3412; box-shadow: inset 0 0 0 1px #fed7aa; }
.agenda-hora-slot-5 .agenda-time-pill { background: #fef3c7; color: #854d0e; box-shadow: inset 0 0 0 1px #fcd34d; }
.agenda-hora-slot-6 .agenda-time-pill { background: #d9fbf5; color: #0f766e; box-shadow: inset 0 0 0 1px #99f6e4; }
.agenda-hora-slot-7 .agenda-time-pill { background: #efe9ff; color: #6d28d9; box-shadow: inset 0 0 0 1px #ddd6fe; }
.agenda-hora-slot-default .agenda-time-pill { background: #eef2f7; color: #475569; box-shadow: inset 0 0 0 1px #d8e1ec; }

.agenda-nombre-cell {
  font-size: 12px;
  font-weight: 400;
  border-left: 0;
  line-height: 1.15;
  letter-spacing: 0;
  text-shadow: none;
  -webkit-text-stroke: 0;
}

.agenda-nombre-estado-confirmado,
.agenda-nombre-estado-cancelado,
.agenda-nombre-estado-reprogramado,
.agenda-nombre-estado-no-contesta,
.agenda-nombre-estado-igs,
.agenda-nombre-estado-pendiente {
  background: transparent !important;
  color: var(--agenda-text);
}

.agenda-nombre-duplicado .agenda-duplicate-name {
  font-weight: 600;
  color: var(--agenda-danger);
  text-shadow: none;
  -webkit-text-stroke: 0;
}

.select-estado {
  width: min(100%, 150px);
  min-height: 22px;
  height: 22px;
  padding: 0 22px 0 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.estado-confirmado {
  background: #dcf8e9;
  color: #087a46;
  border-color: #a7e7c4;
}

.estado-pendiente {
  background: #fff4d6;
  color: #8a5b08;
  border-color: #f5d88b;
}

.estado-reprogramado {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #a78bfa;
}

.estado-cancelado {
  background: #ffe2e4;
  color: #b4232a;
  border-color: #ffb8bd;
}

.estado-no-contesta,
.estado-igs {
  background: #eef3f8;
  color: #425166;
  border-color: #d2dce8;
}

.comment-text {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  cursor: pointer;
}

.agenda-container .rv-chip {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
}

.agenda-contacto-flags {
  gap: 4px;
}

.agenda-contacto-flag {
  min-width: 26px;
  height: 22px;
  justify-content: center;
  padding: 0 5px;
  border-radius: 999px;
  background: #f8fbff;
}

.agenda-actions {
  position: relative;
  gap: 4px;
}

.agenda-action-btn,
.agenda-action-menu-btn {
  border: 1px solid var(--agenda-border);
  border-radius: 7px;
  background: #fff;
  color: var(--agenda-primary-dark);
  box-shadow: none;
}

.agenda-action-btn {
  width: 22px;
  height: 22px;
}

.agenda-action-btn .agenda-action-icon {
  width: 12px;
  height: 12px;
}

.agenda-action-btn.is-visible-action {
  width: auto;
  min-width: 84px;
  height: 38px;
  gap: 8px;
  padding: 0 14px;
  font-size: 13px;
}

.agenda-action-btn.is-visible-action span {
  display: inline;
}

.agenda-action-btn.is-open {
  background: #f5f9ff;
  color: var(--agenda-primary-dark);
  border-color: #cfe0f5;
}

.agenda-action-btn.is-cobrar {
  background: #e8f9ef;
  color: #087a46;
  border-color: #c7efd8;
}

.agenda-action-btn.is-cola {
  background: #f1ecff;
  color: #6d3bd8;
  border-color: #ddd1ff;
}

.agenda-action-btn.is-reprogramar {
  background: #e7f8f5;
  color: #0f766e;
  border-color: #bcece4;
}

.agenda-action-btn.is-crear {
  background: #e8f9ef;
  color: #087a46;
  border-color: #c7efd8;
}

.agenda-action-btn.is-eliminar {
  background: #fff0f1;
  color: var(--agenda-danger);
  border-color: #ffc9ce;
}

.agenda-action-menu {
  position: relative;
}

.agenda-action-menu-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.agenda-action-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  width: 210px;
  padding: 8px;
  border: 1px solid var(--agenda-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 38px rgba(22, 38, 61, 0.18);
}

.agenda-action-menu-panel[hidden] {
  display: none !important;
}

.agenda-action-menu-item {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--agenda-text);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
}

.agenda-action-menu-item:hover {
  background: #f4f8ff;
}

.agenda-action-menu-item .agenda-action-icon {
  width: 16px;
  height: 16px;
  color: var(--agenda-primary);
}

.agenda-action-menu-item.is-danger {
  color: var(--agenda-danger);
}

.agenda-action-menu-item.is-danger .agenda-action-icon {
  color: var(--agenda-danger);
}

.filter-estado {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.agenda-filter-estado-wrap {
  flex: 0 1 auto;
}

.agenda-filter-estado-wrap .agenda-select-shell {
  flex: 0 0 220px;
  width: 220px;
  cursor: pointer;
}

.agenda-filter-estado-wrap .agenda-select-shell.filter-estado-active {
  border-color: #8eb8ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.agenda-filter-estado-wrap .agenda-select-shell.filter-estado-no-results {
  border-color: #d97706;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.2);
}

.agenda-filter-estado-wrap .agenda-select-shell select.filter-estado {
  flex: 1 1 auto;
  width: auto;
  min-width: 126px;
  min-height: 34px;
  padding-right: 24px;
}

.agenda-container .filter-estado.filter-estado-active,
.agenda-container .filter-estado.filter-estado-no-results {
  border: 0;
  box-shadow: none;
}

.agenda-select-shell .filter-estado.estado-confirmado,
.agenda-select-shell .filter-estado.estado-pendiente,
.agenda-select-shell .filter-estado.estado-reprogramado,
.agenda-select-shell .filter-estado.estado-cancelado,
.agenda-select-shell .filter-estado.estado-no-contesta,
.agenda-select-shell .filter-estado.estado-igs {
  background: transparent;
  border: 0;
  color: var(--agenda-text);
}

.agenda-filter-estado-alert {
  margin-left: 8px;
}

.agenda-search-scope-alert {
  border-color: #bcd4fb;
  background: #edf5ff;
  color: var(--agenda-primary-dark);
}

.agenda-month-view {
  border-color: var(--agenda-border);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(22, 38, 61, 0.08);
}

.agenda-month-header {
  background: rgba(248, 251, 255, 0.92);
}

.agenda-month-day {
  border-color: var(--agenda-border);
  border-radius: 12px;
}

.agenda-month-day.has-items {
  border-color: #c7dfff;
  background: #f3f8ff;
}

.agenda-month-count {
  background: var(--agenda-primary);
}

.dark-mode .agenda-container {
  --agenda-background: #0b1220;
  --agenda-surface: #111827;
  --agenda-border: #26354a;
  --agenda-text: #e8f1ff;
  --agenda-muted: #9eb2cc;
}

.dark-mode .agenda-modern-hero::before {
  opacity: 0.5;
}

.dark-mode .agenda-metric-card,
.dark-mode .agenda-controls,
.dark-mode .agenda-table-wrap,
.dark-mode .agenda-month-view,
.dark-mode .agenda-action-menu-panel {
  border-color: var(--agenda-border);
  background: rgba(15, 23, 42, 0.88);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.32);
}

.dark-mode .agenda-metric-card:hover {
  border-color: rgba(96, 165, 250, 0.42);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

.dark-mode .agenda-metric-card.is-highlight-active {
  border-color: #60a5fa;
  background: rgba(37, 99, 235, 0.2);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.18), 0 10px 20px rgba(0, 0, 0, 0.26);
}

.dark-mode .agenda-hero-copy h1,
.dark-mode .agenda-metric-card strong,
.dark-mode .agenda-action-menu-item,
.dark-mode .agenda-date-nav-btn,
.dark-mode .agenda-select-shell select,
.dark-mode .agenda-search-field input,
.dark-mode .agenda-table tbody td {
  color: var(--agenda-text);
}

.dark-mode .agenda-date-today,
.dark-mode .agenda-primary-btn {
  color: #fff;
}

.dark-mode .agenda-view-btn {
  border-color: var(--agenda-border);
  background: var(--agenda-surface, #111827);
  color: var(--agenda-muted);
}

.dark-mode .agenda-view-btn.is-active {
  border-color: color-mix(in srgb, var(--agenda-primary) 60%, transparent);
  background: color-mix(in srgb, var(--agenda-primary) 24%, var(--agenda-surface, #111827));
  color: var(--agenda-text);
  box-shadow: none;
}

.dark-mode .agenda-date-nav,
.dark-mode .agenda-date-field,
.dark-mode .agenda-search-field,
.dark-mode .agenda-select-shell,
.dark-mode .agenda-date-nav-btn,
.dark-mode .agenda-soft-icon-btn,
.dark-mode .agenda-action-menu-btn,
.dark-mode .agenda-action-btn {
  border-color: var(--agenda-border);
  background: #111827;
}

.dark-mode .agenda-table thead th {
  border-color: var(--agenda-border);
  background: rgba(17, 24, 39, 0.96);
  color: var(--agenda-muted);
}

.dark-mode .agenda-table tbody td,
.dark-mode .agenda-table tbody tr:nth-child(even) td {
  border-bottom-color: #1f2d42;
  background: #0f172a;
}

.dark-mode .agenda-table tbody tr:hover td {
  background: #15223a !important;
}

.dark-mode .agenda-table tbody tr.agenda-empty-row td.agenda-empty-cell,
.dark-mode .agenda-table tbody tr.agenda-empty-row:hover td.agenda-empty-cell {
  background: #0f172a !important;
  color: var(--agenda-muted);
}

.dark-mode .agenda-table tbody tr.agenda-row-metric-confirmado td,
.dark-mode .agenda-table tbody tr.agenda-row-metric-confirmado:hover td {
  background: rgba(21, 128, 61, 0.46) !important;
}

.dark-mode .agenda-table tbody tr.agenda-row-metric-cancelado td,
.dark-mode .agenda-table tbody tr.agenda-row-metric-cancelado:hover td {
  background: rgba(185, 28, 28, 0.46) !important;
}

.dark-mode .agenda-table tbody tr.agenda-row-metric-reprogramado td,
.dark-mode .agenda-table tbody tr.agenda-row-metric-reprogramado:hover td {
  background: rgba(109, 40, 217, 0.48) !important;
}

.dark-mode .agenda-table tbody tr.agenda-row-metric-no-contesta td,
.dark-mode .agenda-table tbody tr.agenda-row-metric-no-contesta:hover td {
  background: rgba(71, 85, 105, 0.5) !important;
}

.dark-mode .agenda-table tbody tr.agenda-row-metric-igs td,
.dark-mode .agenda-table tbody tr.agenda-row-metric-igs:hover td {
  background: rgba(194, 65, 12, 0.52) !important;
}

.dark-mode .agenda-table tbody tr.agenda-row-metric-pendiente td,
.dark-mode .agenda-table tbody tr.agenda-row-metric-pendiente:hover td {
  background: rgba(109, 40, 217, 0.46) !important;
}

.dark-mode .agenda-time-pill {
  background: #102b52;
  box-shadow: inset 0 0 0 1px #1e4f8f;
}

.dark-mode .agenda-hora-slot-0 .agenda-time-pill { background: #4a1524; color: #fecdd3; box-shadow: inset 0 0 0 1px #9f1239; }
.dark-mode .agenda-hora-slot-1 .agenda-time-pill { background: #073b2a; color: #bbf7d0; box-shadow: inset 0 0 0 1px #047857; }
.dark-mode .agenda-hora-slot-2 .agenda-time-pill { background: #102b52; color: #bfdbfe; box-shadow: inset 0 0 0 1px #1d4ed8; }
.dark-mode .agenda-hora-slot-3 .agenda-time-pill { background: #4a3310; color: #fde68a; box-shadow: inset 0 0 0 1px #92400e; }
.dark-mode .agenda-hora-slot-4 .agenda-time-pill { background: #4a2410; color: #fed7aa; box-shadow: inset 0 0 0 1px #9a3412; }
.dark-mode .agenda-hora-slot-5 .agenda-time-pill { background: #42320a; color: #fcd34d; box-shadow: inset 0 0 0 1px #854d0e; }
.dark-mode .agenda-hora-slot-6 .agenda-time-pill { background: #0f3b38; color: #99f6e4; box-shadow: inset 0 0 0 1px #0f766e; }
.dark-mode .agenda-hora-slot-7 .agenda-time-pill { background: #2d1958; color: #ddd6fe; box-shadow: inset 0 0 0 1px #6d28d9; }
.dark-mode .agenda-hora-slot-default .agenda-time-pill { background: #1f2d42; color: #cbd5e1; box-shadow: inset 0 0 0 1px #475569; }

.dark-mode .agenda-action-menu-item:hover {
  background: #15223a;
}

.dark-mode .agenda-month-header {
  border-color: var(--agenda-border);
  background: rgba(17, 24, 39, 0.92);
}

.dark-mode .agenda-month-day {
  border-color: var(--agenda-border);
  background: #0f172a;
}

.dark-mode .agenda-month-day.has-items {
  background: #102b52;
  border-color: #1e4f8f;
}

body[data-theme="vampire"].dark-mode .agenda-container {
  --agenda-primary: #007acc;
  --agenda-primary-dark: #9cdcfe;
  --agenda-secondary: #4ec9b0;
  --agenda-background: #1e1e1e;
  --agenda-surface: #252526;
  --agenda-border: #3c3c3c;
  --agenda-text: #d4d4d4;
  --agenda-muted: #9da5b4;
  --agenda-success: #4ec9b0;
  --agenda-warning: #d19a66;
  --agenda-danger: #f14c4c;
}

body[data-theme="vampire"].dark-mode .agenda-metric-card,
body[data-theme="vampire"].dark-mode .agenda-controls,
body[data-theme="vampire"].dark-mode .agenda-table-wrap,
body[data-theme="vampire"].dark-mode .agenda-month-view,
body[data-theme="vampire"].dark-mode .agenda-action-menu-panel {
  border-color: #3c3c3c;
  background: rgba(37, 37, 38, 0.92);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
}

body[data-theme="vampire"].dark-mode .agenda-date-nav,
body[data-theme="vampire"].dark-mode .agenda-date-field,
body[data-theme="vampire"].dark-mode .agenda-search-field,
body[data-theme="vampire"].dark-mode .agenda-select-shell,
body[data-theme="vampire"].dark-mode .agenda-date-nav-btn,
body[data-theme="vampire"].dark-mode .agenda-soft-icon-btn,
body[data-theme="vampire"].dark-mode .agenda-action-menu-btn,
body[data-theme="vampire"].dark-mode .agenda-action-btn {
  border-color: #3c3c3c;
  background: #1f1f1f;
}

body[data-theme="vampire"].dark-mode .agenda-table thead th {
  border-color: #3c3c3c;
  background: #252526;
  color: #9da5b4;
}

body[data-theme="vampire"].dark-mode .agenda-table tbody td,
body[data-theme="vampire"].dark-mode .agenda-table tbody tr:nth-child(even) td {
  border-bottom-color: #303030;
  background: #1e1e1e;
}

body[data-theme="vampire"].dark-mode .agenda-table tbody tr:hover td {
  background: #25384b !important;
}

body[data-theme="vampire"].dark-mode .agenda-action-menu-item:hover {
  background: #2a2d2e;
}

body[data-theme="vampire"].dark-mode .agenda-month-header {
  border-color: #3c3c3c;
  background: #252526;
}

body[data-theme="vampire"].dark-mode .agenda-month-day {
  border-color: #3c3c3c;
  background: #1f1f1f;
}

body[data-theme="vampire"].dark-mode .agenda-month-day.has-items {
  background: #25384b;
  border-color: #007acc;
}

body[data-theme="princess"] .agenda-container {
  --agenda-primary: #ff69b4;
  --agenda-primary-dark: #cd0067;
  --agenda-secondary: #a855f7;
  --agenda-background: #fff1f8;
  --agenda-surface: #fff7fc;
  --agenda-border: #ffc2df;
  --agenda-text: #4a2340;
  --agenda-muted: #845872;
  --agenda-success: #22a164;
  --agenda-warning: #d97706;
  --agenda-danger: #e11d48;
}

body[data-theme="princess"] .agenda-metric-card,
body[data-theme="princess"] .agenda-controls,
body[data-theme="princess"] .agenda-table-wrap,
body[data-theme="princess"] .agenda-month-view,
body[data-theme="princess"] .agenda-action-menu-panel {
  border-color: var(--agenda-border);
  background: rgba(255, 247, 252, 0.92);
  box-shadow: 0 12px 28px rgba(126, 58, 99, 0.1);
}

body[data-theme="princess"] .agenda-date-nav,
body[data-theme="princess"] .agenda-date-field,
body[data-theme="princess"] .agenda-search-field,
body[data-theme="princess"] .agenda-select-shell,
body[data-theme="princess"] .agenda-date-nav-btn,
body[data-theme="princess"] .agenda-soft-icon-btn,
body[data-theme="princess"] .agenda-action-menu-btn,
body[data-theme="princess"] .agenda-action-btn {
  border-color: var(--agenda-border);
  background: #fff7fc;
}

body[data-theme="princess"] .agenda-view-btn.is-active {
  background: #ffd7ec;
  border-color: #ff9cce;
  color: #cd0067;
}

body[data-theme="princess"] .agenda-table thead th {
  border-color: #ffc2df;
  background: #ffe8f4;
  color: #845872;
}

body[data-theme="princess"] .agenda-table tbody td {
  border-bottom-color: rgba(214, 51, 154, 0.16);
  background: #fff7fc;
}

body[data-theme="princess"] .agenda-table tbody tr:nth-child(even) td {
  background: #fff0f8;
}

body[data-theme="princess"] .agenda-table tbody tr:hover td {
  background: #ffe1f1 !important;
}

body[data-theme="princess"] .agenda-time-pill {
  background: #ffe3f2;
  color: #cd0067;
  box-shadow: inset 0 0 0 1px #ffc2df;
}

body[data-theme="princess"] .agenda-hora-slot-0 .agenda-time-pill { background: #ffd8ec; color: #9f1239; box-shadow: inset 0 0 0 1px #ff9cce; }
body[data-theme="princess"] .agenda-hora-slot-1 .agenda-time-pill { background: #e4fbea; color: #0f6a42; box-shadow: inset 0 0 0 1px #bceacb; }
body[data-theme="princess"] .agenda-hora-slot-2 .agenda-time-pill { background: #eadcff; color: #6b21a8; box-shadow: inset 0 0 0 1px #d8b4fe; }
body[data-theme="princess"] .agenda-hora-slot-3 .agenda-time-pill { background: #fff0dc; color: #9a3412; box-shadow: inset 0 0 0 1px #fed7aa; }
body[data-theme="princess"] .agenda-hora-slot-4 .agenda-time-pill { background: #ffe6f1; color: #9f1239; box-shadow: inset 0 0 0 1px #ffb8d7; }
body[data-theme="princess"] .agenda-hora-slot-5 .agenda-time-pill { background: #fff4d6; color: #8a5b08; box-shadow: inset 0 0 0 1px #f5d88b; }
body[data-theme="princess"] .agenda-hora-slot-6 .agenda-time-pill { background: #e7f8f5; color: #0f766e; box-shadow: inset 0 0 0 1px #bcece4; }
body[data-theme="princess"] .agenda-hora-slot-7 .agenda-time-pill { background: #f1ecff; color: #6d3bd8; box-shadow: inset 0 0 0 1px #ddd1ff; }
body[data-theme="princess"] .agenda-hora-slot-default .agenda-time-pill { background: #ffeff8; color: #845872; box-shadow: inset 0 0 0 1px #ffc2df; }

body[data-theme="princess"] .agenda-action-menu-item:hover {
  background: #ffe3f2;
}

body[data-theme="princess"] .agenda-month-header {
  border-color: #ffc2df;
  background: #ffe8f4;
}

body[data-theme="princess"] .agenda-month-day {
  border-color: #ffc2df;
  background: #fff7fc;
}

body[data-theme="princess"] .agenda-month-day.has-items {
  background: #ffe8f4;
  border-color: #ff9cce;
}

@media (max-width: 1500px) {
  .agenda-hero-metrics {
    grid-template-columns: repeat(auto-fit, minmax(112px, 132px));
  }

  .agenda-control-metrics {
    flex-basis: 680px;
    max-width: 820px;
  }
}

@media (max-width: 1200px) {
  .agenda-modern-hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .agenda-hero-metrics {
    grid-template-columns: repeat(4, minmax(76px, 1fr));
    justify-content: stretch;
  }

  .agenda-control-metrics {
    order: 10;
    flex-basis: 100%;
    max-width: none;
    margin-left: 0;
  }
}

@media (max-width: 760px) {
  .agenda-modern-hero {
    padding-top: 8px;
  }

  .agenda-hero-copy h1 {
    font-size: 21px;
  }

  .agenda-hero-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agenda-filter-primary-btn {
    width: 100%;
    margin-left: 0;
  }

  .agenda-date-nav {
    width: 100%;
  }

  .agenda-date-field {
    flex: 1;
    min-width: 0;
  }
}

/* ---------- Indicaciones para la proxima cita (burbuja en el nombre + tooltip) ---------- */
.agenda-nota-proxima-mark {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  vertical-align: middle;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1px solid #fcd34d;
  background: #fef3c7;
  color: #b45309;
  font-size: 10.5px;
  line-height: 1.2;
  cursor: help;
}
.agenda-nota-proxima-mark svg { width: 12px; height: 12px; }
.agenda-nota-proxima-mark b { font-weight: 800; }

.agenda-nota-proxima-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 3000;
  max-width: 340px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #fcd34d;
  border-left: 3px solid #b45309;
  background: #fff;
  color: #1f2937;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  font-size: 12.5px;
  line-height: 1.4;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.agenda-nota-proxima-tooltip.is-open { visibility: visible; opacity: 1; }
.agenda-nota-proxima-tooltip-title { font-weight: 700; margin-bottom: 4px; color: #b45309; }
.agenda-nota-proxima-tooltip-item + .agenda-nota-proxima-tooltip-item {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #fcd34d;
}
.agenda-nota-proxima-tooltip-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.agenda-nota-proxima-tooltip-meta { margin-top: 3px; font-size: 11px; color: #6b7280; }

.dark-mode .agenda-nota-proxima-mark { background: #3b2f14; border-color: #92662a; color: #fcd34d; }
.dark-mode .agenda-nota-proxima-tooltip { background: #1f2430; color: #e5e7eb; border-color: #92662a; border-left-color: #fcd34d; }
.dark-mode .agenda-nota-proxima-tooltip-title { color: #fcd34d; }
.dark-mode .agenda-nota-proxima-tooltip-item + .agenda-nota-proxima-tooltip-item { border-top-color: #92662a; }
.dark-mode .agenda-nota-proxima-tooltip-meta { color: #9ca3af; }

/* =====================================================
   AGENDA EN TABLET (Galaxy Tab A9 con escala 1,5x: ~533 px vertical, ~893 px horizontal)
   Las columnas fijas suman ~714 px: con menos ancho el nombre quedaba partido palabra por palabra y
   la hora encima. Se mide el ancho real de la tabla (container query), no el de la ventana.
===================================================== */
.agenda-table-wrap {
  container-type: inline-size;
}

/* Horizontal: columnas fijas mas angostas para que nombre y comentario tengan lugar. */
@container (max-width: 1000px) {
  .agenda-table {
    --agenda-hora-width: 78px;
    --agenda-fecha-width: 100px;
    --agenda-telefono-width: 92px;
    --agenda-estado-width: 128px;
    --agenda-acciones-width: 168px;
  }
  .agenda-table .select-estado {
    width: 100%;
  }
}

/* Vertical: cada cita es una ficha de 3 lineas, sin scroll lateral.
     1) [#] Nombre .......................... Hora
     2) Fecha  Telefono ................... Estado
     3) Marcas  Comentario ............... Acciones
   Flex con saltos de linea forzados (::before / ::after de la fila, ancho 100% y alto 0).
   Fondo: las celdas quedan transparentes y la del nombre pinta su propio fondo (el del tema, la
   franja par, el hover o el resaltado de estado) en toda la ficha con un ::before (background: inherit).
   Asi no hay parches de color y no hace falta repetir los colores de cada tema. */
@container (max-width: 700px) {
  .agenda-table,
  .agenda-table tbody {
    display: block;
    width: 100%;
  }
  .agenda-table thead {
    display: none;
  }
  .agenda-table tbody tr.agenda-row {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 8px;
    height: auto;
    padding: 7px 10px;
    border-bottom: 1px solid var(--agenda-border);
  }
  .agenda-table tbody tr.agenda-row::before,
  .agenda-table tbody tr.agenda-row::after {
    content: "";
    flex-basis: 100%;
    height: 0;
  }
  .agenda-table tbody tr.agenda-row::before { order: 35; }
  .agenda-table tbody tr.agenda-row::after { order: 65; }

  .agenda-table tbody tr.agenda-row > td {
    display: block;
    width: auto !important;
    min-width: 0;
    max-width: none;
    padding: 3px 0;
    border: none !important;
    box-shadow: none;
  }
  .agenda-table-wrap .agenda-table tbody tr.agenda-row > td:not(.agenda-col-nombre) {
    background: transparent !important;
  }
  .agenda-table tbody tr.agenda-row > td.agenda-col-nombre::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: inherit;
  }

  .agenda-table tbody tr.agenda-row > td.agenda-col-num { order: 10; flex: none; font-weight: 800; }
  /* position static: el resaltado de estado pone position:relative a las celdas y encerraria el ::before. */
  .agenda-table tbody tr.agenda-row > td.agenda-col-nombre { order: 20; flex: 1 1 0; position: static; font-size: 13.5px; font-weight: 700; overflow-wrap: anywhere; }
  .agenda-table tbody tr.agenda-row > td.agenda-col-hora { order: 30; flex: none; }
  .agenda-table tbody tr.agenda-row > td.agenda-col-fecha { order: 40; flex: none; }
  .agenda-table tbody tr.agenda-row > td.agenda-col-telefono { order: 50; flex: 1 1 auto; font-size: 12px; }
  .agenda-table tbody tr.agenda-row > td.agenda-col-estado { order: 60; flex: none; }
  .agenda-table tbody tr.agenda-row > td.agenda-col-contacto { order: 70; flex: none; }
  .agenda-table tbody tr.agenda-row > td.agenda-col-comentario { order: 80; flex: 1 1 0; font-size: 12px; }
  .agenda-table tbody tr.agenda-row > td.agenda-col-acciones { order: 90; flex: none; margin-left: auto; }
  /* Sin comentario queda un hueco entre marcas y acciones: se agrega con doble toque ahi. */
  .agenda-table tbody tr.agenda-row > td.agenda-col-comentario .comment-text { min-height: 26px; display: flex; align-items: center; flex-wrap: wrap; padding-left: 0; }
  /* El tratamiento arranca en el mismo borde izquierdo que nombre y fecha (sin el relleno ni el margen del chip). */
  .agenda-table tbody tr.agenda-row > td.agenda-col-comentario .comment-text > :first-child { margin-left: 0; }

  .agenda-table .select-estado {
    width: auto;
    min-width: 118px;
    height: 28px;
    min-height: 28px;
    font-size: 12px;
  }
  .agenda-time-pill strong {
    font-size: 12.5px;
  }
  /* Acciones a tamaño de dedo sin ocupar una linea propia. */
  .agenda-table .agenda-actions {
    gap: 4px;
  }
  .agenda-table .agenda-action-btn {
    width: 30px;
    height: 30px;
  }
  .agenda-table .agenda-contacto-flags {
    gap: 4px;
  }
  /* La barra de color del resaltado va en la primera celda del DOM (marcas de contacto), que en la
     ficha queda abajo: se quita, el fondo de la ficha ya indica el estado. */
  .agenda-table tbody tr.agenda-row-metric-highlight td:first-child {
    border-left: none;
  }
  .agenda-table tbody tr.agenda-empty-row,
  .agenda-table tbody tr.agenda-empty-row td {
    display: block;
    width: 100%;
  }
}

/* Tarjetas de conteo en tablet vertical: 3 por fila (antes 2 y la tercera quedaba sola);
   filtros Estado/Contacto mitad y mitad. */
@media (max-width: 760px) {
  .agenda-hero-metrics {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  }
  .agenda-control-row-filters > .agenda-filter-estado-wrap,
  .agenda-control-row-filters > .agenda-select-shell {
    flex: 1 1 180px;
    min-width: 0;
  }
  .agenda-control-row-flags {
    gap: 14px;
  }
}
@media (max-width: 760px) {
  .agenda-filter-estado-wrap > .agenda-select-shell {
    flex: 1 1 auto;
  }
}

/* Herramientas en tablet vertical: una fila menos.
     1) [Hoy] [Dia][Mes] ................. [Inasistencias] [Resumen]
     2) < fecha >  (todo el ancho)
     3) tarjetas de conteo (todo el ancho)
   Mismo HTML, solo cambia el orden visual de los hijos de .agenda-control-row-primary. */
@media (max-width: 760px) {
  .agenda-control-row-primary > #agenda-today { order: 1; }
  .agenda-control-row-primary > .agenda-view-toggle { order: 2; }
  .agenda-control-row-primary > #agenda-review-ina { order: 3; margin-left: auto; }
  .agenda-control-row-primary > #agenda-day-summary-open { order: 4; }
  .agenda-control-row-primary > .agenda-date-nav { order: 5; flex: 1 1 100%; }
  .agenda-control-row-primary > .agenda-control-metrics { order: 6; flex: 1 1 100%; }
  .agenda-control-row-filters > .agenda-search-field { flex: 1 1 100%; }
}

/* Reportes de agenda (reusa el modal de Resumen del dia) */
.agenda-report-dialog {
  width: min(1080px, calc(100vw - 32px));
  --rep-surface: #f5f7fb;
  --rep-card: #fff;
  --rep-border: #e2e8f0;
  --rep-text: #0f172a;
  --rep-muted: #64748b;
  --rep-faint: #cbd5e1;
  --rep-head: #f8fafc;
  --rep-total: #eef2f7;
  --rep-confirmado: #16a34a;
  --rep-pendiente: #e0a82e;
  --rep-reprogramado: #8b5cf6;
  --rep-cancelado: #dc2626;
  --rep-no-contesta: #64748b;
  --rep-igs: #ea580c;
}

.dark-mode .agenda-report-dialog {
  --rep-surface: #0b1222;
  --rep-card: #111a2e;
  --rep-border: #26324a;
  --rep-text: #e2e8f0;
  --rep-muted: #94a3b8;
  --rep-faint: #475569;
  --rep-head: #16213a;
  --rep-total: #1b2742;
  --rep-cancelado: #ef4444;
  --rep-igs: #f97316;
}

.agenda-report-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rep-border);
}

.agenda-report-controls .agenda-day-summary-view-toggle {
  margin: 0;
}

.agenda-report-period {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.agenda-report-nav {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rep-border);
  border-radius: 8px;
  background: var(--rep-card);
  color: var(--rep-text);
  cursor: pointer;
}

.agenda-report-nav:hover {
  border-color: #93c5fd;
}

.agenda-report-nav .agenda-action-icon {
  width: 14px;
  height: 14px;
}

.agenda-report-month {
  height: 32px;
  border: 1px solid var(--rep-border);
  border-radius: 8px;
  padding: 0 8px;
  font: inherit;
  font-size: 13px;
  background: var(--rep-card);
  color: var(--rep-text);
}

.dark-mode .agenda-report-month {
  color-scheme: dark;
}

.agenda-report-meta {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--rep-muted);
}

.agenda-report-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 4px;
  background: var(--rep-surface);
}

.agenda-report-section {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--rep-border);
  border-radius: 12px;
  background: var(--rep-card);
}

.agenda-report-section > header {
  margin-bottom: 10px;
}

.agenda-report-section h4 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--rep-text);
}

.agenda-report-section > header p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--rep-muted);
}

.agenda-report-count {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--rep-total);
  color: var(--rep-muted);
  font-size: 12px;
}

.agenda-report-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.agenda-report-kpis.is-compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 10px;
}

.agenda-report-kpi {
  padding: 10px 12px;
  border: 1px solid var(--rep-border);
  border-radius: 10px;
}

.agenda-report-kpi.is-main {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.dark-mode .agenda-report-kpi.is-main {
  border-color: #1e3a8a;
  background: #13244a;
}

.agenda-report-kpi span {
  display: block;
  font-size: 12px;
  color: var(--rep-muted);
}

.agenda-report-kpi strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  line-height: 1.1;
  color: var(--rep-text);
  font-variant-numeric: tabular-nums;
}

.agenda-report-kpis.is-compact .agenda-report-kpi strong {
  font-size: 20px;
}

.agenda-report-kpi.is-zero strong {
  color: var(--rep-faint);
}

.agenda-report-kpi small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--rep-muted);
}

/* Distribucion por estado: barra apilada + leyenda con numeros (el color nunca va solo). */
.agenda-report-bar {
  display: flex;
  gap: 2px;
  height: 12px;
  margin-top: 14px;
}

.agenda-report-bar span {
  min-width: 4px;
}

.agenda-report-bar span:first-child {
  border-radius: 4px 0 0 4px;
}

.agenda-report-bar span:last-child {
  border-radius: 0 4px 4px 0;
}

.agenda-report-bar span:only-child {
  border-radius: 4px;
}

.agenda-report-legend {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.agenda-report-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--rep-muted);
}

.agenda-report-legend strong {
  color: var(--rep-text);
  font-variant-numeric: tabular-nums;
}

.agenda-report-legend small {
  font-variant-numeric: tabular-nums;
}

.agenda-report-legend li.is-zero {
  opacity: 0.55;
}

.agenda-report-legend i,
.agenda-report-table th i,
.agenda-report-estado i {
  width: 9px;
  height: 9px;
  flex: none;
  display: inline-block;
  border-radius: 3px;
}

.agenda-report-dialog .is-est-confirmado { background: var(--rep-confirmado); }
.agenda-report-dialog .is-est-pendiente { background: var(--rep-pendiente); }
.agenda-report-dialog .is-est-reprogramado { background: var(--rep-reprogramado); }
.agenda-report-dialog .is-est-cancelado { background: var(--rep-cancelado); }
.agenda-report-dialog .is-est-no-contesta { background: var(--rep-no-contesta); }
.agenda-report-dialog .is-est-igs { background: var(--rep-igs); }

/* Tablas */
.agenda-report-table-wrap {
  border: 1px solid var(--rep-border);
  border-radius: 10px;
  overflow: auto;
}

.agenda-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.agenda-report-table th {
  padding: 9px 12px;
  background: var(--rep-head);
  border-bottom: 1px solid var(--rep-border);
  color: var(--rep-muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  text-align: right;
}

.agenda-report-table th i {
  margin-right: 5px;
}

.agenda-report-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--rep-border);
  color: var(--rep-text);
  text-align: right;
  white-space: nowrap;
}

.agenda-report-table th:first-child,
.agenda-report-table td:first-child {
  text-align: left;
}

.agenda-report-table tbody tr:last-child td {
  border-bottom: none;
}

.agenda-report-table tbody tr:hover td {
  background: var(--rep-head);
}

.agenda-report-table td.is-strong {
  font-weight: 700;
}

.agenda-report-table td.is-zero {
  color: var(--rep-faint);
}

.agenda-report-table tr.is-empty td:first-child {
  color: var(--rep-muted);
}

.agenda-report-table tbody tr.is-total td {
  font-weight: 700;
  background: var(--rep-total);
}

.agenda-report-table-list th,
.agenda-report-table-list td {
  text-align: left;
}

.agenda-report-table-list td:first-child {
  white-space: normal;
  font-weight: 600;
}

.agenda-report-estado {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.agenda-report-empty {
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--rep-border);
  border-radius: 10px;
  background: var(--rep-card);
  color: var(--rep-muted);
  font-size: 13px;
  font-weight: 600;
}

.agenda-report-empty.is-error {
  color: #b91c1c;
}

@media (max-width: 760px) {
  .agenda-control-row-primary > #agenda-report-open { order: 4; }
  .agenda-report-kpis { grid-template-columns: 1fr; }
  .agenda-report-kpis.is-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agenda-report-meta { margin-left: 0; flex-basis: 100%; }
}

/* ---------- Notas del dia (agenda_nota_dia): aviso ambar arriba de la tabla, 📌 en el calendario y en el modal ---------- */
.agenda-notas-dia,
.agenda-modal-notas {
  display: grid;
  gap: 6px;
  margin: 8px 0 6px;
}
.agenda-notas-dia[hidden],
.agenda-modal-notas[hidden] {
  display: none;
}
.agenda-nota-dia-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 8px 12px;
  /* Misma paleta que la pill Pendiente (.estado-pendiente) y el tooltip de notas de proxima cita. */
  border: 1px solid #f5d88b;
  border-left: 3px solid #b45309;
  border-radius: 10px;
  background: #fff4d6;
  color: #8a5b08;
  font-size: 13px;
  font-weight: 700;
}
.agenda-nota-dia-texto {
  flex: 1 1 220px;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.agenda-nota-dia-autor {
  color: #b45309;
  font-weight: 600;
}
/* Editar/Borrar como iconos: en PC aparecen al pasar el mouse por la nota; en tablet (sin hover) siempre. */
.agenda-nota-dia-acciones {
  display: inline-flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.agenda-nota-dia-item:hover .agenda-nota-dia-acciones,
.agenda-nota-dia-acciones:focus-within {
  opacity: 1;
}
@media (hover: none) {
  .agenda-nota-dia-acciones { opacity: 1; }
}
.agenda-nota-dia-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #8a5b08;
  cursor: pointer;
}
.agenda-nota-dia-btn .agenda-action-icon {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}
.agenda-nota-dia-btn:hover,
.agenda-nota-dia-btn:focus-visible {
  border-color: #f5d88b;
  background: #fff;
}
.agenda-nota-dia-btn.is-danger:hover,
.agenda-nota-dia-btn.is-danger:focus-visible {
  border-color: #f87171;
  color: #b91c1c;
}

/* Aviso del dia: cada nota entra al crearse (solo se repinta cuando cambian las notas, ver renderNotasDia),
   el pin se mueve y la nota hace dos pulsos ambar para llamar la atencion; despues queda quieta. */
.agenda-nota-dia-item {
  animation:
    agenda-nota-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both,
    agenda-nota-pulse 1.2s ease-in-out 0.45s 2;
}
/* Despues sigue resaltando sin cansar: cada 4 s pasa un brillo por la nota y el pin se mueve. */
.agenda-notas-dia .agenda-nota-dia-item {
  position: relative;
  overflow: hidden;
}
.agenda-notas-dia .agenda-nota-dia-item::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.75) 50%, transparent 65%);
  transform: translateX(-100%);
  animation: agenda-nota-shine 4s ease-in-out 1.6s infinite;
}
.agenda-nota-dia-pin {
  display: inline-block;
  transform-origin: 50% 90%;
  animation: agenda-nota-pin-loop 4s ease-in-out 0.3s infinite;
}
@keyframes agenda-nota-shine {
  0% { transform: translateX(-100%); }
  30%, 100% { transform: translateX(100%); }
}
@keyframes agenda-nota-pin-loop {
  0%, 22%, 100% { transform: rotate(0); }
  5% { transform: rotate(-18deg); }
  11% { transform: rotate(14deg); }
  17% { transform: rotate(-8deg); }
}
.dark-mode .agenda-notas-dia .agenda-nota-dia-item::after {
  background: linear-gradient(105deg, transparent 35%, rgba(253, 230, 138, 0.18) 50%, transparent 65%);
}
@keyframes agenda-nota-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes agenda-nota-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(243, 154, 60, 0); }
  50% { box-shadow: 0 0 0 5px rgba(243, 154, 60, 0.28); }
}

/* Calendario: dia con nota con borde ambar y un brillo que respira (color --agenda-warning, el amarillo de
   Pendiente es muy palido sobre blanco). Con outline para no pisar el azul de is-selected. */
.agenda-month-day.has-nota {
  border-color: #f5d88b;
  outline: 3px solid rgba(243, 154, 60, 0);
  outline-offset: 0;
  animation: agenda-nota-glow 2.4s ease-in-out infinite;
}
/* La celda tambien entra en cascada (.fx-cell-in): se combinan las dos animaciones. */
.agenda-month-day.has-nota.fx-cell-in {
  animation:
    fxRowDrop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) var(--fx-delay, 0ms) both,
    agenda-nota-glow 2.4s ease-in-out infinite;
}
@keyframes agenda-nota-glow {
  0%, 100% { outline-color: rgba(243, 154, 60, 0); }
  50% { outline-color: rgba(243, 154, 60, 0.55); }
}
.agenda-month-nota {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 14px;
  line-height: 1;
}
@media (prefers-reduced-motion: reduce) {
  .agenda-nota-dia-item,
  .agenda-notas-dia .agenda-nota-dia-item::after,
  .agenda-nota-dia-pin,
  .agenda-month-day.has-nota,
  .agenda-month-day.has-nota.fx-cell-in {
    animation: none;
  }
}
.dark-mode .agenda-nota-dia-item {
  border-color: #92662a;
  border-left-color: #fcd34d;
  background: #3b2f14;
  color: #fde68a;
}
.dark-mode .agenda-nota-dia-autor {
  color: #fcd34d;
}
.dark-mode .agenda-nota-dia-btn {
  color: #fde68a;
}
.dark-mode .agenda-nota-dia-btn:hover,
.dark-mode .agenda-nota-dia-btn:focus-visible {
  background: rgba(250, 204, 21, 0.12);
}
.dark-mode .agenda-nota-dia-btn.is-danger:hover,
.dark-mode .agenda-nota-dia-btn.is-danger:focus-visible {
  color: #fca5a5;
}
.dark-mode .agenda-month-day.has-nota {
  border-color: #92662a;
}
@media (max-width: 760px) {
  .agenda-control-row-primary > #agenda-nota-dia-open { order: 4; }
}

/* Calendario mes: carga del dia (relativa al dia mas lleno del mes) */
.agenda-month-weekdays,
.agenda-month-grid { grid-template-columns: repeat(6, minmax(0, 1fr)) minmax(0, 0.55fr); }
.agenda-month-load { display: inline-flex; align-items: center; gap: 6px; }
.agenda-month-day.is-load-low .agenda-month-count { background: #16a34a; }
.agenda-month-day.is-load-mid .agenda-month-count { background: #d97706; }
.agenda-month-day.is-load-high .agenda-month-count { background: #dc2626; }
.agenda-month-day.is-load-low { border-left: 4px solid #16a34a; }
.agenda-month-day.is-load-mid { border-left: 4px solid #d97706; }
.agenda-month-day.is-load-high { border-left: 4px solid #dc2626; background: #fff5f5; }
.agenda-month-samples em.is-more { color: var(--agenda-muted, #64748b); }
.agenda-month-day.is-sunday:not(.has-items) { background: transparent; opacity: 0.55; }
.agenda-month-day.is-today { border-color: #2563eb; box-shadow: inset 0 0 0 2px #2563eb; }
.agenda-month-day.is-today .agenda-month-day-number { color: #2563eb; }
.dark-mode .agenda-month-day.is-load-high { background: rgba(127, 29, 29, 0.28); }
