.kpi-framework-intro {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

.report-query-section,
.report-missing-section {
    margin-top: 24px;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

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

.report-query-group + .report-query-group {
    margin-top: 18px;
}

.report-query-group-usage .report-query-card {
    border-left: 3px solid #bfdbfe;
}

.report-query-group-risk .report-query-group-title {
    color: #7c2d12;
}

.report-query-group-risk .report-query-card {
    border-left: 3px solid #bfdbfe;
}

.report-query-group-title {
    margin: 0 0 10px;
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--text-primary);
}

.report-query-card {
    margin: 0;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
}

.report-query-card.query-card-catalog-trigger {
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.report-query-card.query-card-catalog-trigger:hover {
    border-color: #bfdbfe;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.report-query-card.query-card-catalog-trigger:focus-visible {
    outline: 2px solid #0077C5;
    outline-offset: 2px;
}

.report-query-card h4 {
    margin: 0 0 8px;
    font-size: 1rem;
    line-height: 1.35;
}

.query-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.query-card-heading h4 {
    margin: 0;
}

.query-status-badge-inline {
    min-width: 0;
    flex-shrink: 0;
}

.report-query-card p {
    line-height: 1.5;
}

.report-query-card.cohort-heatmap-card {
    grid-column: 1 / -1;
}

.cohort-heatmap-list {
    display: grid;
    gap: 14px;
}

.cohort-heatmap-group {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
    background: #ffffff;
}

.cohort-heatmap-title {
    margin: 0;
    padding: 8px 4px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    list-style: none;
}

.cohort-heatmap-title::-webkit-details-marker {
    display: none;
}

.cohort-heatmap-title::before {
    content: '\25B6';
    display: inline-block;
    margin-right: 6px;
    font-size: 0.7em;
    transition: transform 0.15s ease;
}

details.cohort-heatmap-group[open] > .cohort-heatmap-title::before {
    transform: rotate(90deg);
}

.cohort-heatmap-wrapper {
    width: 100%;
    max-height: none;
}

.cohort-heatmap-table {
    width: 100%;
    min-width: 100%;
    table-layout: fixed;
}

.cohort-heatmap-table col.cohort-col {
    width: 170px;
}

.cohort-heatmap-table col.users-col {
    width: 92px;
}

.cohort-heatmap-table col.week-col {
    width: auto;
}

.cohort-heatmap-table td.cohort-heatmap-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
    padding: 2px;
}

.cohort-heatmap-chip {
    display: block;
    border-radius: 0;
    padding: 7px 8px;
    color: #0f172a;
    font-weight: 450;
}

.cohort-heatmap-table td.cohort-heatmap-cell.is-zero {
    color: #64748b;
    padding: 8px;
}

.result-meta {
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin-bottom: 10px;
}

.report-query-card .muted {
    color: var(--text-secondary);
    margin: 6px 0;
}

.report-query-card .missing,
.report-missing-section li {
    color: #f8b4b4;
}

.report-missing-section ul {
    margin: 10px 0 0;
    padding-left: 20px;
}

.kpi-framework-intro h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #0f172a;
}

.kpi-framework-intro p {
    margin: 10px 0 0;
    color: #475569;
}

.north-star-section {
    margin-bottom: 20px;
}

.north-star-section h3 {
    margin: 0;
    font-size: 1rem;
    color: #0f172a;
}

.north-star-supporting {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}

.north-star-supporting ul {
    margin: 8px 0 0;
    padding-left: 1.15rem;
    color: #334155;
}

.north-star-supporting li {
    margin: 4px 0;
}

.north-star-source {
    margin-top: 10px;
    font-size: 0.84rem;
    color: #64748b;
}

