/* ================================================
   SmartERP - Main Stylesheet
   Design: Clean Modern ERP Dashboard
   ================================================ */

/* ---- CSS Variables ---- */
:root {
  --p: #0f3460;
  --p2: #16213e;
  --acc: #0ea5e9;
  --acc2: #38bdf8;
  --bg: #f0f4f8;
  --card: #ffffff;
  --primary: #0f3460;
  --primary-dark: #16213e;
  --primary-light: #eff6ff;
  --text: #1e293b;
  --text-muted: #475569;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --topbar-height: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(15,52,96,.12);
  --shadow-lg: 0 10px 25px -5px rgba(15,52,96,.15);
  --transition: all .2s ease-in-out;
  --font: 'Noto Sans Thai', 'Inter', system-ui, -apple-system, sans-serif;

  --success: #15803d;
  --warning: #b45309;
  --danger: #dc2626;
  --info: #0891b2;
  --purple: #7c3aed;
}

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

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ================================================
   LAYOUT
   ================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--p2);
  border-right: 1px solid rgba(255,255,255,.1);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: var(--transition);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

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

.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.page-content {
  flex: 1;
  padding: 24px;
  padding-top: calc(var(--topbar-height) + 24px);
}

/* Collapsed Sidebar */
body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
body.sidebar-collapsed .main-content { margin-left: var(--sidebar-collapsed); }
body.sidebar-collapsed .logo-text,
body.sidebar-collapsed .sidebar-user-info,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .nav-arrow,
body.sidebar-collapsed .nav-section-title,
body.sidebar-collapsed .nav-submenu { display: none !important; }
body.sidebar-collapsed .sidebar-user { justify-content: center; padding: 12px; }
body.sidebar-collapsed .sidebar-logo { justify-content: center; }
body.sidebar-collapsed .logo-icon { margin: 0; }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 12px; }
body.sidebar-collapsed .nav-icon { margin: 0; }

/* ================================================
   SIDEBAR
   ================================================ */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: var(--topbar-height);
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.logo-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,.1);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.2);
}

.logo-name {
  font-size: 1.1rem;
  color: #fff;
  letter-spacing: -.3px;
}
.logo-name strong { color: var(--acc2); }
.logo-version {
  display: block;
  font-size: 0.7rem;
  color: rgba(255,255,255,.5);
  margin-top: -2px;
}

.sidebar-close-btn {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: 1px solid rgba(255,255,255,.2); border-radius: 8px;
  width: 30px; height: 30px; cursor: pointer; color: rgba(255,255,255,.6);
  display: flex; align-items: center; justify-content: center;
}

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; margin: 16px 16px 8px;
  background: rgba(255,255,255,.05);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.08);
}
.sidebar-user-avatar {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.15);
  border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.2);
}
.sidebar-user-name { display: block; font-weight: 600; font-size: 0.85rem; color: #fff; }
.sidebar-user-role { display: block; font-size: 0.72rem; color: rgba(255,255,255,.6); }

.sidebar-divider { height: 1px; background: rgba(255,255,255,.1); margin: 8px 16px; }

/* Nav */
.sidebar-nav { flex: 1; padding: 0 10px; overflow-y: auto; overflow-x: hidden; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }
.nav-section-title {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1px;
  color: rgba(255,255,255,.4); padding: 12px 10px 6px; font-weight: 600;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.7); font-size: 0.85rem; font-weight: 500;
  cursor: pointer; transition: var(--transition); margin-bottom: 4px;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; box-shadow: inset 2px 0 0 var(--acc2); }
