﻿/*
 * تنبيه مهم للمطورين والذكاء الاصطناعي: يرجى الحفاظ على اتجاه RTL وتنسيق اللغة العربية عند تعديل الأنماط.
 */
/* Notification Modal Styles */
.notif-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    display: flex;
    align-items: flex-end;
    /* Bottom sheet on mobile */
    justify-content: center;
}

.notif-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

.notif-modal {
    background: #fff;
    width: 100%;
    max-width: 500px;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
}

.notif-backdrop.visible .notif-modal {
    transform: translateY(0);
}

@media (min-width: 768px) {
    .notif-backdrop {
        align-items: center;
        /* Center on desktop */
    }

    .notif-modal {
        border-radius: 20px;
        width: 400px;
    }
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.notif-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
}

.notif-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
}

.notif-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    border-bottom: 1px solid #f9f9f9;
}

.notif-option:last-child {
    border-bottom: none;
}

.notif-label {
    display: flex;
    flex-direction: column;
}

.notif-title {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.notif-desc {
    font-size: 0.85rem;
    color: #888;
}

/* Custom Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #d4af37;
    /* Gold */
}

input:checked+.slider:before {
    transform: translateX(22px);
}

.notif-actions {
    margin-top: 20px;
}

.btn-save-notif {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #d4af37, #aa8a2e);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
}

.btn-save-notif:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

:root {
    --primary-gold: #D4AF37;
    --primary-silver: #C0C0C0;
    --bg-dark: #0f1115;
    --bg-card: rgba(30, 34, 45, 0.6);
    --text-main: #ffffff;
    --text-muted: #8b9bb4;
    --success: #00fa9a;
    --danger: #ff4d4d;
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-heading: 'Cairo', sans-serif;
    --font-body: 'Cairo', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

/* 
 * FORCE SINGLE SCROLLBAR POLICY (Nuclear Reset)
 * Ensures only one vertical scrollbar exists, owned by the root html element.
 */
html {
    overflow-x: clip !important;
    /* Stricter than hidden, prevents all jitter */
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    scroll-behavior: smooth;
}

body {
    overflow-x: clip !important;
    overflow-y: visible !important;
    min-height: 100vh !important;
    height: auto !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(212, 175, 55, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(192, 192, 192, 0.05) 0%, transparent 20%);
}

/* Ensure no high-level wrappers hijack scrolling */
.app-container,
.gold-dashboard {
    overflow: visible !important;
    height: auto !important;
    min-height: 0 !important;
}

/* WordPress Admin Bar Compatibility */
html.admin-bar {
    margin-top: 32px !important;
}

@media screen and (max-width: 782px) {
    html.admin-bar {
        margin-top: 46px !important;
    }
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
}

.pwa-banner {
    display: none;
    position: sticky;
    top: 0;
    z-index: 1200;
    background: var(--primary-gold);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    color: #0f1115;
    padding: 8px 16px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
}

.pwa-banner.pwa-visible {
    display: flex;
}

.pwa-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pwa-actions #pwa-banner-close {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.3);
    color: #0b0c10;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

/* Glassmorphism Utility */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    margin-bottom: 30px;
    width: 100%;
    box-sizing: border-box;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.gold-icon {
    font-size: 2rem;
    color: var(--primary-gold);
    animation: shine 3s infinite;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Cairo', sans-serif !important;
}

.seo-panel h2,
.chart-section h3,
.ticker-section h3,
.news-section h3,
.zakat-section .zakat-header h3,
.making-section h3,
.syndicate-section h3,
.portfolio-section h2,
.portfolio-section h3,
.portfolio-section h4 {
    font-family: 'Cairo', sans-serif !important;
    font-size: clamp(1.45rem, 2.4vw, 1.9rem);
    font-weight: 700;
    color: #ffffff;
}

.zakat-panel h4,
.making-section h4 {
    font-family: 'Cairo', sans-serif !important;
    font-size: clamp(1.15rem, 2vw, 1.5rem);
    font-weight: 600;
    color: #ffffff;
}

body.light-theme .seo-panel h2,
body.light-theme .chart-section h3,
body.light-theme .ticker-section h3,
body.light-theme .news-section h3,
body.light-theme .zakat-section .zakat-header h3,
body.light-theme .making-section h3,
body.light-theme .zakat-panel h4,
body.light-theme .making-section h4 {
    color: var(--primary-gold);
}

.highlight {
    color: var(--primary-gold);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--success);
    width: 100%;
    justify-content: space-between;
    flex-wrap: nowrap;
    position: relative;
}

.status-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-text-container {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.status-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

#fcm-toggle-btn.active {
    color: var(--primary-gold);
    border-color: rgba(212, 175, 55, 0.4);
    background: rgba(212, 175, 55, 0.1);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

.theme-toggle.pressing {
    animation: pulse-fast 0.8s infinite;
    border-color: var(--primary-gold);
    background: rgba(212, 175, 55, 0.3);
}

@keyframes pulse-fast {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Pulse Animation for Active Status */
.fa-bell.status-pulse {
    animation: pulse-gentle 2s infinite ease-in-out;
}

@keyframes pulse-gentle {
    0% {
        transform: scale(1);
        opacity: 1;
        text-shadow: 0 0 0 rgba(212, 175, 55, 0);
    }

    50% {
        transform: scale(1.15);
        opacity: 1;
        text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
    }

    100% {
        transform: scale(1);
        opacity: 1;
        text-shadow: 0 0 0 rgba(212, 175, 55, 0);
    }
}

.byline {
    font-size: 0.75rem;
    opacity: 0.8;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.byline-link {
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.byline-link:hover .byline {
    opacity: 1;
    color: var(--primary-gold);
}

.byline-link i {
    margin-left: 5px;
}

.quick-menu {
    margin: 20px 0;
    padding: 14px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x mandatory;
    border-radius: 16px;
    min-height: 72px;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: padding 0.3s ease, min-height 0.3s ease;
}

.quick-menu::-webkit-scrollbar {
    display: none;
}

.quick-menu-btn {
    scroll-snap-align: start;
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
    color: var(--text-main);
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease, border 0.2s ease;
    user-select: none;
}

.quick-menu-btn:hover,
.quick-menu-btn:focus-visible {
    transform: translateY(-2px);
    background: rgba(212, 175, 55, 0.12);
    border-color: rgba(212, 175, 55, 0.5);
}

.quick-menu-btn:first-child {
    margin-right: 6px;
    margin-inline-start: 6px;
}

.quick-menu-btn:last-child {
    margin-left: 6px;
    margin-inline-end: 6px;
}

@media (max-width: 768px) {
    .quick-menu.glass-panel {
        /* Remove container box for a cleaner "tabs" look */
        background: transparent;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        margin: 12px 0 20px 0;
        padding: 6px 6px;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
    }

    .quick-menu {
        flex-wrap: nowrap;
        gap: 8px;
        scroll-padding: 0 20px;
        max-width: 100%;
        overflow-x: auto;
        padding-top: 12px;
        padding-bottom: 12px;
        min-height: 60px;
    }

    .quick-menu-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
        background: rgba(30, 34, 45, 0.6);
        /* Give buttons their own glass bg */
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border: 1px solid var(--glass-border);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    body.light-theme .quick-menu-btn {
        background: rgba(255, 255, 255, 0.9);
        border-color: rgba(0, 0, 0, 0.08);
        color: var(--text-main);
    }

    .quick-menu-btn.active {
        background: var(--primary-gold);
        color: #000;
        border-color: var(--primary-gold);
        font-weight: 700;
    }
}

.zakat-section {
    margin-top: 24px;
    padding: 18px;
}

.zakat-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    align-items: stretch;
}

.zakat-panel {
    min-width: 0;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 18px;
    padding: 20px;
    border: 1px solid var(--glass-border);
}

.zakat-panel h4 {
    margin-top: 0;
    margin-bottom: 8px;
}

.zakat-calculator {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 14px;
    padding: 18px;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.zakat-calculator h4 {
    margin: 0;
    font-size: 1.15rem;
}

.zakat-header h3 {
    margin-bottom: 10px;
}

.zakat-header p {
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.zakat-header a {
    color: var(--primary-gold);
    text-decoration: none;
}

.zakat-header a:hover {
    text-decoration: underline;
}

.zakat-notes {
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.zakat-notes ul {
    margin: 8px 0 0.5rem;
    padding-left: 18px;
    color: var(--text-muted);
}

.zakat-table-head,
.zakat-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 8px;
    padding: 6px 0;
    color: var(--text-main);
    font-size: 0.9rem;
    align-items: center;
}

.zakat-table-head {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.zakat-row {
    border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.zakat-row span:nth-child(2),
.zakat-row span:nth-child(3) {
    font-family: var(--font-heading);
    font-size: 1rem;
}

.zakat-row span:nth-child(3) {
    color: var(--primary-gold);
}

.zakat-footer {
    margin-top: 14px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.zakat-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    align-items: end;
    width: 100%;
    justify-items: stretch;
}

.zakat-form .form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    width: 100%;
}

.zakat-form label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.zakat-form input,
.zakat-form select,
.making-form input,
.making-form select,
.portfolio-form input,
.portfolio-form select,
.portfolio-form textarea,
.portfolio-filters input,
.portfolio-filters select {
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-main);
    padding: 8px 12px;
    font-size: 0.9rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif !important;
}

button,
.quick-menu-btn {
    font-family: 'Cairo', sans-serif !important;
}

/* Stack fields vertically in the \"احتساب الذهب المضاف\" panel to avoid overlap */
.zakat-columns>.zakat-panel:nth-of-type(2) .zakat-form {
    grid-template-columns: 1fr;
}

.zakat-form input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

body:not(.light-theme) .zakat-form input,
body:not(.light-theme) .zakat-form select {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

body:not(.light-theme) .zakat-form input::placeholder {
    color: rgba(255, 255, 255, 0.75);
}

body.light-theme .zakat-form input,
body.light-theme .zakat-form select {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.15);
    color: #0b0c10;
}

body.light-theme .zakat-form input::placeholder {
    color: rgba(0, 0, 0, 0.45);
}

.zakat-entries {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
}

.entries-header,
.entry-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 6px;
    padding: 8px 10px;
    font-size: 0.85rem;
}

.entries-header {
    background: rgba(255, 255, 255, 0.03);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.empty-entry {
    padding: 14px;
    text-align: center;
    color: var(--text-muted);
}

.entry-row {
    background: rgba(255, 255, 255, 0.04);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.entry-row span {
    font-size: 0.9rem;
    color: var(--text-main);
}

.calc-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
    margin-bottom: 12px;
}

.quick-menu-btn.secondary {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--text-main);
}

body.light-theme .calc-actions .quick-menu-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #0b0c10;
    border-color: rgba(0, 0, 0, 0.25);
}

body.light-theme .calc-actions .quick-menu-btn.secondary {
    background: transparent;
    border-color: rgba(0, 0, 0, 0.2);
}

#add-gold-btn {
    margin-bottom: 5px;
}

body.light-theme #add-gold-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #0b0c10;
    border-color: rgba(0, 0, 0, 0.25);
}

.calc-helper {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.calc-results {
    display: grid;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1px;
}

.calc-result-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-main);
}

