.sp-report-hub {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.sp-report-hub__card {
    display: block;
    padding: 1.25rem;
    border: 1px solid var(--sp-border, #e2e8f0);
    border-radius: 0.75rem;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    text-decoration: none;
    color: inherit;
}

.sp-report-hub__card:hover {
    border-color: var(--sp-brand, #4f46e5);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.sp-report-hub__title {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 0.5rem;
}

.sp-report-hub__desc {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.45;
    margin: 0 0 0.75rem;
}

.sp-report-hub__link {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--sp-brand, #4f46e5);
}

.sp-report-filters__grid {
    display: grid;
    gap: 0.75rem 1rem;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.sp-report-filters__field--search {
    grid-column: 1 / -1;
}

@media (min-width: 768px) {
    .sp-report-filters__field--search {
        grid-column: span 2;
    }
}

.sp-report-filters__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.sp-report-kpis {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.sp-report-kpi {
    flex: 1 1 120px;
    min-width: 100px;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
}

.sp-report-kpi__label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin: 0;
}

.sp-report-kpi__value {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0.15rem 0 0;
    font-variant-numeric: tabular-nums;
}

.sp-report-kpi__hint {
    font-size: 0.6875rem;
    color: #94a3b8;
    margin: 0.15rem 0 0;
}

.sp-report-export {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f1f5f9;
    border-radius: 0.5rem;
}

.sp-report-trail-block {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--sp-brand, #4f46e5);
}

.sp-report-trail-block__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

/* Party summary — nested expandable tables */
.sp-nested-report__table {
    width: 100%;
    margin-bottom: 0;
}

.sp-nested-report__col-expand {
    width: 2.5rem;
}

.sp-nested-report__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.25rem;
    background: #fff;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    color: #334155;
}

.sp-nested-report__toggle:hover {
    background: #eef2ff;
    border-color: var(--sp-brand, #4f46e5);
}

.sp-nested-report__parent {
    background: #fff;
}

.sp-nested-report__parent:hover {
    background: #f8fafc;
}

.sp-nested-report__child-row.hidden {
    display: none;
}

.sp-nested-report__child-cell {
    padding: 0.5rem 0.75rem 0.75rem 2.5rem !important;
    background: #f1f5f9;
    vertical-align: top;
}

.sp-nested-report__child-title {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.sp-nested-report__table--l2 .sp-nested-report__parent {
    background: #fafafa;
}

.sp-nested-report__table--l3 .sp-nested-report__parent {
    background: #fff;
}

.sp-nested-report__table--l4 {
    font-size: 0.8125rem;
}

.sp-nested-report__table--l4 th,
.sp-nested-report__table--l4 td {
    padding: 0.35rem 0.5rem;
}

/* Legacy tree (unused) */
.sp-summary-tree {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sp-summary-tree__group,
.sp-summary-tree__lot,
.sp-summary-tree__process {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #fff;
}

.sp-summary-tree__summary {
    list-style: none;
    cursor: pointer;
    padding: 0.65rem 0.85rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.sp-summary-tree__summary::-webkit-details-marker {
    display: none;
}

.sp-summary-tree__summary--l1 {
    background: linear-gradient(to right, #eef2ff, #f8fafc);
    font-weight: 600;
}

.sp-summary-tree__summary--l2 {
    background: #f8fafc;
}

.sp-summary-tree__summary--l3 {
    background: #fafafa;
}

.sp-summary-tree__title {
    font-weight: 600;
    color: #0f172a;
}

.sp-summary-tree__metrics {
    font-size: 0.75rem;
    color: #64748b;
    margin-left: auto;
}

.sp-summary-tree__body {
    padding: 0 0.5rem 0.5rem;
}

.sp-summary-tree__body--indent {
    margin-left: 0.75rem;
    padding-left: 0.75rem;
    border-left: 2px solid #e2e8f0;
}

.sp-summary-tree__program {
    margin: 0.5rem 0 0.75rem;
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 0.375rem;
}

.sp-table--compact th,
.sp-table--compact td {
    padding: 0.35rem 0.5rem;
}

.sp-summary-badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    background: #e2e8f0;
    color: #334155;
}

.sp-summary-badge--delivery {
    background: #d1fae5;
    color: #065f46;
}