.report-tiles-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.kpi-framework-explorer {
    display: grid;
    grid-template-columns: minmax(250px, 280px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.report-navigator-card {
    position: sticky;
    top: 20px;
}

.report-navigator-list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.navigator-group-title {
    margin: 14px 0 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.report-navigator-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.report-navigator-list a {
    color: #1e3a8a;
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.35;
}

.report-navigator-list a:hover {
    text-decoration: underline;
}

.report-section-stack {
    display: grid;
    gap: 16px;
}

.report-section {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

.report-section h2 {
    margin: 0 0 14px;
    font-size: 1.05rem;
    color: #0f172a;
}

.docs-nav-list li {
    justify-content: flex-start;
}

.docs-nav-list a {
    color: #0f172a;
}

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

.docs-tile {
    min-height: 200px;
}

.report-tile {
    background: #ffffff;
    border: 1px solid #dbe4ee;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 230px;
}

.report-tile h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1rem;
}

.report-tile p {
    margin: 0;
    color: #475569;
    font-size: 0.92rem;
    line-height: 1.45;
}

.report-tile .btn {
    margin-top: auto;
    align-self: flex-start;
}

.report-tile.is-disabled {
    border-style: dashed;
    background: #f8fafc;
}

.report-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    width: fit-content;
}

.report-status.phase1 {
    background: #dcfce7;
    color: #166534;
}

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

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

.report-layout > * {
    min-width: 0;
}

.report-query-section .table-container {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.report-query-section .result-table th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.result-table th[data-sortable-header="true"] {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
    box-sizing: border-box;
    padding-right: 2.05rem;
}

.result-table th[data-sortable-header="true"]::after {
    content: "↕";
    position: absolute;
    right: .6rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: .68rem;
    color: #64748b;
    opacity: .9;
    line-height: 1;
    pointer-events: none;
}

.result-table th[data-sortable-header="true"].is-sorted-asc::after {
    content: "↑";
    color: #0f766e;
}

.result-table th[data-sortable-header="true"].is-sorted-desc::after {
    content: "↓";
    color: #0f766e;
}

.report-query-section .result-table td,
.report-query-section .result-table th {
    padding: 10px 12px;
}

.report-query-section .result-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.report-query-section .result-table--wide,
.report-documentation-section .result-table--wide {
    font-size: 0.82rem;
}

.report-query-section .result-table--wide td,
.report-query-section .result-table--wide th,
.report-documentation-section .result-table--wide td,
.report-documentation-section .result-table--wide th {
    padding: 8px 10px;
    white-space: nowrap;
}

.report-query-section .result-table--wide thead th:first-child,
.report-documentation-section .result-table--wide thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #f8fafc;
    box-shadow: 1px 0 0 #e2e8f0;
}

.report-query-section .result-table--wide tbody td:first-child,
.report-documentation-section .result-table--wide tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #ffffff;
    box-shadow: 1px 0 0 #e2e8f0;
}

.report-query-section .result-table--wide tbody tr:nth-child(even) td:first-child,
.report-documentation-section .result-table--wide tbody tr:nth-child(even) td:first-child {
    background: #f8fafc;
}

.report-assumptions-section {
    margin-top: 24px;
    padding: 20px;
    border: 1px solid #fde68a;
    border-radius: var(--radius-lg);
    background: #fffbeb;
}

.report-query-status-section {
    margin-top: 0;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

.report-query-status-section h3 {
    margin: 0 0 10px;
    font-size: 1rem;
    color: #0f172a;
}

.report-query-status-section .table-container {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.report-query-status-section .result-table td,
.report-query-status-section .result-table th {
    padding: 10px 12px;
    vertical-align: top;
}

.report-query-status-section .result-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.query-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 86px;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.query-status-badge.canonical {
    background: #dcfce7;
    color: #166534;
}

.query-status-badge.proxy {
    background: #fef3c7;
    color: #92400e;
}

.query-status-badge.blocked {
    background: #fee2e2;
    color: #991b1b;
}

.report-assumptions-section h3 {
    margin: 0 0 10px;
    font-size: 1rem;
    color: #92400e;
}

.report-assumptions-section ul {
    margin: 0;
    padding-left: 1.15rem;
    color: #78350f;
}

.report-assumptions-section li {
    margin: 5px 0;
    line-height: 1.45;
    font-size: 0.9rem;
}

.kql-source-details {
    margin-top: 12px;
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
}

.kql-source-details summary {
    cursor: pointer;
    font-size: 0.82rem;
    color: #64748b;
    -webkit-user-select: none;
    user-select: none;
}

.kql-source-details summary:hover {
    color: #0077C5;
}

.kql-source {
    margin: 8px 0 0;
    padding: 12px;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 8px;
    font-size: 0.78rem;
    line-height: 1.55;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.kpi-breadcrumb-back .label-short {
    display: none;
}

.cost-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.cost-hero-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cost-parity-legend {
    width: 100%;
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
}

.cost-note-block {
    width: 100%;
    margin: 0.5rem 0 0;
    padding: 0.55rem 0.7rem;
    border: 1px solid #c7d2fe;
    border-left: 4px solid #4f46e5;
    border-radius: 8px;
    background: #eef2ff;
    color: #1e293b;
    font-size: 0.78rem;
    line-height: 1.5;
}

.cost-pill {
    border: 1px solid var(--hub-border, #d6dee9);
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    color: var(--hub-text-muted, #64748b);
    background: var(--hub-surface-soft, #f4f7fb);
}

.cost-pill-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.cost-pill-link:hover,
.cost-pill-link:focus-visible {
    text-decoration: none;
    filter: brightness(0.98);
}

#cost-reporting-report-content > .report-documentation-section + .report-documentation-section {
    margin-top: 2.5rem;
}

#cost-reporting-report-content {
    max-width: 100%;
    min-width: 0;
}

#cost-reporting-report-content .report-documentation-section {
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: visible;
}

#cost-reporting-report-content > .report-documentation-section:first-child {
    position: relative;
    z-index: 1500;
}

#cost-reporting-report-content .table-container {
    max-width: 100%;
    overflow-x: auto;
}

#cost-reporting-report-content .table-wrapper {
    min-width: max-content;
}

#cost-reporting-report-content .cost-report-tabs {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    align-items: flex-end;
    align-content: flex-end;
    border-bottom: 1px solid #d7e2ee;
    padding-bottom: 0.35rem;
    min-width: 0;
}

#cost-reporting-report-content .cost-report-header-bar {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    align-items: end;
    column-gap: 0.75rem;
    row-gap: 0.45rem;
}

#cost-reporting-report-content .cost-report-header-bar.has-toolbar-actions {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(320px, max-content);
}