.calc-status {
    font-size: 0.85rem;
    color: var(--primary-gold);
}

@media (max-width: 900px) {
    .zakat-body {
        flex-direction: column;
    }
}

/* Header CTA as Facebook promo */
.fb-cta {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-main);
    width: auto;
    justify-content: flex-end;
    flex-direction: row-reverse;
}

.fb-cta * {
    text-decoration: none !important;
    color: inherit;
}

.fb-cta-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    gap: 2px;
}

.fb-cta-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.fb-cta-sub {
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 500;
}

.fb-cta-join,
.fb-cta-link {
    font-size: 0.82rem;
    color: var(--primary-gold) !important;
    font-weight: 600;
    text-decoration: none !important;
    display: inline-block;
}

.fb-cta-join:link,
.fb-cta-join:visited,
.fb-cta-link:link,
.fb-cta-link:visited {
    color: var(--primary-gold) !important;
    text-decoration: none !important;
}

.fb-cta-join:hover,
.fb-cta-link:hover {
    color: #f1d36a;
    text-decoration: underline;
}

.fb-cta a {
    color: var(--primary-gold) !important;
    text-decoration: none !important;
    font-weight: 600;
}

/* Facebook Banner */
.fb-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    margin-bottom: 20px;
    justify-content: flex-start;
}

.fb-icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
    box-shadow: 0 10px 24px rgba(212, 175, 55, 0.25);
}

.fb-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fb-title {
    font-weight: 700;
    font-size: 1.05rem;
}

.fb-link {
    color: var(--primary-gold);
    font-size: 0.9rem;
    text-decoration: none;
}

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

.promo-section {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 12px;
    padding: 14px;
    margin-bottom: 24px;
}

.promo-card {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
    height: 220px;
    display: block;
    padding: 8px;
}

.promo-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.04), transparent 35%), rgba(0, 0, 0, 0.2);
    transition: transform 0.4s ease, filter 0.3s ease;
}

.promo-card:hover img {
    transform: scale(1.02);
    filter: brightness(1.05);
}

@media (max-width: 900px) {
    .promo-section {
        grid-template-columns: 1fr;
    }

    .promo-card {
        height: 180px;
    }
}

@media (max-width: 640px) {
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .chart-controls {
        width: 100%;
        justify-content: flex-start;
    }
}

.seo-panel {
    padding: 14px 18px;
    margin-bottom: 16px;
}

.seo-panel h2 {
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.seo-panel p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
}

.pulse {
    animation: pulse 2s infinite;
}

/* Controls */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
    margin-bottom: 30px;
    justify-content: space-around;
    align-items: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.making-section {
    margin-top: 28px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.making-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-top: 5px;
    /* Added spacing */
    margin-top: 10px;
    /* Added spacing */
}

.making-header h3 {
    margin: 0 0 6px 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.making-header p {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

.making-icon {
    font-size: 1.8rem;
    /* Slightly smaller */
    color: var(--primary-gold);
    margin-top: 2px;
}

.making-insights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.insight-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.insight-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(212, 175, 55, 0.12);
    color: var(--primary-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.insight-body h4 {
    margin-bottom: 6px;
    font-size: 1rem;
    color: var(--text-main);
}

.insight-body p {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.making-calculator {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
    align-items: flex-start;
}

.making-calculator>* {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.making-form {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.making-form input,
.making-form select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.making-actions {
    display: flex;
    gap: 10px;
}

.making-note {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.making-results {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.making-summary {
    border-radius: 12px;
    padding: 14px;
    font-weight: 600;
    line-height: 1.5;
    background: rgba(255, 255, 255, 0.05);
}

.making-alert {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.9rem;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.making-alert.secondary {
    margin-top: -4px;
}

.making-alert.alert-positive {
    border-color: rgba(46, 204, 113, 0.45);
    background: rgba(46, 204, 113, 0.08);
    color: #c8f7dc;
}

.making-alert.alert-warn {
    border-color: rgba(255, 193, 7, 0.5);
    background: rgba(255, 193, 7, 0.1);
    color: #ffe9b3;
}

.making-alert.alert-negative {
    border-color: rgba(255, 82, 82, 0.6);
    background: rgba(255, 82, 82, 0.12);
    color: #ffd4d4;
}

.making-summary.status-low {
    border: 1px solid rgba(0, 170, 120, 0.4);
    background: rgba(0, 170, 120, 0.08);
    color: #16c784;
}

.making-summary.status-mid {
    border: 1px solid rgba(255, 193, 7, 0.4);
    background: rgba(255, 193, 7, 0.08);
    color: #f0c418;
}

.making-summary.status-high {
    border: 1px solid rgba(255, 77, 77, 0.5);
    background: rgba(255, 77, 77, 0.08);
    color: #ff7373;
}

.making-summary.status-alert {
    border: 1px solid rgba(255, 127, 17, 0.5);
    background: rgba(255, 127, 17, 0.1);
    color: #ffb347;
}

.secondary-table {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.86rem;
    color: var(--text-muted);
}

.secondary-table .making-table-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    line-height: 1.4;
}

.secondary-table .making-table-row span {
    color: var(--text-muted);
}

.secondary-table .making-table-row strong {
    color: var(--text-main);
    font-size: 0.95rem;
}

.ratio-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ratio-reset-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ratio-reset-btn:hover {
    background: var(--primary-gold);
    border-color: var(--primary-gold);
    transform: rotate(-15deg);
}

.making-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    width: fit-content;
}

.making-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28c76f;
}

.making-badge.badge-alert {
    background: rgba(255, 77, 77, 0.15);
    color: #ff9f9f;
}

.making-badge.badge-alert::before {
    background: #ff4d4d;
}

.making-gauge {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.3s ease;
}

.making-gauge-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.making-gauge-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.making-gauge-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-main);
}

.making-gauge-track {
    position: relative;
    height: 26px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    margin-top: 6px;
}

.making-gauge-meter {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.making-gauge-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.making-gauge-mid {
    position: absolute;
    left: 50%;
    top: -6px;
    bottom: -6px;
    width: 3px;
    background: rgba(255, 255, 255, 0.45);
    transform: translateX(-50%);
    z-index: 2;
}

.making-gauge-pointer {
    position: absolute;
    top: 50%;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    background: #f7d046;
    box-shadow: 0 0 10px rgba(247, 208, 70, 0.6);
    transform: translate(-50%, -50%);
    z-index: 4;
    transition: left 0.5s ease, transform 0.3s ease;
}

.making-gauge-mid-dot {
    position: absolute;
    left: 50%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.25);
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    animation: referencePulse 2s ease-in-out infinite;
}

.making-gauge-mid-dot::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: #ffffff;
}

.making-gauge-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
    transition: width 0.6s ease;
    z-index: 2;
}

.making-gauge-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-muted);
    gap: 10px;
    flex-wrap: wrap;
}

.making-indicator-card {
    margin-top: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(255, 255, 255, 0.02);
    transition: border-color 0.3s ease, background 0.3s ease;
}

.making-indicator-card.trend-up {
    border-color: rgba(255, 99, 132, 0.45);
    background: rgba(255, 99, 132, 0.08);
}

.making-indicator-card.trend-down {
    border-color: rgba(46, 204, 113, 0.35);
    background: rgba(46, 204, 113, 0.08);
}

.indicator-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.indicator-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.indicator-row strong {
    font-size: 1rem;
    color: var(--text-main);
}

.indicator-row.highlight strong {
    color: var(--primary-gold);
}

.indicator-row strong.trend-up {
    color: #27ae60;
}

.indicator-row strong.trend-down {
    color: #ff6b6b;
}

.indicator-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.indicator-label {
    font-size: 0.9rem;
    color: var(--text-main);
}

.indicator-info small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.indicator-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    padding-top: 6px;
}

.making-gauge-legend {
    margin-top: 12px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 12px;
}

.gauge-marker {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 180px;
}

.marker-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.25);
    align-self: center;
}

.marker-dot.reference {
    animation: referencePulse 2s ease-in-out infinite;
}

.marker-dot.live {
    background: var(--primary-gold);
    border-color: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.7);
}

.marker-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.marker-text strong {
    font-size: 0.95rem;
}

.marker-text small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.making-gauge.status-mid {
    border-color: rgba(255, 193, 7, 0.35);
}

.making-gauge.status-high,
.making-gauge.status-alert {
    border-color: rgba(255, 77, 77, 0.4);
}

.making-gauge.status-low {
    border-color: rgba(46, 204, 113, 0.35);
}

@keyframes referencePulse {
    0% {
        opacity: 0.4;
        transform: translate(-50%, -2px) scale(1);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, -2px) scale(1.15);
    }

    100% {
        opacity: 0.4;
        transform: translate(-50%, -2px) scale(1);
    }
}

@media (max-width: 640px) {
    .making-gauge-legend {
        flex-direction: column;
    }
}

@media (max-width: 900px) {
    .making-calculator {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .making-insights {
        grid-template-columns: 1fr;
    }

    .making-actions {
        flex-wrap: wrap;
    }
}

body.light-theme .making-form,
body.light-theme .making-results,
body.light-theme .insight-card {
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .secondary-table {
    border-color: rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
}

body.light-theme .making-note {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.12);
}

body.light-theme .making-summary {
    background: rgba(0, 0, 0, 0.03);
}

body.light-theme .making-gauge {
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .making-gauge-track {
    background: rgba(0, 0, 0, 0.06);
}

body.light-theme .making-gauge-mid {
    background: rgba(0, 0, 0, 0.28);
}

body.light-theme .making-gauge-pointer {
    border-color: rgba(0, 0, 0, 0.2);
}

body.light-theme .making-gauge-meter,
body.light-theme .making-gauge-scale {
    color: #334;
}

body.light-theme .making-alert {
    border-color: rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
    color: rgba(0, 0, 0, 0.75);
}

body.light-theme .making-alert.alert-positive {
    border-color: rgba(46, 204, 113, 0.4);
    background: rgba(46, 204, 113, 0.15);
    color: #0b4c2f;
}

body.light-theme .making-alert.alert-warn {
    border-color: rgba(255, 193, 7, 0.6);
    background: rgba(255, 193, 7, 0.18);
    color: #6a4b00;
}

body.light-theme .making-alert.alert-negative {
    border-color: rgba(255, 77, 77, 0.6);
    background: rgba(255, 77, 77, 0.18);
    color: #721818;
}

body.light-theme .making-gauge-scale {
    color: rgba(0, 0, 0, 0.6);
}

body.light-theme .making-indicator-card {
    border-color: rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.02);
}

body.light-theme .making-indicator-card.trend-up {
    background: rgba(255, 99, 132, 0.12);
}

body.light-theme .making-indicator-card.trend-down {
    background: rgba(46, 204, 113, 0.12);
}

/* Global form fields styling (dark theme) */
.gold-dashboard input[type="text"],
.gold-dashboard input[type="number"],
.gold-dashboard input[type="date"],
.gold-dashboard input[type="email"],
.gold-dashboard input[type="search"],
.gold-dashboard input[type="url"],
.gold-dashboard textarea,
.gold-dashboard select {
    background: rgba(20, 22, 30, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: var(--text-main);
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.gold-dashboard input::placeholder,
.gold-dashboard textarea::placeholder {
    color: rgba(255, 255, 255, 0.65);
}

.gold-dashboard input:focus,
.gold-dashboard textarea:focus,
.gold-dashboard select:focus {
    outline: none;
    border-color: rgba(212, 175, 55, 0.7);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
    background: rgba(20, 22, 30, 0.9);
}

.gold-dashboard input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.9);
}

.gold-dashboard input[type="checkbox"],
.gold-dashboard input[type="radio"] {
    background: #0f1115;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Light theme overrides for global form fields */
body.light-theme.gold-dashboard input[type="text"],
body.light-theme.gold-dashboard input[type="number"],
body.light-theme.gold-dashboard input[type="date"],
body.light-theme.gold-dashboard input[type="email"],
body.light-theme.gold-dashboard input[type="search"],
body.light-theme.gold-dashboard input[type="url"],
body.light-theme.gold-dashboard textarea,
body.light-theme.gold-dashboard select {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #0b0c10;
}

body.light-theme.gold-dashboard input::placeholder,
body.light-theme.gold-dashboard textarea::placeholder {
    color: rgba(0, 0, 0, 0.45);
}

body.light-theme.gold-dashboard input:focus,
body.light-theme.gold-dashboard textarea:focus,
body.light-theme.gold-dashboard select:focus {
    border-color: rgba(212, 175, 55, 0.7);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.25);
    background: #ffffff;
}

body.light-theme.gold-dashboard input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.05);
}

