/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #374151;
    background-color: #ffffff;
}

/* App Layout */
.app-container {
    display: grid;
    grid-template-columns: 160px 1fr;
    height: 100vh;
    transition: grid-template-columns 0.3s ease-out;
}

.app-container.sidebar-collapsed {
    grid-template-columns: 0px 1fr;
}

/* Sidebar Styles */
.sidebar {
    background-color: #f5f5f5;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: margin-left 0.3s ease-out;
}

.app-container.sidebar-collapsed .sidebar {
    margin-left: -160px;
}

/* Navigation Styles */
.sidebar-nav {
    padding: 16px 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 4px;
    text-decoration: none;
    color: #374151;
    border-radius: 8px;
    transition: all 0.2s ease-out;
    position: relative;
}

.nav-item:hover {
    background-color: #f8fafc;
}

.nav-item-active {
    background-color: #f1f5f9;
    font-weight: 600;
    border-left: 3px solid #3b82f6;
}

.nav-item-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: #3b82f6;
}

.nav-icon {
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.nav-icon svg {
    stroke: #6b7280;
    transition: stroke 0.2s ease-out;
}

.nav-item:hover .nav-icon svg {
    stroke: #374151;
}

.nav-item-active .nav-icon svg {
    stroke: #3b82f6;
}

.nav-item-logout {
    margin-top: auto;
    color: #dc2626;
}

.nav-item-logout:hover {
    background-color: #fee2e2;
    color: #dc2626;
}

.nav-item-logout .nav-icon svg {
    stroke: #dc2626;
}

.nav-text {
    font-size: 14px;
    font-weight: 400;
}

/* Main Content */
.main-content {
    background-color: #ffffff;
    overflow-y: auto;
    transition: margin-left 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.main-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-user {
    color: #6b7280;
    font-size: 14px;
}

.main-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease-out;
}

.main-toggle:hover {
    background-color: #f3f4f6;
}

.content-wrapper {
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
    flex: 1;
    width: 100%;
}

/* Page Content */
.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.content-area {
    line-height: 1.6;
}

.content-area p {
    margin-bottom: 24px;
    color: #6b7280;
    font-size: 16px;
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.feature-card {
    padding: 24px;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.feature-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 12px;
}

.feature-card p {
    color: #6b7280;
    margin: 0;
    font-size: 14px;
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 24px;
}

.flash-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 14px;
}

.flash-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.flash-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.flash-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* User Info Styles */
.user-info-card,
.settings-section {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.user-info-card h3,
.settings-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 16px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 500;
    color: #374151;
}

.info-value {
    color: #6b7280;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
        position: relative;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease-out;
        width: 160px;
    }

    .app-container.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .app-container.sidebar-collapsed {
        grid-template-columns: 1fr;
    }

    .app-container.sidebar-collapsed .sidebar {
        margin-left: 0;
    }

    .content-wrapper {
        padding: 16px;
    }

    .main-header {
        padding: 16px;
    }

    .page-header h1 {
        font-size: 24px;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Focus Styles for Accessibility */
.nav-item:focus,
.main-toggle:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

html {
    scroll-behavior: smooth;
}

/* ─── User Management ────────────────────────────────────────────────── */

.user-management-container {
    max-width: 1200px;
    margin: 0 auto;
}

.add-user-section {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 32px;
}

.add-user-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 16px;
}

.user-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background-color: #ffffff;
    transition: border-color 0.2s ease-out;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-out;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
}

.btn-danger {
    background-color: #dc2626;
    color: white;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-warning {
    background-color: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    margin-right: 4px;
}

.users-list-section {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background-color: #f9fafb;
}

.section-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.users-table-container {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #ffffff;
}

.users-table th {
    background-color: #f9fafb;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e5e7eb;
}

.users-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
    color: #374151;
}

.users-table tr:hover {
    background-color: #f9fafb;
}

.username {
    font-weight: 500;
    color: #111827;
}

.current-user-badge {
    background-color: #dbeafe;
    color: #1e40af;
    font-size: 10px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    text-transform: uppercase;
}

