.ms-report,
.ms-related-accounts {
    --ms-navy-950: #061a33;
    --ms-navy-900: #092747;
    --ms-navy-800: #123b63;
    --ms-teal-500: #16c7c1;
    --ms-ink: #13233a;
    --ms-muted: #657286;
    --ms-line: #d9e2ea;
    --ms-panel: #ffffff;
    --ms-panel-soft: #f5f8fa;
    --ms-danger: #b4232b;
    --ms-danger-soft: #fde7e8;
    --ms-success: #147a55;
    --ms-success-soft: #e0f4eb;
    --ms-warning: #875d0a;
    --ms-warning-soft: #fff3d6;
    color: var(--ms-ink);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.single-ms_account,
body:has(.ms-related-accounts) {
    background: #f3f7fa;
}

.ms-summary-grid {
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 1.5rem;
    margin: 1.125rem 0 1.75rem;
    align-items: stretch;
}

.ms-summary-grid > div:first-child,
.ms-summary-card {
    box-sizing: border-box;
    background: var(--ms-panel);
    border: 0.0625rem solid #cbd8e3;
    border-radius: 0.75rem;
    box-shadow: 0 0.5rem 1.5rem rgba(6, 26, 51, 0.07);
    padding: 1rem;
}

.ms-summary-grid > div:first-child {
    padding: 1.25rem 1.375rem;
}

.ms-summary-grid h2,
.ms-summary-card h2,
.ms-summary-card h3 {
    color: var(--ms-navy-900);
    font-family: inherit;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 0.875rem;
}

.ms-summary-grid p,
.ms-summary-grid li {
    font-size: 0.875rem;
    line-height: 1.55;
}

.ms-summary-card p:last-child,
.ms-summary-grid > div:first-child > :last-child {
    margin-bottom: 0;
}

.ms-guidance-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    line-height: 1.3;
}

.ms-guidance-table td {
    height: 2rem;
    border-bottom: 0.0625rem solid #cbd8e3;
    padding: 0.375rem 0.625rem;
    vertical-align: middle;
}

.ms-guidance-table tr:last-child td {
    border-bottom: 0;
}

.ms-guidance-table td:first-child {
    width: 58%;
    color: var(--ms-ink);
    font-size: inherit;
    font-weight: 600;
    text-align: left;
    background: #e9f0f5;
}

.ms-guidance-table td:last-child {
    color: var(--ms-ink);
    font-size: inherit;
    font-weight: 600;
    text-align: right;
    background: #fff;
}

.ms-guidance-table tr:nth-child(even) td:last-child {
    background: #f7fafc;
}

.ms-guidance-result {
    color: var(--ms-navy-900) !important;
    font-size: inherit !important;
    font-weight: 700 !important;
}

.ms-account-group {
    margin: 0 0 2.5rem;
}

.ms-account-group-title {
    color: var(--ms-navy-950);
    font-family: inherit;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 0.875rem;
}

.ms-account-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 1.5rem;
    align-items: stretch;
}

.ms-account-card {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 0;
    position: relative;
}

.ms-related-accounts article.ms-summary-card.ms-account-card > h2 {
    display: flex;
    align-items: center;
    margin-block: 0 1rem !important;
    margin-inline: 0 !important;
    padding: 0.875rem 3.25rem 0.875rem 1.125rem;
    color: #fff;
    background:
        radial-gradient(circle at 92% -35%, rgba(34, 112, 166, 0.38) 0 36%, transparent 37%),
        linear-gradient(135deg, var(--ms-navy-950), var(--ms-navy-900));
    box-shadow: inset 0.25rem 0 0 var(--ms-teal-500);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.35;
}

.ms-related-accounts article.ms-account-card > .ms-account-edit {
    box-sizing: border-box;
    position: absolute !important;
    z-index: 1;
    top: 0.5rem !important;
    right: 0.875rem !important;
    bottom: auto !important;
    left: auto !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0.0625rem solid rgba(255, 255, 255, 0.25);
    border-radius: 0.5rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.ms-related-accounts article.ms-account-card > .ms-account-edit:hover,
.ms-related-accounts article.ms-account-card > .ms-account-edit:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-0.0625rem);
}

.ms-related-accounts article.ms-account-card > .ms-account-edit:focus-visible {
    outline: 0.125rem solid var(--ms-teal-500);
    outline-offset: 0.125rem;
}

.ms-related-accounts article.ms-account-card > .ms-account-edit svg {
    width: 1rem;
    height: 1rem;
    fill: currentColor;
}