body.light-theme.gold-dashboard input[type="checkbox"],
body.light-theme.gold-dashboard input[type="radio"] {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.2);
}

.control-group label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 140px;
    height: 44px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 34px;
    transition: .4s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
    border: 1px solid var(--glass-border);
}

.toggle-label:before {
    position: absolute;
    content: "";
    height: 36px;
    width: 68px;
    left: 4px;
    bottom: 3px;
    background-color: var(--primary-gold);
    transition: .4s;
    border-radius: 30px;
    z-index: 1;
}

input:checked+.toggle-label:before {
    transform: translateX(64px);
}

.toggle-usd,
.toggle-jod {
    z-index: 2;
    flex: 1;
    text-align: center;
    font-weight: bold;
    font-family: var(--font-heading);
    color: #dfe4f2;
    transition: color 0.3s;
}

input:not(:checked)+.toggle-label .toggle-jod {
    color: #111;
}

input:checked+.toggle-label .toggle-usd {
    color: #111;
}

/* Select Box */
.premium-select {
    appearance: none;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 4px 24px 4px 12px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    cursor: pointer;
    min-width: 200px;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23D4AF37%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: left 12px top 50%;
    /* Adjusted for RTL */
    background-size: 12px;
    line-height: 1.3;
    min-height: 36px;
}

/* Prices Grid */
.prices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

@media (min-width: 1024px) {
    .prices-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.price-card {
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s;
}

.price-card:hover {
    transform: translateY(-5px);
}

.price-display-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.ratio-card {
    grid-column: span 1;
    padding: 15px 20px;
}

.ratio-card .card-header {
    margin-bottom: 8px;
}

@media (min-width: 1024px) {
    .ratio-card {
        grid-column: span 1;
    }
}

.ratio-main-display {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ratio-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 0;
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    width: 100%;
}

.ratio-stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
}

.ratio-stat-item .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ratio-stat-item strong {
    font-size: 1rem;
    color: var(--text-main);
}

.ratio-perf-bar-wrapper {
    margin: 0;
    padding: 2px 12px;
    width: 100%;
}

.ratio-perf-track {
    height: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    display: flex;
    overflow: hidden;
    margin-bottom: 6px;
}

.ratio-perf-fill {
    height: 100%;
    transition: width 2.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.ratio-perf-fill.gold {
    background: linear-gradient(90deg, #D4AF37, #F5D76E);
}

.ratio-perf-fill.silver {
    background: linear-gradient(90deg, #C0C0C0, #E5E4E2);
}

.ratio-perf-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ratio-scale-wrapper {
    margin: 2px 0;
    padding: 5px 0;
    width: 100%;
}

.ratio-scale-track-new {
    height: 12px;
    background: linear-gradient(to right, #D4AF37 0%, #ffffff 50%, #C0C0C0 100%);
    border-radius: 6px;
    position: relative;
    cursor: pointer;
}

.ratio-pointer-triangle {
    position: absolute;
    top: -8px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 15px solid #fff;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    transform: translateX(-50%);
    cursor: grab;
    transition: left 0.1s ease-out;
    z-index: 4;
}

.ratio-pointer-triangle.secondary {
    border-top-color: #C0C0C0;
    z-index: 5;
}

.ratio-pointer-triangle:active {
    cursor: grabbing;
}

.ratio-scale-labels-new {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.ratio-comparison-box {
    margin-top: 12px;
    padding: 12px;
    background: rgba(212, 175, 55, 0.08);
    border: 1px dashed rgba(212, 175, 55, 0.4);
    border-radius: 12px;
    display: flex;
    justify-content: center;
}

.comparison-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.comparison-header-row {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-main);
    background: rgba(212, 175, 55, 0.1);
    padding: 6px;
    border-radius: 6px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    font-weight: 600;
}

.comparison-main-row {
    display: flex;
    justify-content: center;
    gap: 24px;
    align-items: center;
}

.comparison-summary-row {
    text-align: right;
    border-top: 1px solid rgba(212, 175, 55, 0.15);
    padding-top: 10px;
    margin-top: 5px;
}

.comparison-summary {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-main);
}

.summary-highlight {
    font-weight: 700;
}

.summary-gold {
    color: var(--primary-gold);
}

.summary-silver {
    color: #C0C0C0;
}

.summary-gain {
    color: var(--success);
    font-weight: 800;
}

.comparison-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
}

.comparison-percentage {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-gold);
}

/* Simulation Editable Styles */
.sim-edit-icon {
    font-size: 0.7rem;
    color: var(--primary-gold);
    margin-right: 4px;
    opacity: 0.8;
}

#gold-sim-ref[contenteditable="true"] {
    outline: none;
    border-bottom: 1px dashed var(--primary-gold);
    padding: 0 4px;
    cursor: text;
    background: rgba(212, 175, 55, 0.05);
    border-radius: 4px;
    min-width: 60px;
    display: inline-block;
}

#gold-sim-ref[contenteditable="true"]:focus {
    background: rgba(212, 175, 55, 0.1);
    border-bottom-style: solid;
}

body.light-theme .ratio-comparison-box {
    background: rgba(212, 175, 55, 0.05);
    border-color: rgba(212, 175, 55, 0.2);
}

.pointer-hint {
    animation: pointerHintPulse 3s ease-in-out 1 forwards;
}

