/* ============================================================
   style.css — ERP HRM Design System
   RAK Engineering And Automation
   ============================================================ */

/* ---- CSS Variables: Dark Theme (default) ---- */
:root,
[data-theme="dark"] {
  --bg-base:       #0f1117;
  --bg-surface:    #1a1d27;
  --bg-card:       #1e2130;
  --bg-hover:      #252840;
  --bg-input:      #252840;
  --border:        #2d3148;
  --border-focus:  #6366f1;

  --text-primary:  #e2e8f0;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;
  --text-inverse:  #0f1117;

  --accent:        #6366f1;
  --accent-hover:  #4f46e5;
  --accent-light:  rgba(99,102,241,0.15);

  --red:           #ef4444;
  --red-hover:     #dc2626;
  --red-light:     rgba(239,68,68,0.15);

  --green:         #10b981;
  --green-light:   rgba(16,185,129,0.15);

  --yellow:        #f59e0b;
  --yellow-light:  rgba(245,158,11,0.15);

  --blue:          #3b82f6;
  --blue-light:    rgba(59,130,246,0.15);

  --purple:        #8b5cf6;
  --cyan:          #06b6d4;
  --pink:          #ec4899;

  --sidebar-w:     260px;
  --topbar-h:      64px;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.3);
  --transition:    0.2s ease;

  --scrollbar-thumb: #2d3148;
  --scrollbar-track: #1a1d27;
}

/* ---- Light Theme ---- */
[data-theme="light"] {
  --bg-base:       #f1f5f9;
  --bg-surface:    #ffffff;
  --bg-card:       #ffffff;
  --bg-hover:      #f8fafc;
  --bg-input:      #f8fafc;
  --border:        #e2e8f0;
  --border-focus:  #6366f1;

  --text-primary:  #1e293b;
  --text-secondary:#475569;
  --text-muted:    #94a3b8;
  --text-inverse:  #ffffff;

  --accent:        #6366f1;
  --accent-hover:  #4f46e5;
  --accent-light:  rgba(99,102,241,0.1);

  --red:           #ef4444;
  --red-hover:     #dc2626;
  --red-light:     rgba(239,68,68,0.1);

  --green:         #10b981;
  --green-light:   rgba(16,185,129,0.1);

  --yellow:        #f59e0b;
  --yellow-light:  rgba(245,158,11,0.1);

  --blue:          #3b82f6;
  --blue-light:    rgba(59,130,246,0.1);

  --shadow:        0 4px 24px rgba(0,0,0,0.08);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.06);

  --scrollbar-thumb: #cbd5e1;
  --scrollbar-track: #f1f5f9;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; }
ul { list-style: none; }
input, select, textarea, button { font-family: inherit; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-wrapper { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
  overflow: hidden;
}
.sidebar-header {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}
.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 0.9rem;
  flex-shrink: 0;
}
.sidebar-logo .logo-text span { color: var(--accent); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: visible;
  padding: 12px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 16px 20px 6px;
}

.nav-item {
  position: relative;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--text-secondary);
  border-radius: 0;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}
.nav-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-link.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-link .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}
.nav-link.active .nav-icon { opacity: 1; }
.nav-link .nav-arrow {
  margin-left: auto;
  width: 14px; height: 14px;
  transition: transform var(--transition);
  opacity: 0.5;
}
.nav-item.open > .nav-link .nav-arrow { transform: rotate(90deg); }

.nav-submenu {
  display: none;
  background: var(--bg-hover);
  border-left: 2px solid var(--accent-light);
  margin-left: 20px;
}
.nav-item.open > .nav-submenu { display: block; }
.nav-submenu .nav-link {
  padding: 7px 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.nav-submenu .nav-link:hover { color: var(--text-primary); }
.nav-submenu .nav-link.active { color: var(--accent); }

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 1001;
  overflow: visible;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.sidebar-user:hover { background: var(--bg-hover); }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 0.85rem;
  flex-shrink: 0;
}
.user-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.user-info { flex: 1; overflow: hidden; }
.user-name { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.7rem; color: var(--text-muted); text-transform: capitalize; }

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Topbar ---- */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0; z-index: 900;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}
.topbar-toggle {
  display: none;
  background: none; border: none;
  color: var(--text-secondary);
  cursor: pointer; padding: 6px;
  border-radius: var(--radius-sm);
}
.topbar-toggle:hover { background: var(--bg-hover); }

.topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 16px 8px 40px;
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: border-color var(--transition);
  outline: none;
}
.topbar-search input:focus { border-color: var(--border-focus); }
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px; height: 16px;
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.topbar-btn {
  width: 36px; height: 36px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: all var(--transition);
}
.topbar-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.topbar-btn svg { width: 18px; height: 18px; }
.badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 16px; height: 16px;
  background: var(--red);
  border-radius: 8px;
  font-size: 0.6rem;
  font-weight: 700;
  color: white;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

.topbar-divider { width: 1px; height: 24px; background: var(--border); }

.theme-toggle {
  width: 52px; height: 26px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 13px;
  cursor: pointer;
  position: relative;
  transition: background var(--transition);
}
.theme-toggle::after {
  content: '';
  width: 20px; height: 20px;
  background: var(--accent);
  border-radius: 50%;
  position: absolute;
  top: 2px; left: 2px;
  transition: transform var(--transition);
}
[data-theme="light"] .theme-toggle::after { transform: translateX(26px); }
.theme-toggle .theme-icon {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  font-size: 10px;
}
.theme-toggle .icon-dark { left: 5px; }
.theme-toggle .icon-light { right: 5px; }

/* ---- Page Content ---- */
.page-content { padding: 24px; flex: 1; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { opacity: 0.4; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title svg { width: 16px; height: 16px; color: var(--accent); }
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-hover);
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-color, var(--accent));
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--stat-bg, var(--accent-light));
  flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; color: var(--stat-color, var(--accent)); }
.stat-info { flex: 1; }
.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.stat-change {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.data-table th {
  background: var(--bg-hover);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg-hover); }
.data-table .text-right { text-align: right; }
.data-table .text-center { text-align: center; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 18px;
}
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-label .req { color: var(--red); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { opacity: 0.5; cursor: not-allowed; }
select.form-control { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 0.74rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.74rem; color: var(--red); margin-top: 4px; }
.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; white-space: nowrap; }
.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary   { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); color: white; }
.btn-danger    { background: var(--red); color: white; }
.btn-danger:hover { background: var(--red-hover); color: white; }
.btn-success   { background: var(--green); color: white; }
.btn-warning   { background: var(--yellow); color: #1e293b; }
.btn-secondary { background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text-primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-outline { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-outline:hover { background: var(--accent); color: white; }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-lg { padding: 12px 24px; font-size: 0.9rem; }
.btn-icon { width: 34px; height: 34px; padding: 0; }
.btn-block { width: 100%; }

/* ============================================================
   BADGES & STATUS
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}
.chip-accent  { background: var(--accent-light);  color: var(--accent); }
.chip-green   { background: var(--green-light);   color: var(--green); }
.chip-red     { background: var(--red-light);     color: var(--red); }
.chip-yellow  { background: var(--yellow-light);  color: var(--yellow); }
.chip-blue    { background: var(--blue-light);    color: var(--blue); }
.chip-muted   { background: var(--bg-hover);      color: var(--text-muted); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}
.modal-lg { max-width: 860px; }
.modal-xl { max-width: 1100px; }
@keyframes modalIn { from { opacity:0; transform: translateY(-20px) scale(0.97); } to { opacity:1; transform: none; } }
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 22px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-hover);
}

/* ============================================================
   ALERTS / TOASTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.alert-success { background: var(--green-light); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.alert-danger  { background: var(--red-light);   color: var(--red);   border: 1px solid rgba(239,68,68,0.3); }
.alert-warning { background: var(--yellow-light); color: var(--yellow); border: 1px solid rgba(245,158,11,0.3); }
.alert-info    { background: var(--blue-light);  color: var(--blue);  border: 1px solid rgba(59,130,246,0.3); }

.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease;
}
@keyframes toastIn { from { opacity:0; transform:translateX(100%); } to { opacity:1; transform:none; } }
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.warning { border-left: 3px solid var(--yellow); }
.toast .toast-msg { font-size: 0.83rem; color: var(--text-primary); flex: 1; }
.toast .toast-close { background: none; border: none; color: var(--text-muted); cursor: pointer; }

/* ============================================================
   TABS
   ============================================================ */
.tabs { border-bottom: 1px solid var(--border); display: flex; gap: 0; margin-bottom: 24px; }
.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.page-btn {
  min-width: 32px; height: 32px;
  padding: 0 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}
.page-btn:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }
.page-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.grid { display: grid; }
.grid-2 { grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4,1fr); gap: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; align-items: center; gap: 8px; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .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; }
.p-0 { padding: 0; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-sm { font-size: 0.78rem; }
.text-xs { font-size: 0.72rem; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-full { width: 100%; }
.hidden { display: none; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.auth-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 70%);
  top: -200px; right: -100px;
  pointer-events: none;
}
.auth-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(139,92,246,0.1) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  pointer-events: none;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 40px;
  position: relative;
  z-index: 1;
}
.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo .logo-circle {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  margin-bottom: 12px;
}
.auth-logo h1 { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.auth-logo p { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.auth-title { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.auth-subtitle { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 28px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 0.8rem; color: var(--text-muted); }
.password-wrapper { position: relative; }
.password-wrapper .form-control { padding-right: 44px; }
.password-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 2px;
}
.password-toggle:hover { color: var(--text-primary); }
.password-strength { margin-top: 6px; }
.strength-bar { height: 4px; background: var(--border); border-radius: 2px; margin-top: 4px; }
.strength-fill { height: 100%; border-radius: 2px; transition: width 0.3s, background 0.3s; }

/* ============================================================
   DROPDOWN MENUS
   ============================================================ */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  min-width: 200px;
  z-index: 9999;
  display: none;
  overflow: hidden;
}
.dropdown-menu.open { display: block; animation: dropIn 0.15s ease; }
@keyframes dropIn { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:none; } }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  color: var(--text-secondary);
  font-size: 0.83rem;
  cursor: pointer;
  transition: all var(--transition);
}
.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger:hover { background: var(--red-light); }
.dropdown-item svg { width: 15px; height: 15px; }
.dropdown-divider { border-top: 1px solid var(--border); margin: 4px 0; }

