/* =============================================================
   Agenda Electoral — estilos
   Marca IEPC (magenta institucional) con un toque más moderno
   y aireado: más whitespace, esquinas suaves, jerarquía limpia.
   ============================================================= */

/* ===== Reset + base ========================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

:root {
  /* Tokens runtime — los tweaks pueden sobreescribirlos */
  --accent: var(--pink-500);
  --accent-strong: var(--pink-700);
  --accent-soft: var(--pink-50);
  --accent-tint: var(--pink-100);
  --density: 1;                /* 0.85 compact, 1 cómoda */
  --font-scale: 1;             /* tweak tamaño de tipografía */
  --base-fs: calc(16px * var(--font-scale));

  /* Modo claro por defecto */
  --bg: #f5f6f8;
  --surface: #ffffff;
  /* Alias: varias vistas (notificaciones, roles, topbar, búsqueda global)
     escriben --surface-1. Sin esta línea la variable no existía y esos fondos
     quedaban transparentes (tarjetas «planas» en claro, ilegibles en oscuro).
     Al apuntar a --surface hereda automáticamente el valor de cada tema. */
  --surface-1: var(--surface);
  --surface-2: #fbfbfd;
  --surface-3: #f3f4f7;
  --ink: #0f172a;
  --text: #1f2937;
  --text-soft: #4b5563;
  --text-mute: #6b7280;
  --line: #e5e7eb;
  --line-soft: #eef0f3;
  --line-strong: #d1d5db;
  --chip-bg: #f3f4f6;
  --shadow-1: 0 1px 2px rgba(15,23,42,.05);
  --shadow-2: 0 8px 24px rgba(15,23,42,.06), 0 2px 6px rgba(15,23,42,.04);
  --shadow-3: 0 24px 60px rgba(15,23,42,.16), 0 6px 18px rgba(15,23,42,.08);
}

[data-theme="dark"] {
  --bg: #0b1020;
  --surface: #131a2e;
  --surface-2: #181f36;
  --surface-3: #1d2540;
  --ink: #f5f7fb;
  --text: #e5e8f1;
  --text-soft: #c6cbdc;
  --text-mute: #94a0bd;
  --line: #2a3354;
  --line-soft: #232a47;
  --line-strong: #3b4669;
  --chip-bg: #232a47;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 12px 30px rgba(0,0,0,.5), 0 2px 8px rgba(0,0,0,.35);
  --shadow-3: 0 28px 70px rgba(0,0,0,.65), 0 8px 24px rgba(0,0,0,.45);
  --accent-soft: rgba(255,12,117,.10);
  --accent-tint: rgba(255,12,117,.22);
}

body {
  font-family: "Source Sans 3", "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: var(--base-fs);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { color: var(--accent); }

/* ===== App shell ============================================ */
.app {
  display: grid;
  grid-template-columns: 252px 1fr;
  min-height: 100vh;
  background: var(--bg);
  transition: grid-template-columns .25s ease;
}
.app.sidebar-collapsed { grid-template-columns: 76px 1fr; }

/* ===== Sidebar ============================================== */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.sidebar-brand img { width: 38px; height: 38px; object-fit: contain; }
.sidebar-brand .brand-text { line-height: 1.1; }
.sidebar-brand .brand-eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}
.sidebar-brand .brand-name { font-weight: 700; font-size: 15px; color: var(--ink); }
.sidebar.is-collapsed .brand-text { display: none; }

