/* =========================================
   SDOC DASHBOARD
   CLEAN LIGHT / ORANGE THEME
========================================= */

:root {
    --bg: #f5f6f8;
    --panel: #ffffff;

    --border: #e1e5e9;
    --border-dark: #d3d8de;

    --ink: #202b36;
    --ink-soft: #697586;

    --orange: #f28c28;
    --orange-dark: #d96f0b;
    --orange-light: #fff3e6;

    --ok: #198754;
    --ok-bg: #e8f7ee;

    --warn: #b76b00;
    --warn-bg: #fff4dc;

    --danger: #d9363e;
    --danger-bg: #fdebed;

    --shadow-sm: 0 1px 3px rgba(20, 30, 40, 0.08);
    --shadow-md: 0 4px 14px rgba(20, 30, 40, 0.10);

    --radius: 7px;
}


/* =========================================
   GENERAL
========================================= */

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

body {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    background: var(--bg);

    color: var(--ink);

    line-height: 1.5;

    height: 100vh;

    display: flex;
    flex-direction: column;
}


/* =========================================
   HEADER
========================================= */

header {
    background: linear-gradient(
        135deg,
        #f28c28 0%,
        #e87816 100%
    );

    color: white;

    padding: 17px 27px;

    box-shadow:
        0 3px 10px rgba(40, 40, 40, 0.15);

    display: flex;

    justify-content: space-between;
    align-items: center;

    flex-wrap: wrap;

    gap: 12px;

    flex-shrink: 0;
}

header h1 {
    font-size: 20px;

    font-weight: 700;

    letter-spacing: -0.01em;
}

header p {
    margin-top: 3px;

    color: rgba(255, 255, 255, 0.82);

    font-size: 12.5px;
}

#stats {
    font-size: 12.5px;

    color: white;

    background: rgba(255, 255, 255, 0.12);

    border: 1px solid rgba(255, 255, 255, 0.28);

    padding: 7px 12px;

    border-radius: 5px;
}

#stats strong {
    color: white;

    font-variant-numeric: tabular-nums;
}


/* =========================================
   MAIN LAYOUT
========================================= */

.layout {
    flex: 1;

    display: grid;

    grid-template-columns: 360px 1fr;

    overflow: hidden;
}


/* =========================================
   LEFT EMAIL LIST
========================================= */

.list-pane {
    border-right: 1px solid var(--border);

    background: var(--panel);

    display: flex;

    flex-direction: column;

    overflow: hidden;
}


/* =========================================
   SEARCH
========================================= */

.search-wrap {
    padding: 14px;

    border-bottom: 1px solid var(--border);

    position: relative;

    flex-shrink: 0;

    background: #ffffff;
}

.search-input {
    position: relative;
}

.search-input::before {
    content: "⌕";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #8993a0;
    pointer-events: none;
    font-size: 17px;
}

#searchInput {
    width: 100%;

    padding: 9px 12px 9px 32px;

    border: 1px solid var(--border-dark);

    border-radius: 6px;

    font-size: 13.5px;

    background: #f8f9fa;

    color: var(--ink);

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}

#searchInput::placeholder {
    color: #929aa5;
}

#searchInput:hover {
    border-color: #bdc5ce;
}

#searchInput:focus {
    outline: none;

    border-color: var(--orange);

    background: #ffffff;

    box-shadow:
        0 0 0 3px rgba(242, 140, 40, 0.13);
}


/* =========================================
   EMAIL LIST
========================================= */

#email-list {
    overflow-y: auto;

    flex: 1;
}


/* Scrollbar */

#email-list::-webkit-scrollbar,
.detail-pane::-webkit-scrollbar {
    width: 7px;
}

#email-list::-webkit-scrollbar-track,
.detail-pane::-webkit-scrollbar-track {
    background: #f4f5f6;
}

#email-list::-webkit-scrollbar-thumb,
.detail-pane::-webkit-scrollbar-thumb {
    background: #cdd2d8;

    border-radius: 4px;
}

#email-list::-webkit-scrollbar-thumb:hover,
.detail-pane::-webkit-scrollbar-thumb:hover {
    background: #b5bcc4;
}


/* =========================================
   EMAIL ROW
========================================= */

.email-row {
    padding: 13px 16px;

    border-bottom: 1px solid #edf0f2;

    cursor: pointer;

    background: #ffffff;

    transition:
        background-color 0.15s ease,
        border-left 0.15s ease;
}


/* Hover */

.email-row:hover {
    background: #f6f7f8;

    border-left: 3px solid #f3b06b;

    padding-left: 13px;
}


/* Selected */

.email-row.active {
    background: var(--orange-light);

    border-left: 3px solid var(--orange);

    padding-left: 13px;
}


/* =========================================
   SUBJECT
========================================= */

.email-row .subject {
    font-size: 13.5px;

    font-weight: 600;

    color: var(--ink);

    margin-bottom: 5px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}

.email-row:hover .subject,
.email-row.active .subject {
    color: #18222c;
}


/* =========================================
   EMAIL META
========================================= */

.email-row .meta {
    display: flex;

    align-items: center;

    gap: 7px;

    flex-wrap: wrap;
}

.email-row .id {
    font-size: 10.5px;

    color: #8a95a1;

    font-variant-numeric: tabular-nums;
}


/* =========================================
   CATEGORY BADGES
========================================= */

.badge {
    display: inline-block;

    padding: 2px 8px;

    border-radius: 4px;

    font-size: 10px;

    font-weight: 700;

    letter-spacing: 0.01em;

    background: #eef0f2;

    color: #596572;

    border: 1px solid #e1e5e8;
}

.badge.BL_COMPARISON {
    background: #fff0df;

    color: #c96800;

    border-color: #ffd7ad;
}

