/* ═══════════════════════════════════════════════════
   BITÁCORA v3 — Login · Navbar · Vistas nuevas · Responsive
   (se carga después de app.css y sobreescribe lo necesario)
════════════════════════════════════════════════════ */

/* ─── LOGIN ─────────────────────────────────────── */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 55%, var(--primary-mid) 100%);
  overflow: hidden;
}
.login-bg { position: absolute; inset: 0; pointer-events: none; }
.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  animation: orbFloat 9s ease-in-out infinite alternate;
}
.login-orb-1 { width: 380px; height: 380px; background: #fff; top: -120px; left: -80px; }
.login-orb-2 { width: 300px; height: 300px; background: var(--primary-mid); bottom: -90px; right: -60px; animation-delay: -3s; }
.login-orb-3 { width: 220px; height: 220px; background: #fff; bottom: 20%; left: 12%; opacity: 0.15; animation-delay: -6s; }
@keyframes orbFloat {
  from { transform: translateY(0) scale(1); }
  to   { transform: translateY(40px) scale(1.12); }
}
.login-card {
  position: relative;
  width: 370px;
  max-width: calc(100vw - 32px);
  background: rgba(255,255,255,0.96);
  border-radius: 22px;
  padding: 38px 34px 30px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.35);
  text-align: center;
  animation: loginIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  backdrop-filter: blur(8px);
}
@keyframes loginIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.login-card.shake { animation: loginShake 0.4s; }
@keyframes loginShake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}
.login-logo {
  width: 58px; height: 58px;
  margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-mid));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.login-title {
  font-size: 26px; font-weight: 800;
  color: #111827; letter-spacing: -0.6px;
}
.login-subtitle {
  font-size: 13px; color: #6B7280;
  margin: 2px 0 24px;
}
.login-field {
  position: relative;
  margin-bottom: 12px;
}
.login-field > i {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: #9CA3AF; font-size: 13px;
}
.login-field input {
  width: 100%;
  padding: 12px 42px 12px 40px;
  border: 1.5px solid #E5E7EB;
  border-radius: 12px;
  font-size: 15px;
  color: #111827;
  background: #F9FAFB;
  outline: none;
  transition: all 0.15s;
  font-family: var(--font);
}
.login-field input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent);
}
.login-pin-toggle {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: #9CA3AF; font-size: 13px;
  padding: 8px 10px; cursor: pointer;
}
.login-pin-toggle:hover { color: var(--primary); }
.login-remember {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: #4B5563;
  cursor: pointer;
  margin: 4px 2px 0;
  user-select: none;
  font-weight: 500;
}
.login-remember input { display: none; }
.login-check {
  width: 18px; height: 18px;
  border: 1.5px solid #D1D5DB;
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  color: transparent; font-size: 10px;
  transition: all 0.15s;
  flex-shrink: 0;
  background: #fff;
}
.login-remember input:checked + .login-check {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.login-error {
  min-height: 18px;
  font-size: 12.5px;
  color: #DC2626;
  font-weight: 600;
  margin: 10px 0 4px;
}
.login-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-mid));
  color: #fff;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.15s;
  font-family: var(--font);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 40%, transparent);
}
.login-btn:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.login-btn:disabled { opacity: 0.7; cursor: default; }
.login-footer {
  position: relative;
  margin-top: 22px;
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.3px;
}
body.dark .login-card { background: rgba(15,23,42,0.94); }
body.dark .login-title { color: #F1F5F9; }
body.dark .login-field input { background: #1E293B; border-color: #334155; color: #F1F5F9; }
body.dark .login-remember { color: #94A3B8; }
body.dark .login-check { background: #1E293B; border-color: #475569; }

/* ─── NAVBAR: Exportar + salir + hamburguesa ────── */
.nav-export-wrap { position: relative; }
.nav-export-caret { font-size: 9px !important; margin-left: 2px; opacity: 0.6; }
.nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.nav-btn:disabled:hover { background: transparent; color: var(--text-muted); }
.nav-export-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 150px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: 5px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-export-menu button {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px;
  border: none; border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font-size: 13px; font-weight: 500;
  text-align: left;
  transition: background 0.1s;
  font-family: var(--font);
}
.nav-export-menu button:hover { background: var(--bg-hover); }
.nav-export-menu button i { width: 16px; text-align: center; color: var(--primary); }
.nav-btn-logout { color: var(--text-light); }
.nav-btn-logout:hover { background: #FEE2E2; color: #DC2626; }
.nav-hamburger {
  display: none;
  background: none; border: none;
  color: var(--text); font-size: 18px;
  padding: 6px 10px;
}

/* ─── CHIPS DE ESTADO ───────────────────────────── */
.status-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  transition: all 0.13s;
  font-family: var(--font);
}
.status-chip:hover { border-color: var(--st-color); color: var(--st-color); }
.status-chip-check {
  width: 15px; height: 15px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 8px;
  color: transparent;
  transition: all 0.13s;
  flex-shrink: 0;
}
.status-chip.selected {
  border-color: var(--st-color);
  background: color-mix(in srgb, var(--st-color) 10%, transparent);
  color: var(--st-color);
}
.status-chip.selected .status-chip-check {
  background: var(--st-color);
  border-color: var(--st-color);
  color: #fff;
}

/* ─── RESUMEN: estados ──────────────────────────── */
.summ-states {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  flex-wrap: wrap;
}
.summ-state { display: flex; align-items: center; gap: 6px; }
.summ-state-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.summ-state-n { font-size: 14.5px; font-weight: 800; color: var(--text); }
.summ-state-lbl { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }

/* ─── SELECTOR PRIMER DÍA SEMANA ────────────────── */
.weekstart-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px 8px;
}
.weekstart-wrap > i { font-size: 12px; color: var(--text-muted); }
.weekstart-wrap .f-select { border: none; background-color: transparent; padding: 3px 22px 3px 3px; }

/* ─── RÉGIMEN: modo edición ─────────────────────── */
.btn-reg-edit {
  margin-left: 6px;
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: var(--r-sm);
  cursor: pointer; transition: all 0.15s;
  font-family: var(--font);
  display: inline-flex; align-items: center; gap: 5px;
}
.btn-reg-edit:hover { border-color: var(--primary); color: var(--primary); }
.btn-reg-edit.editing {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.regimen-edit-hint {
  font-size: 11.5px;
  color: var(--primary-dark);
  background: var(--primary-xlight);
  border: 1px solid var(--primary-light);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  line-height: 1.4;
}
.regimen-edit-hint i { margin-right: 4px; }
body.dark .regimen-edit-hint { color: var(--text); }
.regimen-legend.regimen-locked { opacity: 0.45; pointer-events: none; }
.regimen-grid:not(.editing) .reg-cell { cursor: default; }
.regimen-grid:not(.editing) .reg-cell:hover { border-color: var(--border); }
.regimen-grid.editing .reg-cell:not(.out) { cursor: crosshair; }

/* Contador de actividades por día en régimen */
.reg-cell-acts {
  position: absolute;
  bottom: 3px; left: 5px;
  font-size: 9px;
  font-weight: 700;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border-radius: 4px;
  padding: 0 4px;
  line-height: 1.5;
  cursor: pointer;
  white-space: nowrap;
  max-width: calc(100% - 24px);
  overflow: hidden;
}
.reg-cell-acts i { font-size: 7.5px; }
.reg-cell-acts:hover { background: var(--primary); color: #fff; }

/* ─── SEMANAL v3 ────────────────────────────────── */
.wk-day-name { font-size: 10px; letter-spacing: 0.3px; }

/* Encabezado de día en modo oscuro: fondo sutil + texto legible */
body.dark .wk-daybox { background: rgba(255,255,255,0.05); }
body.dark .wk-col.today-col .wk-daybox { background: rgba(255,255,255,0.08); }

/* Vistas llenan todo el alto disponible */
.view-area { display: flex; flex-direction: column; }
.view-area > .daily-view,
.view-area > .weekly-view,
.view-area > .monthly-view,
.view-area > .annual-view { flex: 1; min-height: 0; }
.timeline { overflow-y: auto; }
/* Sin color-mix: html2canvas (export PNG/PDF) no lo soporta */
.wk-act-count {
  display: inline-flex; align-items: center;
  font-size: 9.5px; font-weight: 800;
  color: var(--primary);
  background: var(--primary-xlight);
  border-radius: 4px;
  padding: 0 5px;
  height: 16px;
}
.wk-ev-icon-w {
  font-size: 9px;
  color: var(--primary);
  background: none; border: none; padding: 0; margin-left: 3px;
}
.wk-ev-icon-w.tl-ev-pdf  { color: #DC2626; background: none; border: none; }
.wk-ev-icon-w.tl-ev-link { color: #2563EB; background: none; border: none; }

/* Exportación: sin resaltado del día actual */
body.exporting .wk-col.today-col {
  border-color: var(--border);
  background: var(--bg);
}
body.exporting .wk-col.today-col .wk-day-name,
body.exporting .wk-col.today-col .wk-day-num { color: var(--text); }

/* ─── MENSUAL v3: filas de actividades ──────────── */
.monthly-view { overflow: hidden; }
.month-grid {
  grid-template-rows: auto repeat(6, minmax(86px, 1fr));
  height: 100%;
  overflow-y: auto;
  flex: 1;
}
/* Régimen: fondo claro en modo claro, indicador lateral en oscuro */
.month-day.has-regimen { background: var(--reg-bg); }
body.dark .month-day.has-regimen {
  background: #1E293B;
  box-shadow: inset 3px 0 0 var(--reg-c);
}
.month-day {
  min-height: 86px;
  padding: 4px 4px 3px;
}
.month-day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
  flex-shrink: 0;
}
.month-regimen-l { position: static; font-size: 11px; font-weight: 800; }
.month-day.today { background: var(--bg); outline: 2px solid var(--primary); outline-offset: -2px; }
.month-day.today:hover { background: var(--bg-hover); }
body.exporting .month-day.today { outline: none; }
body.exporting .month-day.today .month-day-n {
  color: var(--text);
  background: transparent;
  width: auto; height: auto;
  border-radius: 0;
  font-size: 13px;
  display: block;
}
.month-day-acts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
}
.month-act {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 17px;
  flex-shrink: 0;
  border-radius: 4px;
  padding: 0 5px;
  color: #fff;
  font-size: 10px;
  cursor: pointer;
  overflow: hidden;
  transition: filter 0.1s;
}
.month-act:hover { filter: brightness(1.12); }
.month-act-time { font-weight: 800; font-size: 9px; flex-shrink: 0; opacity: 0.9; }
.month-act-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.month-act-extra { display: none; }
body.exporting .month-act-extra { display: flex; }
.month-more {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 4px;
}
.month-more:hover { background: var(--primary-xlight); }

/* ─── ANUAL v3 ──────────────────────────────────── */
.annual-view { overflow: hidden; }
.annual-scroll {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 2px;
}
.annual-grid {
  grid-template-rows: repeat(3, minmax(170px, 1fr));
  grid-auto-rows: minmax(170px, 1fr);
  flex: 1;
  overflow: visible;
}
.ann-year-summary { margin-top: auto; flex-shrink: 0; }
.ann-card { cursor: pointer; }
.ann-card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.ann-total {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.ann-card.cur-month .ann-total { color: var(--primary); }
.ann-card.no-data .ann-total { color: var(--text-light); }
body.exporting .ann-card.cur-month {
  border-color: var(--border);
  background: var(--bg);
}
.ann-states { display: flex; flex-direction: column; gap: 6px; flex: 1; justify-content: center; }
.ann-st-row { display: flex; flex-direction: column; gap: 2px; }
.ann-st-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.ann-st-row.ann-st-zero { opacity: 0.4; }
.ann-st-lbl { font-size: 10.5px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.ann-st-n { font-size: 11px; font-weight: 800; text-align: right; white-space: nowrap; }
.ann-st-bar {
  height: 6px;
  background: var(--border-light);
  border-radius: 10px;
  overflow: hidden;
}
.ann-st-fill { height: 100%; border-radius: 10px; transition: width 0.3s; }
.ann-regimen { margin-top: 8px; }

/* Resumen anual de días por etiqueta */
.ann-year-summary {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 13px 16px;
}
.ann-year-summary-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 9px;
}
.ann-year-summary-items { display: flex; flex-wrap: wrap; gap: 8px; }
.ann-ys-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1.5px solid;
  border-radius: 20px;
  padding: 4px 12px 4px 5px;
}
.ann-ys-letter {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 4px;
  border-radius: 50%;
  color: #fff;
  font-size: 9.5px; font-weight: 800;
}
.ann-ys-count { font-size: 15px; font-weight: 800; }
.ann-ys-label { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
body.dark .ann-ys-item { background: var(--bg-surface) !important; }
body.dark .ann-year-summary { background: #1E293B; }

/* ─── ALMACENAMIENTO (Configuración) ────────────── */
.storage-usage { display: flex; flex-direction: column; gap: 14px; }
.su-item { display: flex; flex-direction: column; gap: 5px; }
.su-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.su-title { font-size: 12.5px; font-weight: 700; color: var(--text); }
.su-service {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700;
  color: #F6821F;
  background: rgba(246,130,31,0.1);
  border: 1px solid rgba(246,130,31,0.3);
  border-radius: 20px;
  padding: 1px 8px;
  white-space: nowrap;
}
.su-nums {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-muted); font-weight: 500;
}

/* ─── AJUSTES VARIOS ────────────────────────────── */
.edit-ev-thumb-file { background: var(--bg-surface); }
.edit-ev-thumb-file i { font-size: 24px; }
.settings-section-desc i { margin-right: 5px; }

/* ═══════════════════════════════════════════════════
   RESPONSIVE REAL — móvil / tablet
════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  body { overflow: auto; height: auto; zoom: 1 !important; }
  .module { height: auto; min-height: calc(100vh - var(--nav-h)); overflow: visible; }
  #module-register { overflow-y: visible; }
  .register-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .register-layout > .card { height: auto; overflow: visible; }
  .today-list { max-height: 340px; }
  #module-consult { height: auto; overflow: visible; }
  .view-area { overflow: visible; padding: 12px 14px 20px; }
  .daily-view, .weekly-view, .monthly-view, .annual-view { height: auto; }
  .timeline, .weekly-grid { overflow: visible; }
  .annual-scroll { overflow: visible; }
  .month-grid { overflow: visible; }
  .annual-grid { grid-template-columns: repeat(2, 1fr); }
  .weekly-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .wk-col { min-height: 130px; }
  .summary-bar { flex-wrap: wrap; gap: 8px; padding: 8px 14px; }
  .summ-divider { display: none; }
  .consult-bar { padding: 10px 14px 8px; }
  .module-inner { padding: 14px; }
}

@media (max-width: 700px) {
  .navbar { padding: 0 14px; }
  .nav-subtitle { display: none; }
  .nav-hamburger { display: block; }
  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    flex-direction: column;
    align-items: stretch;
    padding: 8px 12px;
    gap: 4px;
    z-index: 150;
  }
  .nav-links.open { display: flex; }
  .nav-sep { display: none; }
  .nav-btn { justify-content: flex-start; padding: 10px 14px; font-size: 14.5px; }
  .nav-export-menu { position: static; box-shadow: none; border: none; padding-left: 24px; }

  #activity-form .row-datetime,
  #activity-form .row-classify,
  #edit-form .row-datetime,
  #edit-form .row-classify { grid-template-columns: 1fr; }
  .link-row { grid-template-columns: 1fr; }
  .link-row .btn-link-action { justify-self: end; }
  .weekly-grid { grid-template-columns: 1fr; }
  .annual-grid { grid-template-columns: 1fr; }
  .month-grid { min-width: 640px; }
  .monthly-view { overflow-x: auto; }
  .filters { flex-wrap: wrap; }
  .f-select, .f-input { flex: 1 1 45%; min-width: 0; }
  .period-tabs { flex-wrap: wrap; }
  .controls-row { gap: 8px; }
  .date-nav { width: 100%; justify-content: space-between; }
  .modal { width: 100%; max-width: 100vw; max-height: 92vh; border-radius: 14px 14px 0 0; align-self: flex-end; }
  .overlay { align-items: flex-end; }
  .modal-lg { width: 100%; }
  .settings-panel { width: 100%; }
  .status-chips { gap: 5px; }
  .status-chip { padding: 6px 10px; font-size: 12px; }
  .summ-states { gap: 10px; padding: 0; }
}

/* Alturas pequeñas de escritorio: mantener escala previa */
@media (min-width: 1101px) and (max-height: 1000px) { body { zoom: 0.92; } }
@media (min-width: 1101px) and (max-height: 900px)  { body { zoom: 0.84; } }
@media (min-width: 1101px) and (max-height: 820px)  { body { zoom: 0.76; } }
@media (min-width: 1101px) and (max-height: 740px)  { body { zoom: 0.68; } }