.role-card {
  margin: 14px 12px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.role-card:hover { border-color: var(--line-strong); }
.role-card .role-avatar {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  letter-spacing: .02em;
  font-size: 13px;
  flex-shrink: 0;
}
.role-card .role-meta { min-width: 0; line-height: 1.2; }
.role-card .role-level {
  font-size: 10px; font-weight: 800; letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.role-card .role-name {
  font-weight: 700; color: var(--ink); font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar.is-collapsed .role-card { padding: 8px; }
.sidebar.is-collapsed .role-card .role-meta { display: none; }

.nav {
  margin-top: 8px;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.nav-section {
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 800;
  padding: 14px 10px 6px;
}
.sidebar.is-collapsed .nav-section { opacity: 0; height: 0; padding: 0; overflow: hidden; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-soft);
  cursor: pointer;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  position: relative;
}
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-item .nav-icon { width: 18px; text-align: center; color: inherit; opacity: .85; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 7px;
}
.sidebar.is-collapsed .nav-item { justify-content: center; padding: 10px 8px; }
.sidebar.is-collapsed .nav-item span:not(.nav-icon):not(.nav-badge) { display: none; }
.sidebar.is-collapsed .nav-item .nav-badge { display: none; }
.sidebar.is-collapsed .nav-item.active::before { display: none; }

.sidebar-foot {
  border-top: 1px solid var(--line-soft);
  padding: 10px 8px;
}

/* ===== Topbar =============================================== */
.topbar {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  display: grid; place-items: center;
  cursor: pointer;
  font-size: 15px;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); border-color: var(--line); }
.icon-btn.has-dot { position: relative; }
.icon-btn .dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
}

.topbar-title { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.topbar-title .crumb {
  font-size: 11px; font-weight: 800; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-mute);
}
.topbar-title .title { font-size: 17px; font-weight: 700; color: var(--ink); }

.topbar-spacer { flex: 1; }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 12px;
  height: 38px;
  padding: 0 12px;
  width: 280px;
  color: var(--text-mute);
  font-size: 13px;
}
.search input {
  border: 0; outline: 0; background: transparent;
  flex: 1; color: var(--text);
  font-family: inherit; font-size: 14px;
}
.search input::placeholder { color: var(--text-mute); }
.kbd {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-mute);
}

