/* ═══════════════════════════════════════════════════════════════
   AL TAIF HRM — Professional HR & Payroll Suite
   Design System v3.0
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Brand */
  --primary: #0f172a;
  --primary-2: #1e293b;
  --primary-3: #334155;
  --accent: #c5a059;
  --accent-2: #e8c97e;
  --accent-soft: rgba(197, 160, 89, 0.12);

  /* Semantic */
  --success: #10b981;
  --success-soft: #ecfdf5;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --warning: #f59e0b;
  --warning-soft: #fff7ed;
  --info: #3b82f6;
  --info-soft: #eff6ff;
  --purple: #8b5cf6;
  --purple-soft: #faf5ff;

  /* Surfaces */
  --bg: #f8fafc;
  --bg-2: #f1f5f9;
  --sidebar-bg: #0a0f1e;
  --card-bg: #ffffff;
  --border: #d1d5db;
  --border-2: #e2e8f0;

  /* Text */
  --text-1: #0f172a;
  --text-2: #334155;
  --text-3: #64748b;
  --text-inv: #f8fafc;

  /* Glass / overlays */
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 24px;
  --r-full: 999px;

  /* Shadows */
  --sh-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --sh-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --sh-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 6px rgba(15, 23, 42, 0.04);
  --sh-lg: 0 10px 30px rgba(15, 23, 42, 0.08), 0 4px 10px rgba(15, 23, 42, 0.04);
  --sh-xl: 0 25px 50px rgba(15, 23, 42, 0.12);
  --sh-glow: 0 0 0 3px var(--accent-soft);
}

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

html,
body {
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button {
  font-family: inherit;
  cursor: pointer;
}

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

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: inline-block;
  vertical-align: middle;
}

/* ── Layout ────────────────────────────────────────────────────── */
:root {
  --sidebar-w: 260px;
  --sidebar-collapsed-w: 74px;
}

.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 64px 1fr;
  grid-template-areas: "sidebar header" "sidebar main";
  min-height: 100vh;
  transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-layout.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-w) 1fr;
}

.sidebar {
  grid-area: sidebar;
  background: var(--sidebar-bg);
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--glass-border);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.top-header {
  grid-area: header;
  background: var(--card-bg);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1.25rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Collapsed States */
.sidebar-collapsed .sidebar-brand,
.sidebar-collapsed .sidebar-brand-sub,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .sidebar-entity .entity-name,
.sidebar-collapsed .sidebar-user-row .user-name,
.sidebar-collapsed .sidebar-user-row .user-role,
.sidebar-collapsed .nav-section-label {
  display: none !important;
}

.sidebar-collapsed .sidebar-logo {
  padding: 1.25rem 0.85rem;
  justify-content: center;
}

.sidebar-collapsed .sidebar-entity {
  padding: 0.7rem;
  justify-content: center;
}

.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 0.75rem;
}

.sidebar-collapsed .nav-link svg {
  width: 20px;
  height: 20px;
  margin: 0;
}

.sidebar-collapsed .sidebar-user-row {
  justify-content: center;
}

.sidebar-collapsed .logout-btn {
  margin: 0;
}

.main-content {
  grid-area: main;
  padding: 2rem 2.5rem 3rem;
  overflow-y: auto;
  background: var(--bg);
  animation: fadeIn 0.3s ease-out;
}

/* ── Sticky table header for long data tables ───────────────────────────────
   Applied to the Employees directory and Attendance Log wrappers. The wrapper
   becomes a bounded vertical scroller (horizontal scroll preserved) and the
   header row pins to the top, so column labels & header filters stay visible
   while scrolling a large data set. The header is short → no scroll → header
   simply sits at the top as before. */
.table-sticky {
  max-height: calc(100vh - 19rem);
  overflow: auto;
}
.table-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  /* Opaque fill matches the bg-surface-container-high header row; the inset
     shadow keeps the bottom divider pinned with the header under collapsed borders. */
  background: #e6e8ea;
  box-shadow: inset 0 -1px 0 #E2E8F0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes modalScale {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1.25rem 1.25rem;
  border-bottom: 1px solid var(--glass-border);
  min-height: 64px;
}