.nav-item.active .nav-icon { color: #fff; }

.nav-icon { width: 20px; text-align: center; font-size: 0.9rem; flex-shrink: 0; color: rgba(255,255,255,.5); }
.nav-item.active .nav-icon { color: #fff; }

.nav-arrow { margin-left: auto; font-size: 0.7rem; transition: var(--transition); color: rgba(255,255,255,.5); }
.nav-item-dropdown[aria-expanded="true"] .nav-arrow { transform: rotate(180deg); }
.nav-item-dropdown.active .nav-arrow { color: #fff; }

.nav-submenu { 
  padding-left: 0; 
  margin-left: 22px; 
  margin-top: 4px; 
  margin-bottom: 8px;
  border-left: 1px dashed rgba(255,255,255,.15); 
  display: flex; flex-direction: column; gap: 2px;
}
.nav-subitem {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px 7px 16px; 
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: rgba(255,255,255,.6); font-size: 0.82rem;
  transition: var(--transition);
  position: relative;
  margin-left: -1px;
  border-left: 2px solid transparent;
}
.nav-subitem:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-subitem.active { 
  background: linear-gradient(90deg, rgba(14,165,233,.15) 0%, transparent 100%); 
  color: #fff; 
  font-weight: 600; 
  border-left-color: var(--acc2); 
}
.nav-subitem.active i { color: var(--acc2); }
.nav-subitem i { width: 16px; text-align: center; font-size: 0.75rem; transition: var(--transition); }

.sidebar-footer { padding: 12px 10px; border-top: 1px solid rgba(255,255,255,.1); }
.logout-btn { color: #fca5a5 !important; }
.logout-btn:hover { background: rgba(239,68,68,.15) !important; color: #fecaca !important; }

/* Sidebar Overlay */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 999; backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ================================================
   TOPBAR
   ================================================ */
.topbar {
  position: fixed; top: 0; left: var(--sidebar-width); right: 0;
  height: var(--topbar-height);
  background: linear-gradient(135deg, var(--p2) 0%, var(--p) 60%, #1a4a8a 100%);
  box-shadow: 0 2px 16px rgba(15,52,96,.4);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; z-index: 900; transition: var(--transition);
  color: #fff;
}
body.sidebar-collapsed .topbar { left: var(--sidebar-collapsed); }

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-toggle {
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.28); border-radius: 9px;
  width: 36px; height: 36px; cursor: pointer;
  color: #fff; transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.topbar-toggle:hover { background: rgba(255,255,255,.25); }

.topbar-breadcrumb .breadcrumb { font-size: 0.82rem; margin-bottom: 0; }
.topbar-breadcrumb .breadcrumb-item a { color: rgba(255,255,255,.72); }
.topbar-breadcrumb .breadcrumb-item.active { color: #fff; font-weight: 500; }
.breadcrumb-item + .breadcrumb-item::before { color: rgba(255,255,255,.5); }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius-sm); padding: 6px 12px;
  font-size: 0.82rem; color: #fff; transition: var(--transition);
}
.topbar-search:focus-within { border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.2); box-shadow: 0 0 0 3px rgba(255,255,255,.1); }
.topbar-search input { border: none; background: none; outline: none; color: #fff; font-family: var(--font); font-size: 0.82rem; width: 180px; }
.topbar-search input::placeholder { color: rgba(255,255,255,.6); }

.icon-btn {
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.2);
  border-radius: 9px; width: 36px; height: 36px;
  cursor: pointer; color: #fff; transition: var(--transition);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.icon-btn:hover { background: rgba(255,255,255,.25); border-color: rgba(255,255,255,.3); }
.badge-dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--danger);
  border: 1.5px solid white;
}

/* Notification Dropdown */
.notif-dropdown {
  width: 340px; padding: 0; border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); border-radius: var(--radius); overflow: hidden; color: var(--text); background: white;
}
.notif-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 0.875rem;
}
.notif-mark-all { font-size: 0.78rem; color: var(--primary); font-weight: 500; }
.notif-list { max-height: 280px; overflow-y: auto; }
.notif-item {
  display: flex; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); transition: var(--transition);
}
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: #fafbff; }
.notif-item-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.notif-item-title { font-size: 0.82rem; font-weight: 600; color: var(--text); margin: 0 0 2px; }
.notif-item-text { font-size: 0.76rem; color: var(--text-muted); margin: 0 0 4px; }
.notif-item-time { font-size: 0.7rem; color: var(--text-muted); }
.notif-footer { padding: 10px 16px; text-align: center; border-top: 1px solid var(--border); font-size: 0.82rem; color: var(--primary); }
.notif-footer a:hover { opacity: .8; }