/* ===== Main content area =================================== */
.main { display: flex; flex-direction: column; min-width: 0; }
.content {
  padding: 24px 28px 80px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ===== Page header (above calendar) ======================== */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head h1 {
  font-size: clamp(24px, 2.2vw, 32px);
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 0 0 2px;
}
.page-head .subtitle { color: var(--text-mute); font-size: 14px; }
.month-nav {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  box-shadow: var(--shadow-1);
}
.month-nav button {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 0; background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 14px;
}
.month-nav button:hover { background: var(--surface-3); color: var(--ink); }
.month-nav .label {
  min-width: 168px; text-align: center;
  font-weight: 700; color: var(--ink); font-size: 15px;
  padding: 0 8px;
  text-transform: capitalize;
}
.btn-today {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 600; font-size: 13px;
  cursor: pointer;
}
.btn-today:hover { background: var(--surface-3); border-color: var(--line-strong); }

.btn-primary {
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 700; font-size: 14px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 14px -4px rgba(0,0,0,.18);
}
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 600; font-size: 13px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-ghost:hover { background: var(--surface-3); }

/* Botón destructivo — contorno rojo (cancelar) */
.btn-danger {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #dc2626;
  background: transparent;
  color: #dc2626;
  font-weight: 600; font-size: 13px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-danger:hover { background: rgba(220,38,38,.08); }

/* Botón de restauración — verde sólido (reactivar) */
.btn-success {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #15803d;
  background: #15803d;
  color: #fff;
  font-weight: 600; font-size: 13px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-success:hover { background: #126a33; }

.view-switch {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.view-switch button {
  padding: 6px 12px;
  border-radius: 7px;
  border: 0; background: transparent;
  color: var(--text-soft);
  font-weight: 600; font-size: 13px;
  cursor: pointer;
}
.view-switch button.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* Oculta elementos Alpine hasta que el runtime los hidrate (evita flash). */
[x-cloak] { display: none !important; }

/* ===== Filter row =========================================== */
.filter-row-wrapper {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
/* Alias semántico: el partial usa .filter-row-wrapper pero las vistas heredadas
   que aún usen .filter-row siguen funcionando igual. */
.filter-row {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
/* En desktop las pills siempre visibles, independientemente del estado Alpine.
   Alpine usa display:none en el x-bind:style; este override lo revierte en ≥961px. */
@media (min-width: 961px) {
  .filter-pills-container { display: contents !important; }
}
.type-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  transition: all .15s ease;
}
.type-chip:hover { border-color: var(--line-strong); color: var(--ink); }
.type-chip.is-on {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--type-color, var(--accent));
  box-shadow: inset 0 0 0 1px var(--type-color, var(--accent));
}
.type-chip.is-off { opacity: .45; text-decoration: line-through; }
.type-chip .swatch {
  width: 10px; height: 10px;
  border-radius: 3px;
  background: var(--type-color, var(--accent));
}

/* ===== Calendar grid (Month) ================================ */
.cal-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.cal-weekrow {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.cal-weekrow .dow {
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-mute);
  text-align: left;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.cal-cell {
  min-height: calc(120px * var(--density));
  padding: calc(10px * var(--density));
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  background: var(--surface);
  transition: background .12s ease;
  cursor: pointer;
  min-width: 0;     /* grid: don't grow past 1fr because of long chip text */
  overflow: hidden;
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-grid > .cal-cell:nth-last-child(-n+7) { border-bottom: 0; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.is-other-month { background: var(--surface-2); }
.cal-cell.is-other-month .day-num { color: var(--text-mute); opacity: .55; }
.cal-cell.is-today .day-num {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  font-weight: 800;
}
.cal-cell.is-weekend { background: var(--surface-2); }
.cal-cell.is-weekend.is-today { background: var(--surface); }

.day-head {
  display: flex; align-items: center; justify-content: space-between;
}
.day-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  width: 28px; height: 28px;
  display: grid; place-items: center;
}
.day-count {
  font-size: 10px; font-weight: 700;
  color: var(--text-mute);
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--chip-bg);
}

.event-list {
  display: flex; flex-direction: column;
  gap: 4px;
  min-height: 0;
  min-width: 0;
}
.event-chip {
  display: flex; align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 6px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--type-bg, var(--surface-3));
  border-left: 3px solid var(--type-color, var(--accent));
  cursor: pointer;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  min-width: 0;
  transition: transform .12s ease, box-shadow .12s ease;
}
.event-chip > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.event-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15,23,42,.08);
}
.event-chip .time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--type-color, var(--accent));
  font-size: 11px;
}
.event-chip.is-modified { box-shadow: inset 3px 0 0 #ffd700; }
.event-chip.is-cancelled {
  opacity: .55;
  text-decoration: line-through;
  filter: grayscale(.4);
}
/* Borradores (sin verificar): outline dashed para distinguir sin layout-shift.
   outline + opacity son aditivos con is-range/is-modified; no pisan el candado nivel-3
   ni el box-shadow de is-modified porque operan en propiedades distintas. */
.event-chip.is-draft {
  outline: 1px dashed currentColor;
  outline-offset: -2px;
  opacity: .7;
}
/* Multi-day range chips (e.g. bloqueos de sala) ─────────────── */
.event-chip.is-range {
  font-weight: 700;
  letter-spacing: .005em;
}
.event-chip.is-range-start {
  border-left-width: 3px;
  border-right: 1px dashed var(--type-color, var(--accent));
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  margin-right: -4px;
}
.event-chip.is-range-middle {
  border-left: 1px dashed var(--type-color, var(--accent));
  border-right: 1px dashed var(--type-color, var(--accent));
  border-radius: 0;
  margin-left: -4px;
  margin-right: -4px;
  opacity: .92;
}
.event-chip.is-range-end {
  border-left: 1px dashed var(--type-color, var(--accent));
  border-right-width: 3px;
  border-right-style: solid;
  border-right-color: var(--type-color, var(--accent));
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: -4px;
}
.event-chip .lock-icon { color: var(--type-color, var(--accent)); font-size: 10px; }
.event-more {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-mute);
  padding: 2px 8px;
  cursor: pointer;
}
.event-more:hover { color: var(--accent); }

/* ===== Empty state ========================================== */
.empty {
  padding: 56px 24px;
  text-align: center;
  color: var(--text-mute);
}
.empty .icon {
  font-size: 30px;
  color: var(--text-mute);
  margin-bottom: 10px;
}

/* ===== Modal ================================================ */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 50;
  padding: 24px;
  animation: fade-in .18s ease;
}
[data-theme="dark"] .modal-mask { background: rgba(0,0,0,.62); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal {
  width: min(680px, 100%);
  max-height: 90vh;
  /* flex column → solo .modal-body scrollea; head (X) y foot (Cerrar) quedan fijos.
     overflow:hidden además clipea el contenido del body a las esquinas redondeadas. */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-3);
  animation: pop-in .22s var(--ease-spring, cubic-bezier(.34,1.56,.64,1));
  border: 1px solid var(--line);
}
/* scrollbar delgada/redondeada en modales (mejora sobre el default del prototipo) */
/* Firefox */
.modal,
.modal-body {
  scrollbar-width: thin;
  scrollbar-color: var(--line, #d6d9e0) transparent;
}
/* WebKit (Chrome / Edge) */
.modal::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
  width: 8px;
}
.modal::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.modal::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
  background: var(--line, #d6d9e0);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.modal::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-mute, #6b7280);
  background-clip: padding-box;
}
/* Evita que la barra rompa el layout del modal (el scroll ahora vive en .modal-body) */
/* Solo desktop: en movil (<641px) scrollbar-gutter recorta ~15px del bottom-sheet */
@media (min-width: 641px) {
  .modal-body {
    scrollbar-gutter: stable;
  }
}

