:root {
    --sv-bg-base: #f5f1e6;
    --sv-bg-1: #ffffff;
    --sv-bg-2: #fffaf0;
    --sv-bg-3: #f1ead7;
    --sv-bg-4: #e5dcc2;
    --sv-gold: #b8860b;
    --sv-gold-dim: #8c6c1f;
    --sv-gold-glow: rgba(184,134,11,0.12);
    --sv-silver: #8e9aa8;
    --sv-silver-dim: #6c7784;
    --sv-silver-glow: rgba(142,154,168,0.14);
    --sv-green: #1a7a4a;
    --sv-green-bg: rgba(26,122,74,0.08);
    --sv-red: #a63a32;
    --sv-red-bg: rgba(166,58,50,0.10);
    --sv-text: #1c1c2e;
    --sv-text-muted: #626270;
    --sv-border: rgba(140,108,31,0.16);
    --sv-radius-sm: 6px;
    --sv-radius-md: 12px;
    --sv-radius-lg: 16px;
    --sv-font-num: 'Space Grotesk', 'IBM Plex Mono', monospace;
}

html[data-theme="night"] {
    --sv-bg-base: #090e1a;
    --sv-bg-1: #0e1320;
    --sv-bg-2: #1a1f2c;
    --sv-bg-3: #252a37;
    --sv-bg-4: #303442;
    --sv-gold: #f2ca50;
    --sv-gold-dim: #d4af37;
    --sv-gold-glow: rgba(242,202,80,0.12);
    --sv-silver: #d4dbe3;
    --sv-silver-dim: #aeb9c6;
    --sv-silver-glow: rgba(212,219,227,0.16);
    --sv-green: #66dd8b;
    --sv-green-bg: rgba(102,221,139,0.08);
    --sv-red: #ff9597;
    --sv-red-bg: rgba(255,149,151,0.08);
    --sv-text: #dee2f4;
    --sv-text-muted: #aeb6cc;
    --sv-border: rgba(77,70,53,0.2);
}

html[data-theme="night"] .sv-card-value,
html[data-theme="night"] .sv-td-num,
html[data-theme="night"] .sv-spread-val,
html[data-theme="night"] .sv-date-main {
    color: #f3f6fd;
}

html[data-theme="night"] .sv-mode.active {
    color: #151821;
}

html[data-theme="night"] .sv-card--accent .sv-card-value {
    color: #f8d86a;
    font-weight: 700;
}

html[data-theme="night"] .sv-card--silver .sv-card-value {
    color: var(--sv-silver);
}

html[data-theme="night"] .sv-card--high {
    border-color: rgba(157,240,191,0.34);
}

html[data-theme="night"] .sv-card--high .sv-card-value {
    color: #9df0bf;
    font-weight: 700;
}

html[data-theme="night"] .sv-panel-title,
html[data-theme="night"] .sv-page-title {
    color: #f7f9ff;
}

html[data-theme="night"] .sv-card-label,
html[data-theme="night"] .sv-card-sub,
html[data-theme="night"] .sv-page-sub,
html[data-theme="night"] .sv-panel-sub,
html[data-theme="night"] .sv-filter-label,
html[data-theme="night"] .sv-sort-info,
html[data-theme="night"] .sv-disclaimer,
html[data-theme="night"] .sv-panel-footer,
html[data-theme="night"] .sv-date-sub,
html[data-theme="night"] .sv-th,
html[data-theme="night"] .sv-search-icon,
html[data-theme="night"] .sv-legend {
    color: #b8c0d6;
}

html[data-theme="night"] .sv-filter-select,
html[data-theme="night"] .sv-search {
    background: #121826;
    border-color: rgba(242,202,80,0.22);
}

html[data-theme="night"] .sv-num-high {
    color: #9df0bf;
    font-weight: 700;
}

html[data-theme="night"] .sv-num-low {
    color: #ffb4b8;
    font-weight: 700;
}

html[data-theme="night"] .sv-num-high .sv-money-currency,
html[data-theme="night"] .sv-num-high .sv-money-number,
html[data-theme="night"] .sv-num-low .sv-money-currency,
html[data-theme="night"] .sv-num-low .sv-money-number {
    color: inherit;
}

html[data-theme="night"] .sv-row:hover {
    background: rgba(255,255,255,0.04);
}

html[data-theme="night"] .sv-chg--up {
    background: rgba(102,221,139,0.14);
}

html[data-theme="night"] .sv-chg--down {
    background: rgba(255,149,151,0.14);
}

