@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   CSS Variables — Design System
   ============================================================ */
:root {
  /* Colors */
  --bg-root:      #070d1f;
  --bg-dark:      #0c1428;
  --bg-card:      rgba(255,255,255,0.04);
  --bg-card-hover:rgba(255,255,255,0.07);
  --glass-border: rgba(255,255,255,0.08);
  --glass-border-hover: rgba(255,255,255,0.15);

  --accent:       #6366f1;
  --accent-end:   #8b5cf6;
  --accent-glow:  rgba(99,102,241,0.35);

  --success:      #10b981;
  --success-dim:  rgba(16,185,129,0.15);
  --warning:      #f59e0b;
  --warning-dim:  rgba(245,158,11,0.15);
  --danger:       #ef4444;
  --danger-dim:   rgba(239,68,68,0.15);
  --info:         #3b82f6;
  --info-dim:     rgba(59,130,246,0.15);
  --purple:       #8b5cf6;
  --purple-dim:   rgba(139,92,246,0.15);

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

  /* Layout */
  --sidebar-w:    260px;
  --header-h:     64px;
  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    16px;

  /* Shadows */
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.4);
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow:  0 0 40px rgba(99,102,241,0.2);
}

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

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-root);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-end); }

img { max-width: 100%; display: block; }

/* ============================================================
   Background Orbs
   ============================================================ */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
}
body::before {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(99,102,241,.18) 0%, transparent 70%);
  top: -200px; left: -100px;
  animation: orbFloat 15s ease-in-out infinite alternate;
}
body::after {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(139,92,246,.12) 0%, transparent 70%);
  bottom: -150px; right: -100px;
  animation: orbFloat 18s ease-in-out infinite alternate-reverse;
}
@keyframes orbFloat {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, 40px) scale(1.1); }
}

/* ============================================================
   Layout
   ============================================================ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: rgba(12,20,40,0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--glass-border);
}
.sidebar-logo .logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent-end));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 16px var(--accent-glow);
  flex-shrink: 0;
}
.sidebar-logo .logo-text {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 0%, var(--accent-end) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-logo .logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  -webkit-text-fill-color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 99px; }

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 8px 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all .2s;
  cursor: pointer;
  margin-bottom: 2px;
}
.nav-item .nav-icon { font-size: 18px; flex-shrink: 0; width: 22px; text-align: center; }
.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,.25), rgba(139,92,246,.15));
  color: #fff;
  border: 1px solid rgba(99,102,241,.3);
  box-shadow: inset 0 0 20px rgba(99,102,241,.1);
}
.nav-item.active .nav-icon { filter: drop-shadow(0 0 6px var(--accent)); }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--glass-border);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ---------- Main Content ---------- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* Đảm bảo không tràn ngang */
  max-width: calc(100vw - var(--sidebar-w));
  overflow-x: hidden;
}

.topbar {
  height: var(--header-h);
  background: rgba(7,13,31,.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}
.topbar-breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 1px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-date {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
}

.page-body {
  padding: 28px;
  flex: 1;
  /* Giới hạn độ rộng, ngăn tràn ngang */
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* ============================================================
   Cards / Glass Panels
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  transition: border-color .25s, box-shadow .25s, transform .25s;
}
.card:hover {
  border-color: var(--glass-border-hover);
  box-shadow: var(--shadow);
}
.card-padded { padding: 24px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--glass-border);
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body { padding: 20px 24px; }

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: all .25s;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 140px; height: 140px;
  border-radius: 50%;
  opacity: 0.05;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--glass-border-hover);
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.stat-icon.purple { background: var(--purple-dim); color: var(--purple); box-shadow: 0 4px 16px rgba(139,92,246,.2); }
.stat-icon.success { background: var(--success-dim); color: var(--success); box-shadow: 0 4px 16px rgba(16,185,129,.2); }
.stat-icon.warning { background: var(--warning-dim); color: var(--warning); box-shadow: 0 4px 16px rgba(245,158,11,.2); }
.stat-icon.info    { background: var(--info-dim);    color: var(--info);    box-shadow: 0 4px 16px rgba(59,130,246,.2); }
.stat-icon.danger  { background: var(--danger-dim);  color: var(--danger);  box-shadow: 0 4px 16px rgba(239,68,68,.2); }
.stat-icon.accent  { background: rgba(99,102,241,.15); color: var(--accent); box-shadow: 0 4px 16px var(--accent-glow); }

