/* =====================================================
   نظام الموارد البشرية - التصميم الرئيسي
   Arabic RTL - Professional HR System
   ===================================================== */

:root {
  --primary:       #1a3a5c;
  --primary-light: #2563a8;
  --primary-dark:  #0f2340;
  --accent:        #c8922a;
  --accent-light:  #e8b84b;
  --success:       #16a34a;
  --danger:        #dc2626;
  --warning:       #d97706;
  --info:          #0891b2;
  --bg:            #f0f4f8;
  --bg-card:       #ffffff;
  --sidebar-bg:    #0f2340;
  --sidebar-text:  #cbd5e1;
  --sidebar-hover: #1a3a5c;
  --sidebar-active:#c8922a;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --shadow:        0 2px 16px rgba(15,35,64,.10);
  --shadow-lg:     0 8px 32px rgba(15,35,64,.15);
  --radius:        12px;
  --radius-sm:     8px;
  --sidebar-w:     260px;
  --header-h:      64px;
  --font-main:     "Segoe UI", Tahoma, Arial, sans-serif;
}

/* RESET & BASE */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  direction: rtl;
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform .3s ease;
  box-shadow: -4px 0 24px rgba(0,0,0,.3);
  overflow: hidden;
}

.sidebar-logo {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.sidebar-logo .logo-icon {
  width: 44px;
  height: 44px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: white;
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  flex: 1;
}

.sidebar-logo .logo-text h1 {
  font-size: 14px;
  font-weight: 700;
  color: white;
  line-height: 1.3;
}

.sidebar-logo .logo-text small {
  font-size: 11px;
  color: var(--sidebar-text);
}

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

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  letter-spacing: 1.5px;
  padding: 14px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 0;
  transition: all .2s;
  position: relative;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: white;
}

.nav-item.active {
  background: rgba(200,146,42,.15);
  color: var(--accent-light);
  border-right: 3px solid var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

.nav-badge {
  margin-right: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 7px;
  min-width: 20px;
  text-align: center;
}

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

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

.sidebar-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-user .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sidebar-user .user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user .user-name {
  font-size: 13px;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .user-role {
  font-size: 11px;
  color: var(--sidebar-text);
}

/* =====================================================
   MAIN LAYOUT
   ===================================================== */
.main-wrapper,
.main-content {
  flex: 1;
  margin-right: var(--sidebar-w);
  min-height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin .3s;
}

.topbar {
  height: var(--header-h);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
  min-width: 0;
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  flex: 1;
}

.topbar-title small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 1px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-lang-btn {
  height: 38px;
  min-width: 58px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  font-family: inherit;
  font-weight: 800;
  transition: all .2s;
}

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

.topbar-lang-primary {
  font-size: 12px;
  line-height: 1;
}

.topbar-lang-secondary {
  font-size: 13px;
  line-height: 1;
  color: var(--text-muted);
}

.topbar-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all .2s;
  position: relative;
}

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

.topbar-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.topbar-badge {
  position: absolute;
  top: -6px;
  left: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border: 2px solid #fff;
}

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

.topbar-date {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 14px;
  background: var(--bg);
  border-radius: 20px;
  border: 1px solid var(--border);
}

.topbar-user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: all .2s;
}

.topbar-user-chip:hover {
  background: var(--bg);
  border-color: #cbd5e1;
}

.topbar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  overflow: hidden;
}

.topbar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.topbar-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar-user-meta strong {
  font-size: 12px;
  line-height: 1.2;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.topbar-user-meta small {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.2;
}

body.lang-en {
  direction: ltr;
}

body.lang-en .sidebar {
  right: auto;
  left: 0;
  box-shadow: 4px 0 24px rgba(0,0,0,.3);
}

body.lang-en .sidebar-logo,
body.lang-en .sidebar-user,
body.lang-en .nav-item,
body.lang-en .topbar,
body.lang-en .card-header,
body.lang-en .topbar-actions,
body.lang-en .topbar-title,
body.lang-en .topbar-user-chip {
  direction: ltr;
}

body.lang-en .nav-item.active {
  border-right: 0;
  border-left: 3px solid var(--accent);
}

body.lang-en .nav-item.active::before {
  right: auto;
  left: 0;
}

body.lang-en .nav-badge {
  margin-right: 0;
  margin-left: auto;
}

body.lang-en .main-wrapper,
body.lang-en .main-content {
  margin-right: 0;
  margin-left: var(--sidebar-w);
}

body.lang-en .topbar-title small,
body.lang-en .user-role,
body.lang-en .user-name,
body.lang-en .card-title,
body.lang-en .page-content,
body.lang-en .nav-section-title,
body.lang-en .form-label,
body.lang-en .table th,
body.lang-en .table td,
body.lang-en .topbar-user-meta strong,
body.lang-en .topbar-user-meta small {
  text-align: left;
}

body.lang-en .sidebar-logo .logo-text small {
  direction: ltr;
}

/* =====================================================
   PAGE CONTENT
   ===================================================== */
.page-content {
  flex: 1;
  padding: 28px;
  min-width: 0;
  overflow-x: auto;
}

/* =====================================================
   CARDS
   ===================================================== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  min-width: 0;
  flex-wrap: wrap;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  flex: 1;
}

.card-body {
  padding: 22px;
  min-width: 0;
}

/* =====================================================
   STAT CARDS
   ===================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform .2s, box-shadow .2s;
}

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

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.stat-icon.primary   { background: rgba(26,58,92,.12);  color: var(--primary-light); }
.stat-icon.success   { background: rgba(22,163,74,.12); color: var(--success); }
.stat-icon.warning   { background: rgba(217,119,6,.12); color: var(--warning); }
.stat-icon.danger    { background: rgba(220,38,38,.12); color: var(--danger); }
.stat-icon.info      { background: rgba(8,145,178,.12); color: var(--info); }
.stat-icon.accent    { background: rgba(200,146,42,.12);color: var(--accent); }

.stat-info {}
.stat-value {
  font-size: 26px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* =====================================================
   TABLES
   ===================================================== */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

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

.table thead th {
  background: var(--primary);
  color: white;
  padding: 13px 16px;
  text-align: right;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  border: none;
}

.table thead th:first-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.table thead th:last-child  { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

.table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}

.table tbody tr:hover { background: rgba(26,58,92,.04); }
.table tbody tr:last-child { border-bottom: none; }

.table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  color: var(--text);
}

