:root {
  --bg-primary: #08121f;
  --bg-secondary: #0f1f32;
  --bg-card: #142840;
  --bg-card-hover: #19314e;
  --bg-sidebar: #0b1829;
  --accent: #f97316;
  --accent-light: #fb923c;
  --accent-dark: #ea580c;
  --accent-glow: rgba(249, 115, 22, 0.16);
  --blue: #38bdf8;
  --green: #22c55e;
  --red: #ef4444;
  --purple: #a78bfa;
  --cyan: #06b6d4;
  --text-primary: #e7eef9;
  --text-secondary: #bccbdf;
  --text-muted: #8aa0bd;
  --border: rgba(173, 216, 255, 0.15);
  --border-accent: rgba(249, 115, 22, 0.45);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-width: 272px;
  --transition: all 0.22s ease;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans Arabic", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-primary);
  background:
    radial-gradient(circle at 15% 12%, rgba(56, 189, 248, 0.14), transparent 30%),
    radial-gradient(circle at 86% 85%, rgba(249, 115, 22, 0.14), transparent 34%),
    linear-gradient(155deg, #07111d 0%, #0b1b2f 44%, #112841 100%);
}

html,
body {
  color-scheme: dark;
}

a {
  color: #8bc8ff;
}

a:hover {
  color: #b7ddff;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
}

::-webkit-scrollbar-thumb {
  background: rgba(142, 164, 195, 0.45);
  border-radius: 999px;
}

.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, rgba(11, 24, 41, 0.98), rgba(11, 24, 41, 0.9));
  border-left: 1px solid var(--border);
  overflow-y: auto;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #130c05;
  background: linear-gradient(135deg, var(--accent-light), var(--accent-dark));
  box-shadow: 0 8px 20px rgba(249, 115, 22, 0.34);
}

.logo-title {
  font-size: 15px;
  font-weight: 700;
}

.logo-sub {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.sidebar-section {
  padding: 14px 10px 2px;
}

.sidebar-section-label {
  margin: 0 8px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 10px;
  margin-bottom: 4px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid transparent;
  transition: var(--transition);
  position: relative;
}

.nav-item i {
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: rgba(173, 216, 255, 0.15);
}

.nav-item.active {
  background: rgba(249, 115, 22, 0.16);
  border-color: var(--border-accent);
  color: #ffd7bb;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 15%;
  width: 3px;
  height: 70%;
  border-radius: 4px;
  background: var(--accent);
}

.nav-badge {
  margin-right: auto;
  min-width: 20px;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 7px;
  color: #111827;
  background: var(--accent);
}

.nav-badge.blue {
  background: var(--blue);
  color: #04253c;
}

.nav-badge.green {
  background: var(--green);
  color: #042411;
}

.nav-badge.red {
  background: var(--red);
  color: #fff;
}

.nav-badge.new {
  color: #fff;
  background: linear-gradient(135deg, #a78bfa, #06b6d4);
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 12px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  padding: 10px;
  transition: var(--transition);
}

.user-profile:hover {
  background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #f97316, #8b5cf6);
  border: 2px solid rgba(249, 115, 22, 0.4);
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

.main {
  margin-right: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  padding: 10px 24px;
  background: rgba(10, 22, 37, 0.84);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
}

.content {
  flex: 1;
  padding: 20px;
}

.page {
  animation: pageIn 0.26s ease;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card,
.card,
.summary-card,
.emp-card,
.task-col,
.payroll-summary,
.wps-card,
.biometric-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(20, 40, 64, 0.95), rgba(20, 40, 64, 0.88));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  color: var(--text-primary);
}

.card,
.summary-card,
.stat-card {
  padding: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}

.grid-2,
.grid-3,
.grid-70-30,
.summary-grid,
.form-grid,
.task-board {
  gap: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 16px;
}

.grid-70-30 {
  display: grid;
  grid-template-columns: 1fr 340px;
  margin-bottom: 16px;
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  background: rgba(8, 18, 31, 0.44);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  background: transparent;
}

th,
td {
  padding: 11px 12px;
  text-align: right;
  white-space: normal;
  word-break: break-word;
  border-bottom: 1px solid rgba(173, 216, 255, 0.1);
}

th {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  background: rgba(8, 18, 31, 0.65);
  position: sticky;
  top: 0;
}

td {
  color: #d3def0;
  font-size: 13px;
}

.grid-2 .table-wrap table {
  min-width: 0;
}

.grid-2 .table-wrap th,
.grid-2 .table-wrap td {
  padding: 10px;
  font-size: 12.5px;
}

tr:nth-child(odd) td {
  background: rgba(255, 255, 255, 0.015);
}

tr:hover td {
  background: rgba(249, 115, 22, 0.08);
}

label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
}

input,
select,
textarea,
.form-control,
.chat-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(8, 18, 31, 0.62);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 12px;
  transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus,
.chat-input:focus,
.topbar-search:focus-within {
  outline: none;
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16);
}

button,
.btn,
input[type="submit"],
input[type="button"] {
  border: 1px solid transparent;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #140f08;
  font-weight: 700;
  font-family: inherit;
  padding: 9px 14px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

button:hover,
.btn:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
}

.btn-warn {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #271507;
}

.flash {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
  border: 1px solid transparent;
}

.flash.success {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.35);
  color: #bbf7d0;
}

.flash.error {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border: 1px solid transparent;
}

.status-pill.success,
.badge-green {
  color: #86efac;
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.35);
}

.status-pill.warn,
.badge-amber {
  color: #fdba74;
  background: rgba(249, 115, 22, 0.14);
  border-color: rgba(249, 115, 22, 0.35);
}

.status-pill.danger,
.badge-red {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
}

.status-pill.info,
.badge-blue {
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.35);
}

.badge-purple {
  color: #d8b4fe;
  background: rgba(167, 139, 250, 0.14);
  border-color: rgba(167, 139, 250, 0.35);
}

.badge-gray {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.35);
}

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(8, 18, 31, 0.52);
  border: 1px solid var(--border);
}

.tab-btn {
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 12px;
}

.tab-btn.active {
  border-color: var(--border-accent);
  background: rgba(249, 115, 22, 0.12);
  color: #ffd7bb;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(8, 18, 31, 0.62);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  width: 290px;
}

.topbar-search input {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text-primary);
  -webkit-box-shadow: 0 0 0 1000px rgba(8, 18, 31, 0.95) inset;
  transition: background-color 9999s ease-in-out 0s;
}

.card *,
.summary-card *,
.stat-card * {
  color: inherit;
}

.topbar-search i {
  color: var(--text-muted);
  font-size: 13px;
}

.muted {
  color: var(--text-muted);
}

@media (max-width: 1160px) {
  .grid-2,
  .grid-3,
  .grid-70-30,
  .task-board,
  .chat-layout,
  .payroll-breakdown {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-left: 0;
    border-bottom: 1px solid var(--border);
  }

  .main {
    margin-right: 0;
  }

  .topbar {
    flex-wrap: wrap;
    padding: 10px 14px;
  }

  .topbar > div:first-child,
  .topbar .btn {
    width: 100%;
  }

  .content {
    padding: 14px;
  }

  table {
    min-width: 540px;
  }
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .card,
  .stat-card,
  .summary-card {
    padding: 12px;
  }

  .logo {
    padding: 14px;
  }

  .sidebar-section {
    padding: 10px 8px 2px;
  }
}
