/* ============================================================================
   ShiftPulse — Premium Design System
   Built and operated by CISO Consulting (ciso.sa)
   Light + Dark + Auto themes | RTL support | Bilingual EN/AR
   ============================================================================ */

/* ---------------- Design Tokens ---------------- */
:root {
  /* Brand */
  --brand-navy:   #0B2545;
  --brand-deep:   #13315C;
  --brand-mid:    #284B6E;
  --brand-gold:   #D4A537;
  --brand-gold-soft: #E8C97A;

  /* Semantic */
  --success: #10B981;
  --warning: #F59E0B;
  --danger:  #EF4444;
  --info:    #3B82F6;

  /* Light theme (default) */
  --bg:           #F7F8FB;
  --bg-elev-1:    #FFFFFF;
  --bg-elev-2:    #FFFFFF;
  --bg-subtle:    #F1F3F8;
  --bg-hover:    rgba(11, 37, 69, 0.07);
  --bg-active:   rgba(11, 37, 69, 0.12);
  --border:       #E5E8EE;
  --border-strong:#CFD4DD;
  --text:         #111827;
  --text-muted:   #6B7280;
  --text-subtle:  #9CA3AF;
  --text-inverse: #FFFFFF;

  --primary:        var(--brand-navy);
  --primary-hover:  var(--brand-deep);
  --primary-soft:   rgba(11, 37, 69, 0.08);
  --primary-text:   #FFFFFF;
  --accent:         var(--brand-gold);
  --accent-hover:   #C09525;

  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.10), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 12px 32px -4px rgba(15, 23, 42, 0.14), 0 4px 8px -4px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 24px 48px -12px rgba(15, 23, 42, 0.18);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  --font-sans:  'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-arabic:'Cairo', 'IBM Plex Arabic', 'Noto Sans Arabic', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', ui-monospace, Menlo, monospace;

  --tx-fast:   140ms cubic-bezier(0.4, 0, 0.2, 1);
  --tx-base:   220ms cubic-bezier(0.4, 0, 0.2, 1);
  --tx-slow:   360ms cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-w: 264px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 64px;
}

/* ---------------- Dark theme ---------------- */
:root[data-theme="dark"] {
  --bg:           #0A0E1A;
  --bg-elev-1:    #131826;
  --bg-elev-2:    #1A2034;
  --bg-subtle:    #0F1422;
  --bg-hover:     rgba(255, 255, 255, 0.04);
  --bg-active:    rgba(255, 255, 255, 0.08);
  --border:       #232A3D;
  --border-strong:#2E3651;
  --text:         #E8EAF0;
  --text-muted:   #9BA3B5;
  --text-subtle:  #6B7388;
  --text-inverse: #0A0E1A;

  --primary:        #5B8DEF;
  --primary-hover:  #7BA5F2;
  --primary-soft:   rgba(91, 141, 239, 0.14);
  --primary-text:   #FFFFFF;
  --accent:         var(--brand-gold-soft);
  --accent-hover:   var(--brand-gold);

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.5), 0 1px 2px -1px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px -4px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 24px 48px -12px rgba(0, 0, 0, 0.7);
}

/* Auto: follow system */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg:           #0A0E1A;
    --bg-elev-1:    #131826;
    --bg-elev-2:    #1A2034;
    --bg-subtle:    #0F1422;
    --bg-hover:     rgba(255, 255, 255, 0.04);
    --bg-active:    rgba(255, 255, 255, 0.08);
    --border:       #232A3D;
    --border-strong:#2E3651;
    --text:         #E8EAF0;
    --text-muted:   #9BA3B5;
    --text-subtle:  #6B7388;
    --text-inverse: #0A0E1A;
    --primary:        #5B8DEF;
    --primary-hover:  #7BA5F2;
    --primary-soft:   rgba(91, 141, 239, 0.14);
    --accent:         var(--brand-gold-soft);
    --accent-hover:   var(--brand-gold);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.5), 0 1px 2px -1px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px -4px rgba(0, 0, 0, 0.6);
  }
}

