.tdgst-widget,
.tdgst-widget * {
    box-sizing: border-box;
}

.tdgst-widget {
    --tdgst-ink: #202833;
    --tdgst-muted: #687482;
    --tdgst-border: #e1e6eb;
    --tdgst-soft: #f7f9fb;
    --tdgst-blue: #245b88;
    --tdgst-blue-dark: #194568;
    --tdgst-gold: #b78525;
    width: 100%;
    max-width: 100%;
    margin: 22px 0;
    padding: clamp(18px, 3vw, 30px);
    color: var(--tdgst-ink);
    background: #fff;
    border: 1px solid var(--tdgst-border);
    border-radius: 9px;
    box-shadow: 0 4px 18px rgba(27, 43, 59, 0.045);
    font-family: inherit;
    line-height: 1.5;
}

.tdgst-widget button {
    font: inherit;
    cursor: pointer;
}

.tdgst-widget button:focus-visible {
    outline: 3px solid rgba(36, 91, 136, 0.25);
    outline-offset: 2px;
}

.tdgst-topline,
.tdgst-controls,
.tdgst-price-heading,
.tdgst-price-row,
.tdgst-history-action-row,
.tdgst-chart-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.tdgst-topline {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--tdgst-border);
}

.tdgst-title-block .tdgst-kicker {
    margin: 0 0 5px;
    color: var(--tdgst-blue);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.35px;
}

.tdgst-title-block h2 {
    margin: 0;
    color: var(--tdgst-ink);
    font-size: clamp(23px, 3vw, 30px);
    font-weight: 750;
    line-height: 1.2;
}

.tdgst-title-block .tdgst-intro {
    margin: 7px 0 0;
    color: var(--tdgst-muted);
    font-size: 14px;
}

.tdgst-refresh {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 13px;
    color: var(--tdgst-blue);
    background: #fff;
    border: 1px solid #cbd8e2;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.tdgst-refresh:hover {
    background: #f2f7fb;
}

.tdgst-refresh span:first-child {
    font-size: 18px;
    line-height: 1;
}

.tdgst-controls {
    flex-wrap: wrap;
    margin: 19px 0 15px;
}

