/* ==========================================================================
   1. GLOBAL RESET & DESIGN VARIABLE SYSTEM — FLAT EMERALD
   ========================================================================== */
:root {
    /* Emerald Palette (primary) */
    --primary: #059669;              /* emerald 600 */
    --primary-hover: #047857;        /* emerald 700 */
    --primary-dark: #065f46;         /* emerald 800 */
    --primary-darker: #064e3b;       /* emerald 900 */
    --primary-light: #ecfdf5;        /* emerald 50  */
    --primary-border: #a7f3d0;       /* emerald 200 */

    /* Neutrals */
    --secondary: #64748b;
    --secondary-hover: #475569;

    /* Semantic colors */
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-light: #fef2f2;
    --success: #059669;
    --success-hover: #047857;
    --warning: #d97706;
    --warning-hover: #b45309;
    --warning-light: #fffbeb;

    /* Backgrounds & text */
    --bg-app: #f8fafc;
    --bg-surface: #ffffff;
    --bg-alt: #f1f5f9;
    --bg-muted: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-on-emerald: #ffffff;
    --border-color: #e2e8f0;
    --border-strong: #cbd5e1;

    /* Badges */
    --badge-recorded-bg: #d1fae5;
    --badge-recorded-text: #065f46;
    --badge-pending-bg: #fef3c7;
    --badge-pending-text: #92400e;

    /* FLAT: radii capped at 2px, shadows disabled */
    --radius-lg: 0;
    --radius-md: 2px;
    --radius-sm: 2px;
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
    --transition: all 0.15s ease;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-app);
    color: var(--text-main);
    min-height: 100vh;
    padding: 24px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    font-size: 1rem;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
}

/* ==========================================================================
   2. HEADER — DARK EMERALD FLAT BAR
   ========================================================================== */
header {
    background: var(--primary-darker);
    color: var(--text-on-emerald);
    padding: 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    border-bottom: 3px solid var(--primary);
    border-radius: 0;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #ffffff;
    background: none;
    -webkit-text-fill-color: currentColor;
}

.header-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.network-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 2px;
    font-size: 0.8rem;
    font-family: 'Consolas', 'Monaco', monospace;
    border: 1px solid rgba(255, 255, 255, 0.15);
    letter-spacing: 0.03em;
    color: #ffffff;
}

/* ==========================================================================
   3. TABS — FLAT UNDERLINE NAV
   ========================================================================== */
.tabs {
    display: flex;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    padding: 0;
    gap: 0;
}

.tab-btn {
    padding: 14px 24px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
    border-radius: 0;
    position: relative;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: rgba(5, 150, 105, 0.06);
    color: var(--primary-dark);
}

.tab-btn.active {
    background: var(--bg-surface);
    color: var(--primary-dark);
    border-bottom-color: var(--primary);
}

.tab-btn.active::after {
    display: none;
}

.tab-content {
    display: none;
    padding: 32px;
}

.tab-content.active {
    display: block;
}

/* ==========================================================================
   4. STATS GRID — FLAT CARDS WITH LEFT ACCENT
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-surface);
    padding: 20px 24px;
    border-radius: 0;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    box-shadow: none;
    transition: border-color 0.15s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before,
.stat-card::after {
    display: none;
}

.stat-card:hover {
    border-color: var(--primary);
    transform: none;
    box-shadow: none;
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--primary-darker);
    background: none;
    -webkit-text-fill-color: currentColor;
}

.stat-recorded { border-left-color: var(--success); }
.stat-recorded .stat-value { color: var(--primary-dark); }

.stat-pending { border-left-color: var(--warning); }
.stat-pending .stat-value { color: var(--warning-hover); }

/* ==========================================================================
   5. CHARTS
   ========================================================================== */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.chart-container {
    background: var(--bg-surface);
    padding: 20px 24px;
    border-radius: 0;
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--primary);
    box-shadow: none;
}

.chart-container h3 {
    margin-bottom: 16px;
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-transform: none;
}

/* ==========================================================================
   6. TABLES — FLAT WITH STRONG HEADER
   ========================================================================== */
.table-wrapper {
    overflow-x: auto;
    border-radius: 0;
    border: 1px solid var(--border-color);
}

