#missingResult {
    width: min(1136px, calc(100% - 40px));
    margin: 0 auto 72px;
}

.md-report {
    margin-top: 32px;
    color: #071b44;
}

.md-report *,
.md-state * {
    box-sizing: border-box;
}

.md-report-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    padding: 34px;
    margin-bottom: 24px;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(
            circle at 100% 0,
            rgba(255, 152, 0, .20),
            transparent 36%
        ),
        linear-gradient(135deg, #071b44, #12397b);
    border: 1px solid rgba(255, 152, 0, .35);
    border-radius: 28px;
    box-shadow: 0 24px 68px rgba(7, 27, 68, .22);
}

.md-report-hero h2 {
    margin: 15px 0 8px;
    color: #fff;
    font-size: clamp(30px, 4vw, 42px);
    line-height: 1.08;
}

.md-report-hero p {
    max-width: 720px;
    margin: 0;
    color: #dbe7ff;
    line-height: 1.65;
}

.md-eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    color: #ffd18b;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
    background: rgba(255, 152, 0, .12);
    border: 1px solid rgba(255, 152, 0, .65);
    border-radius: 999px;
}

.md-primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 52px;
    padding: 14px 22px;
    color: #fff;
    font-weight: 900;
    text-decoration: none;
    background: linear-gradient(135deg, #ff8a00, #ffad22);
    border-radius: 15px;
    box-shadow: 0 15px 30px rgba(255, 138, 0, .28);
}

.md-primary-action:hover {
    transform: translateY(-1px);
}

.md-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.md-kpi {
    min-height: 155px;
    padding: 22px;
    background: #fff;
    border: 1px solid #e9edf4;
    border-radius: 22px;
    box-shadow: 0 13px 38px rgba(7, 27, 68, .09);
}

.md-kpi-featured {
    color: #fff;
    background: linear-gradient(145deg, #071b44, #12397b);
    border-color: #ff9800;
    border-top-width: 6px;
}

.md-kpi > span {
    display: block;
    margin-bottom: 12px;
    color: #667085;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .025em;
    text-transform: uppercase;
}

.md-kpi-featured > span,
.md-kpi-featured small {
    color: #dbe7ff;
}

.md-kpi strong {
    display: block;
    color: #071b44;
    font-size: 31px;
    line-height: 1.1;
}

.md-kpi-featured strong {
    color: #ffb13b;
    font-size: 48px;
}

.md-kpi small {
    display: block;
    margin-top: 12px;
    color: #7a8497;
    line-height: 1.45;
}

.md-progress {
    height: 11px;
    margin-top: 16px;
    overflow: hidden;
    background: #eef1f6;
    border-radius: 999px;
}

.md-progress i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #ff8500, #ffbf52);
    border-radius: inherit;
}

.md-panel {
    padding: 27px;
    margin-bottom: 24px;
    background: #fff;
    border: 1px solid #e9edf4;
    border-radius: 24px;
    box-shadow: 0 14px 42px rgba(7, 27, 68, .09);
}

.md-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.md-section-heading > div > span {
    display: block;
    margin-bottom: 5px;
    color: #ff8500;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.md-section-heading h3 {
    margin: 0;
    color: #071b44;
    font-size: clamp(22px, 3vw, 28px);
}

.md-status-pill,
.md-priority {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
    border-radius: 999px;
}

.md-status-low,
.md-status-production-ready,
.md-priority-low {
    color: #166534;
    background: #dcfce7;
}

.md-status-medium,
.md-status-needs-review,
.md-priority-medium {
    color: #92400e;
    background: #fef3c7;
}

.md-status-high,
.md-status-repair-required,
.md-priority-high {
    color: #9a3412;
    background: #ffedd5;
}

.md-priority-critical {
    color: #991b1b;
    background: #fee2e2;
}

.md-assessment-lead {
    max-width: 940px;
    margin: 0 0 22px;
    color: #071b44;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.55;
}

.md-insight-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
}