.ms-related-accounts .ms-account-card h2 a {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ms-related-accounts .ms-account-card h2 a:hover,
.ms-related-accounts .ms-account-card h2 a:focus {
    text-decoration: underline;
    text-decoration-color: var(--ms-teal-500);
    text-underline-offset: 0.2em;
}

.ms-account-card .ms-guidance-table {
    flex: 0 0 auto;
    width: calc(100% - 2rem);
    margin-right: 1rem;
    margin-left: 1rem;
}

.ms-guidance-result::before {
    display: inline-block;
    margin-right: 0.35rem;
    font-size: 0.9em;
}

.ms-guidance-result.Increase,
.ms-guidance-result.ms-guidance-increase {
    color: var(--ms-success) !important;
    background: var(--ms-success-soft) !important;
}

.ms-guidance-result.Increase::before,
.ms-guidance-result.ms-guidance-increase::before {
    content: "\2191";
}

.ms-guidance-result.Decrease,
.ms-guidance-result.Closed,
.ms-guidance-result.ms-guidance-decrease,
.ms-guidance-result.ms-guidance-closed {
    color: var(--ms-danger) !important;
    background: var(--ms-danger-soft) !important;
}

.ms-guidance-result.Decrease::before,
.ms-guidance-result.ms-guidance-decrease::before {
    content: "\2193";
}

.ms-guidance-result.Stay,
.ms-guidance-result.ms-guidance-stay {
    color: var(--ms-warning) !important;
    background: var(--ms-warning-soft) !important;
}

.ms-guidance-result.Stay::before,
.ms-guidance-result.Closed::before,
.ms-guidance-result.ms-guidance-stay::before,
.ms-guidance-result.ms-guidance-closed::before {
    content: "\2014";
}

.ms-account-mini-chart {
    box-sizing: border-box;
    flex: 0 0 3.75rem;
    width: calc(100% - 2rem);
    height: 3.75rem;
    margin: 0 1rem;
    padding: 0.35rem 0 0.2rem;
    background: #fff;
    border-top: 0.0625rem solid var(--ms-line);
}

.ms-account-mini-chart svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    shape-rendering: crispEdges;
}

.ms-account-mini-chart-grid {
    stroke: rgba(18, 59, 99, 0.09);
    stroke-width: 1;
}

.ms-account-mini-chart-baseline {
    stroke: rgba(18, 59, 99, 0.22);
    stroke-width: 1;
}

.ms-account-mini-chart-empty {
    fill: rgba(18, 59, 99, 0.12);
}

.ms-account-mini-chart-base {
    fill: var(--ms-navy-800);
}

.ms-account-mini-chart-over {
    fill: #df6b70;
}

.ms-account-users {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 2.5rem;
    margin-top: 0;
    padding: 0.45rem 1.125rem 0.65rem;
    color: var(--ms-ink);
    border-top: 0;
    font-size: 0.8125rem;
    line-height: 1.4;
    opacity: 0.56;
}

.ms-account-users h3 {
    margin: 0 0 0.375rem;
    font-size: inherit;
}

.ms-account-users ul {
    margin: 0;
    padding-left: 1.125rem;
}

.ms-account-users li + li {
    margin-top: 0.2rem;
}

.ms-account-users .ms-empty {
    margin: 0;
    color: inherit;
}

.ms-account-total-card {
    display: block;
    padding: 1rem;
}

.ms-account-total-card .ms-guidance-table {
    width: 100%;
    margin-right: 0;
    margin-left: 0;
}

.ms-portfolio-heatmaps {
    margin-top: 1.5rem;
}

.ms-portfolio-heatmap + .ms-portfolio-heatmap {
    margin-top: 1.25rem;
}

.ms-portfolio-heatmap h3 {
    margin: 0 0 0.625rem;
}

.ms-portfolio-heatmap-compact {
    width: 25%;
}

.ms-portfolio-heatmap table {
    width: 100%;
    overflow: hidden;
    border-collapse: collapse;
    table-layout: fixed;
    background: var(--ms-panel);
    border-radius: 0.625rem;
    box-shadow: 0 0.375rem 1.25rem rgba(6, 26, 51, 0.05);
}

.ms-portfolio-heatmap th,
.ms-portfolio-heatmap td {
    width: auto;
    border: 0.0625rem solid var(--ms-line);
    padding: 0.625rem 0.375rem;
    text-align: center;
    vertical-align: middle;
    font-size: 0.75rem;
    font-weight: 500;
}

