/* Estilos generales — tema neutro, sidebar fijo, sin frameworks */

:root {
  --bg: #f4f5f7;
  --card: #fff;
  --text: #1a1d23;
  --muted: #5c6570;
  --sidebar: #1e2a3a;
  --sidebar-text: #e8ecf1;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --border: #dde1e6;
  --danger: #c62828;
  --warn: #ef6c00;
  --ok: #2e7d32;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, sans-serif; color: var(--text); background: var(--bg); }

.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e2a3a, #3d4f68); }
.login-card { background: var(--card); padding: 2rem; border-radius: 12px; width: 100%; max-width: 400px; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.login-card h1 { margin: 0 0 0.5rem; font-size: 1.5rem; color: var(--sidebar); }

.app-body { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; flex-shrink: 0; transition: width 0.2s ease, min-width 0.2s ease, opacity 0.15s ease; }
.sidebar-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; padding: 1rem 0.75rem 0.85rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand { font-weight: 700; font-size: 1rem; line-height: 1.3; flex: 1; min-width: 0; }
.sidebar-collapse-btn { flex-shrink: 0; margin: 0; padding: 0.25rem 0.45rem; font-size: 0.72rem; border-radius: 6px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: var(--sidebar-text); cursor: pointer; font-family: inherit; }
.sidebar-collapse-btn:hover { background: rgba(255,255,255,.14); }
.app-body.sidebar-collapsed .sidebar { width: 0; min-width: 0; overflow: hidden; opacity: 0; pointer-events: none; padding: 0; border: none; }
.sidebar-expand-fab { position: fixed; left: 0; top: 0.75rem; z-index: 2500; margin: 0; padding: 0.5rem 0.7rem 0.5rem 0.55rem; font-size: 0.85rem; font-weight: 600; border-radius: 0 10px 10px 0; border: 1px solid var(--border); border-left: none; background: var(--card); color: var(--text); box-shadow: 2px 2px 12px rgba(0,0,0,.12); cursor: pointer; font-family: inherit; }
.sidebar-expand-fab:hover { background: #f0f2f5; }
.sidebar-expand-fab:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.sidebar-nav { display: flex; flex-direction: column; padding: 0.75rem 0; flex: 1; }
.sidebar-nav a { color: var(--sidebar-text); text-decoration: none; padding: 0.65rem 1.25rem; opacity: 0.9; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.08); font-size: 0.85rem; display: flex; flex-direction: column; gap: 0.35rem; }
.sidebar-footer a { color: #93c5fd; text-decoration: none; }

.main-content { flex: 1; padding: 1.5rem 2rem; overflow-x: auto; }
.page-header { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { margin: 0; font-size: 1.35rem; }

.muted { color: var(--muted); font-size: 0.9rem; }

.btn { display: inline-block; padding: 0.55rem 1rem; border-radius: 8px; border: none; cursor: pointer; font-size: 0.95rem; text-decoration: none; text-align: center; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: #e5e7eb; color: #111; }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b71c1c; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.85rem; border-radius: 6px; }
.table-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.form-inline-delete { display: inline; margin: 0; }
.cli-hint { margin: 0.35rem 0 0; padding: 0.65rem 0.85rem; background: #f1f5f9; border: 1px solid var(--border); border-radius: 8px; font-size: 0.8rem; overflow-x: auto; }

.form-stack label { display: block; margin-bottom: 1rem; font-size: 0.9rem; }
.form-stack input, .form-stack select, .form-stack textarea { width: 100%; margin-top: 0.35rem; padding: 0.5rem 0.65rem; border: 1px solid var(--border); border-radius: 6px; }
.form-card { max-width: 520px; background: var(--card); padding: 1.5rem; border-radius: 10px; border: 1px solid var(--border); }
.reporte-card { max-width: none; }
.reporte-filtros { margin: 0; }
.reporte-filtros-grid { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 1.5rem; }
.reporte-filtros-grid label { display: block; margin: 0; font-size: 0.9rem; }
.reporte-filtros-grid input[type="date"] { margin-top: 0.35rem; padding: 0.5rem 0.65rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem; }
.reporte-filtros-actions { display: flex; align-items: flex-end; }

.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-error { background: #ffebee; color: #b71c1c; }
.alert-success { background: #e8f5e9; color: #1b5e20; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.data-table th, .data-table td { padding: 0.65rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: #f0f2f5; font-weight: 600; }

.color-dot { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border); vertical-align: middle; }

.badge { display: inline-block; padding: 0.2rem 0.5rem; border-radius: 6px; font-size: 0.8rem; }
.badge-ok { background: #e8f5e9; color: var(--ok); }
.badge-warn { background: #fff3e0; color: var(--warn); }
.badge-danger { background: #ffebee; color: var(--danger); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.card.tile { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1.25rem; text-decoration: none; color: inherit; display: block; transition: box-shadow .15s; }
.card.tile:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.tile-icon { font-size: 1.75rem; display: block; margin-bottom: 0.5rem; }
.card.tile h2 { margin: 0 0 0.35rem; font-size: 1.1rem; }
.card.tile p { margin: 0; font-size: 0.88rem; color: var(--muted); }

.palette-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 1rem; }
.palette-swatch { width: 26px; height: 26px; border-radius: 6px; border: 1px solid #ccc; cursor: pointer; padding: 0; }
.checkbox-inline { display: flex; align-items: center; gap: 0.5rem; }

/* Calendario layout */
.cal-layout { display: flex; gap: 1rem; align-items: stretch; flex-wrap: wrap; transition: gap 0.2s ease; }
.cal-layout.cal-side-collapsed { gap: 0; }
.cal-side { width: 220px; flex-shrink: 0; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem; max-height: 75vh; overflow-y: auto; transition: width 0.2s ease, min-width 0.2s ease, padding 0.2s ease, opacity 0.15s ease, border-width 0.2s ease; }
.cal-layout.cal-side-collapsed .cal-side { width: 0; min-width: 0; max-height: none; padding: 0; margin: 0; overflow: hidden; opacity: 0; pointer-events: none; border-width: 0; }
.cal-side h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.cal-main { flex: 1; min-width: 280px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem; overflow-x: auto; }
.cal-main #calendar { min-height: 400px; }
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.cal-title { font-weight: 600; flex: 1; min-width: 200px; }

.ext-item { padding: 0.45rem 0.5rem; margin-bottom: 0.4rem; border-radius: 6px; cursor: grab; font-size: 0.85rem; border-left: 4px solid #3788d8; background: #f8fafc; user-select: none; }
.ext-item:active { cursor: grabbing; }
.ext-emp { border-left-width: 4px; display: flex; align-items: center; gap: 0.35rem; }

.horas-resumen { margin-top: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; }
.horas-resumen h3 { margin: 0 0 0.75rem; font-size: 1rem; }
.hora-row { display: grid; grid-template-columns: 1fr 72px 72px 72px 72px; gap: 0.35rem; align-items: center; font-size: 0.85rem; margin-bottom: 0.5rem; }
.hora-row-head { color: var(--muted); font-weight: 600; font-size: 0.75rem; letter-spacing: 0.02em; margin-bottom: 0.4rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); }
.hora-row-foot { margin-top: 0.25rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.hora-row-head > div:not(.hora-row-head-spacer) { text-align: right; }
.hora-row:not(.hora-row-head) > div:nth-child(2),
.hora-row:not(.hora-row-head) > div:nth-child(3),
.hora-row:not(.hora-row-head) > div:nth-child(4),
.hora-row:not(.hora-row-head) > div:nth-child(5) { text-align: right; }
.hora-row .bar { grid-column: 1 / -1; height: 6px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin-top: 0.15rem; }
.hora-row .bar > i { display: block; height: 100%; border-radius: 4px; }

/* Exportación */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; z-index: 10000; }
.modal-backdrop.open { display: flex; }
.modal-box { background: #fff; padding: 1.25rem; border-radius: 10px; max-width: 400px; width: 90%; }
.modal-box h3 { margin-top: 0; }
.export-capture-wrap { background: #fff; }
.fc-export-mode .cal-toolbar .no-export,
.fc-export-mode .sidebar,
.fc-export-mode .cal-side,
.fc-export-mode .sidebar-expand-fab { display: none !important; }
.fc-export-mode .fc-toolbar-chunk button { display: none !important; }
.fc-export-mode .main-content { padding: 0; }
.fc-export-mode .cal-main { border: none; }

.export-banner { padding: 12px 16px; font-size: 1.1rem; font-weight: 700; color: #1e2a3a; border-bottom: 2px solid #1e2a3a; }
.export-footer-note { padding: 8px 16px; font-size: 0.8rem; color: #555; border-top: 1px solid #ddd; }

.spinner-overlay { position: fixed; inset: 0; background: rgba(255,255,255,.75); display: none; align-items: center; justify-content: center; z-index: 9999; font-weight: 600; }
.spinner-overlay.open { display: flex; }

/* Alerta fija (calendario): horas legales y otros errores de asignación */
.cal-legal-alert-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  background: #7f1d1d;
  color: #fff;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  border-bottom: 3px solid #450a0a;
}
.cal-legal-alert-banner.visible { display: flex; }
.cal-legal-alert-banner-msg { flex: 1; min-width: 200px; max-width: 56rem; }
.cal-legal-alert-banner-close {
  flex-shrink: 0;
  margin: 0;
  padding: 0.35rem 0.65rem;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 700;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
}
.cal-legal-alert-banner-close:hover { background: rgba(255, 255, 255, 0.22); }

@media (max-width: 900px) {
  .app-body { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .cal-side { width: 100%; max-height: none; }
}