@keyframes pointerHintPulse {
    0% {
        transform: translateX(-50%) scale(1);
    }

    50% {
        transform: translateX(-50%) scale(1.3);
        filter: drop-shadow(0 0 8px #fff);
    }

    100% {
        transform: translateX(-50%) scale(1);
    }
}


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

.syndicate-header-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.syndicate-header-info .refresh-timer {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.card-header h2 {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.share-wrapper {
    margin-left: auto;
    position: relative;
    display: flex;
    align-items: center;
}

.emoji-share-trigger {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-share-trigger .card-icon {
    color: var(--primary-gold);
    font-size: 1.6rem;
    animation: sharePulse 2s ease-in-out infinite;
}

.silver-card .emoji-share-trigger .card-icon {
    color: #91c4ff;
}

.mood-selector {
    position: absolute;
    top: 42px;
    left: 0;
    transform: translateX(-70%);
    display: flex;
    gap: 6px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 6px;
    z-index: 11;
}

.mood-selector button {
    border: none;
    background: transparent;
    font-size: 1.3rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.mood-selector button:hover {
    transform: scale(1.2);
}

.share-menu {
    position: absolute;
    top: 42px;
    left: 0;
    transform: translateX(-70%);
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 8px;
    gap: 6px;
    z-index: 10;
    min-width: 160px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.share-menu[hidden] {
    display: none !important;
}

.mood-selector[hidden] {
    display: none !important;
}

.share-wrapper .share-menu,
.share-wrapper .mood-selector {
    right: auto;
}

@media (max-width: 640px) {

    .mood-selector,
    .share-menu {
        transform: translateX(-50%);
    }
}

.share-menu button {
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 4px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.share-menu button:hover {
    background: rgba(255, 255, 255, 0.08);
}

@keyframes sharePulse {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }

    50% {
        transform: scale(1.15);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.4;
    }
}

.card-icon {
    font-size: 1.5rem;
}

.gold-card .card-icon {
    color: var(--primary-gold);
}

.silver-card .card-icon {
    color: var(--primary-silver);
}

.price-value {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 0;
    letter-spacing: -1px;
}

.gold-card .price-value {
    color: var(--primary-gold);
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

.silver-card .price-value {
    color: var(--primary-silver);
    text-shadow: 0 0 20px rgba(192, 192, 192, 0.3);
}

.currency-symbol {
    font-size: 2rem;
    vertical-align: top;
    opacity: 0.8;
}

.price-change {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 700;
    position: relative;
    border: 2px solid transparent;
    background-clip: padding-box, border-box;
    background-origin: padding-box, border-box;
    /* Use a solid background for the inner part to ensure readability and fix the bleed-through */
    --inner-bg: #1e222d;
    background-image: linear-gradient(var(--inner-bg), var(--inner-bg)),
        conic-gradient(var(--primary-gold) var(--progress, 0%), transparent 0%);
    transition: transform 0.2s ease;
    color: #ffffff !important;
    /* Force white text to override global .positive/.negative rules */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

body.light-theme .price-change {
    --inner-bg: #f8f9fa;
    color: #000000 !important;
    text-shadow: none;
}

.positive {
    --indicator-color: var(--success);
}

.positive i {
    color: var(--success);
}

.negative {
    --indicator-color: var(--danger);
}

.negative i {
    color: var(--danger);
}

.exchange-rate-chip {
    display: inline-flex;
    margin-top: 8px;
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.exchange-rate-chip:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

/* Chart Section */
.chart-section {
    padding: 12px;
    min-height: 0;
    height: auto;
    margin-bottom: 16px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.chart-btn {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 10px;
    transition: all 0.3s;
}

.chart-btn.active,
.chart-btn:hover {
    background: var(--primary-gold);
    border-color: var(--primary-gold);
    color: #000;
}

.chart-container {
    height: 410px;
    width: 100%;
    min-height: 380px;
    margin-bottom: 6px;
}

.tradingview-widget-container,
#tradingview_chart {
    height: 410px;
    min-height: 380px;
    width: 100%;
}

#tradingview_chart iframe {
    height: 100% !important;
    width: 100% !important;
}

/* Market layout: chart + ticker board */
.market-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.ticker-section {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 485px;
    /* Matched to Chart height */
    min-height: 0;
}

.ticker-header h3 {
    margin: 0;
}

.ticker-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.tv-quotes-container {
    flex: 1;
    min-height: 0;
}

.tv-quotes-container .tradingview-widget-container,
.tv-quotes-container .tradingview-widget-container__widget {
    height: 100%;
}

/* Keep ticker block dark even in light theme */
.light-theme .ticker-section,
.light-theme .tv-quotes-container,
.light-theme .tradingview-widget-container,
.light-theme .tradingview-widget-container__widget {
    background: #0f1115 !important;
    color: #fff !important;
    border-radius: 12px;
}

.light-theme .ticker-header h3,
.light-theme .ticker-sub {
    color: #fff;
}

@media (max-width: 900px) {
    .market-layout {
        grid-template-columns: 1fr;
    }

    /* Reduce padding for minimal margins */
    .chart-section,
    .ticker-section {
        padding: 6px;
    }
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Animations */
@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

@keyframes shine {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }

    100% {
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .price-value {
        font-size: 2.5rem;
    }

    header {
        flex-direction: column;
        gap: 15px;
    }

    .status-indicator {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        gap: 8px;
        flex-wrap: nowrap;
        padding-bottom: 18px;
    }

    .status-indicator .byline {
        position: absolute;
        right: 0;
        bottom: 2px;
        font-size: 0.68rem;
        margin-left: 0;
    }

    .fb-cta {
        width: 100%;
        justify-content: space-between;
        flex-direction: row-reverse;
        gap: 10px;
    }

    .fb-cta-content {
        align-items: flex-end;
    }

    .fb-cta-title {
        font-size: 0.95rem;
    }

    .fb-cta-sub {
        font-size: 0.85rem;
    }

    .fb-cta-join,
    .fb-cta-link {
        font-size: 0.78rem;
        color: var(--primary-gold);
    }

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

    .toggle-switch {
        width: 100%;
    }

    input:checked+.toggle-label:before {
        transform: translateX(calc(100% - 4px));
        /* Native percentage transform */
    }

    /* Fix toggle on mobile simply */
    .toggle-switch {
        width: 100%;
    }

    .toggle-label:before {
        width: 50%;
    }

    input:checked+.toggle-label:before {
        transform: translateX(100%);
        width: 48%;
    }
}

/* Syndicate Table Styles */
.syndicate-section {
    margin-top: 20px;
}

.syndicate-section .card-header {
    padding: 12px 16px 8px;
    justify-content: space-between;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 15px;
}

.syndicate-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-primary);
    font-size: 1rem;
}

.syndicate-table th,
.syndicate-table td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.syndicate-table th {
    background-color: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--gold-primary);
}

.syndicate-table tbody tr:last-child td {
    border-bottom: none;
}

.syndicate-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.syndicate-table tfoot {
    border-top: 2px solid rgba(255, 215, 0, 0.2);
    font-weight: bold;
    background-color: rgba(0, 0, 0, 0.1);
}

.loading-text {
    font-style: italic;
    color: var(--text-secondary);
    padding: 20px;
}

.source-link {
    margin-top: 15px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: right;
    padding: 0 12px 10px;
}

.source-link a {
    color: var(--gold-primary);
    text-decoration: none;
}

.source-link a:hover {
    text-decoration: underline;
}

.refresh-timer {
    font-size: 0.8em;
    font-weight: normal;
    color: var(--text-secondary);
    margin-right: 10px;
}

/* Lira Row Styling */
.lira-row td {
    color: var(--gold-secondary);
}

.lira-label {
    text-align: right !important;
    padding-right: 20px !important;
}

/* Buy/Sell boxes for lira units */
.buy-sell-boxes {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    width: 100%;
}

.info-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-box .label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.info-box .value {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
}

.price-note {
    margin-top: 4px;
    font-size: 0.78rem;
    color: rgba(139, 155, 180, 0.8);
    text-align: center;
    font-style: italic;
}

.syndicate-compare {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 6px 0;
}

.syndicate-compare[hidden] {
    display: none !important;
}

.syndicate-compare .compare-note {
    flex: 1;
    padding-right: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.syndicate-compare-title {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: rgba(255, 255, 255, 0.92);
    text-align: right;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.syndicate-compare .compare-note-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: right;
}

.syndicate-history {
    margin-top: 18px;
    margin-bottom: 42px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 20px 22px;
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.25);
}

.syndicate-history-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
}

.syndicate-history-header p {
    margin: 4px 0 10px;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.3;
}

.syndicate-history-table {
    overflow-x: hidden;
    padding-top: 10px;
}

.syndicate-history-table table {
    width: 100%;
    border-collapse: separate;
    font-size: 0.78rem;
    table-layout: fixed;
    border-spacing: 12px 16px;
}

.syndicate-history-table th,
.syndicate-history-table td {
    padding: 4px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    vertical-align: middle;
}

.syndicate-history-table thead {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.syndicate-history-table th {
    font-size: 0.72rem;
    letter-spacing: 0.4px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
}

.syndicate-history-table td {
    color: rgba(255, 255, 255, 0.92);
}

.history-label {
    font-size: 0.65rem;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 2px;
    text-align: center;
    display: block;
}

.history-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    display: block;
    text-align: center;
}

.history-grade-cell {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 6px 10px;
    text-align: center;
    border: 1px solid transparent;
}

.history-grade-title {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.55);
    display: block;
    margin-bottom: 4px;
    text-align: center;
}

.history-grade-total {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 4px;
    text-align: center;
}

.history-grade-line {
    font-size: 0.8rem;
    line-height: 1.2;
    display: block;
    text-align: center;
}

.history-line-sale {
    color: rgba(255, 99, 132, 0.85);
}

.history-line-buy {
    color: rgba(0, 255, 127, 0.85);
}

.history-active-badge {
    margin-top: 6px;
    font-size: 0.65rem;
    padding: 2px 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.syndicate-history-table .empty-message {
    text-align: center;
    padding: 18px 0;
    color: rgba(255, 255, 255, 0.6);
}

@media (max-width: 900px) {
    .syndicate-history-table table {
        display: block;
    }

    .syndicate-history-table thead {
        display: none;
    }

    .syndicate-history-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .syndicate-history-table tbody tr {
        display: grid;
        grid-template-columns: 1fr;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 16px;
        padding: 12px;
        background: rgba(255, 255, 255, 0.03);
        gap: 4px;
        position: relative;
    }

    .syndicate-history-table tbody tr::after {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: 16px;
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
        pointer-events: none;
    }

    .syndicate-history-table tbody tr td {
        border: none;
        padding: 6px 0;
        text-align: center;
    }

    .syndicate-history-table .history-grade-cell {
        border: none;
    }
}

@media (min-width: 900px) {
    .syndicate-history-table table {
        max-width: 1100px;
        margin: 0 auto;
    }

    .syndicate-history-table td:nth-child(1),
    .syndicate-history-table td:nth-child(2) {
        width: 18%;
        min-width: 120px;
        max-width: 160px;
    }

    .syndicate-history-table td.history-grade-cell {
        min-width: 150px;
    }

    .syndicate-history-table tbody tr {
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.02);
    }

    .syndicate-history-table tbody tr:hover {
        background: rgba(255, 255, 255, 0.05);
    }
}

.syndicate-section {
    margin-bottom: 26px;
}

.syndicate-history-table td {
    text-align: center;
}

.history-grade-cell,
.history-value {
    text-align: center;
}

.history-grade-line {
    text-align: center;
}

body.light-theme .syndicate-history {
    background: #fff;
    border-color: #e4e4e4;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}

body.light-theme .syndicate-history-table {
    padding-top: 0;
}

body.light-theme .syndicate-history-table table {
    border-radius: 18px;
    border: 1px solid #ececec;
    background: #fff;
    border-spacing: 14px 18px;
}

body.light-theme .syndicate-history-table thead {
    border-color: #f0f0f0;
}

body.light-theme .syndicate-history-table td,
body.light-theme .syndicate-history-table th {
    color: #2c2c2c;
    border-bottom-color: #efefef;
}

body.light-theme .syndicate-history-table tbody tr {
    border-color: #dcdcdc;
    background: #fff;
}

body.light-theme .history-grade-cell {
    background: #fafafa;
    border-color: #ececec;
}

body.light-theme .history-grade-title {
    color: #6d6d6d;
}

body.light-theme .history-value {
    color: #1e1e1e;
}

body.light-theme .history-line-sale {
    color: #d32f2f;
}

body.light-theme .history-line-buy {
    color: #1b9e3d;
}

body.light-theme .syndicate-history-header h3,
body.light-theme .syndicate-history-header p {
    color: #3b3b3b;
}

body.light-theme .history-grade-total,
body.light-theme .history-grade-line {
    color: #2b2b2b;
}

body.light-theme .history-label {
    color: #6a6a6a;
}


body.light-theme .syndicate-history-table th,
body.light-theme .syndicate-history-table td {
    color: #2d2d2d;
}

.syndicate-compare .compare-values {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.compare-row {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 120px;
}

.compare-row span {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.compare-row strong {
    font-size: 1rem;
}

.syndicate-compare.compare-high .compare-row {
    border-color: rgba(255, 99, 132, 0.5);
    background: rgba(255, 99, 132, 0.08);
}

.syndicate-compare.compare-low .compare-row {
    border-color: rgba(46, 204, 113, 0.4);
    background: rgba(46, 204, 113, 0.08);
}

/* News Section */
.news-section {
    margin-top: 22px;
    padding: 18px;
}

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

.news-subtitle {
    margin: 0 0 12px 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.news-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.news-timer {
    font-size: 0.86rem;
    color: var(--text-muted);
}

.news-refresh-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.news-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(-6deg);
    border-color: rgba(255, 255, 255, 0.2);
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.news-pagination {
    margin-top: 18px;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.news-page-btn {
    min-width: 42px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border 0.2s ease, transform 0.2s ease;
}

.news-page-btn:hover,
.news-page-btn:focus-visible {
    border-color: rgba(212, 175, 55, 0.6);
    background: rgba(212, 175, 55, 0.12);
    transform: translateY(-1px);
}

.news-page-btn.active {
    background: rgba(212, 175, 55, 0.2);
    border-color: rgba(212, 175, 55, 0.8);
    color: #1d1b16;
}

.news-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.news-card {
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    overflow: hidden;
    display: block;
    padding: 14px;
}

.news-thumb {
    position: relative;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.12), rgba(0, 0, 0, 0.35));
}

.news-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.news-thumb.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    min-height: 130px;
}

.news-thumb.no-image i {
    font-size: 1.6rem;
    color: var(--primary-gold);
}

.news-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.news-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.4;
    text-decoration: none;
}

.news-title:hover {
    color: var(--primary-gold);
}

.news-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 0.88rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.news-source {
    color: var(--primary-gold);
    font-weight: 600;
}

.news-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 30px 0;
    font-style: italic;
}

.news-footnote {
    margin-top: 12px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.ad-banner {
    margin: 16px 0 22px 0;
    padding: 8px;
    display: flex;
    justify-content: center;
}

.ad-banner a {
    display: block;
    width: 100%;
    max-width: 820px;
}

.ad-banner img {
    width: 100%;
    display: block;
    border-radius: 12px;
    object-fit: contain;
    max-height: 260px;
}

@media (max-width: 640px) {
    .news-card {
        grid-template-columns: 1fr;
    }

    .news-thumb {
        height: 180px;
    }

    .news-grid {
        grid-template-columns: 1fr;
    }

    .news-pagination {
        justify-content: flex-start;
    }

    .ad-banner img {
        max-height: 180px;
    }

    .ad-banner a {
        max-width: 360px;
    }
}

/* Light theme overrides */
body.light-theme {
    --bg-dark: #f6f7fb;
    --bg-card: rgba(255, 255, 255, 0.9);
    --text-main: #0b0c10;
    --text-muted: #5c6475;
    --glass-border: rgba(0, 0, 0, 0.07);
    --success: #008f5c;
    --danger: #d13b3b;
}

body.light-theme .glass-panel {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

body.light-theme .toggle-label {
    background-color: rgba(0, 0, 0, 0.1);
    border-color: var(--glass-border);
}

body.light-theme .theme-toggle {
    background: rgba(0, 0, 0, 0.06);
    color: #222;
}

/* Toggle text visibility in light mode */
body.light-theme .toggle-usd,
body.light-theme .toggle-jod {
    color: #333;
}

body.light-theme input:not(:checked)+.toggle-label .toggle-jod,
body.light-theme input:checked+.toggle-label .toggle-usd {
    color: #111;
}

body.light-theme .quick-menu-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    border-color: rgba(0, 0, 0, 0.08);
    color: #0b0c10;
}

body.light-theme .quick-menu-btn.secondary {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(0, 0, 0, 0.15);
    color: #0b0c10;
}

body.light-theme .quick-menu-btn.tertiary {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    color: #0b0c10;
}

body.light-theme .quick-menu-btn.primary-cta {
    background: linear-gradient(135deg, #d4af37, #f1d36a);
    color: #0f1115;
    border: none;
}

@media (min-width: 901px) {
    .status-indicator {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 6px;
        width: auto;
        padding-bottom: 0;
    }

    .status-indicator .byline {
        position: static;
        margin-left: 0;
        font-size: 0.7rem;
    }
}

/* Portfolio Dashboard */
.portfolio-section {
    margin-top: 26px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

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

.portfolio-header h3 {
    margin: 0 0 6px 0;
    color: var(--text-main);
    font-weight: 700;
}

.portfolio-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.portfolio-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.portfolio-import-label {
    cursor: pointer;
}

.quick-menu-btn.tertiary {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-main);
}

.toggle-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.toggle-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: var(--success);
    box-shadow: 0 0 8px rgba(0, 250, 154, 0.4);
    transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.toggle-btn.is-hidden .toggle-indicator {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: none;
}

#toggle-reset-all {
    margin-inline-start: auto;
}

.quick-menu-btn.primary-cta {
    background: linear-gradient(135deg, #d4af37, #f1d36a);
    color: #0f1115;
    border: none;
    box-shadow: 0 10px 24px rgba(212, 175, 55, 0.25);
}

.quick-menu-btn.primary-cta:hover,
.quick-menu-btn.primary-cta:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(212, 175, 55, 0.32);
}

.portfolio-live-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.portfolio-mini-card {
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.12), rgba(255, 255, 255, 0.02));
}

.portfolio-mini-card.highlight {
    background: linear-gradient(135deg, rgba(0, 250, 154, 0.12), rgba(255, 255, 255, 0.04));
}

.mini-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.mini-value {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 4px 0;
}

.mini-sub {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.mini-sub strong {
    color: var(--text-main);
}

.portfolio-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px dashed var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
}

.notice-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(212, 175, 55, 0.16);
    color: var(--primary-gold);
    display: grid;
    place-items: center;
    font-size: 1.1rem;
}

.notice-text strong {
    display: block;
    margin-bottom: 4px;
}

.notice-text p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 12px;
}

.portfolio-grid .span-2 {
    grid-column: span 2;
}

.portfolio-grid .span-1 {
    grid-column: span 1;
}

.portfolio-card {
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.02);
}

