/* ════════════════════════════════════════
   Design System Tokens
════════════════════════════════════════ */
:root {
    --bg-app: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --border: #e5e7eb;

    --text-1: #0f172a;
    --text-2: #475569;
    --text-3: #94a3b8;

    --blue: #4f46e5;
    --blue-hover: #4338ca;
    --blue-light: #eef2ff;
    --blue-mid: #c7d2fe;

    --green: #10b981;
    --green-light: #d1fae5;
    --red: #ef4444;
    --red-light: #fee2e2;
    --amber: #f59e0b;

    --sidebar-w: 260px;
    --topbar-h: 64px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .08);
    --radius: 10px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ════════════════════════════════════════
   Reset & Base
════════════════════════════════════════ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
}

body {
    font-family: var(--font);
    background: var(--bg-app);
    color: var(--text-1);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ════════════════════════════════════════
   Layout
════════════════════════════════════════ */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ════════════════════════════════════════
   Sidebar
════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 300;
    transition: transform .25s ease;
}

/* Brand */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: -.01em;
}

.badge {
    font-size: 10px;
    font-weight: 700;
    background: var(--blue-light);
    color: var(--blue);
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-section {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-3);
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 0 8px;
    margin: 8px 0 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-2);
    font-weight: 500;
    transition: background .15s, color .15s;
}

.nav-link svg {
    flex-shrink: 0;
    color: var(--text-3);
    transition: color .15s;
}

.nav-link:hover,
.nav-link.active {
    background: var(--blue-light);
    color: var(--blue);
}

.nav-link:hover svg,
.nav-link.active svg {
    color: var(--blue);
}

.nav-link.active {
    font-weight: 600;
}

/* Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.data-source {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-3);
}

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 299;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}

/* ════════════════════════════════════════
   Main Content
════════════════════════════════════════ */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Topbar */
.topbar {
    height: var(--topbar-h);
    padding: 0 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar h1 {
    font-size: 17px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile hamburger (hidden on desktop) */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-2);
    padding: 4px;
    border-radius: 6px;
    flex-shrink: 0;
}

.mobile-menu-btn:hover {
    background: var(--bg-app);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Status pill */
.status-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--green-light);
    color: var(--green);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 999px;
    flex-shrink: 0;
}

.pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s ease infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, .6);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Scrollable area */
.scrollable-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 28px 40px;
}

/* ════════════════════════════════════════
   Section Intro
════════════════════════════════════════ */
.section-intro {
    margin-bottom: 20px;
}

.section-intro h2 {
    font-size: 18px;
    font-weight: 700;
}

.section-intro p {
    font-size: 13px;
    color: var(--text-2);
    margin-top: 4px;
}

/* ════════════════════════════════════════
   Cards
════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.card-header-flex {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

/* Search header */
.card-header-search {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-3);
    pointer-events: none;
}

.search-input {
    padding: 8px 12px 8px 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-1);
    background: var(--bg-app);
    outline: none;
    width: 220px;
    transition: border-color .2s, box-shadow .2s;
}

.search-input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-light);
    background: #fff;
}

.search-input::placeholder {
    color: var(--text-3);
}

.no-results {
    text-align: center;
    color: var(--text-3);
    padding: 24px;
    font-style: italic;
}

.card-header-danger,
.card-header-success {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.card-header-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-header.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-2);
}

.card-header-icon.danger {
    background: var(--red-light);
    color: var(--red);
}

.card-header-icon.success {
    background: var(--green-light);
    color: var(--green);
}

.subtitle {
    font-size: 12px;
    color: var(--text-2);
    margin-top: 2px;
}

/* ════════════════════════════════════════
   Stats Grid
════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 36px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s, transform .2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px dashed var(--border);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-desc {
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
}

.stat-val {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-1);
}

.stat-val.up {
    color: var(--red);
}

.stat-val.down {
    color: var(--green);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.stat-card-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-2);
}

.stat-icon {
    width: 34px;
    height: 34px;
    background: var(--blue-light);
    color: var(--blue);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text-1);
}

.stat-desc {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 4px;
}

/* ════════════════════════════════════════
   Rankings Grid
════════════════════════════════════════ */
.rankings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Rank badges */
.rank-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    flex-shrink: 0;
}

