:root {
  --ceicom-navy: #0a1f44;
  --ceicom-blue: #1e5aa8;
  --ceicom-blue-light: #3b82d4;
  --ceicom-accent: #00b4d8;
  --ceicom-gold: #c9a227;
  --bg-primary: #f0f4f8;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f8fafc;
  --text-primary: #0f2942;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --shadow-sm: 0 1px 2px 0 rgba(15, 41, 66, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 41, 66, 0.08), 0 2px 4px -2px rgba(15, 41, 66, 0.06);
  --shadow-lg: 0 10px 25px -3px rgba(15, 41, 66, 0.1), 0 4px 6px -4px rgba(15, 41, 66, 0.05);
  --shadow-xl: 0 20px 40px -5px rgba(15, 41, 66, 0.12), 0 8px 10px -6px rgba(15, 41, 66, 0.08);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition-fast: 150ms ease;
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: linear-gradient(135deg, var(--bg-primary) 0%, #e8eef5 100%);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, var(--ceicom-navy) 0%, var(--ceicom-blue) 100%);
  color: #fff;
  padding: 0 32px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, #fff 0%, #e0ecff 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ceicom-navy);
  font-weight: 900;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.brand-text b {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-text span {
  display: block;
  color: rgba(255, 255, 255, 0.75);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-normal);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-primary {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-solid {
  background: var(--ceicom-blue);
  color: #fff;
}

.btn-solid:hover {
  background: var(--ceicom-blue-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--ceicom-blue-light);
  color: var(--ceicom-blue);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid transparent;
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

main {
  max-width: 1680px;
  margin: 0 auto;
  padding: 24px;
}

.panel {
  display: none;
  animation: fadeIn 0.35s ease;
}

.panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, #eef4fb 100%);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.nav-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--ceicom-blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-btn:hover {
  background: var(--ceicom-blue);
  color: #fff;
  border-color: var(--ceicom-blue);
  transform: scale(1.05);
}

.month-title {
  min-width: 220px;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.view-toggle {
  display: inline-flex;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 2px;
}

.toggle-btn {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.toggle-btn:hover {
  color: var(--ceicom-blue);
  background: var(--bg-secondary);
}

.toggle-btn.active {
  background: linear-gradient(135deg, var(--ceicom-blue) 0%, var(--ceicom-blue-light) 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(30, 90, 168, 0.3);
}

.year-select {
  padding: 8px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  font-weight: 700;
  font-size: 14px;
  color: var(--ceicom-blue);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.year-select:hover {
  border-color: var(--ceicom-blue-light);
  color: var(--ceicom-blue-light);
}

.year-select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(30, 90, 168, 0.15);
  border-color: var(--ceicom-blue);
}

.sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}
.sync-indicator .sync-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.03);
}
.sync-indicator.online {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}
.sync-indicator.online .sync-dot {
  background: #10b981;
  animation: pulse-green 2s infinite;
}
.sync-indicator.offline {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}
.sync-indicator.offline .sync-dot { background: #ef4444; }
.sync-indicator.partial {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}
.sync-indicator.partial .sync-dot {
  background: #f59e0b;
  animation: pulse-amber 1s infinite;
}
.sync-indicator.syncing {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}
.sync-indicator.syncing .sync-dot {
  background: #3b82f6;
  animation: spin 0.7s linear infinite;
}
@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
  50%      { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}
@keyframes pulse-amber {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.25); }
}
@keyframes spin {
  from { transform: rotate(0deg) scale(1.1); }
  to   { transform: rotate(360deg) scale(1.1); }
}

.toolbar-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

tr.am-row.hidden-row,
tr.pm-separator.hidden-row,
tr.pm-row.hidden-row,
tr.abs-row.hidden-row {
  display: none !important;
}

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: box-shadow var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.board-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
}

.board-header b {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.board-header .board-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--ceicom-blue) 0%, var(--ceicom-accent) 100%);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
}