/* ---------------- Reset / Base ---------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
  transition: background var(--tx-base), color var(--tx-base);
  min-height: 100vh;
}
html[dir="rtl"] body { font-family: var(--font-arabic); }

a { color: var(--primary); text-decoration: none; transition: color var(--tx-fast); }
a:hover { color: var(--primary-hover); }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

::selection { background: var(--primary-soft); color: var(--text); }

/* ---------------- Layout ---------------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns var(--tx-base);
}
.app-shell[data-sidebar="collapsed"] { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); position: fixed; z-index: 50; }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar[data-mobile="open"] { transform: translateX(0); }
}

/* ---------------- Sidebar ---------------- */
.sidebar {
  background: var(--bg-elev-1);
  border-inline-end: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
  transition: background var(--tx-base);
}
.sidebar-brand {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
}
.sidebar-brand .logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-mid));
  display: grid;
  place-items: center;
  color: var(--brand-gold);
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(11, 37, 69, 0.25);
}
.sidebar-brand .name {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-brand .tag {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.nav-section {
  padding: 12px 12px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  font-weight: 600;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--tx-fast);
  margin-bottom: 2px;
  position: relative;
}
.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
html[dir="rtl"] .nav-link.active::before { border-radius: 3px 0 0 3px; }

.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link .label { white-space: nowrap; overflow: hidden; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-footer .user-chip {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--tx-fast);
  cursor: pointer;
  min-width: 0;
}
.sidebar-footer .user-chip:hover { background: var(--bg-hover); }
.sidebar-footer .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-mid));
  color: white;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.sidebar-footer .user-info { min-width: 0; flex: 1; }
.sidebar-footer .user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-footer .user-role {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------- Main column ---------------- */
.main-col { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h);
  background: var(--bg-elev-1);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  background: color-mix(in oklab, var(--bg-elev-1) 92%, transparent);
}
.topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  padding: 9px 14px 9px 40px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: all var(--tx-fast);
}
html[dir="rtl"] .topbar-search input { padding: 9px 40px 9px 14px; }
.topbar-search input::placeholder { color: var(--text-subtle); }
.topbar-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-elev-1);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.topbar-search svg {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-subtle);
  pointer-events: none;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  transition: all var(--tx-fast);
  position: relative;
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .badge {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  background: var(--danger);
  color: white;
  border-radius: 10px;
  min-width: 16px;
  height: 16px;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

.content {
  padding: 28px 32px;
  flex: 1;
  width: 100%;
  margin: 0 auto;
}
@media (max-width: 768px) { .content { padding: 18px; } }

/* ---------------- Page header ---------------- */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.page-header .subtitle {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------------- Cards ---------------- */
.card {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: box-shadow var(--tx-fast), border-color var(--tx-fast);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text); margin: 0; }
.card-body { padding: 20px 22px; }

/* KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.kpi {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: all var(--tx-base);
}
.kpi::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, var(--primary-soft) 100%);
  opacity: 0;
  transition: opacity var(--tx-base);
}
.kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.kpi:hover::before { opacity: 1; }
.kpi > * { position: relative; z-index: 1; }
.kpi .label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}
.kpi .value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 8px 0 4px;
  line-height: 1;
}
.kpi .delta {
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  margin-top: 4px;
}
.kpi .delta.up   { color: var(--success); background: rgba(16, 185, 129, 0.12); }
.kpi .delta.down { color: var(--danger);  background: rgba(239, 68, 68, 0.12); }
.kpi .icon-wrap {
  position: absolute;
  inset-inline-end: 18px;
  top: 18px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
}
.kpi .icon-wrap svg { width: 20px; height: 20px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--tx-fast);
  white-space: nowrap;
  line-height: 1.2;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--bg-elev-1);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover:not(:disabled) { background: #DC2626; }
.btn svg { width: 16px; height: 16px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }

/* ---------------- Forms ---------------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.field .error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev-1);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: all var(--tx-fast);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input::placeholder { color: var(--text-subtle); }
.input-group { position: relative; }
.input-group .input-icon {
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-subtle);
  pointer-events: none;
}
.input-group input { padding-inline-start: 40px; }
.input-toggle {
  position: absolute;
  inset-inline-end: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--tx-fast);
}
.input-toggle:hover { background: var(--bg-hover); color: var(--text); }
.input-toggle svg { width: 16px; height: 16px; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  user-select: none;
  cursor: pointer;
}
.checkbox-row input { accent-color: var(--primary); }

/* ---------------- Tables ---------------- */
.table-wrap {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table thead th {
  text-align: start;
  padding: 14px 18px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}
.table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--bg-hover); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-success { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.14); color: var(--warning); }
.badge-danger  { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.badge-info    { background: rgba(59, 130, 246, 0.12); color: var(--info); }
.badge-neutral { background: var(--bg-subtle); color: var(--text-muted); }

.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-inline-end: 6px;
}