.portfolio-card .card-header h4 {
    margin: 0;
    color: var(--text-main);
    font-weight: 700;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.stats-mode {
    display: inline-flex;
    gap: 10px;
    align-items: center;
}

.stats-mode label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    color: var(--text-muted);
    cursor: pointer;
}

.stats-mode input[type="radio"] {
    accent-color: var(--primary-gold);
    width: 16px;
    height: 16px;
}

.stats-note {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.portfolio-card .card-header small {
    color: var(--text-muted);
}

.portfolio-form .form-row,
.portfolio-filters label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.portfolio-form input,
.portfolio-form select,
.portfolio-form textarea,
.portfolio-filters input,
.portfolio-filters select {
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(20, 22, 30, 0.7);
    color: var(--text-main);
    padding: 11px 14px;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.portfolio-form input::placeholder,
.portfolio-form textarea::placeholder,
.portfolio-filters input::placeholder {
    color: rgba(255, 255, 255, 0.65);
}

.portfolio-form input:focus,
.portfolio-form select:focus,
.portfolio-form textarea:focus,
.portfolio-filters input:focus,
.portfolio-filters select:focus {
    outline: none;
    border-color: rgba(212, 175, 55, 0.7);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
    background: rgba(20, 22, 30, 0.9);
}

.portfolio-form input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.9);
}

.portfolio-form textarea {
    resize: vertical;
}

.portfolio-form .two-cols,
.portfolio-filters .two-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.sold-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.portfolio-stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.stat-pill.has-toggle .stat-pill-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.pill-toggle {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    border-radius: 8px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 700;
}

.ratio-pointer-triangle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    color: #fff;
    cursor: grab;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    transition: transform 0.2s ease;
}

.ratio-pointer-triangle:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.2);
}

.ratio-pointer-triangle::before {
    content: "\f0d7";
    /* FontAwesome Down Arrow */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 28px;
}

.stat-pill.has-toggle .stat-detail {
    display: none;
}

.stat-pill.has-toggle.open .stat-detail {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-main);
}

.stat-note {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

.stat-pill {
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.stat-pill span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.stat-pill strong {
    font-size: 1.1rem;
    color: var(--text-main);
}

.portfolio-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 12px;
}

.portfolio-charts.three-cols {
    grid-template-columns: 1fr;
}

.chart-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 12px 0;
    font-size: 0.9rem;
}

.portfolio-table-card {
    padding: 0;
}

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

.portfolio-table-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .portfolio-table-card .card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .portfolio-table-controls {
        justify-content: space-between;
        width: 100%;
    }
}

.table-responsive {
    overflow-x: auto;
}

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

.portfolio-table th,
.portfolio-table td {
    padding: 9px 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: nowrap;
}

.portfolio-table th {
    color: var(--text-main);
    font-weight: 700;
}

.portfolio-table th.sortable {
    color: var(--primary-gold);
    text-decoration: underline;
    text-decoration-color: rgba(212, 175, 55, 0.6);
    cursor: pointer;
}

.portfolio-table .sub {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.portfolio-table th:first-child,
.portfolio-table td:first-child {
    position: sticky;
    inset-inline-start: 0;
    z-index: 2;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 6px 0 12px rgba(0, 0, 0, 0.08);
}

.portfolio-table th:first-child {
    z-index: 3;
}

.portfolio-table-card .table-responsive {
    overflow-x: auto;
}

/* Custom Table Styles: Center All, Specific Fonts, Mobile Header */
.portfolio-table th:nth-child(9),
.portfolio-table td:nth-child(9) {
    text-align: right;
}

.portfolio-table td:nth-child(2),
.portfolio-table td:nth-child(4),
.portfolio-table td:nth-child(9) {
    font-size: 0.8rem;
    color: var(--text-muted);
}

@media (max-width: 720px) {
    .hide-mobile-text {
        display: none;
    }
}

.portfolio-table td.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 16px 0;
}

/* Light theme heading clarity */
body.light-theme .portfolio-header h3,
body.light-theme .portfolio-card .card-header h4,
body.light-theme .portfolio-table th {
    color: #0b0c10;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

@media (min-width: 992px) {
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.category-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

.cat-primary {
    flex: 1 1 50%;
    min-width: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.cat-secondary {
    flex: 1 1 50%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.1);
    min-height: 100%;
}

@media (min-width: 992px) {
    .cat-primary {
        flex: 1 1 33.333%;
    }

    .cat-secondary {
        flex: 2 1 66.666%;
        flex-direction: row;
        align-items: center;
        justify-content: space-around;
        gap: 12px;
    }
}

.category-card .cat-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    color: #f3d17a;
    font-size: 18px;
}

.category-card .cat-icon.cat-g24 {
    color: #f8e6a5;
}

.category-card .cat-icon.cat-g21 {
    color: #f1d48b;
}

.category-card .cat-icon.cat-g18 {
    color: #e4c178;
}

.category-card .cat-icon.cat-silver {
    color: #d0e5ff;
}

.category-card .cat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-card .cat-label {
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.95rem;
}

.category-card .cat-qty {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.category-card .cat-value-box {
    align-self: flex-start;
    margin-top: 2px;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    font-size: 0.8rem;
    line-height: 1.2;
}

.sec-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sec-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sec-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

body.light-theme .stat-pill {
    border-color: #e4e4e4;
    background: #fafafa;
    color: #1e1e1e;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
}

body.light-theme .stat-pill span,
body.light-theme .stat-pill strong {
    color: #1e1e1e;
}

body.light-theme .stat-pill.has-toggle.open .stat-detail {
    border-top-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .stat-detail .stat-row {
    color: #3a3a3a;
}

body.light-theme .category-card {
    background: #fbfbfb;
    border-color: #e8e8e8;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.035);
}

body.light-theme .category-card .cat-icon {
    background: rgba(0, 0, 0, 0.03);
}

body.light-theme .category-card .cat-label,
body.light-theme .category-card .cat-value-box {
    color: #1f1f1f;
}

body.light-theme .category-card .cat-value-box {
    background: #fff;
}

.category-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.55);
}

.category-modal[hidden] {
    display: none;
}

.category-modal-content {
    width: min(960px, 92vw);
    max-height: 80vh;
    overflow: auto;
    padding: 16px;
    border-radius: 16px;
    position: relative;
}

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

.category-modal .modal-header h4 {
    margin: 0;
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 700;
}

.category-modal .close-modal {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
}

/* Desktop layout tweaks for charts row */
@media (min-width: 992px) {
    .portfolio-charts.three-cols {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #pf-categories-card {
        grid-column: 1 / -1;
    }
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.08);
}

.badge-gold {
    background: rgba(212, 175, 55, 0.18);
    color: #f3d17a;
}

