/* ============================================================
   HRM SYSTEM - DESIGN TOKENS & CORE STYLES
   Palette: Ink Navy #17223B | Steel Blue #3E5C76 | Signal Teal #1FB6A3
            Canvas #F4F6F9 | Slate Text #2B3245 | Amber Alert #E8A33D | Coral #E4572E
   Type: 'Sora' (display/headings) + 'Inter' (body/UI) + 'JetBrains Mono' (data/codes)
   ============================================================ */

:root {
    --ink-navy: #17223B;
    --steel-blue: #3E5C76;
    --signal-teal: #1FB6A3;
    --canvas: #F4F6F9;
    --card-bg: #FFFFFF;
    --slate-text: #2B3245;
    --muted-text: #6B7385;
    --amber: #E8A33D;
    --coral: #E4572E;
    --success: #21976B;
    --border-soft: #E4E8EF;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--canvas);
    color: var(--slate-text);
    font-size: 14.5px;
}

h1, h2, h3, h4, h5, .brand-font {
    font-family: 'Sora', 'Inter', sans-serif;
    color: var(--ink-navy);
    font-weight: 600;
}

.data-mono {
    font-family: 'JetBrains Mono', monospace;
}

.text-teal { color: var(--signal-teal) !important; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background: var(--ink-navy);
    color: #C9D2E3;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .brand {
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar .brand .dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--signal-teal);
    box-shadow: 0 0 0 4px rgba(31,182,163,0.2);
}

.sidebar .nav-section-label {
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    color: #7C87A3;
    padding: 18px 20px 6px;
}

.sidebar a.nav-link {
    color: #C9D2E3;
    padding: 10px 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 3px solid transparent;
    transition: all .15s ease;
}

.sidebar a.nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.sidebar a.nav-link.active {
    background: rgba(31,182,163,0.12);
    border-left-color: var(--signal-teal);
    color: #fff;
    font-weight: 600;
}

.main-content { flex: 1; min-width: 0; }

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border-soft);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.topbar h5 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.page-wrap { padding: 28px; }

.role-badge {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}
.role-badge.super_admin { background: #17223B; color: #fff; }
.role-badge.hr_admin { background: #E8F6F4; color: #14807A; }
.role-badge.manager { background: #FFF3E0; color: #B5691A; }
.role-badge.employee { background: #EEF1F8; color: #3E5C76; }

/* ---------- Sidebar backdrop (mobile) ---------- */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1040;
}
.sidebar-backdrop.show { display: block; }

@media (max-width: 767.98px) {
    .topbar { padding: 12px 16px; }
    .page-wrap { padding: 16px; }
    .role-badge { display: none; }
}

@media (max-width: 400px) {
    .topbar h5 { max-width: 130px; font-size: 1rem; }
}

/* ---------- Cards ---------- */
.card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(23,34,59,0.04);
}

.stat-card {
    border-radius: var(--radius);
    padding: 20px;
    background: #fff;
    border: 1px solid var(--border-soft);
    position: relative;
    overflow: hidden;
}
.stat-card .stat-label {
    font-size: 0.78rem;
    color: var(--muted-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.stat-card .stat-value {
    font-family: 'Sora', sans-serif;
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--ink-navy);
    margin-top: 4px;
}
.stat-card .stat-accent {
    position: absolute; top:0; left:0; bottom:0; width: 4px;
}
.stat-card.teal .stat-accent { background: var(--signal-teal); }
.stat-card.amber .stat-accent { background: var(--amber); }
.stat-card.coral .stat-accent { background: var(--coral); }
.stat-card.navy .stat-accent { background: var(--steel-blue); }

/* ---------- Buttons ---------- */
.btn-brand {
    background: var(--ink-navy);
    color: #fff;
    border: none;
}
.btn-brand:hover { background: #232F4E; color: #fff; }

.btn-teal {
    background: var(--signal-teal);
    color: #fff;
    border: none;
}
.btn-teal:hover { background: #189485; color: #fff; }

/* ---------- Tables ---------- */
.table thead th {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    color: var(--muted-text);
    border-bottom: 2px solid var(--border-soft);
    font-weight: 700;
}
.table td { vertical-align: middle; }

/* ---------- Status pills ---------- */
.pill { padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.pill-present, .pill-approved, .pill-active, .pill-paid { background:#E6F6EF; color: var(--success); }
.pill-pending, .pill-late { background:#FFF3E0; color: var(--amber); }
.pill-absent, .pill-rejected, .pill-terminated { background:#FDEAE5; color: var(--coral); }
.pill-on_leave, .pill-half_day { background:#EEF1F8; color: var(--steel-blue); }

/* ---------- Login page ---------- */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--ink-navy) 0%, #223257 55%, var(--steel-blue) 100%);
}
.login-card {
    background: #fff;
    border-radius: 14px;
    width: 380px;
    padding: 40px 34px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.25);
}

/* ---------- Payslip print sheet ---------- */
.payslip-sheet {
    background: #fff;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px;
    border: 1px solid var(--border-soft);
}
.payslip-sheet table { width: 100%; }
@media print {
    .no-print { display: none !important; }
    .payslip-sheet { border: none; padding: 0; }
    body { background: #fff; }
}

@media (max-width: 900px) {
    .sidebar { position: fixed; left: -260px; z-index: 1050; transition: left .2s; }
    .sidebar.open { left: 0; }
}
