/* ── RESET & BASE ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:     #1a3a5c;
  --primary-mid: #2e6da4;
  --primary-lt:  #ddeeff;
  --accent:      #e8a020;
  --green:       #1a7a3c;
  --red:         #c0392b;
  --sidebar-w:   240px;
  --topbar-h:    60px;
  --radius:      8px;
  --shadow:      0 2px 8px rgba(0,0,0,.1);
  --font:        'Segoe UI', system-ui, sans-serif;
  --bg:          #f0f4f8;
  --card-bg:     #ffffff;
  --border:      #dde3ea;
  --text:        #1e2a38;
  --text-muted:  #6b7a8d;
}

body { font-family: var(--font); background: var(--bg); color: var(--text); display: flex; min-height: 100vh; }

/* ── SIDEBAR ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); min-height: 100vh; background: var(--primary);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; z-index: 100;
  transition: width .25s;
}
.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .user-info > div,
.sidebar.collapsed .user-name,
.sidebar.collapsed .user-role { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; }

.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-logo { width: 36px; height: 36px; background: var(--accent); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: white; font-size: 18px; flex-shrink: 0; }
.brand-name { color: white; font-weight: 700; font-size: 16px; display: block; }
.brand-sub  { color: rgba(255,255,255,.6); font-size: 11px; display: block; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section { padding: 16px 16px 4px; color: rgba(255,255,255,.4); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  color: rgba(255,255,255,.75); text-decoration: none; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.12); color: white; }
.nav-item.active { border-left: 3px solid var(--accent); }
.nav-item i { width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-mid); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.user-name { color: white; font-size: 13px; font-weight: 600; }
.user-role { color: rgba(255,255,255,.5); font-size: 11px; }
.logout-btn { margin-left: auto; color: rgba(255,255,255,.5); font-size: 16px; text-decoration: none; }
.logout-btn:hover { color: var(--red); }

/* ── MAIN CONTENT ──────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; transition: margin-left .25s; min-width: 0; }
.sidebar.collapsed ~ .main-content { margin-left: 60px; }

.topbar { height: var(--topbar-h); background: white; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.sidebar-toggle { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 18px; padding: 4px 8px; }
.page-title { font-size: 18px; font-weight: 600; color: var(--text); flex: 1; }
.topbar-right { color: var(--text-muted); font-size: 13px; }

.content-area { padding: 24px; flex: 1; }

/* ── ALERTS ────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffc107; }

/* ── CARDS ─────────────────────────────────────────────────── */
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 15px; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }

/* ── STAT CARDS ────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat-card { background: var(--card-bg); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-icon.blue   { background: #ddeeff; color: var(--primary-mid); }
.stat-icon.green  { background: #d4edda; color: var(--green); }
.stat-icon.orange { background: #fff3cd; color: var(--accent); }
.stat-icon.red    { background: #f8d7da; color: var(--red); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── TABLES ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { background: var(--primary); color: white; padding: 11px 14px; text-align: left; font-weight: 600; font-size: 13px; white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:hover { background: #f7f9fc; }
tbody td { padding: 11px 14px; color: var(--text); vertical-align: middle; }

/* ── BADGES ────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.badge-active    { background: #d4edda; color: #155724; }
.badge-inactive  { background: #e2e3e5; color: #383d41; }
.badge-pending   { background: #fff3cd; color: #856404; }
.badge-approved  { background: #d4edda; color: #155724; }
.badge-rejected  { background: #f8d7da; color: #721c24; }
.badge-usd       { background: #ddeeff; color: var(--primary-mid); }
.badge-zwg       { background: #fff3cd; color: #856404; }
.badge-split     { background: #e8d5f5; color: #5b2d8e; }

/* ── BUTTONS ───────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px; border: none; cursor: pointer; font-size: 13px; font-weight: 600; text-decoration: none; transition: opacity .15s, transform .1s; }
.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary  { background: var(--primary-mid); color: white; }
.btn-success  { background: var(--green);       color: white; }
.btn-danger   { background: var(--red);         color: white; }
.btn-warning  { background: var(--accent);      color: white; }
.btn-secondary{ background: #6c757d;            color: white; }
.btn-outline  { background: transparent; border: 1.5px solid var(--primary-mid); color: var(--primary-mid); }
.btn-sm       { padding: 5px 10px; font-size: 12px; }

/* ── FORMS ─────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 6px;
  font-size: 14px; color: var(--text); background: white; transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--primary-mid); box-shadow: 0 0 0 3px rgba(46,109,164,.12); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-section { font-size: 13px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .5px; padding-bottom: 8px; border-bottom: 2px solid var(--primary-lt); margin: 24px 0 16px; grid-column: 1 / -1; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; grid-column: 1 / -1; }
.required { color: var(--red); }

/* ── PAYSLIP PREVIEW ───────────────────────────────────────── */
.payslip { max-width: 760px; margin: 0 auto; font-size: 13px; }
.payslip-header { background: var(--primary); color: white; padding: 20px 24px; border-radius: var(--radius) var(--radius) 0 0; }
.payslip-header h2 { font-size: 22px; margin-bottom: 2px; }
.payslip-header p  { opacity: .75; font-size: 12px; }
.payslip-section { padding: 16px 24px; }
.payslip-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--primary-mid); margin-bottom: 10px; font-weight: 700; }
.payslip-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dotted var(--border); }
.payslip-row:last-child { border-bottom: none; }
.payslip-total { background: var(--green); color: white; padding: 14px 24px; font-size: 16px; font-weight: 700; display: flex; justify-content: space-between; border-radius: 0 0 var(--radius) var(--radius); }

/* ── PAGINATION ────────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; margin-top: 16px; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 5px; text-decoration: none; font-size: 13px; border: 1px solid var(--border); color: var(--text); }
.pagination a:hover { background: var(--primary-lt); }
.pagination .current { background: var(--primary-mid); color: white; border-color: var(--primary-mid); }

/* ── SEARCH BAR ────────────────────────────────────────────── */
.search-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-bar input { flex: 1; min-width: 200px; padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 14px; }
.search-bar select { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 14px; }

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .brand-text, .sidebar .nav-item span, .sidebar .nav-section, .sidebar .user-name, .sidebar .user-role { display: none; }
  .sidebar .nav-item { justify-content: center; }
  .main-content { margin-left: 60px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ── LOGIN PAGE ────────────────────────────────────────────── */
.login-page { min-height: 100vh; background: var(--primary); display: flex; align-items: center; justify-content: center; }
.login-box { background: white; border-radius: 12px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { width: 60px; height: 60px; background: var(--primary); border-radius: 14px; display: flex; align-items: center; justify-content: center; color: white; font-size: 28px; margin: 0 auto 12px; }
.login-logo h1 { font-size: 20px; color: var(--text); }
.login-logo p  { font-size: 13px; color: var(--text-muted); }