/* Profile Button */
.profile-btn {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.2);
  border-radius: 9px; padding: 4px 10px 4px 4px;
  cursor: pointer; transition: var(--transition); color: #fff;
}
.profile-btn:hover { background: rgba(255,255,255,.25); border-color: rgba(255,255,255,.3); }
.profile-avatar {
  width: 28px; height: 28px;
  background: #fff;
  border-radius: 50%; color: var(--p);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.78rem;
}
.profile-name { display: block; font-size: 0.82rem; font-weight: 600; line-height: 1.2; }
.profile-role { display: block; font-size: 0.7rem; color: rgba(255,255,255,.7); }
.profile-btn > .fa-chevron-down { font-size: 0.7rem; color: rgba(255,255,255,.7); }

.profile-dropdown { 
  width: 250px; padding: 8px; border: 1px solid rgba(0,0,0,.08); 
  box-shadow: 0 12px 36px rgba(15,52,96,.12); border-radius: 16px; 
  background: white; color: var(--text); margin-top: 10px !important;
}
.profile-dropdown-header { 
  display: flex; gap: 12px; align-items: center; padding: 12px; 
  background: transparent; border-bottom: 1px dashed var(--border);
  margin-bottom: 8px;
}
.profile-dropdown-avatar {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--acc), #0284c7);
  border-radius: 50%; color: white; border: 2px solid var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem; flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(14,165,233,.2);
}
.profile-dropdown-header p { font-size: 0.95rem; color: var(--text); }
.profile-dropdown-header small { font-size: 0.75rem; color: var(--text-light); }

.profile-dropdown .dropdown-item { 
  padding: 8px 14px; font-size: 0.85rem; font-weight: 500; 
  color: var(--text-muted); border-radius: 10px; transition: var(--transition);
  display: flex; align-items: center; margin-bottom: 2px;
}
.profile-dropdown .dropdown-item:hover { background: var(--primary-light); color: var(--primary); }
.profile-dropdown .dropdown-item.text-danger:hover { background: #fef2f2 !important; color: var(--danger) !important; }
.profile-dropdown .dropdown-item i { width: 18px; text-align: center; }

.profile-dropdown .dropdown-divider { margin: 6px 10px; border-color: rgba(0,0,0,.04); }

/* ================================================
   PAGE HEADER (Deprecated) -> CONTROL BAR
   ================================================ */
.page-header { display: none; }
.tab-nav { display: none; }

.ctrl-bar {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.ctrl-bar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding-right: 16px;
  border-right: 1px solid var(--border);
}

.period-grp {
  display: flex; align-items: center; gap: 4px;
}
.period-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px;
  font-size: 0.85rem; font-weight: 600;
  color: var(--text-muted); cursor: pointer; transition: var(--transition);
  border: 1px solid transparent; background: transparent;
}
.period-btn:hover { background: var(--bg); color: var(--text); }
.period-btn.active { background: var(--primary-light); color: var(--primary); border-color: var(--acc2); }

.stat-pills {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.stat-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 4px 12px; font-size: 0.8rem; font-weight: 600;
  white-space: nowrap;
}
.stat-pill i { font-size: 0.85rem; color: var(--acc); }
.stat-pill b { color: var(--primary); font-weight: 800; font-size: 0.85rem; }

.ctrl-div { width: 1px; height: 30px; background: var(--border); margin: 0 4px; }

.action-grp {
  display: flex; align-items: center; gap: 8px; margin-left: auto;
}

/* ================================================
   BUTTONS
   ================================================ */
.btn-primary-custom {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, var(--acc), #0284c7);
  color: white; border: none; padding: 8px 18px; border-radius: 9px;
  font-size: 0.875rem; font-weight: 700; cursor: pointer; transition: var(--transition);
  font-family: var(--font); box-shadow: 0 2px 8px rgba(14,165,233,.35); white-space: nowrap;
}
.btn-primary-custom:hover { background: linear-gradient(135deg, var(--acc2), var(--acc)); transform: translateY(-1px); }
.btn-primary-custom:active { transform: translateY(0); }