.table-striped tbody tr:nth-child(even) { background: rgba(240,244,248,.6); }
.table-striped tbody tr:nth-child(even):hover { background: rgba(26,58,92,.04); }

/* =====================================================
   BADGES & STATUS
   ===================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-success  { background: rgba(22,163,74,.12);  color: var(--success); }
.badge-danger   { background: rgba(220,38,38,.12);  color: var(--danger);  }
.badge-warning  { background: rgba(217,119,6,.12);  color: var(--warning); }
.badge-info     { background: rgba(8,145,178,.12);  color: var(--info);    }
.badge-primary  { background: rgba(26,58,92,.12);   color: var(--primary); }
.badge-accent   { background: rgba(200,146,42,.12); color: var(--accent);  }

/* =====================================================
   FORMS
   ===================================================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.form-label .required { color: var(--danger); margin-right: 2px; }

.form-control {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 14px;
  color: var(--text);
  background: white;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
  direction: rtl;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,99,168,.12);
}

.form-control:disabled, .form-control[readonly] {
  background: var(--bg);
  color: var(--text-muted);
}

.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid   { border-color: var(--success); }

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.form-section {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 22px;
  border: 1px solid var(--border);
}

.form-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all .2s;
  white-space: nowrap;
}

.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-sm  { padding: 6px 14px; font-size: 12.5px; }
.btn-lg  { padding: 12px 28px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }

.btn-primary  { background: var(--primary);       color: white; }
.btn-primary:hover  { background: var(--primary-light); }
.btn-success  { background: var(--success);        color: white; }
.btn-success:hover  { background: #15803d; }
.btn-danger   { background: var(--danger);         color: white; }
.btn-danger:hover   { background: #b91c1c; }
.btn-warning  { background: var(--warning);        color: white; }
.btn-warning:hover  { background: #b45309; }
.btn-info     { background: var(--info);           color: white; }
.btn-accent   { background: var(--accent);         color: white; }
.btn-accent:hover   { background: var(--accent-light); color: var(--primary-dark); }
.btn-outline  { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover  { background: var(--bg); }
.btn-outline-primary { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: white; }

/* =====================================================
   ALERTS
   ===================================================== */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.alert-success { background: rgba(22,163,74,.10);  border-right: 4px solid var(--success); color: #14532d; }
.alert-danger  { background: rgba(220,38,38,.10);  border-right: 4px solid var(--danger);  color: #7f1d1d; }
.alert-warning { background: rgba(217,119,6,.10);  border-right: 4px solid var(--warning); color: #78350f; }
.alert-info    { background: rgba(8,145,178,.10);  border-right: 4px solid var(--info);    color: #0c4a6e; }

/* =====================================================
   LEAVE BALANCE BARS
   ===================================================== */
.leave-balance-card {
  background: white;
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.leave-type-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}

.leave-type-name .days-text {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.progress-bar-container {
  background: var(--bg);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 20px;
  transition: width .5s ease;
}

.progress-bar-fill.annual   { background: var(--primary-light); }
.progress-bar-fill.sick     { background: var(--warning); }
.progress-bar-fill.unpaid   { background: var(--danger); }
.progress-bar-fill.emergency{ background: var(--info); }
.progress-bar-fill.marriage { background: #ec4899; }
.progress-bar-fill.death    { background: #6b7280; }
.progress-bar-fill.hajj     { background: var(--accent); }
.progress-bar-fill.exam     { background: var(--success); }

.leave-counts {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.leave-counts .consumed { color: var(--danger); font-weight: 600; }
.leave-counts .remaining { color: var(--success); font-weight: 600; }

/* =====================================================
   MODAL
   ===================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,35,64,.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.modal-box {
  background: white;
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary);
  color: white;
}

.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; color: white; font-size: 22px; cursor: pointer; line-height: 1; }
.modal-body  { padding: 22px; }
.modal-footer{ padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* =====================================================
   TABS
   ===================================================== */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  gap: 4px;
}

.tab-btn {
  padding: 11px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
}

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

.tab-content { display: none; }
.tab-content.active { display: block; }

/* =====================================================
   EXPIRY ALERTS
   ===================================================== */
.expiry-critical { color: var(--danger) !important; font-weight: 700; }
.expiry-warning  { color: var(--warning) !important; font-weight: 600; }
.expiry-ok       { color: var(--success) !important; }

/* =====================================================
   PAGINATION
   ===================================================== */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 18px 0 0;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  font-family: var(--font-main);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: all .2s;
}

.page-btn:hover, .page-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* =====================================================
   LOGIN PAGE
   ===================================================== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 42px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-circle {
  width: 72px;
  height: 72px;
  background: var(--primary);
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 900;
  color: white;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(26,58,92,.3);
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 4px;
}

.login-logo p {
  font-size: 13px;
  color: var(--text-muted);
}

/* =====================================================
   EMPTY STATE
   ===================================================== */
.empty-state {
  text-align: center;
  padding: 52px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 52px;
  margin-bottom: 14px;
  opacity: .4;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  max-width: 340px;
  margin: 0 auto 20px;
}

/* =====================================================
   PRINT
   ===================================================== */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-wrapper, .main-content { margin-right: 0 !important; }
  .page-content { padding: 0 !important; }
  body { background: white !important; }
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); --sidebar-w: 260px; }
  .main-wrapper,
  .main-content { margin-right: 0; }
}

@media (max-width: 768px) {
  .page-content { padding: 16px; }
  .stats-grid   { grid-template-columns: repeat(2, 1fr); }
  .form-grid    { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .modal-box    { margin: 10px; }
  body.lang-en .main-wrapper,
  body.lang-en .main-content { margin-left: 0 !important; }
  body.lang-en .sidebar { transform: translateX(-100%); }
  body.lang-en .sidebar.open { transform: translateX(0); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* =====================================================
   SCROLLBAR
   ===================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* =====================================================
   MISSING CLASS ALIASES
   (pages use these class names — defined here for compatibility)
   ===================================================== */

/* data-table = same as .table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table thead th {
  background: var(--primary);
  color: white;
  padding: 13px 16px;
  text-align: right;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  border: none;
}
.data-table thead th:first-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.data-table thead th:last-child  { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.data-table tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
.data-table tbody tr:hover { background: rgba(26,58,92,.04); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody td { padding: 12px 16px; vertical-align: middle; color: var(--text); }

/* stat-number = alias for stat-value */
.stat-number {
  font-size: 26px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 4px;
}

/* btn-secondary */
.btn-secondary       { background: #64748b; color: white; }
.btn-secondary:hover { background: #475569; }

/* tabs-nav (used in employee_view.php) */
.tabs-container { margin-top: 0; }
.tabs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0;
  background: white;
  padding: 12px 16px 0;
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
}
.tabs-nav .tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: -2px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: all .2s;
}
.tabs-nav .tab-btn:hover  { color: var(--primary); background: var(--bg); }
.tabs-nav .tab-btn.active { color: var(--primary); border-bottom-color: var(--accent); background: white; }

/* doc upload card */
.doc-upload-card {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: border-color .2s;
}
.doc-upload-card:hover { border-color: var(--primary-light); }

.doc-file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.doc-file-row .doc-icon  { font-size: 22px; flex-shrink: 0; }
.doc-file-row .doc-info  { flex: 1; min-width: 0; }
.doc-file-row .doc-name  { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-file-row .doc-meta  { font-size: 11px; color: var(--text-muted); }

/* =====================================================
   GLOBAL ACTION OVERLAY
   ===================================================== */
.global-action-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 35, 64, .48);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s ease, visibility .2s ease;
}

.global-action-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.global-action-overlay__dialog {
  width: min(420px, 100%);
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(15, 35, 64, .24);
  border: 1px solid rgba(226, 232, 240, .9);
  text-align: center;
  padding: 32px 24px;
}

.global-action-overlay__spinner {
  width: 54px;
  height: 54px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 4px solid rgba(26, 58, 92, .14);
  border-top-color: var(--accent);
  border-right-color: var(--primary);
  animation: hr-overlay-spin .85s linear infinite;
}

.global-action-overlay__title {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}

.global-action-overlay__subtitle {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-muted);
}

body.page-busy {
  overflow: hidden;
}

body.page-busy .sidebar,
body.page-busy .topbar,
body.page-busy .page-content,
body.page-busy .main-content,
body.page-busy .main-wrapper {
  pointer-events: none;
}

.is-loading {
  opacity: .7;
}

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

/* =====================================================
   UTILITIES
   ===================================================== */
.d-flex    { display: flex; }
.align-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-8   { margin-bottom: 8px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.text-warning{ color: var(--warning); }
.text-center { text-align: center; }
.text-sm     { font-size: 12.5px; }
.fw-700      { font-weight: 700; }
.fw-600      { font-weight: 600; }
.w-100       { width: 100%; }
.hidden      { display: none !important; }
