@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/*
 * ══════════════════════════════════════════════════════════════════
 *  PRIMERA PHARMA — shared.css
 *  Single source of truth for styles used across ALL role dashboards.
 *
 *  LEGO BLOCK PHILOSOPHY:
 *  Each section here is a reusable "block" that every page can use.
 *  Role-specific styles (admin tables, area-manager route cards, etc.)
 *  stay inside that page's own <style> tag.
 *
 *  BACKEND MIGRATION:
 *  When moving to a React/Tailwind build, this file maps to:
 *    - globals.css (base reset + typography)
 *    - components/Sidebar.css
 *    - components/Modal.css
 *    - components/Button.css
 *    - components/Card.css
 *    - components/ProfileCard.css
 *    - components/LeaveTab.css
 * ══════════════════════════════════════════════════════════════════
 */

/* ─────────────────────────────────────────────
   1. BASE RESET + LAYOUT
   ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  margin: 0;
  background: #f4f6f9;
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.5;
  color: #111827;
}

/* ── Typography scale ── */
h1 { font-size: 22px; font-weight: 800; color: #0f172a; letter-spacing: -0.03em; margin: 0 0 4px; line-height: 1.2; }
h2 { font-size: 18px; font-weight: 700; color: #0f172a; letter-spacing: -0.02em; margin: 0 0 4px; }
h3 { font-size: 15px; font-weight: 700; color: #0f172a; letter-spacing: -0.01em; margin: 0 0 4px; }
h4 { font-size: 13px; font-weight: 700; color: #374151; margin: 0 0 2px; }
p  { margin: 0 0 8px; }

.content {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  height: 100vh;
  min-width: 0;
}

/* View switcher — all dashboards use .view / .view.active */
.view { display: none; }
.view.active { display: block; }

/* Section switcher — admin uses .section / .section.active */
.section { display: none; }
.section.active { display: block; }

/* ─────────────────────────────────────────────
   2. SIDEBAR (desktop + collapsed + mobile drawer)
   Accepts any nav items — just pass <a> tags.
   ───────────────────────────────────────────── */
.sidebar-container {
  width: 240px;
  min-width: 240px;
  background: linear-gradient(180deg, #2d0f40 0%, #1a0828 100%);
  padding: 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: width 0.26s cubic-bezier(.4,0,.2,1),
              min-width 0.26s cubic-bezier(.4,0,.2,1);
  z-index: 1005;
  flex-shrink: 0;
  overflow-x: hidden;
  overflow-y: auto;
}
/* Hide scrollbar visually but keep functionality */
.sidebar-container::-webkit-scrollbar { width: 0; }
.sidebar-container { scrollbar-width: none; }

/* Brand header */
.sidebar-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  margin-bottom: 6px;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-logo {
  width: 32px; height: 32px; min-width: 32px;
  border-radius: 9px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.sidebar-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 7px; }
.sidebar-brand { flex: 1; min-width: 0; overflow: hidden; }
.sidebar-title {
  font-size: 13px; font-weight: 700; margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -.2px;
  color: rgba(255,255,255,0.92);
}
.sidebar-subtitle { font-size: 12px; color: rgba(255,255,255,.5); margin: 0; white-space: nowrap; }

.menu-toggle {
  width: 30px; height: 30px; min-width: 30px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px;
  cursor: pointer; color: #fff;
  transition: background 0.18s;
  padding: 0; flex-shrink: 0;
}
.menu-toggle:hover { background: rgba(255,255,255,0.18); }
.menu-toggle svg { width: 16px; height: 16px; }

/* Nav links */
.nav-icon { flex-shrink: 0; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 18px; height: 18px; display: block; flex-shrink: 0; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.sidebar-container a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.16s, color 0.16s;
  cursor: pointer;
  position: relative;
}
.sidebar-container a:hover { background: rgba(255,255,255,0.10); color: #fff; border-color: rgba(255,255,255,0.10); }
.sidebar-container a.active { background: rgba(111,59,162,0.50); color: #fff; border-color: rgba(111,59,162,.45); }

.sidebar-divider { height: 1px; background: rgba(255,255,255,0.10); margin: 6px 4px; flex-shrink: 0; }

.signout {
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin-top: auto !important;
  background: rgba(220,38,38,0.16) !important;
  color: #fca5a5 !important;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(220,38,38,0.25) !important;
  border-radius: 10px !important;
  padding: 9px 10px !important;
  font-size: 13px;
}
.signout:hover { background: rgba(220,38,38,0.28) !important; color: #fff !important; }

/* Sidebar status box (office / regional) */
.office-status {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.10);
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 4px;
  flex-shrink: 0;
  overflow: hidden;
}
.office-status h4 { margin: 0 0 4px; font-size: 12px; color: #fff; }
.office-status p { margin: 2px 0; font-size: 12px; color: rgba(255,255,255,.65); }

/* Collapsed desktop state */
.sidebar-container.closed { width: 56px; min-width: 56px; padding: 10px 6px; align-items: center; overflow: visible; }
.sidebar-container.closed .sidebar-top { flex-direction: column; gap: 6px; padding: 4px 0 10px; align-items: center; justify-content: center; }
.sidebar-container.closed .sidebar-brand,
.sidebar-container.closed .nav-label,
.sidebar-container.closed .sidebar-divider,
.sidebar-container.closed .office-status { display: none; }
.sidebar-container.closed a { justify-content: center; padding: 9px; border-radius: 10px; }
.sidebar-container.closed .signout { justify-content: center; }
/* Tooltip on hover when collapsed */
.sidebar-container.closed a[data-tip] { overflow: visible; }
.sidebar-container.closed a[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%; transform: translateY(-50%);
  background: #1a0828; color: #fff;
  font-size: 12px; white-space: nowrap;
  padding: 5px 10px; border-radius: 7px;
  pointer-events: none; opacity: 0;
  transition: opacity 0.15s; z-index: 9999;
  border: 1px solid rgba(255,255,255,0.12);
}
.sidebar-container.closed a[data-tip]:hover::after { opacity: 1; }

/* ─────────────────────────────────────────────
   3. MOBILE TOPBAR + DRAWER
   ───────────────────────────────────────────── */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 54px;
  background: #2d0f40;
  z-index: 3000;
  align-items: center;
  padding: 0 14px;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.mobile-menu-btn {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 9px; color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.mobile-menu-btn svg { width: 18px; height: 18px; }
.mobile-page-title { font-size: 15px; font-weight: 700; color: #fff; flex: 1; }

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.52);
  z-index: 2999;
}
.sidebar-backdrop.visible { display: block; }

/* ─────────────────────────────────────────────
   4. RESPONSIVE BREAKPOINTS
   ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ── iPad landscape (769px–1180px): collapsed sidebar saves space ── */
@media (min-width: 769px) and (max-width: 1180px) {
  .sidebar-container {
    width: 56px !important;
    min-width: 56px !important;
    padding: 10px 6px !important;
    align-items: center !important;
    overflow: visible !important;
  }
  .sidebar-container .sidebar-brand,
  .sidebar-container .nav-label,
  .sidebar-container .sidebar-divider,
  .sidebar-container .office-status { display: none !important; }
  .sidebar-container .sidebar-top {
    flex-direction: column !important;
    gap: 6px !important;
    padding: 4px 0 10px !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .sidebar-container a {
    justify-content: center !important;
    padding: 9px !important;
    border-radius: 10px !important;
  }
  .sidebar-container .signout { justify-content: center !important; }
  .sidebar-container a[data-tip]::after { display: none !important; }
  .content { padding: 24px 20px !important; }
}

@media (max-width: 768px) {
  body { display: block !important; overflow-x: hidden; }
  .mobile-topbar { display: flex; }

  /* Hide desktop topbar on mobile — mobile-topbar replaces it */
  .topbar { display: none !important; }

  /* Make main fill width (sidebar is now an overlay) */
  .main { display: block !important; width: 100% !important; }

  /* Drawer */
  .sidebar-container {
    position: fixed !important;
    top: 0; left: 0;
    height: 100vh !important;
    width: 260px !important;
    min-width: 260px !important;
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(.4,0,.2,1) !important;
    z-index: 3000;
  }
  .sidebar-container.open { transform: translateX(0) !important; }
  .sidebar-container.closed {
    width: 260px !important; min-width: 260px !important;
    transform: translateX(-100%);
  }
  .sidebar-container.closed.open { transform: translateX(0) !important; }
  .sidebar-container.closed { padding: 12px 8px !important; align-items: stretch !important; }
  .sidebar-container.closed .sidebar-top { flex-direction: row !important; padding: 4px 6px 12px !important; align-items: center !important; gap: 10px !important; }
  .sidebar-container.closed .sidebar-brand,
  .sidebar-container.closed .nav-label,
  .sidebar-container.closed .sidebar-divider,
  .sidebar-container.closed .office-status { display: revert !important; }
  .sidebar-container.closed a { justify-content: flex-start !important; padding: 9px 10px !important; }
  .sidebar-container.closed .signout { justify-content: flex-start !important; }
  .sidebar-container.closed a[data-tip]::after { display: none; }

  .content { height: auto !important; padding: 68px 12px 24px !important; }

  /* db-wrap tighter on mobile */
  .db-wrap { gap: 10px !important; }

  /* Shift banner stacks vertically on mobile */
  .db-shift-banner {
    grid-template-columns: 1fr !important;
    padding: 16px !important;
    gap: 16px !important;
  }
  .db-shift-banner .shift-card {
    max-width: 100% !important;
    min-width: 0 !important;
  }
  .db-shift-banner .shift-live-time { font-size: 18px !important; }

  /* KPI grid 2-col on mobile */
  .db-kpis { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  .db-kpi-val { font-size: 20px !important; }
  .db-kpi-icon { width: 38px !important; height: 38px !important; }
  .db-panel { padding: 14px !important; }

  /* Leave form stacks */
  .leave-grid { grid-template-columns: 1fr !important; }
  .form-row { flex-direction: column !important; }
  .form-row input, .form-row select { min-width: 0 !important; width: 100% !important; }

  /* Legacy header row */
  .header-row { flex-direction: column; align-items: flex-start; }
  .profile-card { width: 100%; max-width: none !important; }

  /* Legacy stat cards */
  .cards { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  .card { padding: 14px 12px !important; }
  .card h2 { font-size: 22px !important; }
}

@media (max-width: 480px) {
  .cards { grid-template-columns: repeat(2, 1fr) !important; }
  #routeCards { grid-template-columns: 1fr !important; }
  .db-row-2col { grid-template-columns: 1fr !important; }
  .db-row-3col { grid-template-columns: 1fr !important; }

  /* Buttons full-width on very small screens */
  .shift-card .clock-btn { padding: 14px !important; font-size: 15px !important; }

  /* Modals full-screen on small phones */
  .modal-content, .modal-card, .confirm-modal-card {
    width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    max-height: 92dvh !important;
  }
}

@media (max-width: 360px) {
  .cards { grid-template-columns: 1fr !important; }
  .db-kpis { grid-template-columns: 1fr 1fr !important; }
  .content { padding: 64px 10px 20px !important; }
}

/* ─────────────────────────────────────────────
   5. BUTTONS
   Canonical set — use class combinations: btn primary / btn gray / btn danger
   BACKEND MIGRATION: maps to <Button variant="primary|gray|danger"> in React
   ───────────────────────────────────────────── */
.btn {
  border: none;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  transition: opacity 0.15s, transform 0.12s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: linear-gradient(135deg, #3b1454, #2d0f40); color: #fff; box-shadow: 0 4px 14px rgba(45,15,64,0.28); }
.btn.primary:hover { box-shadow: 0 6px 20px rgba(45,15,64,0.38); }
.btn.gray { background: #e0e0e0; color: #222; }
.btn.danger { background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff; box-shadow: 0 4px 14px rgba(185,28,28,0.25); }
.btn.danger:hover { box-shadow: 0 6px 20px rgba(185,28,28,0.35); }
.btn.green { background: linear-gradient(135deg, #2e7d32, #1b5e20); color: #fff; }
.btn.outline { background: transparent; border: 1.5px solid rgba(59,20,84,0.35); color: #3b1454; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ─────────────────────────────────────────────
   6. MODAL SYSTEM
   All modals use .modal > .confirm-modal-card or .modal-card
   BACKEND MIGRATION: maps to <Modal> component in React
   ───────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,10,25,0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  justify-content: center;
  align-items: center;
  z-index: 5000;
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;
}
/* Open state: use .open class (reliable) + style= fallback (legacy) */
.modal.open { display: flex; }
.modal[style*="display: flex"],
.modal[style*="display:flex"] { display: flex !important; }

@media (max-width: 600px) { .modal { align-items: flex-start; padding: 10px; } }

.modal-content, .modal-card, .confirm-modal-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15,10,25,0.22);
  width: min(480px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
  border: 1px solid rgba(15,23,42,0.08);
  position: relative;
  pointer-events: auto;
}
.modal-card { width: min(560px, 100%); }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 16px 20px;
  border-bottom: 1px solid rgba(15,23,42,0.08);
  background: #faf8fd; border-radius: 18px 18px 0 0;
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 700; color: #0f172a; }
.modal-body, .confirm-body { padding: 18px 20px 20px; }
.modal-body > p, .confirm-body > p, .confirm-message { font-size: 14px; color: #556070; margin: 0 0 16px 0; line-height: 1.6; }

.modal-close, .modal-x {
  width: 30px; height: 30px; border: none; border-radius: 8px;
  background: rgba(15,23,42,0.07); color: #556070;
  font-size: 14px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s, color 0.15s;
  position: static; padding: 0;
}
.modal-close:hover, .modal-x:hover { background: rgba(220,38,38,0.12); color: #dc2626; }

.modal-actions, .confirm-actions, .modal-buttons {
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px;
}

.confirm-btn {
  border: none !important;
  background: linear-gradient(135deg, #3b1454, #2d0f40) !important;
  color: #fff !important; padding: 10px 18px !important; border-radius: 12px !important;
  font-size: 13px !important; font-weight: 700 !important; cursor: pointer;
  box-shadow: 0 4px 14px rgba(45,15,64,0.28) !important;
  transition: box-shadow 0.15s, transform 0.12s;
}
.confirm-btn:hover { box-shadow: 0 6px 20px rgba(45,15,64,0.38) !important; transform: translateY(-1px); }
.confirm-btn.danger-confirm {
  background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
  box-shadow: 0 4px 14px rgba(185,28,28,0.25) !important;
}
.confirm-btn.danger-confirm:hover { box-shadow: 0 6px 20px rgba(185,28,28,0.35) !important; }
.cancel-btn {
  border: 1px solid rgba(15,23,42,0.12) !important;
  background: rgba(15,23,42,0.06) !important; color: #0f172a !important;
  padding: 10px 18px !important; border-radius: 12px !important;
  font-size: 13px !important; font-weight: 600 !important; cursor: pointer;
}
.cancel-btn:hover { background: rgba(15,23,42,0.12) !important; transform: translateY(-1px); }

.pass-row { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 14px; }
.pass-row label { font-size: 12px; font-weight: 700; color: #556070; }
.pass-row input {
  padding: 10px 12px; border-radius: 10px;
  border: 1.5px solid #e2dce9; font-size: 14px; background: #faf8fd; outline: none;
}
.pass-row input:focus { border-color: rgba(111,59,162,.65); box-shadow: 0 0 0 4px rgba(111,59,162,.12); }

/* ─────────────────────────────────────────────
   7. CARDS + KPI GRID
   BACKEND MIGRATION: maps to <StatCard> component
   ───────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 0;
}
.card {
  min-width: 0;
  width: auto !important;
  padding: 18px 16px;
  border-radius: 14px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.05);
  background: white;
}
.card h3 { margin: 0; font-size: 12px; color: #666; font-weight: 600; line-height: 1.3; }
.card h4 { margin: 0 0 8px; font-size: 12px; color: #555; font-weight: 600; line-height: 1.3; }
.card h2 { margin: 10px 0 0; font-size: 26px; font-weight: 800; color: #111827; line-height: 1; }

.panel {
  background: white; border-radius: 14px;
  box-shadow: 0 10px 22px rgba(0,0,0,0.06); padding: 16px;
}
.panel h3 { margin: 0 0 12px; font-size: 14px; color: #222; }
.panel-sub { margin: -6px 0 12px; font-size: 12px; color: #666; }

.progress-wrap { margin-top: 10px; }
.progress-bar { height: 10px; background: #eaecef; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: #3b1454; border-radius: 999px; transition: width 0.25s ease; }
.progress-text { margin-top: 8px; font-size: 12px; color: #555; display: flex; justify-content: space-between; }

/* ─────────────────────────────────────────────
   8. PROFILE CARD + STATUS PILL
   BACKEND MIGRATION: maps to <ProfileCard> component
   ───────────────────────────────────────────── */
.header-row {
  display: flex; gap: 18px; align-items: stretch;
  justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px;
}
.greeting { min-width: 280px; }
.greeting h1 { margin: 0; font-size: 28px; color: #1f1f1f; }
.greeting p { margin: 6px 0 0; color: #444; }

.profile-card {
  min-width: 280px; flex: 1; max-width: 420px;
  background: white; border-radius: 14px;
  box-shadow: 0 10px 22px rgba(0,0,0,0.06);
  padding: 14px; display: flex; gap: 12px; align-items: center;
}
.profile-card img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.profile-meta { flex: 1; }
.profile-meta .name { font-weight: bold; color: #222; font-size: 14px; margin: 0; }
.profile-meta .role { margin: 4px 0 0; font-size: 12px; color: #666; }

.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 8px; padding: 6px 10px;
  border-radius: 999px; font-size: 12px; font-weight: bold;
  width: fit-content; background: #f3f4f6; color: #333;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: #d32f2f; }
.status-on { background: #e8f5e9; color: #2e7d32; }
.status-on .dot { background: #2e7d32; }
.status-off { background: #ffebee; color: #c62828; }
.status-off .dot { background: #c62828; }

/* ─────────────────────────────────────────────
   9. PILL + BADGE UTILITIES
   ───────────────────────────────────────────── */
.pill {
  display: inline-block; padding: 4px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 700;
  background: #ede7f6; color: #3b1454;
}
.pill.gray { background: #eceff1; color: #546e7a; }
.pill.green { background: #e8f5e9; color: #2e7d32; }
.pill.orange { background: #fff3e0; color: #ef6c00; }
.pill.red { background: #ffebee; color: #c62828; }
.pill.blue { background: #e3f2fd; color: #1565c0; }

.badge {
  font-size: 12px; font-weight: bold;
  padding: 6px 10px; border-radius: 999px;
  background: #ede7f6; color: #3b1454;
}

/* ─────────────────────────────────────────────
   10. LEAVE TAB
   Shared across area-manager, office-staff, regional, national
   BACKEND MIGRATION: maps to <LeaveTab> component
   ───────────────────────────────────────────── */
.leave-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px; margin-bottom: 16px;
}
.form-row {
  display: flex; flex-wrap: wrap;
  gap: 10px; margin-bottom: 12px;
}
.form-row input, .form-row select {
  flex: 1; min-width: 140px;
  padding: 10px 13px;
  border: 1.5px solid rgba(15,23,42,.12);
  border-radius: 12px; font-size: 13px;
  background: #faf8fd; outline: none; color: #0f172a;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.form-row input:focus, .form-row select:focus {
  border-color: rgba(111,59,162,.6);
  box-shadow: 0 0 0 4px rgba(111,59,162,.1);
}
.leave-list { display: flex; flex-direction: column; gap: 8px; }
.leave-item {
  padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid rgba(15,23,42,.09);
  background: #faf8fd; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.leave-item:hover { border-color: rgba(111,59,162,.35); box-shadow: 0 2px 10px rgba(111,59,162,.08); }
.leave-item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.leave-item-title { font-size: 13px; font-weight: 700; color: #0f172a; margin-bottom: 4px; line-height: 1.3; }
.leave-item-meta { font-size: 12px; color: #7a8694; line-height: 1.6; }
.leave-status {
  flex-shrink: 0; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  background: #fef9c3; color: #92400e; white-space: nowrap;
}
.leave-status.approved { background: #e8f5e9; color: #2e7d32; }
.leave-status.denied { background: #ffebee; color: #c62828; }

/* Leave detail panel */
.leave-detail-box {
  padding: 14px; border-radius: 12px;
  border: 1.5px solid rgba(15,23,42,.09);
  background: #fff; font-size: 13px; color: #556070;
}
.leave-detail-box h4 { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: #0f172a; }
.leave-detail-row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.leave-detail-row b { color: #0f172a; }

/* ─────────────────────────────────────────────
   11. CLOCK BUTTON
   ───────────────────────────────────────────── */
.clock-btn {
  padding: 18px 45px; border: none; border-radius: 16px;
  cursor: pointer; font-weight: bold; font-size: 18px;
  transition: 0.2s; margin-top: 25px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.15);
}
.clock-in { background: linear-gradient(135deg, #2e7d32, #1b5e20); color: white; }
.clock-out { background: linear-gradient(135deg, #c62828, #8e0000); color: white; }
.clock-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 35px rgba(0,0,0,0.2); }
.clock-btn:active { transform: translateY(0); }

/* ─────────────────────────────────────────────
   12. MISC UTILITIES
   ───────────────────────────────────────────── */
.muted { color: #666; }
.small { font-size: 12px; color: #666; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 22px; }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.event { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: #f7f7fb; border: 1px solid #eee; }
.event-time { font-weight: bold; font-size: 12px; color: #3b1454; min-width: 62px; }
.event-text { font-size: 12px; color: #333; }

/* System alert badge */
.alert-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: #ef4444; color: white;
  border-radius: 999px; font-size: 12px; font-weight: 800;
  min-width: 18px; height: 18px; padding: 0 5px;
  position: absolute; top: -4px; right: -4px;
}

/* ── DESIGN TOKENS (merged from unified patch) ─────────────── */
:root {
  --pp-brand-900: #2d0f40;
  --pp-brand-800: #3b1454;
  --pp-brand-600: #6f3ba2;
  --pp-surface:   #ffffff;
  --pp-bg:        #f4f6f9;
  --pp-text:      #111827;
  --pp-muted:     #667085;
  --pp-border:    rgba(17,24,39,0.08);
  --pp-radius:    16px;
  --pp-shadow:    0 10px 24px rgba(0,0,0,0.06);

  /* Purple palette — 3 shades only */
  --pp-purple-mid:  #9b5de5;   /* accent / hover */
  --pp-tint:        #f0ebf8;   /* light background tint */
  --pp-tint-border: #e4d9f5;   /* tint border / input focus ring */

  /* Radius scale */
  --r-sm:   10px;
  --r-md:   14px;
  --r-lg:   20px;
  --r-pill: 999px;

  /* Shadow scale */
  --shadow-card:     0 2px 8px rgba(0,0,0,0.06);
  --shadow-elevated: 0 8px 24px rgba(0,0,0,0.10);
  --shadow-modal:    0 24px 60px rgba(15,10,25,0.20);
}

body.pp-unified-ui {
  background: var(--pp-bg);
  color: var(--pp-text);
  -webkit-font-smoothing: antialiased;
}
body.pp-unified-ui .card,
body.pp-unified-ui .panel,
body.pp-unified-ui .profile-card {
  border-radius: var(--pp-radius);
  box-shadow: var(--pp-shadow);
  border: 1px solid var(--pp-border);
}
body.pp-unified-ui input,
body.pp-unified-ui select,
body.pp-unified-ui textarea { border-radius: 12px; }
body.pp-unified-ui .btn.primary { background: var(--pp-brand-900); color: #fff; }
body.pp-unified-ui .btn.danger  { background: #ff4d4d; color: #fff; }
body.pp-unified-ui .btn.gray    { background: #eef2f6; color: #111827; }
body.pp-unified-ui .btn.success { background: #18b26a; color: #fff; }

/* ─────────────────────────────────────────────
   14. SHARED TOPBAR
   Used identically across all role dashboards.
   BACKEND MIGRATION: maps to <Topbar> component
   ───────────────────────────────────────────── */
.topbar {
  height: 60px;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 28px;
  box-shadow: 0 1px 0 rgba(15,23,42,0.08);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}

/* Left side: page title */
.topbar-title {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right side: name + avatar */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.topbar-right span {
  font-size: 13px;
  font-weight: 500;
  color: #556070;
  white-space: nowrap;
}
.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #6f3ba2;
  overflow: hidden;
}

/* ─────────────────────────────────────────────
   15. SHARED DASHBOARD GRID  (db-wrap system)
   Shift card is always Row 1 — full-width banner.
   Greeting is embedded inside it, no separate header row needed.
   Used across all role dashboards.
   Regional already uses this; area-manager and
   office-staff are migrated to it for consistency.
   ───────────────────────────────────────────── */
.db-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Row 1: Shift banner — full width, greeting + shift side by side ── */
.db-shift-banner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(15,23,42,.07);
  box-shadow: 0 4px 14px rgba(0,0,0,.05);
  padding: 20px 24px;
}
.db-shift-banner .db-greeting { min-width: 0; }
.db-shift-banner .db-welcome {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 2px;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-shift-banner .db-date {
  font-size: 12px;
  color: #8fa0b0;
  margin: 0;
}
/* Shift card inside the banner — no background, no shadow, no border */
.db-shift-banner .shift-card {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
  min-width: 280px;
  max-width: 320px;
}
.db-shift-banner .shift-live-time { font-size: 20px; margin-bottom: 1px; }
.db-shift-banner .shift-live-date { margin-bottom: 8px; }
.db-shift-banner .shift-duration-row { margin-bottom: 8px; }
.db-shift-banner .shift-card .clock-btn { margin-top: 10px; padding: 10px; font-size: 13px; }

/* Legacy db-header kept for regional (has pending alert block beside it) */
.db-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}
.db-welcome {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 2px;
  letter-spacing: -.02em;
}
.db-date {
  font-size: 13px;
  color: #667085;
  margin: 0;
}

/* KPI stat cards row */
.db-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.db-kpi-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(15,23,42,.07);
  padding: 18px 20px;
  box-shadow: 0 4px 14px rgba(0,0,0,.05);
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.db-kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.db-kpi-val {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
}
.db-kpi-lbl {
  font-size: 12px;
  color: #667085;
  margin-top: 3px;
  font-weight: 500;
}

/* Generic panel card */
.db-panel {
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(15,23,42,.07);
  padding: 20px;
  box-shadow: 0 4px 14px rgba(0,0,0,.05);
  min-width: 0;
}
.db-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 4px;
  letter-spacing: -.01em;
  text-transform: uppercase;
  letter-spacing: .04em;
  opacity: .7;
}
.db-panel .sub {
  font-size: 12px;
  color: #8fa0b0;
  margin: 0 0 12px;
}

/* Shift card sits in its own full-width row */
.db-row-shift {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 14px;
  align-items: start;
}

/* Two equal columns */
.db-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

/* Three equal columns */
.db-row-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  align-items: start;
}

/* Responsive */
@media (max-width: 900px) {
  .db-kpis           { grid-template-columns: repeat(2, 1fr); }
  .db-row-shift      { grid-template-columns: 1fr; }
  .db-row-2col       { grid-template-columns: 1fr; }
  .db-row-3col       { grid-template-columns: 1fr 1fr; }
  .db-shift-banner   { grid-template-columns: 1fr; }
  .db-shift-banner .shift-card { max-width: 100%; min-width: 0; }
}
@media (max-width: 560px) {
  .db-kpis      { grid-template-columns: 1fr 1fr; }
  .db-row-3col  { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────
   13. SHARED SHIFT STATUS CARD
   Used identically across area-manager, office-staff,
   regional-manager, and national-manager dashboards.
   BACKEND MIGRATION: maps to <ShiftCard> component
   ───────────────────────────────────────────── */
.shift-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(15,23,42,.08);
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.shift-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}
.shift-card-header h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: #556070;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Live wall-clock time */
.shift-live-time {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -.03em;
  line-height: 1;
  margin-bottom: 2px;
}
.shift-live-date {
  font-size: 12px;
  color: #8fa0b0;
  margin-bottom: 14px;
}

/* Duration row */
.shift-duration-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 14px;
}
.shift-duration-label {
  font-size: 12px;
  font-weight: 700;
  color: #8fa0b0;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.shift-duration-val {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -.02em;
}

/* Status pill row */
.shift-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.shift-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
  transition: background .2s;
}
.shift-status-dot.on  { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.shift-status-dot.off { background: #cbd5e1; }
.shift-status-label {
  font-size: 13px;
  font-weight: 700;
  color: #556070;
  transition: color .2s;
}
.shift-status-label.on  { color: #16a34a; }
.shift-status-label.off { color: #94a3b8; }

/* Clock button — full width inside the card */
.shift-card .clock-btn {
  width: 100%;
  padding: 13px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  margin-top: auto;
}
.shift-card .clock-btn.clock-in {
  background: linear-gradient(135deg, #2e7d32, #1b5e20);
  color: #fff;
  box-shadow: 0 4px 14px rgba(46,125,50,.30);
}
.shift-card .clock-btn.clock-out {
  background: linear-gradient(135deg, #c62828, #8e0000);
  color: #fff;
  box-shadow: 0 4px 14px rgba(198,40,40,.28);
}
.shift-card .clock-btn:hover  { transform: translateY(-1px); }
.shift-card .clock-btn:active { transform: scale(.97); }

/*
 * ══════════════════════════════════════════════════════════════════
 *  END OF shared.css — Do not add role-specific styles here.
 * ══════════════════════════════════════════════════════════════════
 */

/* ─────────────────────────────────────────────
   16. LOADING SPINNER & BUTTON LOADING STATE
   ───────────────────────────────────────────── */
@keyframes pp-spin {
  to { transform: rotate(360deg); }
}
.pp-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: pp-spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
  flex-shrink: 0;
}
.btn-loading {
  opacity: 0.78;
  pointer-events: none;
  cursor: not-allowed;
}
.clock-btn.btn-loading {
  opacity: 0.7;
  pointer-events: none;
}
.btn-ci.btn-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ── Table sort indicators ── */
th[data-sortcol] { cursor: pointer; user-select: none; }
th[data-sortcol]:hover { background: #f0ebf8; color: #6f3ba2; }
th[data-sortcol]::after { content: ' ⇅'; opacity: 0.35; font-size: 12px; }
th[data-sortdir="asc"]::after  { content: ' ↑'; opacity: 0.8; color: #6f3ba2; }
th[data-sortdir="desc"]::after { content: ' ↓'; opacity: 0.8; color: #6f3ba2; }

/* ─────────────────────────────────────────────
   17. PRINT STYLES
   Hides nav/sidebar, renders tables cleanly.
   Use: window.print() on reports section.
   ───────────────────────────────────────────── */
@media print {
  /* ── Hide all UI chrome ── */
  .sidebar-container,
  .mobile-topbar,
  .topbar,
  .btn,
  .modal,
  #pp-toast-container,
  [data-tip],
  .signout,
  .notif-bell-wrap,
  .section:not(.active),
  .view:not(.active),
  #reportFilterBar,
  #reportPaginationTop,
  #reportPaginationBot,
  .section-header .btn,
  .section-header button { display: none !important; }

  /* ── Full-width layout ── */
  html, body {
    background: white !important;
    font-size: 12px !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  .main {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  .content {
    margin: 0 !important;
    padding: 8px !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    display: block !important;
  }

  /* ── Show ALL sections when printing ── */
  .section {
    display: block !important;
    page-break-after: always;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  .section.active { page-break-after: auto; }

  /* ── Table fixes ── */
  .table-wrap {
    overflow: visible !important;
    width: 100% !important;
  }

  table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 12px !important;
    table-layout: fixed !important;
  }

  th, td {
    border: 1px solid #ccc !important;
    padding: 4px 6px !important;
    word-wrap: break-word !important;
    overflow: visible !important;
  }

  th {
    background: #f0f0f0 !important;
    color: black !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* ── Coverage area table ── */
  #areaList .table-wrap,
  #areaList table {
    overflow: visible !important;
    width: 100% !important;
  }

  #areaList td, #areaList th {
    white-space: normal !important;
    word-break: break-word !important;
  }

  /* ── Coverage sector/area cards ── */
  #areaList > div {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    margin-bottom: 8px !important;
    page-break-inside: avoid;
  }

  /* ── Chips and badges ── */
  span[style*="border-radius:999px"],
  span[style*="border-radius: 999px"] {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* ── Remove shadows/backgrounds ── */
  .db-wrap, .db-panel, .db-kpi-card, .shift-card, .panel {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }

  a { text-decoration: none !important; color: black !important; }

  /* ── Page setup ── */
  @page {
    margin: 1cm 1.2cm;
    size: landscape;
  }

  /* ── Page break helpers ── */
  tr { page-break-inside: avoid; }
  thead { display: table-header-group; }
  tfoot { display: table-footer-group; }
}

/* ── Notification Bell ── */
.notif-bell-wrap {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  transition: background .15s;
  flex-shrink: 0;
}
.notif-bell-wrap:hover { background: rgba(255,255,255,0.12); }
.notif-bell-wrap svg { color: rgba(255,255,255,0.85); }

#notifBadge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  border: 1.5px solid var(--pp-brand-900, #3b1454);
}

#notifPanel {
  position: fixed;
  top: 56px;
  right: 12px;
  width: min(360px, 94vw);
  max-height: 420px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,.1);
  box-shadow: 0 12px 36px rgba(0,0,0,.14);
  overflow-y: auto;
  z-index: 9999;
  display: none;
}
#notifPanel .notif-header {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  border-bottom: 1px solid rgba(15,23,42,.07);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}