/* ============================================================
   Bubble — pages/calendar.css  (Módulo 2: Calendario)
   Cabecera con breadcrumbs + pestañas segmentadas. Tematización
   de FullCalendar (mes/semana), eventos pastel, línea roja "ahora".
   ============================================================ */

.cal-head { margin-bottom: var(--space-5); }
.cal-breadcrumbs { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-tertiary); margin-bottom: var(--space-2); }
.cal-breadcrumbs .sep { opacity: 0.5; }
.cal-title { font-size: var(--text-xl); font-weight: var(--fw-medium); letter-spacing: -0.02em; }

.cal-tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg-overlay); border-radius: var(--radius-md); margin-top: var(--space-4); }
.cal-tab {
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-secondary);
  cursor: pointer; transition: background 120ms ease, color 120ms ease;
}
.cal-tab:hover { color: var(--text-primary); }
.cal-tab.active { background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* ─── Barra de filtros ─── */
.cal-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); }
.cal-filters:empty { display: none; }
.cal-filter select {
  appearance: none; -webkit-appearance: none;
  padding: 6px 28px 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--bg-surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>") no-repeat right 10px center;
  font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-secondary);
  cursor: pointer; transition: border-color 120ms ease, color 120ms ease;
}
.cal-filter select:hover { border-color: var(--border-strong); color: var(--text-primary); }
.cal-filter select:focus { outline: none; border-color: var(--border-focus); }
.cal-filter-clear {
  padding: 6px 10px; border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: var(--fw-medium);
  color: var(--accent); opacity: 0; pointer-events: none; transition: opacity 120ms ease, background 120ms ease;
}
.cal-filter-clear.is-visible { opacity: 1; pointer-events: auto; }
.cal-filter-clear:hover { background: var(--accent-light); }

#calendar {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

/* ─── FullCalendar overrides ─── */
.fc { font-family: var(--font-sans); }
.fc .fc-toolbar.fc-header-toolbar { margin-bottom: var(--space-4); }
.fc .fc-toolbar-title { font-size: var(--text-md); font-weight: var(--fw-medium); color: var(--text-primary); }
.fc .fc-button {
  background: var(--bg-surface) !important; border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important; box-shadow: none !important;
  font-size: var(--text-sm) !important; font-weight: var(--fw-medium) !important;
  text-transform: capitalize; padding: 6px 12px !important; border-radius: var(--radius-md) !important;
}
.fc .fc-button:hover { background: var(--bg-overlay) !important; color: var(--text-primary) !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: var(--accent-light) !important; color: var(--accent-text) !important; border-color: var(--accent) !important;
}
.fc .fc-button .fc-icon { font-size: 1.2em; }
.fc-theme-standard td, .fc-theme-standard th { border-color: var(--border); }
.fc-theme-standard .fc-scrollgrid { border-color: var(--border); }
.fc .fc-col-header-cell-cushion { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-secondary); padding: 8px; text-transform: uppercase; letter-spacing: 0.03em; }
.fc .fc-daygrid-day-number { font-size: var(--text-sm); color: var(--text-secondary); padding: 6px 8px; }
.fc .fc-day-other .fc-daygrid-day-number { color: var(--text-disabled); }
.fc .fc-daygrid-day.fc-day-today { background: var(--accent-light) !important; }
.fc .fc-timegrid-col.fc-day-today { background: var(--accent-light) !important; }
.fc .fc-day-today .fc-daygrid-day-number { color: var(--accent); font-weight: var(--fw-medium); }

/* Eventos compactos, sin bordes de estado. */
.fc-event {
  border: none !important;
  border-radius: 6px !important; padding: 3px 6px !important;
  font-size: var(--text-xs) !important; font-weight: var(--fw-medium) !important;
  cursor: pointer; margin: 1px 2px !important; overflow: hidden;
}
.fc-daygrid-event-dot { display: none; }
.fc .fc-more-link { font-size: var(--text-xs); color: var(--text-tertiary); font-weight: var(--fw-medium); }

/* Línea roja "ahora" (vista semana) */
.fc .fc-timegrid-now-indicator-line { border-color: var(--error); border-width: 2px; }
.fc .fc-timegrid-now-indicator-arrow { border-color: var(--error); color: var(--error); }
.fc .fc-timegrid-slot { height: 2.4em; }
.fc .fc-timegrid-axis-cushion, .fc .fc-timegrid-slot-label-cushion { font-size: var(--text-xs); color: var(--text-tertiary); }

/* Días no laborables con patrón sutil */
.fc .fc-day-sat, .fc .fc-day-sun { background: rgba(241,240,238,0.4); }