#cost-reporting-artifact-panel .cost-report-header-actions {
    display: inline-grid;
    grid-template-columns: max-content max-content;
    grid-template-areas:
        "refresh reprocess"
        "status status";
    align-items: center;
    justify-content: end;
    justify-self: end;
    gap: 0.5rem;
    min-width: max-content;
}

#cost-reporting-artifact-panel .cost-report-header-actions .btn-toggle-queries {
    white-space: nowrap;
}

#cost-reporting-artifact-panel #retrieve-sharepoint-zips {
    grid-area: refresh;
}

#cost-reporting-artifact-panel #reprocess-sharepoint-zips {
    grid-area: reprocess;
}

#cost-reporting-artifact-panel .cost-report-header-actions #cost-reporting-refresh-status {
    grid-area: status;
    grid-column: 1 / -1;
    margin-left: 0;
    margin-top: 0.1rem;
    justify-self: end;
    text-align: right;
    white-space: nowrap;
    max-width: none;
}

#cost-reporting-report-content .cost-report-control-bar {
    display: block;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    position: relative;
    top: auto;
    z-index: auto;
    overflow: visible;
    border: 1px solid #d7e2ee;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(6px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

:is(#cost-reporting-report-content, #trial-credit-packaging-panel, #competitive-analysis-panel, #cost-duration-drivers-panel) .cost-report-control-bar {
    display: block;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

:is(#cost-reporting-report-content, #trial-credit-packaging-panel, #competitive-analysis-panel, #cost-duration-drivers-panel) .cost-report-header-bar {
    width: 100%;
}

#cost-reporting-report-content .cost-report-period-wrap {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: nowrap;
    justify-content: flex-start;
    position: relative;
    z-index: 1;
    overflow: visible;
    padding: 0.22rem 0.4rem;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    border-radius: 10px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

:is(#cost-reporting-report-content, #trial-credit-packaging-panel, #competitive-analysis-panel, #cost-duration-drivers-panel) .cost-report-period-wrap {
    width: 100%;
    max-width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow: visible;
}

#cost-reporting-report-content .cost-report-header-bar,
#cost-reporting-report-content .cost-period-combobox,
#trial-credit-packaging-panel .cost-report-header-bar,
#trial-credit-packaging-panel .cost-report-period-wrap,
#trial-credit-packaging-panel .cost-period-combobox {
    overflow: visible;
}

#cost-reporting-report-content .cost-report-period-label {
    color: #1e3a8a;
    font-size: 0.78rem;
    font-weight: 700;
}

#cost-reporting-report-content .cost-report-scope-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid #bfdbfe;
    background: #dbeafe;
    color: #1e3a8a;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.25rem 0.5rem;
    white-space: nowrap;
}

#cost-reporting-report-content .cost-report-period-select {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    font-weight: 600;
    padding: 0.35rem 0.55rem;
    min-width: 8.3rem;
}

#cost-reporting-report-content .cost-report-period-select:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

#cost-reporting-report-content .cost-report-header-bar > .cost-report-tabs {
    justify-self: stretch;
    min-width: 0;
}

#cost-reporting-report-content .cost-report-tab {
    appearance: none;
    border: 1px solid transparent;
    border-bottom: none;
    background: #edf3fa;
    color: #334155;
    border-radius: 10px 10px 0 0;
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

#cost-reporting-report-content .cost-period-combobox {
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

#cost-reporting-report-content .cost-report-period-wrap .cost-period-combobox,
#cost-reporting-report-content .cost-report-period-wrap .cost-report-period-select,
#cost-reporting-report-content .cost-report-period-wrap .cost-report-period-label,
#cost-reporting-report-content .cost-report-period-wrap .cost-report-scope-badge {
    flex: 0 0 auto;
}

#trial-credit-packaging-panel .cost-report-header-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
}

#trial-credit-packaging-panel .cost-report-period-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    padding: 0.22rem 0.4rem;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    border-radius: 10px;
}

#trial-credit-packaging-panel .cost-report-period-label {
    color: #1e3a8a;
    font-size: 0.78rem;
    font-weight: 700;
}

#trial-credit-packaging-panel .cost-report-scope-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid #bfdbfe;
    background: #dbeafe;
    color: #1e3a8a;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.25rem 0.5rem;
}

#trial-credit-packaging-panel .cost-period-combobox {
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

@media (max-width: 820px) {
    #cost-reporting-report-content .cost-report-header-bar {
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
    }

    #cost-reporting-report-content .cost-report-header-bar.has-toolbar-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    #cost-reporting-report-content .cost-report-period-wrap {
        width: 100%;
        justify-content: space-between;
        flex-wrap: nowrap;
    }

    #cost-reporting-report-content .cost-report-tabs {
        width: 100%;
        justify-content: flex-start;
    }

    #cost-reporting-artifact-panel .cost-report-header-actions {
        width: 100%;
        justify-self: start;
        justify-content: start;
        min-width: 0;
    }

    #cost-reporting-artifact-panel .cost-report-header-actions #cost-reporting-refresh-status {
        justify-self: start;
        text-align: left;
        max-width: none;
    }
}

#cost-reporting-report-content .cost-report-tab:hover {
    background: #e3edf8;
    color: #0f172a;
}

#cost-reporting-report-content .cost-report-tab:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