/* ---------------- Auth Layout (Login Page) ---------------- */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
@media (max-width: 1024px) { .auth-page { grid-template-columns: 1fr; } }

.auth-pane {
  display: flex;
  flex-direction: column;
  padding: 48px;
  position: relative;
}
.auth-pane.left {
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-deep) 50%, var(--brand-mid) 100%);
  color: #fff;
  overflow: hidden;
}
@media (max-width: 1024px) { .auth-pane.left { display: none; } }
.auth-pane.left::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(212, 165, 55, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(91, 141, 239, 0.12) 0%, transparent 50%);
  pointer-events: none;
}
.auth-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
}
.auth-brand .logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(212, 165, 55, 0.18);
  border: 1px solid rgba(212, 165, 55, 0.4);
  display: grid;
  place-items: center;
  color: var(--brand-gold);
  font-weight: 800;
  font-size: 18px;
}
.auth-brand .name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.auth-pane.left .hero {
  position: relative;
  z-index: 1;
  margin-top: auto;
  margin-bottom: auto;
  max-width: 480px;
}
.auth-pane.left .hero h2 {
  font-size: 38px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
}
.auth-pane.left .hero p {
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.78);
  margin: 0;
}
.auth-pane.left .features {
  position: relative;
  z-index: 1;
  margin-top: 32px;
  display: grid;
  gap: 14px;
}
.auth-pane.left .feature {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
}
.auth-pane.left .feature .check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(212, 165, 55, 0.2);
  display: grid;
  place-items: center;
  color: var(--brand-gold);
  flex-shrink: 0;
  margin-top: 1px;
}
.auth-pane.left .feature .check svg { width: 12px; height: 12px; }
.auth-footer-mark {
  position: relative;
  z-index: 1;
  margin-top: auto;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
}

.auth-pane.right {
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  width: 100%;
  max-width: 420px;
}
.auth-card h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  color: var(--text);
}
.auth-card .lead {
  color: var(--text-muted);
  margin: 0 0 32px;
  font-size: 15px;
}
.auth-card form { display: grid; gap: 4px; }
.auth-card .alert {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.auth-card .alert svg { flex-shrink: 0; margin-top: 1px; }
.auth-card .row-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.auth-card .submit { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.auth-card .footer-line {
  margin-top: 28px;
  text-align: center;
  font-size: 12px;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.auth-card .footer-line svg { width: 14px; height: 14px; }
.auth-toolbar {
  position: absolute;
  top: 24px;
  inset-inline-end: 24px;
  display: flex;
  gap: 6px;
  z-index: 2;
}

/* ---------------- Theme switcher dropdown ---------------- */
.menu {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 30;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: all var(--tx-fast);
}
.menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background var(--tx-fast);
  width: 100%;
  background: transparent;
  border: 0;
  text-align: start;
}
.menu-item:hover { background: var(--bg-hover); }
.menu-item.active { color: var(--primary); font-weight: 600; }
.menu-item svg { width: 16px; height: 16px; }
.menu-divider { height: 1px; background: var(--border); margin: 4px 0; }
.menu-label {
  padding: 8px 14px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  font-weight: 600;
}
.relative { position: relative; }

/* ---------------- Toast / Flash ---------------- */
.flash {
  position: fixed;
  top: 24px;
  inset-inline-end: 24px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--success);
  padding: 14px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  min-width: 300px;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideIn 0.3s ease-out;
}
.flash.error { border-inline-start-color: var(--danger); }
.flash.warn  { border-inline-start-color: var(--warning); }
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------------- Utility ---------------- */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.w-full { width: 100%; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1024px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid-3 { grid-template-columns: 1fr; } }

/* RTL adjustments */
html[dir="rtl"] { font-feature-settings: 'liga'; }
html[dir="rtl"] .nav-link svg,
html[dir="rtl"] .icon-btn svg { transform: scaleX(1); }

/* Print */
@media print {
  .sidebar, .topbar { display: none; }
  .content { padding: 0; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* Focus visibility */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ============================================================================
   Phase 1 — Employees Module Components
   ============================================================================ */

/* Form sections */
.grid-form { display: grid; gap: 20px; }
.form-section {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* Phase 89: full-width override — many views had inline max-width:840px or
     max-width:720px on .form-section / .form-actions / .grid-form because
     a previous design wanted narrow forms. The current design lets the
     content area (`.content` already width:100%) breathe edge-to-edge.
     !important defeats the inline styles without touching every file. */
  width: 100% !important;
  max-width: none !important;
}
.form-section-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}
.form-section-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.form-section-icon svg { width: 20px; height: 20px; }
.form-section-head h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.form-section-head p { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); }
.form-section-body { padding: 22px; }
.form-subhead {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  margin: 18px 0 10px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  width: 100% !important;
  max-width: none !important;
}

/* Phase 89: full-width override for .grid-form too (used by user/location/
   employee admin forms). The inline max-width:840px was forcing forms to
   sit centered with whitespace on either side — now they fill the column. */
.grid-form {
  width: 100% !important;
  max-width: none !important;
}

/* Avatar uploader */
.avatar-uploader {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
}
.avatar-preview, .avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.avatar-placeholder {
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-mid));
  color: var(--brand-gold);
  display: grid;
  place-items: center;
}

