/* ==========================================================================
   NEXORA ERP — Core Design System
   Premium enterprise UI on top of Bootstrap 5.3
   ========================================================================== */

:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #EFF4FF;
  --secondary: #0F172A;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --bg-light: #F8FAFC;
  --card-bg: #FFFFFF;
  --border-color: #E7EBF3;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 10px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.10);
  --sidebar-width: 268px;
  --sidebar-collapsed: 84px;
  --header-height: 72px;
  --transition: all .2s ease;
  --sidebar-bg: #0F172A;
  --header-bg: linear-gradient(90deg, #0F172A 0%, #1E3A8A 100%);
  --app-font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---------- Dark mode variables ---------- */
[data-theme="dark"] {
  --bg-light: #0B1220;
  --card-bg: #121A2B;
  --border-color: #1F2937;
  --text-main: #E5E9F0;
  --text-muted: #94A3B8;
  --primary-light: #17233F;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  font-family: var(--app-font);
  background: var(--bg-light);
  color: var(--text-main);
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

a { text-decoration: none; }

h1, h2, h3, h4, h5, h6 { font-weight: 600; color: var(--text-main); }

.text-muted-soft { color: var(--text-muted) !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #2A374D; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 500;
  padding: .55rem 1.15rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  border: none;
}
.btn:active { transform: translateY(1px); }
.btn:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline-secondary { background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); box-shadow: none; }
.btn-light-soft { background: var(--primary-light); color: var(--primary); }

.btn-sm { padding: .35rem .8rem; font-size: .8rem; }

/* Loading button state */
.btn.is-loading { pointer-events: none; opacity: .85; position: relative; color: transparent !important; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  top: 50%; left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255,255,255,.55);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
}
.btn.is-loading.btn-outline-secondary::after,
.btn.is-loading.btn-light-soft::after { border-color: rgba(37,99,235,.35); border-top-color: var(--primary); }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   CARDS
   ========================================================================== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  border-radius: var(--radius) var(--radius) 0 0 !important;
}