.rank-exp {
    background: var(--red-light);
    color: var(--red);
}

.rank-cheap {
    background: var(--green-light);
    color: var(--green);
}

/* ════════════════════════════════════════
   Tables
════════════════════════════════════════ */
.table-container {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

th {
    padding: 11px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-2);
    background: var(--bg-app);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 13px 20px;
    border-bottom: 1px solid var(--border);
    color: var(--text-1);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--bg-app);
}

.price-col {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    white-space: nowrap;
}

/* ════════════════════════════════════════
   Chart
════════════════════════════════════════ */
.chart-container {
    padding: 24px;
    height: 380px;
}

/* ════════════════════════════════════════
   Form Controls
════════════════════════════════════════ */
.premium-select {
    padding: 7px 32px 7px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    font-family: inherit;
    font-size: 13px;
    color: var(--text-1);
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    min-width: 180px;
}

.premium-select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-light);
}

/* Tom Select Overrides - Fix inherited premium-select styles */
.ts-wrapper.premium-select {
    padding: 0;
    border: none;
    background: none;
    min-width: 200px;
}

.ts-wrapper.premium-select.focus {
    box-shadow: none;
}

.ts-wrapper.single .ts-control {
    padding: 8px 36px 8px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--bg-card);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-1);
    cursor: pointer;
    outline: none;
    box-shadow: none;
    transition: all 0.2s ease;
}

.ts-wrapper.single.focus .ts-control {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-light);
}

.ts-dropdown {
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-top: 6px;
    font-size: 14px;
    background: var(--bg-card);
    overflow: hidden;
}

.ts-dropdown .option {
    padding: 10px 16px;
    cursor: pointer;
    color: var(--text-1);
}

.ts-dropdown .option:hover,
.ts-dropdown .active {
    background: var(--bg-body);
    color: var(--blue);
}

.ts-control>input {
    font-size: 14px;
    font-family: inherit;
}

/* ════════════════════════════════════════
   Views
════════════════════════════════════════ */
.view-section {
    animation: fadeUp .3s ease;
}

.view-section.hidden {
    display: none;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ════════════════════════════════════════
   Loader
════════════════════════════════════════ */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 60px 0;
    color: var(--text-2);
    font-size: 13px;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--border);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin .9s linear infinite;
}

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

/* ════════════════════════════════════════
   Home Dashboard Redesign
════════════════════════════════════════ */

/* Hero Banner */
.hero-banner {
    position: relative;
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-hover) 100%);
    color: white;
    border-radius: var(--radius);
    padding: 32px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
    backdrop-filter: blur(4px);
}

.hero-badge .pulse {
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, .8);
}

.hero-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
}

.hero-icon-wrap {
    position: absolute;
    right: 40px;
    opacity: 0.15;
    transform: rotate(15deg);
    pointer-events: none;
}

/* Region Selector */
.region-selector-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    padding: 16px 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.region-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-2);
    font-weight: 600;
    font-size: 14px;
}

/* Fuel Cards Row */
.fuel-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.fuel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.fuel-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.fuel-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.fuel-petrol::before {
    background: var(--blue);
}

.fuel-diesel::before {
    background: var(--green);
}

.fuel-kerosene::before {
    background: var(--amber);
}

.fuel-card-top {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.fuel-icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.petrol-circle {
    background: var(--blue-light);
    color: var(--blue);
}

.diesel-circle {
    background: var(--green-light);
    color: var(--green);
}

.kero-circle {
    background: #fef3c7;
    color: var(--amber);
}

.fuel-label-group {
    display: flex;
    flex-direction: column;
}

.fuel-type-label {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-1);
}

.fuel-type-sub {
    font-size: 12px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fuel-price-display {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 4px;
}

.fuel-currency {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-2);
}

.fuel-amount {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-1);
    letter-spacing: -0.02em;
}

.fuel-unit {
    font-size: 13px;
    color: var(--text-3);
    margin-bottom: 24px;
}

.fuel-card-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 6px;
    width: fit-content;
}

.petrol-footer {
    background: var(--blue-light);
    color: var(--blue);
}

.diesel-footer {
    background: var(--green-light);
    color: var(--green);
}

