/* TocaYAvanza v2 — Calendar */

  /* =================== CALENDARIO =================== */
  .cal-toolbar { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); flex-wrap: wrap; }
  .cal-week-nav { display: flex; align-items: center; gap: var(--space-1); }
  .cal-week-label { font-size: var(--text-base); font-weight: var(--fw-semibold); min-width: 200px; text-align: center; color: var(--text); }
  .cal-section-scroll { overflow-x: auto; padding-bottom: var(--space-2); }
  .cal-legend { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; margin-bottom: var(--space-3); }
  .cal-legend-item { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-xs); color: var(--text-muted); }
  .cal-legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

  /* Week grid */
  .cal-week-grid {
    display: grid;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    overflow: hidden; background: var(--card); font-size: var(--text-xs); min-width: 600px;
  }
  .cal-header-cell {
    background: var(--bg); padding: var(--space-2) 6px; text-align: center;
    font-weight: var(--fw-bold); font-size: var(--text-xs); border-bottom: 2px solid var(--border);
    border-right: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
    text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
  }
  .cal-header-cell.today { background: var(--primary-subtle); color: var(--primary); }
  .cal-header-cell:last-child { border-right: none; }
  .cal-time-col-header { background: var(--bg); border-bottom: 2px solid var(--border); border-right: 1px solid var(--border); }

  .cal-body-row { display: contents; }
  .cal-time-cell {
    background: var(--bg); border-right: 1px solid var(--border);
    padding: 0 6px; font-size: 10px; color: var(--text-muted);
    display: flex; align-items: flex-start; padding-top: var(--space-1);
    justify-content: flex-end; min-width: 48px;
  }
  .cal-day-cell {
    border-right: 1px solid var(--border); border-bottom: 1px solid #f1f5f9;
    position: relative; min-height: 50px;
  }
  .cal-day-cell.today-col { background: #fdfcff; }
  .cal-day-cell:last-child { border-right: none; }
  .cal-day-col-wrap {
    position: relative; border-right: 1px solid var(--border);
    overflow: visible;
  }
  .cal-day-col-wrap:last-child { border-right: none; }

  /* Slot blocks */
  .cal-slot-block {
    position: absolute; left: 2px; right: 2px;
    border-radius: var(--radius-sm); padding: 3px 6px; cursor: pointer;
    overflow: hidden; border-left: 3px solid;
    transition: box-shadow 0.1s, transform 0.1s;
    z-index: 5; font-size: var(--text-xs);
  }
  .cal-slot-block:hover { box-shadow: var(--shadow-lg); transform: translateX(1px); z-index: 20; }
  .cal-slot-block .slot-patient { font-weight: var(--fw-bold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cal-slot-block .slot-info { font-size: 10px; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cal-slot-block.is-absent { opacity: 0.35; }
  .cal-slot-block.is-absent .slot-patient { text-decoration: line-through; }
  .cal-slot-block.is-rescheduled { border-style: dashed; opacity: 0.85; }
  .cal-slot-block.is-recovery { border-style: dashed; border-color: #16a34a !important; }
  .cal-slot-block.has-conflict { box-shadow: 0 0 0 2px var(--danger) !important; }
  .cal-slot-block.is-cita { background:#f0f9ff !important; border-color:#0ea5e9 !important; color:#0c4a6e !important; border-style:dashed !important; border-width:2px !important; }
  .cal-slot-block.is-cita .slot-patient::before { content:'📅 '; }
  .cal-slot-block.is-out-of-avail { border-style: dashed !important; }
  /* Plaza reservada (stand-by, mig 099): hueco bloqueado con tramado azul */
  .cal-slot-block.is-reserved { border-style: dashed !important; }
  .cal-slot-block.is-reserved .slot-patient { font-weight: var(--fw-bold); }
  .cal-slot-block.is-reserved:hover { box-shadow: 0 0 0 2px #3b82f6, var(--shadow-lg); }
  /* Badge fino de plaza reservada: superpuesto, NO bloquea la hora — durante
     el stand-by otro paciente puede ocupar la celda a ancho completo. */
  .cal-reserved-badge {
    position: absolute; right: 3px; z-index: 7; pointer-events: all;
    max-width: 64%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 9px; font-weight: 700; line-height: 1.5; padding: 0 5px;
    border-radius: 6px; background: rgba(219,234,254,.92); color: #1d4ed8;
    border: 1px dashed #93c5fd; cursor: pointer;
  }
  .cal-reserved-badge:hover { background: #dbeafe; box-shadow: 0 0 0 2px #93c5fd; }
  .slot-avail-warn { font-size: 10px; margin-right: 2px; vertical-align: middle; }

  /* Current time indicator */
  .cal-now-line {
    position: absolute; width: 100%; height: 2px; background: var(--danger); z-index: 8; left: 0; pointer-events: none;
  }
  .cal-now-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
    position: absolute; left: -4px; top: -3px;
  }

  /* Conflict banner */
  .cal-conflict-banner {
    background: #fff7ed; border: 1px solid #fed7aa; border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3); margin-bottom: var(--space-3); font-size: var(--text-sm); color: #9a3412;
  }

  /* Day/room view */
  .cal-room-grid {
    display: grid; border: 1px solid var(--border); border-radius: var(--radius-md);
    overflow: hidden; background: var(--card); min-width: 600px; font-size: var(--text-xs);
  }
  .cal-day-tabs { display: flex; gap: var(--space-1); margin-bottom: var(--space-2); flex-wrap: wrap; }
  .cal-day-tab {
    padding: 6px var(--space-3); border-radius: 20px; font-size: var(--text-xs); font-weight: var(--fw-semibold);
    cursor: pointer; border: 1px solid var(--border); background: white; color: var(--text-muted);
    transition: all 0.15s;
  }
  .cal-day-tab:hover { background: var(--bg); }
  .cal-day-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

  /* Mobile calendar day-strip */
  .cal-mobile-day-strip {
    display: none;
    overflow-x: auto; gap: 6px; padding: var(--space-2) 0 var(--space-1);
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .cal-mobile-day-strip::-webkit-scrollbar { display: none; }
  .cal-mobile-day-pill {
    flex-shrink: 0; display: flex; flex-direction: column; align-items: center;
    padding: 6px var(--space-2); border-radius: var(--radius-lg); border: 1.5px solid var(--border);
    cursor: pointer; background: var(--card); transition: all .15s; min-width: 44px;
  }
  .cal-mobile-day-pill .pill-dow { font-size: 10px; font-weight: var(--fw-bold); text-transform: uppercase; color: var(--text-muted); }
  .cal-mobile-day-pill .pill-num { font-size: 18px; font-weight: var(--fw-bold); color: var(--text); line-height: 1.1; }
  .cal-mobile-day-pill.today { border-color: var(--primary); }
  .cal-mobile-day-pill.today .pill-num { color: var(--primary); }
  .cal-mobile-day-pill.active { background: var(--primary); border-color: var(--primary); }
  .cal-mobile-day-pill.active .pill-dow,
  .cal-mobile-day-pill.active .pill-num { color: white; }

  .cal-mobile-day-pill .pill-dot {
    display: none;
    width: 5px; height: 5px; border-radius: 50%;
    background: currentColor; opacity: 0.55; margin-top: 2px;
  }
