/* ═══════════════════════════════════════════════════
   BITÁCORA PROFESIONAL — Design System
   Purple Corporate · Minimalista · Screenshot-ready
════════════════════════════════════════════════════ */

:root {
  --primary:        #7C3AED;
  --primary-mid:    #8B5CF6;
  --primary-light:  #EDE9FE;
  --primary-xlight: #F5F3FF;
  --primary-dark:   #5B21B6;

  --text:           #111827;
  --text-muted:     #6B7280;
  --text-light:     #9CA3AF;

  --border:         #E5E7EB;
  --border-light:   #F3F4F6;

  --bg:             #FFFFFF;
  --bg-surface:     #F9FAFB;
  --bg-hover:       #F3F4F6;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.14);

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --nav-h: 58px;
}

/* ─── Reset ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* ─── Navbar ────────────────────────────────────── */
.navbar {
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 9px;
}
.nav-logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-mid));
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 14px;
  flex-shrink: 0;
}
.nav-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.4px;
}
.nav-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 8px;
  font-weight: 500;
}
.nav-links { display: flex; gap: 3px; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-btn:hover { background: var(--bg-hover); color: var(--text); }
.nav-btn.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-btn i { font-size: 13px; }
/* ─── Dark mode ─────────────────────────────────── */
body.dark {
  --text:           #F1F5F9;
  --text-muted:     #94A3B8;
  --text-light:     #64748B;
  --border:         #334155;
  --border-light:   #1E293B;
  --bg:             #0F172A;
  --bg-surface:     #1E293B;
  --bg-hover:       #334155;
  --primary-xlight: rgba(124,58,237,0.15);
  --primary-light:  rgba(124,58,237,0.28);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);
}
body.dark .navbar    { background: #1E293B; }
body.dark .card      { background: #1E293B; }
body.dark .modal     { background: #1E293B; }
body.dark .tl-item   { background: #1E293B; }
body.dark .wk-col    { background: #1E293B; }
body.dark .ann-card  { background: #1E293B; }
body.dark .month-day { background: #1E293B; }
body.dark .month-day.other { background: #0F172A; }
body.dark input, body.dark select, body.dark textarea { background: #1E293B; color: var(--text); }
body.dark .file-drop { border-color: #334155; }
body.dark .today-item { background: #1E293B; border-color: #334155; }
body.dark .wk-act    { background: #0F172A; }
body.dark .summary-bar { background: rgba(124,58,237,0.15); }
body.dark .lightbox  { background: rgba(0,0,0,0.96); }

/* ─── Settings panel ────────────────────────────── */
.settings-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 200;
  justify-content: flex-end;
  align-items: stretch;
}
.settings-overlay.open { display: flex; }

.settings-panel {
  width: 320px;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideInRight 0.2s ease;
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.settings-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}
.settings-hd i { color: var(--primary); margin-right: 8px; }
.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.settings-section { display: flex; flex-direction: column; gap: 10px; }
.settings-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.settings-section-desc { font-size: 12.5px; color: var(--text-muted); margin-top: -6px; }

/* Palette swatches */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.palette-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  position: relative;
}
.palette-swatch:hover { transform: scale(1.12); box-shadow: 0 3px 10px rgba(0,0,0,0.2); }
.palette-swatch.selected { transform: scale(1.12); box-shadow: 0 0 0 3px white, 0 0 0 5px currentColor; }
.palette-check {
  color: white;
  font-size: 12px;
  opacity: 0;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.4));
  transition: opacity 0.15s;
}
.palette-swatch.selected .palette-check { opacity: 1; }

/* Custom color row */
.custom-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
#custom-color-input {
  width: 44px;
  height: 44px;
  padding: 2px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}
#custom-color-input::-webkit-color-swatch-wrapper { padding: 0; }
#custom-color-input::-webkit-color-swatch { border: none; border-radius: 4px; }
.custom-color-preview {
  flex: 1;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.5px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
  transition: background 0.2s;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ─── Storage mode badge (navbar) ───────────────── */
.storage-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid transparent;
  cursor: default;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

/* ─── Permission banner ──────────────────────────── */
.permission-banner {
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FEF3C7;
  border-bottom: 1px solid #FDE68A;
  color: #92400E;
  padding: 10px 24px;
  font-size: 13.5px;
  font-weight: 500;
}
.permission-banner i { font-size: 14px; }
.permission-banner span { flex: 1; }
body.permission-active .module { margin-top: calc(var(--nav-h) + 42px) !important; height: calc(100vh - var(--nav-h) - 42px) !important; }

/* ─── Setup modal options ────────────────────────── */
.setup-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.setup-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  transition: all 0.15s;
}
.setup-option:hover {
  border-color: var(--primary);
  background: var(--primary-xlight);
}
.setup-option-icon {
  width: 42px; height: 42px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.setup-option-body { flex: 1; min-width: 0; }
.setup-option-title { font-size: 14px; font-weight: 700; color: var(--text); }
.setup-option-desc  { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.setup-note {
  font-size: 12px; color: var(--text-muted);
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 12px;
  display: flex; align-items: flex-start; gap: 7px; line-height: 1.5;
}
.setup-note i { color: var(--primary); margin-top: 2px; flex-shrink: 0; }

/* Storage bar */
.storage-bar-wrap  { display: flex; flex-direction: column; gap: 5px; }
.storage-bar-track {
  height: 7px; background: var(--border);
  border-radius: 10px; overflow: hidden;
}
.storage-bar-fill  {
  height: 100%; border-radius: 10px;
  transition: width 0.4s ease, background 0.3s;
  background: var(--primary);
}
.storage-bar-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.storage-bar-hint  { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* Theme toggle (en Configuración) */
.theme-toggle-row { display: flex; gap: 8px; }
.theme-opt {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  font-family: var(--font);
}
.theme-opt:hover { border-color: var(--primary); color: var(--primary); }
.theme-opt.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* Danger zone */
.danger-zone { border-top: 1px solid var(--border); padding-top: 16px; }
.btn-danger-zone {
  background: #FEF2F2; color: #DC2626; border: 1.5px solid #FECACA;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.15s; font-family: var(--font);
}
.btn-danger-zone:hover { background: #DC2626; color: white; border-color: #DC2626; }

.nav-btn-settings { color: var(--text-muted); font-size: 13px; }
.nav-btn-settings:hover { background: var(--bg-hover); color: var(--primary); }

.nav-btn-dark { color: var(--text-muted); font-size: 13px; }
.nav-btn-dark:hover { background: var(--bg-hover); color: var(--text); }
body.dark .nav-btn-dark { color: #FBBF24; }
body.dark .nav-btn-dark:hover { background: rgba(251,191,36,0.12); }

.nav-sep { width: 1px; background: var(--border); margin: 8px 4px; }
.nav-btn-export-data { color: #2563EB; font-size: 12px; }
.nav-btn-export-data:hover { background: #DBEAFE; color: #1D4ED8; }
.nav-btn-import-data { color: #7C3AED; font-size: 12px; }
.nav-btn-import-data:hover { background: var(--primary-light); color: var(--primary-dark); }
.nav-btn-seed { color: #059669; font-size: 12px; }
.nav-btn-seed:hover { background: #D1FAE5; color: #047857; }
.nav-btn-clear { color: var(--text-light); font-size: 12px; }
.nav-btn-clear:hover { background: #FEE2E2; color: #DC2626; }

/* ─── Modules ───────────────────────────────────── */
.module {
  display: none;
  margin-top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow: hidden;
  flex-direction: column;
}
.module.active { display: flex; }

/* ─── MODULE 1: REGISTER ────────────────────────── */
#module-register { overflow-y: auto; }
.module-inner {
  padding: 20px 24px 24px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.module-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.module-header h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}
.module-subtitle { font-size: 13.5px; color: var(--text-muted); margin-top: 2px; }

.register-layout {
  --c-side: 720px;            /* ancho de C1 y C3 (igual) */
  display: grid;
  grid-template-columns: var(--c-side) 1fr var(--c-side);
  gap: 16px;
  align-items: stretch;
  height: calc(100vh - var(--nav-h) - 40px);
}
/* Las 3 tarjetas llenan el alto; scroll interno solo si hace falta */
.register-layout > .card {
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.form-card { overflow-y: auto; }
.form-card-title { margin-bottom: 14px; }

/* Card */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

/* Form */
.form-row {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}
.form-row.three-col { grid-template-columns: repeat(3, 1fr); }
.form-row.two-col   { grid-template-columns: repeat(2, 1fr); }
/* REGISTRO: llenan el ancho del contenedor */
#activity-form .row-datetime { grid-template-columns: 1fr 1fr 1fr; }
#activity-form .row-classify { grid-template-columns: 1fr 1fr 1fr; }
/* EDICIÓN: llenan el ancho del modal, columnas iguales */
#edit-form .row-datetime { grid-template-columns: 1fr 1fr 1fr; }
#edit-form .row-classify { grid-template-columns: 1fr 1fr 1fr; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.1px;
}
.req { color: var(--primary); }

input[type="text"],
input[type="date"],
input[type="time"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
textarea { resize: vertical; min-height: 72px; }
/* Oculta el ícono nativo: usamos botón propio al lado */
.input-with-btn input::-webkit-calendar-picker-indicator { display: none; }
.input-with-btn { display: flex; gap: 6px; align-items: stretch; }
.input-with-btn input { flex: 1; min-width: 0; }
.btn-field-action {
  width: 38px;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; cursor: pointer;
  transition: all 0.15s;
}
.btn-field-action:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-xlight);
}

/* Category info */
.cat-info-toggle {
  display: inline-flex;
  align-items: center;
  color: var(--primary);
  cursor: pointer;
  margin-left: 5px;
  font-size: 12px;
  font-weight: 400;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.cat-info-toggle:hover { opacity: 1; }
.cat-desc-box {
  display: none;
  font-size: 12px;
  color: var(--primary-dark);
  background: var(--primary-xlight);
  border: 1px solid var(--primary-light);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  margin-top: 5px;
  line-height: 1.45;
}
.field-hint { font-size: 11px; color: var(--text-light); font-weight: 400; margin-left: 4px; }

/* Multiple links */
.links-wrap { display: flex; flex-direction: column; gap: 6px; }
.link-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 7px;
  align-items: center;
}
.link-row.hidden { display: none; }
.link-title-input, .link-url-input {
  width: 100%;
  padding: 8px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  font-family: var(--font);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.link-title-input:focus, .link-url-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}
.btn-link-action {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.btn-link-add:hover    { border-color: var(--primary); color: var(--primary); background: var(--primary-xlight); }
.btn-link-remove:hover { border-color: #DC2626; color: #DC2626; background: #FEF2F2; }
.btn-link-action.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* File drop */
.file-drop {
  border: 1.5px dashed var(--border);
  border-radius: var(--r);
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  transition: all 0.15s;
  cursor: pointer;
}
.file-drop:hover,
.file-drop.drag-over {
  border-color: var(--primary);
  background: var(--primary-xlight);
  color: var(--primary);
}
.file-drop i { font-size: 20px; margin-bottom: 5px; display: block; }
.file-drop p { font-size: 12.5px; margin: 2px 0; }
.hint { font-size: 11px; color: var(--text-light); }
.link-btn {
  background: none; border: none;
  color: var(--primary); font-size: 12.5px;
  font-weight: 500; text-decoration: underline;
  padding: 0;
}

.file-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 4px 9px;
  font-size: 11.5px;
  color: var(--text);
}
.file-chip i { color: var(--primary); font-size: 11px; }
.file-chip .rm {
  background: none; border: none;
  color: var(--text-light);
  padding: 0; margin-left: 3px;
  font-size: 10px; cursor: pointer;
}
.file-chip .rm:hover { color: #DC2626; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: all 0.15s;
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary  { background: var(--primary); color: white; }
.btn-primary:hover  { background: var(--primary-dark); }
.btn-ghost    { background: var(--bg-surface); color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover    { background: var(--bg-hover); color: var(--text); }
.btn-outline  { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); padding: 5px 11px; font-size: 12px; }
.btn-outline:hover  { border-color: var(--primary); color: var(--primary); background: var(--primary-xlight); }
.btn-sm       { padding: 5px 11px; font-size: 12px; }
.btn-icon     { padding: 6px 9px; }
.hidden       { display: none !important; }

/* Today panel */
.today-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.today-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.panel-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}
.today-date-lbl {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-top: 2px;
}
.today-count {
  background: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  min-width: 26px;
  text-align: center;
}
.today-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.today-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 9px;
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.1s;
  position: relative;
}
.today-item:hover { border-color: var(--primary); background: var(--primary-xlight); }
.today-item-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.today-item-body { flex: 1; min-width: 0; }
.today-item-time { font-size: 12px; font-weight: 700; color: var(--primary); }
.today-item-title { font-size: 13.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-item-cat { font-size: 12px; color: var(--text-muted); }
.today-item-del {
  background: none; border: none;
  color: var(--text-light); padding: 2px 4px;
  border-radius: 3px; opacity: 0; transition: opacity 0.1s;
}
.today-item:hover .today-item-del { opacity: 1; }
.today-item-del:hover { color: #DC2626; background: #FEE2E2; }

/* ─── MODULE 2: CONSULT ─────────────────────────── */
#module-consult {
  display: none;
  flex-direction: column;
  height: calc(100vh - var(--nav-h));
  overflow: hidden;
}
#module-consult.active { display: flex; }

.consult-bar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px 8px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.period-tabs { display: flex; gap: 3px; }
.ptab {
  padding: 6px 14px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
}
.ptab:hover { background: var(--bg-hover); color: var(--text); }
.ptab.active { background: var(--primary); color: white; font-weight: 600; }

.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.date-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px 7px;
}
.nav-arr {
  background: none; border: none;
  color: var(--text-muted); padding: 4px 6px;
  border-radius: 4px; font-size: 11px;
  transition: all 0.1s;
}
.nav-arr:hover { background: var(--bg-hover); color: var(--text); }
.date-nav-lbl {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  min-width: 160px;
  text-align: center;
}
.custom-range {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px 10px;
}
.custom-range input[type="date"] {
  border: none; background: transparent;
  padding: 2px 3px; font-size: 13.5px;
  width: 132px; box-shadow: none;
}
.range-sep { color: var(--text-muted); font-weight: 300; }

.filters { display: flex; gap: 6px; flex: 1; }
.f-select, .f-input {
  padding: 5px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
}
.f-select:focus, .f-input:focus { border-color: var(--primary); }
.f-input { min-width: 110px; }
.f-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; padding-right: 24px; }

.export-btns { display: flex; gap: 5px; margin-left: auto; }

/* Summary bar */
.summary-bar {
  display: flex;
  align-items: center;
  background: var(--primary-xlight);
  border-bottom: 1px solid rgba(124,58,237,0.1);
  padding: 7px 24px;
  gap: 0;
  flex-shrink: 0;
}
.summ-item { display: flex; align-items: center; gap: 8px; padding: 0 18px; }
.summ-item:first-child { padding-left: 0; }
.summ-divider { width: 1px; background: rgba(124,58,237,0.15); height: 22px; }
.summ-lbl { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--primary); opacity: 0.65; }
.summ-val { font-size: 15px; font-weight: 800; color: var(--primary); }

/* View area */
.view-area {
  flex: 1;
  overflow: hidden;
  padding: 14px 24px 16px;
}
.full-center {
  height: 100%;
  justify-content: center;
}

/* ════════════════════════════════════════════
   DAILY VIEW
════════════════════════════════════════════ */
.daily-view {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.view-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  flex-shrink: 0;
}
.timeline {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.tl-item {
  display: flex;
  align-items: stretch;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  flex-shrink: 0;
  transition: box-shadow 0.15s;
}
.tl-item:hover { box-shadow: var(--shadow-sm); }
.tl-time-col {
  width: 68px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-light);
}
.tl-time { font-size: 13.5px; font-weight: 700; color: var(--text); }
.tl-time-end { font-size: 11.5px; color: var(--text-muted); }
.tl-color { width: 3px; flex-shrink: 0; }
.tl-body {
  flex: 1;
  padding: 8px 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.tl-main { flex: 1; min-width: 0; }
.tl-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tl-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tl-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}
.tl-duration { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }

/* ════════════════════════════════════════════
   WEEKLY VIEW
════════════════════════════════════════════ */
.weekly-view { height: 100%; display: flex; flex-direction: column; }
.weekly-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
  flex: 1;
  overflow: hidden;
}
.wk-col {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 9px 7px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.15s;
}
.wk-col.today-col { border-color: var(--primary); background: var(--primary-xlight); }
.wk-col-head {
  text-align: center;
  margin-bottom: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
/* Bloque del día (nombre + número) — solo esto se tiñe con el régimen */
.wk-daybox {
  position: relative;
  border-radius: var(--r-sm);
  padding: 4px 2px 5px;
  margin-bottom: 5px;
  overflow: hidden;
}
.wk-head-regimen {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.wk-daybox > *:not(.wk-head-regimen) { position: relative; z-index: 1; }
.wk-day-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}
.wk-col.today-col .wk-day-name { color: var(--primary); }
.wk-day-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  margin: 2px 0;
}
.wk-col.today-col .wk-day-num { color: var(--primary); }
.wk-stats {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
}
.wk-stats b { color: var(--text); }
.wk-acts {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wk-act {
  padding: 4px 6px;
  border-radius: 4px;
  background: var(--bg-surface);
  border-left: 2.5px solid transparent;
  overflow: hidden;
  flex-shrink: 0;
}
.wk-act { cursor: pointer; }
.wk-act-time { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.wk-act-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}
.wk-more {
  font-size: 10.5px;
  color: var(--primary);
  font-weight: 600;
  text-align: center;
  padding: 2px 4px;
  background: var(--primary-xlight);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.wk-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 10.5px;
  font-style: italic;
}

/* ════════════════════════════════════════════
   MONTHLY VIEW
════════════════════════════════════════════ */
.monthly-view { height: 100%; display: flex; flex-direction: column; }
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: auto repeat(6, 1fr);
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.month-head-cell {
  padding: 6px 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border-light);
}
.month-head-cell:last-child { border-right: none; }
.month-day {
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 5px 5px 4px;
  cursor: pointer;
  transition: background 0.1s;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-height: 0;
  overflow: hidden;
  position: relative;
}
/* Régimen overlay en vista mensual (no-export) */
.month-regimen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.85;
}
.month-regimen-l {
  position: absolute;
  bottom: 2px; right: 5px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.month-day > *:not(.month-regimen) { position: relative; z-index: 1; }
.month-day:hover { background: var(--bg-hover); }
.month-day.other { background: var(--bg-surface); opacity: 0.6; }
.month-day.today { background: var(--primary-xlight); }
.month-day.today:hover { background: #ddd6fe; }
.month-day.no-act { cursor: default; }
.month-day-n {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 3px;
}
.month-day.today .month-day-n {
  color: white;
  background: var(--primary);
  width: 21px; height: 21px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px;
}
.month-day.other .month-day-n { color: var(--text-light); }
.month-day-cnt { font-size: 13px; color: var(--primary); font-weight: 600; }
.month-day-hrs { font-size: 12.5px; color: var(--text-muted); }
.month-day-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 2px;
}

/* ════════════════════════════════════════════
   ANNUAL VIEW
════════════════════════════════════════════ */
.annual-view { height: 100%; display: flex; flex-direction: column; }
.annual-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 9px;
  flex: 1;
  overflow: hidden;
}
.ann-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.15s;
  overflow: hidden;
}
.ann-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.ann-card.cur-month { border-color: var(--primary); background: var(--primary-xlight); }
.ann-card.no-data { cursor: default; }
.ann-card.no-data:hover { border-color: var(--border); box-shadow: none; }
.ann-month-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.ann-card.cur-month .ann-month-name { color: var(--primary); }
.ann-big {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.ann-card.cur-month .ann-big { color: var(--primary); }
.ann-card.no-data .ann-big { color: var(--text-light); font-size: 20px; }
.ann-lbl { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ann-hrs { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-top: 4px; }
.ann-bar {
  height: 3px;
  background: var(--border-light);
  border-radius: 10px;
  margin-top: 8px;
  overflow: hidden;
}
.ann-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-mid));
  border-radius: 10px;
  transition: width 0.4s ease;
}

/* ─── Badges ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-Completado  { background: #D1FAE5; color: #059669; }
.badge-En.progreso { background: #DBEAFE; color: #2563EB; }
.badge-Pendiente   { background: #FEF3C7; color: #D97706; }
.badge-Cancelado   { background: #FEE2E2; color: #DC2626; }
/* safe class names */
.status-completado  { background: #D1FAE5; color: #059669; }
.status-en-progreso { background: #DBEAFE; color: #2563EB; }
.status-pendiente   { background: #FEF3C7; color: #D97706; }
.status-cancelado   { background: #FEE2E2; color: #DC2626; }

/* ─── Modal ─────────────────────────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.overlay.open { display: flex; }
/* Modal de detalle/guía: por encima del modal de edición (z-index 200) */
#overlay { z-index: 250; }
.modal {
  background: var(--bg);
  border-radius: var(--r-lg);
  width: 500px;
  max-width: 95vw;
  max-height: 80vh;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-hd h3 { font-size: 16px; font-weight: 700; flex: 1; min-width: 0; }
.modal-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.modal-title-text {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.btn-modal-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
  flex-shrink: 0;
}
.btn-modal-back:hover { background: var(--bg-hover); color: var(--text); border-color: var(--text-muted); }
.btn-modal-back i { font-size: 11px; }
.modal-close {
  background: none; border: none;
  color: var(--text-muted); font-size: 16px;
  padding: 4px 6px; border-radius: 4px; transition: all 0.1s;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-bd { padding: 16px 20px; overflow-y: auto; flex: 1; }
.modal-act {
  display: flex;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.modal-act:last-child { border-bottom: none; }
.modal-act-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.modal-act-body { flex: 1; }
.modal-act-time { font-size: 12px; font-weight: 700; color: var(--primary); }
.modal-act-title { font-size: 14.5px; font-weight: 600; color: var(--text); }
.modal-act-cat { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }
.modal-act-desc { font-size: 13.5px; color: var(--text); margin-top: 4px; line-height: 1.4; }

/* ─── No-export: hidden during PNG/PDF capture ──── */
body.exporting .no-export { visibility: hidden !important; }

/* PERSONALIZADO: ocultar número de actividades y tiempo inicio-fin */
.view-area.custom-mode .wk-stats,
.view-area.custom-mode .wk-act-time,
.view-area.custom-mode .tl-time-col,
.view-area.custom-mode .tl-duration,
.view-area.custom-mode .month-day-cnt,
.view-area.custom-mode .month-day-hrs { display: none !important; }
/* Durante exportación: anular zoom responsive (html2canvas deforma texto con zoom) */
body.exporting { zoom: 1 !important; }

/* ─── Edit button inside modal title ────────────── */
.btn-edit-act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 10px;
  vertical-align: middle;
  transition: all 0.15s;
  font-family: var(--font);
}
.btn-edit-act:hover { background: var(--primary-light); border-color: var(--primary); }
.btn-edit-act i { font-size: 11px; }

/* Duration in detail: muted, smaller */
.detail-dur {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 6px;
}

/* Wider modal for edit form */
.modal-lg { width: 680px; max-height: 92vh; }

/* Evidence manager inside edit modal */
.edit-ev-empty { font-size: 12.5px; color: var(--text-light); font-style: italic; margin-bottom: 4px; }
.edit-ev-label { font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 8px; }
.edit-ev-grid  { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.edit-ev-item  {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  width: 76px;
}
.edit-ev-thumb {
  width: 72px; height: 72px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  overflow: hidden;
  background: var(--bg-surface);
  display: flex; align-items: center; justify-content: center;
}
.edit-ev-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.edit-ev-thumb-pdf { background: #FEF2F2; }
.edit-ev-thumb-pdf i { font-size: 26px; color: #DC2626; }
.edit-ev-name  { font-size: 10px; color: var(--text-muted); text-align: center; word-break: break-all; line-height: 1.2; }
.edit-ev-del   {
  position: absolute;
  top: -6px; right: -6px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #DC2626;
  color: white;
  border: 2px solid white;
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.1s;
}
.edit-ev-del:hover { background: #991B1B; }

/* Delete button red on hover */
#edit-delete-btn:hover { background: #FEE2E2; color: #DC2626; border-color: #FECACA; }

/* ─── Activity detail modal ─────────────────────── */
.detail-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--bg-surface);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border-light);
}
.detail-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}
.detail-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.detail-cat { font-weight: 600; }
.detail-icon { font-size: 12px; color: var(--text-muted); width: 14px; text-align: center; }
.detail-desc {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 12px;
  padding: 0 2px;
}
.detail-evidence-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Clickable list items in day/month modals */
.modal-act-clickable {
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: background 0.1s;
  padding: 10px 6px;
  margin: 0 -6px;
  align-items: center;
}
.modal-act-clickable:hover { background: var(--bg-hover); }
.modal-act-arrow {
  color: var(--text-light);
  font-size: 11px;
  flex-shrink: 0;
  margin-left: 6px;
}

/* Evidence icons on timeline / weekly items */
.tl-ev-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--primary);
  background: var(--primary-xlight);
  border: 1px solid var(--primary-light);
  border-radius: 4px;
  padding: 1px 4px;
  margin-left: 5px;
  vertical-align: middle;
  line-height: 1;
}
.tl-ev-pdf  { color: #DC2626; background: #FEF2F2; border-color: #FECACA; }
.tl-ev-link { color: #2563EB; background: #DBEAFE; border-color: #BFDBFE; }
.wk-ev-link { color: #2563EB; }

/* Link in detail modal */
.detail-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  margin-bottom: 12px;
  background: #EFF6FF;
  border: 1.5px solid #BFDBFE;
  border-radius: var(--r-sm);
  color: #2563EB;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
  max-width: 100%;
  word-break: break-all;
}
.detail-link:hover { background: #DBEAFE; border-color: #93C5FD; text-decoration: none; }
.detail-link i:first-child { font-size: 12px; flex-shrink: 0; }
.detail-link span { flex: 1; min-width: 0; }
.detail-link-ext { font-size: 10px; opacity: 0.6; flex-shrink: 0; }

/* Weekly activity header row */
.wk-act-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wk-act-icons { display: flex; gap: 3px; align-items: center; }
.wk-ev-icon { font-size: 9px; color: var(--primary); opacity: 0.8; }
.wk-ev-pdf  { color: #DC2626; }

/* Monthly camera dot */
.month-day-cam {
  font-size: 8px;
  color: var(--primary);
  opacity: 0.7;
  margin-top: 1px;
}

/* Cursor pointer on clickable timeline items */
.tl-item { cursor: pointer; }

/* ─── Evidence thumbnails ───────────────────────── */
.evidence-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.ev-thumb {
  width: 72px; height: 72px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: var(--bg-surface);
  flex-shrink: 0;
  transition: all 0.15s;
}
.ev-thumb:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: scale(1.04); }
.ev-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ev-thumb-pdf {
  width: 72px; height: 72px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px; cursor: pointer;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: #FEF2F2;
  transition: all 0.15s;
}
.ev-thumb-pdf:hover { border-color: #DC2626; background: #FEE2E2; }
.ev-thumb-pdf i { font-size: 24px; color: #DC2626; }
.ev-thumb-pdf span { font-size: 10px; color: #DC2626; font-weight: 600; text-align: center; padding: 0 4px; line-height: 1.2; word-break: break-all; }
.ev-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  background: var(--primary-xlight);
  border: 1px solid var(--primary-light);
  border-radius: 20px;
  padding: 1px 7px;
  margin-left: 6px;
}
.ev-badge i { font-size: 10px; }

/* ─── Lightbox ───────────────────────────────────── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 500;
  align-items: center;
  justify-content: center;
}
.lightbox.open { display: flex; }
.lb-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
}
.lb-img {
  max-width: 88vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--r);
  box-shadow: 0 8px 48px rgba(0,0,0,0.6);
}
.lb-caption {
  margin-top: 12px;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  text-align: center;
}
.lb-close {
  position: fixed;
  top: 18px; right: 22px;
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  font-size: 20px;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.lb-close:hover { background: rgba(255,255,255,0.25); }
.lb-nav {
  position: fixed;
  top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  font-size: 20px;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.lb-nav:hover { background: rgba(255,255,255,0.25); }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lb-nav.hidden { opacity: 0; pointer-events: none; }

/* ─── Toast ─────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 22px; right: 22px;
  background: #1F2937;
  color: white;
  padding: 12px 20px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  opacity: 0;
  transition: all 0.22s;
  z-index: 400;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.ok  { background: #059669; }
.toast.err { background: #DC2626; }

/* ─── Empty state ───────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px;
  color: var(--text-muted);
  gap: 7px;
  text-align: center;
}
.empty-state i { font-size: 32px; opacity: 0.25; }
.empty-state p { font-size: 13.5px; }

/* ═══════════════════════════════════════════════════
   RÉGIMEN — calendario contenedor 3
════════════════════════════════════════════════════ */
.regimen-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.regimen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}
.regimen-nav { display: flex; align-items: center; gap: 4px; }
.regimen-month-lbl {
  font-size: 13px; font-weight: 700; color: var(--text);
  min-width: 100px; text-align: center;
}
.btn-reg-clear {
  margin-left: 6px;
  border: 1.5px solid #FECACA;
  background: #FEF2F2; color: #DC2626;
  font-size: 11px; font-weight: 600;
  padding: 4px 9px; border-radius: var(--r-sm);
  cursor: pointer; transition: all 0.15s; font-family: var(--font);
}
.btn-reg-clear:hover { background: #DC2626; color: white; border-color: #DC2626; }

/* Legend / type selector */
.regimen-legend {
  display: flex; flex-wrap: nowrap; gap: 3px;
}
.reg-type {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  flex: 1 1 0; min-width: 0;
  padding: 4px 5px; border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text-muted);
  font-size: 10px; font-weight: 600;
  cursor: pointer; transition: all 0.12s; font-family: var(--font);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.reg-type:hover { border-color: var(--rt-color); color: var(--rt-color); }
.reg-type.active {
  background: var(--rt-bg); border-color: var(--rt-color); color: var(--rt-color);
}
.reg-type-letter {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 15px; height: 15px; padding: 0 2px;
  border-radius: 4px; flex-shrink: 0;
  background: var(--rt-color); color: white;
  font-size: 8.5px; font-weight: 800;
}
.reg-type-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Calendar grid */
.regimen-grid { flex: 1; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.reg-heads {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.reg-head {
  text-align: center; font-size: 10px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase;
}
.reg-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: auto;
  gap: 4px;
  flex: none;
}
.reg-cell {
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  position: relative;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 4px 6px;
  transition: border-color 0.1s;
  background: var(--bg);
  aspect-ratio: 1 / 1;   /* celda cuadrada · estructura fija */
  min-height: 0;
}
.reg-cell:hover { border-color: var(--primary); }
.reg-cell.out { border: none; background: transparent; cursor: default; }
.reg-cell-n { font-size: 12px; font-weight: 700; }
.reg-cell-l {
  position: absolute; bottom: 3px; right: 5px;
  font-size: 10px; font-weight: 800;
}
.reg-cell.holiday { border-color: #DC2626; }
.reg-cell-hol {
  position: absolute; top: 2px; right: 4px;
  font-size: 10px; color: #DC2626; line-height: 1;
  cursor: help;
}

/* Summary */
.regimen-summary {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding-top: 8px; border-top: 1px solid var(--border-light);
}
.reg-sum-item { display: flex; align-items: baseline; gap: 5px; }
.reg-sum-n { font-size: 16px; font-weight: 800; }
.reg-sum-l { font-size: 11px; color: var(--text-muted); }
.reg-sum-empty { font-size: 11.5px; color: var(--text-light); font-style: italic; }

/* ── Régimen en las vistas (Historial) ──────────── */
/* Chip grande (Diario) */
.reg-vchip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600;
  padding: 2px 9px; border-radius: 20px;
  border: 1.5px solid; margin-left: 6px;
  vertical-align: middle;
}
.reg-vchip b { font-weight: 800; }
.reg-vchip-hol { background: #FEF2F2; color: #DC2626; border-color: #FECACA; }
.daily-regimen { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.daily-regimen .reg-vchip { margin-left: 0; font-size: 13px; padding: 3px 12px; }

/* Mini sigla (Semanal) */
.wk-regimen { display: flex; justify-content: center; gap: 3px; margin: 2px 0; }
.reg-mini {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 3px;
  border-radius: 4px; color: white;
  font-size: 9px; font-weight: 800;
}
.reg-mini-hol { background: #DC2626 !important; }

/* Chips de conteo (Anual) */
.ann-regimen { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.ann-reg-chip {
  display: inline-flex; align-items: center;
  font-size: 9.5px; font-weight: 700; color: white;
  padding: 1px 5px; border-radius: 20px;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE — escala proporcional para monitores
   más pequeños. 1920×1080 (alto ≥1001) queda intacto.
   App orientada a vistas sin scroll → se escala por alto.
════════════════════════════════════════════════════ */
@media (max-height: 1000px) { body { zoom: 0.92; } }
@media (max-height: 900px)  { body { zoom: 0.84; } }
@media (max-height: 820px)  { body { zoom: 0.76; } }
@media (max-height: 740px)  { body { zoom: 0.68; } }

/* Pantallas angostas: ajuste adicional por ancho */
@media (max-width: 1500px) and (min-height: 1001px) { body { zoom: 0.92; } }
@media (max-width: 1300px) and (min-height: 1001px) { body { zoom: 0.82; } }

/* Firefox no soporta zoom: fallback con transform */
@supports not (zoom: 1) {
  @media (max-height: 900px) {
    body { transform: scale(0.84); transform-origin: top left; width: 119%; height: 119%; }
  }
}
