/**
 * Manager Portal - Unified Stylesheet
 * Handles Layout, Audit Tables, Branded Login UI, and Bulk Import UI.
 */

:root {
    /* These defaults act as fallbacks if the backend settings are missing */
    --portal-primary: #1e3a5f;
    --portal-hover: #2b5080;
    --portal-btn-text: #ffffff;
    --portal-btn-text-hover: #ffffff;
    --portal-success: #2ecc71;
    --portal-warning: #f39c12;
    --portal-danger: #e74c3c;
    --portal-bg: #ffffff;
    --portal-sidebar-bg: #1e3a5f;
    --portal-text: #1e3a5f;
    --portal-muted-text: #526670;
    --portal-soft-text: #60727c;
    --portal-placeholder: #7c8a9a;
    --portal-white: #ffffff;
    --portal-border: #d6dde6;
    --portal-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* 1. LAYOUT WRAPPER */
.map-portal-wrapper {
    display: flex;
    min-height: 90vh;
    background: var(--portal-bg);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    border-radius: 12px;
    overflow: visible;
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
}

/* Shared dashboard controls
   Keep common buttons and fields scoped to plugin screens only. */
.map-portal-wrapper .map-form-group label,
.map-agent-dashboard .map-form-group label,
.map-manager-dashboard .map-form-group label {
    display: block;
    margin: 0 0 6px;
    color: var(--portal-muted-text);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0.02em;
    text-align: left;
    text-transform: uppercase;
}

.map-portal-wrapper .map-form-group input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.map-portal-wrapper .map-form-group select,
.map-portal-wrapper .map-form-group textarea,
.map-agent-dashboard .map-form-group input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.map-agent-dashboard .map-form-group select,
.map-agent-dashboard .map-form-group textarea,
.map-manager-dashboard .map-form-group input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.map-manager-dashboard .map-form-group select,
.map-manager-dashboard .map-form-group textarea,
.map-manager-select {
    width: 100%;
    min-height: 40px;
    box-sizing: border-box;
    padding: 9px 12px;
    border: 1px solid var(--portal-border);
    border-radius: 6px;
    background-color: #fff;
    color: var(--portal-text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    outline: none;
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.04);
}

.map-portal-wrapper .map-form-group textarea,
.map-agent-dashboard .map-form-group textarea,
.map-manager-dashboard .map-form-group textarea {
    min-height: 86px;
    resize: vertical;
}

.map-portal-wrapper .map-form-group input:focus,
.map-portal-wrapper .map-form-group select:focus,
.map-portal-wrapper .map-form-group textarea:focus,
.map-agent-dashboard .map-form-group input:focus,
.map-agent-dashboard .map-form-group select:focus,
.map-agent-dashboard .map-form-group textarea:focus,
.map-manager-dashboard .map-form-group input:focus,
.map-manager-dashboard .map-form-group select:focus,
.map-manager-dashboard .map-form-group textarea:focus,
.map-manager-select:focus {
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

.map-portal-wrapper input::placeholder,
.map-portal-wrapper textarea::placeholder,
.map-agent-dashboard input::placeholder,
.map-agent-dashboard textarea::placeholder,
.map-manager-dashboard input::placeholder,
.map-manager-dashboard textarea::placeholder {
    color: var(--portal-placeholder);
    opacity: 1;
}

.map-portal-wrapper input[type="checkbox"],
.map-portal-wrapper input[type="radio"],
.map-agent-dashboard input[type="checkbox"],
.map-agent-dashboard input[type="radio"],
.map-manager-dashboard input[type="checkbox"],
.map-manager-dashboard input[type="radio"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin: 0;
    accent-color: var(--portal-primary);
}

/* 2. SIDEBAR */
.map-portal-sidebar {
    width: 250px;
    min-width: 250px;
    flex-shrink: 0;
    background: var(--portal-sidebar-bg);
    color: var(--portal-white);
    display: flex;
    flex-direction: column;
}

.map-sidebar-header {
    min-height: 150px;
    box-sizing: border-box;
    padding: 32px 25px 26px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.map-sidebar-header h3 {
    margin: 0;
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.map-sidebar-header p {
    margin: 7px 0 0;
    color: rgba(255,255,255,0.55);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.35;
}

.map-sidebar-nav ul { padding: 14px 0; margin: 0; list-style: none; flex-grow: 1; }
.map-sidebar-nav li {
    min-height: 50px;
    box-sizing: border-box;
    padding: 13px 25px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    cursor: pointer;
    border-left: 4px solid transparent;
    transition: 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    color: rgba(255,255,255,0.7);
}
.map-sidebar-nav li:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.map-sidebar-nav li span.dashicons {
    width: 20px;
    height: 20px;
    margin-right: 0;
    flex: 0 0 20px;
    color: currentColor;
    font-size: 20px;
    line-height: 20px;
    text-align: center;
}
.map-sidebar-nav li.active {
    background: rgba(255,255,255,0.1);
    border-left-color: var(--portal-hover);
    color: #fff;
}

.map-notification-badge {
    align-items: center;
    background: #e74c3c;
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 800;
    justify-content: center;
    line-height: 1;
    margin-left: auto;
    min-width: 18px;
    min-height: 18px;
    padding: 2px 5px;
}

.map-notification-dot {
    border: 2px solid rgba(255,255,255,0.92);
    min-width: 11px;
    min-height: 11px;
    padding: 0;
}

.map-sidebar-footer { padding: 20px; border-top: 1px solid rgba(255,255,255,0.08); }
.map-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    box-sizing: border-box;
    padding: 11px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: rgba(255,255,255,0.55);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    transition: all 0.25s ease;
    cursor: pointer;
}
.map-logout-btn:hover {
    background: rgba(231, 76, 60, 0.15);
    border-color: rgba(231, 76, 60, 0.4);
    color: #e74c3c;
}
.map-logout-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 18px;
    transition: transform 0.2s ease;
}
.map-logout-btn:hover .dashicons {
    transform: translateX(2px);
}

.map-directory-agent-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.map-directory-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    background: #eef5fb;
    border: 1px solid #dce6f0;
    color: var(--portal-primary);
    font-size: 13px;
    font-weight: 800;
}

.map-directory-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.map-directory-photo-link {
    color: var(--portal-primary);
    font-size: 11px;
    font-weight: 700;
    text-decoration: underline;
}

.map-agent-picker-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.map-agent-picker-toolbar input[type="text"] {
    width: 100%;
    min-height: 38px;
    box-sizing: border-box;
}

.map-agent-picker-count {
    color: #6b7b8c;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.map-agent-picker-action {
    white-space: nowrap;
}

.map-agent-picker-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 8px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.map-agent-picker-item {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    min-height: 58px;
    background: #fff;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    cursor: pointer;
    margin: 0;
}

.map-agent-picker-item:hover {
    border-color: var(--portal-primary);
}

.map-agent-picker-item.is-selected {
    background: #eef6ff;
    border-color: #2b78d4;
}

.map-agent-picker-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.map-agent-picker-copy {
    min-width: 0;
}

.map-agent-picker-copy strong,
.map-agent-picker-copy small {
    display: block;
    overflow-wrap: anywhere;
}

.map-agent-picker-copy strong {
    color: #334155;
    font-size: 13px;
    line-height: 1.35;
}

.map-agent-picker-copy small {
    color: var(--portal-soft-text);
    font-size: 11px;
    line-height: 1.35;
    margin-top: 2px;
}

@media (max-width: 720px) {
    .map-agent-picker-toolbar {
        grid-template-columns: 1fr;
    }

    .map-agent-picker-list {
        grid-template-columns: 1fr;
    }
}

/* 3. MAIN WORKSPACE */
.map-portal-main { flex-grow: 1; min-width: 0; overflow-y: auto; background: #fff; }
.map-workspace-header { padding: 25px 35px; background: #fff; border-bottom: 1px solid var(--portal-border); display: flex; justify-content: space-between; align-items: center; }
.map-workspace-header h2 { font-size: 1.6rem; font-weight: 700; color: var(--portal-sidebar-bg); margin: 0; }
#map-portal-search { width: 300px; padding: 10px 18px; border: 1px solid var(--portal-border); border-radius: 25px; font-size: 13px; outline: none; color: var(--portal-text); }
#map-portal-search::placeholder { color: var(--portal-placeholder); opacity: 1; }
#map-portal-search.map-portal-search-wide { width: min(520px, 42vw); }
#map-workspace-content { padding: 35px; }

/* 4. STAT CARDS */
.map-stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 30px; }
.map-stat-card { background: #fff; padding: 20px; border-radius: 10px; border: 1px solid var(--portal-border); box-shadow: var(--portal-shadow); }
.stat-label { font-size: 10px; text-transform: uppercase; color: var(--portal-muted-text); font-weight: 700; }
.stat-value { font-size: 22px; font-weight: 800; display: block; margin: 5px 0; }
.stat-trend { font-size: 11px; color: var(--portal-soft-text); display: block; margin-top: 2px; }

/* 5. REGISTRATION TOOLS */
.map-registration-tools {
    background: #fff;
    padding: 20px 25px;
    border-radius: 10px;
    margin-bottom: 25px;
    border: 1px solid var(--portal-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--portal-shadow);
}

#toggleAddAgent {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; padding: 10px 20px; height: 40px; font-size: 12px; font-weight: 600;
    cursor: pointer; border: none; background: var(--portal-primary); color: var(--portal-btn-text); border-radius: 6px;
}
#toggleAddAgent:hover { background: var(--portal-hover); color: var(--portal-btn-text-hover); }

.map-password-field {
    position: relative;
}

.map-password-toggle {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: auto;
    min-width: 46px;
    height: 28px;
    border: 1px solid #d4dde8;
    border-radius: 6px;
    background: #f7f9fc;
    color: var(--portal-primary, #1e3a5f);
    cursor: pointer;
    opacity: 1;
    padding: 0 9px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    text-align: center;
}

.map-password-toggle:hover {
    background: #eef4fb;
    border-color: #b9c8da;
}

#addAgentSwitchboard {
    background: #fff; padding: 30px; border-radius: 10px; margin-bottom: 30px; border: 1px solid var(--portal-border); box-shadow: var(--portal-shadow);
}

.map-switchboard-nav { display: flex; gap: 15px; justify-content: center; margin-bottom: 30px; }
.map-tool-choice {
    background: #f1f2f6; border: 1px solid #dfe4ea; padding: 10px 20px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.map-tool-choice.active { background: var(--portal-primary); color: #fff; border-color: var(--portal-primary); }

/* 6. FORM GRIDS */
.map-registration-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

.map-report-workspace {
    display: grid;
    gap: 18px;
}

.map-report-filter-card,
.map-report-preview,
.map-report-summary-grid > div {
    background: #fff;
    border: 1px solid var(--portal-border, #e1e4e8);
    border-radius: 8px;
    box-shadow: var(--portal-shadow, 0 4px 15px rgba(0,0,0,0.05));
}

.map-report-filter-card {
    padding: 18px 20px;
}

.map-report-filter-card .map-registration-grid {
    gap: 14px 18px;
}

.map-report-filter-card .map-form-group {
    margin-bottom: 10px;
}

.map-report-filter-card .map-form-group label {
    font-size: 10px !important;
    line-height: 1.25;
    margin-bottom: 7px;
}

.map-report-filter-card .map-form-group input,
.map-report-filter-card .map-form-group select {
    min-height: 40px;
    padding: 8px 11px !important;
    font-size: 13px !important;
    line-height: 1.25 !important;
    border-radius: 6px;
}

.map-report-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.map-report-note {
    color: var(--portal-soft-text, #6f7f86);
    font-size: 12px !important;
    line-height: 1.4;
}

.map-report-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 12px !important;
    font-weight: 700;
    line-height: 1;
    text-decoration: none !important;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(30, 58, 95, 0.12);
}

.map-report-button-primary {
    width: auto;
    min-width: 96px;
    max-width: 130px;
    background: var(--portal-primary, #1e3a5f);
    color: var(--portal-btn-text, #fff);
}

.map-report-button-secondary {
    background: #fff;
    color: var(--portal-primary, #1e3a5f);
    border-color: #cdd8e4;
    box-shadow: none;
}

.map-report-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.map-report-summary-grid > div {
    padding: 13px 15px;
    min-height: 78px;
}

.map-report-summary-grid span {
    display: block;
    color: var(--portal-muted-text, #5f7078);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.map-report-summary-grid strong {
    display: block;
    color: var(--portal-primary, #1e3a5f);
    font-size: 16px !important;
    line-height: 1.25;
}

.map-report-preview {
    padding: 18px;
    overflow-x: auto;
}

.map-report-dashboard-preview h3 {
    margin: 0 0 14px;
    color: var(--portal-primary, #1e3a5f);
    font-size: 16px !important;
    font-weight: 700;
}

.map-report-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.map-report-chart-card {
    border: 1px solid #dce4ec;
    border-radius: 8px;
    background: #f8fbff;
    padding: 14px;
}

.map-report-chart-card h4 {
    margin: 0 0 12px;
    color: var(--portal-primary, #1e3a5f);
    font-size: 13px !important;
    font-weight: 800;
}

.map-report-chart-canvas-wrap {
    height: 320px;
    min-width: 520px;
}

.map-report-bar-row {
    display: grid;
    grid-template-columns: minmax(90px, 150px) minmax(120px, 1fr) 34px;
    gap: 10px;
    align-items: center;
    margin-bottom: 9px;
}

.map-report-bar-row:last-child {
    margin-bottom: 0;
}

.map-report-bar-label {
    color: var(--portal-text, #1e3a5f);
    font-size: 11px !important;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.map-report-bar-track {
    height: 12px;
    border-radius: 999px;
    background: #e8eef5;
    overflow: hidden;
}

.map-report-bar-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--portal-primary, #1e3a5f);
}

.map-report-bar-track-file span {
    background: #5f7fa8;
}

.map-report-bar-row strong {
    color: var(--portal-primary, #1e3a5f);
    font-size: 12px !important;
    text-align: right;
}

.map-report-agent-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 14px;
}

.map-report-agent-summary-table th,
.map-report-agent-summary-table td {
    border: 1px solid #dce4ec;
    padding: 7px 8px;
    text-align: left;
    color: var(--portal-text, #1e3a5f);
    font-size: 12px;
}

.map-report-agent-summary-table th {
    background: #f5f8fb;
    color: var(--portal-muted-text, #5f7078);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.map-report-trend-chart {
    display: grid;
    gap: 12px;
}

.map-report-trend-plot {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(54px, 1fr);
    gap: 10px;
    align-items: end;
    min-height: 220px;
    padding: 18px 14px 10px;
    border: 1px solid #dce4ec;
    border-radius: 8px;
    background:
        repeating-linear-gradient(
            to top,
            #fff 0,
            #fff 43px,
            #edf2f7 44px
        );
    overflow-x: auto;
}

.map-report-trend-period {
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 8px;
    min-width: 54px;
    height: 200px;
}

.map-report-trend-bars {
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 4px;
    height: 170px;
}

.map-report-trend-bar {
    width: 12px;
    min-height: 3px;
    border-radius: 999px 999px 0 0;
    border: 1px solid transparent;
    position: relative;
}

.map-report-trend-bar b {
    position: absolute;
    left: 50%;
    top: -18px;
    transform: translateX(-50%);
    color: var(--portal-primary, #1e3a5f);
    font-size: 10px !important;
    font-weight: 800;
    line-height: 1;
}

.map-report-trend-submitted {
    background: #dfeaf5;
    border-color: var(--portal-primary, #1e3a5f);
}

.map-report-trend-approved {
    background: #b7ebcc;
    border-color: #2ecc71;
}

.map-report-trend-pending {
    background: #ffe9a6;
    border-color: #d89400;
}

.map-report-trend-rejected {
    background: #ffd6d6;
    border-color: #d64545;
}

.map-report-trend-closed {
    background: #e6eaee;
    border-color: #52616b;
}

.map-report-trend-label {
    color: var(--portal-soft-text, #6f7f86);
    font-size: 10px !important;
    font-weight: 700;
    text-align: center;
    line-height: 1.2;
}

.map-report-trend-legend {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
    color: var(--portal-soft-text, #6f7f86);
    font-size: 12px !important;
}

.map-report-trend-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.map-report-trend-legend i {
    display: inline-block;
    width: 18px;
    height: 10px;
    border-radius: 999px;
}

.map-report-trend-key-submitted {
    background: #dfeaf5;
    border: 1px solid var(--portal-primary, #1e3a5f);
}

.map-report-trend-key-approved {
    background: #b7ebcc;
    border: 1px solid #2ecc71;
}

.map-report-trend-key-pending {
    background: #ffe9a6;
    border: 1px solid #d89400;
}

.map-report-trend-key-rejected {
    background: #ffd6d6;
    border: 1px solid #d64545;
}

.map-report-trend-key-closed {
    background: #e6eaee;
    border: 1px solid #52616b;
}

.map-report-empty {
    margin: 0;
    padding: 22px;
    color: var(--portal-soft-text, #6f7f86);
    text-align: center;
}

.map-report-compact-list {
    display: grid;
    gap: 8px;
}

.map-report-compact-item {
    border: 1px solid #dce4ec;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.map-report-compact-item summary {
    display: grid;
    grid-template-columns: 112px minmax(52px, 66px) minmax(110px, 1fr) 82px 82px;
    gap: 10px;
    align-items: center;
    padding: 9px 12px;
    min-height: 54px;
    cursor: pointer;
    list-style: none;
}

.map-report-compact-item summary::-webkit-details-marker {
    display: none;
}

.map-report-compact-item:nth-child(even) summary {
    background: #f8fbff;
}

.map-report-compact-item[open] summary {
    background: #eef6ff;
    border-bottom: 1px solid #dce4ec;
}

.map-report-ref,
.map-report-main,
.map-report-bank,
.map-report-date {
    min-width: 0;
    overflow-wrap: anywhere;
}

.map-report-ref {
    color: var(--portal-primary, #1e3a5f);
    font-weight: 800;
    font-size: 12px !important;
    line-height: 1.25;
}

.map-report-main,
.map-report-bank {
    color: var(--portal-text, #1e3a5f);
    font-weight: 700;
    font-size: 12px !important;
    line-height: 1.25;
}

.map-report-date {
    color: var(--portal-soft-text, #6f7f86);
    font-size: 11px !important;
    line-height: 1.3;
}

.map-report-status-pill {
    justify-self: start;
    padding: 4px 9px;
    border-radius: 999px;
    background: #d1f2eb;
    color: #1a7a5e;
    font-size: 10px !important;
    font-weight: 800;
    line-height: 1.2;
}

.map-report-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 14px;
}

.map-report-detail-grid div {
    min-width: 0;
}

.map-report-detail-grid span {
    display: block;
    color: var(--portal-muted-text, #5f7078);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.map-report-detail-grid strong {
    color: var(--portal-text, #1e3a5f);
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.map-report-detail-wide {
    grid-column: 1 / -1;
}

.map-report-sheet h2 {
    margin: 0 0 14px;
    color: var(--portal-primary, #1e3a5f);
    font-size: 20px;
}

.map-report-summary {
    margin: 0 0 18px;
    border-collapse: collapse;
}

.map-report-summary th,
.map-report-summary td {
    padding: 4px 14px 4px 0;
    text-align: left;
    font-size: 13px;
}

.map-report-table {
    width: 100%;
    min-width: 1100px;
    border-collapse: collapse;
    table-layout: fixed;
}

.map-report-table th,
.map-report-table td {
    border: 1px solid #dce4ec;
    padding: 8px;
    vertical-align: top;
    overflow-wrap: anywhere;
    font-size: 12px;
    color: var(--portal-text, #1e3a5f);
}

.map-report-table th {
    background: #f5f8fb;
    color: var(--portal-muted-text, #5f7078);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

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

    .map-report-compact-item summary,
    .map-report-detail-grid,
    .map-report-chart-grid {
        grid-template-columns: 1fr;
    }

    .map-report-bar-row {
        grid-template-columns: 1fr;
    }

    .map-report-bar-row strong {
        text-align: left;
    }

    .map-report-trend-plot {
        grid-auto-columns: minmax(48px, 70px);
    }
}
.map-form-group { margin-bottom: 15px; position: relative; }

.map-manager-select {
    padding-right: 34px;
}

.map-manager-select:focus {
    border-color: var(--portal-primary, #1e3a5f);
}

#map-comp-case-types-wrap .map-field-note {
    color: var(--portal-soft-text, #6f7f86);
    font-weight: 600;
    text-transform: none;
}

#map-comp-case-types-wrap .map-comp-component-source {
    display: none !important;
}

#map-comp-case-types-wrap .map-comp-add-rule-btn {
    margin-top: 10px;
}

#map-comp-case-types-wrap .map-comp-rule-help {
    color: var(--portal-soft-text, #6f7f86);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
    margin: 10px 0 0;
}

#map-comp-agency-wrap .map-agency-picker {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
    background: #fff;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    max-height: 260px;
    overflow-y: auto;
}

#map-comp-agency-wrap label.map-agency-option {
    display: grid !important;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 46px;
    min-width: 0;
    padding: 10px 12px;
    margin: 0;
    background: #fff;
    border: 0;
    border-bottom: 1px solid #e6edf5;
    border-radius: 0;
    color: var(--portal-text, #1e3a5f);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    text-align: left;
    text-transform: none !important;
    white-space: normal;
    box-sizing: border-box;
}

#map-comp-agency-wrap label.map-agency-option:nth-child(even) {
    background: #f8fbff;
}

#map-comp-agency-wrap label.map-agency-option:last-child {
    border-bottom: 0;
}

#map-comp-agency-wrap .map-agency-option input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    justify-self: start;
    align-self: center;
}

#map-comp-agency-wrap .map-agency-option span {
    min-width: 0;
    overflow-wrap: anywhere;
}

#map-comp-agency-wrap .map-agency-option:has(input[type="checkbox"]:checked) {
    background: #eef6ff;
    border-color: var(--portal-primary, #1e3a5f);
    box-shadow: inset 3px 0 0 var(--portal-primary, #1e3a5f);
}

#map-comp-agents-wrap .map-agent-picker-toolbar {
    display: grid !important;
    grid-template-columns: minmax(220px, 1fr) auto auto auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

#map-comp-agents-wrap .map-agent-picker-toolbar input[type="text"] {
    width: 100%;
    min-height: 40px;
}

#map-comp-agents-wrap .map-agent-picker-count {
    color: var(--portal-soft-text, #6f7f86);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

#map-comp-agents-wrap .map-agent-picker-action {
    width: auto !important;
    min-width: 0 !important;
    min-height: 32px !important;
    padding: 6px 12px !important;
    border: 1px solid #cfd8e3 !important;
    border-radius: 6px !important;
    background: #f7f9fc !important;
    color: var(--portal-primary, #1e3a5f) !important;
    box-shadow: none !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    text-transform: none !important;
    white-space: nowrap;
}

#map-comp-agents-wrap .map-agent-picker-list {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
    background: #fff;
    border: 1px solid #d9e1ea;
    border-radius: 8px;
    max-height: 320px;
    overflow-y: auto;
}

#map-comp-agents-wrap .map-agent-picker-item {
    display: grid !important;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    margin: 0 !important;
    border: 0;
    border-bottom: 1px solid #e6edf5;
    border-radius: 0;
    background: #fff;
    cursor: pointer;
    color: var(--portal-text, #1e3a5f);
    text-align: left;
    text-transform: none !important;
    box-sizing: border-box;
}

#map-comp-agents-wrap .map-agent-picker-item:nth-child(even) {
    background: #f8fbff;
}

#map-comp-agents-wrap .map-agent-picker-item:last-child {
    border-bottom: 0;
}

#map-comp-agents-wrap .map-agent-picker-item:hover {
    background: #eef6ff;
}

#map-comp-agents-wrap .map-agent-picker-item.is-selected {
    background: #e8f3ff;
    box-shadow: inset 3px 0 0 #1e3a5f;
}

#map-comp-agents-wrap .map-agent-picker-item input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    padding: 0 !important;
    margin: 0 !important;
    justify-self: start;
}

#map-comp-agents-wrap .map-agent-picker-copy {
    display: block;
    min-width: 0;
}

#map-comp-agents-wrap .map-agent-picker-copy strong,
#map-comp-agents-wrap .map-agent-picker-copy small {
    display: block;
    overflow-wrap: anywhere;
}

#map-comp-agents-wrap .map-agent-picker-copy strong {
    color: var(--portal-text, #1e3a5f);
    font-size: 13px;
    line-height: 1.3;
}

#map-comp-agents-wrap .map-agent-picker-copy small {
    color: var(--portal-soft-text, #6f7f86);
    font-size: 11px;
    line-height: 1.3;
    margin-top: 2px;
}

@media (max-width: 720px) {
    #map-comp-agents-wrap .map-agent-picker-toolbar {
        grid-template-columns: 1fr;
    }
}

.map-uppercase-name {
    text-transform: uppercase;
}

.map-agency-suggestions {
    display: none;
    position: absolute;
    z-index: 50;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(20,48,80,0.14);
    padding: 6px;
}

.map-agency-suggestion {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--portal-text);
    cursor: pointer;
    display: block;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    padding: 9px 10px;
    text-align: left;
    border-radius: 6px;
}

.map-agency-suggestion:hover,
.map-agency-suggestion:focus {
    background: #eef3f8;
    color: var(--portal-primary);
    outline: none;
}

.map-agency-suggestion-empty {
    color: var(--portal-soft-text);
    font-size: 12px;
    padding: 8px 10px;
}

/* 7. DATA TABLES */
.map-portal-table { width: 100%; border-collapse: collapse; background: #fff; box-shadow: var(--portal-shadow); border-radius: 10px; overflow: hidden; font-size: 13px; }
.map-portal-table th { padding: 15px; background: #fcfcfc; font-size: 10px; text-transform: uppercase; color: var(--portal-muted-text); border-bottom: 2px solid var(--portal-bg); text-align: left; }
.map-portal-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--portal-bg);
}

.map-portal-table > tbody > tr:not(.map-sub-drawer):not(.map-drawer-row) > td {
    vertical-align: top;
}

.map-portal-table > thead > tr > th:last-child,
.map-portal-table > tbody > tr:not(.map-sub-drawer):not(.map-drawer-row) > td:last-child {
    width: auto;
    min-width: 136px;
    text-align: right;
}

.map-portal-table .map-action-stack,
.map-card-action-stack {
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
    min-width: 118px;
}

.map-portal-table .map-action-stack .map-btn-small,
.map-card-action-stack .map-btn-small {
    width: 100%;
    justify-content: center;
}

/* 8. BUTTONS */
.map-btn-small,
.map-report-button,
.map-upload-picker-btn,
.map-upload-clear-btn,
.map-agent-picker-action,
.map-file-picker,
.map-party-add,
.map-party-remove,
.map-case-file-choose-btn,
.map-case-file-remove,
.map-doc-upload-btn,
.map-ctos-file-button,
#toggleAddAgent,
#portalLoginBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    box-sizing: border-box;
    padding: 0 14px;
    border-radius: 6px;
    font-size: 12px !important;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none !important;
    white-space: nowrap;
    font-family: inherit;
}

.map-btn-small {
    min-width: 88px;
    background: #f3f6f9;
    color: var(--portal-primary, #1e3a5f) !important;
    border-color: #d8e0e7;
}

.map-btn-small:hover {
    background: #e9f0f7;
    color: var(--portal-primary, #1e3a5f) !important;
    border-color: #c8d5e2;
}

.map-btn-edit,
.map-btn-primary,
.map-report-button-primary,
.map-doc-upload-btn,
.map-ctos-action-secondary,
#toggleAddAgent,
#portalLoginBtn {
    background: var(--portal-primary);
    color: var(--portal-btn-text) !important;
    border-color: var(--portal-primary);
    box-shadow: 0 2px 6px rgba(30, 58, 95, 0.12);
}

.map-btn-edit:hover,
.map-btn-primary:hover,
.map-report-button-primary:hover,
.map-doc-upload-btn:hover,
.map-ctos-action-secondary:hover,
#toggleAddAgent:hover,
#portalLoginBtn:hover {
    background: var(--portal-hover);
    color: var(--portal-btn-text-hover) !important;
    border-color: var(--portal-hover);
}

.map-btn-secondary {
    background: #f3f6f9;
    color: var(--portal-primary) !important;
    border-color: #d8e0e7;
    box-shadow: none;
}

.map-btn-secondary:hover {
    background: #e9f0f7;
    color: var(--portal-primary) !important;
    border-color: #c8d5e2;
}

.map-btn-danger,
.map-comp-delete-btn,
.map-join-reject-btn {
    background: #fff7f6;
    color: #b42318 !important;
    border: 1px solid #f0c7c7;
    box-shadow: none;
}

.map-btn-danger:hover,
.map-comp-delete-btn:hover,
.map-join-reject-btn:hover {
    background: #fde8e8;
    color: #b42318 !important;
    border-color: #e8aaaa;
}

.map-status-decision-wrap {
    display: grid;
    gap: 10px;
}

.map-status-decision-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.map-status-action-btn.is-active {
    font-weight: 800;
    box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.08);
}

.map-status-action-correction.is-active {
    background: #fde8e8 !important;
    color: #c0392b !important;
    border-color: #c0392b !important;
}

.map-status-action-btn[data-status="Approved"].is-active {
    background: #d1f2eb !important;
    color: #1a7a5e !important;
    border-color: #1a7a5e !important;
}

.map-status-more-select {
    width: auto;
    min-width: 150px;
    max-width: 220px;
}

.map-status-note-label {
    display: grid;
    gap: 5px;
    color: var(--portal-muted-text, #5f7078);
    font-size: 12px;
    font-weight: 800;
}

.map-status-note {
    width: 100%;
    min-height: 68px;
    resize: vertical;
    border: 1px solid var(--portal-border, #d9e2ec);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--portal-text, #1e3a5f);
    background: #fff;
}

.map-status-current-note {
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff8e6;
    color: var(--portal-muted-text, #5f7078);
    font-size: 12px;
    line-height: 1.5;
}

.map-report-button-secondary,
.map-upload-picker-btn,
.map-upload-clear-btn,
.map-agent-picker-action,
.map-file-picker,
.map-party-add,
.map-case-file-choose-btn,
.map-ctos-file-button {
    background: #fff;
    color: var(--portal-primary) !important;
    border-color: #cdd8e4;
    box-shadow: 0 2px 6px rgba(30, 58, 95, 0.08);
}

.map-report-button-secondary:hover,
.map-upload-picker-btn:hover,
.map-upload-picker-btn:focus,
.map-upload-clear-btn:hover,
.map-upload-clear-btn:focus,
.map-agent-picker-action:hover,
.map-file-picker:hover,
.map-file-picker:focus,
.map-party-add:hover,
.map-case-file-choose-btn:hover,
.map-ctos-file-button:hover {
    background: #f3f8fd;
    border-color: var(--portal-primary);
    color: var(--portal-primary) !important;
    outline: none;
}

.map-party-remove,
.map-case-file-remove {
    background: #fff7f6;
    color: #b42318 !important;
    border-color: #f0c7c7;
    box-shadow: none;
}

.map-party-remove:hover,
.map-case-file-remove:hover,
.map-case-file-remove:focus {
    background: #fde8e8;
    color: #b42318 !important;
    outline: none;
}

.map-badge-new {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #b42318;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
    vertical-align: middle;
}

.map-btn-small:disabled,
.map-btn-small[disabled],
.map-report-button:disabled,
.map-report-button[disabled],
.map-upload-picker-btn:disabled,
.map-upload-clear-btn:disabled,
.map-agent-picker-action:disabled,
.map-file-picker:disabled,
.map-party-add:disabled,
.map-party-remove:disabled,
.map-case-file-choose-btn:disabled,
.map-case-file-remove:disabled,
.map-doc-upload-btn:disabled,
#toggleAddAgent:disabled,
#portalLoginBtn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    box-shadow: none;
}

.map-pagination {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.map-pagination-centered {
    justify-content: center;
    margin-top: 25px;
}

.map-page-link {
    min-width: 34px;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid #d8e0e7;
    background: #fff;
    color: var(--portal-primary);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.map-page-link:hover,
.map-page-link.active {
    background: var(--portal-primary);
    color: #fff;
    border-color: var(--portal-primary);
}

.map-upload-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 36px;
}

.map-portal-wrapper input[type="file"],
.map-agent-dashboard input[type="file"],
.map-manager-dashboard input[type="file"] {
    max-width: 100%;
    color: var(--portal-soft-text, #60727c);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.map-portal-wrapper input[type="file"]::file-selector-button,
.map-agent-dashboard input[type="file"]::file-selector-button,
.map-manager-dashboard input[type="file"]::file-selector-button {
    min-height: 34px;
    margin-right: 10px;
    padding: 0 14px;
    border: 1px solid #cdd8e4;
    border-radius: 6px;
    background: #fff;
    color: var(--portal-primary, #1e3a5f);
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.map-portal-wrapper input[type="file"]::file-selector-button:hover,
.map-agent-dashboard input[type="file"]::file-selector-button:hover,
.map-manager-dashboard input[type="file"]::file-selector-button:hover {
    background: #f3f8fd;
    border-color: var(--portal-primary, #1e3a5f);
}

.map-upload-dropzone {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
    max-width: 520px;
    min-height: 96px;
    box-sizing: border-box;
    padding: 18px 22px;
    border: 2px dashed #c3d2e4;
    border-radius: 10px;
    background: #f8fbff;
    color: var(--portal-text);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.map-upload-dropzone:hover,
.map-upload-dropzone:focus-within {
    border-color: var(--portal-primary);
    background: #f3f8fd;
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.08);
}

.map-upload-native-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.map-upload-picker-btn {
    padding: 0 14px !important;
    margin: 0 !important;
    text-transform: none !important;
}

.map-upload-dropzone .map-upload-picker-btn {
    display: block;
    min-height: 0;
    padding: 0 !important;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--portal-text) !important;
    font-size: 13px !important;
    font-weight: 800;
    line-height: 1.3;
    white-space: normal;
}

.map-upload-dropzone .map-upload-hint {
    display: block;
    color: var(--portal-muted-text);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
}

.map-upload-picker-name {
    color: var(--portal-soft-text, #6f7f86);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.map-upload-dropzone .map-upload-picker-name {
    color: #50637a;
    font-weight: 800;
}

.map-inline-image-preview {
    align-items: center;
    gap: 14px;
    margin: 0 0 10px;
}

.map-inline-image-preview img {
    border: 1px solid var(--portal-border, #d8e2ee);
    border-radius: 8px;
    height: 72px;
    object-fit: cover;
    width: 72px;
}

.map-reward-admin-title {
    align-items: center;
    display: flex;
    gap: 12px;
    min-width: 0;
}

.map-reward-admin-title img {
    border: 1px solid var(--portal-border, #d8e2ee);
    border-radius: 8px;
    flex: 0 0 auto;
    height: 46px;
    object-fit: cover;
    width: 46px;
}

.map-upload-clear-btn {
    margin-top: 10px;
}

/* 9. LOGIN UI */
.map-portal-login-container { display: flex; justify-content: center; align-items: center; height: 80vh; background: #fff; }
.map-portal-login-card { background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.08); width: 380px; border-top: 5px solid var(--portal-primary); }
.map-portal-login-header { text-align: center; margin-bottom: 30px; }
.map-portal-login-header h2 { font-size: 22px; color: var(--portal-sidebar-bg); margin-bottom: 8px; }
.map-portal-login-header p { font-size: 13px; color: var(--portal-soft-text); }
.login-field label { text-align: left !important; display: block; }
#portalLoginBtn { width: 100%; padding: 12px; background: var(--portal-primary); color: var(--portal-btn-text); border: none; border-radius: 6px; font-weight: 700; cursor: pointer; margin-top: 20px; }
#portalLoginBtn:hover { background: var(--portal-hover); color: var(--portal-btn-text-hover); }
.map-auth-row {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin: 14px 0 0;
}
.map-auth-remember {
    align-items: center;
    color: var(--portal-soft-text, #60727c);
    cursor: pointer;
    display: flex;
    font-size: 12px;
    gap: 6px;
}
.map-auth-primary-btn {
    align-items: center;
    background: var(--portal-primary, #1e3a5f);
    border: 1px solid var(--portal-primary, #1e3a5f);
    border-radius: 6px;
    box-sizing: border-box;
    color: var(--portal-btn-text, #ffffff) !important;
    cursor: pointer;
    display: inline-flex;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    justify-content: center;
    line-height: 1.2;
    margin-top: 20px;
    min-height: 46px;
    padding: 0 18px;
    text-decoration: none !important;
    width: 100%;
}
.map-auth-primary-btn:hover,
.map-auth-primary-btn:focus {
    background: var(--portal-hover, #2b5080);
    border-color: var(--portal-hover, #2b5080);
    color: var(--portal-btn-text-hover, #ffffff) !important;
}
.map-auth-primary-btn:disabled {
    cursor: wait;
    opacity: 0.75;
}
.map-auth-link-btn {
    background: none;
    border: 0;
    color: var(--portal-primary, #1e3a5f);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    padding: 0;
    text-decoration: underline;
}
.map-auth-link-btn:hover,
.map-auth-link-btn:focus {
    color: var(--portal-hover, #2b5080);
}

/* 10. BULK IMPORT UI (PROFESSIONAL DROPZONE) */
.map-bulk-import-wrapper { padding: 20px 0; display: flex; justify-content: center; }
.map-bulk-dropzone {
    width: 100%; max-width: 550px; padding: 50px 40px; border: 2px dashed var(--portal-border);
    border-radius: 12px; text-align: center; background: #fafbfc; transition: all 0.3s ease;
}
.map-bulk-dropzone:hover { border-color: var(--portal-primary); background: #ffffff; }
.map-bulk-dropzone .dashicons-media-spreadsheet {
    font-size: 50px; width: 50px; height: 50px; color: #dcdde1; margin-bottom: 20px;
}
.map-bulk-dropzone h4 { font-size: 18px; color: var(--portal-sidebar-bg); margin: 0 0 10px 0; }
.map-bulk-dropzone p { font-size: 13px; color: var(--portal-soft-text); line-height: 1.6; margin-bottom: 30px; }

.map-bulk-file-selector { margin-bottom: 35px; }
#bulk-file-name {
    margin-top: 15px; font-size: 12px; font-weight: 600; color: var(--portal-primary);
    background: rgba(30, 58, 95, 0.05); padding: 8px 18px; border-radius: 20px; display: inline-block;
}

.map-bulk-actions { border-top: 1px solid var(--portal-border); padding-top: 30px; margin-top: 25px; }
.map-bulk-footer { margin-top: 25px; }
.map-bulk-footer a {
    font-size: 12px; color: var(--portal-primary); text-decoration: none; font-weight: 700; display: inline-flex; align-items: center; gap: 5px;
}
.map-bulk-footer a:hover { color: var(--portal-hover); }
/* Drawer full-width fix */
.map-drawer-row td { width: 100%; padding: 0; }
.map-drawer-content { width: 100%; box-sizing: border-box; }
.map-portal-table { table-layout: fixed; }
.map-portal-wrapper { border-radius: 12px; overflow: hidden; }
.map-portal-main { overflow-y: auto; }

/* Shared detail drawers.
   Keep this scoped so ordinary table action columns keep their own alignment. */
.map-sub-drawer td {
    width: auto !important;
    min-width: 0 !important;
    text-align: left !important;
}

.map-sub-drawer p,
.map-sub-drawer span,
.map-sub-drawer strong,
.map-sub-drawer small,
.map-sub-drawer label,
.map-case-view-panel,
.map-case-view-panel p,
.map-case-view-panel span,
.map-case-view-panel strong,
.map-case-view-panel small,
.map-case-detail-card,
.map-case-detail-card h4,
.map-case-detail-item,
.map-case-detail-item span,
.map-case-detail-item strong {
    text-align: left !important;
}

.map-sub-drawer .map-case-detail-card,
.map-case-view-panel .map-case-detail-card {
    justify-items: stretch;
}

.map-sub-drawer .map-case-detail-item,
.map-case-view-panel .map-case-detail-item {
    justify-items: stretch;
}

.map-toast-wrap {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 99999;
    display: grid;
    gap: 10px;
    max-width: min(360px, calc(100vw - 32px));
}

.map-toast {
    border: 1px solid var(--portal-border, #d8e0e7);
    border-left: 4px solid var(--portal-primary, #1e3a5f);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 14px 32px rgba(20, 48, 80, 0.16);
    color: var(--portal-text, #263746);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    padding: 12px 14px;
}

.map-toast-success { border-left-color: #1a7a5e; }
.map-toast-error { border-left-color: #c0392b; }
.map-toast-info { border-left-color: var(--portal-primary, #1e3a5f); }

/* Shared CTOS / Land Search request rows */
.map-ctos-work-queue h3 {
    margin: 0 0 16px;
    color: var(--portal-primary, #1e3a5f);
    font-size: 22px;
    line-height: 1.25;
}

.map-ctos-queue-tools {
    display: grid;
    grid-template-columns: minmax(220px, 260px);
    gap: 10px;
    margin: 0 0 16px;
}

.map-ctos-queue-tools select {
    min-height: 42px;
    width: 100%;
    border: 1px solid var(--portal-border, #d8e0e7);
    border-radius: 8px;
    color: var(--portal-text, #253444);
    font-size: 13px;
    font-weight: 600;
    padding: 0 12px;
}

.map-ctos-request-card {
    display: grid;
    grid-template-columns: minmax(280px, 1.45fr) minmax(160px, .6fr) minmax(190px, .75fr);
    gap: 16px;
    align-items: start;
    border: 1px solid var(--portal-border, #d8e0e7);
    border-radius: 8px;
    background: #fff;
    padding: 16px;
    margin-bottom: 12px;
    color: var(--portal-text, #253444);
}

.map-ctos-request-card > * {
    align-self: start;
    min-width: 0;
}

.map-ctos-request-main {
    display: grid;
    gap: 7px;
    min-width: 0;
}
.map-ctos-request-main strong {
    color: var(--portal-primary, #1e3a5f);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.25;
}
.map-ctos-request-card span {
    color: var(--portal-soft-text, #53666f);
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.map-ctos-request-status {
    display: grid;
    justify-items: start;
    gap: 6px;
}
.map-status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #e9f4ff;
    color: var(--portal-primary, #1e3a5f) !important;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    padding: 6px 10px;
}
.map-status-pill--compact {
    font-size: 11px;
    padding: 4px 10px;
}
.map-muted-meta {
    color: var(--portal-soft-text, #53666f);
    font-size: 12px;
    line-height: 1.45;
}
.map-block-meta {
    display: block;
    margin-top: 6px;
}
.map-empty-state {
    color: var(--portal-soft-text, #53666f);
    font-size: 14px;
    font-weight: 700;
    padding: 52px 24px;
    text-align: center;
}
.map-table-actions {
    text-align: right;
}
.map-col-points {
    width: 80px;
}
.map-col-status {
    width: 100px;
}
.map-col-date {
    width: 110px;
}
.map-col-actions {
    text-align: right;
    width: 200px;
}
.map-inline-action {
    margin-right: 4px;
}
.map-section-toolbar {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}
.map-section-title {
    color: var(--portal-primary, #1e3a5f);
    font-size: 18px;
    font-weight: 800;
    margin: 0;
}
.map-section-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.map-compact-select {
    max-width: 190px;
}
.map-drawer-pad {
    padding: 20px;
}
.map-detail-panel {
    background: #fff;
    border: 1px solid #eef0f2;
    border-radius: 8px;
    padding: 12px 14px;
    text-align: left;
}
.map-detail-panel--soft {
    background: #f8f9fa;
}
.map-detail-panel--warning {
    background: #fff8e6;
    border-color: #f5d78a;
}
.map-detail-panel--spaced {
    margin-bottom: 16px;
}
.map-detail-panel--compact {
    font-size: 12px;
}
.map-detail-title {
    color: var(--portal-muted-text, #5f7078);
    display: block;
    font-size: 10px;
    font-weight: 800;
    margin: 0 0 8px;
    text-align: left;
    text-transform: uppercase;
}
.map-detail-title--primary {
    color: var(--portal-primary, #1e3a5f);
    font-size: 12px;
    text-transform: none;
}
.map-detail-title--warning {
    color: #8a6d1d;
    font-size: 12px;
    text-transform: none;
}
.map-detail-grid {
    display: grid;
    gap: 14px;
    font-size: 12px;
    text-align: left;
}
.map-detail-grid--5 {
    grid-template-columns: repeat(5, minmax(110px, 1fr));
}
.map-detail-grid--4 {
    grid-template-columns: repeat(4, minmax(110px, 1fr));
}
.map-detail-grid--3 {
    grid-template-columns: repeat(3, minmax(110px, 1fr));
}
.map-detail-item {
    text-align: left;
}
.map-detail-label {
    color: var(--portal-soft-text, #53666f);
    display: block;
    margin-bottom: 3px;
    text-align: left;
}
.map-detail-list {
    display: grid;
    gap: 8px;
}
.map-detail-file-row {
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #eef0f2;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 9px 10px;
}
.map-detail-file-main {
    flex: 1;
    min-width: 220px;
}
.map-detail-decision-row {
    align-items: center;
    border-top: 1px solid #eee;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 15px;
}

.map-detail-decision-row.map-status-decision-wrap {
    align-items: stretch;
    display: grid;
    gap: 12px;
}

.map-detail-decision-row .map-status-decision-main {
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    min-width: 0;
}

.map-detail-decision-row .map-status-action-btn {
    min-height: 40px;
    min-width: 120px;
    padding-left: 18px;
    padding-right: 18px;
}

.map-detail-decision-row .map-status-action-correction {
    min-width: 180px;
}

.map-detail-decision-row .map-status-more-select {
    flex: 0 1 230px;
    height: 40px;
    max-width: 230px;
    min-width: 160px;
    width: 230px;
}

.map-detail-decision-row .map-status-more-apply {
    background: var(--portal-primary, #1e3a5f) !important;
    border-color: var(--portal-primary, #1e3a5f) !important;
    color: #fff !important;
    width: auto;
    min-height: 40px;
    min-width: 96px;
}

.map-detail-decision-row .map-status-more-apply:hover,
.map-detail-decision-row .map-status-more-apply:focus {
    background: var(--portal-sidebar-bg, #183454) !important;
    border-color: var(--portal-sidebar-bg, #183454) !important;
    color: #fff !important;
}

.map-detail-decision-row .map-status-note-label {
    max-width: 720px;
}

.map-manager-dashboard .map-status-note,
.map-status-note {
    box-sizing: border-box;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.45;
    min-height: 92px;
    padding: 10px 12px;
}

.map-manager-dashboard .map-status-note::placeholder,
.map-status-note::placeholder {
    color: var(--portal-soft-text, #6f7f86);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.45;
}

.map-detail-decision-label {
    color: var(--portal-primary, #1e3a5f);
    font-size: 12px;
    font-weight: 700;
}
.map-detail-inline-control {
    max-width: 260px;
}
.map-detail-inline-control--narrow {
    max-width: 130px;
}
.map-ctos-request-actions {
    display: grid;
    gap: 10px;
    justify-items: stretch;
    align-content: start;
}
.map-ctos-request-actions > .map-btn-small {
    width: 100%;
    justify-content: center;
}
.map-ctos-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.map-ctos-action-row .map-btn-small {
    flex: 1 1 150px;
    justify-content: center;
    min-width: 150px;
}
.map-ctos-action-secondary {
    width: 100%;
    background: var(--portal-primary, #1e3a5f) !important;
    color: #fff !important;
    text-decoration: none !important;
}
.map-ctos-action-warning {
    background: #ffca57 !important;
    color: var(--portal-text, #253444) !important;
}
.map-ctos-action-light {
    min-width: 82px;
    background: #eef3f8 !important;
    color: var(--portal-primary, #1e3a5f) !important;
    border: 1px solid var(--portal-border, #d8e0e7) !important;
    text-decoration: none !important;
}
.map-ctos-note {
    color: var(--portal-soft-text, #53666f);
    font-size: 13px;
    line-height: 1.45;
    margin: 0;
}
.map-ctos-details {
    width: 100%;
}
.map-ctos-details-row {
    grid-column: 1 / -1;
}
.map-ctos-details summary {
    color: var(--portal-primary, #1e3a5f);
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    list-style-position: inside;
    margin-top: 0;
}
.map-ctos-details-body {
    display: grid;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--portal-border, #d8e0e7);
}
.map-ctos-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.map-ctos-detail-grid span,
.map-ctos-signature-preview {
    display: grid;
    gap: 3px;
    color: var(--portal-soft-text, #53666f);
    font-size: 12px;
    line-height: 1.35;
}
.map-ctos-detail-grid strong,
.map-ctos-signature-preview strong,
.map-ctos-detail-label {
    color: var(--portal-text, #1e3a5f);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}
.map-ctos-document-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.map-ctos-document-links .map-ctos-detail-label {
    flex: 0 0 100%;
}
.map-ctos-signature-preview img {
    max-width: 180px;
    max-height: 76px;
    object-fit: contain;
    border: 1px solid var(--portal-border, #d8e0e7);
    border-radius: 6px;
    background: #fff;
    padding: 5px;
}
.map-ctos-report-form {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
    width: 100%;
}
.map-ctos-file-button {
    width: 100%;
    background: #eef3f8 !important;
    border: 1px solid var(--portal-border, #d8e0e7);
    color: var(--portal-primary, #1e3a5f) !important;
    cursor: pointer;
}
.map-ctos-file-button input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.map-ctos-report-form .map-btn-small,
.map-ctos-request-actions > .map-btn-small {
    width: 100%;
    min-height: 40px;
}
.map-ctos-report-form .map-btn-small:disabled {
    cursor: not-allowed;
    opacity: .55;
}
.map-readonly-badge {
    display: inline-flex;
    align-items: center;
    width: max-content;
    margin-top: 10px;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 999px;
    color: rgba(255, 255, 255, .86);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.map-readonly-form input:disabled,
.map-readonly-form select:disabled,
.map-readonly-form textarea:disabled {
    background: #f7f9fb !important;
    color: var(--portal-muted-text, #5f7078) !important;
    cursor: default;
    opacity: 1;
}
.map-readonly-manager .map-btn-small[disabled] {
    cursor: default;
}

.map-comp-rule-group-list {
    display: grid;
    gap: 12px;
}
.map-comp-rule-group {
    background: #fff;
    border: 1px solid var(--portal-border, #d8e0e7);
    border-radius: 8px;
    box-shadow: var(--portal-shadow, 0 4px 15px rgba(0,0,0,0.05));
    padding: 14px;
}
.map-comp-rule-group-head {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 10px;
}
.map-comp-rule-group-title {
    color: var(--portal-primary, #1e3a5f);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}
.map-comp-rule-criteria {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 12px;
}
.map-comp-case-target-settings {
    grid-template-columns: 1fr;
}
.map-comp-case-target-settings .map-comp-case-mode-field,
.map-comp-case-target-settings .map-comp-shared-target-field {
    grid-column: 1 / -1;
}
.map-comp-rule-criteria label.map-comp-hidden,
.map-comp-hidden {
    display: none !important;
}
.map-comp-rule-criteria label {
    display: grid !important;
    gap: 5px;
    margin: 0 !important;
    text-transform: none !important;
}
.map-comp-rule-criteria label span {
    color: var(--portal-muted-text, #526670);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
}
.map-comp-rule-criteria input,
.map-comp-rule-criteria select {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--portal-border, #d8e0e7);
    border-radius: 6px;
    color: var(--portal-text, #1e3a5f);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 10px;
}
.map-comp-rule-criteria .map-comp-firm-field {
    grid-column: 1 / -1;
}
.map-comp-firm-options {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.map-comp-firm-option {
    align-items: center;
    background: #f8fbff;
    border: 1px solid var(--portal-border, #d8e0e7);
    border-radius: 8px;
    display: flex !important;
    gap: 8px;
    margin: 0 !important;
    min-height: 40px;
    padding: 8px 10px;
    text-transform: none !important;
}
.map-comp-firm-option input {
    flex: 0 0 16px;
    height: 16px !important;
    margin: 0 !important;
    min-height: 16px !important;
    padding: 0 !important;
    width: 16px !important;
}
.map-comp-firm-option span {
    color: var(--portal-text, #1e3a5f) !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    overflow-wrap: anywhere;
    text-transform: none !important;
}
.map-comp-firm-option:has(input:checked) {
    background: #eef6ff;
    border-color: var(--portal-primary, #1e3a5f);
}
.map-comp-rule-section-title {
    color: var(--portal-muted-text, #526670);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.2;
    margin: 14px 0 8px;
    text-transform: uppercase;
}
.map-rich-editor {
    border: 1px solid var(--portal-border, #d8e0e7);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.map-rich-toolbar {
    align-items: center;
    background: #f8fbff;
    border-bottom: 1px solid var(--portal-border, #d8e0e7);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
}
.map-rich-btn {
    background: #fff;
    border: 1px solid var(--portal-border, #d8e0e7);
    border-radius: 6px;
    color: var(--portal-primary, #1e3a5f);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    min-height: 30px;
    padding: 5px 9px;
}
.map-rich-btn:hover {
    background: #eef6ff;
    border-color: var(--portal-primary, #1e3a5f);
}
.map-rich-editor-area {
    color: var(--portal-text, #1e3a5f);
    font-size: 13px;
    line-height: 1.6;
    min-height: 130px;
    outline: none;
    padding: 12px;
}
.map-rich-editor-area-compact {
    min-height: 96px;
}
.map-rich-editor-area:empty:before {
    color: var(--portal-soft-text, #6f7f86);
    content: attr(data-placeholder);
}
.map-rich-editor-area ul,
.map-rich-editor-area ol {
    margin: 0 0 0 20px;
    padding: 0;
}
.map-comp-description p {
    margin: 0 0 8px;
}
.map-comp-description p:last-child {
    margin-bottom: 0;
}
.map-comp-description ul,
.map-comp-description ol {
    margin: 0 0 8px 18px;
    padding: 0;
}
.map-comp-rule-options {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.map-comp-rule-option {
    align-items: center;
    background: #f8fbff;
    border: 1px solid var(--portal-border, #d8e0e7);
    border-radius: 8px;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    gap: 8px;
    margin: 0;
    min-height: 46px;
    padding: 10px 14px;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.map-comp-rule-option input {
    align-self: center;
    display: block;
    height: 16px !important;
    margin: 0;
    min-height: 16px !important;
    padding: 0 !important;
    width: 16px !important;
}
.map-comp-rule-option span {
    align-self: center;
    color: var(--portal-text, #1e3a5f);
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    padding-right: 4px;
}
.map-comp-rule-option small {
    align-self: center;
    color: #e65100;
    font-size: 11px;
    font-weight: 800;
    background: #fff3e0;
    border-radius: 999px;
    padding: 3px 8px;
    white-space: nowrap;
}
.map-comp-rule-option:has(input:checked) {
    background: #eef6ff;
    border-color: var(--portal-primary, #1e3a5f);
    box-shadow: inset 3px 0 0 var(--portal-primary, #1e3a5f);
}
#map-comp-case-types-wrap label.map-comp-rule-option {
    align-items: center !important;
    display: flex !important;
    flex-wrap: nowrap;
    gap: 8px;
    letter-spacing: 0;
    margin: 0;
    text-transform: none !important;
}
#map-comp-case-types-wrap label.map-comp-rule-option input[type="checkbox"] {
    flex: 0 0 16px;
}
#map-comp-case-types-wrap label.map-comp-rule-option span {
    align-items: center;
    display: inline-flex;
    flex: 0 1 auto;
}
#map-comp-case-types-wrap label.map-comp-rule-option small {
    flex: 0 0 auto;
}
.map-comp-rule-empty {
    color: var(--portal-soft-text, #6f7f86);
    font-size: 13px;
    font-weight: 700;
    grid-column: 1 / -1;
    margin: 0;
}
@media (max-width: 860px) {
    .map-comp-rule-criteria {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .map-comp-rule-options {
        grid-template-columns: 1fr;
    }
    .map-comp-firm-options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .map-toast-wrap {
        left: 16px;
        right: 16px;
        top: 12px;
    }
    .map-ctos-request-card {
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
        gap: 12px;
        padding: 14px;
    }
    .map-ctos-request-status,
    .map-ctos-request-actions {
        min-width: 0;
        justify-items: stretch;
    }
    .map-status-pill {
        justify-self: start;
        max-width: 100%;
        white-space: normal;
    }
    .map-ctos-report-form {
        grid-template-columns: 1fr;
        max-width: none;
    }
    .map-comp-rule-options {
        grid-template-columns: 1fr;
    }
    .map-comp-rule-criteria {
        grid-template-columns: 1fr;
    }
    .map-status-decision-main {
        align-items: stretch;
        flex-wrap: wrap;
    }
    .map-status-decision-main .map-btn-small,
    .map-status-more-select {
        width: 100%;
        max-width: none;
    }
}

.map-manager-section-head {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 18px;
}
.map-manager-section-head h3 {
    color: var(--portal-primary, #1e3a5f);
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 6px;
}
.map-reward-admin-form {
    margin-bottom: 22px;
}
.map-reward-admin-form textarea,
#map-point-cycle-form textarea {
    border: 1px solid var(--portal-border, #d8e2ee);
    border-radius: 8px;
    box-sizing: border-box;
    color: var(--portal-text, #1e3a5f);
    font-size: 14px;
    line-height: 1.5;
    padding: 12px;
    resize: vertical;
    width: 100%;
}
.map-form-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
    margin-top: 14px;
}
.map-table-note-row td {
    background: #f8fafc;
    color: var(--portal-soft-text, #6f7f86);
    font-size: 13px;
    line-height: 1.5;
}

@media (max-width: 700px) {
    .map-manager-section-head,
    .map-form-actions {
        align-items: stretch;
        flex-direction: column;
    }
    .map-form-actions .map-btn-small {
        width: 100%;
    }
}