/* Alert banners */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-radius: var(--radius);
  margin-bottom: 22px;
  font-size: 14px;
}
.alert-banner.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--warning);
}
.alert-banner.alert-danger {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}
.alert-banner svg { flex-shrink: 0; }

/* Profile page */
.profile-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
}
@media (max-width: 1024px) { .profile-grid { grid-template-columns: 1fr; } }

.profile-card {
  position: sticky;
  top: 88px;
  overflow: hidden;
}
.profile-cover {
  height: 80px;
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-deep), var(--brand-mid));
  position: relative;
}
.profile-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 70% 30%, rgba(212, 165, 55, 0.2) 0%, transparent 60%),
    radial-gradient(circle at 20% 80%, rgba(91, 141, 239, 0.15) 0%, transparent 60%);
}
.profile-avatar-wrap {
  display: flex;
  justify-content: center;
  margin-top: -40px;
  position: relative;
}
.profile-avatar-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid var(--bg-elev-1);
  object-fit: cover;
  box-shadow: var(--shadow-md);
}
.profile-avatar-text {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid var(--bg-elev-1);
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-mid));
  color: var(--brand-gold);
  font-size: 26px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-md);
}
.profile-body {
  padding: 12px 22px 22px;
}
.profile-divider {
  height: 1px;
  background: var(--border);
  margin: 18px -22px;
}
.profile-info {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}
.profile-info li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
}
.profile-info-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.profile-info-icon svg { width: 14px; height: 14px; }

.profile-main { min-width: 0; }

/* Info grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px 24px;
}
.info-item .info-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.info-item .info-value {
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}
.info-value.mono { font-family: var(--font-mono); font-size: 13px; }

/* Document list */
.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
}
.doc-item:last-child { border-bottom: 0; }
.doc-item:hover { background: var(--bg-hover); }
.doc-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.doc-icon svg { width: 18px; height: 18px; }
.doc-info { flex: 1; min-width: 0; }
.doc-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.doc-meta .text-warning { color: var(--warning); }
.doc-meta .text-danger  { color: var(--danger); }
.doc-actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }

