:root {
  --primary: #1F4E79;
  --primary-light: #2E75B6;
  --primary-bg: #F2F7FB;
  --accent: #E8740C;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --gray-50: #f8f9fa;
  --gray-100: #e9ecef;
  --gray-200: #dee2e6;
  --gray-500: #6c757d;
  --gray-700: #495057;
  --gray-900: #212529;
  --sidebar-w: 260px;
  --header-h: 56px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
}
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--gray-50); color: var(--gray-900); font-size: 14px; }
a { color: var(--primary-light); text-decoration: none; }

/* ===== LOGIN ===== */
.login-wrapper { display:flex; align-items:center; justify-content:center; min-height:100vh; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); }
.login-card { background:#fff; border-radius: 12px; padding: 40px; width: 400px; box-shadow: var(--shadow-md); }
.login-card h1 { color: var(--primary); font-size: 24px; margin-bottom: 8px; }
.login-card p { color: var(--gray-500); margin-bottom: 24px; }
.login-card .subtitle { font-size: 13px; }

/* ===== FORM ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 4px; color: var(--gray-700); font-size: 13px; }
.form-control { width: 100%; padding: 10px 12px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: 14px; transition: border .2s; }
.form-control:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(46,117,182,.15); }
.form-control.is-invalid { border-color: var(--danger); }
select.form-control { appearance: auto; }

.btn { display:inline-flex; align-items:center; gap:6px; padding: 10px 20px; border-radius: 6px; border: none; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--gray-200); color: var(--gray-700); }
.btn-outline:hover { background: var(--gray-100); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ===== LAYOUT ===== */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--primary); color: #fff; position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; z-index: 100; transition: transform .3s; }
.sidebar-header { padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-header h2 { font-size: 16px; font-weight: 700; }
.sidebar-header small { opacity: .7; font-size: 11px; }
.sidebar-nav { padding: 12px 0; }
.nav-section { padding: 8px 20px 4px; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; opacity: .5; margin-top: 8px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: rgba(255,255,255,.8); font-size: 13px; cursor: pointer; transition: all .15s; border-left: 3px solid transparent; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: var(--accent); font-weight: 600; }
.nav-item .icon { width: 18px; text-align: center; font-size: 15px; }

.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; }
.header { height: var(--header-h); background: #fff; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.header-left { display: flex; align-items: center; gap: 12px; }
.header-left h1 { font-size: 18px; color: var(--gray-900); }
.header-right { display: flex; align-items: center; gap: 16px; }
.user-info { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.user-info .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-light); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-ceo { background: #E8740C22; color: #E8740C; }
.badge-hr { background: #2E75B622; color: #2E75B6; }
.badge-manager { background: #28a74522; color: #28a745; }
.badge-employee { background: #6c757d22; color: #6c757d; }

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

/* ===== CARDS ===== */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--gray-100); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 15px; color: var(--gray-900); }
.card-body { padding: 20px; }

/* ===== TABLE ===== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--primary-bg); color: var(--primary); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--gray-100); }
tr:hover { background: var(--gray-50); }
td.number { text-align: right; font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ===== STATS GRID ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border-left: 4px solid var(--primary); }
.stat-card .stat-label { font-size: 12px; color: var(--gray-500); margin-bottom: 4px; }
.stat-card .stat-value { font-size: 24px; font-weight: 700; color: var(--gray-900); }
.stat-card .stat-sub { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.stat-card.accent { border-left-color: var(--accent); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }

/* ===== CONFIG SECTION ===== */
.config-section { margin-bottom: 24px; }
.config-section h4 { font-size: 14px; color: var(--primary); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--primary-bg); }
.config-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--gray-100); }
.config-row:last-child { border-bottom: none; }
.config-row .config-label { flex: 1; }
.config-row .config-label .name { font-weight: 600; }
.config-row .config-label .desc { font-size: 12px; color: var(--gray-500); }
.config-row .config-value { width: 160px; text-align: right; }
.config-row .config-value input { width: 120px; text-align: right; padding: 6px 8px; border: 1px solid var(--gray-200); border-radius: 4px; }
.config-row .config-unit { width: 80px; text-align: right; color: var(--gray-500); font-size: 13px; }
.inline-edit { display: inline-flex; align-items: center; gap: 4px; }
.inline-edit input { width: 80px; padding: 4px 8px; text-align: right; border: 1px solid var(--gray-200); border-radius: 4px; font-size: 13px; }
.inline-edit .save-btn { background: var(--success); color: #fff; border: none; border-radius: 4px; padding: 4px 8px; cursor: pointer; font-size: 11px; }

/* ===== TOAST ===== */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: 8px; color: #fff; font-size: 13px; box-shadow: var(--shadow-md); animation: slideIn .3s; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary-light); }
@keyframes slideIn { from { transform: translateX(100%); opacity:0; } to { transform: translateX(0); opacity:1; } }

/* ===== MISC ===== */
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.tag-active { background: #d4edda; color: #155724; }
.tag-inactive { background: #f8d7da; color: #721c24; }

.money { font-variant-numeric: tabular-nums; }
.money::before { content: ''; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