.modal-head {
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-shrink: 0; /* fijo arriba: la X de cerrar siempre visible */
}
.modal-head .type-badge {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--type-bg, var(--accent-soft));
  color: var(--type-color, var(--accent));
  display: grid; place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.modal-head h2 {
  margin: 2px 0 4px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.005em;
  color: var(--ink);
  line-height: 1.2;
}
.modal-head .meta {
  color: var(--text-mute);
  font-size: 13px;
  display: flex; gap: 10px; flex-wrap: wrap;
}
.modal-head .meta .pill {
  background: var(--surface-3);
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-soft);
}
.modal-close {
  margin-left: auto;
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 0; background: transparent;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 15px;
}
.modal-close:hover { background: var(--surface-3); color: var(--ink); }

.modal-body {
  padding: 18px 26px 22px;
  display: flex; flex-direction: column; gap: 18px;
  /* único contenedor que scrollea. */
  overflow-y: auto;
  flex: 1 1 auto;
  /* GOTCHA CRÍTICO: sin min-height:0 el flex item no encoge por debajo de su
     contenido y el scroll NUNCA aparece (causa #1 de modales rotos). */
  min-height: 0;
}
.modal-foot {
  padding: 14px 26px 22px;
  border-top: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  flex-shrink: 0; /* fijo abajo: el boton Cerrar siempre visible */
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}
.detail-cell .lbl {
  font-size: 10px; letter-spacing: .14em; font-weight: 800;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 4px;
}
.detail-cell .val { font-size: 14px; color: var(--ink); font-weight: 600; }
.detail-cell .val.long { font-weight: 500; line-height: 1.45; }

.lock-section {
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 12px;
}
.lock-section.locked .lock-icon-wrap {
  background: var(--chip-bg);
  color: var(--text-mute);
}
.lock-section.unlocked {
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.lock-section .lock-icon-wrap {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--accent);
  display: grid; place-items: center;
  flex-shrink: 0;
  font-size: 13px;
}
.lock-section h4 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}
.lock-section .lvl-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 6px;
}
.lock-section .lock-body {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.5;
}
.lock-section a { font-weight: 700; word-break: break-all; }
.lock-section.locked .lock-body { color: var(--text-mute); }
.lock-section ul.docs { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.lock-section ul.docs li {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
}
.lock-section ul.docs li .doc-icon {
  color: var(--accent);
  font-size: 14px;
}
.lock-section ul.docs li .doc-size {
  margin-left: auto;
  color: var(--text-mute);
  font-size: 11px;
  font-weight: 700;
}
.lock-section ul.docs li .doc-lvl {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ===== Document editor (en form crear/editar) =============== */
.doc-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.doc-empty {
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-mute);
  font-size: 13px;
  text-align: center;
}
.doc-row {
  display: grid;
  grid-template-columns: 20px 1fr 130px 38px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.doc-name-input {
  height: 34px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 13px;
  min-width: 0;
}
.doc-name-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.doc-lvl-select {
  height: 34px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 0 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.doc-add-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-soft);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.doc-add-btn:hover { background: var(--surface-3); border-color: var(--line-strong); color: var(--ink); }
@media (max-width: 640px) {
  .doc-row { grid-template-columns: 18px 1fr; gap: 6px; }
  .doc-row .doc-lvl-select { grid-column: 2; }
  .doc-row .icon-btn { grid-column: 2; justify-self: end; }
}

.copy-btn {
  margin-left: 8px;
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 8px;
  cursor: pointer;
  color: var(--text-soft);
  font-weight: 700;
}
.copy-btn:hover { color: var(--ink); border-color: var(--line-strong); }

/* ===== Form (create / edit) ================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
  letter-spacing: .01em;
}
.field input, .field select, .field textarea {
  height: 40px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 14px;
}
.field textarea { height: auto; min-height: 86px; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.field .help { font-size: 11px; color: var(--text-mute); }
.field .field-error { font-size: 0.8rem; font-weight: 500; color: #dc2626; margin-top: 4px; }
.input-error { border-color: #dc2626 !important; box-shadow: 0 0 0 3px rgba(220,38,38,.15) !important; }
.visibility-pick {
  display: flex; flex-direction: column; gap: 6px;
}
.visibility-pick .opt {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}
.visibility-pick .opt:hover { border-color: var(--line-strong); }
.visibility-pick .opt.selected {
  border-color: var(--lvl-color);
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--lvl-color);
}
.visibility-pick .opt .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--lvl-color, var(--accent));
}
.visibility-pick .opt .lvl-name { font-weight: 700; color: var(--ink); font-size: 13px; }
.visibility-pick .opt .lvl-desc { font-size: 12px; color: var(--text-mute); }

/* ===== Publication-flags checkbox grid ====================== */
.pub-flags {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.pub-flag {
  display: grid;
  grid-template-columns: 22px 36px 1fr 28px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: all .15s ease;
}
.pub-flag:hover { border-color: var(--line-strong); }
.pub-flag.is-on {
  border-color: var(--line);
  background: var(--surface-2);
}
.pub-flag input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.pub-flag-ico {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--chip-bg);
  color: var(--text-mute);
  display: grid; place-items: center;
  font-size: 14px;
  transition: all .12s ease;
}
.pub-flag.is-on .pub-flag-ico {
  background: var(--surface-3);
  color: var(--accent);
}
.pub-flag-meta { min-width: 0; line-height: 1.3; }
.pub-flag-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 1px;
}
.pub-flag-desc {
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.4;
}
.pub-flag-check {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3);
  color: var(--text-soft);
  font-size: 11px;
}