.ms-portfolio-heatmap th {
    color: var(--ms-navy-900);
    background: #edf3f7;
    font-weight: 700;
}

@media (max-width: 45rem) {
    .ms-portfolio-heatmap-compact {
        width: 100%;
    }
}

.ms-report {
    box-sizing: border-box;
    max-width: 100rem;
    margin: 0 auto;
    padding: 1.5rem;
}

.ms-report > h1 {
    margin: 0 0 1.25rem;
    padding: 1.125rem 1.5rem;
    color: #fff;
    background:
        radial-gradient(circle at 90% -100%, rgba(35, 115, 171, 0.42) 0 42%, transparent 43%),
        linear-gradient(135deg, var(--ms-navy-950), var(--ms-navy-900));
    border-left: 0.3rem solid var(--ms-teal-500);
    border-radius: 0.75rem;
    box-shadow: 0 0.625rem 1.75rem rgba(6, 26, 51, 0.12);
    font-family: inherit;
    font-size: clamp(1.25rem, 2vw, 1.6rem);
    font-weight: 700;
    line-height: 1.3;
}

.ms-table {
    width: 100%;
    margin-bottom: 1.75rem;
    border-collapse: collapse;
    table-layout: fixed;
    color: var(--ms-ink);
    background: var(--ms-panel);
    box-shadow: 0 0.375rem 1.25rem rgba(6, 26, 51, 0.055);
    font-size: 0.8125rem;
    line-height: 1.25;
}

.ms-report-section {
    box-sizing: border-box;
    margin: 2rem 0;
    padding: 1rem;
    overflow: hidden;
    background: var(--ms-panel);
    border: 0.0625rem solid var(--ms-line);
    border-radius: 0.75rem;
    box-shadow: 0 0.5rem 1.5rem rgba(6, 26, 51, 0.07);
}

.ms-report-section .ms-table {
    margin-bottom: 0;
    box-shadow: none;
}

.ms-table th,
.ms-table td {
    position: relative;
    height: 1.75rem;
    border: 0.0625rem solid var(--ms-line);
    padding: 0.375rem 0.4375rem;
    text-align: right;
    vertical-align: middle;
    white-space: nowrap;
}

.ms-table th {
    color: var(--ms-navy-900);
    background: #edf3f7;
    font-weight: 700;
}

/* Keep this width paired with .ms-chart-wrap so all 12 month columns align. */
.ms-table .label-col {
    width: 13.75rem;
    text-align: left;
}

.ms-table td.label-col {
    color: var(--ms-ink);
    background: #f7f9fb;
    font-weight: 500;
}

.ms-negative {
    color: var(--ms-danger) !important;
}

.ms-section-title {
    margin: 0 0 0.75rem;
    padding: 0;
    color: var(--ms-navy-900);
    font-family: inherit;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
}

.ms-add-data {
    display: inline-block;
    margin-bottom: 1.25rem;
    padding: 0.55rem 0.9rem;
    color: #fff;
    background: var(--ms-navy-900);
    border-radius: 0.4rem;
    font-size: 0.8125rem;
    font-weight: 650;
    text-decoration: none;
}

.ms-add-data:hover,
.ms-add-data:focus {
    color: #fff;
    background: var(--ms-navy-800);
}

/*
 * Preserve the production table/chart geometry exactly: the chart begins after
 * the 13.75rem label column plus its existing padding and border allowance.
 */
.ms-chart-wrap {
    width: calc(100% - 14.375rem);
    margin-left: 14.375rem;
    height: 16.25rem;
    margin-bottom: 2.125rem;
    margin-right: 0.625rem;
    background: var(--ms-panel);
    border-top: 0.0625rem solid var(--ms-line);
    border-bottom: 0.0625rem solid var(--ms-line);
}

.ms-plan-section .ms-chart-wrap {
    margin-bottom: 0;
}

#msChart {
    width: 100%;
    height: 16.25rem;
}

.ms-heat-cell {
    color: var(--ms-ink);
}

.ms-empty {
    color: var(--ms-muted);
}

.ms-table td.dollar::before {
    content: "$";
    position: absolute;
    left: 0.5rem;
    color: inherit;
    opacity: 0.72;
}

@media (max-width: 70rem) {
    .ms-account-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ms-summary-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 45rem) {
    .ms-account-card-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .ms-report {
        padding: 1rem;
        overflow-x: auto;
    }

    .ms-report > h1 {
        padding: 1rem 1.125rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ms-account-edit {
        transition: none;
    }
}
