* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #f0f4f8;
    color: #1a202c;
    padding-bottom: 40px;
    font-size: 15px;
    line-height: 1.5;
}

/* --- Top Navigation Bar --- */
.nav-bar {
    background: #0b3954;
    color: #ffffff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.nav-bar span {
    font-weight: 700;
    font-size: 1rem;
}

.nav-link {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
}

/* --- Main Layout Containers --- */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 20px auto;
    padding: 0 16px;
}

.container-sm {
    max-width: 600px;
}

.card {
    background: #ffffff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.card h2 {
    margin-bottom: 16px;
    color: #0b3954;
    font-size: 1.25rem;
}

/* --- Form Fields & Inputs --- */
.form-group {
    margin-bottom: 14px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.flex-1 {
    flex: 1;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #4a5568;
}

/* 16px font-size prevents Safari on iOS from auto-zooming on focus */
input[type="text"],
input[type="number"],
input[type="date"] {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 16px; 
    color: #2d3748;
    background-color: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
    border-color: #087e8b;
    box-shadow: 0 0 0 3px rgba(8, 126, 139, 0.15);
}

input[readonly] {
    background-color: #f7fafc;
    color: #718096;
    border-color: #e2e8f0;
}

.input-with-status {
    position: relative;
}

.status-indicator {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
}

/* --- Touch-Friendly Radio Buttons --- */
.radio-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #edf2f7;
    padding: 10px 8px;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
    text-align: center;
    user-select: none;
}

.radio-label input[type="radio"] {
    accent-color: #0b3954;
}

/* --- Buttons --- */
button {
    cursor: pointer;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    padding: 12px 18px;
    font-size: 0.95rem;
    transition: background-color 0.2s;
}

#submitBtn {
    width: 100%;
    background: #0b3954;
    color: white;
    margin-top: 10px;
    padding: 14px;
}

#submitBtn:active {
    background: #062335;
}

.btn-secondary { background: #087e8b; color: white; }
.btn-ghost { background: #e2e8f0; color: #4a5568; }
.btn-email { background: #2f855a; color: white; }

/* --- Summary Filter Bar --- */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
}

.filter-inputs {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
}

.filter-item {
    flex: 1;
    min-width: 140px;
}

/* --- Responsive Table Handling --- */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    min-width: 480px; /* Forces scroll container rather than squishing text */
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    text-align: left;
}

th {
    background-color: #f7fafc;
    color: #4a5568;
    white-space: nowrap;
}

.grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* --- Alerts --- */
.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 0.9rem;
}
.alert.success { background: #c6f6d5; color: #22543d; }
.alert.error { background: #fed7d7; color: #742a2a; }
.hidden { display: none; }


/* ========================================================= */
/* --- Mobile Viewport Breakpoint (Phones < 768px) --- */
/* ========================================================= */
@media (max-width: 768px) {
    body {
        padding-bottom: 24px;
    }

    .container {
        margin: 12px auto;
        padding: 0 12px;
    }

    .card {
        padding: 16px;
        border-radius: 8px;
    }

    /* Stack form row items into full-width vertical blocks */
    .form-row {
        flex-direction: column;
        gap: 12px;
    }

    /* Stack radio choices for readable finger targets */
    .radio-options {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .radio-label {
        justify-content: flex-start;
        padding: 12px 14px;
    }

    /* Stack summary grid */
    .grid-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Stack filter bar and make buttons full-width */
    .filter-bar,
    .filter-inputs {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .filter-item {
        width: 100%;
    }

    .filter-inputs button,
    #mailReportBtn {
        width: 100%;
        margin-top: 4px;
    }

    /* Header styling */
    .nav-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .nav-link {
        align-self: flex-start;
    }
}