.board-header span {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.table-wrap {
  overflow: auto;
  max-height: 70vh;
  position: relative;
}

.table-wrap::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.table-wrap::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 5px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 5px;
}

.table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 1350px;
}

th, td {
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

thead th {
  position: sticky;
  top: 0;
  z-index: 10;
}

th.corner-cell {
  width: 160px;
  min-width: 160px;
  background: linear-gradient(135deg, var(--ceicom-navy) 0%, var(--ceicom-blue) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  padding: 14px 16px;
  z-index: 20;
  left: 0;
}

.day-cell {
  height: 78px;
  min-width: 160px;
  padding: 12px 14px;
  text-align: left;
  background: var(--bg-secondary);
  transition: background var(--transition-fast);
}

.day-cell:hover {
  background: var(--bg-tertiary);
}

.day-cell .dow {
  text-transform: capitalize;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.day-cell .date {
  font-size: 20px;
  font-weight: 800;
  margin-top: 4px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.day-cell.sat {
  background: linear-gradient(180deg, #fffbeb 0%, #fef9e7 100%);
}

.day-cell.sat .dow {
  color: #b45309;
}

.day-cell.sun {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.day-cell.sun .dow,
.day-cell.sun .date {
  color: var(--text-muted);
}

.day-cell.today {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  box-shadow: inset 0 3px 0 0 var(--ceicom-blue);
}

.day-cell.today .date {
  color: var(--ceicom-blue);
}

.time-cell {
  width: 160px;
  min-width: 160px;
  background: linear-gradient(90deg, var(--bg-tertiary) 0%, #eef4fb 100%);
  text-align: left;
  padding: 12px 16px;
  position: sticky;
  left: 0;
  z-index: 5;
  border-right: 2px solid var(--border-light);
}

.time-cell b {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 700;
}

.time-cell small {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
  margin-top: 3px;
  font-weight: 500;
}

.slot-cell {
  height: 72px;
  min-width: 160px;
  padding: 6px;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.slot-cell::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  background: linear-gradient(135deg, rgba(30, 90, 168, 0.04) 0%, rgba(0, 180, 216, 0.04) 100%);
  transition: opacity var(--transition-fast);
}

.slot-cell:hover::before {
  opacity: 1;
}

.slot-cell:hover {
  background: #f0f7ff;
}

.slot-cell.sat {
  background: #fffef7;
}

.slot-cell.sat:hover {
  background: #fff9e0;
}

.slot-cell.sun {
  background: #fafbfc;
  cursor: not-allowed;
}

.slot-cell.sun::before {
  display: none;
}

.slot-cell.is-today {
  background: #f0f7ff;
}

.assignment {
  height: 100%;
  border-radius: var(--radius-md);
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--c) 35%, #fff);
  border-left: 4px solid var(--c);
  background: color-mix(in srgb, var(--c) 10%, #fff);
  position: relative;
  transition: all var(--transition-normal);
  overflow: hidden;
}

.assignment:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--c) 25%, transparent);
}

.assignment.telework {
  background: var(--success-light) !important;
  border-left-color: var(--success) !important;
  border-color: color-mix(in srgb, var(--success) 35%, #fff) !important;
}

.assignment b {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
}

.assignment small {
  display: block;
  color: var(--text-secondary);
  font-size: 10px;
  margin-top: 3px;
  font-weight: 500;
}

.delete-btn {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 20px;
  height: 20px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  opacity: 0;
}

.assignment:hover .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  background: var(--danger);
  color: #fff;
  transform: scale(1.1);
}

.empty-hint {
  text-align: center;
  color: var(--border-medium);
  font-size: 11px;
  padding-top: 20px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.slot-cell:hover .empty-hint {
  color: var(--ceicom-blue);
}

.slot-cell.sat .empty-hint {
  color: #d97706;
}

.slot-cell.sun .empty-hint {
  color: var(--border-medium);
}

.holiday-cell {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%) !important;
  color: var(--danger) !important;
  cursor: not-allowed;
  display: flex;
  align-items: center;
  justify-content: center;
}

.holiday-cell::before {
  display: none;
}

.holiday-label {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  padding: 8px;
}

.holiday-label::before {
  content: '🎉';
  margin-right: 4px;
}

.abs-row td {
  height: 62px;
  background: linear-gradient(180deg, var(--bg-tertiary) 0%, #eef2f7 100%);
}

.abs-row .time-cell {
  background: linear-gradient(90deg, #e8eef5 0%, #dde6f0 100%);
  font-weight: 700;
}

.abs-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px;
  align-items: center;
  justify-content: center;
  min-height: 100%;
}

.abs-pill {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: var(--danger);
  border-radius: 20px;
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid rgba(220, 38, 38, 0.2);
  white-space: nowrap;
}

.pm-separator th {
  height: 44px !important;
  padding: 10px 16px !important;
  background: linear-gradient(135deg, var(--ceicom-navy) 0%, var(--ceicom-blue) 100%) !important;
  color: #fff;
  text-align: left !important;
  border-top: 3px solid var(--ceicom-accent) !important;
  border-bottom: 1px solid var(--border-light) !important;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
}

.pm-separator th:first-child {
  padding-left: 16px !important;
}

.pm-note {
  display: inline-block;
  margin-left: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: normal;
}

.pm-row .time-cell {
  background: linear-gradient(90deg, #f0f7ff 0%, #e8f0fe 100%);
}

.pm-row:nth-of-type(even) td {
  background: #f8fbfd;
}

.pm-person {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 3px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 700;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 12%, #fff) 0%, color-mix(in srgb, var(--c) 6%, #fff) 100%);
  border-left: 3px solid var(--c);
  transition: all var(--transition-fast);
  border: 1px solid color-mix(in srgb, var(--c) 25%, #fff);
  border-left-width: 3px;
}

.pm-person:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--c) 20%, transparent);
}

.pm-person.tt {
  background: linear-gradient(135deg, var(--success-light) 0%, #d1fae5 100%);
  border-left-color: var(--success);
  border-color: rgba(22, 163, 74, 0.3);
}

.pm-person small {
  font-weight: 500;
  color: var(--text-secondary);
}

.tt-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--success);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 16px;
  background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  border-top: 1px solid var(--border-light);
}

.day-stat {
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  transition: all var(--transition-normal);
}

.day-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--ceicom-blue-light);
}

.day-stat .label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0.03em;
}