/* Stat / KPI cards */
.stat-card {
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  min-width: 0;
  height: 100%;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card .stat-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.stat-card .stat-value {
  font-size: clamp(1rem, 2.4vw, 1.55rem);
  font-weight: 700;
  line-height: 1.25;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.stat-card .stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: .2rem;
}
.stat-card .stat-trend { font-size: .75rem; font-weight: 600; }

.dashboard-stat-row > [class*="col-"] {
  min-width: 0;
}

.icon-bg-primary { background: rgba(37,99,235,.12); color: var(--primary); }
.icon-bg-success { background: rgba(16,185,129,.12); color: var(--success); }
.icon-bg-danger  { background: rgba(239,68,68,.12); color: var(--danger); }
.icon-bg-warning { background: rgba(245,158,11,.12); color: var(--warning); }
.icon-bg-secondary { background: rgba(15,23,42,.08); color: var(--secondary); }

/* ==========================================================================
   BADGES
   ========================================================================== */
.badge-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  padding: .35em .85em;
  border-radius: 50px;
  font-size: .74rem;
  line-height: 1.2;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-pending   { background: rgba(245,158,11,.14); color: #B45309; }
.badge-approved  { background: rgba(37,99,235,.14); color: #1D4ED8; }
.badge-progress  { background: rgba(14,165,233,.16); color: #0369A1; }
.badge-completed { background: rgba(16,185,129,.14); color: #047857; }
.badge-cancelled { background: rgba(239,68,68,.14); color: #B91C1C; }

/* ==========================================================================
   FORMS — floating labels, icons, validation
   ========================================================================== */
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  padding: .65rem .9rem;
  font-size: .9rem;
  background: var(--card-bg);
  color: var(--text-main);
  transition: var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

.form-floating > label { color: var(--text-muted); }
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label { color: var(--primary); }

.required-mark::after { content: " *"; color: var(--danger); }

.input-icon-group { position: relative; }
.input-icon-group .input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: .9rem; z-index: 5;
}
.input-icon-group .form-control { padding-left: 2.4rem; }
.input-icon-group .toggle-password {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); cursor: pointer; font-size: .9rem; z-index: 5;
}

.invalid-feedback { font-size: .78rem; }
.valid-feedback { font-size: .78rem; color: var(--success); }

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

/* ==========================================================================
   AUTH LAYOUT (Login / Signup)
   ========================================================================== */
.auth-wrapper { min-height: 100vh; display: flex; background: var(--bg-light); }
.auth-illustration {
  flex: 1.05;
  background: linear-gradient(160deg, var(--secondary) 0%, #1E293B 55%, var(--primary-dark) 130%);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  color: #fff; padding: 3rem; position: relative; overflow: hidden;
}
.auth-illustration::before, .auth-illustration::after {
  content: ""; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.auth-illustration::before { width: 380px; height: 380px; top: -120px; right: -120px; }
.auth-illustration::after { width: 260px; height: 260px; bottom: -80px; left: -60px; background: rgba(37,99,235,.18); }
.auth-illustration .brand-mark {
  width: 56px; height: 56px; border-radius: 14px;
  background: rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin-bottom: 1.5rem;
  overflow: hidden;
}
.auth-illustration h2,
.auth-illustration h1 { color: #fff; }

body.auth-page {
  margin: 0;
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
html:has(body.auth-page) {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

.auth-wrapper--centered {
  min-height: 100vh;
  min-height: 100dvh;
  height: auto;
  overflow: visible;
  justify-content: center;
  align-items: center;
  align-items: safe center;
}
.auth-wrapper--centered .auth-form-side {
  flex: none;
  width: 100%;
  padding: 1rem;
}
.auth-wrapper--centered .auth-card {
  padding: 1.75rem 2rem;
}
.auth-wrapper--centered .auth-card.wide {
  max-width: 920px;
  padding: 1.15rem 1.5rem 1.05rem;
}
.auth-wrapper--centered .auth-card.wide .form-label {
  margin-bottom: .2rem;
}
.auth-wrapper--centered .auth-card.wide .form-control,
.auth-wrapper--centered .auth-card.wide .form-select {
  padding-top: .45rem;
  padding-bottom: .45rem;
}
.auth-form-side {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 2.5rem; background: var(--bg-light);
}
.auth-card {
  width: 100%; max-width: 460px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 2.5rem 2.25rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}
.auth-card.wide { max-width: 620px; }

@media (max-width: 767.98px) {
  body.auth-page,
  html:has(body.auth-page) {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .auth-wrapper--centered {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    align-items: flex-start;
    padding-block: .5rem env(safe-area-inset-bottom, .75rem);
  }
  .auth-wrapper--centered .auth-form-side {
    padding: .75rem;
    align-items: flex-start;
  }
  .auth-wrapper--centered .auth-card {
    padding: 1.35rem 1.1rem 1.25rem;
  }
  .auth-wrapper--centered .auth-card.wide {
    max-width: 100%;
    padding: 1.1rem .95rem 1.2rem;
  }
}

.plan-expired-card {
  position: relative;
  margin-bottom: 1.15rem;
  padding: 1rem 1rem 1.05rem;
  border-radius: 14px;
  color: #3b2208;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 214, 102, .45), transparent 55%),
    linear-gradient(145deg, #fff8e8 0%, #ffe8c2 55%, #ffd9a0 100%);
  border: 1px solid #e8b45a;
  box-shadow: 0 10px 24px rgba(180, 110, 12, .12);
  overflow: hidden;
}
.plan-expired-card::before {
  content: "";
  position: absolute;
  inset: auto -12px -18px auto;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: rgba(201, 124, 18, .12);
}
.plan-expired-card__badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .55rem;
  padding: .22rem .6rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #7a3e00;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(201, 124, 18, .35);
}
.plan-expired-card__title {
  margin: 0 0 .35rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: #7a2e00;
}
.plan-expired-card__copy,
.plan-expired-card__action {
  margin: 0;
  font-size: .82rem;
  line-height: 1.45;
}
.plan-expired-card__copy { color: #5c3a12; }
.plan-expired-card__action {
  margin-top: .55rem;
  padding-top: .55rem;
  border-top: 1px dashed rgba(201, 124, 18, .45);
  font-weight: 600;
  color: #8a3d00;
}

/* ==========================================================================
   APP SHELL — sidebar, header, footer
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: #CBD5E1;
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 1030;
  transition: width .22s ease, background .25s ease;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-brand {
  height: var(--header-height);
  display: flex; align-items: center; gap: .5rem;
  padding: 0 .7rem 0 .9rem;
  color: #fff; font-weight: 700; font-size: .88rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-brand-name {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.sidebar-brand .logo-box {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #60A5FA);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-brand .logo-box img {
  width: 100%; height: 100%; border-radius: inherit; object-fit: contain;
  background: #fff; padding: 3px;
}
.sidebar-toggle-btn {
  margin-left: auto; flex-shrink: 0;
  width: 34px; height: 34px; border: none; border-radius: 9px;
  background: rgba(255,255,255,.08); color: #CBD5E1;
  align-items: center; justify-content: center;
  font-size: .9rem; padding: 0; transition: var(--transition);
}
.sidebar-toggle-btn:hover { background: rgba(255,255,255,.16); color: #fff; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 0 .5rem; }
.sidebar.collapsed .sidebar-brand .logo-box { display: none; }
.sidebar.collapsed .sidebar-toggle-btn { margin-left: 0; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 1rem .75rem; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }

.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: .85rem;
  color: #94A3B8; padding: .68rem .9rem; border-radius: var(--radius-sm);
  font-size: .89rem; font-weight: 500; margin-bottom: .15rem;
  white-space: nowrap; overflow: hidden;
  transition: var(--transition);
}
.sidebar-nav .nav-link i.menu-icon { width: 18px; text-align: center; font-size: .95rem; flex-shrink: 0; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.sidebar-nav .nav-link .chevron { margin-left: auto; font-size: .7rem; transition: transform .2s; }
.sidebar-nav .nav-link[aria-expanded="true"] .chevron { transform: rotate(90deg); }

.sidebar-nav .submenu { padding-left: 2.15rem; }
.sidebar-nav .submenu .nav-link { padding: .5rem .7rem; font-size: .84rem; }

.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-link .chevron { display: none; }
.sidebar.collapsed .sidebar-nav .submenu { display: none !important; }
.sidebar.collapsed .nav-link { justify-content: center; }

.sidebar-footer {
  padding: .9rem 1rem; border-top: 1px solid rgba(255,255,255,.08);
  font-size: .72rem; color: #64748B; flex-shrink: 0;
}

/* ---- Main content offset ---- */
.main-wrapper {
  flex: 1; margin-left: var(--sidebar-width);
  display: flex; flex-direction: column; min-height: 100vh;
  transition: margin-left .22s ease;
  width: calc(100% - var(--sidebar-width));
}
.sidebar.collapsed ~ .main-wrapper { margin-left: var(--sidebar-collapsed); width: calc(100% - var(--sidebar-collapsed)); }

/* ---- Top Header ---- */
.topbar {
  height: var(--header-height);
  background: var(--header-bg);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; position: sticky; top: 0; z-index: 1020;
  box-shadow: var(--shadow-sm);
  transition: background .25s ease;
}
.topbar .btn-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.08); color: #fff; border: none; box-shadow: none;
}
.topbar .btn-icon:hover { background: rgba(255,255,255,.16); box-shadow: none; }
.topbar .search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.topbar .search-wrap .search-toggle {
  flex-shrink: 0;
}
.topbar .search-wrap .search-field {
  position: relative;
  display: none;
  align-items: center;
}
.topbar .search-wrap.is-open .search-toggle {
  display: none;
}
.topbar .search-wrap.is-open .search-field {
  display: flex;
}
.topbar .global-search {
  background: rgba(255,255,255,.09); border: none; border-radius: 50px;
  color: #fff; padding: .5rem 2.2rem .5rem 2.4rem; width: 280px; font-size: .85rem;
  transition: width .2s ease, background .15s ease;
}
.topbar .global-search::placeholder { color: #CBD5E1; }
.topbar .global-search:focus { background: rgba(255,255,255,.14); outline: none; box-shadow: none; color: #fff; }
.topbar .search-field-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: #CBD5E1; pointer-events: none; z-index: 1; font-size: .85rem;
}
.topbar .search-close {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #E2E8F0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .75rem; line-height: 1; z-index: 2; padding: 0;
}
.topbar .search-close:hover { background: rgba(255,255,255,.22); color: #fff; }
.topbar .search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; min-width: 280px;
  background: var(--card-bg); border: 1px solid var(--border-color);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-height: 320px; overflow-y: auto; z-index: 1050; padding: .35rem;
}
.topbar .search-results[hidden] { display: none !important; }
.topbar .search-result-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem .75rem; border-radius: var(--radius-sm);
  color: var(--text-main); text-decoration: none; cursor: pointer;
}
.topbar .search-result-item:hover,
.topbar .search-result-item.is-active {
  background: var(--primary-light); color: var(--primary);
}
.topbar .search-result-item .result-icon {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary); font-size: .85rem;
}
.topbar .search-result-item .result-label { font-size: .85rem; font-weight: 500; line-height: 1.2; }
.topbar .search-result-item .result-group { font-size: .72rem; color: var(--text-muted); margin-top: 1px; }
.topbar .search-empty {
  padding: .75rem; text-align: center; font-size: .82rem; color: var(--text-muted);
}
.topbar .company-name { color: #fff; font-weight: 600; font-size: .95rem; }
.topbar .fy-select {
  background: rgba(255,255,255,.09); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: .4rem .7rem; font-size: .8rem;
}
.notif-badge-dot {
  position: absolute; top: 4px; right: 5px; width: 8px; height: 8px;
  background: var(--danger); border-radius: 50%; border: 2px solid var(--secondary);
}
.profile-chip {
  display: flex; align-items: center; gap: .55rem; cursor: pointer;
  background: transparent; border: none; padding: .2rem .15rem; border-radius: var(--radius-sm);
}
.profile-chip:hover,
.profile-chip[aria-expanded="true"] { background: rgba(255,255,255,.1); }
.profile-chip .avatar {
  width: 38px; height: 38px; border-radius: 10px; object-fit: cover;
  background: rgba(255,255,255,.15);
}
.profile-chip .user-name { color: #fff; font-size: .85rem; font-weight: 600; line-height: 1.1; }
.profile-chip .user-role { color: #CBD5E1; font-size: .72rem; }
.profile-chip-caret {
  color: rgba(255,255,255,.75); font-size: .68rem;
  transition: transform .2s ease;
}
.profile-chip[aria-expanded="true"] .profile-chip-caret { transform: rotate(180deg); }

.dropdown-menu { border-radius: var(--radius); border: 1px solid var(--border-color); box-shadow: var(--shadow-lg); }

/* ---- User menu dropdown ---- */
.user-menu {
  width: 220px;
  padding: .45rem;
  margin-top: .5rem !important;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}
.user-menu-head {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .55rem .7rem;
  margin-bottom: .2rem;
  border-bottom: 1px solid var(--border-color);
}
.user-menu-head img {
  width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.user-menu-head strong {
  display: block;
  font-size: .84rem; font-weight: 600; color: var(--text-main);
  line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 140px;
}
.user-menu-head small {
  display: block;
  font-size: .7rem; color: var(--text-muted); margin-top: 1px;
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  padding: .62rem .7rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  font-size: .86rem;
  font-weight: 500;
  text-align: left;
  transition: background .15s ease;
}
.user-menu-item i {
  width: 1rem;
  text-align: center;
  font-size: .9rem;
  color: #475569;
}
.user-menu-item:hover {
  background: #F1F5F9;
  color: #0F172A;
}
.user-menu-sep {
  height: 1px;
  margin: .25rem .4rem;
  background: var(--border-color);
}
.user-menu-item.is-logout {
  color: #EF4444;
}
.user-menu-item.is-logout i { color: #EF4444; }
.user-menu-item.is-logout:hover {
  background: #FEF2F2;
  color: #DC2626;
}
[data-theme="dark"] .user-menu-item { color: var(--text-main); }
[data-theme="dark"] .user-menu-item i { color: var(--text-muted); }
[data-theme="dark"] .user-menu-item:hover { background: var(--primary-light); }
[data-theme="dark"] .user-menu-item.is-logout:hover { background: rgba(239, 68, 68, 0.12); }
.notif-item { display: flex; gap: .75rem; padding: .7rem .9rem; border-radius: var(--radius-sm); }
.notif-item:hover { background: var(--primary-light); }
.notif-item .notif-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ---- Content area ---- */
.content-area { padding: 1.6rem; flex: 1; }

/* ---- Footer ---- */
.app-footer {
  padding: 1rem 1.6rem; border-top: 1px solid var(--border-color);
  background: var(--card-bg); font-size: .8rem; color: var(--text-muted);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
}

/* ---- Layout customizer: fixed / scroll modes ---- */
html.layout-header-scroll .topbar {
  position: relative;
  top: auto;
}

html.layout-sidebar-scroll .sidebar {
  position: relative;
  height: auto;
  min-height: 100vh;
  align-self: stretch;
  flex-shrink: 0;
}
html.layout-sidebar-scroll .main-wrapper,
html.layout-sidebar-scroll .sidebar.collapsed ~ .main-wrapper {
  margin-left: 0;
  width: auto;
  flex: 1;
  min-width: 0;
}

html.layout-footer-fixed .app-footer {
  position: sticky;
  bottom: 0;
  z-index: 1010;
  box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.06);
}
html.layout-footer-scroll .app-footer {
  position: relative;
  bottom: auto;
  box-shadow: none;
}

@media (max-width: 991.98px) {
  html.layout-sidebar-scroll .sidebar {
    position: fixed;
    height: auto;
    min-height: 0;
    top: 0; bottom: 0;
  }
}

/* ==========================================================================
   TABLES
   ========================================================================== */
.table-card { padding: 0; overflow: hidden; }
table.dataTable { border-collapse: separate !important; border-spacing: 0; }
table.dataTable thead th {
  background: var(--primary-light);
  color: var(--secondary);
  font-size: .78rem; text-transform: uppercase; letter-spacing: .03em;
  border-bottom: none !important; position: sticky; top: 0;
  padding: .85rem 1rem;
}
[data-theme="dark"] table.dataTable thead th { color: var(--text-main); }
table.dataTable tbody td { padding: .85rem 1rem; font-size: .87rem; vertical-align: middle; border-bottom: 1px solid var(--border-color); }
table.dataTable tbody tr:hover { background: var(--primary-light); }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select { border-radius: var(--radius-sm); border: 1px solid var(--border-color); padding: .4rem .7rem; }
.dataTables_wrapper .dataTables_paginate .page-item .page-link { border-radius: 8px !important; margin: 0 2px; border: 1px solid var(--border-color); color: var(--text-main); }
.dataTables_wrapper .dataTables_paginate .page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ==========================================================================
   QUICK ACTIONS
   ========================================================================== */
.quick-action-btn {
  display: flex; flex-direction: column; align-items: center; gap: .55rem;
  padding: 1.1rem .75rem; border-radius: var(--radius);
  background: var(--card-bg); border: 1px solid var(--border-color);
  color: var(--text-main); font-size: .8rem; font-weight: 500;
  transition: var(--transition); width: 100%;
}
.quick-action-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); color: var(--primary); border-color: var(--primary); }
.quick-action-btn .qa-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}

/* ==========================================================================
   MISC / RESPONSIVE
   ========================================================================== */
.chart-card canvas { max-height: 300px; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0 !important; width: 100% !important; }
  .topbar .global-search { width: 200px; }
  .sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 1025;
  }
  .sidebar-backdrop.show { display: block; }
}

@media (max-width: 575.98px) {
  .content-area { padding: 1rem; }
  .topbar { padding: 0 .85rem; }
  .topbar .company-name, .topbar .fy-select { display: none; }
}