@media (max-width: 640px) {
  .pub-flag { grid-template-columns: 20px 32px 1fr 24px; gap: 8px; padding: 10px 12px; }
  .pub-flag-ico { width: 32px; height: 32px; font-size: 13px; }
  .pub-flag-title { font-size: 13px; }
  .pub-flag-desc { font-size: 11px; }
}

/* ===== Audit (Timeline) ===================================== */
.audit-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.audit-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  padding: 10px 0;
}
.audit-item .axis {
  display: flex; flex-direction: column; align-items: center;
}
.audit-item .axis .bullet {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 4px;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.audit-item .axis .line {
  width: 2px;
  flex: 1;
  background: var(--line);
  margin-top: 4px;
}
.audit-item:last-child .axis .line { display: none; }
.audit-item .who { font-weight: 700; color: var(--ink); font-size: 14px; }
.audit-item .act { color: var(--text-soft); font-size: 13px; }
.audit-item .when {
  color: var(--text-mute);
  font-size: 12px;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* ===== Notifications panel (slide-down on topbar) =========== */
.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 22px;
  width: min(420px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-3);
  z-index: 30;
  overflow: hidden;
  animation: pop-in .18s ease;
}
.notif-head {
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}
.notif-head h3 { margin: 0; font-size: 14px; font-weight: 800; color: var(--ink); }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  align-items: flex-start;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-2); }
.notif-item .ico {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: grid; place-items: center;
  font-size: 12px;
}
.notif-item .title {
  font-size: 13px; font-weight: 700; color: var(--ink);
  line-height: 1.35; margin-bottom: 2px;
}
.notif-item .body { font-size: 12px; color: var(--text-soft); line-height: 1.4; }
.notif-item .when { font-size: 11px; color: var(--text-mute); margin-top: 4px; }
.notif-item .unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 8px; }