.badge-gold.badge-g24 {
    background: rgba(245, 215, 110, 0.22);
    color: #f8e6a5;
}

.badge-gold.badge-g21 {
    background: rgba(217, 182, 76, 0.22);
    color: #f1d48b;
}

.badge-gold.badge-g18 {
    background: rgba(184, 144, 58, 0.22);
    color: #e4c178;
}

.badge-gold.badge-base {
    background: rgba(229, 199, 92, 0.22);
    color: #f2da94;
}

.badge-silver {
    background: rgba(145, 196, 255, 0.18);
    color: #d0e5ff;
}

.status-pill {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-active {
    background: rgba(0, 250, 154, 0.12);
    color: var(--success);
}

.status-sold {
    background: rgba(255, 193, 7, 0.15);
    color: #ffd66b;
}

.table-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.link-btn {
    border: none;
    background: transparent;
    color: var(--primary-gold);
    cursor: pointer;
    font-weight: 600;
}

.link-btn.danger {
    color: #ff7b7b;
}

.positive {
    color: var(--success);
}

.negative {
    color: var(--danger);
}

.note-cell {
    max-width: 220px;
    word-break: break-word;
}

.collapsible-card {
    border: 1px solid var(--glass-border);
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    /* Allow wrapping for mobile */
}

.filter-header-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    flex: 1;
}

.filter-header-content h4 {
    margin: 0;
    white-space: nowrap;
}

/* Adjust stats-mode for header context */
.filter-header-content .stats-mode {
    background: rgba(255, 255, 255, 0.05);
    /* Subtle background pill */
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-header-content .stats-mode label {
    font-size: 0.82rem;
    color: var(--text-main);
    font-weight: 500;
}

.collapsible-toggle {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 700;
}

.collapsible-body {
    margin-top: 1px;
}

#pf-form-toggle {
    display: none;
}

@media (max-width: 768px) {
    #pf-form-toggle {
        display: inline-flex !important;
        margin-inline-start: 6px;
    }
}

.section-hidden {
    display: none !important;
}

.toggle-wrapper {
    position: relative;
}

/* Light theme overrides for portfolio inputs */
body.light-theme .portfolio-form input,
body.light-theme .portfolio-form select,
body.light-theme .portfolio-form textarea,
body.light-theme .portfolio-filters input,
body.light-theme .portfolio-filters select {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(0, 0, 0, 0.1);
    color: #0b0c10;
}

body.light-theme .portfolio-form input::placeholder,
body.light-theme .portfolio-form textarea::placeholder,
body.light-theme .portfolio-filters input::placeholder {
    color: rgba(0, 0, 0, 0.45);
}

body.light-theme .portfolio-form input:focus,
body.light-theme .portfolio-form select:focus,
body.light-theme .portfolio-form textarea:focus,
body.light-theme .portfolio-filters input:focus,
body.light-theme .portfolio-filters select:focus {
    border-color: rgba(212, 175, 55, 0.7);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.25);
    background: rgba(255, 255, 255, 1);
}

body.light-theme .portfolio-form input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.05);
}

@media (max-width: 720px) {
    .app-container {
        padding: 8px 6px;
        /* Minimal padding for mobile */
    }

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

    .portfolio-section {
        padding: 16px 12px !important;
    }

    .portfolio-live-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .portfolio-charts {
        grid-template-columns: 1fr;
    }
}

.toggle-wrapper {
    position: relative;
}

.section-hidden {
    display: none !important;
}

.block-toggle {
    position: absolute;
    top: 1px;
    inset-inline-end: 10px;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
    user-select: none;
    opacity: 0.35;
}

.block-toggle i {
    pointer-events: none;
}

.block-toggle:hover {
    color: var(--primary-gold);
    opacity: 1;
    transform: scale(1.05);
}

.toggle-wrapper:hover .block-toggle {
    opacity: 0.7;
}

/* 
 * Mobile Syndicate History Carousel 
 * Transform table to horizontal scroll cards on mobile
 */
.history-label {
    display: none;
}

@media (max-width: 768px) {
    .history-label {
        display: block;
        font-size: 0.75rem;
        color: var(--text-muted);
        margin-bottom: 2px;
    }

    .syndicate-history-table table,
    .syndicate-history-table thead,
    .syndicate-history-table tbody,
    .syndicate-history-table th,
    .syndicate-history-table td,
    .syndicate-history-table tr {
        display: block;
    }

    .syndicate-history-table thead {
        display: none;
    }

    .syndicate-history-table tbody {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 85%;
        overflow-x: auto;
        gap: 12px;
        padding-bottom: 25px;
        scroll-snap-type: x mandatory;
        scrollbar-width: thin;
        width: 100%;
        box-sizing: border-box;
        padding-left: 6px;
        padding-right: 6px;
    }

    /* Ensure scrollbar works but is subtle */
    .syndicate-history-table tbody::-webkit-scrollbar {
        height: 4px;
        display: block;
    }

    .syndicate-history-table tbody::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
        border-radius: 4px;
    }

    .syndicate-history-table tbody::-webkit-scrollbar-thumb {
        background: var(--primary-gold);
        border-radius: 4px;
    }

    .syndicate-history-table tr {
        width: 100%;
        border: 1px solid var(--glass-border);
        background: rgba(255, 255, 255, 0.03);
        border-radius: 14px;
        padding: 14px;
        scroll-snap-align: center;
        display: flex;
        flex-direction: column;
        gap: 8px;
        box-sizing: border-box;
    }

    body.light-theme .syndicate-history-table tr {
        background: rgba(255, 255, 255, 0.7);
        border: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    }

    .syndicate-history-table td {
        border: none;
        padding: 4px 0;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        text-align: right;
        width: 100%;
    }

    .syndicate-history-table td:first-child {
        position: static;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        padding-bottom: 8px;
        margin-bottom: 8px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    body.light-theme .syndicate-history-table td:first-child {
        border-bottom-color: rgba(0, 0, 0, 0.05);
    }

    .history-value {
        font-weight: 700;
        font-size: 1rem;
        color: var(--primary-gold);
    }

    .history-grade-cell {
        background: rgba(255, 255, 255, 0.03);
        border-radius: 8px;
        padding: 8px !important;
        margin-bottom: 4px;
    }

    body.light-theme .history-grade-cell {
        background: rgba(0, 0, 0, 0.03);
    }

    .history-grade-title {
        font-size: 0.8rem;
        color: var(--text-muted);
        display: block;
    }

    .history-grade-total {
        font-size: 1.1rem;
        font-weight: 700;
        color: var(--text-main);
        display: block;
        margin: 2px 0 6px 0;
    }

    .history-grade-line {
        display: flex;
        justify-content: space-between;
        width: 100%;
        font-size: 0.85rem;
        padding-top: 4px;
        border-top: 1px dashed rgba(255, 255, 255, 0.1);
    }

    body.light-theme .history-grade-line {
        border-top-color: rgba(0, 0, 0, 0.1);
    }

    .history-line-sale {
        color: var(--danger);
    }


    .history-active-badge {
        font-size: 0.7rem;
        padding: 4px 8px;
        border-radius: 6px;
        background: rgba(0, 250, 154, 0.15);
        color: var(--success);
        border: 1px solid rgba(0, 250, 154, 0.3);
    }
}

/* 
 * Mobile Header Optimization 
 * Sticky header and compact elements
 */
@media (max-width: 768px) {
    /* ... existing header styles ... */

    /* Mobile SEO Panel */
    .seo-panel.glass-panel {
        padding: 16px;
    }

    .seo-panel h2 {
        font-size: 1.1rem !important;
        margin-bottom: 8px;
    }

    .seo-panel p {
        font-size: 0.85rem;
        color: var(--text-muted);
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        line-clamp: 2;
        overflow: hidden;
        margin-bottom: 0;
    }

    /* Mobile Controls Touch Optimization */
    .controls-section {
        gap: 12px;
    }

    /* Make Currency Toggle larger */
    .toggle-switch {
        min-height: 44px;
        /* Apple recommendation */
        min-width: 140px;
    }

    .toggle-label {
        padding: 6px;
    }

    .toggle-label span {
        font-size: 1rem;
        line-height: 32px;
        /* Vertically center */
    }

    /* Select Inputs */
    .control-group label {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }

    .premium-select {
        height: 48px;
        /* Taller touch target */
        font-size: 1rem;
    }


    /* --- Header & Navigation (Restored) --- */
    header {
        position: relative;
        /* Unstuck */
        /* top: 0; */
        z-index: 1000;
        padding: 10px 16px;
        margin-bottom: 0;
        background: rgba(15, 17, 21, 0.9);
        /* Slightly more opaque due to more content */
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--glass-border);
        transition: padding 0.3s ease;
    }

    body.light-theme header {
        background: rgba(255, 255, 255, 0.9);
    }

    /* Logo & Facebook Section */
    .logo {
        gap: 10px;
    }

    .gold-icon {
        font-size: 1.6rem;
    }

    /* Restore Facebook Details */
    .fb-cta-title {
        font-size: 0.95rem;
    }

    .fb-cta-sub {
        display: block;
        font-size: 0.75rem;
        color: var(--text-muted);
        margin-top: 2px;
    }

    .fb-cta-join {
        display: block;
        font-size: 0.75rem;
        margin-top: 2px;
    }

    /* Status Section */
    .status-indicator {
        width: 100%;
        gap: 8px;
        flex-direction: column;
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .status-left {
        font-size: 0.75rem;
    }

    /* Restore Status Text */
    .status-left span#connection-status {
        display: inline;
    }

    /* Restore Byline */
    .byline {
        display: block;
        font-size: 0.65rem;
        margin-top: 2px;
    }

    .theme-toggle {
        width: 32px;
        height: 32px;
    }

    /* Mobile Sticky Quick Menu */
    .quick-menu.glass-panel {
        position: sticky;
        top: 0;
        z-index: 1001;
        background: rgba(15, 17, 21, 0.95);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        margin-bottom: 20px;
        border-bottom: 1px solid var(--glass-border);
        padding-top: 10px;
        padding-bottom: 10px;
        margin-top: 0;
    }

    body.light-theme .quick-menu.glass-panel {
        background: rgba(255, 255, 255, 0.95);
    }

    /* --- Price Cards Optimization --- */
    .prices-grid {
        gap: 16px;
        margin-bottom: 20px;
    }

    .price-card {
        padding: 18px 16px;
    }

    .card-header {
        margin-bottom: 12px;
    }

    .card-header h2 {
        font-size: 1.25rem;
    }

    .price-value {
        font-size: 2.6rem;
        margin-bottom: 6px;
    }

    .currency-symbol {
        font-size: 1.5rem;
    }

    /* Horizontal Buy/Sell Boxes (Side-by-Side) */
    .buy-sell-boxes {
        grid-template-columns: 1fr 1fr;
        /* Force 2 columns */
        gap: 10px;
        margin-top: 12px;
    }

    .info-box {
        padding: 8px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        text-align: right;
    }

    .info-box .label {
        font-size: 0.75rem;
        opacity: 0.8;
    }

    .info-box .value {
        font-size: 1.15rem;
    }

    .price-note {
        font-size: 0.72rem;
        margin-top: 8px;
    }

    /* Syndicate Compare Compact */
    .syndicate-compare {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 10px;
        align-items: stretch;
    }

    .syndicate-compare .compare-note {
        padding-right: 0;
        align-items: center;
        text-align: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        padding-bottom: 6px;
        margin-bottom: 2px;
    }

    .syndicate-compare-title {
        text-align: center;
        width: 100%;
    }

    .syndicate-compare .compare-note-text {
        text-align: center;
        width: 100%;
    }

    .compare-values {
        display: flex;
        justify-content: space-around;
        width: 100%;
    }

    /* --- Market Section Optimization --- */
    /* Reduce Chart Height to save space */
    .chart-container,
    .tradingview-widget-container,
    #tradingview_chart {
        height: 330px !important;
        min-height: 310px !important;
    }

    .chart-header {
        margin-bottom: 12px;
        flex-direction: row;
        flex-wrap: wrap;
        /* Allow wrapping */
        justify-content: space-between;
        align-items: center;
        text-align: right;
        gap: 8px;
        /* Gap for wrapped items */
    }

    .chart-header h3 {
        font-size: 1.3rem;
        /* Increased size as requested */
        margin: 0;
    }

    /* Ticker Optimization */
    .ticker-section {
        max-height: 550px;
        /* Increase mobile height to fit all rows without scroll */
        height: auto;
        display: flex;
        flex-direction: column;
        padding-bottom: 0;
    }

    .tv-quotes-container {
        flex: 1;
        overflow-y: auto;
        /* Scroll ONLY the quotes */
        min-height: 0;
        border-radius: 0 0 12px 12px;
    }

    .tv-quotes-container iframe {
        height: 100% !important;
    }
}