#cost-reporting-report-content .cost-report-tab.is-active,
#cost-reporting-report-content .cost-report-tab[aria-selected="true"] {
    background: #ffffff;
    color: #0f172a;
    border-color: #d7e2ee;
    position: relative;
    top: 1px;
}

#cost-reporting-report-content .cost-report-tab-panel {
    position: relative;
    z-index: 1;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

#cost-reporting-report-content .cost-report-control-bar + .cost-report-tab-panel {
    margin-top: 0.85rem;
}

#cost-reporting-report-content #cost-report-panel-rollup > .report-documentation-section:first-child {
    margin-top: 0.25rem;
}

#cost-reporting-report-content .cost-report-tab-panel .report-documentation-section {
    max-width: 100%;
    min-width: 0;
}

#cost-reporting-report-content .cost-report-tab-panel .table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#cost-reporting-report-content .cost-report-tab-panel .result-table td,
#cost-reporting-report-content .cost-report-tab-panel .result-table th {
    overflow-wrap: anywhere;
    word-break: break-word;
}

#cost-reporting-report-content .cost-report-tab-panel .result-table .cost-models-col {
    width: 12rem;
    max-width: 12rem;
    min-width: 9rem;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

#cost-reporting-report-content .cost-report-tab-panel .result-table .cost-error-category-col {
    width: 10rem;
    max-width: 10rem;
    min-width: 8rem;
    white-space: normal;
}

