.treasury-tool {
    width: min(1180px, calc(100% - 24px));
    margin: clamp(26px, 4vw, 48px) auto 58px;
    color: var(--ga-color-text);
}

.treasury-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--ga-color-border-soft);
}

.treasury-hero > div:first-child > span,
.treasury-updated span,
.treasury-panel-heading span,
.treasury-summary-card span,
.treasury-spread-card span,
.treasury-status-card span,
.treasury-source-card span {
    display: block;
    color: var(--ga-color-muted);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.treasury-hero > div:first-child > span {
    margin-bottom: 8px;
    color: var(--ga-color-primary-hover);
}

.treasury-hero h1 {
    margin: 0;
    color: var(--ga-color-heading);
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.08;
    letter-spacing: 0;
}

.treasury-hero p {
    max-width: 780px;
    margin: 12px 0 0;
    color: var(--ga-color-muted);
    font-size: clamp(1rem, 2vw, 1.12rem);
    line-height: 1.55;
}

.treasury-updated,
.treasury-status-card,
.treasury-source-card,
.treasury-summary-card,
.treasury-panel,
.treasury-spreads,
.treasury-content-grid > article,
.treasury-content-grid > aside {
    border: 1px solid var(--ga-color-border);
    border-radius: var(--ga-radius-lg);
    background: var(--ga-color-surface);
    box-shadow: var(--ga-shadow-sm);
}

.treasury-updated {
    display: grid;
    gap: 4px;
    min-width: 176px;
    padding: 12px 14px;
}

.treasury-updated strong {
    color: var(--ga-color-heading);
    font-size: 0.96rem;
    white-space: nowrap;
}

.treasury-empty {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid rgba(220, 53, 69, 0.25);
    border-radius: var(--ga-radius-lg);
    background: rgba(220, 53, 69, 0.08);
    color: #7f1d1d;
}

.treasury-empty i {
    margin-top: 2px;
}

.treasury-empty strong,
.treasury-empty span,
.treasury-empty small {
    display: block;
}

.treasury-market-strip {
    display: grid;
    grid-template-columns: minmax(260px, 1.25fr) repeat(2, minmax(180px, 0.65fr));
    gap: 12px;
    margin-top: 18px;
}

.treasury-status-card,
.treasury-source-card {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 16px;
}

.treasury-status-card {
    position: relative;
    overflow: hidden;
}

.treasury-status-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: #1d9a68;
}

.treasury-status-card.warning::before {
    background: #d84a4a;
}

.treasury-status-card strong,
.treasury-source-card strong {
    color: var(--ga-color-heading);
    font-size: 1.08rem;
    line-height: 1.25;
}

.treasury-status-card small,
.treasury-source-card small {
    color: var(--ga-color-muted);
    line-height: 1.4;
}

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

.treasury-summary-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 15px;
    overflow: hidden;
}

.treasury-summary-card i {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: var(--ga-radius-md);
    color: var(--ga-color-primary-hover);
    background: rgba(var(--ga-color-primary-rgb), 0.10);
}

.treasury-summary-card strong {
    display: block;
    margin-top: 5px;
    color: var(--ga-color-heading);
    font-size: clamp(1.28rem, 2vw, 1.72rem);
    line-height: 1.1;
}

.treasury-summary-card.featured {
    border-color: rgba(var(--ga-color-primary-rgb), 0.35);
}

.treasury-summary-card.warning i {
    color: #c62f3b;
    background: rgba(198, 47, 59, 0.10);
}

.treasury-summary-card.warning strong,
.treasury-spread-card.negative strong,
.treasury-table .negative {
    color: #c62f3b;
}

.treasury-table .positive,
.treasury-spread-card.positive strong {
    color: #14804a;
}

.treasury-table .flat,
.treasury-spread-card.flat strong {
    color: var(--ga-color-muted);
}

.treasury-chart-panel,
.treasury-layout {
    margin-top: 18px;
}

.treasury-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 18px;
}

.treasury-panel,
.treasury-spreads {
    min-width: 0;
    padding: 18px;
}

.treasury-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.treasury-panel-heading h2 {
    margin: 4px 0 0;
    color: var(--ga-color-heading);
    font-size: clamp(1.18rem, 2vw, 1.48rem);
    letter-spacing: 0;
}

.treasury-badge {
    display: inline-flex !important;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid rgba(var(--ga-color-primary-rgb), 0.22);
    border-radius: 999px;
    background: rgba(var(--ga-color-primary-rgb), 0.08);
    color: var(--ga-color-primary-hover) !important;
    white-space: nowrap;
}