/* Mobile News Optimization - Ensure High Specificity */
@media (max-width: 768px) {
    .news-grid {
        grid-template-columns: 1fr !important;
        /* Force Single column */
        gap: 12px;
    }

    .news-card {
        flex-direction: row !important;
        /* Force Horizontal layout */
        height: 80px;
        align-items: center;
        padding: 0 !important;
        background: rgba(255, 255, 255, 0.03);
        /* Maintain glass effect */
    }

    .news-image-container {
        width: 80px !important;
        height: 100% !important;
        min-width: 80px;
        border-radius: 0 12px 12px 0;
        /* Adjust radius for RTL */
        margin: 0 !important;
    }

    .news-content {
        padding: 8px 12px !important;
        justify-content: center;
        height: 100%;
        gap: 4px;
        /* Tighter gap */
    }

    .news-title {
        font-size: 0.85rem !important;
        /* Slightly smaller for better fit */
        margin-bottom: 0;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        line-clamp: 2;
        overflow: hidden;
        line-height: 1.3;
        font-weight: 600;
    }

    .news-meta {
        font-size: 0.7rem;
        margin-top: 0;
    }
}

/* --- Mobile Zakat Optimization (Compact Table) --- */
@media (max-width: 768px) {

    /* Use standard grid layout, just tighter */
    .zakat-table-head {
        display: grid !important;
        /* Force show header */
        grid-template-columns: 0.8fr 1.1fr 1.1fr;
        font-size: 0.8rem;
        padding: 10px 8px;
        gap: 4px;
        text-align: center;
    }

    .zakat-table {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .zakat-row {
        display: grid;
        grid-template-columns: 0.8fr 1.1fr 1.1fr;
        flex-direction: row;
        /* Not column */
        align-items: center;
        padding: 12px 8px;
        gap: 4px;
        text-align: center;
        /* Reset Card Styles */
        background: rgba(255, 255, 255, 0.02);
        border: none;
        border-bottom: 1px solid var(--glass-border);
        margin-bottom: 0;
        border-radius: 0;
    }

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

    .zakat-row span {
        width: auto;
        justify-content: center;
        font-size: 0.9rem;
    }

    /* Remove the pseudo-element labels */
    .zakat-row span:nth-child(1)::after,
    .zakat-row span:nth-child(2)::before,
    .zakat-row span:nth-child(3)::before {
        content: none !important;
        display: none !important;
    }
}

/* --- Mobile Portfolio Optimization (Scrollable Table) --- */
@media (max-width: 768px) {

    /* 1. Stats Grid Compactness */
    .portfolio-stats {
        grid-template-columns: 1fr 1fr;
        /* 2 columns instead of 4 */
        gap: 12px;
    }

    /* 2. Revert to Table but Scrollable */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0;
        padding: 0 6px;
        width: 100%;
        box-sizing: border-box;
    }

    .pf-table {
        display: table;
        width: 100%;
        min-width: 800px;
        /* Force minimum width to trigger scroll */
        border-collapse: separate;
        border-spacing: 0 8px;
        /* Row spacing */
    }

    .pf-table thead {
        display: table-header-group;
        /* Show header */
    }

    .pf-table thead th {
        font-size: 0.8rem;
        white-space: nowrap;
        padding: 8px;
    }

    .pf-table tbody,
    .pf-table tr,
    .pf-table td {
        display: table-row-group;
        /* Reset to table defaults */
    }

    .pf-table tr {
        display: table-row;
        background: rgba(255, 255, 255, 0.02);
    }

    .pf-table td {
        display: table-cell;
        padding: 12px 8px;
        border: none;
        white-space: nowrap;
        /* Prevent wrapping */
        text-align: center;
        min-height: auto;
    }

    /* Remove labels */
    .pf-table td::before {
        display: none !important;
    }

    .pf-table td:first-child {
        border-radius: 0 8px 8px 0;
    }

    .pf-table td:last-child {
        border-radius: 8px 0 0 8px;
    }

    /* Actions column sticky or specific width */
    .pf-table td .table-actions {
        justify-content: center;
    }
}

/* --- FORCE SYNDICATE HISTORY VISIBILITY --- */
/* Overwrite any hidden constraints globally */
.syndicate-history,
.syndicate-history-table,
.syndicate-history-table table,
.syndicate-history-table tbody {
    max-height: none !important;
    height: auto !important;
    overflow-y: visible !important;
}

/* Force standard table display on Desktop */
@media (min-width: 901px) {
    .syndicate-history-table table {
        display: table !important;
    }

    .syndicate-history-table thead {
        display: table-header-group !important;
    }

    .syndicate-history-table tbody {
        display: table-row-group !important;
        overflow: visible !important;
    }

    .syndicate-history-table tbody tr {
        display: table-row !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .syndicate-history-table td {
        display: table-cell !important;
    }
}

/* Ensure Mobile Scroll works if overflowed */
@media (max-width: 900px) {
    .syndicate-history-table tbody {
        padding-bottom: 20px !important;
    }
}

/* Mobile Filter Header Optimization */
@media (max-width: 768px) {
    .filter-header-content {
        gap: 8px;
        width: 100%;
        justify-content: space-between;
    }

    .filter-header-content .stats-mode {
        padding: 4px 8px;
        gap: 8px;
    }

    .filter-header-content .stats-mode label {
        font-size: 0.75rem;
        /* Smaller text on mobile */
        gap: 4px;
    }

    .portfolio-card.collapsible-card .card-header {
        align-items: center;
        /* keep centered vertically */
    }
}

/* Version Number Styling */
.status-text-container {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.app-version {
    font-size: 0.65rem;
    font-weight: 300;
    opacity: 0.6;
    letter-spacing: 0.5px;
}

/* Portfolio Actions Mobile Fix */
.portfolio-header-actions {
    display: flex;
    flex-wrap: nowrap;
    /* Force single line */
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}

.portfolio-header-actions .quick-menu-btn {
    flex: 0 1 auto;
    /* Allow shrinking but prioritize content */
    white-space: nowrap;
    text-align: center;
    padding: 6px 12px;
    font-size: 0.85rem;
    min-width: fit-content;
}

@media (max-width: 480px) {
    .portfolio-header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .portfolio-header-actions .quick-menu-btn {
        font-size: 0.75rem;
        padding: 6px 8px;
        flex: 1;
        /* Distribute space evenly on very small screens */
    }
}

/* Syndicate Price Alert (Notebook Style) */
.syndicate-alert-block {
    background: #fdf6e3;
    /* Notebook cream color */
    color: #5c4b37;
    margin: 0 0 20px 0;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    font-family: var(--font-body);
    border: 1px solid #e0d0b8;
    transform-origin: top center;
}

/* Notebook Lines effect */
.notebook-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(#e5e5e5 1px, transparent 1px);
    background-size: 100% 24px;
    pointer-events: none;
    opacity: 0.5;
    z-index: 0;
    margin-top: 24px;
    /* Offset for header space */
}

/* Left red margin line (common in notebooks) - Right for RTL */
.syndicate-alert-block::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 40px;
    /* RTL specific: right side margin line */
    width: 2px;
    background-color: rgba(255, 99, 71, 0.4);
    z-index: 1;
}

.alert-content {
    position: relative;
    z-index: 2;
    /* Above lines */
    display: flex;
    align-items: flex-start;
    padding: 16px 16px 16px 60px;
    /* Left padding for close btn */
    gap: 15px;
}

.alert-icon {
    font-size: 1.8rem;
    color: #D4AF37;
    /* Primary Gold */
    margin-top: 4px;
}

.alert-text {
    flex: 1;
}

.alert-text h3 {
    margin: 0 0 6px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #D4AF37;
    /* Primary Gold */
    font-family: var(--font-heading);
}

.alert-text p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #5c4b37;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #8c7b67;
    cursor: pointer;
    line-height: 1;
    padding: 0 8px;
    transition: color 0.2s;
    position: absolute;
    top: 8px;
    left: 10px;
    /* Left side for RTL close button */
    z-index: 10;
}

.alert-close:hover {
    color: #d35400;
}

/* Animation Classes */
.alert-visible {
    animation: alertPopIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.alert-closing {
    animation: alertPopOut 0.4s ease-in forwards;
}

@keyframes alertPopIn {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes alertPopOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
}

/* Mobile Tweak */
@media (max-width: 600px) {
    .syndicate-alert-block::before {
        right: 20px;
    }

    .alert-content {
        padding: 14px 14px 14px 30px;
    }

    .alert-icon {
        font-size: 1.5rem;
    }

    .alert-text h3 {
        font-size: 1rem;
    }
}

/* --- Performance & CLS Optimizations --- */
.ad-banner {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.promo-section {
    min-height: 150px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 12px;
}

.promo-card {
    min-height: 100px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    overflow: hidden;
}

.promo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 768px) {
    .ad-banner {
        min-height: 80px;
    }

    .promo-section {
        min-height: 120px;
    }
}

/* Final Global Font Override for Cairo */
h1,
h2,
h3,
h4,
h5,
h6,
button,
input,
select,
textarea,
.price-value,
.info-box .value,
.card-header h2,
.syndicate-section h3,
.portfolio-section h2,
.portfolio-section h3,
.portfolio-section h4,
.making-section h3,
.zakat-section h3,
.fb-cta-title,
.logo h1,
.status-indicator {
    font-family: 'Cairo', sans-serif !important;
}

* {
    font-family: 'Cairo', sans-serif;
}

/* Regional Switcher Styles (Namespaced for Robustness) */
.gm-region-container {
    margin-right: auto;
    display: flex;
    align-items: center;
}

/* Regional Switcher Modal Internal Styles */
.gm-region-modal-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gm-region-modal-option:hover {
    background: rgba(212, 175, 55, 0.08);
    border-color: rgba(212, 175, 55, 0.3);
    transform: translateY(-2px);
}

.gm-region-modal-option.active {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--primary-gold);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.1);
}