.stat-value { font-size: 26px; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.stat-sub   { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   Grids
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ============================================================
   Page Header
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header-left h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}
.page-header-left p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 3px;
}
.page-header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-end));
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 6px 24px var(--accent-glow); color: #fff; }

.btn-success {
  background: linear-gradient(135deg, #059669, var(--success));
  color: #fff;
  box-shadow: 0 4px 16px rgba(16,185,129,.3);
}
.btn-success:hover { color: #fff; }

.btn-warning {
  background: linear-gradient(135deg, #d97706, var(--warning));
  color: #fff;
  box-shadow: 0 4px 16px rgba(245,158,11,.3);
}
.btn-warning:hover { color: #fff; }

.btn-danger {
  background: linear-gradient(135deg, #dc2626, var(--danger));
  color: #fff;
  box-shadow: 0 4px 16px rgba(239,68,68,.3);
}
.btn-danger:hover { color: #fff; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--glass-border);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--glass-border-hover);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn-outline:hover {
  background: rgba(99,102,241,.1);
  color: var(--accent);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ============================================================
   Tables
   ============================================================ */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* smooth scroll on iOS */
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  width: 100%;
  max-width: 100%;
  /* Scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}
.table-responsive::-webkit-scrollbar { height: 6px; }
.table-responsive::-webkit-scrollbar-track { background: rgba(255,255,255,.03); border-radius: 99px; }
.table-responsive::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 99px; }
.table-responsive::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.25); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead {
  background: rgba(255,255,255,.03);
  position: sticky; top: 0; z-index: 1;
}
thead th {
  padding: 13px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap;
  text-align: left;
}
thead th.text-center, td.text-center { text-align: center; }
tbody tr {
  border-bottom: 1px solid rgba(255,255,255,.04);
  transition: background .15s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-card-hover); }
tbody td {
  padding: 13px 16px;
  color: var(--text-secondary);
  vertical-align: middle;
}
tbody td strong, .td-name { color: var(--text-primary); font-weight: 600; }
tfoot td {
  padding: 12px 16px;
  border-top: 1px solid var(--glass-border);
  font-weight: 700;
  color: var(--text-primary);
  background: rgba(255,255,255,.02);
}

/* ============================================================
   Attendance Sheet Table
   ============================================================ */
.sheet-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  /* Sề-scroll indicator */
  background: linear-gradient(to right, #0c1428 30%, transparent),
              linear-gradient(to left,  #0c1428 30%, transparent) 100% 0,
              radial-gradient(farthest-side at 0   50%, rgba(255,255,255,.12), transparent),
              radial-gradient(farthest-side at 100% 50%, rgba(255,255,255,.12), transparent) 100% 0;
  background-repeat: no-repeat;
  background-color: #0c1428;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}
.sheet-table {
  border-collapse: collapse;
  white-space: nowrap; /* prevent line break in cells */
}
.sheet-table th.day-header {
  writing-mode: horizontal-tb;
  text-align: center;
  padding: 10px 6px;
  min-width: 44px;
  font-size: 10px;
}
.sheet-table td.day-cell {
  text-align: center;
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 4px;
}
.cell-present  { background: rgba(16,185,129,.2);  color: #10b981; }
.cell-late     { background: rgba(245,158,11,.2);  color: #f59e0b; }
.cell-half     { background: rgba(59,130,246,.2);  color: #3b82f6; }
.cell-leave    { background: rgba(139,92,246,.2);  color: #a78bfa; }
.cell-noperm   { background: rgba(239,68,68,.2);   color: #ef4444; }
.cell-weekend  { background: rgba(255,255,255,.02); color: var(--text-muted); }
.cell-empty    { color: var(--text-muted); }

/* Sticky column background - must match sidebar dark color */
.sheet-sticky {
  position: sticky;
  background: #0c1428;
  z-index: 2;
}
.sheet-sticky-head {
  position: sticky;
  background: #0d1530;
  z-index: 3;
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge-success  { background: var(--success-dim); color: var(--success); }
.badge-warning  { background: var(--warning-dim); color: var(--warning); }
.badge-danger   { background: var(--danger-dim);  color: var(--danger);  }
.badge-info     { background: var(--info-dim);    color: var(--info);    }
.badge-primary  { background: rgba(99,102,241,.15); color: var(--accent); }
.badge-purple   { background: var(--purple-dim);  color: var(--purple);  }
.badge-secondary{ background: rgba(255,255,255,.06); color: var(--text-muted); }

/* ============================================================
   Forms
   ============================================================ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.form-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  padding: 10px 14px;
  transition: border-color .2s, box-shadow .2s, background .2s;
  outline: none;
  width: 100%;
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus {
  border-color: var(--accent);
  background: rgba(99,102,241,.06);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.form-control:disabled {
  opacity: .5;
  cursor: not-allowed;
}
select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--text-muted); }
.form-error { font-size: 12px; color: var(--danger); }

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 24px;
  border-bottom: 1px solid var(--glass-border);
}
.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-label { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.5px; text-transform: uppercase; }
.filter-control {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  padding: 8px 12px;
  outline: none;
  transition: border-color .2s;
  min-width: 120px;
}
.filter-control:focus { border-color: var(--accent); }
select.filter-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

/* ============================================================
   Alerts / Messages
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-dim); border-color: rgba(16,185,129,.3); color: var(--success); }
.alert-danger   { background: var(--danger-dim);  border-color: rgba(239,68,68,.3);  color: var(--danger);  }
.alert-warning  { background: var(--warning-dim); border-color: rgba(245,158,11,.3); color: var(--warning); }
.alert-info     { background: var(--info-dim);    border-color: rgba(59,130,246,.3); color: var(--info);    }

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .5; }
.empty-state p { font-size: 14px; }

/* ============================================================
   Utilities
   ============================================================ */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2       { gap: 8px; }
.gap-3       { gap: 12px; }
.gap-4       { gap: 16px; }
.gap-6       { gap: 24px; }
.mt-1        { margin-top: 4px; }
.mt-2        { margin-top: 8px; }
.mt-4        { margin-top: 16px; }
.mt-6        { margin-top: 24px; }
.mb-4        { margin-bottom: 16px; }
.mb-6        { margin-bottom: 24px; }
.w-full      { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm     { font-size: 13px; }
.text-xs     { font-size: 11px; }
.text-lg     { font-size: 18px; }
.text-muted  { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-bold   { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-success{ color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning{ color: var(--warning); }
.text-accent { color: var(--accent); }

/* Avatar */
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-end));
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }

/* Divider */
.divider {
  height: 1px;
  background: var(--glass-border);
  margin: 20px 0;
}

/* ============================================================
   Payroll Detail
   ============================================================ */
.payroll-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
}
.breakdown-label { font-size: 13px; color: var(--text-secondary); }
.breakdown-value { font-size: 15px; font-weight: 700; color: var(--text-primary); }

.salary-total {
  background: linear-gradient(135deg, rgba(99,102,241,.15), rgba(139,92,246,.1));
  border: 1px solid rgba(99,102,241,.3);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-top: 20px;
}
.salary-total .label { font-size: 14px; color: var(--text-secondary); margin-bottom: 6px; }
.salary-total .amount {
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Print styles */
@media print {
  .sidebar, .topbar, .page-header-actions, .btn, .filter-bar { display: none !important; }
  .main-content { margin-left: 0 !important; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ddd; }
  table { font-size: 11px; }
}

/* ============================================================
   Responsive — Mobile-First
   Breakpoints: 480 / 768 / 1024 / 1280
   ============================================================ */

/* ── Hamburger toggle (hidden on desktop) ──────────────────── */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 20px;
  transition: all .2s;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* ── Sidebar overlay (mobile backdrop) ─────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ── Tablet: 768px – 1024px ────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .page-body { padding: 20px; }
  .topbar { padding: 0 20px; }
}

/* ── Mobile: ≤ 768px ───────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  /* Sidebar: hidden off-screen by default */
  .sidebar {
    transform: translateX(-260px);
    width: 260px;
    z-index: 200;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.open { transform: translateX(0); }

  /* Show toggle button */
  .sidebar-toggle { display: flex; }

  /* Main content full-width */
  .main-content { margin-left: 0; }

  /* Topbar adjustments */
  .topbar { padding: 0 14px; gap: 8px; height: auto; min-height: var(--header-h); flex-wrap: wrap; }
  .topbar-title { font-size: 15px; }
  .topbar-breadcrumb { font-size: 11px; }

  /* Hide date in topbar on mobile (saves space) */
  .topbar-date { display: none; }

  /* Hide user full badge on small screens, show only avatar */
  .topbar-userbadge-text { display: none; }

  /* Grids collapse to 1 column */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; gap: 12px; }

  /* Forms */
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; gap: 12px; }
  .payroll-breakdown { grid-template-columns: 1fr; }

  /* Page body padding */
  .page-body { padding: 12px; }

  /* Page header: stack vertically */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }
  .page-header-left h1 { font-size: 20px; }
  .page-header-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .page-header-actions .btn { flex: 1; min-width: 130px; justify-content: center; font-size: 13px; }

  /* Filter bar: wrap and full-width inputs */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 14px 16px;
    gap: 10px;
  }
  .filter-group { width: 100%; }
  .filter-control { width: 100%; min-width: unset; }
  .filter-bar .btn { width: 100%; justify-content: center; }

  /* Card header: wrap */
  .card-header { flex-wrap: wrap; gap: 8px; padding: 14px 16px; }
  .card-body { padding: 14px 16px; }
  .card-padded { padding: 16px; }

  /* Stat cards */
  .stat-card { padding: 16px; }
  .stat-value { font-size: 22px; }
  .stat-icon { width: 44px; height: 44px; font-size: 20px; }

  /* Tables: horizontal scroll */
  .table-responsive { border-radius: var(--radius-sm); }
  thead th, tbody td { padding: 10px 12px; font-size: 13px; }

  /* Payroll breakdown */
  .salary-total .amount { font-size: 28px; }
}

/* ── Small mobile: ≤ 480px ─────────────────────────────────── */
@media (max-width: 480px) {
  .page-header-left h1 { font-size: 18px; }
  .stat-value { font-size: 20px; }
  .btn { font-size: 13px; padding: 8px 14px; }
  .btn-lg { font-size: 14px; padding: 10px 18px; }
  .card-header { padding: 12px 14px; }
  .card-body { padding: 12px 14px; }
  .card-padded { padding: 14px; }

  /* Stack stat cards completely on tiny screens */
  .stat-card { flex-direction: row; align-items: center; }

  /* Attendance status buttons: 2-column grid */
  .att-status-group { display: grid !important; grid-template-columns: 1fr 1fr; }

  /* Reduce table font */
  thead th, tbody td { padding: 8px 10px; font-size: 12px; }

  /* Topbar user badge: more compact */
  .topbar { padding: 0 12px; }
  .topbar-title { font-size: 14px; }
}


/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .35s ease forwards; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .6; }
}
.pulse { animation: pulse 2s ease-in-out infinite; }

/* Spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