.md-insight-grid article {
    padding: 18px;
    background: #fff9ef;
    border: 1px solid #f5d49d;
    border-radius: 17px;
}

.md-insight-grid span {
    display: block;
    margin-bottom: 8px;
    color: #ff7a00;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.md-insight-grid p {
    margin: 0;
    color: #344054;
    line-height: 1.6;
}

.md-chart-grid {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    gap: 24px;
}

.md-chart-panel {
    min-height: 390px;
}

.md-donut {
    --score: 0;
    position: relative;
    display: grid;
    place-items: center;
    width: 220px;
    height: 220px;
    margin: 26px auto 18px;
    background:
        conic-gradient(
            #ff9200 calc(var(--score) * 1%),
            #edf0f5 0
        );
    border-radius: 50%;
}

.md-donut::after {
    position: absolute;
    width: 145px;
    height: 145px;
    content: "";
    background: #fff;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px #edf0f5;
}

.md-donut > div {
    position: relative;
    z-index: 2;
    text-align: center;
}

.md-donut strong,
.md-donut span {
    display: block;
}

.md-donut strong {
    color: #071b44;
    font-size: 31px;
}

.md-donut span {
    margin-top: 5px;
    color: #667085;
    font-size: 13px;
    font-weight: 800;
}

.md-chart-caption {
    margin: 0;
    color: #667085;
    font-weight: 800;
    text-align: center;
}

.md-horizontal-chart {
    display: grid;
    gap: 19px;
    padding-top: 18px;
}

.md-horizontal-chart > div {
    display: grid;
    grid-template-columns: 82px 1fr 38px;
    align-items: center;
    gap: 12px;
}

.md-horizontal-chart span {
    color: #344054;
    font-weight: 800;
}

.md-horizontal-chart i {
    height: 16px;
    overflow: hidden;
    background: #edf0f5;
    border-radius: 999px;
}

.md-horizontal-chart b {
    display: block;
    min-width: 0;
    height: 100%;
    border-radius: inherit;
}

.severity-critical,
.heat-critical {
    background: #dc2626;
}

.severity-high,
.heat-high {
    background: #f97316;
}

.severity-medium,
.heat-medium {
    background: #ffb020;
}

.severity-low,
.heat-low {
    background: #22a06b;
}

.md-horizontal-chart strong {
    color: #071b44;
    text-align: right;
}

.md-column-chart {
    display: grid;
    grid-template-columns: repeat(8, minmax(70px, 1fr));
    align-items: end;
    gap: 13px;
    min-height: 320px;
    padding-top: 20px;
}

.md-column-chart article {
    display: grid;
    grid-template-rows: 28px 220px 38px 20px;
    gap: 7px;
    min-width: 0;
    text-align: center;
}

.md-column-bar-value {
    color: #071b44;
    font-weight: 900;
}

.md-column-bar-track {
    position: relative;
    align-self: stretch;
    overflow: hidden;
    background:
        repeating-linear-gradient(
            to top,
            #f6f7fa 0,
            #f6f7fa 43px,
            #e9edf4 44px
        );
    border-radius: 13px 13px 5px 5px;
}

.md-column-bar-track i {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: 10px 10px 4px 4px;
}

.md-column-chart article > strong {
    overflow: hidden;
    color: #344054;
    font-size: 12px;
    line-height: 1.25;
    text-overflow: ellipsis;
}

.md-column-chart article > span {
    color: #ff7a00;
    font-size: 12px;
    font-weight: 900;
}

.md-sheet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
    gap: 18px;
}

.md-sheet-card {
    padding: 21px;
    background: linear-gradient(145deg, #fffdf8, #fff8ec);
    border: 1px solid #f2c477;
    border-radius: 19px;
}

.md-sheet-card header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
}

.md-sheet-card header span {
    color: #667085;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.md-sheet-card h4 {
    margin: 5px 0 0;
    color: #071b44;
    font-size: 19px;
}

.md-sheet-card header > strong {
    color: #ff7a00;
    white-space: nowrap;
}