.gm-region-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.gm-region-info .flag {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.gm-region-info .notif-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    display: block;
}

.gm-region-info .notif-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

.gm-region-modal-option .check-icon {
    font-size: 1.2rem;
    color: var(--primary-gold);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gm-region-modal-option.active .check-icon {
    opacity: 1;
}

#gm-region-modal.glass-panel {
    background: rgba(28, 30, 34, 0.85) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}


.gm-region-btn {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 0 12px !important;
    width: auto !important;
    min-width: 60px !important;
}

.gm-region-flag-mini {
    font-size: 1.1rem !important;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

/* Regional Locked Overlay Styles */
.region-locked-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 17, 21, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
}

.region-locked-overlay.show {
    display: flex;
}

.lock-content {
    max-width: 300px;
}

.unlock-feature-btn {
    margin-top: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--gm-accent, #d4af37);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.unlock-feature-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--gm-accent, #d4af37);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.unlock-feature-btn::before {
    content: "\f09c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.lock-content i {
    font-size: 2.5rem;
    color: var(--primary-gold);
    margin-bottom: 15px;
}

.lock-content p {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #fff;
}

.lock-content small {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
    display: block;
}

/* Zakat Warning & Custom Stat Styles */
.stat-main-value-alt {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-warning-note {
    font-size: 0.72rem;
    color: #ff9800;
    display: none;
    align-items: center;
    gap: 5px;
    background: rgba(255, 152, 0, 0.1);
    padding: 6px 10px;
    border-radius: 8px;
    line-height: 1.3;
    margin-top: 4px;
    border: 1px solid rgba(255, 152, 0, 0.2);
    text-align: right;
}

#zakat-pill-overlay {
    border-radius: 12px;
}

.toggle-wrapper {
    position: relative;
    /* Ensure overlay covers the section */
}

/* Mobile Layout Hardening (Fix Horizontal Scroll) */
@media (max-width: 768px) {
    header {
        flex-direction: column !important;
        gap: 16px !important;
        padding: 15px 12px !important;
        text-align: center;
    }

    .status-indicator {
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
        gap: 8px !important;
        width: 100% !important;
        padding: 0 4px !important;
        box-sizing: border-box !important;
    }

    .status-left {
        width: 100% !important;
        justify-content: center !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        margin: 0 auto !important;
    }

    .gm-region-container {
        margin: 0 !important;
        display: flex;
        align-items: center;
    }

    .byline {
        width: 100% !important;
        text-align: center !important;
        margin: 4px 0 0 0 !important;
        font-size: 0.72rem !important;
        display: block !important;
        position: static !important;
    }

    .app-container {
        overflow-x: clip !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 8px 4px !important;
        box-sizing: border-box !important;
    }
}


/* --- Simplified Yearly Performance: Gold-Silver Ratio Centerpiece --- */
/* (Block container removed from HTML, keeping card styles for grid usage) */

.yearly-header {
    margin-bottom: 30px;
    text-align: center;
}

body.light-theme .yearly-header h3 {
    color: var(--primary-gold);
}

.yearly-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    opacity: 0.8;
}

.ratio-centered-grid {
    display: flex;
    justify-content: center;
    width: 100%;
}

.ratio-card {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(16px);
    border: none !important;
    /* Explicitly remove ALL borders */
    border-radius: 28px;
    padding: 10px 10px;
    /* Minimal side padding to maximize bar width */
    width: 100%;
    box-shadow: none !important;
    /* Remove shadow to ensure no border-like artifacts */
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    direction: ltr !important;
    /* Force LTR for the card components as requested: Gold Left, Silver Right */
    gap: 4px;
    /* Space out elements vertically */
}

.ratio-status-indicator-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.ratio-era-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.era-badge {
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.4s ease;
    white-space: nowrap;
}

.era-date {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
    margin-right: 4px;
}

.era-badge.era-ancient {
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    color: #000;
}

.era-badge.era-classical {
    background: linear-gradient(135deg, #8b4513 0%, #a0522d 100%);
}

.era-badge.era-bimetallic {
    background: linear-gradient(135deg, #cd7f32 0%, #8b4513 100%);
}

.era-badge.era-volatility {
    background: linear-gradient(135deg, #4682b4 0%, #1e90ff 100%);
}

.era-badge.era-bretton {
    background: linear-gradient(135deg, #607d8b 0%, #455a64 100%);
}

.era-badge.era-modern {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.ratio-status-indicator {
    display: flex;
    justify-content: flex-end;
}

.sim-badge {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 12px;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(79, 172, 254, 0.4);
    animation: simPulse 2s infinite;
}

@keyframes simPulse {
    0% {
        opacity: 0.8;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    100% {
        opacity: 0.8;
        transform: scale(1);
    }
}

.ratio-stat-item.highlight-silver,
.ratio-stat-item.highlight-gold {
    background: rgba(0, 250, 154, 0.1);
    border: 1px dashed rgba(0, 250, 154, 0.3) !important;
}

.ratio-stat-item.highlight-silver .stat-label,
.ratio-stat-item.highlight-gold .stat-label {
    color: #4ade80;
}

.live-helper-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
    font-weight: 400;
}

.highlight-silver.active {
    background: rgba(46, 204, 113, 0.1) !important;
    border-color: rgba(46, 204, 113, 0.3) !important;
}

.highlight-silver.active strong {
    color: #2ecc71 !important;
    text-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
}

.ratio-main-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
    gap: 4px;
}

.ratio-value-wrapper {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ratio-value-wrapper .ratio-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.ratio-value-wrapper .ratio-value {
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    font-weight: 900;
    color: #fff;
    line-height: 1;
    letter-spacing: -1px;
}

.ratio-sep {
    color: var(--primary-gold);
    margin: 0 2px;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.ratio-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 15px;
    border-radius: 18px;
    margin-bottom: 2px;
}

.ratio-stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ratio-stat-item .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.ratio-stat-item strong {
    font-size: 1.05rem;
    color: #fff;
    font-weight: 700;
}

.ratio-stat-item.open-price {
    opacity: 0.7;
}

.ratio-stat-item.live-price strong {
    color: var(--accent-gold);
}

.ratio-stat-item.highlight-silver strong {
    color: #e5e7eb;
}

/* Performance Bar Styles */
.ratio-perf-bar-wrapper {
    margin: 2px 0;
    background: rgba(0, 0, 0, 0.15);
    padding: 5px 5px;
    /* Minimal side padding to widen the bars as much as possible */
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    width: 100%;
    box-sizing: border-box;
}

.ratio-perf-header {
    margin-bottom: 12px;
}

.ratio-perf-header small {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.ratio-perf-track {
    height: 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    display: flex;
    overflow: hidden;
    margin-bottom: 10px;
}

.ratio-perf-fill {
    height: 100%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.ratio-perf-fill.gold {
    background: linear-gradient(90deg, #d4af37, #f7d774);
    box-shadow: 2px 0 10px rgba(212, 175, 55, 0.3);
}

.ratio-perf-fill.silver {
    background: linear-gradient(90deg, #9ca3af, #d1d5db);
}

.ratio-perf-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 8px;
}

.ratio-perf-labels span {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Fixed overlap by adding gap */
}

.ratio-perf-labels span span {
    color: #fff;
    font-weight: 800;
}

.ratio-scale-wrapper {
    margin: 2px 0;
    position: relative;
    padding: 5px 5px;
    /* Minimal side padding */
    width: 100%;
    box-sizing: border-box;
}

.ratio-scale-track-new {
    height: 8px;
    /* Slightly taller for better visibility */
    background: linear-gradient(90deg, var(--primary-gold) 0%, #4facfe 50%, var(--primary-silver) 100%);
    border-radius: 4px;
    position: relative;
    margin-bottom: 12px;
    width: 100%;
}

.ratio-pointer-triangle {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 15px solid #fff;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
    transition: left 1s cubic-bezier(0.23, 1, 0.32, 1);
    z-index: 10;
}

.ratio-pointer-triangle::after {
    content: '';
    position: absolute;
    top: -22px;
    left: -4px;
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
}

.ratio-scale-labels-new {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 700;
    margin-top: 15px;
    position: relative;
}

.label-pivot {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: var(--primary-gold);
    opacity: 0.6;
    font-size: 0.75rem;
}

.ratio-status-badge {
    text-align: center;
    margin-top: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    display: inline-block;
    width: 100%;
}

.ratio-status-badge.gold-lead {
    color: var(--primary-gold);
    background: rgba(212, 175, 55, 0.1);
}

.ratio-status-badge.silver-lead {
    color: #4facfe;
    background: rgba(79, 172, 254, 0.1);
}

@media (max-width: 768px) {
    .yearly-performance {
        padding: 20px 10px;
    }

    .yearly-card.ratio-card.full-width {
        padding: 15px 12px;
    }

    .ratio-main-display {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .ratio-stats-grid {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
        padding: 18px;
        box-sizing: border-box;
        text-align: center;
        background: rgba(0, 0, 0, 0.3);
    }

    .ratio-stat-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .ratio-stat-item strong {
        font-size: 1.05rem;
        margin-top: 2px;
    }

    .ratio-stat-item .stat-label {
        font-size: 0.7rem;
        opacity: 0.8;
    }

    .ratio-value-wrapper .ratio-value {
        font-size: 2.5rem;
    }

    .ratio-scale-labels-new {
        font-size: 0.75rem;
    }
}

body.light-theme .yearly-card.ratio-card.full-width {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

body.light-theme .ratio-value-wrapper .ratio-value,
body.light-theme .open-stat strong {
    color: #1a1a1a;
}

body.light-theme .ratio-stats-grid {
    background: rgba(0, 0, 0, 0.04);
}

body.light-theme .ratio-stat-item strong {
    color: #1a1a1a;
}

body.light-theme .ratio-pointer-triangle {
    border-top-color: #4facfe;
}

body.light-theme .ratio-pointer-triangle::after {
    background: #4facfe;
}

/* Admin Toggle Switch */
.gold-admin-toggle {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.gold-admin-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.gold-admin-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.gold-admin-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.gold-admin-toggle input:checked+.slider-red {
    background-color: #d63638;
}

.gold-admin-toggle input:checked+.slider-green {
    background-color: #46b450;
}

.gold-admin-toggle input:focus+.gold-admin-slider {
    box-shadow: 0 0 1px #2196F3;
}

.gold-admin-toggle input:checked+.gold-admin-slider:before {
    transform: translateX(30px);
}