:root {
  --app-primary: #4f46e5;
  --app-primary-hover: #4338ca;
  --app-bg: #f1f5f9;
  --app-surface: #ffffff;
  --app-border: #e2e8f0;
  --app-text: #0f172a;
  --app-muted: #64748b;
  --app-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 8px 24px rgba(15, 23, 42, 0.06);
  --app-radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--app-bg);
  color: var(--app-text);
  min-height: 100vh;
}

.app-navbar {
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.app-brand {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--app-text);
}

.app-brand i {
  color: var(--app-primary);
}

.nav-pill {
  border-radius: 999px;
  padding: 0.45rem 1rem;
  color: var(--app-muted);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-pill:hover,
.nav-pill.active {
  background: #eef2ff;
  color: var(--app-primary);
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}

.page-header p {
  color: var(--app-muted);
  margin-bottom: 0;
}

.content-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  overflow: hidden;
}

.toolbar {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--app-border);
  background: #fafbfc;
}

.search-box {
  position: relative;
  max-width: 320px;
}

.search-box i {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--app-muted);
}

.search-box input {
  padding-left: 2.35rem;
  border-radius: 10px;
  border: 1px solid var(--app-border);
}

.search-box input:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
}

.btn-primary {
  background: var(--app-primary);
  border-color: var(--app-primary);
  border-radius: 10px;
  font-weight: 600;
  padding: 0.55rem 1rem;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--app-primary-hover);
  border-color: var(--app-primary-hover);
}

.table thead th {
  background: #f8fafc;
  color: var(--app-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--app-border);
  padding: 0.9rem 1.25rem;
}

.table tbody td {
  padding: 1rem 1.25rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}

.table tbody tr:hover {
  background: #f8fafc;
}

.badge-id {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.25rem 0.55rem;
  border-radius: 8px;
  background: #eef2ff;
  color: var(--app-primary);
  font-weight: 600;
  font-size: 0.85rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--app-border);
  background: white;
  color: var(--app-muted);
  transition: all 0.15s ease;
}

.btn-icon:hover {
  border-color: #cbd5e1;
  color: var(--app-text);
  background: #f8fafc;
}

.btn-icon.edit:hover {
  color: var(--app-primary);
  border-color: #c7d2fe;
  background: #eef2ff;
}

.btn-icon.delete:hover {
  color: #dc2626;
  border-color: #fecaca;
  background: #fef2f2;
}

.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--app-muted);
}

.empty-state i {
  font-size: 2.5rem;
  color: #cbd5e1;
  margin-bottom: 1rem;
}

.loading-overlay {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--app-muted);
  gap: 0.75rem;
}

.loading-overlay.show {
  display: flex;
}

.modal-content {
  border: none;
  border-radius: 16px;
  box-shadow: var(--app-shadow);
}

.modal-header {
  border-bottom: 1px solid var(--app-border);
  padding: 1.25rem 1.5rem;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  border-top: 1px solid var(--app-border);
  padding: 1rem 1.5rem;
}

.form-label {
  font-weight: 600;
  color: var(--app-text);
  margin-bottom: 0.4rem;
}

.form-control {
  border-radius: 10px;
  border: 1px solid var(--app-border);
  padding: 0.65rem 0.85rem;
}

.form-control:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
}

.toast-container {
  z-index: 1080;
}

.toast {
  border: none;
  border-radius: 12px;
  box-shadow: var(--app-shadow);
}

.toast-success .toast-header {
  background: #ecfdf5;
  color: #047857;
}

.toast-error .toast-header {
  background: #fef2f2;
  color: #b91c1c;
}

.filter-select {
  min-width: 180px;
  max-width: 220px;
  border-radius: 10px;
  border: 1px solid var(--app-border);
}

.filter-select:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
}