.md-sheet-card dl {
    margin: 18px 0 0;
}

.md-sheet-card dl div {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 10px 0;
    border-bottom: 1px solid #f1dfc2;
}

.md-sheet-card dl div:last-child {
    border-bottom: 0;
}

.md-sheet-card dt {
    color: #475467;
    font-weight: 800;
}

.md-sheet-card dd {
    margin: 0;
    color: #ff7a00;
    font-weight: 900;
}

.md-table-heading {
    align-items: flex-end;
}

.md-table-controls {
    display: flex;
    gap: 10px;
}

.md-table-controls input,
.md-table-controls select {
    min-height: 44px;
    padding: 10px 13px;
    color: #071b44;
    background: #fff;
    border: 1px solid #d8dee9;
    border-radius: 11px;
    outline: 0;
}

.md-table-controls input:focus,
.md-table-controls select:focus {
    border-color: #ff9800;
    box-shadow: 0 0 0 3px rgba(255, 152, 0, .15);
}

.md-table-wrap {
    overflow-x: auto;
    border: 1px solid #e9edf4;
    border-radius: 16px;
}

.md-data-table {
    width: 100%;
    min-width: 1100px;
    border-collapse: collapse;
}

.md-data-table th,
.md-data-table td {
    padding: 14px 13px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #edf0f5;
}

.md-data-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #fff;
    background: #071b44;
}

.md-data-table th button {
    padding: 0;
    color: #fff;
    font: inherit;
    font-weight: 900;
    background: none;
    border: 0;
    cursor: pointer;
}

.md-data-table tbody tr:hover {
    background: #fff9ef;
}

.md-data-table td {
    color: #344054;
}

.md-data-table td > strong,
.md-data-table td > small {
    display: block;
}

.md-data-table td > small {
    margin-top: 4px;
    color: #98a2b3;
}

.md-row-details summary {
    color: #ff7a00;
    font-weight: 900;
    cursor: pointer;
}

.md-row-details p,
.md-row-details small {
    display: block;
    min-width: 210px;
    margin: 9px 0 0;
    color: #475467;
    line-height: 1.5;
}

.md-table-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 13px;
    color: #667085;
    font-size: 13px;
    font-weight: 800;
}

.md-heatmap {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: 10px;
}

.md-heatmap article {
    min-height: 88px;
    padding: 14px;
    color: #fff;
    border-radius: 14px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3);
}

.md-heatmap strong,
.md-heatmap span {
    display: block;
}

.md-heatmap strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.md-heatmap span {
    margin-top: 13px;
    font-size: 19px;
    font-weight: 900;
}

.md-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.md-action-grid > .md-panel:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.md-count {
    display: grid;
    place-items: center;
    min-width: 42px;
    height: 42px;
    color: #fff;
    background: #071b44;
    border-radius: 50%;
}

.md-action-list {
    display: grid;
    gap: 13px;
    max-height: 620px;
    padding-right: 4px;
    overflow-y: auto;
}

.md-action-list > article {
    padding: 17px;
    background: #fff9ef;
    border: 1px solid #f4d7a8;
    border-left: 5px solid #ff9800;
    border-radius: 15px;
}

.md-action-list h4 {
    margin: 11px 0 7px;
    color: #071b44;
}

.md-action-list p {
    margin: 6px 0;
    color: #475467;
    line-height: 1.55;
}

.md-action-list > article > strong {
    display: block;
    margin-top: 12px;
    color: #071b44;
}

.md-export-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

.md-export-card {
    display: grid;
    grid-template-columns: 62px 1fr auto;
    align-items: center;
    gap: 15px;
    padding: 17px;
    background: #fffaf2;
    border: 1px solid #f2d4a4;
    border-radius: 17px;
}

.md-export-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    background: linear-gradient(145deg, #071b44, #12397b);
    border-radius: 15px;
}

.md-export-card h4 {
    margin: 0 0 5px;
    color: #071b44;
}

.md-export-card p {
    margin: 0;
    color: #667085;
    font-size: 13px;
    line-height: 1.5;
}