.btn-outline-primary-custom {
  display: inline-flex; align-items: center; gap: 6px;
  background: white; color: var(--primary); border: 1.5px solid #bfdbfe !important;
  padding: 8px 18px; border-radius: 9px;
  font-size: 0.875rem; font-weight: 700; cursor: pointer; transition: var(--transition);
  font-family: var(--font); white-space: nowrap;
}
.btn-outline-primary-custom:hover { background: var(--primary-light); }

.btn-sm-custom {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--primary-light); color: var(--primary);
  border: none; padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 0.8rem; font-weight: 700; cursor: pointer; transition: var(--transition);
  font-family: var(--font);
}
.btn-sm-custom:hover { background: var(--primary); color: white; }

/* ================================================
   CARDS
   ================================================ */
.card-custom {
  background: white; border-radius: 16px;
  border: 1px solid rgba(0,0,0,.05); box-shadow: 0 4px 15px rgba(0,0,0,.03);
  overflow: hidden;
}
.card-custom-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px dashed rgba(0,0,0,.08); flex-wrap: wrap; gap: 10px;
}
.card-custom-title { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin: 0; }
.card-custom-subtitle { font-size: 0.82rem; color: var(--text-muted); margin: 2px 0 0; }

/* ================================================
   KPI CARDS
   ================================================ */
.kpi-card {
  background: white; border-radius: 16px;
  border: 1px solid rgba(0,0,0,.05); box-shadow: 0 4px 15px rgba(0,0,0,.03);
  padding: 24px; display: flex; align-items: center; gap: 20px;
  transition: var(--transition); overflow: hidden;
}
.kpi-card:hover { transform: translateY(-4px); box-shadow: 0 10px 25px rgba(0,0,0,.06); }