.kero-footer {
    background: #fef3c7;
    color: var(--amber);
}

/* Info Strip */
.info-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 24px;
    box-shadow: var(--shadow-sm);
}

.info-strip-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-2);
}

.info-link {
    color: var(--blue);
    font-weight: 600;
    text-decoration: none;
}

.info-link:hover {
    text-decoration: underline;
}

.cta-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--blue);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

.cta-btn:hover {
    background: var(--blue-hover);
}

.show-more-wrap {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.show-more-btn {
    width: 100%;
    padding: 8px 0;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--blue);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.show-more-btn:hover {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

@media (max-width: 768px) {

    /* Show hamburger */
    .mobile-menu-btn {
        display: flex;
    }

    /* Slide sidebar off-screen by default */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        transform: translateX(-100%);
        box-shadow: var(--shadow-md);
    }

    /* Open state */
    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    /* Show overlay when open */
    .sidebar-overlay {
        display: block;
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: all;
    }

    /* Rankings stack vertically */
    .rankings-grid {
        grid-template-columns: 1fr;
    }

    /* Stats grid: 1 column */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Reduce padding */
    .scrollable-content {
        padding: 16px 12px 32px;
    }

    .topbar {
        padding: 0 16px;
    }

    /* Chart smaller */
    .chart-container {
        height: 280px;
        padding: 16px;
    }

    /* Table font smaller on very small screens */
    td,
    th {
        padding: 10px 14px;
    }

    .stat-value {
        font-size: 22px;
    }

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

    .premium-select {
        width: 100%;
        min-width: unset;
    }

    .search-input {
        width: 100%;
    }

    .card-header-search {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-wrap {
        width: 100%;
    }

    .search-input {
        width: 100%;
    }

    /* New Home Redesign Responsiveness */
    .fuel-row {
        grid-template-columns: 1fr;
    }

    .hero-banner {
        padding: 24px;
        text-align: left;
    }

    .hero-title {
        font-size: 24px;
    }

    .info-strip {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
        text-align: center;
    }

    .cta-btn {
        justify-content: center;
    }

    .hide-mobile {
        display: none;
    }
}

/* ════════════════════════════════════════
   Tablet (769 – 1024px)
════════════════════════════════════════ */
@media (min-width: 769px) and (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .scrollable-content {
        padding: 20px;
    }
}

/* ════════════════════════════════════════
   Dark Mode Overrides
   ════════════════════════════════════════ */
body.dark-mode {
    --bg-app: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-card: #1e293b;
    --border: #334155;

    --text-1: #f8fafc;
    --text-2: #cbd5e1;
    --text-3: #64748b;

    --blue-light: #1e1b4b;
    --blue-mid: #312e81;

    --green-light: #064e3b;
    --red-light: #7f1d1d;
}

/* ════════════════════════════════════════
   Settings Dropdown Styles
   ════════════════════════════════════════ */
.settings-dropdown {
    position: relative;
    display: inline-block;
    margin-left: 12px;
}

.settings-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-2);
    cursor: pointer;
    transition: all 0.2s;
}

.settings-toggle-btn:hover {
    color: var(--blue);
    background: var(--blue-light);
    border-color: var(--blue-mid);
}

.settings-menu {
    display: none;
    position: absolute;
    top: 44px;
    right: 0;
    width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    padding: 6px 0;
    animation: dropdownFadeIn 0.2s ease;
}

.settings-menu.show {
    display: block;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.settings-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    color: var(--text-2);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.settings-item:hover {
    background: var(--bg-app);
    color: var(--text-1);
}

.settings-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.settings-item span.theme-icon,
.settings-item span.lang-icon {
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Ensure chart grid lines and tooltips look good in dark mode */
body.dark-mode .ts-wrapper.single .ts-control {
    background-color: var(--bg-card) !important;
    color: var(--text-1) !important;
    border-color: var(--border) !important;
}

body.dark-mode .ts-dropdown {
    background-color: var(--bg-card) !important;
    color: var(--text-1) !important;
    border-color: var(--border) !important;
}

body.dark-mode .ts-dropdown .option {
    color: var(--text-1) !important;
}

body.dark-mode .ts-dropdown .active {
    background-color: var(--blue-light) !important;
    color: var(--text-1) !important;
}