.sidebar-logo-box {
  width: 40px;
  height: 40px;
  background: white;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.9rem;
  color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.sidebar-brand {
  color: var(--sidebar-text);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.sidebar-brand-sub {
  color: var(--text-3);
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 1px;
}

.sidebar-entity {
  margin: 0.875rem 1rem;
  padding: 0.7rem 0.875rem;
  background: var(--glass-border);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 0;
}

.sidebar-entity:empty {
  display: none;
}

.entity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.entity-name {
  color: var(--sidebar-text);
  font-weight: 700;
  font-size: 0.78rem;
  line-height: 1.2;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 0.62rem;
  font-weight: 800;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.875rem 0.625rem 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.65rem 0.875rem;
  border-radius: var(--r-sm);
  color: #94a3b8;
  font-size: 0.86rem;
  font-weight: 600;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all 0.18s ease;
}

.nav-link:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(2px);
}

.nav-link.active {
  color: white;
  background: linear-gradient(90deg, rgba(197, 160, 89, 0.12), rgba(197, 160, 89, 0.02));
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-link svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
  flex-shrink: 0;
}

.nav-link.active svg {
  opacity: 1;
  color: var(--accent);
}

.sidebar-footer {
  padding: 0.875rem 1rem;
  border-top: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
}

.sidebar-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: white;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.user-name {
  color: #f1f5f9;
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.2;
}

.user-role {
  color: #64748b;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 1px;
  letter-spacing: 0.04em;
}

.logout-btn {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  border: none;
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: var(--danger);
  color: white;
}

.logout-btn svg {
  width: 14px;
  height: 14px;
}

/* ── Header ────────────────────────────────────────────────────── */
.header-title {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--primary);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.header-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.18s;
}

.header-icon-btn:hover {
  background: var(--bg-2);
  color: var(--primary);
}

.notif-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid white;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 14px 4px 4px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  box-shadow: var(--sh-xs);
}

.header-user-name {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--primary);
  line-height: 1.1;
}

.header-user-role {
  font-size: 0.62rem;
  color: var(--text-3);
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 1px;
  letter-spacing: 0.04em;
}

.entity-switcher {
  position: relative;
}

.entity-switcher-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-1);
  box-shadow: var(--sh-xs);
  transition: all 0.18s;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.entity-switcher-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--sh-sm);
}

.entity-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  min-width: 280px;
  padding: 6px;
  z-index: 200;
  animation: fadeIn 0.18s ease;
}

.entity-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.entity-opt:hover {
  background: var(--bg-2);
}

.entity-opt.selected {
  background: var(--accent-soft);
}

.entity-opt-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary);
}

.entity-opt-sub {
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 1px;
}

/* ── Page Header ───────────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.65rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.page-header p {
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 4px;
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.625rem 1.125rem;
  border-radius: var(--r-md);
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid transparent;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  line-height: 1;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  border-radius: var(--r-sm);
}

.btn-lg {
  padding: 0.85rem 1.5rem;
  font-size: 0.95rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: var(--sh-sm);
}

.btn-primary:hover {
  background: #000;
  transform: translateY(-1px);
  box-shadow: var(--sh-md);
}

.btn-secondary {
  background: var(--card-bg);
  color: var(--text-1);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-2);
  border-color: var(--text-3);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-warning:hover {
  background: #d97706;
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0a0f1e;
}

.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(197, 160, 89, 0.35);
}

.btn-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: white;
  color: var(--text-2);
  font-size: 0.95rem;
  line-height: 1;
  transition: all 0.15s;
  cursor: pointer;
}

.btn-icon:hover {
  background: var(--bg-2);
  border-color: var(--text-3);
  transform: translateY(-1px);
}

/* ── Toolbars / Search ─────────────────────────────────────────── */
.toolbar {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border-2);
  background: white;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  max-width: 420px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.4rem;
  background: var(--bg-2);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 0.85rem;
  color: var(--text-1);
  transition: all 0.18s;
}