.badge.SPAM {
    background: #f2e8fa;

    color: #7437a3;

    border-color: #dfc9ee;
}


/* =========================================
   STATUS PILLS
========================================= */

.status-pill {
    display: inline-flex;

    align-items: center;

    gap: 5px;

    padding: 2px 8px;

    border-radius: 4px;

    font-size: 10px;

    font-weight: 700;
}

.status-pill::before {
    content: "";

    width: 5px;

    height: 5px;

    border-radius: 50%;

    background: currentColor;
}

.status-pill.OK {
    color: var(--ok);

    background: var(--ok-bg);
}

.status-pill.MISMATCH {
    color: var(--warn);

    background: var(--warn-bg);
}

.status-pill.NEEDS_REVIEW {
    color: var(--danger);

    background: var(--danger-bg);
}


/* =========================================
   EMPTY / LOADING
========================================= */

.empty-state,
.loading-state {
    padding: 40px 20px;

    text-align: center;

    color: var(--ink-soft);

    font-size: 13.5px;
}

.empty-state strong {
    display: block;

    color: var(--ink);

    margin-bottom: 4px;

    font-size: 14.5px;
}


/* =========================================
   DETAIL PANE
========================================= */

.detail-pane {
    overflow-y: auto;

    padding: 25px 28px;

    background: #f5f6f8;
}


/* =========================================
   PLACEHOLDER
========================================= */

.detail-placeholder {
    height: 100%;

    display: flex;

    align-items: center;

    justify-content: center;

    color: #8b96a3;

    font-size: 14px;

    text-align: center;

    flex-direction: column;

    gap: 6px;
}

.detail-placeholder div:first-child {
    font-size: 23px;

    color: #b0b8c1;
}


/* =========================================
   CARDS
========================================= */

.card {
    background: #ffffff;

    border: 1px solid var(--border);

    border-radius: var(--radius);

    box-shadow: var(--shadow-sm);

    padding: 18px 20px;

    margin-bottom: 15px;

    transition:
        box-shadow 0.15s ease,
        border-color 0.15s ease;
}

.card:hover {
    border-color: #d7dce1;

    box-shadow: var(--shadow-md);
}

.card h2 {
    font-size: 15px;

    font-weight: 700;

    margin-bottom: 10px;

    color: #26313c;
}

.card .sub {
    font-size: 12px;

    color: var(--ink-soft);

    margin-bottom: 10px;
}

.card .body-text {
    font-size: 13.5px;

    white-space: pre-wrap;

    color: #414c57;

    line-height: 1.65;
}


/* =========================================
   FIELD TABLE
========================================= */

.fields-table {
    width: 100%;

    border-collapse: collapse;

    margin-top: 4px;
}

.fields-table th {
    text-align: left;

    font-size: 11px;

    color: #74808c;

    padding: 8px 10px;

    border-bottom: 1px solid var(--border);
}

.fields-table td {
    padding: 8px 10px;

    font-size: 13px;

    border-bottom: 1px solid #edf0f2;

    color: #46515c;
}

.fields-table tr.defect {
    background: var(--danger-bg);
}

.fields-table tr.defect td:first-child {
    font-weight: 700;

    color: var(--danger);
}


/* =========================================
   CODE
========================================= */

code {
    background: #f1f3f5;

    color: #4f5964;

    padding: 2px 6px;

    border-radius: 4px;

    font-size: 12px;

    font-family:
        "SF Mono",
        Menlo,
        Consolas,
        monospace;
}


/* =========================================
   REVIEW PANEL
 */

.review-panel {
    border-left: 3px solid var(--danger);
}

.review-panel h3 {
    font-size: 13px;

    color: var(--danger);

    margin-bottom: 10px;
}

.review-panel select,
.review-panel textarea {
    width: 100%;

    padding: 8px 10px;

    border: 1px solid var(--border-dark);

    border-radius: 5px;

    font-size: 13px;

    font-family: inherit;

    margin-bottom: 8px;

    background: #f8f9fa;

    color: var(--ink);
}

.review-panel select:focus,
.review-panel textarea:focus {
    outline: none;

    border-color: var(--orange);

    background: #ffffff;

    box-shadow:
        0 0 0 3px rgba(242, 140, 40, 0.10);
}

.review-panel textarea {
    resize: vertical;

    min-height: 56px;
}


/* =========================================
   REVIEW BUTTON
========================================= */

.review-panel button {
    background: var(--orange);

    color: white;

    border: none;

    padding: 8px 16px;

    border-radius: 5px;

    font-size: 13px;

    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.15s ease,
        box-shadow 0.15s ease;
}

.review-panel button:hover {
    background: var(--orange-dark);

    box-shadow:
        0 3px 8px rgba(217, 111, 11, 0.25);
}

.review-panel button:disabled {
    opacity: 0.6;

    cursor: not-allowed;

    box-shadow: none;
}

.review-status {
    font-size: 12px;

    margin-top: 8px;

    color: var(--ink-soft);
}


/* =========================================
   RESPONSIVE
========================================= */

@media (max-width: 800px) {

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

    .list-pane {
        max-height: 40vh;

        border-right: none;

        border-bottom: 1px solid var(--border);
    }

    .detail-pane {
        padding: 20px;
    }

    header {
        padding: 15px 18px;
    }

    header h1 {
        font-size: 17px;
    }
}

.filter-btn {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    background: #f0f2f4;
    color: #596572;
    border: 1px solid #e1e5e8;
    border-radius: 5px;
    cursor: pointer;
}
.filter-btn:hover { background: #e4e7ea; }
.filter-btn.active {
    background: var(--orange);
    color: white;
    border-color: var(--orange);
}