.badge-role {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-role.manager {
  background: #fef3c7;
  color: #b45309;
}

.badge-role.employee {
  background: #f1f5f9;
  color: #475569;
}

.badge-tipo {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
}

.badge-tipo.vacaciones {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-tipo.libre {
  background: #ede9fe;
  color: #6d28d9;
}

.badge-tipo.baja {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-tipo.default {
  background: #f1f5f9;
  color: #475569;
}

.form-check-input:checked {
  background-color: var(--app-primary);
  border-color: var(--app-primary);
}

/* Calendario anual minimalista */
.calendar-page-body {
  background: #fff;
}

.calendar-page {
  max-width: 1480px;
  margin: 0 auto;
  padding: 2rem 0.75rem 3rem;
}

.view-tabs {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  background: #f4f4f5;
  border-radius: 10px;
  padding: 4px;
}

.view-tab {
  border: none;
  background: none;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #888;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.view-tab:hover {
  color: #444;
}

.view-tab.active {
  background: #fff;
  color: #222;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.panel-toolbar-wrap {
  flex-wrap: wrap;
}

.panel-toolbar-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.panel-field-label {
  font-size: 0.72rem;
  color: #777;
  line-height: 1.2;
  margin: 0;
}

.worker-year-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.65rem 1.25rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid #ececec;
  border-radius: 10px;
  background: #fafbfc;
}

.worker-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 7rem;
}

.worker-stat-label {
  font-size: 0.72rem;
  color: #777;
  line-height: 1.25;
}

.worker-stat-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  line-height: 1.2;
}