.search-box input:focus {
  background: white;
  border-color: var(--accent);
  outline: none;
  box-shadow: var(--sh-glow);
}

.search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.search-icon svg {
  width: 16px;
  height: 16px;
}

/* ── Tabs ──────────────────────────────────────────────────────── */
.tab-bar,
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab-btn {
  padding: 0.75rem 1.125rem;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 600;
  position: relative;
  transition: color 0.18s;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--primary);
}

.tab-btn.active {
  color: var(--primary);
  font-weight: 700;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 8px;
  right: 8px;
  height: 2.5px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

/* ── Panels / Cards ────────────────────────────────────────────── */
.panel {
  background: white;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--sh-xs);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.panel-pad {
  padding: 1.5rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
  border-color: #cbd5e1;
}

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.stat-card h3 {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat-sub {
  font-size: 0.72rem;
  color: var(--text-3);
  margin-top: 2px;
  font-weight: 500;
}

/* ── Tables ────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th {
  padding: 12px 18px;
  font-size: 0.68rem;
  font-weight: 900;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-2);
  font-size: 0.875rem;
  color: var(--text-1);
  transition: background 0.15s;
  vertical-align: middle;
}

table tr:last-child td {
  border-bottom: none;
}

table tbody tr:hover td {
  background: #fafbfc;
}

.td-name {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.9rem;
}

.td-sub {
  font-size: 0.72rem;
  color: var(--text-3);
  margin-top: 2px;
  font-weight: 500;
}

table code {
  background: var(--bg-2);
  padding: 2px 7px;
  border-radius: 5px;
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 600;
}

/* ── Pills ─────────────────────────────────────────────────────── */
.pill {
  padding: 3px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  line-height: 1.4;
}

.pill-green {
  background: var(--success-soft);
  color: #065f46;
}

.pill-blue {
  background: var(--info-soft);
  color: #1e40af;
}

.pill-red {
  background: var(--danger-soft);
  color: #991b1b;
}

.pill-orange {
  background: var(--warning-soft);
  color: #9a3412;
}

.pill-purple {
  background: var(--purple-soft);
  color: #6b21a8;
}

.pill-gray {
  background: var(--bg-2);
  color: var(--text-2);
}

/* ── Premium Login ─────────────────────────────────────────────── */
.login-root {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(rgba(10, 15, 30, 0.8), rgba(15, 23, 42, 0.8)), url('../img/login_bg.png');
  background-size: cover;
  background-position: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

/* Animated background shapes removed for cleaner look with image */
.login-bg-shapes {
  display: none;
}

/* Login Container — Split Layout */
.login-container {
  display: flex;
  width: 960px;
  max-width: 100%;
  min-height: 520px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
  position: relative;
  z-index: 1;
  animation: loginSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Left: Hero/Branding Panel */
.login-hero {
  flex: 1.15;
  padding: 3rem;
  background: linear-gradient(160deg, rgba(17, 24, 39, 0.9) 0%, rgba(30, 41, 59, 0.9) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}

.login-hero::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(180deg, rgba(197, 160, 89, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.login-hero-content {
  position: relative;
  z-index: 1;
}

.login-hero-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 2.5rem;
}

.login-logo-icon {
  width: 52px;
  height: 52px;
  background: white;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.login-hero-brand {
  font-size: 1.15rem;
  font-weight: 900;
  color: #f8fafc;
  letter-spacing: 0.1em;
  line-height: 1.1;
}

.login-hero-brand-sub {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 2px;
}

.login-hero-title {
  font-size: 1.85rem;
  font-weight: 900;
  color: #f1f5f9;
  line-height: 1.25;
  letter-spacing: -0.03em;
  margin-bottom: 0;
}

.login-hero-footer {
  position: relative;
  z-index: 1;
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* Right: Login Card */
.login-card {
  width: 420px;
  min-width: 340px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
}

.login-card-inner {
  width: 100%;
}

.login-card-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-welcome {
  font-size: 1.5rem;
  font-weight: 900;
  color: #1e293b;
  letter-spacing: -0.03em;
}

.login-welcome-sub {
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 500;
  margin-top: 6px;
}

.login-body {}

.login-form-title {
  display: none;
  /* Replaced by .login-welcome */
}

.login-field {
  margin-bottom: 1.25rem;
}

.login-field label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.login-field input {
  width: 100%;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  color: #1e293b;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-field input:focus {
  background: #ffffff;
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.1), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.login-field input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.btn-login {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  height: 52px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #0a0f1e;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 0.75rem;
  position: relative;
  overflow: hidden;
  text-align: center;
}

.btn-login::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s;
}

.btn-login:hover::before {
  transform: translateX(100%);
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(197, 160, 89, 0.4);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.btn-login:disabled::before {
  display: none;
}

.login-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #b91c1c;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  text-align: center;
  animation: loginShake 0.4s ease;
}

@keyframes loginShake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-6px);
  }

  75% {
    transform: translateX(6px);
  }
}

.login-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 2rem;
  font-size: 0.68rem;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.04em;
  justify-content: center;
}

.login-footer-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
}

/* Responsive: stack on mobile */
@media (max-width: 768px) {
  .login-container {
    flex-direction: column;
    min-height: auto;
  }

  .login-hero {
    display: none;
  }

  .login-card {
    width: 100%;
    min-width: auto;
    padding: 2rem 1.5rem;
  }
}

/* ── Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
}

.modal-box {
  background: white;
  border-radius: var(--r-2xl);
  width: 600px;
  max-width: 100%;
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.3);
  border: 1px solid var(--border);
  animation: modalScale 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-lg {
  width: 880px;
}

.modal-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.modal-close {
  background: var(--bg-2);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  font-size: 1rem;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.modal-close:hover {
  background: var(--danger);
  color: white;
}

#modal-body {
  padding: 1.75rem;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

#modal-body::-webkit-scrollbar {
  width: 6px;
}

#modal-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

/* ── Forms ─────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  gap: 1rem;
}

.form-grid-1 {
  grid-template-columns: 1fr;
}

.form-grid-2 {
  grid-template-columns: 1fr 1fr;
}

.form-grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-section {
  grid-column: 1 / -1;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.5rem 0 0.25rem;
  border-top: 1px solid var(--border-2);
  margin-top: 0.25rem;
}

.form-section:first-child {
  padding-top: 0;
  border-top: none;
  margin-top: 0;
}

.field {
  display: flex;
  flex-direction: column;
}

.field label:not([class*="font-"]) {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.field input:not([class*="px-"]),
.field select:not([class*="px-"]),
.field textarea:not([class*="px-"]) {
  width: 100%;
  padding: 0.65rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  color: var(--text-1);
  background: white;
  transition: all 0.18s;
}

.field input:not([class*="px-"]):focus,
.field select:not([class*="px-"]):focus,
.field textarea:not([class*="px-"]):focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: var(--sh-glow);
}

.field input[readonly]:not([class*="px-"]) {
  background: var(--bg-2);
  color: var(--text-2);
}

.field textarea:not([class*="px-"]) {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

.field select:not([class*="px-"]) {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2.25rem;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border-2);
}

/* ── Spinner ───────────────────────────────────────────────────── */
.spinner {
  border: 2.5px solid rgba(197, 160, 89, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  animation: spin 0.7s linear infinite;
}

.spinner-white {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: white;
}

.spinner-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Toasts ────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}

.toast {
  background: white;
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-1);
  animation: slideIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 280px;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.success>span:first-child {
  color: var(--success);
  font-size: 1.1rem;
  font-weight: 800;
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.error>span:first-child {
  color: var(--danger);
  font-size: 1.1rem;
  font-weight: 800;
}

.toast.warning {
  border-left-color: var(--warning);
}

.toast.warning>span:first-child {
  color: var(--warning);
  font-size: 1.1rem;
  font-weight: 800;
}

.toast.info>span:first-child {
  color: var(--info);
  font-size: 1.1rem;
  font-weight: 800;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.15s;
}

.toast-close:hover {
  background: var(--bg-2);
  color: var(--danger);
}

/* ── Empty States ──────────────────────────────────────────────── */
.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-3);
}

.empty-state p {
  font-size: 0.85rem;
}

/* ── Utilities ─────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mb-1 {
  margin-bottom: 0.75rem;
}

.mb-2 {
  margin-bottom: 1.5rem;
}

.mt-1 {
  margin-top: 0.75rem;
}

.mt-2 {
  margin-top: 1.5rem;
}

/* ── Scrollbars ────────────────────────────────────────────────── */
.main-content::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.main-content::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.main-content::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 220px 1fr;
  }

  .main-content {
    padding: 1.5rem 1.75rem;
  }

  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "header" "main";
  }

  .sidebar {
    display: none;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .modal-box {
    width: 100%;
    max-height: calc(100vh - 1rem);
    margin: 0.5rem;
  }
}