.kpi-icon {
  width: 60px; height: 60px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0; box-shadow: 0 4px 10px rgba(0,0,0,.05);
}
.kpi-revenue .kpi-icon { background: linear-gradient(135deg, #10b981, #059669); color: white; }
.kpi-expense .kpi-icon { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.kpi-tasks .kpi-icon { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.kpi-employees .kpi-icon { background: linear-gradient(135deg, var(--acc), #0284c7); color: white; }

.kpi-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 1.8rem; font-weight: 800; color: var(--text); margin: 0 0 6px; letter-spacing: -.5px; }
.kpi-change { font-size: 0.8rem; display: flex; align-items: center; gap: 4px; font-weight: 600; }
.kpi-change-up { color: var(--success); }
.kpi-change-down { color: var(--danger); }

/* TAB NAVIGATION (Deprecated) */

/* ================================================
   TABLES
   ================================================ */
.table-responsive { padding: 0 4px; }
.table-custom {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.table-custom thead th {
  padding: 10px 16px; text-align: left;
  font-size: 0.78rem; font-weight: 700; color: var(--primary);
  text-transform: uppercase; letter-spacing: .5px;
  background: var(--bg); border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table-custom thead th:first-child { border-radius: 8px 0 0 0; padding-left: 20px; }
.table-custom thead th:last-child { border-radius: 0 8px 0 0; }
.table-custom tbody tr { border-bottom: 1px solid var(--border); transition: var(--transition); }
.table-custom tbody tr:last-child { border-bottom: none; }
.table-custom tbody tr:hover { background: #fafbff; }
.table-custom tbody td { padding: 13px 16px; vertical-align: middle; color: var(--text); }
.table-custom tbody td:first-child { padding-left: 20px; }

.table-search-wrap { position: relative; }
.table-search-input {
  padding: 7px 12px 7px 32px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.82rem; background: var(--bg);
  color: var(--text); font-family: var(--font); transition: var(--transition); width: 200px;
}
.table-search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); background: white; }
.table-search-wrap::before {
  content: '\f002'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-size: 0.75rem; color: var(--text-muted); pointer-events: none;
}

/* ================================================
   BADGES & STATUS
   ================================================ */
.badge-id {
  display: inline-block; padding: 3px 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; font-size: 0.72rem; font-weight: 600;
  color: var(--text-muted); font-family: 'Courier New', monospace;
}
.badge-type {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 600;
}
.badge-success { background: #ecfdf5; color: var(--success); }
.badge-danger { background: #fef2f2; color: var(--danger); }
.badge-info { background: #ecfeff; color: var(--info); }
.badge-warning { background: #fffbeb; color: var(--warning); }
.badge-count {
  display: inline-flex; align-items: center;
  padding: 4px 10px; background: #fef2f2;
  color: var(--danger); border-radius: 6px; font-size: 0.75rem; font-weight: 600;
}
.badge-dept {
  display: inline-block; padding: 3px 8px;
  background: var(--primary-light); color: var(--primary);
  border-radius: 6px; font-size: 0.75rem; font-weight: 600;
}
.badge-method {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; background: #f0fdf4; color: var(--success);
  border-radius: 6px; font-size: 0.75rem;
}
.badge-role {
  display: inline-block; padding: 3px 8px;
  border-radius: 6px; font-size: 0.75rem; font-weight: 600;
}
.badge-role-admin { background: #fdf4ff; color: #a855f7; }
.badge-role-manager { background: var(--primary-light); color: var(--primary); }
.badge-role-accountant { background: #ecfdf5; color: var(--success); }
.badge-role-staff { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.badge-role-it-staff { background: #ecfeff; color: var(--info); }

.status-badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}
.status-active { background: #ecfdf5; color: var(--success); }
.status-inactive, .status-cancelled { background: #f3f4f6; color: var(--text-muted); }
.status-pending { background: #fffbeb; color: var(--warning); }
.status-completed { background: #ecfdf5; color: var(--success); }
.status-approved { background: #eff6ff; color: var(--primary); }
.status-rejected { background: #fef2f2; color: var(--danger); }
.status-in-progress { background: #ecfeff; color: var(--info); }
.status-todo { background: #f3f4f6; color: var(--text-muted); }

.action-badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 4px; font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase;
}
.action-login { background: #ecfdf5; color: var(--success); }
.action-logout { background: #f3f4f6; color: var(--text-muted); }
.action-create { background: var(--primary-light); color: var(--primary); }
.action-edit { background: #fffbeb; color: var(--warning); }
.action-delete { background: #fef2f2; color: var(--danger); }
.action-approve { background: #ecfdf5; color: var(--success); }

/* Priority */
.priority-badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 600;
}
.priority-high { background: #fef2f2; color: var(--danger); }
.priority-medium { background: #fffbeb; color: var(--warning); }
.priority-low { background: #ecfdf5; color: var(--success); }

/* ================================================
   ACTION BUTTONS
   ================================================ */
.action-btns { display: flex; gap: 4px; }
.action-btn {
  width: 30px; height: 30px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; background: white;
  color: var(--text-muted); transition: var(--transition);
  display: flex; align-items: center; justify-content: center; font-size: 0.8rem;
}
.action-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.action-btn.action-delete:hover { border-color: var(--danger); color: var(--danger); background: #fef2f2; }
.action-btn.action-approve:hover { border-color: var(--success); color: var(--success); background: #ecfdf5; }
.action-btn.action-reject:hover { border-color: var(--danger); color: var(--danger); background: #fef2f2; }

/* ================================================
   ACTIVITY FEED
   ================================================ */
.activity-feed { padding: 16px 20px; }
.activity-item { display: flex; gap: 14px; position: relative; padding-bottom: 20px; }
.activity-item:last-child { padding-bottom: 0; }
.activity-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0.9rem;
}
.activity-description { font-size: 0.875rem; font-weight: 500; color: var(--text); margin: 0 0 4px; }
.activity-amount { display: inline-block; font-size: 0.82rem; font-weight: 600; color: var(--success); margin-right: 8px; }
.activity-time { font-size: 0.75rem; color: var(--text-muted); }
.activity-connector {
  position: absolute; left: 19px; top: 44px;
  width: 2px; background: var(--border);
  bottom: 0;
}

/* Soft Colors */
.bg-success-soft { background: #ecfdf5; }
.bg-danger-soft, .bg-red-soft { background: #fef2f2; }
.bg-warning-soft { background: #fffbeb; }
.bg-info-soft { background: #ecfeff; }
.bg-primary-soft, .bg-blue-soft { background: var(--primary-light); }
.bg-green-soft { background: #ecfdf5; }
.bg-purple-soft { background: #fdf4ff; }
.text-purple { color: var(--purple); }

/* ================================================
   NOTIFICATIONS (INLINE)
   ================================================ */
.notif-list-inline { padding: 8px 0; }
.notif-inline-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 20px; border-bottom: 1px solid var(--border); transition: var(--transition);
}
.notif-inline-item:last-child { border-bottom: none; }
.notif-inline-item:hover { background: var(--bg); }
.notif-inline-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0.9rem;
}
.notif-warning .notif-inline-icon { background: #fffbeb; color: var(--warning); }
.notif-info .notif-inline-icon { background: #ecfeff; color: var(--info); }
.notif-success .notif-inline-icon { background: #ecfdf5; color: var(--success); }
.notif-danger .notif-inline-icon { background: #fef2f2; color: var(--danger); }
.notif-inline-title { font-size: 0.85rem; font-weight: 600; margin: 0 0 2px; }
.notif-inline-msg { font-size: 0.78rem; color: var(--text-muted); margin: 0 0 4px; }
.notif-inline-time { font-size: 0.72rem; color: var(--text-muted); }

/* Full Notifications */
.notif-list-full { display: flex; flex-direction: column; gap: 10px; }
.notif-full-item {
  display: flex; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  transition: var(--transition);
}
.notif-full-item:hover { box-shadow: var(--shadow-md); }
.notif-full-icon {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0;
}
.notif-warning .notif-full-icon { background: #fffbeb; color: var(--warning); }
.notif-info .notif-full-icon { background: #ecfeff; color: var(--info); }
.notif-success .notif-full-icon { background: #ecfdf5; color: var(--success); }
.notif-danger .notif-full-icon { background: #fef2f2; color: var(--danger); }
.notif-full-title { font-size: 0.9rem; font-weight: 600; margin: 0 0 2px; }
.notif-full-msg { font-size: 0.82rem; color: var(--text-muted); margin: 0 0 4px; }
.notif-full-time { font-size: 0.75rem; color: var(--text-muted); }

/* ================================================
   SUMMARY CARDS
   ================================================ */
.summary-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow);
}
.summary-icon { font-size: 1.5rem; }
.summary-income .summary-icon { color: var(--success); }
.summary-expense .summary-icon { color: var(--danger); }
.summary-warning .summary-icon { color: var(--warning); }
.summary-balance .summary-icon { color: var(--primary); }
.summary-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; margin: 0 0 2px; }
.summary-value { font-size: 1.4rem; font-weight: 700; margin: 0; }
.summary-income .summary-value { color: var(--success); }
.summary-expense .summary-value { color: var(--danger); }
.summary-warning .summary-value { color: var(--warning); }
.summary-balance .summary-value { color: var(--primary); }

/* ================================================
   BANK CARDS
   ================================================ */
.bank-card {
  background: linear-gradient(135deg, var(--p2), var(--p));
  border-radius: var(--radius); padding: 20px;
  color: white; transition: var(--transition); box-shadow: var(--shadow-md);
}
.bank-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.bank-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.bank-name { font-weight: 600; font-size: 0.9rem; opacity: .9; }
.bank-card-no { font-size: 1rem; letter-spacing: 2px; font-weight: 300; margin-bottom: 20px; opacity: .8; }
.bank-card-footer { display: flex; justify-content: space-between; align-items: flex-end; }
.bank-card-label { font-size: 0.7rem; opacity: .7; margin: 0 0 2px; }
.bank-card-balance { font-size: 1.3rem; font-weight: 700; margin: 0; }
.bank-card-type { font-size: 0.75rem; opacity: .7; }

/* ================================================
   REPORT CARDS
   ================================================ */
.report-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); transition: var(--transition); cursor: pointer;
}
.report-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.report-card-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; margin-bottom: 14px;
}
.report-card-title { font-size: 0.9rem; font-weight: 600; margin: 0 0 6px; }
.report-card-desc { font-size: 0.78rem; color: var(--text-muted); margin: 0; }

/* ================================================
   WELFARE CARDS
   ================================================ */
.welfare-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); transition: var(--transition);
}
.welfare-card:hover { box-shadow: var(--shadow-md); }
.welfare-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; flex-wrap: wrap; gap: 8px; }
.welfare-name { font-size: 0.9rem; font-weight: 600; margin: 0; }
.welfare-desc { font-size: 0.82rem; color: var(--text-muted); margin: 0 0 12px; }
.welfare-progress-wrap { margin-top: 10px; }
.welfare-progress-label { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 6px; }
.welfare-progress { height: 6px; background: var(--border); border-radius: 6px; overflow: hidden; }
.welfare-progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), #6366f1); border-radius: 6px; transition: width .6s ease; }
.welfare-pct { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; display: block; }

/* ================================================
   EMPLOYEE CELL
   ================================================ */
.employee-cell { display: flex; align-items: center; gap: 8px; }
.employee-avatar {
  width: 30px; height: 30px;
  background: var(--primary-light);
  border-radius: 50%; color: var(--primary); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}

/* ================================================
   PROGRESS BARS
   ================================================ */
.progress-wrap { display: flex; align-items: center; gap: 8px; }
.progress-bar-custom { flex: 1; height: 6px; background: var(--border); border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--acc), #0284c7); border-radius: 6px; }
.progress-pct { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; min-width: 32px; }

/* ================================================
   CALENDAR
   ================================================ */
.calendar-grid { padding: 16px 20px; }
.calendar-header { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.cal-day-name { text-align: center; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); padding: 8px; }
.calendar-body { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  min-height: 80px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px; transition: var(--transition);
}
.cal-cell:hover { background: var(--bg); }
.cal-empty { background: var(--bg); opacity: .4; }
.cal-today { border-color: var(--primary); background: var(--primary-light); }
.cal-date { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.cal-today .cal-date { color: var(--primary); }
.cal-event { font-size: 0.65rem; padding: 2px 5px; border-radius: 4px; margin-top: 4px; font-weight: 500; }
.cal-event-blue { background: var(--primary-light); color: var(--primary); }
.cal-event-green { background: #ecfdf5; color: var(--success); }
.cal-event-red { background: #fef2f2; color: var(--danger); }

/* ================================================
   SETTINGS FORMS
   ================================================ */
.settings-form { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.settings-form-row { display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: center; }
.settings-label { font-size: 0.85rem; font-weight: 500; color: var(--text); }
.settings-input {
  padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.85rem;
  color: var(--text); font-family: var(--font); transition: var(--transition); width: 100%;
}
.settings-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.settings-textarea { resize: vertical; }

.logo-upload-area { padding: 20px; }
.logo-placeholder {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 40px 20px; text-align: center; cursor: pointer; transition: var(--transition);
  color: var(--text-muted);
}
.logo-placeholder:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.logo-placeholder i { font-size: 2rem; margin-bottom: 12px; display: block; }
.logo-placeholder p { margin: 0 0 4px; font-size: 0.85rem; }

/* ================================================
   BACKUP
   ================================================ */
.backup-status { text-align: center; padding: 30px 20px; }
.backup-icon { font-size: 3rem; color: var(--primary); margin-bottom: 12px; }
.backup-label { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 4px; }
.backup-date { font-size: 1rem; font-weight: 600; margin: 0 0 20px; }
.backup-list { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.backup-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--bg); border-radius: var(--radius-sm); }
.backup-item-info { display: flex; align-items: center; gap: 4px; }
.backup-item-date { font-size: 0.85rem; font-weight: 500; margin: 0 0 2px; }
.backup-item-size { font-size: 0.75rem; color: var(--text-muted); margin: 0; }

/* ================================================
   LINK SUBTLE
   ================================================ */
.link-subtle { color: var(--primary); font-size: 0.82rem; }
.link-subtle:hover { text-decoration: underline; }
.text-truncate-custom { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ================================================
   LOGIN PAGE
   ================================================ */
.login-page {
  background: linear-gradient(135deg, #f0f4ff 0%, #fafbff 50%, #f8fafc 100%);
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  font-family: var(--font); position: relative; overflow: hidden;
}

.login-bg { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.login-bg-circle {
  position: absolute; border-radius: 50%;
  background: linear-gradient(135deg, rgba(59,130,246,.1), rgba(99,102,241,.1));
}
.login-bg-circle-1 { width: 600px; height: 600px; top: -200px; right: -150px; }
.login-bg-circle-2 { width: 400px; height: 400px; bottom: -150px; left: -100px; animation: floatCircle 8s ease-in-out infinite; }
.login-bg-circle-3 { width: 200px; height: 200px; top: 40%; left: 20%; opacity: .5; }

@keyframes floatCircle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

.login-container { position: relative; z-index: 1; width: 100%; max-width: 420px; padding: 20px; }

.login-card {
  background: white; border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.1), 0 4px 12px rgba(59,130,246,.08);
  padding: 40px; border: 1px solid rgba(255,255,255,.8);
}

.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border-radius: 18px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.8rem;
  box-shadow: 0 8px 24px rgba(59,130,246,.35);
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(59,130,246,.35); }
  50% { box-shadow: 0 8px 32px rgba(59,130,246,.5); }
}
.login-logo-name { font-size: 1.6rem; font-weight: 700; color: var(--text); margin: 0; letter-spacing: -.5px; }
.login-logo-name strong { color: var(--primary); }
.login-logo-tagline { color: var(--text-muted); font-size: 0.85rem; margin: 6px 0 0; }

.login-form-group { margin-bottom: 18px; }
.login-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.login-input {
  width: 100%; padding: 12px 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.9rem; color: var(--text); font-family: var(--font);
  transition: var(--transition); background: var(--bg);
}
.login-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.12); background: white; }
.login-input-wrapper { position: relative; }
.login-input-wrapper .login-input { padding-right: 44px; }
.login-eye-btn {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  font-size: 0.9rem; transition: var(--transition);
}
.login-eye-btn:hover { color: var(--primary); }

.login-options { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.login-remember { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text); cursor: pointer; }
.login-remember input { accent-color: var(--primary); cursor: pointer; }
.login-forgot { font-size: 0.82rem; color: var(--primary); font-weight: 500; }
.login-forgot:hover { text-decoration: underline; }

.login-btn {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; border: none; border-radius: var(--radius-sm);
  font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: var(--transition); font-family: var(--font);
  box-shadow: 0 4px 14px rgba(59,130,246,.35);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.login-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(59,130,246,.45); }
.login-btn:disabled { opacity: .7; cursor: not-allowed; }

.login-demo-hint {
  margin-top: 20px; text-align: center;
  background: var(--bg); border-radius: var(--radius-sm);
  padding: 10px 16px; font-size: 0.82rem; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px dashed var(--border);
}
.login-demo-hint strong { color: var(--text); }

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.show { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .topbar { left: 0 !important; }
  .page-content { padding: 16px; padding-top: calc(var(--topbar-height) + 16px); }
}

@media (max-width: 767.98px) {
  .page-title { font-size: 1.2rem; }
  .kpi-value { font-size: 1.3rem; }
  .table-search-input { width: 150px; }
  .topbar-breadcrumb { display: none; }
  .settings-form-row { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
  .tab-nav { gap: 2px; }
  .tab-nav-item { padding: 6px 10px; font-size: 0.78rem; }
}

@media (max-width: 479.98px) {
  .page-header { flex-direction: column; align-items: flex-start; }
  .kpi-card { padding: 14px; }
  .kpi-icon { width: 42px; height: 42px; }
}

/* ================================================
   UTILITIES
   ================================================ */
.gap-2 { gap: 8px; }
.fw-medium { font-weight: 500; }
.fw-semibold { font-weight: 600; }