.day-stat .nums {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 800;
}

.present-count {
  color: var(--success);
}

.absent-count {
  color: var(--danger);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.panel-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-header h2::before {
  content: '';
  width: 4px;
  height: 28px;
  background: linear-gradient(180deg, var(--ceicom-blue) 0%, var(--ceicom-accent) 100%);
  border-radius: 2px;
}

.people-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
}

.card-form,
.card-list {
  padding: 24px;
}

.card-form h3,
.card-list h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-field {
  margin-bottom: 14px;
}

.form-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-field input,
.form-field select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  transition: all var(--transition-fast);
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.form-field input:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--ceicom-blue);
  box-shadow: 0 0 0 3px rgba(30, 90, 168, 0.1);
  background: #fff;
}

.form-field input[type="color"] {
  padding: 4px;
  height: 44px;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.person-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
  border-radius: var(--radius-md);
  margin-bottom: 4px;
}

.person-item:hover {
  background: var(--bg-tertiary);
}

.person-item:last-child {
  border-bottom: none;
}

.person-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-preview {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.color-input-inline {
  width: 40px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.person-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
}

.person-item.inactive .person-name {
  color: var(--text-muted);
  text-decoration: line-through;
}

.person-actions {
  display: flex;
  gap: 6px;
}

.abs-item,
.holiday-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  transition: background var(--transition-fast);
}

