/* Sapio Ltd brand tokens — see ~/.claude/skills/sapio-brand/ */
:root {
    --primary: #B71C1C;
    --primary-hover: #7F1212;
    --primary-soft: rgba(183, 28, 28, 0.08);
    --secondary: #15803D;
    --secondary-soft: rgba(21, 128, 61, 0.08);
    --danger: #DC2626;
    --danger-hover: #B91C1C;
    --warning: #D97706;
    --background: #F5F5F4;
    --surface: #FFFFFF;
    --surface-glass: rgba(255, 255, 255, 0.85);
    --text-main: #1A1A1A;
    --text-muted: #6B7280;
    --border: #E5E5E5;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --gradient-brand: linear-gradient(135deg, #1A1A1A 0%, #B71C1C 100%);
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    font-feature-settings: "tnum";
}

/* Visibility */
.hidden { display: none !important; }

/* Buttons */
button {
    font-family: inherit;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
}
.btn-primary { background: var(--primary); color: white; box-shadow: var(--shadow-md); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-danger { background: var(--danger); color: white; box-shadow: var(--shadow-md); }
.btn-danger:hover { background: var(--danger-hover); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-danger:disabled { background: #FCA5A5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-success { background: var(--secondary); color: white; }
.btn-text { background: transparent; color: var(--primary); padding: 0; }
.btn-text:hover { color: var(--primary-hover); text-decoration: underline; }
.btn-lg { padding: 14px 28px; font-size: 1.1rem; border-radius: 100px; }
.btn-block { width: 100%; display: flex; }
.btn-icon { background: transparent; color: var(--text-muted); padding: 8px; border-radius: 50%; }
.btn-icon:hover { background: var(--border); color: var(--text-main); }

/* Forms */
.form-group { margin-bottom: 20px; display: flex; flex-direction: column; }
.form-group label { font-size: 0.9rem; font-weight: 500; margin-bottom: 6px; color: var(--text-muted); }
.form-group-row { display: flex; gap: 15px; }
.form-group-row > .form-group { flex: 1; }

input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--surface);
    color: var(--text-main);
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(183, 28, 28, 0.1);
}
.input-group {
    position: relative;
    margin-bottom: 20px;
}
.input-group span {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.input-group input { padding-left: 45px; }

/* ── Login: split-screen ───────────────────────────────────────────── */
#login-view {
    display: grid;
    grid-template-columns: minmax(420px, 5fr) 7fr;
    width: 100vw;
    height: 100vh;
    background: var(--surface);
    position: fixed;
    top: 0; left: 0; z-index: 1000;
}

.login-hero {
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 64px 72px;
    position: relative;
    overflow: hidden;
}
.login-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 85% 110%, rgba(255, 255, 255, 0.10) 0%, transparent 55%),
        radial-gradient(circle at 10% -10%, rgba(0, 0, 0, 0.20) 0%, transparent 50%);
    pointer-events: none;
}
.login-hero-inner {
    max-width: 440px;
    position: relative;
    z-index: 1;
}
.login-hero-logo {
    width: 150px;
    height: auto;
    margin-bottom: 56px;
    filter: brightness(0) invert(1);
    opacity: 0.95;
}
.login-hero h1 {
    font-size: 2.75rem;
    font-weight: 700;
    letter-spacing: -1.2px;
    line-height: 1.05;
    margin-bottom: 22px;
}
.login-hero-tagline {
    font-size: 1.05rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 38px;
}
.login-hero-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.login-hero-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.93rem;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.95);
}
.login-hero-features .material-icons-round {
    font-size: 14px;
    background: rgba(255, 255, 255, 0.15);
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.login-form-panel {
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 64px;
}
.login-form-inner {
    width: 100%;
    max-width: 380px;
}
.login-form-inner h2 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    color: var(--text-main);
}
.login-form-inner .muted {
    color: var(--text-muted);
    margin-bottom: 36px;
    font-size: 0.95rem;
}
.login-form-inner .form-group { margin-bottom: 18px; }
.login-form-inner .btn-primary { margin-top: 6px; }
.login-footer-line {
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}
.login-footer-line strong { color: var(--text-main); font-weight: 600; }

/* Reusable sidebar logo (kept) */
.brand-logo-sm {
    width: 130px;
    height: auto;
    margin: 0;
    display: block;
}

@media (max-width: 900px) {
    #login-view {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    .login-hero { padding: 40px; }
    .login-hero-logo { margin-bottom: 28px; width: 120px; }
    .login-hero h1 { font-size: 1.85rem; }
    .login-hero-features { display: none; }
    .login-form-panel { padding: 40px; }
}

