/* ─── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #2563EB;
  --primary-dark:  #1D4ED8;
  --secondary:     #6366F1;
  --success:       #10B981;
  --warning:       #F59E0B;
  --danger:        #EF4444;
  --bg:            #F8FAFC;
  --surface:       #FFFFFF;
  --sidebar-bg:    #1E293B;
  --sidebar-text:  #94A3B8;
  --sidebar-hover: #334155;
  --sidebar-active:#2563EB;
  --text:          #1E293B;
  --text-secondary:#64748B;
  --border:        #E2E8F0;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08);
  --shadow-md:      0 4px 12px rgba(0,0,0,.1);
  --shadow-lg:      0 8px 32px rgba(0,0,0,.14);
  --radius:        8px;
  --radius-lg:     12px;
  --sidebar-w:     240px;
  --topbar-h:      60px;
  --transition:    150ms ease;
}

html { font-size: 14px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ─── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #CBD5E1; }

/* ─── App Shell ─────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-collapsed .sidebar {
  transform: translateX(-240px);
}
.sidebar-collapsed .main-content {
  margin-left: 0;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.sidebar-logo-sub {
  font-size: 10px;
  color: var(--sidebar-text);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 12px;
  overflow-y: auto;
}

.sidebar-nav-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(148,163,184,.5);
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 8px 8px 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
  text-decoration: none;
}

.nav-item.active {
  background: rgba(37,99,235,.2);
  color: #fff;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.05);
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.user-avatar.lg { width: 48px; height: 48px; font-size: 18px; }

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--sidebar-text); text-transform: capitalize; }

/* ─── Main Content ──────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-collapse {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border: none; background: transparent;
  color: var(--text-secondary);
  cursor: pointer; border-radius: 8px;
  transition: var(--transition);
}
.topbar-collapse:hover { background: var(--border); color: var(--text); }

.topbar-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
}

.topbar-hamburger:hover { background: var(--bg); }

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.topbar-clock {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 7px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}

.topbar-btn:hover { background: var(--bg); color: var(--text); }

.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  width: 16px; height: 16px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ─── Page Content ──────────────────────────────────────────────────────── */
.page-content {
  padding: 28px 28px 40px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ─── Stat Cards ────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.stat-icon.blue { background: rgba(37,99,235,.1); color: var(--primary); }
.stat-icon.green { background: rgba(16,185,129,.1); color: var(--success); }
.stat-icon.purple { background: rgba(99,102,241,.1); color: var(--secondary); }
.stat-icon.amber { background: rgba(245,158,11,.1); color: var(--warning); }
.stat-icon.red { background: rgba(239,68,68,.1); color: var(--danger); }
.stat-icon.teal { background: rgba(20,184,166,.1); color: #14B8A6; }

.stat-body { flex: 1; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.1; letter-spacing: -0.5px; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 3px; font-weight: 500; }
.stat-change { font-size: 11px; margin-top: 4px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: #EEF2FF; border-color: var(--primary); color: var(--primary); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #059669; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #DC2626; }

.btn-ghost { background: none; color: var(--text-secondary); border: none; }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }

.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-xl { padding: 16px 32px; font-size: 16px; border-radius: 12px; }

.btn-icon { padding: 8px; border-radius: var(--radius); }

/* ─── Clock Button (prominent) ─────────────────────────────────────────── */
.clock-btn {
  width: 140px; height: 140px;
  border-radius: 50%;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  position: relative;
  overflow: hidden;
}

.clock-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.15);
  border-radius: 50%;
}