/* ============================================================
   SEARCH RESULTS DROPDOWN
   ============================================================ */
.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 1200;
  display: none;
  overflow: hidden;
  max-height: 360px;
  overflow-y: auto;
}
.search-results.open { display: block; }
.search-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-hover); }
.search-result-icon {
  width: 32px; height: 32px;
  background: var(--accent-light);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.search-result-icon svg { width: 14px; height: 14px; }
.search-result-info { flex: 1; overflow: hidden; }
.search-result-name { font-size: 0.83rem; font-weight: 500; color: var(--text-primary); }
.search-result-meta { font-size: 0.72rem; color: var(--text-muted); }

/* ============================================================
   CHARTS PLACEHOLDER
   ============================================================ */
.chart-container { position: relative; }
.chart-canvas { width: 100%; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; opacity: 0.3; margin-bottom: 12px; }
.empty-state h4 { font-size: 0.95rem; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 0.8rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 240px; }
  .form-row.cols-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }

  .main-content { margin-left: 0; }

  .topbar-toggle { display: flex; }
  .topbar-search { max-width: 200px; }

  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
  }
  .sidebar-overlay.open { display: block; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .form-row.cols-3, .form-row.cols-4 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
  .auth-card { padding: 28px 22px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row.cols-2 { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
}

/* ============================================================
   PAGE-SPECIFIC UNIQUE CLASSES
   ============================================================ */

/* Login Page */
.page-login .auth-card { animation: fadeUp 0.4s ease; }
@keyframes fadeUp { from { opacity:0; transform:translateY(24px); } to { opacity:1; transform:none; } }

/* Dashboard Page */
.page-dashboard .stat-card { cursor: default; }
.page-dashboard .chart-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 900px) { .page-dashboard .chart-row { grid-template-columns: 1fr; } }

/* Clients Page */
.page-clients .client-avatar {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-weight: 700; font-size: 0.8rem;
}

/* Users Page */
.page-users .role-badge { text-transform: capitalize; }

/* Master Page */
.page-master .master-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 16px; }

/* Profile Page */
.page-profile .profile-cover {
  height: 140px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: var(--radius) var(--radius) 0 0;
  position: relative;
}
.page-profile .profile-avatar-wrap {
  position: absolute; bottom: -28px; left: 24px;
}
.page-profile .profile-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 3px solid var(--bg-card);
  background: var(--bg-card);
  overflow: hidden;
}

/* 404 / Error Pages */
.page-error { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.page-error .error-code { font-size: 6rem; font-weight: 800; color: var(--accent); line-height: 1; }

/* ============================================================
   TOP-DROP — Dropdown from topbar (no overflow clipping issues)
   ============================================================ */
.top-drop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  z-index: 99999;
  overflow: hidden;
  animation: dropIn 0.15s ease;
}
.top-drop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 0.83rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}
.top-drop-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
#theme-dark-btn.theme-active,
#theme-light-btn.theme-active {
  background: var(--accent) !important;
  color: white !important;
  border-color: var(--accent) !important;
}

.theme-btn.theme-active { background: var(--accent) !important; color: white !important; border-color: var(--accent) !important; }