/* Dashboard Layout */
#dashboard-view {
    display: flex;
    width: 100%;
    min-height: 100vh;
}
.sidebar {
    width: 280px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    transition: transform 0.3s ease;
    z-index: 50;
    position: relative;
}
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px 30px;
}
.sidebar-header .logo-icon { font-size: 32px; margin: 0; }
.sidebar-header .brand-logo { margin: 0; }
.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 12px;
}
.nav-btn {
    background: transparent;
    color: var(--text-muted);
    justify-content: flex-start;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    font-size: 1.05rem;
}
.nav-btn:hover { background: var(--background); color: var(--text-main); transform: none; box-shadow: none; }
.nav-btn.active {
    background: var(--primary-soft);
    color: var(--primary);
}
.nav-btn .badge {
    margin-left: auto;
    background: #FEF3C7;
    color: #D97706;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
}

.sidebar-footer {
    padding: 20px 24px 0;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.user-info { display: flex; align-items: center; gap: 12px; }
.avatar { 
    width: 40px; height: 40px; 
    border-radius: 50%; 
    background: var(--background); 
    display: flex; align-items: center; justify-content: center; color: var(--primary); 
}
.details { display: flex; flex-direction: column; }
.details strong { font-size: 0.95rem; }
.details span { font-size: 0.8rem; color: var(--text-muted); text-transform: capitalize; }

/* Main Content */
.main-content {
    flex: 1;
    padding: 0 40px;
    height: 100vh;
    overflow-y: auto;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 0;
    gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
}
.menu-toggle:hover { background: var(--background); }
.menu-toggle .material-icons-round { font-size: 28px; }
.sidebar-backdrop { display: none; }
.topbar h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.5px; }
.clock { font-size: 1.25rem; font-weight: 500; color: var(--text-muted); background: var(--surface); padding: 8px 16px; border-radius: 100px; box-shadow: var(--shadow-sm); }

.content-panels { padding-bottom: 50px; }

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255,255,255,0.5);
    transition: var(--transition);
}
.card.premium-card { background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%); box-shadow: var(--shadow-md); border: 1px solid var(--border); }
.card.premium-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.card h3 { margin-bottom: 20px; color: var(--text-main); font-weight: 600; }

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}
.split-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
    align-items: start;
}