/* ===== Login (role picker) ================================= */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--bg);
}
.login-visual {
  position: relative;
  background:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,.55), transparent 38%),
    radial-gradient(circle at 80% 12%, rgba(255,255,255,.4), transparent 32%),
    linear-gradient(145deg, #f7cddf 0%, #f1d6e2 45%, #ecccdc 100%);
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #1c1c1f;
  overflow: hidden;
}
.login-visual::after {
  content: "";
  position: absolute; inset: 0;
  background-image: linear-gradient(135deg, rgba(255,255,255,.1) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}
.login-visual > * { position: relative; z-index: 1; }
.login-eyebrow {
  font-size: 11px; font-weight: 800; letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent-strong);
}
.login-title {
  margin: 16px 0 12px;
  font-size: clamp(28px, 3.4vw, 44px);
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1.08;
  max-width: 540px;
}
.login-sub { font-size: 17px; max-width: 480px; line-height: 1.45; color: #2a2a30; }
.login-mark { display: flex; align-items: center; gap: 16px; }
.login-mark img { height: 78px; }
.login-mark .mark-line { line-height: 1.2; }
.login-mark .small { font-size: 11px; font-weight: 800; letter-spacing: .14em; color: var(--accent-strong); text-transform: uppercase; }
.login-mark .big { font-weight: 800; color: #1c1c1f; font-size: 17px; }
.login-foot {
  font-size: 12px;
  color: rgba(28,28,32,.66);
  letter-spacing: .04em;
}
.login-panel {
  display: flex; flex-direction: column; justify-content: center;
  padding: 56px clamp(28px, 5vw, 72px);
  background: var(--surface);
}
.login-panel h2 {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.01em;
}
.login-panel p { margin: 0 0 24px; color: var(--text-mute); font-size: 15px; }
.role-grid { display: flex; flex-direction: column; gap: 10px; }
.role-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: all .15s ease;
  width: 100%;
  font-family: inherit;
}
.role-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -12px var(--accent);
}
.role-btn .avatar {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: var(--role-color, var(--accent));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px;
  letter-spacing: .02em;
  flex-shrink: 0;
}
.role-btn .role-info { flex: 1; min-width: 0; }
.role-btn .role-info .name { font-weight: 700; color: var(--ink); font-size: 15px; }
.role-btn .role-info .desc { font-size: 12.5px; color: var(--text-mute); line-height: 1.35; }
.role-btn .role-chevron { color: var(--text-mute); font-size: 14px; }
.role-btn .lvl-pill {
  font-size: 10px; font-weight: 800; letter-spacing: .14em;
  background: var(--role-color, var(--accent));
  color: #fff;
  padding: 2px 8px; border-radius: 999px;
  text-transform: uppercase;
  margin-left: 6px;
  display: inline-block;
}
.login-help {
  margin-top: 24px;
  padding: 14px;
  border-radius: 12px;
  border: 1px dashed var(--line-strong);
  background: var(--surface-2);
  color: var(--text-mute);
  font-size: 12.5px;
  line-height: 1.55;
}
.login-help strong { color: var(--text); font-weight: 700; }
.login-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 18px;
}
.login-alert--error {
  background: color-mix(in srgb, #ef4444 12%, transparent);
  border: 1px solid color-mix(in srgb, #ef4444 35%, transparent);
  color: #b91c1c;
}
.login-alert--error .fas { color: #ef4444; flex-shrink: 0; }

/* ===== List view ============================================ */
.list-day-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 14px;
  overflow: hidden;
}
.list-day-head {
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 12px;
}
.list-day-num {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}
.list-day-meta { line-height: 1.2; }
.list-day-dow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.list-day-rel { font-size: 13px; color: var(--text-soft); font-weight: 600; }
.list-event {
  display: grid;
  grid-template-columns: 86px 4px 1fr auto;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  align-items: center;
  cursor: pointer;
}
.list-event:last-child { border-bottom: 0; }
.list-event:hover { background: var(--surface-2); }
.list-event .time-block {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.list-event .time-start { font-size: 16px; font-weight: 700; color: var(--ink); }
.list-event .time-end { font-size: 11px; color: var(--text-mute); }
.list-event .stripe { width: 4px; height: 100%; min-height: 32px; border-radius: 4px; background: var(--type-color, var(--accent)); }
.list-event .ev-title { font-weight: 700; color: var(--ink); font-size: 15px; }
.list-event .ev-meta { color: var(--text-mute); font-size: 12px; margin-top: 2px; }
.list-event .ev-actions { display: flex; gap: 6px; }

/* ===== Timeline view ======================================== */
.timeline-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  overflow-x: auto;
}
.timeline-track {
  display: grid;
  gap: 6px;
  min-width: 900px;
}
.timeline-days {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
}
.timeline-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.timeline-row:last-child { border-bottom: 0; }
.timeline-row .lane {
  position: relative;
  height: 28px;
}
.timeline-row .ev {
  position: absolute;
  top: 4px; bottom: 4px;
  border-radius: 6px;
  background: var(--type-color, var(--accent));
  opacity: .85;
  padding: 0 8px;
  display: flex; align-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timeline-row .ev:hover { opacity: 1; }
.timeline-row .row-label { font-size: 13px; font-weight: 600; color: var(--text); }
.timeline-row .row-sub { font-size: 11px; color: var(--text-mute); }

/* ===== Toast =============================================== */
.toast-area {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex; flex-direction: column; gap: 12px;
  min-width: 320px;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 24px rgba(0,0,0,.28), 0 2px 8px rgba(0,0,0,.18);
  animation: pop-in .22s ease;
  display: inline-flex; align-items: center; gap: 10px;
  white-space: nowrap;
}
/* Variantes: solo el ícono cambia de color; el cuerpo del toast conserva el fondo oscuro base. */
.toast-success i { color: #4ade80; }
.toast-error i { color: #f87171; }

/* ===== Gestión (/gestion): tabla responsive ================= */
/* ≥641px: el grid de columnas fijas (1fr + 130+100+110+150+80px) desborda en
   anchos medios (tablet / ventana angosta) y recortaba la columna de acciones.
   El wrapper scrollea horizontal y el min-width:830px garantiza que ninguna
   columna colapse. En ≤640px este modo se desactiva (card-stacking, ver el
   @media de Phone más abajo). */
.manage-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.manage-table-scroll > div[style*="grid-template-columns"] {
  min-width: 830px; /* 1fr≥160 + 130+100+110+150 + acciones 180 (4 botones simultáneos) */
}

/* ===== Mobile =============================================== */
.mobile-only { display: none; }
.desktop-only { display: inline-flex; }
.hide-on-mobile { display: inline; }

/* Tablet ≤ 960 ─────────────────────────────────────────────── */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 90;
    inset: 0 auto 0 0;
    width: 288px;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-3);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.45);
    z-index: 80;
  }
  .content { padding: 18px 14px 100px; }
  .mobile-only { display: inline-flex; }
  .search { display: none; }
  .login { grid-template-columns: 1fr; }
  .login-visual { padding: 32px 28px; min-height: 240px; }
  .login-title { font-size: 30px; }
  .login-panel { padding: 32px 22px; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; gap: 8px; }
  .month-nav .label { min-width: 120px; font-size: 13px; }
  .notif-panel { right: 8px; left: 8px; width: auto; }

  /* Page head reorganizes on tablet */
  .page-head { gap: 12px; }
  .page-head h1 { font-size: 22px; }

  /* Filter row: ocultar etiqueta desktop y separador en tablet (641-960px).
     Scoped a .filter-row-wrapper para NO afectar el topbar (usa .desktop-only con su
     propio breakpoint 640px — regla global en línea 1453). */
  .filter-row-wrapper .desktop-only { display: none !important; }
}

/* Phone ≤ 640 ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .desktop-only { display: none; }
  .hide-on-mobile { display: none !important; }
  .content { padding: 14px 10px 110px; }
  .topbar { height: 56px; padding: 0 10px; }
  .topbar-title .title { font-size: 15px; }
  .topbar-title .crumb { font-size: 10px; }
  .btn-primary span:not(.always) { display: none; }
  .btn-primary { padding: 0 12px; }
  .view-switch { display: none; }
  .month-nav { padding: 3px; }
  .month-nav button { width: 32px; height: 32px; font-size: 13px; }
  .month-nav .label { min-width: 110px; font-size: 13px; padding: 0 4px; }
  .btn-today { height: 34px; padding: 0 10px; font-size: 12px; }

  /* Calendar: dots instead of chips on phone */
  .cal-wrap { border-radius: 14px; }
  .cal-weekrow .dow { padding: 8px 4px; font-size: 9px; text-align: center; }
  .cal-cell { min-height: 56px; padding: 6px 4px; gap: 4px; }
  .day-num { font-size: 12px; width: 22px; height: 22px; }
  .cal-cell.is-today .day-num { width: 24px; height: 24px; font-size: 12px; }
  .day-count { display: none; }
  .event-chip {
    display: block;
    height: 6px;
    width: auto;
    padding: 0;
    border-left: 0;
    border-radius: 999px;
    background: var(--type-color, var(--accent));
    opacity: .85;
    margin: 1px 0;
  }
  .event-chip > * { display: none; }
  .event-chip:hover { transform: none; box-shadow: none; }
  .event-chip.is-cancelled { opacity: .35; }
  .event-more { font-size: 10px; padding: 0 4px; }
  .event-list { gap: 2px; }

  /* Filter chips wrap, smaller */
  .filter-row { gap: 6px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 6px; }
  .filter-row > div:first-child { display: none; }
  .filter-row-wrapper { gap: 6px; flex-wrap: wrap; padding-bottom: 6px; }
  .filter-row-wrapper > .desktop-only { display: none; }
  .type-chip { font-size: 12px; padding: 5px 10px; white-space: nowrap; flex-shrink: 0; }

  /* List view tighter */
  .list-event { grid-template-columns: 64px 4px 1fr; padding: 12px 10px; }
  .list-event .ev-actions { display: none; }
  .list-day-num { font-size: 22px; }

  /* Modal becomes a bottom-sheet */
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    animation: slide-up .22s var(--ease-spring, cubic-bezier(.34,1.56,.64,1));
  }
  @keyframes slide-up {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .modal-head { padding: 18px 18px 14px; gap: 12px; }
  .modal-head h2 { font-size: 18px; }
  .modal-body { padding: 14px 18px 18px; }
  .modal-foot { padding: 12px 18px 18px; gap: 8px; }
  .modal-foot > div { flex: 1; }
  .modal-foot .btn-primary, .modal-foot .btn-ghost,
  .modal-foot .btn-danger, .modal-foot .btn-success { width: 100%; justify-content: center; }

  /* Login compact */
  .login-visual { padding: 24px 20px; min-height: auto; }
  .login-mark img { height: 56px; }
  .login-title { font-size: 24px; line-height: 1.15; margin: 12px 0 8px; }
  .login-sub { font-size: 14px; }
  .login-foot { display: none; }
  .login-panel { padding: 22px 18px; }
  .login-panel h2 { font-size: 20px; }
  .login-panel p { font-size: 13px; margin-bottom: 16px; }
  .role-btn { padding: 12px; }
  .role-btn .avatar { width: 40px; height: 40px; border-radius: 12px; font-size: 12px; }
  .role-btn .role-info .name { font-size: 13px; }
  .role-btn .role-info .desc { font-size: 11px; }
  .role-btn .lvl-pill { font-size: 9px; padding: 1px 6px; margin-left: 4px; }

  /* Manage table → cards. En phone NO hay scroll horizontal: cada fila-grid
     colapsa a 1 columna (card apilada con todos sus datos + fila de acciones).
     Selector actualizado: las filas son hijas de .manage-table-scroll (wrapper
     de scroll para anchos ≥641px), ya no hijas directas de .cal-wrap. */
  .manage-table-scroll { overflow-x: visible; }
  .manage-table-scroll > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
    padding: 12px 14px !important;
    min-width: 0; /* anula el min-width del modo scroll para que la card se apile (misma especificidad, gana por cascada) */
  }
  /* El header-grid de columnas no aporta en modo card — se oculta */
  .manage-table-scroll > div[style*="grid-template-columns"]:first-child { display: none !important; }

  /* Tweaks panel: stays as is but doesn't cover whole screen */
}