/* Vista Agenda (lista): stream cronológico */
.fc .fc-list { border-color: var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.fc .fc-list-day-cushion { background: var(--bg-overlay); font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-secondary); }
.fc .fc-list-event:hover td { background: var(--bg-overlay); }
.fc .fc-list-event-title { font-size: var(--text-sm); color: var(--text-primary); }
.fc .fc-list-event-time { font-size: var(--text-sm); color: var(--text-tertiary); }
.fc .fc-list-empty { background: transparent; color: var(--text-tertiary); font-size: var(--text-sm); }
.fc .fc-list-event-time { display: none; }
.fc .fc-list-event-graphic { display: none; }
.fc .fc-list-event-title { padding: 10px 14px; }
.fc-ev-agenda { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); min-width: 0; width: 100%; }
.fc-ev-agenda > .fc-ev-title { min-width: 0; }
.fc-ev-agenda-meta { display: inline-flex; align-items: center; justify-self: end; gap: var(--space-3); min-width: 0; max-width: 52%; }
.fc-ev-agenda .fc-ev-proj { max-width: 10rem; }

/* Hover sutil en celdas y eventos (feedback de interacción) */
.fc .fc-daygrid-day:hover { background: var(--bg-overlay); transition: background 120ms ease; }
.fc .fc-daygrid-day.fc-day-today:hover { background: var(--accent-light); }
.fc-event { transition: filter 120ms ease, opacity 120ms ease; }
.fc-event:hover { filter: brightness(0.97); }
/* Cursor de arrastre cuando el evento es reprogramable */
.fc-event.fc-event-draggable { cursor: grab; }
.fc-event.fc-event-dragging { cursor: grabbing; opacity: 0.85; }

/* ============================================================
   Menú contextual del evento (clic derecho): abrir / eliminar
   ============================================================ */
.cal-ctx-menu {
  position: fixed; z-index: 1100; min-width: 180px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: var(--space-1);
}
.cal-ctx-item {
  display: flex; align-items: center; gap: var(--space-2); width: 100%; text-align: left;
  padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-secondary);
  transition: background 120ms ease, color 120ms ease;
}
.cal-ctx-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.cal-ctx-item:hover { background: var(--bg-overlay); color: var(--text-primary); }
.cal-ctx-danger { color: var(--error); }
.cal-ctx-danger:hover { background: var(--error-bg); color: var(--error); }

/* ============================================================
   Layout: lienzo del calendario + barra lateral de próximos
   ============================================================ */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-5); align-items: start; }
.cal-layout #calendar { margin: 0; }