.scrollable-table {
    max-height: 500px;
    overflow-y: auto;
    overflow-x: auto;
    border-radius: 0;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-surface);
    font-size: 0.875rem;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--primary-darker);
    color: #ffffff;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    border-bottom: 2px solid var(--primary);
}

.scrollable-table thead th {
    position: sticky;
    top: 0;
    background: var(--primary-darker);
    z-index: 10;
    backdrop-filter: none;
    border-bottom: 2px solid var(--primary);
}

tbody tr:nth-child(even) {
    background: var(--bg-alt);
}

tr:hover {
    background: var(--primary-light);
}

/* ==========================================================================
   7. FORMS & INPUTS
   ========================================================================== */
.form-container,
.reports-section,
.search-section {
    background: var(--bg-surface);
    padding: 24px;
    border-radius: 0;
    border: 1px solid var(--border-color);
    box-shadow: none;
}

.form-container h2,
.reports-section h2,
.search-section h2 {
    margin-bottom: 20px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    border-left: 4px solid var(--primary);
    padding-left: 14px;
    color: var(--text-main);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.search-fields input,
.search-fields select {
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    font-size: 0.9rem;
    font-family: inherit;
    background-color: var(--bg-surface);
    color: var(--text-main);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.search-fields input:focus,
.search-fields select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.edit-mode {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    font-size: 0.9rem;
    background-color: var(--bg-surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.edit-mode:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.search-fields {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.search-fields input,
.search-fields select {
    flex: 1;
    min-width: 180px;
}

.filter-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* ==========================================================================
   8. BUTTONS — FLAT SOLID
   ========================================================================== */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 10px 22px;
    border: none;
    border-radius: 2px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.02em;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: none;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: none;
    box-shadow: none;
}

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
    background: var(--bg-alt);
    border-color: var(--primary);
    color: var(--primary-dark);
    transform: none;
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
    box-shadow: none;
}

.btn-danger:hover {
    background: var(--danger-hover);
    transform: none;
    box-shadow: none;
}

/* ==========================================================================
   9. BADGES & STATUS — RECTANGULAR TAGS
   ========================================================================== */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 2px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-recorded {
    background: var(--badge-recorded-bg);
    color: var(--badge-recorded-text);
}

.status-pending {
    background: var(--badge-pending-bg);
    color: var(--badge-pending-text);
}

.record-count {
    margin-bottom: 14px;
    padding: 8px 14px;
    background: var(--primary-light);
    border-radius: 2px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-dark);
    display: inline-block;
    border: 1px solid var(--primary-border);
}

.info-box {
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
    padding: 14px 18px;
    margin: 20px 0;
    border-radius: 2px;
}

.info-box p {
    margin: 0;
    color: var(--primary-dark);
    font-size: 0.875rem;
}

/* ==========================================================================
   10. MODAL — FLAT PANEL
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(6, 78, 59, 0.55);
    backdrop-filter: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-content {
    background: var(--bg-surface);
    border-radius: 0;
    width: 90%;
    max-width: 750px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--primary-border);
    border-top: 4px solid var(--primary);
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
    background: var(--primary-darker);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
    border-radius: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    background: none;
    -webkit-text-fill-color: currentColor;
    letter-spacing: -0.01em;
}

.modal-header .close {
    font-size: 24px;
    font-weight: 400;
    cursor: pointer;
    transition: color 0.15s ease;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1;
}

.modal-header .close:hover {
    color: #ffffff;
    transform: none;
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
    background: var(--bg-surface);
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--bg-alt);
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-strong);
}

.modal-footer {
    padding: 16px 24px;
    background: var(--bg-alt);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Modal form fields */
.modal .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.modal .form-group {
    display: flex;
    flex-direction: column;
}

.modal .form-group label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.modal .form-group input,
.modal .form-group select {
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    background: var(--bg-surface);
}

.modal .form-group input:focus,
.modal .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.modal .checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.modal .checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-main);
    font-size: 0.875rem;
}

.modal .checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

#modalMessage {
    margin: 0 24px 16px 24px;
    padding: 10px 14px;
    border-radius: 2px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}