/* Very narrow phone ≤ 380 ───────────────────────────────────── */
@media (max-width: 380px) {
  .cal-weekrow .dow { font-size: 8px; padding: 6px 2px; }
  .cal-cell { min-height: 50px; padding: 4px 3px; }
  .day-num { font-size: 11px; width: 20px; height: 20px; }
  .page-head h1 { font-size: 20px; }
}

/* ===== Accent helpers ====================================== */
[data-accent="magenta"] { --accent: #ff0c75; --accent-strong: #c41e72; --accent-soft: #fff0f5; --accent-tint: #ffe4f0; }
[data-accent="indigo"]  { --accent: #4f46e5; --accent-strong: #3730a3; --accent-soft: #eef2ff; --accent-tint: #e0e7ff; }
[data-accent="forest"]  { --accent: #15803d; --accent-strong: #14532d; --accent-soft: #ecfdf5; --accent-tint: #d1fae5; }
[data-accent="cobalt"]  { --accent: #0e7490; --accent-strong: #155e75; --accent-soft: #ecfeff; --accent-tint: #cffafe; }

/* ===== Misc utility ========================================= */
.kbd-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-mute); }
.divider-soft { height: 1px; background: var(--line-soft); margin: 4px 0; }
.cancelled-banner {
  background: linear-gradient(180deg, #fee2e2, #fff);
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; gap: 10px;
}
[data-theme="dark"] .cancelled-banner {
  background: rgba(220,38,38,.15);
  border-color: rgba(220,38,38,.3);
  color: #fca5a5;
}
.modified-banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; gap: 10px;
}
[data-theme="dark"] .modified-banner {
  background: rgba(245,158,11,.15);
  border-color: rgba(245,158,11,.3);
  color: #fcd34d;
}

/* ───────────────────────────────────────────────────────────────
   Agenda · override Laravel — historial con scroll interno (HITL 2026-06-05)
   La timeline del modal de historial no crece sin límite: se acota a una
   altura cómoda y scrollea internamente, dejando fijos el header
   (título / pills / intro WORM) y el footer ("Entendido").
   ─────────────────────────────────────────────────────────────── */
.audit-list { max-height: 46vh; overflow-y: auto; padding-right: 6px; }