.clock-btn.clock-in { background: linear-gradient(135deg, #10B981, #059669); color: #fff; }
.clock-btn.clock-out { background: linear-gradient(135deg, #EF4444, #DC2626); color: #fff; }
.clock-btn:hover:not(:disabled) { transform: scale(1.05); box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.clock-btn:active:not(:disabled) { transform: scale(0.97); }
.clock-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.clock-btn-label { font-size: 14px; font-weight: 700; z-index: 1; }
.clock-btn-time { font-size: 28px; font-weight: 700; z-index: 1; letter-spacing: -1px; }
.clock-btn-date { font-size: 11px; font-weight: 500; opacity: 0.85; z-index: 1; }

/* ─── Inputs ─────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label.required::after { content: ' *'; color: var(--danger); }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  transition: var(--transition);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.form-input.error, .form-select.error { border-color: var(--danger); }
.form-input.error:focus, .form-select.error:focus {
  box-shadow: 0 0 0 3px rgba(239,68,68,.1);
}

.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

.form-textarea { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ─── Tables ────────────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table thead th {
  background: var(--bg);
  padding: 12px 16px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #F8FAFF; }

/* ─── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-present  { background: rgba(16,185,129,.12);  color: #059669; }
.badge-late     { background: rgba(245,158,11,.12);  color: #D97706; }
.badge-early    { background: rgba(239,68,68,.12);   color: #DC2626; }
.badge-morning  { background: rgba(37,99,235,.12);   color: #2563EB; }
.badge-afternoon{ background: rgba(99,102,241,.12);  color: #6366F1; }
.badge-night    { background: rgba(30,41,59,.12);    color: #475569; }
.badge-custom   { background: rgba(245,158,11,.12);  color: #D97706; }
.badge-active   { background: rgba(16,185,129,.12);  color: #059669; }
.badge-inactive { background: rgba(100,116,139,.12); color: #64748B; }
.badge-admin    { background: rgba(99,102,241,.12);  color: #6366F1; }
.badge-manager  { background: rgba(245,158,11,.12);  color: #D97706; }
.badge-employee { background: rgba(37,99,235,.12);   color: #2563EB; }
.badge-ok       { background: rgba(16,185,129,.12);  color: #059669; }
.badge-understaffed { background: rgba(239,68,68,.12); color: #DC2626; }

/* ─── Modals ────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.25s ease;
}

.modal-lg { max-width: 640px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 16px; font-weight: 700; color: var(--text); }

.modal-close {
  background: none; border: none; color: var(--text-secondary);
  padding: 4px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body { padding: 24px; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ─── Toast Notifications ────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 360px;
  pointer-events: all;
  animation: slideIn 0.3s ease;
  border-left: 4px solid;
}

.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.info    { border-color: var(--primary); }

.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--primary); }

.toast-body { flex: 1; }
.toast-title { font-size: 13px; font-weight: 600; color: var(--text); }
.toast-msg { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }

/* ─── Tabs ──────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 24px; }

.tab-btn {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ─── Roster Grid ────────────────────────────────────────────────────────── */
.roster-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.roster-week-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
}

.roster-week-nav button {
  background: none;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}

.roster-week-nav button:hover { background: var(--bg); color: var(--text); }
.roster-week-nav button.today { background: var(--primary); color: #fff; border-radius: 6px; }
.roster-week-label { font-size: 13px; font-weight: 600; color: var(--text); min-width: 160px; text-align: center; }

.roster-grid {
  display: grid;
  grid-template-columns: 160px repeat(7, minmax(120px, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}

.roster-header-cell {
  background: var(--bg);
  padding: 12px 8px;
  text-align: center;
  border-right: 1px solid var(--border);
  font-size: 12px;
}

.roster-header-cell:last-child { border-right: none; }
.roster-day { font-weight: 700; color: var(--text); display: block; }
.roster-date { font-size: 11px; color: var(--text-secondary); font-weight: 500; }

.roster-emp-row { display: contents; }

.roster-emp-cell {
  padding: 10px 12px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  position: sticky;
  left: 0;
  z-index: 2;
  box-shadow: 2px 0 4px rgba(0,0,0,.06);
}

.roster-emp-name { font-size: 13px; font-weight: 600; color: var(--text); }
.roster-emp-dept { font-size: 11px; color: var(--text-secondary); }

.roster-shift-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px;
  min-height: 70px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
}

.roster-shift-cell:last-child { border-right: none; }
.roster-shift-cell:hover { background: #F0F4FF; }

.roster-add-btn {
  width: 100%;
  height: 100%;
  min-height: 70px;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--border);
  font-size: 18px;
  transition: var(--transition);
}

.roster-add-btn:hover { color: var(--primary); background: #EEF2FF; }

.shift-block {
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: grab;
  transition: box-shadow var(--transition);
  user-select: none;
  margin-bottom: 3px;
}

.shift-block:hover { box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.shift-block.dragging { opacity: 0.5; box-shadow: 0 4px 16px rgba(0,0,0,.2); }

.shift-block.morning   { background: rgba(37,99,235,.15);  color: #1D4ED8; border-left: 3px solid #2563EB; }
.shift-block.afternoon { background: rgba(99,102,241,.15); color: #4338CA; border-left: 3px solid #6366F1; }
.shift-block.night     { background: rgba(30,41,59,.12);    color: #334155; border-left: 3px solid #475569; }
.shift-block.custom    { background: rgba(245,158,11,.15); color: #92400E; border-left: 3px solid #F59E0B; }

.shift-loc { display: block; font-weight: 700; font-size: 11px; }
.shift-loc .draft { color: #B45309; font-size: 9px; vertical-align: super; }
.shift-time { display: block; }
.shift-note { font-weight: 400; font-size: 10px; opacity: 0.8; display: block; }

/* ─── Shift Block Actions (Edit/Delete/Copy) ────────────────────────────── */
.shift-block-actions {
  display: flex;
  gap: 4px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.shift-action-btn {
  background: rgba(255,255,255,.6);
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  padding: 1px 5px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.shift-action-btn.edit {
  color: #1D4ED8;
}
.shift-action-btn.edit:hover {
  background: rgba(37,99,235,.15);
  border-color: rgba(37,99,235,.3);
}
.shift-action-btn.copy {
  color: #065F46;
}
.shift-action-btn.copy:hover {
  background: rgba(5,150,105,.1);
  border-color: rgba(5,150,105,.3);
}
.shift-action-btn.delete {
  color: #B91C1C;
  padding: 1px 4px;
}
.shift-action-btn.delete:hover {
  background: rgba(220,38,38,.1);
  border-color: rgba(220,38,38,.3);
}

/* ─── Notification Panel ────────────────────────────────────────────────── */
.notif-panel {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  width: 360px;
  max-height: calc(100vh - var(--topbar-h) - 20px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 150;
  overflow: hidden;
  animation: slideIn 0.25s ease;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.notif-title { font-size: 14px; font-weight: 700; color: var(--text); }
.notif-list { max-height: 400px; overflow-y: auto; }

.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}

.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: rgba(37,99,235,.04); }

.notif-icon-wrap {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.notif-body { flex: 1; }
.notif-body-title { font-size: 12.5px; font-weight: 600; color: var(--text); }
.notif-body-msg { font-size: 12px; color: var(--text-secondary); margin-top: 2px; line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* ─── Filter Bar ───────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.filter-input-wrap .form-input {
  padding-left: 36px;
}

.filter-input-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

/* ─── Login Page ────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}

.login-header {
  background: linear-gradient(135deg, #1E293B, #0F172A);
  padding: 40px 32px 32px;
  text-align: center;
}

.login-logo {
  width: 56px; height: 56px;
  background: var(--primary);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}

.login-title { font-size: 22px; font-weight: 800; color: #fff; letter-spacing: -0.5px; }
.login-subtitle { font-size: 13px; color: var(--sidebar-text); margin-top: 6px; }

.login-body { padding: 32px; }

/* ─── Animations ────────────────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 14px;
}

.pulse-dot {
  width: 10px; height: 10px;
  background: var(--primary);
  border-radius: 50%;
  animation: pulse 1.5s ease infinite;
}

/* ─── Misc Utilities ───────────────────────────────────────────────────── */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted   { color: var(--text-secondary); }
.text-sm      { font-size: 12px; }
.text-xs      { font-size: 11px; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mb-4  { margin-bottom: 16px; }
.mb-6  { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex  { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state-desc { font-size: 13.5px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Dashboard ─────────────────────────────────────────────────────────── */
.dashboard-welcome {
  background: linear-gradient(135deg, #1E293B, #2563EB);
  border-radius: var(--radius-lg);
  padding: 32px;
  color: #fff;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.dashboard-welcome::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
}

.dashboard-welcome h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.dashboard-welcome p { font-size: 14px; opacity: 0.8; margin-top: 4px; }

.quick-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.quick-action-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.quick-action-btn:hover { background: rgba(255,255,255,.25); text-decoration: none; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-240px);
    width: 240px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-collapsed .sidebar { transform: translateX(-240px); }
  .sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99;
  }
  .topbar-hamburger { display: flex; }
  .topbar-collapse { display: none; }
  .main-content { margin-left: 0; }
}

@media (max-width: 768px) {
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .notif-panel { width: calc(100vw - 40px); right: -20px; }
  .form-row { grid-template-columns: 1fr; }
  .roster-grid { font-size: 12px; }
  .roster-emp-cell { padding: 8px; }
  .clock-btn { width: 120px; height: 120px; }
  .clock-btn-time { font-size: 22px; }
  .modal { max-width: 100%; border-radius: var(--radius); }
}

/* ── Comparison badges ── */
.badge-ontime    { background: rgba(16,185,129,.12);  color: #059669; }
.badge-late-badge { background: rgba(234,179,8,.15);  color: #B45309; }
.badge-earlyleave { background: rgba(239,68,68,.12);  color: #DC2626; }
.badge-overtime  { background: rgba(139,92,246,.12);  color: #7C3AED; }
.badge-leave     { background: rgba(37,99,235,.12);  color: #2563EB; }
.badge-absent    { background: rgba(100,116,139,.15); color: #475569; }
.badge-scheduled { background: rgba(59,130,246,.13);  color: #1D4ED8; }

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ─── Roster: frozen date header row + frozen name column ────────────────── */
.roster-pane {
  overflow: auto;
  max-height: calc(100vh - 240px);
  min-height: 320px;
  border-radius: 12px;
  overscroll-behavior: contain;
  position: relative;
  /* must stay bounded so the wide grid scrolls INSIDE the pane, not the page */
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* allow the page column to shrink below the roster's natural width */
.main-content { min-width: 0; }
.page-content { min-width: 0; max-width: 100%; }
/* every flex ancestor of a wide grid must be allowed to shrink, otherwise it
   stretches to the grid's natural width and the page (not the pane) overflows */
.page-content div:has(.roster-pane) { min-width: 0; }

/* Rows must be FLEX (not CSS grid). A sticky item can only move inside its
   containing block; as a grid item that block is the single cell, so the name
   column could never slide. As a flex item the containing block is the whole
   row, which is what makes the freeze work. */
.rg-row {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 1000px; /* 160 + 7 x 120 */
}
.rg-row > * { flex: 1 1 0; min-width: 120px; }
.rg-row-m { min-width: 1600px; }           /* monthly: 160 + 16 x 90 */
.rg-row-m > * { flex: 1 1 0; min-width: 90px; }

.rg-row > .rg-name,
.rg-row > .rg-corner {
  flex: 0 0 160px;
  width: 160px;
  min-width: 160px;
  max-width: 160px;
  box-sizing: border-box;
}

/* date header row — sticks to the top of the pane */
.roster-pane .rg-head {
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .12);
}
/* name column — sticks to the left edge */
.roster-pane .rg-name {
  position: sticky;
  left: 0;
  z-index: 20;
  background: var(--surface);
  box-shadow: 2px 0 4px -2px rgba(15, 23, 42, .12);
}
/* top-left corner cell — sticks both ways, above everything */
.roster-pane .rg-corner {
  position: sticky;
  left: 0;
  z-index: 40;
}
/* CRITICAL: the pane's direct child must size to its content. The store cards
   have overflow:clip and would otherwise stay at 100% pane width, clipping the
   1600px rows inside themselves — the pane then has nothing to scroll. */
.roster-pane > * { width: max-content; min-width: 100%; }

/* keep the horizontal scrollbar permanently visible (macOS hides overlays) */
.roster-pane { scrollbar-width: thin; scrollbar-color: #94A3B8 #F1F5F9; }
.roster-pane::-webkit-scrollbar { width: 12px; height: 12px; }
.roster-pane::-webkit-scrollbar-track { background: #F1F5F9; }
.roster-pane::-webkit-scrollbar-thumb {
  background: #94A3B8;
  border: 2px solid #F1F5F9;
  border-radius: 6px;
}
.roster-pane::-webkit-scrollbar-thumb:hover { background: #64748B; }
.roster-pane::-webkit-scrollbar-corner { background: #F1F5F9; }
.roster-pane:focus { outline: 2px solid var(--primary); outline-offset: -2px; }

@media (max-width: 1091px) {
  .roster-pane { max-height: calc(100vh - 210px); }
}