.role-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.role-admin {
    background-color: #fee2e2;
    color: #991b1b;
}

.role-user {
    background-color: #e0f2fe;
    color: #0277bd;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-active {
    background-color: #d1fae5;
    color: #065f46;
}

.status-inactive {
    background-color: #fef3c7;
    color: #92400e;
}

.actions-cell {
    white-space: nowrap;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: #ffffff;
    margin: 5% auto;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.modal-close {
    font-size: 24px;
    font-weight: bold;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.modal-close:hover {
    color: #374151;
}

.modal form {
    padding: 24px;
}

.modal .form-group {
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    margin: 0;
    color: #374151;
    line-height: 1.5;
}

/* Login Page Styles */
body.login-page {
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    background: white;
    padding: 48px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.login-header p {
    color: #6b7280;
    font-size: 14px;
}

.login-container .form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease-out;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.login-button {
    width: 100%;
    background-color: #3b82f6;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease-out;
}

.login-button:hover {
    background-color: #2563eb;
}

.login-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}


/* ═══════════════════════════════════════════════════════════════════════
   INCIDENT REGISTER STYLES
   ═══════════════════════════════════════════════════════════════════════ */

/* Page header */
.incidents-page {
    width: 100%;
}

.incidents-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
    gap: 16px;
}

.incidents-header-left h1 {
    font-size: 28px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.incidents-header-right {
    flex-shrink: 0;
}

.incidents-count {
    font-size: 14px;
    color: #6b7280;
    font-weight: 400;
}

/* ─── Filter Bar ─────────────────────────────────────────────────────── */
.filter-bar {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.filter-group label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    background-color: #ffffff;
    color: #374151;
    transition: border-color 0.15s;
    min-width: 0;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.filter-search {
    flex: 1.5;
}

.filter-actions {
    display: flex;
    align-items: flex-end;
}

.btn-filter-clear {
    padding: 8px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-filter-clear:hover {
    background: #f3f4f6;
    color: #374151;
}

/* ─── Incident List ──────────────────────────────────────────────────── */
.incidents-list {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background-color: #ffffff;
}

.incidents-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    color: #6b7280;
    font-size: 14px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.incidents-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: #9ca3af;
    font-size: 14px;
}

/* ─── Incident Row ───────────────────────────────────────────────────── */
.incident-row {
    border-bottom: 1px solid #f3f4f6;
}

.incident-row:last-child {
    border-bottom: none;
}

/* Summary (always visible) */
.incident-summary {
    display: grid;
    grid-template-columns: 60px 90px 100px 1.3fr 1fr 1fr 90px 32px;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.12s;
    user-select: none;
}

.incident-summary:hover {
    background-color: #f9fafb;
}

.incident-row.expanded .incident-summary {
    background-color: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}

.incident-field {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: #374151;
}

.incident-id {
    font-weight: 600;
    color: #6b7280;
    font-size: 12px;
}

.incident-date {
    font-size: 13px;
    color: #6b7280;
}

.incident-project {
    font-weight: 500;
    color: #111827;
}

.incident-contractor,
.incident-pm {
    color: #6b7280;
}

.incident-contract-num {
    font-size: 12px;
    color: #6b7280;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.incident-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    transition: transform 0.2s ease-out;
}

.incident-row.expanded .incident-chevron {
    transform: rotate(180deg);
    color: #3b82f6;
}

/* ─── Outcome Badges ─────────────────────────────────────────────────── */
.outcome-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.outcome-lti {
    background-color: #fee2e2;
    color: #991b1b;
}

.outcome-mti {
    background-color: #fef3c7;
    color: #92400e;
}

.outcome-rwi {
    background-color: #fff7ed;
    color: #9a3412;
}

.outcome-hpi {
    background-color: #ede9fe;
    color: #5b21b6;
}

.outcome-fatality {
    background-color: #1f2937;
    color: #ffffff;
}

.outcome-pemc {
    background-color: #dbeafe;
    color: #1e40af;
}

.outcome-damage {
    background-color: #f3f4f6;
    color: #4b5563;
}

.outcome-other {
    background-color: #f3f4f6;
    color: #6b7280;
}

.outcome-firstaid {
    background-color: #ECFDF5;
    color: #065F46;
}

/* ─── Expanded Detail ────────────────────────────────────────────────── */
.incident-detail {
    display: none;
    padding: 20px 24px 24px;
    background-color: #fafbfc;
    border-bottom: 1px solid #e2e8f0;
}

.incident-row.expanded .incident-detail {
    display: block;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
    margin-bottom: 16px;
}

.detail-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e5e7eb;
}

.detail-row {
    margin-bottom: 8px;
}

.detail-label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: #9ca3af;
    margin-bottom: 1px;
}

.detail-value {
    font-size: 13px;
    color: #374151;
    line-height: 1.4;
}

.detail-description {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.detail-description h4 {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.detail-description p {
    font-size: 13px;
    color: #374151;
    line-height: 1.6;
    white-space: pre-wrap;
    margin: 0;
}

/* ─── Responsive — Incidents ─────────────────────────────────────────── */
@media (max-width: 1024px) {
    .incident-summary {
        grid-template-columns: 50px 80px 1fr 100px 32px;
    }

    /* Hide contract number, contractor and PM on medium screens */
    .incident-contract-num,
    .incident-contractor,
    .incident-pm {
        display: none;
    }

    .detail-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .incident-summary {
        grid-template-columns: 50px 1fr 80px 28px;
        gap: 8px;
        padding: 10px 14px;
    }

    .incident-date {
        display: none;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .incidents-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .users-table th,
    .users-table td {
        padding: 8px 12px;
    }

    .modal-content {
        margin: 2% auto;
        width: 95%;
    }

    .modal-header {
        padding: 16px;
    }

    .modal form,
    .modal-body {
        padding: 16px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   EDIT INCIDENT FORM STYLES
   ═══════════════════════════════════════════════════════════════════════ */

/* Wide modal for edit form */
.modal-wide {
    max-width: 960px;
    width: 95%;
}

/* Detail actions bar (Edit button in expanded row) */
.detail-actions-bar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 16px;
}

.btn-edit-incident {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-edit-incident svg {
    flex-shrink: 0;
}

/* Add incident button in header */
.incidents-header-right .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Contract lookup typeahead */
.contract-lookup-row {
    margin-bottom: 4px;
}

.contract-lookup-field {
    position: relative;
}

.contract-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
    max-height: 240px;
    overflow-y: auto;
}

.suggestion-item {
    display: grid;
    grid-template-columns: 110px 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.1s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: #f1f5f9;
}

.suggestion-id {
    font-weight: 600;
    font-size: 12px;
    color: #3b82f6;
    white-space: nowrap;
    min-width: 100px;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.suggestion-name {
    font-size: 13px;
    color: #111827;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-supplier {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

.suggestion-spd {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    font-style: italic;
}

.suggestion-empty {
    padding: 12px;
    color: #9ca3af;
    font-size: 13px;
    text-align: center;
}

/* Edit form body */
.edit-form-body {
    padding: 24px;
    max-height: calc(90vh - 70px);
    overflow-y: auto;
}

.edit-form-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Edit section */
.edit-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.edit-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 12px;
}

.edit-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.edit-field-full {
    grid-column: 1 / -1;
}

.edit-field label {
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

.edit-field input,
.edit-field select,
.edit-field textarea {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background-color: #ffffff;
    color: #374151;
    transition: border-color 0.15s;
}

.edit-field input:focus,
.edit-field select:focus,
.edit-field textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.edit-field textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.edit-field select {
    cursor: pointer;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    max-width: 100%;
}

/* HI-CM select/text toggle */
.custom-input-hidden {
    display: none !important;
}

/* Form actions */
.edit-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

/* Toast notifications */
.toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s, transform 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background-color: #065f46;
    color: #ffffff;
}

.toast-error {
    background-color: #991b1b;
    color: #ffffff;
}

/* Edit form responsive */
@media (max-width: 960px) {
    .edit-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .modal-wide {
        margin: 0;
        max-width: 100%;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .edit-form-body {
        padding: 16px;
        max-height: calc(100vh - 60px);
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   REPORT STYLES
   ═══════════════════════════════════════════════════════════════════════ */

.report-page { width: 100%; }

.report-config {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
    gap: 24px;
    flex-wrap: wrap;
}

.report-config-left h1 {
    font-size: 28px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px;
}

.report-subtitle { color: #6b7280; font-size: 14px; margin: 0; }

.report-dates {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.report-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 64px 24px;
    color: #6b7280;
}

/* Report sections */
.report-section {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 24px;
    overflow: hidden;
}

.report-section-header {
    background: #1E3A5F;
    padding: 16px 24px;
}

.report-section-header h2 {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

/* Summary cards */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 24px;
}

.summary-card {
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.summary-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.summary-value {
    font-size: 42px;
    font-weight: 700;
}

.summary-card .summary-label { color: inherit; opacity: 0.8; }

/* Key Updates textarea */
.key-updates-section {
    padding: 0 24px 24px;
}

.key-updates-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.key-updates-section textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
}

/* Chart containers */
.report-chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding: 24px;
}

.report-chart-container {
    position: relative;
    min-height: 300px;
}

.report-chart-full {
    padding: 24px;
    position: relative;
    min-height: 350px;
}

.report-stats-panel {
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
}

.stat-label { color: #374151; }
.stat-value { font-weight: 600; color: #111827; }

/* KPI rows */
.outcome-kpi-row, .audit-kpi-row {
    display: flex;
    gap: 12px;
    padding: 24px;
    flex-wrap: wrap;
}

.outcome-kpi {
    flex: 1;
    min-width: 120px;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.kpi-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #ffffff;
    opacity: 0.9;
}

.kpi-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: #ffffff;
}

.kpi-red { background: #991B1B; }
.kpi-blue { background: #1E3A5F; }
.kpi-lightblue { background: #3B82F6; }
.kpi-orange { background: #F97316; }
.kpi-navy { background: #0F172A; }
.kpi-green { background: #10B981; }
.kpi-yellow { background: #F59E0B; }

/* Report tables */
.report-table-container {
    padding: 24px;
    overflow-x: auto;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.report-table th {
    background: #1E3A5F;
    color: #ffffff;
    padding: 10px 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
}

.report-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    color: #374151;
    vertical-align: top;
}

.report-table tr:nth-child(even) { background: #f9fafb; }

.desc-cell {
    max-width: 350px;
    font-size: 12px;
    line-height: 1.5;
}

.region-title {
    font-size: 18px;
    font-weight: 600;
    color: #1E3A5F;
    padding: 24px 24px 12px;
}

.no-data {
    padding: 24px;
    color: #9ca3af;
    text-align: center;
}

/* Report actions */
.report-actions {
    text-align: center;
    padding: 32px;
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
    .report-chart-row { grid-template-columns: 1fr; }
    .report-config { flex-direction: column; align-items: flex-start; }
    .report-dates { flex-wrap: wrap; }
}

.kpi-value-small { font-size: 22px; }

/* ═══════════════════════════════════════════════════════════════════════
   DATA MANAGEMENT STYLES
   ═══════════════════════════════════════════════════════════════════════ */

.data-mgmt-page { width: 100%; max-width: 900px; }

.page-subtitle { color: #6b7280; font-size: 14px; margin: 4px 0 0; }

.upload-section {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 24px;
    overflow: hidden;
}

.upload-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.upload-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px;
}

.upload-desc {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
    max-width: 500px;
    line-height: 1.5;
}

.upload-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.stat-pill {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    background: #f3f4f6;
    color: #374151;
    border-radius: 12px;
}

.stat-pill-date {
    background: #dbeafe;
    color: #1e40af;
}

/* Upload drop zone */
.upload-zone {
    margin: 0 24px 24px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    transition: all 0.2s;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-zone-hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.upload-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px;
    gap: 8px;
    text-align: center;
}

.upload-icon { color: #9ca3af; }

.upload-zone-hover .upload-icon { color: #3b82f6; }

.upload-text {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

.upload-or {
    font-size: 12px;
    color: #9ca3af;
    margin: 0;
}

.upload-browse {
    cursor: pointer;
    margin-top: 4px;
}

/* Upload progress */
.upload-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px;
    color: #6b7280;
    font-size: 14px;
}

/* Upload result */
.upload-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    margin: 0;
}

.upload-result-success {
    background: #f0fdf4;
}

.upload-result-error {
    background: #fef2f2;
}

.result-icon {
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}

.upload-result-success .result-icon { color: #10b981; }
.upload-result-error .result-icon { color: #ef4444; }

.result-message {
    font-size: 14px;
    color: #374151;
    flex: 1;
}

.result-reset {
    flex-shrink: 0;
}

.report-presets {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* PDF Generation status */
.pdf-status {
    margin-top: 12px;
    font-size: 14px;
    color: #6b7280;
    text-align: center;
}

.pdf-status-success { color: #065f46; }
.pdf-status-error { color: #991b1b; }

.pdf-download-link {
    color: #3b82f6;
    text-decoration: underline;
    font-weight: 500;
}

/* Previous Reports section */
.previous-reports-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid #e5e7eb;
}

.previous-reports-section h2 {
    font-size: 22px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 16px;
}

.previous-reports-table {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.report-filename {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    color: #374151;
}

/* Print/PDF page break hints */
.report-section {
    page-break-inside: avoid;
    break-inside: avoid;
}

/* ═══════════════════════════════════════════════════════════════════════
   PDF MODE — applied during PDF generation
   ═══════════════════════════════════════════════════════════════════════ */

.pdf-mode {
    width: 1100px !important;
    max-width: 1100px !important;
    overflow: hidden !important;
    font-size: 12px !important;
}

.pdf-mode .report-section {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 16px;
}

.pdf-mode .report-section-header {
    padding: 10px 16px;
}

.pdf-mode .report-section-header h2 {
    font-size: 15px;
}

.pdf-mode .summary-grid {
    padding: 16px;
    gap: 10px;
}

.pdf-mode .summary-card {
    padding: 12px;
}

.pdf-mode .summary-value {
    font-size: 28px;
}

.pdf-mode .summary-label {
    font-size: 10px;
}

.pdf-mode .report-chart-row {
    padding: 16px;
    gap: 16px;
}

.pdf-mode .report-chart-container {
    min-height: 220px;
}

.pdf-mode .report-chart-full {
    padding: 16px;
    min-height: 250px;
}

.pdf-mode .outcome-kpi-row,
.pdf-mode .audit-kpi-row {
    padding: 12px 16px;
    gap: 8px;
}

.pdf-mode .outcome-kpi {
    padding: 10px;
}

.pdf-mode .kpi-value {
    font-size: 24px;
}

.pdf-mode .kpi-label {
    font-size: 10px;
}

.pdf-mode .kpi-value-small {
    font-size: 16px;
}

/* Key updates rendered text */
.key-updates-rendered {
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.6;
    color: #374151;
    background: #f9fafb;
    border-radius: 6px;
    min-height: 40px;
}

/* Tables in PDF mode */
.pdf-mode .report-table {
    font-size: 11px;
}

.pdf-mode .report-table th {
    padding: 6px 8px;
    font-size: 10px;
}

.pdf-mode .report-table td {
    padding: 6px 8px;
    font-size: 11px;
}

.pdf-mode .desc-cell {
    max-width: 280px;
    font-size: 10px;
}

.pdf-mode .key-updates-section {
    padding: 0 16px 16px;
}

.pdf-mode .stat-row {
    font-size: 11px;
}

.pdf-mode .region-title {
    font-size: 15px;
    padding: 16px 16px 8px;
}

/* Enhanced stats panel for doughnut charts */
.stats-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #E5E7EB;
}

.stat-row-enhanced {
    display: grid;
    grid-template-columns: 10px 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #F3F4F6;
}

.stat-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.stat-row-enhanced .stat-label {
    font-size: 13px;
    color: #374151;
}

.stat-row-enhanced .stat-count {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    min-width: 30px;
    text-align: right;
}

.stat-row-enhanced .stat-pct {
    font-size: 12px;
    color: #6B7280;
    min-width: 42px;
    text-align: right;
}

.stat-row-total {
    display: grid;
    grid-template-columns: 10px 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 10px 0 4px;
    margin-top: 4px;
    border-top: 2px solid #E5E7EB;
}

.stat-row-total .stat-label {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    grid-column: 1 / 3;
}

.stat-row-total .stat-count {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    text-align: right;
}

/* ═══════════════════════════════════════════════════════════════════════
   SUMMARY CARDS — redesigned with rounded corners and trend arrows
   ═══════════════════════════════════════════════════════════════════════ */

.summary-card {
    border-radius: 12px;
}

.summary-value-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.summary-value {
    font-size: 42px;
    font-weight: 700;
    line-height: 1;
}

.summary-trend {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.trend-up {
    color: #DC2626;
}

.trend-down {
    color: #10B981;
}

.trend-flat {
    color: #9CA3AF;
}

.summary-subtitle {
    font-size: 11px;
    color: #6B7280;
    text-align: left;
    margin-top: 4px;
    line-height: 1.4;
    min-height: 14px;
    padding: 0 12px;
}

.report-chart-fullwidth {
    padding: 24px;
    position: relative;
    height: 420px;
}

.summary-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 16px 24px 0;
}

.summary-grid-4:last-child {
    padding-bottom: 24px;
}

/* Summary card colours — by column */

/* Column 1: LTI / rates family = red */
.summary-col1 { background: #FEE2E2; color: #991B1B; }
.summary-col1 .summary-label { color: inherit; opacity: 0.8; }

/* Column 2: Incidents family = orange */
.summary-col2 { background: #FFF7ED; color: #9A3412; }
.summary-col2 .summary-label { color: inherit; opacity: 0.8; }

/* Column 3: Audits family = green */
.summary-col3 { background: #ECFDF5; color: #065F46; }
.summary-col3 .summary-label { color: inherit; opacity: 0.8; }

.summary-grid-3x4 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 20px 24px;
}

@media (max-width: 768px) {
    .summary-grid-3x4 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .summary-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════════════════════════════
   TYPE TREND PANELS — Incident Type & HPI (Page 6, replaces bar charts)
   Append this block to the bottom of your existing style.css
   ═══════════════════════════════════════════════════════════════════════ */

.type-trend-panel {
    background: #f9fafb;
    border-radius: 10px;
    padding: 20px 24px;
    min-height: 220px;
}

.type-trend-title {
    font-size: 14px;
    font-weight: 600;
    color: #1E3A5F;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #E5E7EB;
    display: flex;
    align-items: center;
    gap: 8px;
}

.type-trend-row {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #F3F4F6;
    gap: 8px;
}

.type-trend-row:last-child {
    border-bottom: none;
}

.type-trend-name {
    flex: 1;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.type-trend-count {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    min-width: 28px;
    text-align: right;
}

.type-trend-arrow {
    font-size: 16px;
    font-weight: 700;
    min-width: 22px;
    text-align: center;
    line-height: 1;
}

.type-trend-empty {
    color: #9CA3AF;
    font-size: 14px;
    padding: 32px 0;
    text-align: center;
}
/* ── Audit Region Cards ─────────────────────────────────────────── */
.audit-region-row {
    display: flex;
    gap: 20px;
    margin-bottom: 8px;
}
.audit-region-card {
    flex: 1;
    background: #f9fafb;
    border-radius: 10px;
    padding: 20px 24px;
    min-width: 0;
}
.audit-region-name {
    font-size: 15px;
    font-weight: 700;
    color: #1E3A5F;
    margin-bottom: 4px;
}
.audit-region-count {
    font-size: 13px;
    color: #6B7280;
    margin-bottom: 14px;
}
.audit-stacked-bar {
    display: flex;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    background: #E5E7EB;
    margin-bottom: 10px;
}
.asb-c  { background: #10B981; height: 100%; }
.asb-pc { background: #F59E0B; height: 100%; }
.asb-nc { background: #DC2626; height: 100%; }
.audit-region-legend {
    display: flex;
    gap: 16px;
    font-size: 12px;
    font-weight: 600;
}
.arl-c  { color: #10B981; }
.arl-pc { color: #D97706; }
.arl-nc { color: #DC2626; }

/* ── Rank Badge ─────────────────────────────────────────────────── */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #E5E7EB;
    color: #374151;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.rank-badge.rank-nc {
    background: #FEE2E2;
    color: #DC2626;
}

/* ── NC count highlight ─────────────────────────────────────────── */
.nc-count {
    color: #DC2626;
}

/* ═══════════════════════════════════════════════════════════════════════
   TYPE TREND PANELS — Incident Type & HPI (Page 6, replaces bar charts)
   Append this block to the bottom of your existing style.css
   ═══════════════════════════════════════════════════════════════════════ */

.type-trend-panel {
    background: #f9fafb;
    border-radius: 10px;
    padding: 20px 24px;
    min-height: 220px;
}

.type-trend-title {
    font-size: 14px;
    font-weight: 600;
    color: #1E3A5F;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #E5E7EB;
    display: flex;
    align-items: center;
    gap: 8px;
}

.type-trend-row {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #F3F4F6;
    gap: 8px;
}

.type-trend-row:last-child {
    border-bottom: none;
}

.type-trend-name {
    flex: 1;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.type-trend-count {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    min-width: 28px;
    text-align: right;
}

.type-trend-arrow {
    font-size: 16px;
    font-weight: 700;
    min-width: 22px;
    text-align: center;
    line-height: 1;
}

.type-trend-empty {
    color: #9CA3AF;
    font-size: 14px;
    padding: 32px 0;
    text-align: center;
}

/* ── Fixed-layout report tables with controlled column widths ── */
.report-table-fixed {
    table-layout: fixed;
    width: 100%;
}

.report-table-fixed th,
.report-table-fixed td {
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: auto;
    white-space: normal;
}

/* Description cell — let it breathe */
.report-table-fixed td.desc-cell {
    font-size: 0.82rem;
    line-height: 1.45;
}

/* Tighter padding on narrow cols */
.report-table-fixed th,
.report-table-fixed td {
    padding: 8px 10px;
}
/* ═══════════════════════════════════════════════════════════════════════
   MULTI-SELECT DROPDOWN — Checkbox filter dropdowns
   Append this entire block to the end of your existing style.css
   ═══════════════════════════════════════════════════════════════════════ */

.ms-container {
    position: relative;
    min-width: 0;
}

.ms-trigger {
    display: block;
    width: 100%;
    padding: 8px 28px 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E") right 10px center no-repeat;
    color: #6b7280;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: border-color 0.15s;
}

.ms-trigger:hover {
    border-color: #9ca3af;
}

.ms-trigger.ms-active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.ms-trigger.ms-has-selection {
    color: #111827;
    font-weight: 500;
}

.ms-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 220px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 100;
    overflow: hidden;
}

.ms-panel.ms-open {
    display: block;
}

.ms-search {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid #e5e7eb;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    background: #f9fafb;
}

.ms-search:focus {
    background: #ffffff;
}

.ms-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 4px 0;
}

.ms-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    transition: background-color 0.1s;
}

.ms-option:hover {
    background: #f3f4f6;
}

.ms-option input[type="checkbox"] {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    accent-color: #3b82f6;
    cursor: pointer;
}

.ms-option span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Filter row adjustments for date inputs + multi-selects ──────── */
.filter-row {
    flex-wrap: wrap;
}

.filter-group input[type="date"] {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    background-color: #ffffff;
    color: #374151;
    transition: border-color 0.15s;
    min-width: 0;
    font-family: inherit;
}

.filter-group input[type="date"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}