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

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f4f4;
    color: #333;
}

.container {
    flex: 1 0 auto;
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ---------- Header & Nav (desktop) ---------- */
.header {
    background: #fff;
    border-bottom: 2px solid #d32f2f;
    padding: 10px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo {
    height: 80px;
    width: auto;
}

.user-info span {
    margin-right: 15px;
    font-weight: 500;
}

.navbar {
    background: #fff;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.navbar ul {
    list-style: none;
    display: flex;
    padding: 10px 0;
}

.navbar li {
    margin-right: 20px;
}

.navbar a {
    text-decoration: none;
    color: #333;
    padding: 5px 0;
    font-weight: 500;
    transition: all 0.3s;
}

.navbar a:hover,
.navbar a.active {
    color: #d32f2f;
    border-bottom: 2px solid #d32f2f;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: #d32f2f;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s;
}

.btn:hover {
    background: #b71c1c;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-secondary { background: #6c757d; }
.btn-secondary:hover { background: #5a6268; }
.btn-success { background: #28a745; }
.btn-success:hover { background: #218838; }
.btn-danger { background: #dc3545; }
.btn-danger:hover { background: #c82333; }
.btn-warning { background: #ffc107; color: #333; }
.btn-warning:hover { background: #e0a800; }

/* ---------- Cards ---------- */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    padding: 20px;
}

.card-header {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #d32f2f;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* ---------- Forms ---------- */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #d32f2f;
    box-shadow: 0 0 0 3px rgba(211,47,47,0.1);
}

/* ---------- Tables (desktop) ---------- */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th {
    background: #f8f8f8;
    font-weight: 600;
    color: #555;
}

.table tr:hover {
    background: #f5f5f5;
}

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ---------- Stats Grid (desktop) ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #d32f2f;
}

.stat-label {
    color: #666;
    font-size: 14px;
    margin-top: 5px;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-pending_head, .badge-pending_deputy, .badge-pending_director {
    background: #ffe082;
    color: #ff8f00;
}

.badge-approved {
    background: #c8e6c9;
    color: #388e3c;
}

.badge-rejected {
    background: #ffcdd2;
    color: #d32f2f;
}

.badge-cancelled {
    background: #e0e0e0;
    color: #616161;
}

/* ---------- Footer ---------- */
.footer {
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 20px 0;
    text-align: center;
    color: #666;
    font-size: 14px;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.02);
}

.footer p {
    margin: 0;
}

/* ---------- Login ---------- */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #d32f2f;
    font-size: 28px;
}

/* ======================================================================
   MOBILE & TABLET (max-width: 768px)
   ====================================================================== */
@media (max-width: 768px) {

    .container {
        width: 95%;
        padding: 15px;
    }

    /* ----- Header stays in a row with hamburger ----- */
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .user-info {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 14px;
    }

    .logo {
        height: 50px;
    }

    /* ----- Hamburger ----- */
    .mobile-nav-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.8rem;
        color: #d32f2f;
        cursor: pointer;
        padding: 5px;
        margin-right: 10px;
    }

    /* ----- Nav (hidden by default, shown when .open) ----- */
    .navbar {
        display: none;
        width: 100%;
    }
    .navbar.open {
        display: block;
    }
    .navbar ul {
        flex-direction: column;
        align-items: stretch;
        padding: 10px 0;
    }
    .navbar li {
        margin: 0;
        border-bottom: 1px solid #eee;
    }
    .navbar a {
        display: block;
        padding: 12px 15px;
    }

    /* ----- 2‑column stat grid ----- */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .stat-card {
        padding: 15px 10px;
    }
    .stat-number {
        font-size: 26px;
    }
    .stat-label {
        font-size: 12px;
        line-height: 1.3;
    }

    /* ----- Cards ---------- */
    .card {
        padding: 15px;
    }
    .card-header {
        font-size: 1.2rem;
    }

    /* ----- Buttons ---------- */
    .btn {
        padding: 10px 18px;
    }
    .btn-small {
        padding: 6px 12px;
        font-size: 13px;
    }

    /* ----- Login box ---------- */
    .login-box {
        padding: 25px;
        max-width: 100%;
        margin: 0 15px;
    }

    /* ===== TABLES – default: scrollable wrapper ===== */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table {
        min-width: 500px;
    }
}

/* ======================================================================
   VERY SMALL PHONES (max-width: 600px) – Stack table rows like cards
   ====================================================================== */
@media (max-width: 600px) {

    /* Disable the scroll wrapper and its forced min-width */
    .table-responsive {
        overflow-x: visible !important;
    }

    .table-responsive .table {
        min-width: unset !important;
        display: block;
    }

    .table-responsive .table thead {
        display: none;
    }

    .table-responsive .table tbody,
    .table-responsive .table tr,
    .table-responsive .table td {
        display: block;
        width: 100%;
    }

    .table-responsive .table tr {
        margin-bottom: 15px;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 12px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    }

    .table-responsive .table td {
        border-bottom: 1px solid #f0f0f0;
        padding: 8px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 14px;
    }

    .table-responsive .table td:last-child {
        border-bottom: none;
    }

    /* Insert column label before each cell value */
    .table-responsive .table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #555;
        margin-right: 10px;
        flex-shrink: 0;
    }
}

/* ======================================================================
   DESKTOP (min-width: 769px) – Always show nav, hide hamburger
   ====================================================================== */
@media (min-width: 769px) {
    .mobile-nav-toggle {
        display: none;
    }
    .navbar {
        display: block !important;
    }
}

/* ======================================================================
   PRINT
   ====================================================================== */
@media print {
    .navbar, .mobile-nav-toggle, .btn, .user-info {
        display: none;
    }
}