/* ============================================================
   denschShift – Stylesheet
   ============================================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary:       #1D4ED8;
  --primary-dark:  #1E40AF;
  --primary-light: rgba(29,78,216,0.10);
  --success:       #10B981;
  --warning:       #F59E0B;
  --danger:        #EF4444;
  --g50:  #F9FAFB; --g100: #F3F4F6; --g200: #E5E7EB; --g300: #D1D5DB;
  --g400: #9CA3AF; --g500: #6B7280; --g600: #4B5563; --g700: #374151;
  --g800: #1F2937; --g900: #111827;
  --sidebar: 240px;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--g50);
  color: var(--g800);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar);
  background: white;
  border-right: 1px solid var(--g200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sb-logo {
  padding: 18px 16px;
  border-bottom: 1px solid var(--g200);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.sb-logo .icon {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}
.sb-logo h1  { font-size: 15px; font-weight: 700; color: var(--g900); }
.sb-logo span{ font-size: 11px; color: var(--g500); }
.sb-nav  { padding: 10px 8px; flex: 1; }
.nav-label {
  font-size: 10px; font-weight: 600; color: var(--g400);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 10px 8px 4px; margin-top: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  cursor: pointer; color: var(--g600);
  font-size: 13px; font-weight: 500;
  transition: all 0.12s; margin-bottom: 2px;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover  { background: var(--g100); color: var(--g900); }
.nav-item.active { background: var(--primary-light); color: var(--primary); }
.nav-item .ni   { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-item .ni svg { width: 18px; height: 18px; display: block; }
.conn-dot {
  width: 7px; height: 7px; border-radius: 50%;
  margin-left: auto; flex-shrink: 0;
}
.conn-dot.green { background: var(--success); }
.conn-dot.red   { background: var(--danger); }
.conn-dot.gray  { background: var(--g300); }

/* ── Main ── */
.main { margin-left: var(--sidebar); flex: 1; display: flex; flex-direction: column; min-width: 0; }
.page-header {
  background: white; border-bottom: 1px solid var(--g200);
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50; gap: 12px; flex-wrap: wrap;
}
.page-header-left h2  { font-size: 18px; font-weight: 600; color: var(--g900); }
.page-header-left p   { font-size: 12px; color: var(--g500); margin-top: 1px; }
.content { padding: 24px; flex: 1; }
.page { display: none; }
.page.active { display: block; }

/* ── Cards ── */
.card {
  background: white; border: 1px solid var(--g200);
  border-radius: var(--radius); overflow: hidden;
  margin-bottom: 16px;
}
.card:last-child { margin-bottom: 0; }
.card-header {
  padding: 14px 20px; border-bottom: 1px solid var(--g100);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 14px; font-weight: 600; }