.sv-page {
    direction: rtl;
    display: grid;
    gap: 16px;
}

.sv-page-header,
.sv-panel,
.sv-table-wrap,
.sv-card {
    background: var(--sv-bg-2);
    color: var(--sv-text);
    border-radius: var(--sv-radius-lg);
    border: 1px solid var(--sv-border);
    box-shadow: 0 18px 40px rgba(0,0,0,0.18);
}

.sv-page-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: end;
    flex-wrap: wrap;
}

.sv-page-title,
.sv-panel-title {
    margin: 0;
    color: var(--sv-text);
    font-size: 22px;
    font-weight: 900;
}

.sv-page-sub,
.sv-panel-sub,
.sv-card-sub,
.sv-filter-label,
.sv-sort-info,
.sv-disclaimer,
.sv-panel-footer {
    color: var(--sv-text-muted);
}

.sv-page-sub,
.sv-panel-sub {
    margin: 6px 0 0;
    font-size: 13px;
}

.sv-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.sv-filter {
    min-width: 150px;
}

.sv-country-form {
    margin: 0;
}

.sv-filter-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 700;
}

.sv-filter-select,
.sv-search {
    width: 100%;
    background: var(--sv-bg-1);
    color: var(--sv-text);
    border: 1px solid rgba(242,202,80,0.16);
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
}

.sv-filter-select:focus,
.sv-search:focus {
    outline: none;
    border-color: rgba(242,202,80,0.48);
    box-shadow: 0 0 0 3px rgba(242,202,80,0.08);
}

.sv-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.sv-source-mini {
    margin-top: -8px;
    color: var(--sv-text-muted);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.5;
    opacity: .72;
}

.sv-source-mini a {
    color: var(--sv-gold-dim);
    font-weight: 900;
    text-decoration: none;
}

.sv-source-mini a:hover {
    text-decoration: underline;
}

.sv-card {
    padding: 20px;
    overflow: hidden;
}

.sv-card--accent {
    border-top: 2px solid var(--sv-gold);
}

.sv-card--silver {
    border-top-color: var(--sv-silver);
}

.sv-card-header,
.sv-panel-header,
.sv-table-header,
.sv-toolbar,
.sv-panel-footer,
.sv-table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.sv-card-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--sv-text-muted);
}

.sv-card-value {
    margin-top: 10px;
    font-family: var(--sv-font-num);
    font-size: clamp(24px, 2vw, 28px);
    font-weight: 700;
    color: var(--sv-text);
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.25;
    direction: ltr;
    unicode-bidi: isolate;
    text-align: right;
}

.sv-card-sub {
    margin-top: 8px;
    line-height: 1.7;
}

.sv-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--sv-bg-1);
    border: 1px solid var(--sv-border);
    color: var(--sv-text-muted);
    font-family: var(--sv-font-num);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    direction: ltr;
    unicode-bidi: isolate;
}

.sv-icon--gold {
    background: var(--sv-gold-glow);
    color: var(--sv-gold);
    border-color: rgba(242,202,80,0.28);
}

.sv-icon--silver {
    background: var(--sv-silver-glow);
    color: var(--sv-silver);
    border-color: rgba(142,154,168,0.28);
}

.sv-panel,
.sv-table-wrap {
    overflow: hidden;
}

.sv-panel-header,
.sv-table-header,
.sv-toolbar,
.sv-panel-footer,
.sv-table-footer {
    padding: 20px 24px;
}

.sv-chart-wrap {
    padding: 0 24px 24px;
    position: relative;
    min-height: 320px;
}

.sv-chart-stage {
    width: 100%;
    height: 100%;
}

.sv-chart-stage canvas {
    width: 100% !important;
}

.sv-chart-loader {
    position: absolute;
    inset: 0 24px 24px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(245,241,230,0.74);
    border-radius: 14px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .18s ease, visibility .18s ease;
    backdrop-filter: blur(5px);
}

html[data-theme="night"] .sv-chart-loader {
    background: rgba(9,14,26,0.72);
}

.sv-chart-wrap.is-loading .sv-chart-loader {
    opacity: 1;
    visibility: visible;
}

.sv-chart-wrap.is-loading .sv-chart-stage {
    opacity: 0.38;
    transition: opacity .18s ease;
}

.sv-chart-loader-bar {
    width: min(220px, 62%);
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(242,202,80,0.12), rgba(242,202,80,0.9), rgba(242,202,80,0.12));
    background-size: 200% 100%;
    animation: sv-loader-shift 1s linear infinite;
    box-shadow: 0 0 0 1px rgba(242,202,80,0.18);
}