/* ==========================================================================
   11. LOADING OVERLAY
   ========================================================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(6, 78, 59, 0.65);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: none;
    gap: 16px;
}

.loading-overlay p {
    color: #ffffff;
    font-weight: 600;
}

.loading-spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top: 3px solid #ffffff;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   12. MESSAGES
   ========================================================================== */
.message {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 2px;
    font-size: 0.85rem;
    font-weight: 500;
    display: none;
}

.message.success {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-left: 3px solid var(--success);
    display: block;
}

.message.error {
    background: var(--danger-light);
    color: #991b1b;
    border-left: 3px solid var(--danger);
    display: block;
}

/* ==========================================================================
   13. PAGINATION
   ========================================================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 14px;
    flex-wrap: wrap;
    background: var(--bg-alt);
    border-radius: 2px;
    border: 1px solid var(--border-color);
}

.pagination button {
    padding: 7px 14px;
    border: 1px solid var(--border-strong);
    background: var(--bg-surface);
    cursor: pointer;
    border-radius: 2px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    transition: var(--transition);
}

.pagination button:hover:not(:disabled) {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pagination .page-info {
    padding: 7px 14px;
    background: var(--primary-light);
    border-radius: 2px;
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 0.8rem;
    border: 1px solid var(--primary-border);
}

.page-jump {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.page-jump input {
    width: 60px;
    padding: 6px;
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    text-align: center;
    font-family: inherit;
    font-size: 0.8rem;
}

/* ==========================================================================
   14. REPORT SUMMARY CARDS
   ========================================================================== */
.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.summary-card {
    background: var(--primary);
    color: #ffffff;
    padding: 20px 24px;
    border-radius: 0;
    text-align: center;
    border-left: 4px solid var(--primary-darker);
    box-shadow: none;
    transition: var(--transition);
}

.summary-card:hover {
    transform: none;
    box-shadow: none;
    background: var(--primary-hover);
}

.summary-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    opacity: 0.95;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.summary-value {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* ==========================================================================
   15. PRINT STYLES — unchanged
   ========================================================================== */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        background: white;
        padding: 0;
        margin: 0;
    }

    .app-container, .modal, .loading-overlay, .btn-primary,
    .btn-secondary, .btn-danger, header, .tabs, .pagination,
    .form-actions, .search-fields, .filter-fields {
        display: none !important;
    }

    .print-report-container {
        display: block !important;
        padding: 0.3in;
        margin: 0;
        width: 100%;
    }
}

.print-report-container {
    font-family: 'Times New Roman', Times, serif;
    max-width: 100%;
    margin: 0 auto;
    background: white;
}