.card-body { padding: 20px; }
.two-col  { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three-col{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; transition: all 0.12s;
  white-space: nowrap; text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: var(--g100); color: var(--g700); }
.btn-secondary:hover:not(:disabled) { background: var(--g200); }
.btn-danger  { background: #FEE2E2; color: var(--danger); }
.btn-danger:hover:not(:disabled)  { background: #FECACA; }
.btn-success { background: #D1FAE5; color: #065F46; }
.btn-success:hover:not(:disabled) { background: #A7F3D0; }
.btn-warning { background: #FEF3C7; color: #92400E; }
.btn-warning:hover:not(:disabled) { background: #FDE68A; }
.btn-sm  { padding: 5px 10px; font-size: 12px; }
.btn-lg  { padding: 10px 20px; font-size: 14px; }
.btn-icon{ padding: 6px 8px; }
.btn-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 9px 14px;
  background: var(--g50); border-bottom: 1px solid var(--g200);
  font-size: 10px; font-weight: 600; color: var(--g500);
  text-transform: uppercase; letter-spacing: 0.5px;
  white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid var(--g100); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--g50); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 100px;
  font-size: 11px; font-weight: 500;
}
.badge-p       { background: var(--primary-light); color: var(--primary); }
.badge-g       { background: var(--g100); color: var(--g600); }
.badge-s,
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-w,
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }

/* ── Modals ── */
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 1000;
  align-items: center; justify-content: center;
  padding: 16px;
}
.overlay.active { display: flex; }
.modal {
  background: white; border-radius: 16px;
  width: 100%; max-width: 540px; max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal-sm { max-width: 400px; }
.modal-lg { max-width: 780px; }
.modal-hd {
  padding: 18px 22px; border-bottom: 1px solid var(--g200);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: white; z-index: 1;
}
.modal-hd h3   { font-size: 15px; font-weight: 600; }
.modal-close   { background: none; border: none; cursor: pointer; color: var(--g400); font-size: 22px; line-height: 1; padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { background: var(--g100); }
.modal-bd { padding: 22px; }
.modal-ft {
  padding: 14px 22px; border-top: 1px solid var(--g200);
  display: flex; justify-content: flex-end; gap: 8px;
  position: sticky; bottom: 0; background: white;
}

/* ── Forms ── */
.fg          { margin-bottom: 14px; }
.fg:last-child{ margin-bottom: 0; }
.fg label    { display: block; font-size: 12px; font-weight: 500; color: var(--g700); margin-bottom: 5px; }
.fc {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--g300); border-radius: 8px;
  font-size: 13px; color: var(--g800); outline: none;
  transition: border-color 0.12s; background: white;
  font-family: inherit;
}
.fc:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.fc-mono  { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── Qualifications checkbox grid ── */
.qual-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 7px; }
.qual-cb {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 10px; border: 1px solid var(--g200); border-radius: 8px;
  cursor: pointer; font-size: 12px; transition: all 0.12s; user-select: none;
}
.qual-cb:hover  { border-color: var(--primary); background: var(--primary-light); }
.qual-cb.on     { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.qual-cb input  { display: none; }

/* ── Color picker ── */
.colors    { display: flex; gap: 7px; flex-wrap: wrap; }
.color-dot {
  width: 26px; height: 26px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent; transition: all 0.12s;
}
.color-dot.on { border-color: var(--g800); transform: scale(1.2); }

/* ── Day buttons ── */
.day-row { display: flex; gap: 6px; flex-wrap: wrap; }
.day-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--g300); background: white;
  cursor: pointer; font-size: 11px; font-weight: 600; color: var(--g600);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s;
}
.day-btn.on { background: var(--primary); border-color: var(--primary); color: white; }

/* ── Shift cards ── */
.shifts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.shift-card  { background: white; border: 1px solid var(--g200); border-radius: var(--radius); overflow: hidden; }
.shift-card-hd { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; }
.shift-card-title { font-size: 14px; font-weight: 600; }
.shift-card-bd { padding: 12px 16px; border-top: 1px solid var(--g100); }
.shift-time { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.shift-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; background: var(--g100); border-radius: 5px; font-size: 11px; color: var(--g600); }
.shift-card-ft { display: flex; gap: 7px; padding: 10px 16px; border-top: 1px solid var(--g100); }

/* ── Avatar ── */
.avatar {
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 600; color: white; flex-shrink: 0;
}

/* ── Dashboard stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card  { background: white; border: 1px solid var(--g200); border-radius: var(--radius); padding: 20px; }
.stat-icon  { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 12px; }
.stat-val   { font-size: 28px; font-weight: 700; color: var(--g900); line-height: 1; margin-bottom: 4px; }
.stat-lbl   { font-size: 12px; color: var(--g500); }

/* ── Availability grid ── */
.avail-grid {
  display: grid; grid-template-columns: 160px repeat(7, 1fr);
  background: white; border: 1px solid var(--g200); border-radius: var(--radius); overflow: hidden;
}
.avail-hd {
  padding: 9px 10px; font-size: 10px; font-weight: 600; color: var(--g500);
  text-transform: uppercase; background: var(--g50);
  border-bottom: 1px solid var(--g200); border-right: 1px solid var(--g100);
  text-align: center;
}
.avail-hd:first-child { text-align: left; }
.avail-name {
  padding: 10px 12px; font-size: 12px; font-weight: 500;
  border-right: 1px solid var(--g100); border-bottom: 1px solid var(--g100);
  display: flex; align-items: center; gap: 7px;
}
.avail-cell {
  padding: 6px; border-right: 1px solid var(--g100); border-bottom: 1px solid var(--g100);
  display: flex; align-items: center; justify-content: center;
}
.avail-toggle {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  cursor: pointer; font-size: 13px; transition: all 0.12s;
  display: flex; align-items: center; justify-content: center;
}
.avail-on   { background: #D1FAE5; color: #065F46; }
.avail-part { background: #FEF3C7; color: #92400E; }
.avail-off  { background: var(--g100); color: var(--g400); }

/* ── Schedule grid ── */
.sched-grid { background: white; border: 1px solid var(--g200); border-radius: var(--radius); overflow: hidden; }
.sched-col-hdrs { display: grid; background: var(--g50); border-bottom: 1px solid var(--g200); }
.sched-col-hd {
  padding: 11px 8px; text-align: center;
  font-size: 11px; font-weight: 600; color: var(--g600);
  border-right: 1px solid var(--g200);
}
.sched-col-hd:last-child { border-right: none; }
.sched-col-hd .dn { font-size: 18px; font-weight: 700; color: var(--g800); line-height: 1.2; }
.sched-col-hd.today .dn { color: var(--primary); }
.sched-row { display: grid; border-bottom: 1px solid var(--g100); }
.sched-row:last-child { border-bottom: none; }
.sched-shift-lbl {
  padding: 10px 12px; font-size: 11px; font-weight: 500; color: var(--g700);
  background: var(--g50); border-right: 1px solid var(--g200);
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.sched-shift-lbl .st { font-size: 10px; color: var(--g400); }
.sched-cell { padding: 6px; border-right: 1px solid var(--g100); min-height: 76px; }
.sched-cell:last-child { border-right: none; }
.sched-emp {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 7px; border-radius: 5px; margin-bottom: 3px;
  font-size: 11px; font-weight: 500;
}
.sched-cell-off { background: var(--g50); }
.sched-missing  { font-size: 10px; color: var(--danger); padding: 3px; }
.sched-warn     { font-size: 10px; color: var(--warning); margin-top: 2px; }

/* ── Week navigation ── */
.week-nav { display: flex; align-items: center; gap: 10px; }
.week-lbl { font-size: 13px; font-weight: 500; min-width: 215px; text-align: center; }
.hdr-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Alerts ── */
.alert {
  padding: 12px 16px; border-radius: 9px; font-size: 13px;
  margin-bottom: 14px; display: flex; align-items: flex-start; gap: 10px; line-height: 1.5;
}
.alert:last-child { margin-bottom: 0; }
.alert-info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.alert-danger  { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }

/* ── Empty state ── */
.empty { text-align: center; padding: 60px 20px; color: var(--g400); }
.empty .ei { font-size: 48px; margin-bottom: 12px; }
.empty h3  { font-size: 16px; color: var(--g600); margin-bottom: 6px; font-weight: 500; }
.empty p   { font-size: 13px; }

/* Spinner */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--g200); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.6s linear infinite;
  display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Divider */
.divider { border: none; border-top: 1px solid var(--g200); margin: 20px 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--g300); border-radius: 3px; }

/* ══════════════════════════════
   PRINT
   ══════════════════════════════ */
#print-header { display: none; }

@media print {
  body { background: white; font-size: 11px; }
  .sidebar, .page-header, #sc-alerts, .hdr-actions, .btn { display: none !important; }
  .main { margin-left: 0; }
  .page { display: block !important; }
  #pg-dashboard, #pg-employees, #pg-shifts, #pg-qualifications,
  #pg-availability { display: none !important; }
  #pg-schedule { display: block !important; }
  .content { padding: 0; }
  #print-header { display: block !important; margin-bottom: 14px; }
  #print-header h2 { font-size: 16px; font-weight: 700; }
  #print-header p  { font-size: 11px; color: #666; }
  .sched-grid { border-radius: 0; border: 1px solid #ccc; }
  .sched-col-hd, .sched-shift-lbl { background: #f5f5f5 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sched-emp { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sched-cell { min-height: 55px; }
}