.sv-chart-loader-text {
    color: var(--sv-text-muted);
    font-size: 13px;
    font-weight: 700;
}

@keyframes sv-loader-shift {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.sv-chart-fullscreen {
    position: absolute;
    top: 10px;
    left: 34px;
    z-index: 2;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(242,202,80,0.34);
    border-radius: 10px;
    background: rgba(14,19,32,0.72);
    color: var(--sv-gold);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(0,0,0,0.22);
    backdrop-filter: blur(12px);
    transition: transform .2s ease, background-color .2s ease, border-color .2s ease;
}

.sv-chart-fullscreen:hover {
    transform: translateY(-1px);
    background: rgba(26,31,44,0.92);
    border-color: rgba(242,202,80,0.58);
}

.sv-chart-wrap:fullscreen {
    width: 100vw;
    height: 100vh;
    padding: 58px 20px 24px;
    background: var(--sv-bg-base);
    overflow: hidden;
}

.sv-chart-wrap:fullscreen .sv-chart-stage {
    width: 100%;
    height: 100%;
}

.sv-chart-wrap:fullscreen canvas {
    height: 100% !important;
}

.sv-chart-wrap:fullscreen .sv-chart-fullscreen {
    top: 14px;
    left: 18px;
}

.sv-chart-wrap.is-fallback-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    width: 100vw;
    height: 100vh;
    padding: 58px 20px 24px;
    background: var(--sv-bg-base);
    overflow: hidden;
}

.sv-chart-wrap.is-fallback-fullscreen .sv-chart-stage {
    width: 100%;
    height: 100%;
}

.sv-chart-wrap.is-fallback-fullscreen canvas {
    height: 100% !important;
}

.sv-chart-wrap.is-fallback-fullscreen .sv-chart-fullscreen {
    top: 14px;
    left: 18px;
}

body.sv-no-scroll {
    overflow: hidden;
    touch-action: none;
}

@media (orientation: portrait) and (max-width: 820px) {
    .sv-chart-wrap:fullscreen {
        padding: 0;
    }

    .sv-chart-wrap:fullscreen .sv-chart-stage {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 100vh;
        height: 100vw;
        padding: 54px 18px 22px;
        transform: translate(-50%, -50%) rotate(90deg);
        transform-origin: center;
    }

    .sv-chart-wrap:fullscreen .sv-chart-fullscreen {
        top: 14px;
        left: 14px;
        width: 40px;
        height: 40px;
        font-size: 22px;
    }

    .sv-chart-wrap.is-fallback-fullscreen {
        padding: 0;
    }

    .sv-chart-wrap.is-fallback-fullscreen .sv-chart-stage {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 100vh;
        height: 100vw;
        padding: 54px 18px 22px;
        transform: translate(-50%, -50%) rotate(90deg);
        transform-origin: center;
    }

    .sv-chart-wrap.is-fallback-fullscreen .sv-chart-fullscreen {
        top: 14px;
        left: 14px;
        width: 40px;
        height: 40px;
        font-size: 22px;
    }
}

.sv-mode-group {
    display: inline-flex;
    gap: 8px;
    background: var(--sv-bg-1);
    border-radius: 999px;
    padding: 4px;
}

.sv-chart-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sv-chart-mobile-bar,
.sv-mobile-panel {
    display: none;
}

.sv-chart-selectors {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}

.sv-filter--compact {
    min-width: 170px;
}

.sv-mode {
    border: 0;
    background: transparent;
    color: var(--sv-text-muted);
    border-radius: 999px;
    padding: 10px 16px;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    cursor: pointer;
}

.sv-mode:disabled {
    opacity: 0.55;
    cursor: wait;
}

.sv-mode.active {
    color: #151821;
    background: var(--sv-gold);
}

.sv-legend,
.sv-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sv-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.sv-legend-dot--green { background: var(--sv-green); }
.sv-legend-dot--red { background: var(--sv-red); }

.sv-search-wrap {
    min-width: 240px;
    position: relative;
}

.sv-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 50%;
    transform: translateY(-50%);
    opacity: 0.72;
}

.sv-search-icon::after {
    content: "";
    position: absolute;
    width: 7px;
    height: 2px;
    right: -5px;
    bottom: -3px;
    background: currentColor;
    transform: rotate(45deg);
    transform-origin: center;
}

.sv-search {
    padding-right: 40px;
}

.sv-table-scroll {
    overflow-x: auto;
    position: relative;
}