.tdgst-tabs,
.tdgst-currency,
.tdgst-range-tabs {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.tdgst-tab {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    gap: 9px;
    padding: 7px 16px;
    color: #44505d;
    background: #fff;
    border: 1px solid var(--tdgst-border);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
}

.tdgst-tab.is-active {
    color: #fff;
    background: var(--tdgst-blue);
    border-color: var(--tdgst-blue);
}

.tdgst-tab-mark {
    display: inline-flex;
    width: 23px;
    height: 23px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
}

.tdgst-gold-mark {
    background: #c28e2c;
}

.tdgst-silver-mark {
    background: #7a8794;
}

.tdgst-currency {
    padding: 4px;
    background: #f0f3f6;
    border: 1px solid #e8edf1;
    border-radius: 7px;
}

.tdgst-currency-btn {
    min-height: 32px;
    padding: 5px 11px;
    color: #53606d;
    background: transparent;
    border: 0;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 700;
}

.tdgst-currency-btn[aria-pressed="true"] {
    color: var(--tdgst-blue-dark);
    background: #fff;
    box-shadow: 0 1px 3px rgba(23, 43, 61, 0.12);
}

.tdgst-price-card {
    padding: clamp(18px, 3vw, 25px);
    background: var(--tdgst-soft);
    border: 1px solid #e8edf1;
    border-radius: 8px;
}

.tdgst-price-heading {
    align-items: flex-start;
}

.tdgst-price-label,
.tdgst-unit-label {
    display: block;
}

.tdgst-price-label {
    color: #475463;
    font-size: 14px;
    font-weight: 700;
}

.tdgst-unit-label {
    margin-top: 2px;
    color: #7b8793;
    font-size: 12px;
}

.tdgst-market-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 9px;
    color: #53616c;
    background: #fff;
    border: 1px solid var(--tdgst-border);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.tdgst-live-dot {
    width: 7px;
    height: 7px;
    background: #269b62;
    border-radius: 50%;
}

.tdgst-price-row {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin: 12px 0 18px;
}

.tdgst-price-value {
    color: #1d2935;
    font-size: clamp(30px, 5vw, 43px);
    font-weight: 780;
    letter-spacing: -1.3px;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.tdgst-change {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    color: #5a6570;
    background: #edf1f4;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 750;
}

.tdgst-change.is-up {
    color: #177347;
    background: #e8f5ee;
}

.tdgst-change.is-down {
    color: #b33c37;
    background: #fbebea;
}

.tdgst-quote-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #e2e8ed;
}

.tdgst-quote-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tdgst-quote-item span {
    color: #7a8590;
    font-size: 11px;
}

.tdgst-quote-item strong {
    color: #33404c;
    font-size: 14px;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.tdgst-price-footnote {
    margin: 12px 0 0;
    color: #7b8792;
    font-size: 11px;
}

.tdgst-status {
    min-height: 23px;
    margin: 10px 1px 19px;
    color: #75818c;
    font-size: 12px;
}

.tdgst-status.is-error,
.tdgst-chart-status.is-error {
    color: #ad3732;
}

.tdgst-status.is-warning {
    color: #8c651e;
}

.tdgst-history-action-row {
    align-items: center;
    padding: 17px 0 13px;
    border-top: 1px solid var(--tdgst-border);
}

.tdgst-history-action-row h3,
.tdgst-chart-topline h3 {
    margin: 0;
    color: var(--tdgst-ink);
    font-size: 17px;
    font-weight: 750;
}

.tdgst-history-action-row p,
.tdgst-chart-topline p {
    margin: 4px 0 0;
    color: var(--tdgst-muted);
    font-size: 12px;
}

.tdgst-history-toggle {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    gap: 8px;
    padding: 8px 13px;
    color: #fff;
    background: var(--tdgst-blue);
    border: 1px solid var(--tdgst-blue);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.tdgst-history-toggle:hover {
    background: var(--tdgst-blue-dark);
}

.tdgst-toggle-chevron {
    font-size: 10px;
}

.tdgst-history-panel {
    margin-top: 5px;
    padding: 18px;
    background: #fff;
    border: 1px solid var(--tdgst-border);
    border-radius: 8px;
}

.tdgst-history-panel[hidden] {
    display: none !important;
}

.tdgst-chart-topline {
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 13px;
}

.tdgst-range-tabs {
    gap: 5px;
}

.tdgst-range-tabs button {
    min-height: 30px;
    padding: 5px 9px;
    color: #5d6975;
    background: #f5f7f9;
    border: 1px solid #e4e9ee;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
}

.tdgst-range-tabs button.is-active {
    color: #fff;
    background: var(--tdgst-blue);
    border-color: var(--tdgst-blue);
}

.tdgst-chart-wrap {
    position: relative;
    width: 100%;
    min-height: 240px;
}

.tdgst-chart {
    display: block;
    width: 100%;
    height: 280px;
    touch-action: pan-y;
}

.tdgst-chart-readout {
    min-height: 22px;
    margin-top: 4px;
    color: #43515f;
    font-size: 12px;
    font-weight: 700;
}

.tdgst-chart-status {
    min-height: 20px;
    margin-top: 5px;
    color: #7b8792;
    font-size: 11px;
}

.tdgst-fx-note {
    margin: 7px 0 0;
    color: #7b8792;
    font-size: 11px;
}

.tdgst-disclaimer {
    margin-top: 19px;
    padding: 12px 14px;
    color: #64717d;
    background: #fafbfc;
    border-left: 3px solid #d9e1e8;
    font-size: 11px;
    line-height: 1.6;
}

.tdgst-disclaimer strong {
    color: #44515e;
}

.tdgst-attribution {
    margin-top: 12px;
    color: #84909b;
    font-size: 10px;
    text-align: right;
}

.tdgst-attribution a {
    color: var(--tdgst-blue);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.tdgst-noscript {
    color: #ad3732;
    font-size: 13px;
}

@media (max-width: 640px) {
    .tdgst-widget {
        padding: 16px;
        border-radius: 7px;
    }

    .tdgst-topline {
        align-items: flex-start;
    }

    .tdgst-refresh {
        padding: 7px 9px;
    }

    .tdgst-refresh span:last-child {
        display: none;
    }

    .tdgst-controls {
        align-items: flex-start;
        flex-direction: column;
    }

    .tdgst-currency {
        width: 100%;
    }

    .tdgst-currency-btn {
        flex: 1;
    }

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

    .tdgst-history-action-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .tdgst-history-toggle {
        width: 100%;
        justify-content: center;
    }

    .tdgst-history-panel {
        padding: 12px;
    }

    .tdgst-chart {
        height: 245px;
    }

    .tdgst-range-tabs {
        width: 100%;
    }

    .tdgst-range-tabs button {
        flex: 1 1 auto;
    }

    .tdgst-attribution {
        text-align: left;
        line-height: 1.8;
    }
}
