/* Calendario mensual — electrodiagnóstico */
.electro-cal-wrap.card {
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  background: #fff;
}

.ecal-container {
  padding: 12px 14px 16px;
  --ecal-accent: #1e40af;
  --ecal-accent-soft: #eff6ff;
  --ecal-accent-border: #3b82f6;
  --ecal-today-text: #fff;
}

.ecal-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  gap: 10px 12px;
  align-items: center;
  margin-bottom: 14px;
}

.ecal-header-center {
  grid-column: 2;
  grid-row: 1;
  text-align: center;
  min-width: 0;
}

#electroCalLegend.ecal-legend {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-content: center;
}

.ecal-month-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

.ecal-subtitle {
  display: block;
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 500;
  margin-top: 2px;
}

.ecal-nav-btn {
  grid-row: 1;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

#electroCalPrevMonth { grid-column: 1; }
#electroCalNextMonth { grid-column: 3; }

.ecal-nav-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.ecal-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
}

.ecal-legend-title {
  width: 100%;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.ecal-legend-cont-badge {
  font-size: 0.65rem;
  font-weight: 600;
  color: #a16207;
  background: #fefce8;
  border-radius: 4px;
  padding: 1px 6px;
}

.ecal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: #475569;
}

.ecal-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.ecal-legend-num {
  font-weight: 700;
  color: #0f172a;
}

.ecal-tipo-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  margin-bottom: 12px;
  font-size: 0.65rem;
  color: #64748b;
}

.ecal-tipo-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.ecal-tipo-pill--cont .ecal-tipo-dot--cont {
  width: 14px;
  height: 5px;
  border-radius: 2px;
  background: repeating-linear-gradient(
    -45deg,
    #d97706,
    #d97706 2px,
    #fde68a 2px,
    #fde68a 4px
  );
}

.ecal-tipo-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

/* Vista tipo calendario de escritorio */
.ecal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: #e2e8f0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.ecal-weekday {
  text-align: center;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  padding: 8px 4px;
  background: #f8fafc;
}

.ecal-cell {
  position: relative;
  min-height: 64px;
  border: none;
  border-radius: 0;
  background: #fff;
  color: #334155;
  padding: 6px 6px 5px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  transition: background 0.12s;
  appearance: none;
  -webkit-appearance: none;
}

.ecal-cell.ecal-empty {
  background: #fafbfc;
  cursor: default;
  min-height: 0;
  padding: 0;
}

.ecal-cell:not(.ecal-empty):hover {
  background: #f8fafc;
  z-index: 1;
  box-shadow: inset 0 0 0 1px #cbd5e1;
}

.ecal-cell--idle .ecal-dia-num {
  color: #94a3b8;
  font-weight: 500;
}

.ecal-day {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
}

.ecal-dia-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  line-height: 1;
}

.ecal-count {
  font-size: 0.62rem;
  font-weight: 700;
  color: #64748b !important;
  background: #f1f5f9;
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.3;
}

.ecal-cell--busy .ecal-count {
  color: #0f172a !important;
  background: #e2e8f0;
}

.ecal-track {
  display: flex;
  align-items: stretch;
  gap: 2px;
  width: 100%;
  height: 5px;
  min-height: 5px;
  border-radius: 3px;
  overflow: hidden;
  background: #f1f5f9;
}

.ecal-cell--idle .ecal-track {
  visibility: hidden;
}

.ecal-seg {
  flex: 1 1 4px;
  min-width: 3px;
  border-radius: 2px;
  background: var(--c, #94a3b8);
}

.ecal-seg--cont {
  opacity: 0.85;
  background: repeating-linear-gradient(
    -45deg,
    var(--c, #94a3b8),
    var(--c, #94a3b8) 2px,
    rgba(255, 255, 255, 0.35) 2px,
    rgba(255, 255, 255, 0.35) 4px
  ) !important;
}

.ecal-seg--more {
  flex: 0 0 auto;
  min-width: 14px;
  padding: 0 2px;
  font-size: 0.5rem;
  font-weight: 800;
  color: #64748b;
  background: #e2e8f0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hoy y selección (azul, sin verde de marca) */
.ecal-hoy .ecal-dia-num {
  background: var(--ecal-accent);
  color: #fff !important;
  border-radius: 6px;
  font-weight: 700;
}

.ecal-selected {
  background: var(--ecal-accent-soft) !important;
  box-shadow: inset 0 0 0 2px var(--ecal-accent-border);
}

.ecal-selected.ecal-hoy .ecal-dia-num {
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--ecal-accent-border);
}

.ecal-cell--solo-cont {
  background: #fffbeb;
}

.ecal-cell--solo-cont:hover {
  background: #fef3c7;
}

.ecal-cell--mix {
  background: linear-gradient(180deg, #fff 70%, #fffbeb 100%);
}

@media (max-width: 900px) {
  .ecal-cell {
    min-height: 56px;
    padding: 5px 4px 4px;
  }
}

@media (max-width: 520px) {
  .ecal-container {
    padding: 10px 8px 12px;
  }
  .ecal-cell {
    min-height: 48px;
    padding: 4px 3px 3px;
  }
  .ecal-dia-num {
    font-size: 0.72rem;
    min-width: 1.35rem;
    height: 1.35rem;
  }
  .ecal-count {
    font-size: 0.55rem;
    padding: 0 4px;
  }
  .ecal-track {
    height: 4px;
    min-height: 4px;
  }
  .ecal-weekday {
    font-size: 0.55rem;
    padding: 6px 2px;
  }
}