/* Timeline */
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.timeline::before {
  content: '';
  position: absolute;
  inset-inline-start: 31px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline li {
  position: relative;
  padding: 16px 22px 16px 56px;
  border-bottom: 1px solid var(--border);
}
.timeline li:last-child { border-bottom: 0; }
html[dir="rtl"] .timeline li { padding: 16px 56px 16px 22px; }
html[dir="rtl"] .timeline::before { inset-inline-start: auto; inset-inline-end: 31px; }
.timeline-dot {
  position: absolute;
  inset-inline-start: 24px;
  top: 22px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-elev-1);
  border: 3px solid var(--primary);
  z-index: 1;
}
html[dir="rtl"] .timeline-dot { inset-inline-start: auto; inset-inline-end: 24px; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.open { display: flex; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.modal-panel {
  position: relative;
  background: var(--bg-elev-1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-subtle);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}
.btn.disabled { opacity: 0.4; pointer-events: none; }

/* Confirm dialog (small variant of modal) */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.confirm-box {
  background: var(--bg-elev-1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 420px;
  width: 100%;
  padding: 28px;
  animation: slideUp 0.25s ease;
}
.confirm-box h3 { margin: 0 0 8px; font-size: 17px; color: var(--text); }
.confirm-box p { margin: 0 0 22px; color: var(--text-muted); }
.confirm-box .actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ============================================================================
   Phase 2 — Roster Grid
   ============================================================================ */
.roster-grid-wrap {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: auto;
  box-shadow: var(--shadow-xs);
}
.roster-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.roster-grid thead th {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  text-align: center;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
}
.roster-grid thead th.is-today {
  background: var(--primary-soft);
  color: var(--primary);
}
.roster-day-name {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}
.roster-day-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}
.roster-grid thead th.is-today .roster-day-num,
.roster-grid thead th.is-today .roster-day-name {
  color: var(--primary);
}
.roster-day-cov {
  margin-top: 2px;
  color: var(--text-subtle);
}
.roster-grid tbody td {
  border-bottom: 1px solid var(--border);
  padding: 8px;
  vertical-align: middle;
  background: var(--bg-elev-1);
}
.roster-grid tbody tr:last-child td { border-bottom: 0; }
.roster-grid .emp-col {
  position: sticky;
  inset-inline-start: 0;
  background: var(--bg-elev-1);
  z-index: 1;
  min-width: 220px;
  max-width: 240px;
  border-inline-end: 1px solid var(--border);
  padding: 12px 16px;
}
.roster-grid thead .emp-col {
  z-index: 3;
  background: var(--bg-subtle);
}

/* Cells */
.roster-cell {
  min-width: 130px;
  max-width: 150px;
  cursor: pointer;
  transition: background var(--tx-fast);
}
.roster-cell.is-today { background: rgba(91, 141, 239, 0.04); }
.roster-cell:hover    { background: var(--bg-hover); }

.roster-shift {
  border: 1px solid;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  text-align: center;
  font-weight: 600;
  font-size: 11px;
  line-height: 1.3;
  transition: all var(--tx-fast);
}
.roster-cell:hover .roster-shift {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.roster-shift-name {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.roster-shift-time {
  font-family: var(--font-mono);
  font-size: 10px;
  margin-top: 2px;
  opacity: 0.8;
}
.roster-shift-tag {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: rgba(0,0,0,0.06);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.roster-empty {
  text-align: center;
  font-size: 18px;
  font-weight: 300;
  color: var(--text-subtle);
  padding: 14px;
  border: 1px dashed transparent;
  border-radius: var(--radius-sm);
  transition: all var(--tx-fast);
}
.roster-cell:hover .roster-empty {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

@media (max-width: 768px) {
  .roster-grid .emp-col { min-width: 160px; }
  .roster-cell { min-width: 100px; }
}

/* ============================================================================
   Phase 3 — Tasks Kanban
   ============================================================================ */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(260px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
}
@media (max-width: 1280px) { .kanban { grid-template-columns: repeat(5, 280px); } }

.kanban-col {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 400px;
  overflow: hidden;
}
.kanban-col-head {
  padding: 12px 14px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.kanban-count {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
}
.kanban-col-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  max-height: 70vh;
}
.kanban-empty {
  text-align: center;
  color: var(--text-subtle);
  padding: 32px 12px;
  font-size: 13px;
  font-style: italic;
}

.kanban-card {
  display: block;
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-decoration: none;
  color: var(--text);
  transition: all var(--tx-fast);
  cursor: pointer;
}
.kanban-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  color: var(--text);
}
.kanban-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}
.kanban-prio {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}
.kanban-card-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 6px;
}
.kanban-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}
.kanban-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.kanban-assignee {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.kanban-assignee span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 110px;
  color: var(--text-muted);
}
.kanban-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-mid));
  color: white;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}