.treasury-chart-shell {
    position: relative;
    min-height: 460px;
    border: 1px solid var(--ga-color-border-soft);
    border-radius: var(--ga-radius-md);
    background:
        linear-gradient(180deg, rgba(var(--ga-color-primary-rgb), 0.04), rgba(255, 255, 255, 0) 34%),
        var(--ga-color-surface);
    overflow: hidden;
}

.treasury-chart {
    height: 460px;
    min-height: 320px;
    width: 100%;
}

.treasury-timeframes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.treasury-timeframes button {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--ga-color-border);
    border-radius: var(--ga-radius-md);
    background: var(--ga-color-surface-muted);
    color: var(--ga-color-heading);
    cursor: pointer;
    font-weight: 800;
}

.treasury-timeframes button:hover,
.treasury-timeframes button.is-active {
    border-color: var(--ga-color-primary);
    background: var(--ga-color-primary);
    color: #fff;
}

.treasury-table-wrap {
    overflow-x: auto;
}

.treasury-table {
    width: 100%;
    border-collapse: collapse;
}

.treasury-table th,
.treasury-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--ga-color-border-soft);
    text-align: right;
    white-space: nowrap;
}

.treasury-table th:first-child,
.treasury-table td:first-child {
    text-align: left;
}

.treasury-table thead th {
    color: var(--ga-color-muted);
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
}

.treasury-table tbody td {
    color: var(--ga-color-heading);
    font-weight: 800;
}

.treasury-table tbody tr:hover {
    background: rgba(var(--ga-color-primary-rgb), 0.04);
}

.treasury-spreads {
    align-self: start;
}

.treasury-spread-card {
    display: grid;
    gap: 5px;
    margin-bottom: 10px;
    padding: 14px;
    border: 1px solid var(--ga-color-border-soft);
    border-radius: var(--ga-radius-md);
    background: var(--ga-color-surface-muted);
}

.treasury-spread-card strong {
    color: var(--ga-color-heading);
    font-size: 1.48rem;
    line-height: 1.1;
}

.treasury-spreads p,
.treasury-content-grid p {
    margin: 0;
    color: var(--ga-color-muted);
    line-height: 1.65;
}

.treasury-content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    margin-top: 18px;
}

.treasury-content-grid > article,
.treasury-content-grid > aside {
    padding: 22px;
}

.treasury-content-grid h2 {
    margin: 0 0 12px;
    color: var(--ga-color-heading);
    font-size: 1.25rem;
    letter-spacing: 0;
}

.treasury-content-grid p + p {
    margin-top: 12px;
}

@media (max-width: 980px) {
    .treasury-hero,
    .treasury-layout,
    .treasury-content-grid {
        grid-template-columns: 1fr;
    }

    .treasury-market-strip {
        grid-template-columns: 1fr;
    }

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

    .treasury-updated {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .treasury-tool {
        width: min(100% - 20px, 1180px);
        margin-top: 28px;
    }

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

    .treasury-panel,
    .treasury-spreads,
    .treasury-content-grid > article,
    .treasury-content-grid > aside {
        padding: 14px;
    }

    .treasury-panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .treasury-timeframes {
        justify-content: flex-start;
        width: 100%;
    }

    .treasury-timeframes button {
        flex: 1 1 calc(33.333% - 8px);
    }

    .treasury-chart-shell,
    .treasury-chart {
        min-height: 340px;
        height: 340px;
    }

    .treasury-table,
    .treasury-table tbody,
    .treasury-table tr,
    .treasury-table td {
        display: block;
        width: 100%;
    }

    .treasury-table thead {
        display: none;
    }

    .treasury-table tr {
        margin-bottom: 10px;
        padding: 10px;
        border: 1px solid var(--ga-color-border-soft);
        border-radius: var(--ga-radius-md);
        background: var(--ga-color-surface);
    }

    .treasury-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 0;
        border-bottom: 1px solid var(--ga-color-border-soft);
        text-align: right;
        white-space: normal;
    }

    .treasury-table td:last-child {
        border-bottom: 0;
    }

    .treasury-table td::before {
        content: attr(data-label);
        padding-right: 16px;
        color: var(--ga-color-muted);
        font-size: 0.74rem;
        font-weight: 800;
        text-align: left;
        text-transform: uppercase;
    }
}