.cal-side { position: sticky; top: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.cal-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-sm);
  padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3);
}
.cal-card-head { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.cal-card-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cal-notes-area { width: 100%; min-height: 90px; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; font-size: var(--text-sm); color: var(--text-primary); background: var(--warning-bg); outline: none; resize: vertical; transition: border-color 150ms ease; }
.cal-notes-area:focus { border-color: var(--warning); }
.cal-notes-area::placeholder { color: var(--text-tertiary); }
.cal-prio-flag { width: 13px; height: 13px; flex-shrink: 0; }
.cal-priority-high { color: var(--priority-high); }
.cal-upcoming-list { display: flex; flex-direction: column; gap: var(--space-2); }
#cal-important-list.cal-important-list { display: flex; flex-direction: column; gap: var(--space-3); }
.cal-upcoming-empty { font-size: var(--text-sm); color: var(--text-tertiary); padding: var(--space-2) 0; }
.cal-upcoming-item {
  display: flex; flex-direction: column; gap: 2px; text-align: left; width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border); border-left: 3px solid var(--cal-item-border, var(--accent));
  border-radius: var(--radius-md); background: var(--bg-surface);
  transition: background 120ms ease, border-color 120ms ease;
}
.cal-upcoming-item:hover { background: var(--bg-overlay); }
.cal-upcoming-title { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-upcoming-date { font-size: var(--text-xs); color: var(--text-tertiary); }

/* Apila el panel bajo el calendario en pantallas estrechas */
@media (max-width: 1024px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-side { position: static; }
}

/* Móvil: menús flotantes nunca exceden el viewport */
@media (max-width: 640px) {
  .cal-ctx-menu,
  .cal-inline-create { max-width: calc(100vw - 16px); }
  .cal-inline-create { width: calc(100vw - 16px); }
}

/* ============================================================
   Tarjetas resumen coloridas
   ============================================================ */
.cal-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.cal-sumcard {
  display: flex; align-items: center; gap: var(--space-3); text-align: left;
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg);
  background: var(--bg-surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
.cal-sumcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.cal-sumcard.active { border-color: var(--sc); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sc) 25%, transparent); }
.cal-sumicon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-md); background: var(--scbg); color: var(--sc); flex-shrink: 0; }
.cal-sumicon svg { width: 20px; height: 20px; }
.cal-sumtext { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.cal-sumnum { font-size: var(--text-xl); font-weight: var(--fw-medium); color: var(--text-primary); }
.cal-sumlabel { font-size: var(--text-sm); color: var(--text-secondary); white-space: nowrap; }

@media (max-width: 960px) { .cal-summary { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .cal-summary { grid-template-columns: repeat(2, 1fr); } }

/* ============================================================
   Vista Resumen (vencidas / próximas / completadas)
   ============================================================ */
.cal-overview { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); align-items: start; margin-top: var(--space-7, 40px); }
.cal-overview[hidden] { display: none; }
.cal-ov-col { background: var(--bg-surface); border: none; border-radius: var(--cal-radius, 22px); box-shadow: var(--cal-shadow, var(--shadow-sm)); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.cal-ov-head { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.cal-ov-count { margin-left: auto; background: var(--bg-overlay); color: var(--text-secondary); border-radius: var(--radius-pill); padding: 1px 9px; font-size: var(--text-xs); }
.cal-ov-list { display: flex; flex-direction: column; gap: var(--space-2); max-height: 460px; overflow-y: auto; }
.cal-ov-item { display: flex; flex-direction: column; gap: 4px; text-align: left; width: 100%; padding: var(--space-2) var(--space-3) var(--space-2) 14px; border-radius: var(--cal-radius-sm, 14px); background: var(--bg-overlay); position: relative; transition: background 140ms ease, box-shadow 140ms ease, transform 140ms ease; }
.cal-ov-item::before { content: ''; position: absolute; left: 6px; top: 9px; bottom: 9px; width: 4px; border-radius: var(--radius-pill); background: var(--cal-item-border, var(--accent)); }
.cal-ov-item:hover { background: #fff; box-shadow: var(--cal-shadow, var(--shadow-sm)); transform: translateY(-1px); }
.cal-ov-item-title { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ov-item-meta { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

@media (max-width: 860px) { .cal-overview { grid-template-columns: 1fr; } }

/* ============================================================
   Creación inline (cuadro flotante, sustituye al prompt nativo)
   ============================================================ */
.cal-inline-create {
  position: absolute; z-index: 1000; width: 240px;
  background: var(--bg-surface); border: 1px solid var(--border-focus);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: var(--space-2);
  display: flex; flex-direction: column; gap: 6px;
}
.cal-inline-create input {
  width: 100%; border: none; outline: none; background: transparent;
  font-size: var(--text-sm); color: var(--text-primary); padding: 4px 6px;
}
.cal-inline-project {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-overlay); color: var(--text-secondary);
  font-size: var(--text-xs); padding: 5px 6px; outline: none; cursor: pointer;
}
.cal-inline-project:focus { border-color: var(--border-focus); }
.cal-inline-create input::placeholder { color: var(--text-tertiary); }
.cal-inline-time { display: grid; grid-template-columns: auto 76px auto 76px; align-items: center; gap: 4px; padding: 2px 6px; color: var(--text-tertiary); font-size: var(--text-xs); }

/* ============================================================
   Selector de vista (Calendario ↔ Timeline)
   ============================================================ */
.cal-viewswitch { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg-overlay); border-radius: var(--radius-md); margin-bottom: var(--space-4); }
.cal-vbtn {
  padding: 6px 16px; border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-secondary);
  transition: background 120ms ease, color 120ms ease;
}
.cal-vbtn:hover { color: var(--text-primary); }
.cal-vbtn.active { background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* ============================================================
   Vista Timeline / Gantt
   ============================================================ */
.cal-timeline { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-sm); overflow: hidden; margin-top: var(--space-7, 40px); }
.cal-timeline[hidden] { display: none; }
/* Fusión calendario+timeline: el conmutador Calendario/Timeline ya no aplica. */
#cal-viewswitch { display: none; }

.tl-toolbar { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.tl-scale, .tl-pager { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg-overlay); border-radius: var(--radius-md); }
.tl-sbtn, .tl-pbtn {
  padding: 5px 12px; border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: var(--fw-medium);
  color: var(--text-secondary); transition: background 120ms ease, color 120ms ease;
}
.tl-sbtn:hover, .tl-pbtn:hover { color: var(--text-primary); }
.tl-sbtn.active { background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.tl-pbtn { min-width: 30px; text-align: center; }
.tl-showdone { display: inline-flex; align-items: center; gap: var(--space-2); margin-left: auto; font-size: var(--text-sm); color: var(--text-secondary); cursor: pointer; }

.tl-scroll { overflow-x: auto; overflow-y: hidden; }
.tl-canvas { position: relative; min-width: 100%; }

/* Cabecera de dos niveles (meses + días) */
.tl-head { position: sticky; top: 0; z-index: 3; background: var(--bg-surface); border-bottom: 1px solid var(--border); }
.tl-months { display: flex; }
.tl-month { padding: 6px 10px; font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-primary); border-right: 1px solid var(--border); white-space: nowrap; overflow: hidden; }
.tl-days { display: flex; }
.tl-day { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 0; border-right: 1px solid var(--border); box-sizing: border-box; }
.tl-day.is-weekend { background: rgba(241, 240, 238, 0.5); }
.tl-dow { font-size: var(--text-xs); color: var(--text-tertiary); text-transform: uppercase; }
.tl-dnum { font-size: var(--text-sm); color: var(--text-secondary); }
.tl-day.is-today .tl-dnum { color: var(--accent); font-weight: var(--fw-medium); }
.tl-day.is-today .tl-dow { color: var(--accent); }

/* Cuerpo: fondo de columnas + barras */
.tl-body { position: relative; }
.tl-bg { position: absolute; inset: 0; display: flex; pointer-events: none; }
.tl-bgcol { border-right: 1px solid var(--border); box-sizing: border-box; }
/* Textura diagonal para fines de semana / días no laborables */
.tl-bgcol.is-weekend {
  background-image: repeating-linear-gradient(-45deg, rgba(148,148,148,0.06) 0, rgba(148,148,148,0.06) 1px, transparent 1px, transparent 6px);
  background-color: rgba(241, 240, 238, 0.35);
}
/* Línea vertical del día actual */
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); z-index: 2; pointer-events: none; }
.tl-today::before { content: ''; position: absolute; top: -4px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.tl-empty { position: absolute; top: 24px; left: 24px; font-size: var(--text-sm); color: var(--text-tertiary); }

/* Barra/tarjeta de tarea */
.tl-bar {
  position: absolute; height: 34px; display: flex; align-items: center; gap: 8px;
  background: var(--tl-bg, var(--bg-surface)); border-radius: var(--radius-md);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 0 0 1px var(--border);
  padding: 0 10px 0 0; overflow: hidden; cursor: grab; user-select: none;
  transition: box-shadow 120ms ease, transform 120ms ease;
}
.tl-bar:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.16); }
.tl-bar.is-active {
  cursor: grabbing; color: #fff; z-index: 4;
  background: var(--cal-iris);
  box-shadow: 0 6px 20px rgba(109,40,217,0.35);
}
.tl-strip { width: 4px; align-self: stretch; border-radius: var(--radius-md) 0 0 var(--radius-md); background: var(--tl-strip, var(--accent)); flex-shrink: 0; }
.tl-bar.is-active .tl-strip { background: rgba(255,255,255,0.5); }
.tl-bar-main { min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.tl-bar-title { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--tl-text, var(--text-primary)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.tl-bar-sub { font-size: var(--text-xs); color: var(--tl-text, var(--text-tertiary)); opacity: 0.72; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.tl-bar.is-active .tl-bar-title, .tl-bar.is-active .tl-bar-sub { color: #fff; opacity: 1; }
.tl-av { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,0.6); color: var(--tl-text, var(--accent-text)); font-size: 10px; font-weight: var(--fw-medium); display: grid; place-items: center; }
.tl-bar.is-active .tl-av { background: rgba(255,255,255,0.25); color: #fff; }

/* Tiradores de redimensionado (visibles al hover / activa) */
.tl-handle { position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; z-index: 5; opacity: 0; transition: opacity 120ms ease; }
.tl-h-l { left: 0; } .tl-h-r { right: 0; }
.tl-bar:hover .tl-handle, .tl-bar.is-active .tl-handle { opacity: 1; }
.tl-handle::before { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 2px; height: 14px; border-radius: 2px; background: var(--border-strong); box-shadow: 3px 0 0 var(--border-strong), -3px 0 0 var(--border-strong); }
.tl-bar.is-active .tl-handle::before { background: rgba(255,255,255,0.85); box-shadow: 3px 0 0 rgba(255,255,255,0.85), -3px 0 0 rgba(255,255,255,0.85); }
.tl-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

/* ============================================================
   REDISEÑO 2026 — estética amable, clara y elegante
   Radios amplios, sombras difusas, cápsulas, ticks de color,
   glow pastel y jerarquía por peso (Light Mode).
   ============================================================ */
.content-zone {
  --cal-radius: 22px;
  --cal-radius-sm: 14px;
  --cal-shadow: 0 12px 36px rgba(23, 37, 71, 0.07), 0 2px 8px rgba(23, 37, 71, 0.04);
  --cal-shadow-hover: 0 18px 48px rgba(23, 37, 71, 0.13);
  --cal-iris: linear-gradient(120deg, #6D28D9 0%, #3B82F6 28%, #22D3EE 48%, #EC4899 72%, #FB923C 100%);
  background: linear-gradient(180deg, #F5F8FC 0%, #EEF2F8 100%);
}

/* Cabecera ejecutiva (jerarquía por peso, subtítulo atenuado) */
.cal-head { margin-bottom: var(--space-5); }
.cal-title { font-size: var(--text-2xl); font-weight: var(--fw-medium); letter-spacing: -0.025em; }
.cal-subtitle { font-size: var(--text-base); color: var(--text-tertiary); margin-top: 2px; }
.cal-breadcrumbs { margin-bottom: var(--space-1); }

/* Tarjetas resumen — flotantes y premium */
.cal-sumcard { border: none; border-radius: var(--cal-radius); padding: var(--space-4) var(--space-5); box-shadow: var(--cal-shadow); }
.cal-sumcard:hover { box-shadow: var(--cal-shadow-hover); }
.cal-sumcard.active { box-shadow: var(--cal-shadow), inset 0 0 0 2px var(--sc); background: linear-gradient(135deg, color-mix(in srgb, var(--scbg) 65%, #fff) 0%, #fff 75%); }
.cal-sumicon { width: 42px; height: 42px; border-radius: 14px; }
.cal-sumnum { font-size: var(--text-2xl); letter-spacing: -0.02em; }
.cal-sumcard[data-overview] .cal-sumicon { background: var(--cal-iris); color: #fff; }

/* Filtros y selector de vista como cápsulas flotantes */
.cal-filters .cselect-trigger { border-radius: var(--radius-pill); border-color: transparent; box-shadow: var(--cal-shadow); }
.cal-filter-clear { border-radius: var(--radius-pill); }
.cal-viewswitch { background: var(--bg-surface); box-shadow: var(--cal-shadow); border-radius: var(--radius-pill); padding: 4px; }
.cal-vbtn { border-radius: var(--radius-pill); padding: 7px 18px; }
.cal-vbtn.active { background: var(--cal-iris); color: #fff; box-shadow: none; }

/* Lienzos y tarjetas: esquinas amables + sombras difusas (sin bordes duros) */
.cal-card, #calendar, .cal-timeline { border: none; border-radius: var(--cal-radius); box-shadow: var(--cal-shadow); }
#calendar { padding: var(--space-4) var(--space-5) var(--space-5); overflow: visible; }

/* La rejilla nunca debe exceder su tarjeta (evita que la columna del domingo
   se corte por la derecha) y los días recortan su contenido limpiamente. */
.fc { max-width: 100%; }
.fc .fc-view-harness, .fc .fc-scrollgrid { max-width: 100%; }
/* NO recortar el frame del día: FullCalendar pinta las barras multi-día
   desbordando la celda de inicio hacia las vecinas; con overflow:hidden la
   barra quedaba cortada a un solo día. El propio evento ya recorta su texto. */
.fc .fc-daygrid-day-frame { overflow: visible; min-height: 112px; }
.fc .fc-col-header-cell-cushion { padding: 8px 4px; letter-spacing: 0; }
.fc .fc-daygrid-day-number { padding: 6px 6px; }
/* Eventos: el contenido encoge con elipsis (sin max-width en el evento/harness,
   que aplastaría las barras multi-día a una sola celda). */
.fc-event { overflow: hidden; }
.fc-ev { min-width: 0; }

/* Notas con textura glow pastel (púrpura→naranja difuso) */
.cal-notes { position: relative; overflow: hidden; }
.cal-notes::before { content: ''; position: absolute; top: -50%; right: -15%; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, rgba(109, 40, 217, 0.26), rgba(59, 130, 246, 0.16) 55%, transparent 70%); filter: blur(18px); pointer-events: none; }
.cal-notes::after { content: ''; position: absolute; bottom: -45%; left: -12%; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(236, 72, 153, 0.20), rgba(251, 146, 60, 0.18) 60%, transparent 70%); filter: blur(18px); pointer-events: none; }
.cal-notes > * { position: relative; z-index: 1; }
.cal-notes-area { background: rgba(255, 255, 255, 0.62); border-color: rgba(255, 255, 255, 0.85); }

/* Items de listas (próximos / importantes): tick + lift al hover */
.cal-upcoming-item { border: none; border-radius: var(--cal-radius-sm); background: var(--bg-overlay); padding: var(--space-2) var(--space-3) var(--space-2) 14px; position: relative; transition: background 140ms ease, box-shadow 140ms ease, transform 140ms ease; }
.cal-upcoming-item::before { content: ''; position: absolute; left: 6px; top: 9px; bottom: 9px; width: 4px; border-radius: var(--radius-pill); background: var(--cal-item-border, var(--accent)); }
.cal-upcoming-item:hover { background: #fff; box-shadow: var(--cal-shadow); transform: translateY(-1px); }
.cal-upcoming-date { display: inline-flex; align-items: center; gap: 2px; }

/* FullCalendar: botones cápsula, eventos píldora con tick, fin de semana rojo */
.fc .fc-toolbar.fc-header-toolbar {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--bg-overlay);
  border: 1px solid var(--border);
}
.fc .fc-toolbar-title { font-weight: var(--fw-medium); letter-spacing: -0.01em; color: var(--text-primary); }
.fc .fc-button {
  border-radius: var(--radius-pill) !important;
  background: var(--bg-surface) !important;
  border-color: var(--border) !important;
  color: var(--text-secondary) !important;
  padding: 6px 14px !important;
}
.fc .fc-button:hover { background: var(--bg-overlay) !important; color: var(--text-primary) !important; }
.fc .fc-button-group > .fc-button { margin-left: var(--space-2) !important; border-radius: var(--radius-pill) !important; }
.fc .fc-button-group > .fc-button:first-child { margin-left: 0 !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: transparent !important;
}
/* Tarjeta de dos líneas, con la densidad visual de Google Calendar. */
.fc-event {
  border: 0 !important;
  border-radius: 6px !important;
  padding: 3px 6px !important;
  min-height: 30px;
  display: flex;
  align-items: stretch;
  position: relative;
  box-shadow: none !important;
  margin-top: 1px !important;
  background: var(--cal-project-gradient, var(--cal-gradient)) !important;
  color: var(--cal-project-ink, #fff) !important;
}
/* Barras multi-día partidas por el cambio de semana: el segmento que no es el
   inicio no lleva punto ni esquina redondeada a la izquierda ni borde izquierdo;
   el que no es el final, no la lleva a la derecha ni borde derecho. Así se leen como una barra continua. */
.fc-event:not(.fc-event-start) {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  padding-left: 6px !important;
}
.fc-event:not(.fc-event-end) {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}
.fc .fc-daygrid-day.fc-day-today { background: color-mix(in srgb, var(--accent) 8%, transparent) !important; }
.fc .fc-day-sat .fc-daygrid-day-number, .fc .fc-day-sun .fc-daygrid-day-number { color: #E26B6B; }
.fc-theme-standard td, .fc-theme-standard th { border-color: color-mix(in srgb, var(--border) 60%, transparent); }

/* ============================================================
   Avatares de asignados (icono de perfil, no el nombre)
   ============================================================ */
.cal-avastack { display: inline-flex; align-items: center; flex-shrink: 0; }
.cal-ava {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent-light); color: var(--accent-text);
  font-size: 9px; font-weight: var(--fw-medium);
  display: inline-grid; place-items: center;
  margin-left: -5px; border: 1.5px solid rgba(255, 255, 255, 0.72);
  overflow: hidden; flex-shrink: 0;
}
.cal-ava:first-child { margin-left: 0; }
.cal-ava img { width: 100%; height: 100%; object-fit: cover; }
.cal-ava-more { background: var(--bg-overlay); color: var(--text-secondary); }

.cal-upcoming-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }

/* Avatares dentro de un evento de FullCalendar */
/* Contenido del evento: título prioritario + meta agrupada a la derecha */
.fc-ev { display: flex; align-items: center; gap: 5px; min-width: 0; width: 100%; }
/* Variante enriquecida: título arriba, meta (proyecto/estado/avatares) debajo. */
.fc-ev-rich { flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; }
.fc-ev-rich .fc-ev-title-row { width: 100%; }
.fc-ev-title-row { display: flex; align-items: center; gap: 4px; width: 100%; min-width: 0; }
.fc-ev-title-row .fc-ev-title { flex: 1 1 auto; }
.fc-ev-title-row .cal-avastack { flex-shrink: 0; }
.fc-ev-sub { display: flex; align-items: center; min-width: 0; max-width: 100%; }
.fc-ev-proj { display: inline-flex; align-items: center; gap: 3px; font-size: 9px; line-height: 1.1; font-weight: var(--fw-medium); opacity: 0.78; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.fc-ev-pdot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.fc-ev-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; line-height: 1.2; font-weight: 650; }
.fc-ev-meta { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; }
.fc-ev-cont { height: 100%; }
.fc-ev .cal-ava { width: 14px; height: 14px; font-size: 7px; }

/* Avatares en las barras del timeline */
.tl-bar .cal-ava { width: 20px; height: 20px; }
.tl-bar.is-active .cal-ava { border-color: rgba(255,255,255,0.5); }

/* ============================================================
   Etiqueta de estado dentro del evento (En proceso/Vencido/Completado)
   ============================================================ */
.fc-st {
  flex-shrink: 0; font-size: 9px; font-weight: var(--fw-medium);
  padding: 1px 7px; border-radius: var(--radius-pill); line-height: 1.5;
  white-space: nowrap; background: rgba(255, 255, 255, 0.78);
}
.fc-st.st-prog { color: #1E40AF; }
.fc-st.st-over { color: #991B1B; }
.fc-st.st-done { color: #065F46; }

/* Chip de prioridad dentro de los eventos del calendario */
.fc-prio {
  flex-shrink: 0; font-size: 9px; font-weight: var(--fw-medium);
  padding: 1px 7px; border-radius: var(--radius-pill); line-height: 1.5;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255, 255, 255, 0.78);
}
.fc-prio-flag { width: 11px; height: 11px; flex-shrink: 0; }

.fc-prio.prio-urgent { color: var(--priority-urgent); }
.fc-prio.prio-high { color: var(--priority-high); }
.fc-prio.prio-medium { color: var(--priority-medium); }
.fc-prio.prio-low { color: var(--priority-low); }

/* La misma identidad de proyecto se conserva en el Timeline de Calendar. */
.tl-bar.cal-tl-project {
  border: 0;
  background: var(--cal-project-gradient, var(--cal-gradient));
  color: var(--cal-project-ink, #fff);
  box-shadow: none;
}
.tl-bar.cal-tl-project .tl-strip { display: none; }
.tl-bar.cal-tl-project .tl-bar-title,
.tl-bar.cal-tl-project .tl-bar-sub { color: inherit; }
.tl-bar.cal-tl-project .tl-bar-sub { opacity: 0.76; }

/* ============================================================
   Ajustes responsive del calendario
   ============================================================ */
@media (max-width: 700px) {
  .cal-head { margin-bottom: var(--space-6); }

  .cal-summary {
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
  }

  .cal-sumcard {
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
  }

  .cal-sumlabel {
    white-space: normal;
    line-height: 1.25;
  }

  .cal-filters {
    align-items: stretch;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
  }

  .cal-filter,
  .cal-filter select,
  .cal-filter .cselect,
  .cal-filter .cselect-trigger {
    width: 100%;
  }

  .cal-filter {
    flex: 1 1 148px;
  }

  .cal-filter select {
    min-height: 40px;
  }

  .cal-filter-clear {
    min-height: 40px;
    padding-inline: var(--space-4);
  }

  .cal-layout {
    gap: var(--space-6);
    margin-top: var(--space-2);
  }

  #calendar {
    padding: var(--space-4);
    border-radius: 20px;
  }

  .fc .fc-toolbar.fc-header-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
    padding: var(--space-4);
    margin-bottom: var(--space-5);
  }

  .fc .fc-toolbar-chunk {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .fc .fc-toolbar-title {
    width: 100%;
    text-align: center;
    font-size: var(--text-lg);
    line-height: 1.25;
  }

  .fc .fc-button-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
  }

  .fc .fc-button {
    margin: 0 !important;
    padding: 7px 12px !important;
  }

  .fc .fc-view-harness,
  .fc .fc-scrollgrid,
  .fc .fc-scrollgrid table {
    width: 100% !important;
    max-width: 100%;
  }

  .fc .fc-daygrid-day-frame {
    min-height: 86px;
  }

  .fc .fc-col-header-cell-cushion {
    font-size: var(--text-xs);
    padding: 8px 2px;
  }

  .fc .fc-daygrid-day-number {
    font-size: var(--text-xs);
    padding: 6px 5px;
  }
}

@media (max-width: 420px) {
  .cal-summary {
    grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  }

  #calendar {
    padding: var(--space-3);
    margin-inline: -2px;
  }

  .fc .fc-toolbar.fc-header-toolbar {
    padding: var(--space-3);
  }

  .fc .fc-button {
    padding: 6px 10px !important;
    font-size: var(--text-xs) !important;
  }

  .fc-event {
    min-height: 32px;
    padding: 4px 7px 4px 13px !important;
  }

  .fc .fc-daygrid-day-frame {
    min-height: 74px;
  }
}

/* ============================================================
   REDISEÑO FINAL — vista mensual Bubble
   ============================================================ */
.content-zone {
  --bubble-purple: #6c4df6;
  --bubble-blue: #2f80ed;
  --cal-ink: #14213d;
  --cal-muted: #71809b;
  --cal-line: rgba(148, 163, 184, 0.22);
  --cal-weekend: rgba(255, 241, 239, 0.58);
  --cal-gradient: linear-gradient(135deg, var(--bubble-purple), var(--bubble-blue));
  --cal-shadow-main: 0 22px 55px rgba(36, 55, 96, 0.09), 0 3px 12px rgba(76, 81, 191, 0.05);
  background: #f6f8fc;
  padding-top: 22px;
}

#topbar-mount:empty,
.cal-head,
.cal-summary {
  display: none;
}

.cal-viewswitch {
  display: inline-flex !important;
  margin: 0 0 12px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--cal-line);
  box-shadow: 0 5px 16px rgba(36, 55, 96, 0.06);
}

.cal-vbtn {
  min-height: 36px;
  padding: 7px 16px;
}

.cal-vbtn.active {
  background: var(--cal-gradient);
  box-shadow: 0 6px 18px rgba(98, 74, 255, 0.16);
}

.cal-filters {
  gap: 8px;
  margin-bottom: 14px;
}

.cal-filter select,
.cal-filters .cselect-trigger {
  min-height: 40px;
  border: 1px solid var(--cal-line);
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.92);
  color: var(--cal-ink);
  box-shadow: 0 4px 14px rgba(36, 55, 96, 0.05);
}

.cal-filter select:focus,
.cal-filters .cselect-trigger:focus-visible,
.cal-filter-clear:focus-visible,
.cal-vbtn:focus-visible {
  outline: 3px solid rgba(108, 77, 246, 0.22);
  outline-offset: 2px;
}

.cal-layout {
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
}

#calendar,
.cal-card,
.cal-timeline {
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--cal-shadow-main);
}

#calendar {
  border-radius: 26px;
  padding: 14px 18px 20px;
  background: #fff;
}

.fc .fc-toolbar.fc-header-toolbar {
  min-height: 58px;
  margin-bottom: 14px;
  padding: 9px 12px;
  border: 1px solid var(--cal-line);
  border-radius: 18px;
  background: #f8f9fc;
}

.fc .fc-toolbar-title {
  color: var(--cal-ink);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.fc .fc-button {
  min-height: 36px;
  border-color: transparent !important;
  background: #fff !important;
}

.fc .fc-button:focus-visible {
  outline: 3px solid rgba(108, 77, 246, 0.22) !important;
  outline-offset: 2px;
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: var(--cal-gradient) !important;
  box-shadow: 0 6px 18px rgba(98, 74, 255, 0.16) !important;
}

.fc-theme-standard td,
.fc-theme-standard th {
  border-color: var(--cal-line);
}

.fc .fc-col-header-cell-cushion {
  color: var(--cal-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fc .fc-day-sat,
.fc .fc-day-sun {
  background: var(--cal-weekend);
}

.fc .fc-daygrid-day.fc-day-today {
  background: linear-gradient(135deg, rgba(108, 77, 246, 0.08), rgba(47, 128, 237, 0.1)) !important;
  box-shadow: inset 0 0 0 1px rgba(108, 77, 246, 0.12);
}

.fc .fc-day-today .fc-daygrid-day-number {
  display: inline-grid;
  width: 28px;
  height: 28px;
  margin: 4px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  background: var(--cal-gradient);
  color: #fff;
  box-shadow: 0 5px 15px rgba(108, 77, 246, 0.22);
}

.fc .fc-day-other .fc-daygrid-day-number {
  color: #c3cad7;
}

.fc-event {
  border-radius: 6px !important;
  min-height: 30px;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.fc-event:hover {
  z-index: 6 !important;
  transform: translateY(-0.5px);
  box-shadow: 0 3px 8px rgba(36, 55, 96, 0.14) !important;
}

.fc-ev-picon {
  display: inline-grid;
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  place-items: center;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.34);
}

.fc-ev-picon img,
.fc-ev-picon svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fc-ev-picon svg {
  padding: 2px;
}

.fc-ev-picon--fallback { color: currentColor; }

.fc-list-event.cal-project-event > td {
  background: var(--cal-project-gradient, var(--cal-gradient)) !important;
  color: var(--cal-project-ink, #fff) !important;
}

.fc-ev-proj {
  gap: 5px;
}

.cal-card {
  border-radius: 20px;
  box-shadow: 0 12px 32px rgba(36, 55, 96, 0.07);
}

@media (max-width: 1100px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-side { position: static; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .content-zone { padding: 14px 12px 24px; }
  .cal-viewswitch { width: 100%; }
  .cal-vbtn { flex: 1; min-height: 44px; }
  .cal-filters { margin-bottom: 12px; }
  .cal-filter select,
  .cal-filter .cselect-trigger,
  .cal-filter-clear { min-height: 44px; }
  #calendar { padding: 10px; border-radius: 20px; }
  .fc .fc-toolbar.fc-header-toolbar { gap: 10px; padding: 12px 8px; }
  .fc .fc-button { min-height: 44px; padding: 8px 11px !important; }
  .cal-side { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .fc-event,
  .cal-vbtn,
  .cal-filter-clear { transition: none; }
}