.official-top { margin-bottom: 20px; }
.official-line-thick { border-top: 4px solid #2e7d32; width: 100%; }
.official-line-thin { border-top: 2px solid #1b5e20; width: 100%; margin-top: 2px; }

.ris-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}
.logo-container { display: flex; gap: 10px; }
.logo {
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.logo img { width: 100%; height: auto; object-fit: contain; }
.header-text { text-align: center; }
.header-text h1 { font-size: 11px; margin: 2px 0; font-weight: normal; line-height: 1.3; }
.header-text h2 { font-size: 14px; margin: 3px 0; font-weight: bold; }
.header-text h3 { font-size: 16px; margin: 12px 0 5px; font-weight: bold; text-decoration: underline; }

.info-section {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
    padding: 12px 15px;
    background: #f0f4f8;
    border-radius: 6px;
    border-left: 4px solid #2e7d32;
}
.info-box { font-size: 10px; line-height: 1.6; }
.info-box strong { color: #1b5e20; }
.info-box.right { text-align: right; }

.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.summary-table caption { font-size: 11px; font-weight: bold; margin-bottom: 8px; color: #1b5e20; }
.summary-table th, .summary-table td { border: 1px solid #333; padding: 8px 10px; text-align: center; }
.summary-table th { background: #2e7d32; color: white; font-weight: bold; }
.summary-table .recorded-row { background: #d4edda; }
.summary-table .pending-row { background: #fff3cd; }
.summary-table .total-row { background: #065f46; color: white; font-weight: bold; }

.items-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 8.5px;
    page-break-inside: avoid;
}
.items-table th, .items-table td { border: 1px solid #222; padding: 6px 4px; }
.items-table th { background: #e9ecef; font-weight: bold; text-align: center; }
.items-table td.text-center { text-align: center; }
.items-table td.text-right { text-align: right; }

.custom-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 12px;
    border-top: 1px solid #ccc;
    font-size: 8px;
    color: #666;
}

@media print {
    .summary-table .recorded-row,
    .summary-table .pending-row,
    .summary-table .total-row,
    .info-section {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .items-table tr { page-break-inside: avoid; }
}

@media screen {
    .summary-table tr:hover,
    .items-table tr:hover {
        background: rgba(5, 150, 105, 0.08);
    }
}

/* ==========================================================================
   16. USER MANAGEMENT / OFFICES TABLE
   ========================================================================== */
.user-table th,
.user-table td {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.user-table th {
    background: var(--primary-darker);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.user-table tr:hover {
    background: var(--primary-light);
}

.btn-edit {
    background: var(--warning);
    color: #ffffff;
    padding: 5px 12px;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    margin-right: 6px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    transition: background-color 0.15s ease;
}

.btn-edit:hover {
    background: var(--warning-hover);
    transform: none;
}

.btn-delete {
    background: var(--danger);
    color: white;
    padding: 5px 12px;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    transition: background-color 0.15s ease;
}

.btn-delete:hover {
    background: var(--danger-hover);
    transform: none;
}

/* ==========================================================================
   17. PROFILE PAGE (still exists as legacy in style.css)
   ========================================================================== */
.profile-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
}

.profile-card {
    background: var(--bg-surface);
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    border: 1px solid var(--border-color);
}

.profile-header {
    background: var(--primary-darker);
    color: #ffffff;
    padding: 40px 32px;
    text-align: center;
}

.profile-header .avatar {
    font-size: 64px;
    background: rgba(255, 255, 255, 0.1);
    width: 110px;
    height: 110px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    backdrop-filter: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.profile-header h2 { margin: 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.profile-header p { margin: 6px 0 0; opacity: 0.85; font-size: 0.9rem; }

.profile-body { padding: 28px; }

.profile-info-section { margin-bottom: 28px; }
.profile-info-section h3 {
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.profile-info-section h3::before { content: '👤'; font-size: 1.1rem; }

.profile-info-grid { display: flex; flex-direction: column; gap: 10px; }

.profile-info-row {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-alt);
    border-radius: 2px;
    transition: var(--transition);
    border: 1px solid transparent;
}
.profile-info-row:hover { border-color: var(--primary); background: var(--bg-surface); }
.profile-info-label {
    width: 130px;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.profile-info-value { flex: 1; color: var(--text-main); font-weight: 500; }
.profile-info-value.editable {
    cursor: pointer;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.profile-info-value.editable::after {
    content: '✏️';
    font-size: 0.75rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.profile-info-value.editable:hover::after { opacity: 1; }
.profile-info-value.editable:hover { text-decoration: underline; }

.profile-edit-form {
    background: var(--bg-alt);
    padding: 18px;
    border-radius: 2px;
    margin-bottom: 18px;
    border-left: 4px solid var(--primary);
}
.profile-edit-form .form-group { margin-bottom: 14px; }
.profile-edit-form .form-group label {
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 6px;
    display: block;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.profile-edit-form .form-group input,
.profile-edit-form .form-group select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg-surface);
}
.profile-edit-form .form-actions { display: flex; gap: 10px; margin-top: 14px; }

.profile-password-section {
    background: var(--bg-alt);
    padding: 22px;
    border-radius: 2px;
    margin-top: 28px;
    border: 1px solid var(--border-color);
}
.profile-password-section h3 {
    margin-top: 0;
    margin-bottom: 18px;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.profile-password-section h3::before { content: '🔐'; }
.profile-password-section .form-group { margin-bottom: 14px; }
.profile-password-section .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.profile-password-section .form-group input {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg-surface);
}
.profile-password-section .form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.password-hint { font-size: 0.7rem; color: var(--text-muted); margin-top: 6px; }

@media (max-width: 768px) {
    .profile-container { padding: 16px; }
    .profile-header { padding: 28px 20px; }
    .profile-header .avatar { width: 80px; height: 80px; font-size: 44px; }
    .profile-header h2 { font-size: 1.25rem; }
    .profile-body { padding: 20px; }
    .profile-info-row { flex-direction: column; align-items: flex-start; gap: 6px; }
    .profile-info-label { width: 100%; }
    .profile-info-value.editable::after { content: ' (click to edit)'; font-size: 0.65rem; }
}

/* ==========================================================================
   18. BANNER + MODAL-BASED ARCHITECTURE ADDITIONS
   ========================================================================== */
.banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    font-size: 0.9rem;
    flex-wrap: wrap;
    border-radius: 0;
}
.banner.warning {
    background: var(--warning-light);
    color: #78350f;
    border-bottom: 1px solid var(--warning);
    border-left: 4px solid var(--warning);
}
.banner.warning .btn-primary {
    background: var(--danger);
    padding: 8px 18px;
    font-size: 0.8rem;
}

.modal-content.modal-lg { max-width: 900px; }
.modal-content.modal-xl { max-width: 1100px; }
.modal.modal-stacked { z-index: 10010; }

.modal-tabs {
    display: flex;
    gap: 0;
    padding: 0;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border-color);
}
.modal-tab {
    padding: 12px 20px;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 0;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
}
.modal-tab:hover { background: rgba(5, 150, 105, 0.06); color: var(--primary-dark); }
.modal-tab.active {
    background: var(--bg-surface);
    color: var(--primary-dark);
    border-bottom-color: var(--primary);
    margin-bottom: -1px;
}

.profile-tab-content { display: none; }
.profile-tab-content.active { display: block; }

.form-container.compact {
    padding: 18px;
    background: var(--bg-alt);
    border-radius: 2px;
    border: 1px solid var(--border-color);
}
.form-container.compact h3 {
    margin: 0 0 14px;
    font-size: 0.95rem;
    font-weight: 700;
    border-left: 4px solid var(--primary);
    padding-left: 12px;
    color: var(--text-main);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}
.chart-header h3 { margin: 0; }
.chart-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chart-filters select {
    padding: 6px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    font-family: inherit;
    font-size: 0.8rem;
    background: var(--bg-surface);
}
.chart-filters .btn-secondary { padding: 6px 12px; font-size: 0.8rem; }

.print-report-container { display: none; }

@media print {
    .print-report-container {
        display: block !important;
        padding: 0.3in;
        margin: 0;
        width: 100%;
    }
    .app-container,
    .modal,
    .loading-overlay,
    .banner,
    header,
    .tabs {
        display: none !important;
    }
}

/* ==========================================================================
   19. RESPONSIVE
   ========================================================================== */
@media (max-width: 1200px) {
    .scrollable-table { overflow-x: auto; }
    #searchResultsTable { min-width: 1000px; }
}

@media (max-width: 768px) {
    body { padding: 12px; }
    header { padding: 16px 20px; }
    header h1 { font-size: 1.15rem; }

    .tabs { flex-direction: column; padding: 0; }
    .tab-btn {
        border-radius: 0;
        text-align: left;
        border-bottom: 1px solid var(--border-color);
        border-left: 3px solid transparent;
    }
    .tab-btn.active {
        background: var(--primary-light);
        color: var(--primary-dark);
        border-bottom-color: var(--border-color);
        border-left-color: var(--primary);
    }
    .tab-content { padding: 20px; }
    .charts-row, .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px 16px; }
    .stat-value { font-size: 1.4rem; }
    .btn-primary, .btn-secondary, .btn-danger { padding: 8px 16px; font-size: 0.8rem; }

    .modal-content { width: 95%; max-height: 90vh; }
    .modal-header { padding: 14px 18px; }
    .modal-header h2 { font-size: 1rem; }
    .modal-body { padding: 18px; }
    .modal .form-row { grid-template-columns: 1fr; gap: 12px; }
    .modal-footer { padding: 12px 18px; flex-direction: column; }
    .modal-footer button { width: 100%; }

    .profile-header .avatar { width: 80px; height: 80px; font-size: 44px; }
    .report-summary { grid-template-columns: 1fr; gap: 12px; }
    .pagination { flex-direction: column; align-items: stretch; }
    .page-jump { justify-content: center; }
}

/* ==========================================================================
   20. HEADER BUTTON OVERRIDES — TRANSPARENT ON DARK
   ========================================================================== */
header .btn-secondary,
header .btn-primary,
header .btn-danger {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 2px;
}

header .btn-secondary:hover,
header .btn-primary:hover,
header .btn-danger:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.35);
    transform: none;
    box-shadow: none;
}

header .btn-danger {
    background: rgba(220, 38, 38, 0.25);
    border-color: rgba(220, 38, 38, 0.4);
}

header .btn-danger:hover {
    background: rgba(220, 38, 38, 0.4);
}

/* ==========================================================================
   21. LOGIN PAGE — FLAT EMERALD (scoped to body.login-page)
   ========================================================================== */
body.login-page {
    margin: 0;
    padding: 24px;
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--primary-darker);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.login-page .login-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border: 1px solid var(--primary);
    border-top: 4px solid var(--primary);
    border-radius: 0;
    animation: loginFadeIn 0.35s ease-out;
}

@keyframes loginFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

body.login-page .login-card-header {
    padding: 32px 32px 24px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

body.login-page .login-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: #ffffff;
    font-size: 50px;
    border-radius: 0;
    margin-bottom: 14px;
}

body.login-page .login-card-header h1 {
    margin: 0 0 4px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

body.login-page .login-card-header p {
    margin: 0;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

body.login-page .login-card-body { padding: 32px; }

body.login-page .login-field { margin-bottom: 20px; }

body.login-page .login-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #334155;
}

body.login-page .login-field input[type="text"],
body.login-page .login-field input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
    background: #ffffff;
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body.login-page .login-field input[type="text"]:focus,
body.login-page .login-field input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

body.login-page .login-field input.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

body.login-page .login-field input::placeholder { color: #94a3b8; }

body.login-page .login-remember {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

body.login-page .login-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

body.login-page .login-remember label {
    font-size: 0.85rem;
    color: var(--text-secondary, #475569);
    cursor: pointer;
    user-select: none;
    margin: 0;
}

body.login-page .login-submit {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 2px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

body.login-page .login-submit:hover:not(:disabled) { background: var(--primary-hover); }
body.login-page .login-submit:active:not(:disabled) { background: var(--primary-dark); }
body.login-page .login-submit:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
body.login-page .login-submit:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    opacity: 0.85;
}

body.login-page .message {
    display: none;
    margin: 0 0 20px;
    padding: 12px 14px;
    font-size: 0.85rem;
    line-height: 1.4;
    border-left: 3px solid;
    border-radius: 2px;
}

body.login-page .message.error {
    display: block;
    background: var(--danger-light);
    color: #991b1b;
    border-left-color: var(--danger);
}

body.login-page .message.success {
    display: block;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-left-color: var(--primary);
}

body.login-page .login-footer-note {
    padding: 16px 32px;
    background: var(--bg-alt);
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.55;
    color: var(--text-muted);
}

body.login-page .login-footer-note strong {
    display: block;
    margin-bottom: 2px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    color: #334155;
}

body.login-page .login-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: loginSpin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: -2px;
}

@keyframes loginSpin { to { transform: rotate(360deg); } }

body.login-page .login-noscript {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(6, 78, 59, 0.9);
    color: #ffffff;
    text-align: center;
    z-index: 9999;
}

body.login-page .login-noscript h2 { margin: 0 0 12px; font-size: 1.25rem; }
body.login-page .login-noscript p { margin: 0; font-size: 0.95rem; opacity: 0.85; max-width: 380px; }

@media (max-width: 480px) {
    body.login-page { padding: 16px; }
    body.login-page .login-card-header { padding: 24px 20px 20px; }
    body.login-page .login-card-body { padding: 24px 20px; }
    body.login-page .login-footer-note { padding: 14px 20px; }
    body.login-page .login-card-header h1 { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    body.login-page .login-card,
    body.login-page .login-spinner,
    .modal-content,
    .modal,
    .tab-content,
    .loading-spinner {
        animation: none;
    }
}