/* -- RTL Support ------------------------------------------ */
.rtl-mode .app-layout {
  grid-template-areas: " header sidebar\ \main sidebar\; grid-template-columns: 1fr var(--sidebar-w); }
 .rtl-mode .app-layout.sidebar-collapsed {
    grid-template-columns: 1fr var(--sidebar-collapsed-w);
  }

  .rtl-mode .sidebar {
    border-right: none;
    border-left: 1px solid var(--glass-border);
  }

  .rtl-mode .nav-link {
    transform: none;
  }

  .rtl-mode .nav-link:hover {
    transform: translateX(-2px);
  }

  .rtl-mode .nav-link.active::after {
    left: auto;
    right: 0;
    width: 3px;
    height: 100%;
    border-radius: 2px 0 0 2px;
  }

  .rtl-mode .top-header {
    flex-direction: row-reverse;
  }

  .rtl-mode .header-right {
    margin-left: 0;
    margin-right: auto;
    flex-direction: row-reverse;
  }

  .rtl-mode .header-user {
    padding: 4px 4px 4px 14px;
    flex-direction: row-reverse;
  }

  .rtl-mode .sidebar-logo {
    flex-direction: row-reverse;
  }

  .rtl-mode .sidebar-user-row {
    flex-direction: row-reverse;
  }

  .rtl-mode .logout-btn {
    margin-left: 0;
    margin-right: auto;
  }

  .rtl-mode .page-header {
    flex-direction: row-reverse;
    text-align: right;
  }

  .rtl-mode .page-header h1 {
    letter-spacing: 0;
  }

  .rtl-mode .search-box svg {
    left: auto;
    right: 0.875rem;
  }

  .rtl-mode .search-box input {
    padding: 0.65rem 2.4rem 0.65rem 1rem;
    text-align: right !important;
  }

  .rtl-mode .btn {
    flex-direction: row-reverse;
  }

  .rtl-mode .stat-card {
    text-align: right;
  }

  .rtl-mode table {
    text-align: right;
  }

  .rtl-mode table th {
    text-align: right;
  }

  .rtl-mode .modal-header {
    flex-direction: row-reverse;
  }

  .rtl-mode .form-actions {
    justify-content: flex-start;
  }

  .rtl-mode .toast {
    flex-direction: row-reverse;
    border-left: none;
    border-right: 4px solid var(--info);
  }

  .rtl-mode .toast.success {
    border-right-color: var(--success);
  }

  .rtl-mode .toast.error {
    border-right-color: var(--danger);
  }

  .rtl-mode .toast.warning {
    border-right-color: var(--warning);
  }

  /* Redesign helpers */
  .table-zebra tr:nth-child(even) { background-color: #ffffff; }
  .table-zebra tr:nth-child(odd) { background-color: #f2f4f6; }

  /* Employee directory: vertically centre every cell so the name + avatar line
     up with the code, contract, salary, etc. on multi-line rows. */
  .emp-directory-table td { vertical-align: middle; }

  /* Tailwind custom border style override when preflight is disabled */
  [class*="border-"], [class="border"] {
    border-style: solid;
  }

  /* Split view fit-to-viewport helper */
  .main-content.page-split-view {
    overflow: hidden !important;
    height: calc(100vh - 64px) !important;
    padding: 1.5rem !important;
  }