.kanban-due {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}
.kanban-due.soon    { color: var(--warning); }
.kanban-due.overdue { color: var(--danger); font-weight: 700; }

/* ============================================================================
   Phase 4 — Attendance Clock-in/out
   ============================================================================ */
.clock-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}
@media (max-width: 1024px) { .clock-grid { grid-template-columns: 1fr; } }

.clock-card { overflow: hidden; }
.clock-time {
  font-size: 64px;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-family: var(--font-mono);
  color: var(--text);
  line-height: 1;
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
:root[data-theme="dark"] .clock-time {
  background: linear-gradient(135deg, #5B8DEF, var(--brand-gold-soft));
  -webkit-background-clip: text;
  background-clip: text;
}
.clock-shift {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.clock-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 18px 36px;
  font-size: 17px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  border: 0;
  cursor: pointer;
  transition: all var(--tx-base);
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-md);
}
.clock-btn svg { width: 22px; height: 22px; }
.clock-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.clock-btn:disabled, .clock-btn.loading {
  opacity: 0.7;
  cursor: not-allowed;
}
.clock-btn-in {
  background: linear-gradient(135deg, #10B981, #059669);
  color: white;
}
.clock-btn-out {
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: white;
}

.clock-status {
  text-align: center;
  margin-bottom: 20px;
}
.clock-completed {
  text-align: center;
  padding: 20px;
}
.clock-geo {
  margin-top: 18px;
  padding: 8px 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  display: inline-block;
}

/* ============================================================================
   Phase 6 — Reports
   ============================================================================ */
.report-tile {
  transition: all var(--tx-base);
}
.report-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
table.table th.num,
table.table td.num {
  text-align: end;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono), inherit;
}

/* ============================================================================
   Print stylesheet
   ============================================================================ */
@media print {
  /* ============================================================
     PRINT — clean, professional output
     ============================================================
     Strategy to suppress the browser's URL/date/page-number headers:
     `@page { margin: 0 }` removes the gutter that browsers use to
     paint those headers, so they vanish in Chrome/Edge/Safari.
     We then re-add INNER padding on the body so content still has
     breathing room from the paper edge.
     Caveat: Firefox respects @page margins but ALSO has a separate
     "Print headers and footers" toggle in its print dialog. Users
     on Firefox may still need to uncheck that option once. */

  @page {
    size: A4 landscape;
    margin: 0;                    /* removes browser header/footer area */
  }

  html, body {
    background: white !important;
    color: black !important;
    font-size: 11pt;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Inner padding gives our content breathing room since @page margin is 0 */
  body {
    padding: 14mm 12mm !important;
  }

  /* Hide all chrome — nav, buttons, forms, flash messages, banners */
  .sidebar, .topbar, .no-print, .btn, .icon-btn, .flash,
  button, form.no-print, .breadcrumbs, .pagination,
  .announcements-stack, #impersonation-banner,
  .filter-bar, .toolbar, .actions, [data-no-print] {
    display: none !important;
  }

  .app, .app-shell { display: block !important; }
  .main-col, .main { margin: 0 !important; padding: 0 !important; }
  .content { padding: 0 !important; max-width: 100% !important; }
  .page-header { padding: 0 0 6mm 0 !important; border-bottom: 1px solid #999; margin-bottom: 6mm; }
  .page-header h1 { font-size: 18pt !important; margin: 0 !important; }
  .page-header .subtitle { font-size: 10pt !important; color: #555 !important; }

  /* Show print-only blocks */
  .print-only { display: block !important; }

  /* Cards */
  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
    margin-bottom: 6mm !important;
    background: white !important;
  }
  .card-header { background: #f5f5f5 !important; border-bottom: 1px solid #ccc !important; }

  /* Tables */
  table.table {
    width: 100% !important;
    font-size: 9.5pt;
    border-collapse: collapse;
  }
  table.table th {
    background: #eee !important;
    color: black !important;
    border-bottom: 1.5px solid #999 !important;
  }
  table.table td {
    border-bottom: 1px solid #eee !important;
    padding: 6px 8px !important;
  }
  tr { page-break-inside: avoid; }
  thead { display: table-header-group; }   /* repeat header on each page */

  /* KPI cards */
  .kpi-grid { gap: 4mm !important; }
  .kpi { padding: 8px !important; box-shadow: none !important; border: 1px solid #ccc !important; }
  .kpi .value { font-size: 16pt !important; }
  .kpi .icon-wrap { display: none !important; }

  /* Roster grid */
  .roster-grid-wrap { box-shadow: none !important; border: 1px solid #ccc !important; }
  .roster-grid { font-size: 8pt !important; }
  .roster-grid thead th { background: #eee !important; }

  /* No images (avatars, decorative icons) in print */
  img { display: none !important; }
  svg.icon-decorative, .page-header svg, .card-header svg { display: none !important; }

  /* Links: no URL after links (the `content: " (" attr(href) ")"` browser
     default doesn't apply unless authored — but if anything elsewhere set it,
     this kills it). No underline, black text. */
  a, a:link, a:visited { color: black !important; text-decoration: none !important; }
  a[href]:after { content: "" !important; }

  /* Force background colors to print (greens/reds/etc on status badges) */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}

/* PWA — show install button only when browser supports installation */
html[data-installable="1"] [data-pwa-install] { display: grid !important; }
html[data-installable="1"] [data-pwa-install]:hover { background: rgba(212, 165, 55, 0.18); color: var(--brand-gold); }

/* === Impersonation banner === */
.impersonation-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1100;
  background: linear-gradient(90deg, #7C3AED, #EC4899);
  color: white; padding: 0; box-shadow: 0 2px 12px rgba(124,58,237,0.35);
  border-bottom: 2px solid #fbbf24;
  animation: impSlide 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes impSlide { from { transform: translateY(-100%); } to { transform: translateY(0); } }
.impersonation-banner-inner {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 22px; max-width: 1600px; margin: 0 auto;
  font-size: 13px;
}
.impersonation-banner-inner svg { flex-shrink: 0; opacity: 0.95; }
.impersonation-banner-text { flex: 1; min-width: 0; line-height: 1.4; }
.impersonation-banner-text strong { font-weight: 700; letter-spacing: 0.01em; }
.impersonation-banner-imp { font-family: var(--font-mono); opacity: 0.85; font-size: 11px; }
.impersonation-banner-time {
  font-family: var(--font-mono); font-size: 11px; opacity: 0.85;
  padding: 1px 6px; background: rgba(0,0,0,0.2); border-radius: 3px;
}
.impersonation-banner-exit button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; background: rgba(0,0,0,0.25); color: white;
  border: 1px solid rgba(255,255,255,0.3); border-radius: 6px;
  font-weight: 600; font-size: 12px; cursor: pointer;
  transition: background 0.15s;
}
.impersonation-banner-exit button:hover { background: rgba(0,0,0,0.4); }
/* Push the rest of the page down by the banner height (~40px) */
body:has(.impersonation-banner) { padding-top: 42px; }
@media (max-width: 640px) {
  .impersonation-banner-inner { padding: 8px 12px; font-size: 12px; flex-wrap: wrap; }
  .impersonation-banner-text { width: 100%; }
}

/* ============================================================================
 * Phase 27 — Native Capacitor shell adjustments
 *
 * MobileBridge.js adds body.native (+ body.native-ios / body.native-android)
 * on app launch. These rules apply only inside the wrapper, so the PWA / web
 * experience is unaffected.
 * ========================================================================== */

body.native {
  /* Honour iOS/Android safe-area insets (notches, gesture bars) */
  padding-top:    env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left:   env(safe-area-inset-left);
  padding-right:  env(safe-area-inset-right);
}

/* Hide PWA install affordance — the app is already installed. */
body.native [data-pwa-install] { display: none !important; }

/* Hide any "Open in browser" / external-link helpers inside the shell —
   MobileBridge.openExternal() handles that case in JS instead. */
body.native .pwa-only { display: none !important; }

/* Larger touch targets feel right inside a native shell. */
body.native .btn,
body.native .icon-btn { min-height: 44px; }

/* iOS status-bar overlap fix: when running standalone, the topbar can collide
   with the status bar. Push it down by the safe-area-inset-top so the search
   field and bell are tappable. */
body.native-ios .topbar { padding-top: max(env(safe-area-inset-top), 8px); }

/* Android: hardware-back gesture sometimes triggers a horizontal-overscroll —
   pin the body so back gestures route to navigation instead. */
body.native-android { overscroll-behavior-x: none; }

/* =================== BULK OPERATIONS UI (Phase 31) =================== */

/* Checkbox column — slim, centered */
.bulk-col, .bulk-cell {
  width: 36px;
  min-width: 36px;
  text-align: center;
  padding-inline-start: 4px !important;
  padding-inline-end: 4px !important;
}
.bulk-checkbox, .bulk-all {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-mid, #0B2545);
  cursor: pointer;
  margin: 0;
}
.bulk-cell:hover, tr:has(.bulk-checkbox:checked) {
  background: rgba(212, 165, 55, 0.04);
}

/* Floating action bar — appears when 1+ rows selected */
.bulk-action-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--brand-mid, #0B2545);
  color: white;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(11, 37, 69, 0.35), 0 2px 6px rgba(0,0,0,0.1);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9000;
  min-width: 340px;
  max-width: 90vw;
  font-size: 14px;
  transition: transform 0.25s ease-out, opacity 0.2s;
  opacity: 0;
  pointer-events: none;
}
.bulk-action-bar.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.bulk-action-bar .count {
  background: rgba(212, 165, 55, 0.2);
  color: #D4A537;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.bulk-action-bar .actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.bulk-action-bar .btn-bulk {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
}
.bulk-action-bar .btn-bulk:hover {
  background: rgba(255, 255, 255, 0.15);
}
.bulk-action-bar .btn-bulk.danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
}
.bulk-action-bar .btn-bulk.primary {
  background: var(--brand-gold, #D4A537);
  color: var(--brand-mid, #0B2545);
  border-color: transparent;
  font-weight: 600;
}
.bulk-action-bar .btn-bulk.primary:hover {
  background: #e8b847;
}
.bulk-action-bar .close {
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 18px;
  line-height: 1;
}
.bulk-action-bar .close:hover { color: white; }

/* Bulk parameter modal — for actions that need extra input (PIN, role, notes) */
.bulk-param-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9100;
  padding: 20px;
}
.bulk-param-modal.open { display: flex; }
.bulk-param-modal .modal-box {
  background: var(--bg, white);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
  padding: 28px 24px;
  max-width: 460px;
  width: 100%;
}
.bulk-param-modal h3 {
  margin: 0 0 6px;
  font-size: 18px;
  color: var(--text, #111);
}
.bulk-param-modal p {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-muted, #666);
}
.bulk-param-modal .field { margin-bottom: 14px; }
.bulk-param-modal .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
}

/* RTL adjustments */
[dir="rtl"] .bulk-action-bar { /* transform stays centered */ }

@media (max-width: 640px) {
  .bulk-action-bar {
    min-width: auto;
    width: calc(100vw - 24px);
    flex-wrap: wrap;
    padding: 10px 12px;
  }
  .bulk-action-bar .actions { flex: 1; }
}

/* ============================================================
   HOVER FEEDBACK — explicit affordances for light theme
   ============================================================ */

/* Plain links inside cards/content get a subtle underline on hover */
.card a:not(.btn):not(.icon-btn):hover,
.content a:not(.btn):not(.icon-btn):not(.sidebar-link):not(.nav-link):hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Sidebar nav links — stronger hover bg + slight color shift */
.sidebar a:hover, .sidebar-link:hover, .nav-link:hover {
  background: var(--bg-hover);
  color: var(--primary);
}

/* Table rows — clickable rows get a clear hover affordance */
.table tbody tr:hover { background: var(--bg-hover); }

/* Dropdown items */
.dropdown-item:hover, .menu-item:hover { background: var(--bg-hover); color: var(--primary); }

/* Icon-only buttons (settings cog, delete, edit) */
.icon-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--primary);
}

/* Pagination links */
.pagination a:hover { background: var(--bg-hover); color: var(--primary); }

/* Tabs */
.tab:hover:not(.active) { background: var(--bg-hover); color: var(--text); }

/* Action links inside table cells (Edit · Delete) */
td a:not(.btn):hover { color: var(--primary); text-decoration: underline; }

/* "Card" links — file/document cards in lists */
.card-link:hover, a.card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