/* Specific Cards */
.clock-card { text-align: center; }
.status-indicator {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 100px;
    font-weight: 600;
    margin-bottom: 25px;
    font-size: 1.1rem;
    background: var(--background); color: var(--text-muted);
}
.status-indicator.is-in { background: #D1FAE5; color: #065F46; }
.status-indicator.is-out { background: #FEE2E2; color: #991B1B; }

.action-buttons {
    display: flex; justify-content: center; gap: 20px; margin-bottom: 20px;
}
.meta-info { color: var(--text-muted); font-size: 0.95rem; }

.stat-card {
    display: flex; align-items: center; gap: 20px;
}
.bg-icon { font-size: 64px; color: var(--primary-soft); }
.stat-info h4 { font-size: 1.25rem; margin-bottom: 4px; }
.stat-info p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 10px; }

/* Tables */
.table-responsive { overflow-x: auto; }
.premium-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    text-align: left;
}
.premium-table th {
    padding: 12px 16px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.premium-table td {
    padding: 16px;
    background: var(--background);
}
.premium-table tr td:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.premium-table tr td:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.premium-table tbody tr { transition: var(--transition); }
.premium-table tbody tr:hover td { background: #e5e7eb; }

.badge {
    padding: 4px 10px; border-radius: 100px; font-size: 0.8rem; font-weight: 600; display: inline-block;
}
.badge-pending { background: #FEF3C7; color: #D97706; }
.badge-approved { background: #D1FAE5; color: #065F46; }
.badge-rejected { background: #FEE2E2; color: #991B1B; }

/* Toast */
#toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
}
.toast {
    background: white; border-left: 4px solid var(--primary);
    padding: 16px 24px; margin-bottom: 10px;
    border-radius: 8px; box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease forwards;
    display: flex; align-items: center; gap: 12px;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--secondary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Modal — top-aligned with internal scroll so the close button is never clipped */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(4px);
    display: flex; align-items: flex-start; justify-content: center;
    overflow-y: auto;
    padding: 32px 16px;
    z-index: 2000;
}
.modal-content {
    background: white;
    padding: 0; /* let inner sections control their own padding */
    border-radius: var(--radius-lg);
    width: 720px; max-width: 100%;
    position: relative;
    box-shadow: 0 25px 60px -12px rgba(0,0,0,0.4);
    margin: auto;
}
.modal-content:not(.fiche-modal) { padding: 36px; }
.close-modal {
    position: absolute;
    top: 14px; right: 14px;
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.92);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-main);
    z-index: 3;
    transition: background 0.2s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.close-modal:hover { background: #fff; transform: scale(1.06); color: var(--primary); }

/* ── Fiche de Paye — redesigned ───────────────────────────────────── */
.fiche-modal { width: 820px; }
.fiche {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    font-feature-settings: "tnum";
}
.fiche-band {
    background: linear-gradient(135deg, #1A1A1A 0%, #B71C1C 100%);
    color: #fff;
    padding: 26px 40px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
}
.fiche-band .co-name { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.3px; }
.fiche-band .co-meta { font-size: 0.85rem; opacity: 0.85; margin-top: 4px; line-height: 1.5; }
.fiche-band .period-tag {
    text-align: right;
    flex-shrink: 0;
}
.fiche-band .period-tag .doc-type {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.75;
}
.fiche-band .period-tag .period {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 2px;
    letter-spacing: -0.3px;
}

.fiche-body { padding: 30px 40px 36px; }

.fiche-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
    margin-bottom: 28px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
}
.fiche-meta-grid .field { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; }
.fiche-meta-grid .field .label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}
.fiche-meta-grid .field .value {
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 500;
}
.fiche-meta-grid .field.primary .value { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.2px; }

.fiche-leave {
    display: grid;
    grid-template-columns: auto auto auto auto;
    gap: 12px 16px;
    align-items: center;
    margin-bottom: 28px;
    padding: 14px 18px;
    background: var(--background);
    border-radius: var(--radius-md);
    font-size: 0.88rem;
}
.fiche-leave .head { font-weight: 600; color: var(--text-muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; }
.fiche-leave .type { font-weight: 500; }
.fiche-leave .num { font-feature-settings: "tnum"; text-align: right; }
.fiche-leave .num.taken { color: var(--primary); font-weight: 600; }

.fiche-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }
@media (max-width: 700px) { .fiche-sections { grid-template-columns: 1fr; gap: 24px; } }
.fiche-section { display: flex; flex-direction: column; }
.fiche-section .section-head {
    display: flex; justify-content: space-between;
    border-bottom: 2px solid var(--text-main);
    padding-bottom: 8px;
    margin-bottom: 12px;
}
.fiche-section .section-head h4 {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-main);
}
.fiche-section .section-head .unit {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.fiche-line { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; font-size: 0.93rem; }
.fiche-line .item { color: var(--text-main); }
.fiche-line .item small { color: var(--primary); font-size: 0.72rem; font-weight: 600; margin-left: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.fiche-line .amt { font-feature-settings: "tnum"; font-weight: 500; color: var(--text-main); }
.fiche-line.total {
    border-top: 1px solid var(--border);
    margin-top: 6px;
    padding-top: 10px;
    font-weight: 700;
    font-size: 0.95rem;
}
.fiche-line.total .amt { color: var(--text-main); }

.fiche-netpay {
    margin-top: 28px;
    background: linear-gradient(135deg, var(--primary-soft) 0%, transparent 100%);
    border: 1px solid var(--primary-line);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.fiche-netpay .label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    font-weight: 600;
}
.fiche-netpay .label strong { display: block; color: var(--primary); font-size: 1.15rem; font-weight: 700; letter-spacing: -0.3px; margin-top: 2px; }
.fiche-netpay .amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -1px;
    font-feature-settings: "tnum";
}

.fiche-employer {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}
.fiche-employer .section-head {
    display: flex; justify-content: space-between;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    margin-bottom: 12px;
}
.fiche-employer .section-head h4 {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
}
.fiche-employer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 36px; }
@media (max-width: 700px) { .fiche-employer-grid { grid-template-columns: 1fr; } }
.fiche-employer .total {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    grid-column: 1 / -1;
}

.fiche-sign {
    margin-top: 36px;
    padding-top: 18px;
    border-top: 1px dashed var(--border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.fiche-sign .line {
    border-bottom: 1px solid var(--text-main);
    height: 38px;
    margin-top: 6px;
}

/* ── Print: revert to stark, regulatory look ──────────────────────── */
@media print {
    .fiche-band { background: #fff !important; color: #000 !important; border-bottom: 2px solid #000; padding: 0 0 16px; border-radius: 0; }
    .fiche-band .co-name, .fiche-band .period-tag .period { color: #000; }
    .fiche-band .co-meta, .fiche-band .period-tag .doc-type { color: #444; }
    .fiche-body { padding: 16px 0 0; }
    .fiche-netpay { background: #fff !important; border: 2px solid var(--primary); }
    .fiche-leave { background: #fafafa; border: 1px solid #ccc; }
    .fiche-meta-grid { border-bottom: 1px solid #000; }
    .fiche-section .section-head { border-bottom-color: #000; }
    .close-modal { display: none; }
    .modal { position: static; background: transparent; padding: 0; }
    .modal-content { box-shadow: none; max-width: 100%; }
}

/* Utilities */
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.pt-4 { padding-top: 16px; }
.border-top { border-top: 1px solid var(--border); }
.inline-form { display: flex; gap: 10px; align-items: center; }
.text-muted { color: var(--text-muted); }
.block { display: block; }

/* Print Styles for Fiche de Paye Modal */
@media print {
    body * {
        visibility: hidden;
    }
    #payslip-print-area, #payslip-print-area * {
        visibility: visible;
    }
    #payslip-print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 20px;
    }
    .no-print {
        display: none !important;
    }
}

/* Day-of-week pill toggles (shift form) */
.day-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 100px;
    font-size: 0.9rem; cursor: pointer; user-select: none;
    transition: var(--transition);
}
.day-pill input { width: auto; margin: 0; cursor: pointer; }
.day-pill:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }

/* Roster cards */
.roster-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
}
.roster-card h4 {
    margin-bottom: 4px;
    font-size: 1rem;
    color: var(--text-main);
}
.roster-card .roster-meta { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 12px; }
.roster-card ul { list-style: none; }
.roster-card li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.roster-card li:last-child { border-bottom: none; }

/* ── Report KPI Cards ───────────────────────────────────────── */
.kpi-box {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.kpi-box.kpi-highlight {
    background: var(--primary);
    border-color: transparent;
}
.kpi-box.kpi-highlight .kpi-label,
.kpi-box.kpi-highlight .kpi-value { color: #fff; }
.kpi-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.kpi-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
}
.kpi-box-sm {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.kpi-value-sm {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
}
#report-mc-tbody tr:last-child {
    font-weight: 700;
    background: var(--background);
    border-top: 2px solid var(--border);
}

/* ───────────────── Mobile responsive (≤ 900px) ───────────────── */
@media (max-width: 900px) {
    body {
        display: block;
        min-height: 100vh;
    }

    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }

    /* Sidebar slides in over the content from the left */
    #dashboard-view { flex-direction: column; }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: min(280px, 82vw);
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
        z-index: 100;
        background: var(--surface);
        padding-top: 16px;
    }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 99;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .sidebar-backdrop.is-open { opacity: 1; pointer-events: auto; }

    .main-content {
        padding: 0 16px;
        height: auto;
        overflow-y: visible;
        width: 100%;
    }

    .topbar { padding: 16px 0; }
    .topbar h1 { font-size: 1.4rem; }
    .clock { font-size: 0.85rem; padding: 4px 10px; }

    /* Stack two-column layouts */
    .split-layout,
    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    .form-group-row { flex-direction: column; gap: 0; }
    .form-group-row > .form-group { width: 100%; }

    /* Cards a touch tighter */
    .card { padding: 22px; border-radius: var(--radius-md); }
    .card.premium-card { padding: 22px; }
    .card.premium-card:hover { transform: none; }

    /* Inline filter rows — let them wrap nicely */
    .inline-form { flex-wrap: wrap; gap: 8px; width: 100%; }
    .inline-form > input,
    .inline-form > select { flex: 1 1 calc(50% - 4px); min-width: 0; }
    .inline-form > button { flex: 1 1 100%; }

    /* KPI grid: 2-up on phones rather than 1 huge column */
    #payroll-summary-kpis,
    [style*="grid-template-columns: repeat(auto-fit"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Action buttons (Clock In / Clock Out) — stack and full-width for touch */
    .action-buttons { flex-direction: column; gap: 12px; }
    .action-buttons > button { width: 100%; }
    .btn-lg { padding: 14px 22px; font-size: 1rem; }

    /* Tables — keep horizontal scroll, tighten cells */
    .premium-table th, .premium-table td { padding: 12px 10px; font-size: 0.9rem; }

    /* Modal: take the screen */
    .modal-content { width: 95vw !important; max-width: 95vw !important; padding: 24px 18px; }
    .fiche-modal { width: 95vw !important; }

    /* Payslip-generate form: each control on its own line */
    #generate-payslip-form > input,
    #generate-payslip-form > select { width: 100% !important; }

    /* Login already stacks via the existing rule, but tighten the hero */
    .login-hero { padding: 32px 28px; }
    .login-hero-logo { width: 110px; margin-bottom: 22px; }
    .login-hero h1 { font-size: 1.7rem; }
    .login-hero-tagline { font-size: 0.95rem; margin-bottom: 22px; }
    .login-form-panel { padding: 32px 24px; }
    .login-form-inner h2 { font-size: 1.6rem; }
}

@media (max-width: 480px) {
    .topbar h1 { font-size: 1.15rem; }
    .clock { display: none; }
    #payroll-summary-kpis,
    [style*="grid-template-columns: repeat(auto-fit"] {
        grid-template-columns: 1fr !important;
    }
    .login-hero-features { display: none; }
}