.sv-footer-status {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sv-data-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--sv-bg-1);
    border: 1px solid var(--sv-border);
    color: var(--sv-text-muted);
    font-size: 12px;
    font-weight: 700;
}

.sv-table-loader {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245,241,230,0.7);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease, visibility .18s ease;
}

html[data-theme="night"] .sv-table-loader {
    background: rgba(9,14,26,0.7);
}

.sv-table-wrap.is-loading .sv-table-loader {
    opacity: 1;
    visibility: visible;
}

.sv-table-wrap.is-loading .sv-table {
    opacity: 0.42;
}

.sv-table-loader-text {
    color: var(--sv-text-muted);
    font-size: 13px;
    font-weight: 700;
}

.sv-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 880px;
}

.sv-th,
.sv-td {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.05);
    text-align: right;
}

.sv-th {
    background: var(--sv-bg-1);
    color: var(--sv-text-muted);
    font-size: 11px;
    letter-spacing: 0.02em;
    cursor: pointer;
    user-select: none;
}

.sv-row:hover {
    background: rgba(255,255,255,0.02);
}

.sv-td-num,
.sv-date-main,
.sv-spread-val,
.sv-chg-usd,
.sv-chg-pct,
.sv-card-value,
.sv-footer-date {
    font-family: var(--sv-font-num);
}

.sv-td-num,
.sv-spread-val,
.sv-chg-usd {
    direction: ltr;
    unicode-bidi: isolate;
    text-align: right;
}

.sv-money {
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: flex-start;
    gap: 0.35em;
    white-space: nowrap;
    text-align: left;
}

.sv-money-currency,
.sv-money-number {
    direction: ltr;
    unicode-bidi: isolate;
}

.sv-money-currency {
    order: 0;
}

.sv-money-number {
    order: 1;
}

.sv-date-main {
    font-weight: 700;
    color: var(--sv-text);
}

.sv-date-sub {
    margin-top: 4px;
    font-size: 11px;
    color: var(--sv-text-muted);
}

.sv-num-high { color: #1a7a4a; }
.sv-num-low { color: #a63a32; }

.sv-spread-track {
    margin-top: 8px;
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 999px;
    overflow: hidden;
}

.sv-spread-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sv-gold-dim), var(--sv-gold));
}

.sv-chg {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
}

.sv-chg--up {
    color: var(--sv-green);
    background: var(--sv-green-bg);
}

.sv-chg--down {
    color: var(--sv-red);
    background: var(--sv-red-bg);
}

.sv-chg--flat {
    color: var(--sv-text-muted);
    background: rgba(128, 136, 153, 0.10);
}

.sv-chg-arrow {
    font-size: 12px;
    font-weight: 700;
}

.sv-no-chg {
    color: var(--sv-text-muted);
    font-size: 16px;
}

.sv-green { color: var(--sv-green); }
.sv-red { color: var(--sv-red); }
.sv-neutral { color: var(--sv-text-muted); }
.it-hidden { display: none; }

@media (max-width: 1100px) {
    .sv-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 720px) {
    .sv-grid-4 {
        grid-template-columns: 1fr;
    }

    .sv-chart-actions {
        width: 100%;
    }

    .sv-chart-mobile-bar {
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
        gap: 10px;
        align-items: end;
    }

    .sv-mobile-panel {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding: 14px;
        background: var(--sv-bg-1);
        border: 1px solid var(--sv-border);
        border-radius: 14px;
    }

    .sv-mobile-panel[hidden] {
        display: none;
    }

    .sv-mobile-toggle {
        min-height: 46px;
        border: 1px solid var(--sv-border);
        border-radius: 12px;
        background: var(--sv-bg-1);
        color: var(--sv-text);
        padding: 12px 14px;
        font: inherit;
        font-weight: 700;
        white-space: nowrap;
    }

    .sv-chart-selectors {
        display: none;
    }

    .sv-filter--compact {
        min-width: 0;
        flex: 1 1 180px;
    }

    .sv-chart-actions .sv-mode-group {
        width: 100%;
        justify-content: center;
    }

    .sv-page-header,
    .sv-panel-header,
    .sv-table-header,
    .sv-toolbar,
    .sv-panel-footer,
    .sv-table-footer {
        padding: 16px;
    }

    .sv-chart-wrap {
        padding: 0 16px 16px;
        min-height: 280px;
    }

    .sv-chart-loader {
        inset: 0 16px 16px;
    }

    .sv-chart-fullscreen {
        left: 26px;
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .sv-th,
    .sv-td {
        padding: 12px 16px;
    }
}