#cost-reporting-report-content .cost-report-tab-panel .result-table .cost-error-category-col .cost-pill {
    display: inline-block;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* ── Canonical grouped-header styling (result-table--grouped) ── */
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead th {
    text-align: center;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead th[rowspan] {
    text-align: left;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped tbody td {
    text-align: center;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped tbody td:first-child {
    text-align: left;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead th.cost-core-runs-col,
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead th.cost-core-models-col,
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead th.cost-core-total-calls-col,
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped tbody td.cost-core-runs-col,
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped tbody td.cost-core-models-col,
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped tbody td.cost-core-total-calls-col {
    text-align: center;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead th.cost-core-runs-col[data-sortable-header="true"],
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead th.cost-core-grade-col[data-sortable-header="true"] {
    min-width: 6.25rem;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead th.cost-core-latest-date-col[data-sortable-header="true"],
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead th.cost-core-latest-date-col[data-canon-sortable="true"] {
    min-width: 8.5rem;
    padding-right: 2.45rem;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped tbody td.cost-core-latest-date-col {
    min-width: 8.5rem;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead tr:first-child th[colspan] {
    text-align: center;
    padding-left: 0;
    padding-right: 0;
    border-radius: 8px;
    border: 1px solid #b6c9e7;
    box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.06);
}

/* Group color palette — gradient for primary headers */
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead tr:first-child th[data-group="blue"]   { background: linear-gradient(180deg, #dce9ff 0%, #b8d0ff 100%) !important; }
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead tr:first-child th[data-group="cyan"]   { background: linear-gradient(180deg, #def6ff 0%, #bfe8ff 100%) !important; }
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead tr:first-child th[data-group="mint"]   { background: linear-gradient(180deg, #ddfff2 0%, #baf1da 100%) !important; }
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead tr:first-child th[data-group="peach"]  { background: linear-gradient(180deg, #fff0e8 0%, #ffd3be 100%) !important; }
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead tr:first-child th[data-group="yellow"] { background: linear-gradient(180deg, #fff7e5 0%, #ffe5a8 100%) !important; }
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead tr:first-child th[data-group="purple"] { background: linear-gradient(180deg, #ede9fe 0%, #c4b5fd 100%) !important; }
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead tr:first-child th[data-group="slate"]  { background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%) !important; }
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead tr:first-child th[data-group="green"]  { background: linear-gradient(180deg, #d1fae5 0%, #6ee7b7 100%) !important; }

/* Group color palette — flat tint for sub-headers */
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead tr:not(:first-child) th[data-group="blue"]   { background: #d6e6ff !important; }
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead tr:not(:first-child) th[data-group="cyan"]   { background: #d9f1ff !important; }
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead tr:not(:first-child) th[data-group="mint"]   { background: #d9fbe9 !important; }
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead tr:not(:first-child) th[data-group="peach"]  { background: #ffe7d9 !important; }
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead tr:not(:first-child) th[data-group="yellow"] { background: #fff1c9 !important; }
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead tr:not(:first-child) th[data-group="purple"] { background: #ede5ff !important; }
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead tr:not(:first-child) th[data-group="slate"]  { background: #e8ecf0 !important; }
:is(#cost-reporting-report-content, #competitive-analysis-panel) .result-table--grouped thead tr:not(:first-child) th[data-group="green"]  { background: #a7f3d0 !important; }

/* Sub-agent model table: center-align overrides */
#cost-reporting-report-content .cost-report-tab-panel .result-table--subagent-model tbody td { text-align: center; }
#cost-reporting-report-content .cost-report-tab-panel .result-table--subagent-model thead th { text-align: center; }
#cost-reporting-report-content .cost-report-tab-panel .result-table--subagent-model thead tr:first-child th:nth-child(2),
#cost-reporting-report-content .cost-report-tab-panel .result-table--subagent-model thead tr:first-child th:nth-child(11) { text-align: left; }
#cost-reporting-report-content .cost-report-tab-panel .result-table--subagent-model tbody td:nth-child(2),
#cost-reporting-report-content .cost-report-tab-panel .result-table--subagent-model tbody td:nth-child(16) { text-align: left; }

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-dropdown {
    margin: 0 0 .75rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border: 1px solid var(--border-color, #d7dee8);
    border-radius: 10px;
    background: var(--bg-secondary, #f8fafc);
    overflow: hidden;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-dropdown > summary {
    cursor: pointer;
    padding: .5rem .7rem;
    font-size: .82rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    list-style: none;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-dropdown > summary::-webkit-details-marker {
    display: none;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 250px));
    gap: .55rem;
    padding: .55rem .7rem .75rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    justify-content: start;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-button {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    border-radius: 8px;
    padding: .35rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    align-items: stretch;
    text-align: left;
    cursor: pointer;
    width: 100%;
    max-width: min(100%, 250px);
    flex: 0 0 220px;
    min-width: 0;
    overflow: hidden;
    transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-button:hover {
    border-color: #60a5fa;
    box-shadow: 0 4px 12px rgba(2, 6, 23, .08);
    transform: translateY(-1px);
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-button:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-button--blackout {
    border-color: #dc2626;
    box-shadow: inset 0 0 0 1px rgba(220, 38, 38, .45), 0 6px 16px rgba(127, 29, 29, .18);
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-button--blackout:hover {
    border-color: #b91c1c;
    box-shadow: inset 0 0 0 1px rgba(220, 38, 38, .55), 0 8px 18px rgba(127, 29, 29, .24);
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 10;
    max-height: 160px;
    border-radius: 6px;
    background: #e2e8f0;
    overflow: hidden;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-image {
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    object-fit: contain;
    object-position: center center;
    background: transparent;
    opacity: 0;
    transition: opacity .25s ease;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-image.is-loaded {
    opacity: 1;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-media::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 6px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: cost-thumb-shimmer 1.4s ease-in-out infinite;
    z-index: 1;
    pointer-events: none;
    transition: opacity .25s ease;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-media.is-loaded::before {
    opacity: 0;
}

@keyframes cost-thumb-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-trend {
    position: absolute;
    top: .45rem;
    right: .45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.25rem;
    padding: .1rem .45rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .01em;
    line-height: 1;
    background: rgba(15, 23, 42, .9);
    color: #ffffff;
    pointer-events: none;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-trend--improved {
    background: rgba(22, 101, 52, .92);
    border-color: rgba(187, 247, 208, .75);
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-trend--regressed {
    background: rgba(153, 27, 27, .92);
    border-color: rgba(254, 202, 202, .78);
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-trend--stable {
    background: rgba(30, 64, 175, .92);
    border-color: rgba(191, 219, 254, .78);
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-blackout-indicator {
    position: absolute;
    top: .45rem;
    left: .45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.25rem;
    padding: .1rem .45rem;
    border-radius: 999px;
    border: 1px solid rgba(254, 202, 202, .9);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .01em;
    line-height: 1;
    color: #ffffff;
    background: rgba(127, 29, 29, .95);
    pointer-events: none;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-caption-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: .35rem;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.2rem;
    min-width: 1.2rem;
    padding: 0 .35rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, .6);
    font-size: .64rem;
    font-weight: 700;
    line-height: 1;
    color: #334155;
    background: #f8fafc;
    flex: 0 0 auto;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-ref-list {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .2rem;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-ref-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.15rem;
    min-width: 1.15rem;
    padding: 0 .35rem;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    font-size: .64rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-ref-pill--more {
    color: #0f4ba8;
    border-color: #bfdbfe;
    background: #eff6ff;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-ref-none {
    color: #64748b;
    font-size: .72rem;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-caption {
    font-size: .72rem;
    color: var(--text-secondary, #475569);
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    flex: 1 1 auto;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(2, 6, 23, .62);
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal[hidden] {
    display: none;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-surface {
    width: min(1120px, 96vw);
    max-height: 94vh;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #dbe4ee;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .6rem;
    padding: .65rem .85rem;
    border-bottom: 1px solid #e2e8f0;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-title {
    margin: 0;
    font-size: .9rem;
    color: var(--text-primary, #0f172a);
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    flex: 1 1 14rem;
    min-width: 0;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-close {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: .9rem;
    font-weight: 700;
    width: 32px;
    height: 32px;
    cursor: pointer;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-close:hover {
    background: #eef2f7;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-close:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-body {
    padding: .75rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    min-height: 0;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-image-switch {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-image-switch-button {
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.2;
    padding: .3rem .62rem;
    cursor: pointer;
    transition: border-color .14s ease, background-color .14s ease, color .14s ease;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-image-switch-button:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-image-switch-button:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-image-switch-button.is-active {
    border-color: #2563eb;
    background: #dbeafe;
    color: #0f3a8a;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-image-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    height: clamp(260px, 62vh, 680px);
    max-height: calc(94vh - 192px);
    border-radius: 8px;
    background: #0f172a;
    padding: .25rem;
    touch-action: none;
    cursor: default;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-image-wrap .cost-xaml-modal-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2rem;
    height: 2rem;
    margin: -1rem 0 0 -1rem;
    border: 3px solid rgba(255, 255, 255, .15);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: cost-modal-spin .7s linear infinite;
    pointer-events: none;
    z-index: 2;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-image-wrap .cost-xaml-modal-spinner.is-hidden {
    display: none;
}

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

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-image {
    width: auto;
    max-width: 100%;
    max-height: 100%;
    height: auto;
    border-radius: 8px;
    background: #0f172a;
    object-fit: contain;
    object-position: center center;
    margin: 0;
    transform-origin: center center;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    will-change: transform;
}

#competitive-analysis-panel .cost-xaml-modal-surface {
    width: min(1240px, 98vw);
    max-height: 95vh;
}

#competitive-analysis-panel .cost-xaml-modal-image-wrap {
    height: clamp(320px, 70vh, 760px);
    max-height: calc(95vh - 188px);
    background: #e2e8f0;
}

#competitive-analysis-panel .cost-xaml-modal-image {
    background: #e2e8f0;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-image-wrap.is-zoomed {
    cursor: grab;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-image-wrap.is-panning {
    cursor: grabbing;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-caption {
    font-size: .78rem;
    color: var(--text-secondary, #475569);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .7rem;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-zoom-controls {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-zoom-button {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: .76rem;
    font-weight: 700;
    line-height: 1.2;
    min-height: 28px;
    min-width: 28px;
    padding: .25rem .45rem;
    cursor: pointer;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-zoom-button:hover {
    background: #eef2f7;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-zoom-button:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-zoom-button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-zoom-button--reset {
    min-width: 56px;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-zoom-level {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    min-width: 52px;
    padding: .2rem .45rem;
    border: 1px solid #dbe4ee;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    font-size: .74rem;
    font-weight: 700;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-zip-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    width: fit-content;
    font-size: .78rem;
    font-weight: 600;
    color: #0f4ba8;
    text-decoration: none;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-zip-link:hover {
    text-decoration: underline;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-copy-button {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: .76rem;
    font-weight: 600;
    line-height: 1.2;
    padding: .35rem .62rem;
    cursor: pointer;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-copy-button:hover {
    background: #eef2f7;
}

:is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-copy-button:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

@media (max-width: 900px) {
    :is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 220px));
    }

    :is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-button {
        max-width: 220px;
        flex-basis: 220px;
    }

    :is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-image-wrap {
        height: clamp(240px, 58vh, 580px);
    }
}

@media (max-width: 640px) {
    :is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-grid {
        grid-template-columns: minmax(min(150px, 100%), 220px);
        justify-content: center;
    }

    :is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-thumb-button {
        max-width: 220px;
        flex-basis: 220px;
    }

    :is(#cost-reporting-report-content, #competitive-analysis-panel) .cost-xaml-modal-image-wrap {
        height: clamp(220px, 52vh, 460px);
    }
}

#cost-reporting-report-content #cost-report-panel-trial-packaging {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

#cost-reporting-report-content #cost-report-panel-trial-packaging #trial-credit-packaging-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

#cost-reporting-report-content #cost-report-panel-trial-packaging #trial-credit-packaging-panel .table-container {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
}

#cost-reporting-report-content #cost-report-panel-trial-packaging #trial-credit-packaging-panel .table-wrapper {
    width: 100%;
    min-width: 0;
}

#cost-reporting-report-content #cost-report-panel-trial-packaging #trial-credit-packaging-panel .result-table th,
#cost-reporting-report-content #cost-report-panel-trial-packaging #trial-credit-packaging-panel .result-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.cost-pill-status {
    font-weight: 600;
}

.cost-pill-status--ok {
    color: #065f46;
    border-color: #10b981;
    background: #ecfdf5;
}

.cost-pill-status--warn {
    color: #92400e;
    border-color: #f59e0b;
    background: #fffbeb;
}

.cost-pill-status--critical {
    color: #991b1b;
    border-color: #ef4444;
    background: #fef2f2;
}

.cost-confidence-pill--high {
    color: #065f46;
    border-color: #10b981;
    background: #ecfdf5;
}

.cost-confidence-pill--medium {
    color: #92400e;
    border-color: #f59e0b;
    background: #fffbeb;
}

.cost-confidence-pill--low {
    color: #991b1b;
    border-color: #ef4444;
    background: #fef2f2;
}

.cost-error-pill--timeout {
    color: #9a3412;
    border-color: #fb923c;
    background: #fff7ed;
}

.cost-error-pill--network {
    color: #0c4a6e;
    border-color: #38bdf8;
    background: #f0f9ff;
}

.cost-error-pill--auth {
    color: #92400e;
    border-color: #f59e0b;
    background: #fffbeb;
}

.cost-error-pill--runtime {
    color: #991b1b;
    border-color: #ef4444;
    background: #fef2f2;
}

.cost-error-pill--other {
    color: #334155;
    border-color: #94a3b8;
    background: #f8fafc;
}

.cost-error-pill--default {
    color: #374151;
    border-color: #d1d5db;
    background: #f9fafb;
}

#cost-reporting-report-content .cost-error-sortable-header {
    cursor: pointer;
    user-select: none;
}

#cost-reporting-report-content .cost-error-sortable-header:focus-visible {
    outline: 2px solid #0077c5;
    outline-offset: -2px;
}

.metric-delta-worse {
    color: #92400e;
    font-weight: 600;
}

.metric-best {
    color: #16a34a;
    font-weight: 600;
}

.cost-critical-section {
    border: 1px solid var(--hub-border, #d6dee9);
    background: var(--hub-surface-soft, #f4f7fb);
}

.cost-critical-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.cost-critical-header h3 {
    margin: 0;
}

.cost-kpi-card {
    background: #ffffff;
    border: 1px solid #d4d7dc;
    border-radius: 14px;
    padding: 1.25rem 1.2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    text-align: left;
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.cost-kpi-card:hover {
    transform: translateY(-1px);
    border-color: #0077c5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.cost-kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
    margin-bottom: 0.35rem;
}

.cost-kpi-label {
    font-size: 0.82rem;
    color: #64748b;
    margin-top: 0;
    text-transform: uppercase;
    letter-spacing: 0.45px;
    font-weight: 600;
}

.cost-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.cost-kpi-grid--top {
    margin-top: 0;
}

.cost-rollup-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0.6rem 0 0.5rem;
}

.cost-rollup-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

#cost-reporting-report-content .cost-filter-text-input,
#cost-reporting-report-content .cost-error-filter-input {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.42rem 0.6rem;
    min-width: 16rem;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

#cost-reporting-report-content .cost-filter-text-input::placeholder,
#cost-reporting-report-content .cost-error-filter-input::placeholder {
    color: #64748b;
    font-weight: 500;
}

#cost-reporting-report-content .cost-filter-text-input:focus-visible,
#cost-reporting-report-content .cost-error-filter-input:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.cost-rollup-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem;
    margin: 0.4rem 0 0.9rem;
}

.cost-rollup-summary-card {
    border: 1px solid #dbe7ff;
    border-radius: 12px;
    padding: 0.65rem 0.75rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.cost-rollup-summary-label {
    font-size: 0.72rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.035em;
}

.cost-rollup-summary-value {
    font-size: 1rem;
    font-weight: 700;
    margin-top: 0.2rem;
    color: #0f172a;
}

.cost-watch-sparkline {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.25rem;
}

.cost-watch-sparkline svg {
    width: 48px;
    height: 16px;
    flex: 0 0 auto;
}

.cost-delta-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1;
    padding: 0.18rem 0.56rem;
    margin-top: 0.18rem;
    border: 1px solid transparent;
    white-space: nowrap;
}

.cost-delta-chip--good {
    background: #ecfdf3;
    color: #166534;
    border-color: #86efac;
}

.cost-delta-chip--bad {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fca5a5;
}

.cost-delta-chip--neutral {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}

#cost-reporting-report-content .cost-success-main-row {
    width: 100%;
    max-width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: stretch;
}

#cost-reporting-report-content .cost-combined-trend-container {
    margin-bottom: 1.5rem;
    position: relative;
    background: #ffffff;
    border: 1px solid #D4D7DC;
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    min-height: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
}

#cost-reporting-report-content .cost-combined-trend-svg {
    width: 100%;
    height: auto;
    display: block;
    max-height: 300px;
}

#cost-reporting-report-content .cost-combined-trend-legend {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.45rem;
}

#cost-reporting-report-content .cost-trend-dot {
    display: inline-block;
    width: 0.72rem;
    height: 0.72rem;
    border-radius: 999px;
    margin-right: 0.35rem;
    flex: 0 0 auto;
}

#cost-reporting-report-content .cost-combined-trend-legend-item {
    font-size: 0.875rem;
    color: #475569;
    display: inline-flex;
    align-items: center;
}

#cost-reporting-report-content .cost-success-summary-grid {
    width: 100%;
    max-width: 100%;
    margin: 0;
}

#cost-reporting-report-content .cost-success-summary-grid.cost-grade-comparison-grid {
    gap: 0.65rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

#cost-reporting-report-content .cost-success-contrib-panel {
    width: 100%;
    max-width: 100%;
    margin: 0;
}

#cost-reporting-report-content .cost-success-side-stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
    align-content: start;
}

#cost-reporting-report-content .cost-success-driver-row {
    margin-top: 0.45rem;
}

#cost-reporting-report-content .cost-success-driver-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    font-size: 0.82rem;
}

#cost-reporting-report-content .cost-success-driver-label {
    color: var(--text-primary);
    font-weight: 600;
}

#cost-reporting-report-content .cost-success-driver-meta {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

#cost-reporting-report-content .cost-success-driver-track {
    margin-top: 0.18rem;
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

#cost-reporting-report-content .cost-success-driver-fill {
    height: 100%;
    border-radius: 999px;
}

#cost-reporting-report-content .cost-success-formula-panel {
    border-style: solid;
}

#cost-reporting-report-content .cost-success-formula-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

@media (max-width: 1200px) {
    #cost-reporting-report-content .cost-success-main-row {
        grid-template-columns: minmax(0, 1fr);
    }

    #cost-reporting-report-content .cost-combined-trend-container {
        width: 100%;
        max-width: 100%;
    }

    #cost-reporting-report-content .cost-success-summary-grid,
    #cost-reporting-report-content .cost-success-contrib-panel {
        width: 100%;
        max-width: 100%;
    }
}

.cost-rollup-row--regression td:first-child {
    box-shadow: inset 3px 0 0 #dc2626;
}

.cost-rollup-row--improvement td:first-child {
    box-shadow: inset 3px 0 0 #16a34a;
}

.cost-rollup-row--new td:first-child {
    box-shadow: inset 3px 0 0 #2563eb;
}

.cost-rollup-row--high-priority-blackout td:first-child {
    box-shadow: inset 4px 0 0 #b91c1c;
}

.cost-row-badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 0.1rem 0.4rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.cost-row-badge--new {
    background: #dbeafe;
    color: #1d4ed8;
}

.cost-row-badge--bad {
    background: #fee2e2;
    color: #b91c1c;
}

.cost-row-badge--good {
    background: #dcfce7;
    color: #166534;
}

.cost-row-badge--mock {
    background: #ede9fe;
    color: #5b21b6;
}

.cost-row-badge--critical-blackout {
    background: #7f1d1d;
    color: #ffffff;
    border: 1px solid #ef4444;
}

.cost-critical-count {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--hub-text-muted, #64748b);
    border: 1px solid var(--hub-border, #d6dee9);
    background: var(--surface, #ffffff);
}

.cost-critical-list {
    margin: 0.65rem 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.6rem;
}

.cost-critical-item {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 0.6rem;
    border: 1px solid var(--hub-border, #d6dee9);
    border-radius: 10px;
    background: var(--surface, #ffffff);
    padding: 0.6rem 0.7rem;
}

.cost-critical-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #991b1b;
    border: 1px solid #ef4444;
    background: #fef2f2;
}

.cost-critical-text {
    color: var(--text-primary, #111827);
    line-height: 1.35;
}

.cost-metric-grid .report-query-card {
    min-height: 120px;
}

.cost-target-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.76rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.cost-target-pill--ok {
    color: #065f46;
    border-color: #10b981;
    background: #ecfdf5;
}

.cost-target-pill--warn {
    color: #92400e;
    border-color: #f59e0b;
    background: #fffbeb;
}

.cost-target-pill--bad {
    color: #991b1b;
    border-color: #ef4444;
    background: #fef2f2;
}

.cost-duration-ok {
    color: #065f46;
}

.cost-duration-bad {
    color: #991b1b;
    font-weight: 700;
}

.cost-duration-warn {
    color: #92400e;
    font-weight: 600;
}

.cost-fa-success {
    color: #16a34a;
}

.cost-fa-danger {
    color: #dc2626;
}

.cost-fa-bar-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cost-fa-bar-container span {
    font-size: 0.8rem;
    white-space: nowrap;
}

.cost-fa-bar {
    height: 8px;
    border-radius: 4px;
    background: #6366f1;
    min-width: 2px;
}

.cost-fa-bar--tool {
    background: #0ea5e9;
}

.cost-reporting-live-note {
    margin-top: 0.35rem;
}

.cost-driver-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
}

.cost-driver-summary-card {
    border: 1px solid var(--border-color, #d7dce6);
    border-radius: 10px;
    background: #fff;
    padding: 0.85rem 1rem;
}

.cost-driver-summary-card h4 {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary, #667085);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cost-driver-summary-value {
    margin-top: 0.35rem;
    font-size: 1.3rem;
    font-weight: 700;
}

.cost-driver-stack {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.cost-driver-row {
    border: 1px solid var(--border-color, #d7dce6);
    border-radius: 10px;
    padding: 0.75rem 0.85rem;
    background: #fff;
}

.cost-driver-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.cost-driver-name {
    font-weight: 700;
}

.cost-driver-meta {
    color: var(--text-secondary, #667085);
    font-size: 0.82rem;
}

.cost-driver-meters {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.cost-driver-meter-label {
    font-size: 0.8rem;
    color: var(--text-secondary, #667085);
}

.cost-driver-meter-track {
    background: #eef2f7;
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.cost-driver-meter-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
}

.cost-driver-meter-fill-cost {
    background: linear-gradient(90deg, #ef4444 0%, #f97316 100%);
}

.cost-driver-meter-fill-duration {
    background: linear-gradient(90deg, #2563eb 0%, #0ea5e9 100%);
}

.cost-driver-meter-value {
    font-weight: 600;
    font-size: 0.82rem;
}

@media (max-width: 720px) {
    .report-tiles-grid,
    .report-query-grid {
        grid-template-columns: 1fr;
    }

    .cost-critical-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .docs-tiles-grid {
        grid-template-columns: 1fr;
    }

    .cost-driver-summary-grid {
        grid-template-columns: 1fr;
    }

    .cost-driver-meters {
        grid-template-columns: 1fr;
    }
}

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

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

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

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

    .kpi-framework-explorer {
        grid-template-columns: minmax(0, 1fr);
    }

    .report-navigator-card {
        position: static;
    }

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

@media (max-width: 640px) {
    .kpi-breadcrumb-back .label-full {
        display: none;
    }

    .kpi-breadcrumb-back .label-short {
        display: inline;
    }

    .cost-kpi-grid {
        grid-template-columns: 1fr;
    }
}
