/* ============================================================
   Calendario profesional (día / semana / mes)
   ============================================================ */
.cal-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav button {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 15px;
}
.cal-nav button:hover { background: var(--hover); }
.cal-title { font-size: 16px; font-weight: 700; min-width: 180px; text-transform: capitalize; }
.cal-views { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; border: 1px solid var(--border); }
.cal-views button { border: none; background: none; padding: 6px 14px; border-radius: 999px; color: var(--text-soft); font-weight: 600; font-size: 12px; }
.cal-views button.active { background: var(--brand-grad); color: #fff; }
.cal-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-left: auto; }
.cal-legend span { font-size: 11px; color: var(--text-soft); display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.calendar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}

/* ---- Vista mensual ---- */
.month-head, .month-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.month-head div { padding: 10px; text-align: center; font-size: 12px; font-weight: 700; color: var(--text-soft); border-bottom: 1px solid var(--border); }
.month-cell { min-height: 108px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; }
.month-cell:nth-child(7n) { border-right: none; }
.month-cell.out { background: var(--surface-2); opacity: .5; }
.month-cell.today .daynum { background: var(--brand-grad); color: #fff; }
.daynum { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.mini-event {
  font-size: 11px; padding: 3px 6px; border-radius: 6px; margin-bottom: 3px;
  color: #fff; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---- Vista semana / día (rejilla horaria) ---- */
.time-grid { display: grid; max-height: 640px; overflow-y: auto; }
.time-grid__head { display: grid; position: sticky; top: 0; background: var(--surface); z-index: 2; border-bottom: 1px solid var(--border); }
.time-grid__head div { padding: 10px; text-align: center; font-size: 12px; font-weight: 700; border-right: 1px solid var(--border); }
.time-body { display: grid; position: relative; }
.time-col { border-right: 1px solid var(--border); position: relative; }
.time-label { font-size: 11px; color: var(--text-soft); text-align: right; padding: 2px 8px; height: 52px; border-bottom: 1px solid var(--border); }
.time-slot { height: 52px; border-bottom: 1px solid var(--border); transition: background .15s; }
.time-slot:hover { background: var(--hover); }
.time-slot.dragover { background: rgba(168,85,247,.15); }

.event {
  position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 6px 8px;
  color: #fff; font-size: 11px; box-shadow: 0 2px 8px rgba(0,0,0,.15); cursor: grab; overflow: hidden;
  border-left: 3px solid rgba(255,255,255,.6);
}
.event:active { cursor: grabbing; }
.event.dragging { opacity: .5; }
.event strong { display: block; font-size: 12px; font-weight: 700; }
.event small { opacity: .9; }

/* Colores por estado (fondo de evento) */
.ev-confirmada { background: #3b82f6; }
.ev-pendiente  { background: #f59e0b; }
.ev-en_atencion{ background: #8b5cf6; }
.ev-finalizada { background: #10b981; }
.ev-cancelada  { background: #ef4444; }
.ev-no_show    { background: #6b7280; }

@media (max-width: 900px) {
  .month-cell { min-height: 76px; }
  .cal-legend { width: 100%; margin-left: 0; }
}