.abs-item:hover,
.holiday-item:hover {
  background: var(--bg-tertiary);
}

.abs-item:last-child,
.holiday-item:last-child {
  border-bottom: none;
}

.abs-info,
.holiday-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.abs-info b,
.holiday-info b {
  font-size: 13px;
  font-weight: 700;
}

.abs-info small,
.holiday-info small {
  font-size: 11px;
  color: var(--text-secondary);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 31, 68, 0.55);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeOverlay 0.2s ease;
}

@keyframes fadeOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-overlay.show {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-subtitle {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-tertiary);
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--danger-light);
  color: var(--danger);
  transform: rotate(90deg);
}

.checkbox-option {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 8px;
}

.checkbox-option:hover {
  background: #eef4fb;
  border-color: var(--ceicom-blue-light);
}

.checkbox-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--ceicom-blue);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-option label {
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.preview-field {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, #eef4fb 100%);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 13px;
  color: var(--ceicom-blue);
  text-align: center;
  border: 1px dashed var(--ceicom-blue-light);
}

.empty-state {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.hidden-field {
  display: none;
}

.print-area {
  display: none;
}

@media (max-width: 1024px) {
  .people-layout {
    grid-template-columns: 1fr;
  }
  
  header {
    padding: 0 20px;
  }
  
  main {
    padding: 16px;
  }
  
  .month-title {
    min-width: 160px;
    font-size: 15px;
  }
  
  .stats-bar {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .month-nav {
    justify-content: center;
    margin-right: 0;
  }
  
  .toolbar-nav {
    justify-content: center;
  }
  
  .header-actions .btn span {
    display: none;
  }
  
  .modal {
    padding: 20px;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 5mm 6mm;
  }

  html, body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: 100% !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    -webkit-font-smoothing: antialiased;
  }

  header,
  .no-print {
    display: none !important;
  }

  main {
    padding: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }

  .panel { display: none !important; }
  .panel.active { display: block !important; }

  .screen-board, #syncCard {
    display: none !important;
  }

  .print-area {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .print-page {
    width: 100% !important;
    min-height: 190mm;
    max-height: 190mm;
    box-sizing: border-box !important;
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
    page-break-after: always;
    break-after: page;
    overflow: hidden;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .print-page:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  .print-week {
    width: 100% !important;
    height: 190mm;
    box-sizing: border-box !important;
    background: #fff !important;
    padding: 4mm 5mm !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 3mm;
    margin: 0;
    overflow: hidden;
  }

  /* === HEADER DE PAGE IMPRIMEE (SANS SIGNATURE) === */
  .print-page-header {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    padding-bottom: 2.5mm;
    border-bottom: 4px solid var(--ceicom-navy);
    margin-bottom: 0;
    flex: 0 0 auto;
    gap: 6mm;
  }
  .print-header-left {
    display: flex;
    align-items: center;
    gap: 4mm;
    flex: 1 1 auto;
  }
  .print-header-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    gap: 1.5mm;
    flex: 0 0 auto;
  }
  .print-logo-badge {
    width: 18mm;
    height: 18mm;
    border-radius: 4.5mm;
    background: linear-gradient(135deg, var(--ceicom-navy) 0%, var(--ceicom-blue) 55%, #3b82f6 100%);
    color: #fff;
    font-weight: 900;
    font-size: 28pt;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2mm 5mm rgba(10, 31, 68, 0.22);
    flex-shrink: 0;
  }
  .print-company-text { display: flex; flex-direction: column; gap: 0.5mm; }
  .print-company-name {
    font-size: 21pt;
    font-weight: 900;
    letter-spacing: 0.5px;
    color: var(--ceicom-navy);
    line-height: 1;
  }
  .print-company-sub {
    margin-top: 0.8mm;
    font-size: 11pt;
    color: #475569;
    font-weight: 600;
    letter-spacing: 1.2px;
  }
  .print-month-main {
    font-size: 22pt;
    font-weight: 900;
    color: var(--ceicom-navy);
    line-height: 1;
    letter-spacing: 0.5px;
  }
  .print-week-block {
    display: flex;
    align-items: center;
    gap: 2.5mm;
  }
  .print-week-num {
    display: inline-block;
    font-size: 15pt;
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, var(--ceicom-blue) 0%, #2563eb 100%);
    padding: 1.2mm 4mm;
    border-radius: 2.5mm;
    letter-spacing: 1px;
    box-shadow: 0 1mm 2.5mm rgba(30, 90, 168, 0.35);
  }
  .print-week-dates {
    font-size: 12pt;
    font-weight: 700;
    color: #1e293b;
    padding: 1mm 3mm;
    background: #eef4fb;
    border-radius: 2mm;
    border: 1px solid #dbe5f1;
  }

  /* === TABLEAU PRINCIPAL — COLONNES DYNAMIQUES (6 OU 7 PAR PAGE) === */
  .print-table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    border: 2px solid #0f2545 !important;
    font-size: 11pt;
    flex: 1 1 auto;
    page-break-inside: avoid;
    overflow: hidden;
  }
  .print-table col.print-time-col { width: 9.5% !important; }
  .print-table col.print-day-col  {
    width: calc((100% - 9.5%) / var(--cols, 6)) !important;
  }

  .print-table th,
  .print-table td {
    box-sizing: border-box !important;
    border-right: 1.5px solid #7a8ea5 !important;
    border-bottom: 1.5px solid #7a8ea5 !important;
    padding: 1mm 1.5mm !important;
    text-align: center;
    vertical-align: middle;
    overflow: hidden;
    background-clip: padding-box;
  }

  .print-table th:first-child,
  .print-table td:first-child {
    border-left: 2px solid #0f2545 !important;
  }

  .print-table thead tr:first-child th {
    border-top: 2px solid #0f2545 !important;
  }

  .print-table thead th {
    height: 18mm;
    background: linear-gradient(180deg, #e3ecf7 0%, #c9d8ec 100%) !important;
    color: var(--ceicom-navy);
    font-weight: 800;
    border-bottom: 2.5px solid var(--ceicom-navy) !important;
    padding: 1mm 0.5mm !important;
  }
  .print-table thead th.we {
    background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%) !important;
    color: #1e3a8a !important;
  }
  .print-table thead th.print-time-head {
    background: linear-gradient(180deg, var(--ceicom-navy) 0%, #1a3969 100%) !important;
    color: #fff;
    font-size: 11.5pt;
    letter-spacing: 1.5px;
    font-weight: 800;
  }
  .print-table thead th.print-empty-col {
    background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 2mm, #e2e8f0 2mm, #e2e8f0 4mm) !important;
    border-left: 1.5px dashed #94a3b8 !important;
    border-right: 1.5px dashed #94a3b8 !important;
  }
  .print-table thead th.print-empty-col.we {
    background: repeating-linear-gradient(45deg, #eff6ff, #eff6ff 2mm, #dbeafe 2mm, #dbeafe 4mm) !important;
  }
  .print-dow {
    font-size: 9.5pt;
    letter-spacing: 1.5px;
    font-weight: 800;
    opacity: 0.9;
    line-height: 1;
  }
  thead th.we .print-dow { opacity: 1; }
  .print-date-num {
    margin-top: 0.6mm;
    font-size: 24pt;
    line-height: 1;
    font-weight: 900;
    color: var(--ceicom-navy);
    font-family: 'Inter', system-ui, sans-serif;
  }
  .print-date-small {
    margin-top: 0.5mm;
    font-size: 8pt;
    font-weight: 600;
    color: #475569;
  }
  .print-date-empty {
    margin-top: 1mm;
    font-size: 20pt;
    color: #cbd5e1;
    font-weight: 700;
  }
  thead th.we .print-date-num,
  thead th.we .print-date-small { color: #1e40af !important; }

  /* Cellules weekend (gris-bluet clairement délimité) */
  .print-table tbody td.we-cell {
    background-color: #f8fbff !important;
  }
  .print-table tbody tr:nth-child(even) td.we-cell {
    background-color: #ecf3fd !important;
  }

  /* Lignes horaires */
  .print-time-row {
    background: linear-gradient(90deg, #eef4fb 0%, #e6edf7 100%) !important;
    font-weight: 800 !important;
    text-align: left !important;
    padding-left: 3mm !important;
    color: #0f172a;
    font-size: 11pt;
  }
  .print-time-row b {
    font-size: 12pt;
    display: block;
    line-height: 1.05;
    color: var(--ceicom-navy);
  }
  .print-time-row small {
    display: block;
    font-weight: 500;
    font-size: 8.5pt;
    color: #64748b;
    margin-top: 0.3mm;
  }
  .print-time-row.ast {
    background: linear-gradient(90deg, #fef3c7 0%, #fde68a 100%) !important;
    color: #92400e;
    border-bottom: 2px solid #fbbf24 !important;
  }
  .print-time-row.ast b { color: #78350f; }
  .print-time-row.abs-row-header {
    background: linear-gradient(90deg, #dfe7f1 0%, #d0dae7 100%) !important;
    color: #1e293b;
    font-weight: 900 !important;
    border-top: 2px solid #94a3b8 !important;
  }

  /* Alternance lignes CONTRASTEE */
  .print-table tbody tr:nth-child(odd) th,
  .print-table tbody tr:nth-child(odd) td {
    background: #ffffff !important;
  }
  .print-table tbody tr:nth-child(even) th,
  .print-table tbody tr:nth-child(even) td {
    background: #eaf1fb !important;
  }
  .print-table .print-abs th,
  .print-table .print-abs td {
    background: #dbe5f1 !important;
  }

  .print-table tbody td {
    min-height: 10.5mm;
    height: 10.5mm;
  }

  /* Cartes agent */
  .print-assignment {
    max-width: 100%;
    box-sizing: border-box;
    border-left: 5px solid var(--c) !important;
    background: linear-gradient(180deg, #f5f9fd 0%, #eef3f9 100%) !important;
    padding: 1mm 2mm !important;
    border-radius: 1.8mm;
    overflow: hidden;
    text-align: left;
    box-shadow: 0 0.6mm 1.2mm rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.35);
  }
  .print-assignment.ast-assign {
    background: linear-gradient(180deg, #fff8e1 0%, #ffecb3 100%) !important;
    border-color: #d97706 !important;
  }
  .print-assignment b {
    display: block;
    font-size: 11.5pt;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 800;
    color: var(--ceicom-navy);
  }
  .print-assignment small {
    display: block;
    font-size: 8.8pt;
    color: #475569;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    margin-top: 0.2mm;
    font-weight: 500;
  }
  .print-ast-empty {
    font-size: 10pt;
    font-weight: 700;
    color: #b45309;
    font-style: italic;
  }

  /* Jours fériés */
  .print-holiday {
    background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%) !important;
    color: #991b1b !important;
    font-weight: 800 !important;
    font-size: 10.5pt;
    padding: 1mm 1.8mm !important;
    border-radius: 1.5mm;
    border: 1.5px solid #fecaca !important;
  }

  /* Absences ligne */
  .print-abs span {
    display: inline-block;
    background: linear-gradient(180deg, #fee2e2 0%, #fecaca 100%) !important;
    color: #7f1d1d;
    border: 1px solid #fca5a5;
    padding: 0.8mm 2mm;
    border-radius: 1.5mm;
    margin: 0.4mm;
    font-size: 9.5pt;
    font-weight: 700;
    line-height: 1.3;
  }
}

@media screen {
  .print-preview-hint { display: none; }
}