.worker-stat-value.vacaciones { color: #1d4ed8; }
.worker-stat-value.pendientes { color: #047857; }
.worker-stat-value.libre { color: #6d28d9; }

.worker-chips-label {
  font-size: 0.75rem;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 1rem 0 0.5rem;
  text-align: center;
}

.worker-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.worker-chip {
  border: 1px solid #e5e5e5;
  background: #fff;
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font-size: 0.78rem;
  color: #888;
  cursor: pointer;
  transition: all 0.12s ease;
}

.worker-chip:hover {
  border-color: #ccc;
  color: #444;
}

.worker-chip.active {
  background: #222;
  border-color: #222;
  color: #fff;
}

/* Comparativa mensual */
.compare-scroll {
  overflow-x: auto;
  margin-top: 0.5rem;
  border: 1px solid #f0f0f0;
  border-radius: 10px;
}

.compare-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.compare-grid th,
.compare-grid td {
  padding: 0;
  text-align: center;
  border: none;
}

.compare-sticky-name {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  text-align: left !important;
  padding: 0.5rem 0.75rem !important;
  font-weight: 600;
  color: #333;
  font-size: 0.92rem;
  white-space: nowrap;
  min-width: 150px;
  max-width: 180px;
  border-right: 1px solid #f0f0f0 !important;
}

.compare-day-head {
  font-size: 0.92rem;
  font-weight: 700;
  color: #444;
  padding: 0.5rem 0 !important;
  min-width: 34px;
  border-bottom: 1px solid #f0f0f0 !important;
}

.compare-day-head.weekend {
  color: #666;
}

.compare-cell {
  min-width: 32px;
  height: 38px;
  cursor: pointer;
  transition: opacity 0.12s ease;
  vertical-align: middle;
}

.compare-cell:hover {
  opacity: 0.75;
}

.compare-cell.weekend {
  background: #fafafa;
}

.compare-cell.vacaciones { background: #dbeafe; }
.compare-cell.libre { background: #ede9fe; }
.compare-cell.baja { background: #fee2e2; }

.compare-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

.compare-cell.vacaciones .compare-dot { background: #3b82f6; opacity: 1; }
.compare-cell.libre .compare-dot { background: #8b5cf6; opacity: 1; }
.compare-cell.baja .compare-dot { background: #ef4444; opacity: 1; }

.compare-empty {
  text-align: center;
  color: #aaa;
  font-size: 0.9rem;
  padding: 3rem 1rem;
}

.calendar-top {
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 1rem;
}

.filter-select-minimal {
  width: auto;
  min-width: 160px;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #666;
  padding: 0.35rem 2rem 0.35rem 0.75rem;
  background-color: #fff;
  box-shadow: none;
}

.filter-select-minimal:focus {
  border-color: #ccc;
  box-shadow: none;
}

.calendar-count {
  font-size: 0.8rem;
  color: #aaa;
  padding-left: 0.25rem;
}

.year-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2rem 0 1.5rem;
}

.year-strip-arrow {
  border: none;
  background: none;
  color: #ccc;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: color 0.15s ease;
}

.year-strip-arrow:hover {
  color: #888;
}

.year-strip-years {
  display: flex;
  align-items: baseline;
  gap: 2rem;
}

.year-strip-item {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 400;
  color: #d4d4d4;
  transition: color 0.15s ease, font-size 0.15s ease;
  letter-spacing: -0.01em;
}

.year-strip-item:hover {
  color: #999;
}

.year-strip-item.active {
  font-size: 2rem;
  font-weight: 500;
  color: #222;
  cursor: default;
}

.calendar-legend-minimal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: #555;
}

.calendar-legend-minimal .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.legend-swatch.vacaciones { background: #3b82f6; }
.legend-swatch.libre { background: #8b5cf6; }
.legend-swatch.baja { background: #ef4444; }

.calendar-loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 4rem 0;
  color: #aaa;
  font-size: 0.9rem;
}

.calendar-loading.show {
  display: flex;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2.25rem 1rem;
}

.month-block {
  text-align: center;
}

.month-name {
  font-size: 1.15rem;
  font-weight: 600;
  color: #222;
  margin-bottom: 0.65rem;
  letter-spacing: 0.01em;
}

.month-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 0.2rem;
}

.month-weekdays span {
  font-size: 0.95rem;
  color: #444;
  font-weight: 700;
  line-height: 1.6;
}

.month-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 2px;
}

.cal-day {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font-size: 1rem;
  line-height: 1.4;
  color: #666;
  font-weight: 400;
  cursor: pointer;
  position: relative;
  font-family: inherit;
  transition: color 0.12s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 2.1rem;
}

.cal-num {
  line-height: 1.6;
  font-weight: 400;
}

.cal-day.empty {
  cursor: default;
}

.cal-day:not(.empty):hover {
  color: #444;
}

.cal-day.has-event {
  border-radius: 6px;
  padding: 1px 0 2px;
}

.cal-day.has-event .cal-num {
  font-weight: 600;
}

.cal-day.has-event.vacaciones {
  color: #1d4ed8;
  background: #dbeafe;
}

.cal-day.has-event.vacaciones:hover {
  color: #1e3a8a;
  background: #bfdbfe;
}

.cal-day.has-event.libre {
  color: #6d28d9;
  background: #ede9fe;
}

.cal-day.has-event.libre:hover {
  color: #5b21b6;
  background: #ddd6fe;
}

.cal-day.has-event.baja {
  color: #dc2626;
  background: #fee2e2;
}

.cal-day.has-event.baja:hover {
  color: #b91c1c;
  background: #fecaca;
}

.cal-day.has-event.mixed {
  color: #374151;
  background: #f3f4f6;
}

.cal-day.has-event.mixed:hover {
  color: #111827;
  background: #e5e7eb;
}

.cal-day.is-today {
  font-weight: 400;
  color: #444;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cal-day.is-today.has-event .cal-num {
  font-weight: 700;
}

.cal-day.is-today.has-event.vacaciones {
  color: #1d4ed8;
}

.cal-day.is-today.has-event.libre {
  color: #6d28d9;
}

.cal-day.is-today.has-event.baja {
  color: #dc2626;
}

.cal-dots {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-top: -2px;
  line-height: 0;
}

.cal-dots i {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  font-style: normal;
}

.cal-day.has-event.mixed .cal-dots i {
  width: 6px;
  height: 6px;
}

.cal-dots .dot-vacaciones { background: #3b82f6; }
.cal-dots .dot-libre { background: #8b5cf6; }
.cal-dots .dot-baja { background: #ef4444; }
.cal-dots .dot-default { background: #aaa; }

.day-events-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.day-event-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--app-border);
  border-radius: 10px;
  background: #fafbfc;
}

.day-event-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.day-event-name {
  font-weight: 600;
  color: var(--app-text);
}

.day-event-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

@media (max-width: 992px) {
  .year-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem 1rem;
  }

  .year-strip-years {
    gap: 1.25rem;
  }

  .year-strip-item.active {
    font-size: 1.6rem;
  }
}

@media (max-width: 768px) {
  .year-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 576px) {
  .calendar-page {
    padding: 1.25rem 0.5rem 2rem;
  }

  .year-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem 0.75rem;
  }

  .year-strip-years {
    gap: 0.75rem;
  }

  .year-strip-item {
    font-size: 0.85rem;
  }

  .year-strip-item.active {
    font-size: 1.35rem;
  }

  .filter-select-minimal {
    width: 100%;
    min-width: 0;
  }

  .calendar-legend-minimal {
    gap: 0.75rem;
  }
}

@media (max-width: 576px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.75rem;
  }

  .search-box {
    max-width: none;
  }

  .page-header {
    margin-bottom: 1rem !important;
  }

  .table thead {
    display: none;
  }

  .table tbody tr {
    display: block;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--app-border);
  }

  .table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    padding: 0.45rem 1rem;
  }

  .table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--app-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  .table tbody td.actions-cell {
    justify-content: flex-end;
    padding-top: 0.75rem;
  }

  .table tbody td.actions-cell::before {
    display: none;
  }
}