.md-export-card a {
    color: #ff7800;
    font-weight: 900;
}

.md-export-unavailable {
    color: #98a2b3;
    font-size: 13px;
    font-weight: 800;
}

.md-governance-note {
    margin: 20px 0 0;
    padding: 15px 17px;
    color: #475467;
    line-height: 1.6;
    background: #f7f9fc;
    border-left: 5px solid #ff9800;
    border-radius: 10px;
}

.md-empty-state {
    padding: 20px;
    color: #475467;
    text-align: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
}

.md-state {
    display: flex;
    align-items: center;
    gap: 18px;
    width: min(1136px, calc(100% - 40px));
    padding: 24px;
    margin: 28px auto;
    background: #fff;
    border: 1px solid #f0c57d;
    border-radius: 20px;
    box-shadow: 0 14px 38px rgba(7, 27, 68, .09);
}

.md-state h3 {
    margin: 0 0 6px;
    color: #071b44;
}

.md-state p {
    margin: 0;
    color: #667085;
}

.md-error {
    border-left: 7px solid #dc2626;
}

.md-spinner {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border: 5px solid #ffe1b3;
    border-top-color: #ff8500;
    border-radius: 50%;
    animation: md-spin .8s linear infinite;
}

.md-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

@media (max-width: 1050px) {
    .md-kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .md-insight-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .md-column-chart {
        grid-template-columns: repeat(4, minmax(80px, 1fr));
    }

    .md-column-chart article {
        grid-template-rows: 28px 170px 38px 20px;
    }
}

@media (max-width: 820px) {
    #missingResult {
        width: min(100% - 24px, 1136px);
    }

    .md-report-hero {
        display: block;
        padding: 27px;
    }

    .md-primary-action {
        margin-top: 20px;
    }

    .md-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .md-chart-grid,
    .md-action-grid {
        grid-template-columns: 1fr;
    }

    .md-action-grid > .md-panel:last-child:nth-child(odd) {
        grid-column: auto;
    }

    .md-table-heading {
        display: block;
    }

    .md-table-controls {
        margin-top: 16px;
    }

    .md-export-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .md-report {
        margin-top: 20px;
    }

    .md-report-hero,
    .md-panel {
        padding: 20px;
        border-radius: 19px;
    }

    .md-kpi-grid,
    .md-insight-grid {
        grid-template-columns: 1fr;
    }

    .md-kpi {
        min-height: auto;
    }

    .md-section-heading {
        display: block;
    }

    .md-section-heading > .md-status-pill,
    .md-section-heading > .md-count {
        margin-top: 13px;
    }

    .md-column-chart {
        grid-template-columns: repeat(2, minmax(90px, 1fr));
    }

    .md-column-chart article {
        grid-template-rows: 28px 145px 38px 20px;
    }

    .md-table-controls {
        display: grid;
    }

    .md-table-controls input,
    .md-table-controls select {
        width: 100%;
    }

    .md-export-card {
        grid-template-columns: 52px 1fr;
    }

    .md-export-icon {
        width: 50px;
        height: 50px;
    }

    .md-export-card a,
    .md-export-unavailable {
        grid-column: 1 / -1;
        justify-self: stretch;
        padding: 10px;
        text-align: center;
        background: #fff;
        border-radius: 9px;
    }
}

/* =====================================================
   PHASE 13E VISUAL CONSISTENCY
   Scoped to Missing Data Detector reporting only
   ===================================================== */

.md-sheet-card header span,
.md-sheet-card header h4,
.md-sheet-card h4 {
    color: #ffffff !important;
}

.md-sheet-card header > strong {
    color: #ff9800 !important;
}

.md-column-chart article > strong {
    overflow: visible;
    color: #344054;
    font-size: 11px;
    line-height: 1.3;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
}

.md-heatmap strong {
    overflow: visible;
    line-height: 1.3;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
}

@media (max-width: 600px) {
    .md-column-chart article > strong {
        font-size: 10px;
    }
}
