:root {
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --primary-light: #f3e8ff;
  --text-main: #334155;
  --text-muted: #64748b;
  --border-color: #cbd5e1;
  --border-dark: #1e293b;
  --weekend-bg: #e2e8f0;
  --other-month-bg: #f1f5f9;
  --other-month-text: #94a3b8;
  --holiday-bg: #fef3c7;
  --holiday-border: #f59e0b;
  --vacation-bg: #e0f2fe;
  --radius: 10px;
}

body {
  font-family: 'Nunito', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  margin: 0;
  padding: 16px;
  display: flex;
  justify-content: center;
}

.app-container { width: 100%; max-width: 1200px; }
.app-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.today-display { font-size: 13px; color: var(--text-muted); font-weight: 600; }

.card {
  background: var(--card-bg); padding: 20px; border-radius: var(--radius);
  box-shadow: 0 0 10px rgba(0,0,0,0.03); border: 1px solid var(--border-color); margin-bottom: 16px;
}

.status-badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: bold; margin-left: 10px; }
.status-draft { background: #fef3c7; color: #b45309; }
.status-approved { background: #dcfce7; color: #15803d; }

.nav-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn {
  padding: 8px 14px; border: 1px solid var(--border-color); background: white; 
  border-radius: var(--radius); cursor: pointer; font-weight: 600; font-size: 13px;
}
.tab-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.form-group { margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

input, select, button {
  font-family: inherit; font-size: 13px; padding: 7px 10px;
  border-radius: 8px; border: 1px solid var(--border-color); outline: none;
}
input[type="month"] { cursor: pointer; }
input[type="radio"], input[type="checkbox"] { width: auto; display: inline-block; }

button.btn-primary { background-color: var(--primary); color: white; border: none; cursor: pointer; font-weight: 600; transition: background-color 0.2s; }
button.btn-primary:hover { background-color: var(--primary-hover); }
button.btn-secondary { background-color: #64748b; color: white; border: none; cursor: pointer; }
button.btn-danger { background-color: #ef4444; color: white; border: none; cursor: pointer; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.counter-input-group { display: flex; align-items: center; gap: 6px; }
.counter-btn { width: 32px; height: 32px; font-size: 16px; font-weight: bold; padding: 0; display: flex; align-items: center; justify-content: center; }
.counter-input-group input[type="number"] { width: 50px; text-align: center; }

.worker-id-badge {
  font-size: 9px;
  color: var(--text-muted);
  opacity: 0.75;
  font-weight: normal;
  margin-left: 2px;
}

.staff-priority-badge {
  display: inline-block;
  font-size: 9px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 1px 3px;
  margin-left: 3px;
  font-weight: 600;
}

.calendar-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 11px; }
.calendar-table th, .calendar-table td {
  border: 1px solid var(--border-color); padding: 5px 3px;
  text-align: center; word-wrap: break-word; position: relative;
  white-space: nowrap;
}
.calendar-table th { background-color: #f8fafc; font-weight: 700; }
.calendar-table th.admin-clickable-th { cursor: pointer; transition: background-color 0.1s ease; }
.calendar-table th.admin-clickable-th:hover { background-color: #e2e8f0; }

.calendar-table th.worker-col { background-color: var(--primary) !important; color: white !important; width: 140px; }
.calendar-table td.worker-col {
  background-color: var(--primary-light) !important;
  border-right: 1px solid var(--border-color) !important; 
  text-align: left !important; padding-left: 6px !important;
}

.calendar-table td.is-weekend { background-color: var(--weekend-bg) !important; }
.calendar-table td.is-other-month { background-color: var(--other-month-bg) !important; color: var(--other-month-text); }
.calendar-table td.is-holiday { background-color: var(--holiday-bg) !important; }
.is-holiday { background-color: var(--holiday-bg) !important; }
.is-holiday-cancelled { background-color: #ffe4e6 !important; }
.calendar-table td.is-vacation { background-color: var(--vacation-bg) !important; }

.holiday-icon-wrap { 
  display: inline-block; 
  line-height: 1; 
  vertical-align: text-bottom; 
  margin: 0 0 0 2px; 
  padding: 0; 
  font-size: 11px; 
}
.shift-note { display: block; font-size: 9px; color: #7c3aed; font-weight: bold; margin-top: 2px; line-height: 1; }

.locked-msg { background: #fee2e2; color: #991b1b; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; font-weight: bold; font-size: 12px; }
.draft-msg { background: #fef3c7; color: #b45309; padding: 15px; border-radius: 8px; text-align: center; font-weight: 600; font-size: 14px; border: 1px solid #f59e0b; }

.hidden { display: none !important; }

.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); display: flex;
  justify-content: center; align-items: center; z-index: 1000;
}
.modal-content {
  background: white; padding: 20px; border-radius: var(--radius);
  width: 90%; max-width: 450px; box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.users-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 15px; }
.users-table th, .users-table td { border: 1px solid var(--border-color); padding: 8px; text-align: left; }
.users-table th { background: #f1f5f9; }
.users-table input, .users-table select { width: 100%; box-sizing: border-box; padding: 5px; }

.calendar-table td.admin-clickable { cursor: pointer; transition: background-color 0.15s ease; }
.calendar-table td.admin-clickable:hover { outline: 2px solid var(--primary); z-index: 10; }

@media print {
  @page { size: A4 portrait; margin: 5mm; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; box-sizing: border-box !important; }
  body { background: white; padding: 0; font-size: 9px; margin: 0; }
  .no-print, .nav-tabs, button, form { display: none !important; }
  .card { box-shadow: none; border: none; padding: 0; margin-bottom: 2mm; }

  body.mode-individual-print #standard-schedule-view { display: none !important; }
  body.mode-individual-print #individual-print-view { display: block !important; }

  .week-print-container { 
    page-break-inside: avoid !important; 
    break-inside: avoid !important; 
    margin-bottom: 4mm !important;
  }

  .print-page-break { page-break-inside: avoid; page-break-after: always; break-after: page; }
  .print-header { border-bottom: 1px solid var(--primary); padding-bottom: 2px; margin-bottom: 4px; }
  .print-header h2 { margin: 0 0 2px 0; font-size: 14px; }
  .print-meta { font-size: 10px; }

  .highlighted-worker-row td { background-color: #ddd6fe !important; font-weight: bold; }
  .highlighted-worker-row td.worker-col { background-color: var(--primary) !important; color: white !important; }

  .calendar-table { 
    margin-bottom: 2mm; 
    border-collapse: collapse !important; 
    width: 100% !important; 
    border: 1px solid #1e293b !important; 
    table-layout: fixed !important; 
  }
  
  .calendar-table th, .calendar-table td { 
    font-size: 8px !important; 
    padding: 3px 1px !important; 
    border: 1px solid #1e293b !important; 
    word-wrap: break-word;
    overflow: hidden;
  }
  
  .calendar-table th:nth-child(1), .calendar-table td:nth-child(1) { 
    width: 15% !important; 
    white-space: normal !important; 
  }
}