/* ========================================
   Commodities Page Styles
   ======================================== */

.commodities-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--bg-main);
    min-height: 0;
}

.commodities-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-light);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.commodities-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 32px 12px;
}

.commodities-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.title-group {
    flex: 1;
}

.commodities-title {
    font-family: var(--font-brand);
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.commodities-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.header-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.update-time {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.source-badge {
    font-size: 11px;
    padding: 3px 10px;
    background: rgba(99, 102, 241, 0.1);
    color: #6366F1;
    border-radius: 20px;
    font-weight: 600;
}

/* Finance Sub-Navigation */
.finance-sub-nav {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 4px 0;
}

.finance-sub-nav::-webkit-scrollbar {
    display: none;
}

.sub-nav-item {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding-bottom: 12px;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sub-nav-item:hover {
    color: var(--text-primary);
}

.sub-nav-item.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

/* ========================================
   Commodity Groups & Tables
   ======================================== */

.commodities-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px 60px; /* Reduced top padding as Top Assets is above */
}

.top-assets-scroll {
    margin-bottom: 0;
    padding: 12px 32px;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 32px; /* Increased gap for ticker feel */
}

/* Ticker-style adjustments for Top Assets on this page */
.top-assets-scroll .top-asset-card {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    width: auto !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-assets-scroll .asset-value {
    font-size: 14px;
    font-weight: 700;
}

.top-assets-scroll .asset-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

.top-assets-scroll .asset-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-assets-scroll [id^="spark-"] {
    display: none !important; /* Hide small sparklines to make it a clean ticker */
}

.table-container {
    background: var(--bg-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.commodity-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}

.commodity-table th {
    background: rgba(0, 0, 0, 0.02);
    padding: 14px 16px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.commodity-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

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

.commodity-table tr:hover td {
    background: rgba(0, 0, 0, 0.015);
}

/* Columns */
.crop-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.crop-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.crop-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.crop-date {
    font-size: 11px;
    color: var(--text-tertiary);
    font-family: var(--font-ui);
    font-weight: 500;
}

.crop-location {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.col-price { 
    text-align: right;
    width: 160px;
    min-width: 160px;
    max-width: 160px;
    font-family: 'JetBrains Mono', 'Roboto Mono', monospace; 
    font-size: 15px; 
}

.col-change, .col-percent, .col-monthly, .col-yearly {
    text-align: right;
    font-family: var(--font-ui);
}

.badge-change {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    background: transparent !important;
}

.badge-change.positive { color: #059669; }
.badge-change.negative { color: #DC2626; }
.badge-change.neutral { color: var(--text-tertiary); }

.col-trend-span {
    padding: 4px 16px 12px !important;
    border-top: none !important;
    border-bottom: 1px solid var(--border-color);
}

.commodity-row td {
    border-bottom: none !important;
}

.commodity-sparkline-row td {
    border-bottom: 1px solid var(--border-color);
    padding-top: 0 !important;
}

.commodity-sparkline-row:hover td {
    background: rgba(0, 0, 0, 0.015);
}

.sparkline-container {
    width: 100% !important;
    min-width: 0;
    display: block;
}

.commodity-table tr.selected td {
    background: rgba(99, 102, 241, 0.05);
}

/* Indicators */
.positive { color: #10B981; }
.negative { color: #EF4444; }

/* ========================================
   Empty State
   ======================================== */

.commodities-empty {
    padding: 80px 20px;
    text-align: center;
}

.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }

/* ========================================
   Animations
   ======================================== */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 1024px) {
    /* Keep key columns visible; allow horizontal scroll instead of hiding. */
    .col-monthly, .col-yearly { display: table-cell; }
}

@media (max-width: 768px) {
    .commodities-header-inner { padding: 20px 16px 8px; }
    .commodities-content { padding: 16px; }
    .col-change { display: none; }
    .commodities-title { font-size: 24px; }
    .commodities-title-row { flex-direction: column; align-items: flex-start; gap: 12px; }
    .header-meta { align-items: flex-start; }
}

@media (max-width: 768px) {
    /* Ensure the remaining numeric columns have room and can be scrolled into view. */
    .col-price { min-width: 140px; }
    .col-percent { min-width: 110px; }
    .col-monthly, .col-yearly { min-width: 80px; }
}

/* ========================================
   Commodities Filter & Advanced Logic
   ======================================== */

.filter-container {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.filter-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #374151;
}

.multiselect-wrapper {
    position: relative;
}

.multiselect-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    box-sizing: border-box;
}

.multiselect-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.multiselect-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    min-height: 32px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #3b82f6;
    color: white;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.tag-remove {
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.tag-remove:hover {
    opacity: 1;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.autocomplete-dropdown.active {
    display: block;
}

/* Premium header search wrapper: ensure dropdown positions correctly */
.premium-search-input-wrapper {
    position: relative;
}

/* Match premium input look/feel */
.premium-search-container .autocomplete-dropdown {
    top: calc(100% + 6px);
    border-top: 1px solid #d1d5db;
    border-radius: 12px;
    max-height: 340px;
    overflow-y: auto;
}

/* Full-screen focus mode (table + filters) */
.commodities-focus-shell {
    position: relative;
}

.commodities-fullscreen-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 6px 12px;
    margin-left: 4px;
    color: #475569;
    flex-shrink: 0;
    white-space: nowrap;
}

.commodities-fullscreen-btn svg {
    display: block;
    flex-shrink: 0;
    stroke: currentColor;
}

.commodities-fullscreen-label {
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.commodities-focus-shell.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 13000;
    display: flex;
    flex-direction: column;
    padding: 16px 20px 20px;
    background: var(--bg-main, #f8fafc);
    overflow: hidden;
    box-sizing: border-box;
}

.commodities-focus-shell.is-fullscreen .commodities-filter-panel {
    flex-shrink: 0;
    margin-bottom: 12px;
}

.commodities-focus-shell.is-fullscreen .glass-data-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    border-radius: 20px;
}

.commodities-focus-shell.is-fullscreen .commodities-week-strip {
    flex-shrink: 0;
}

.commodities-focus-shell.is-fullscreen .premium-table-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.commodities-focus-shell.is-fullscreen .table-container {
    flex: 1;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

body.commodities-fullscreen-active {
    overflow: hidden;
}

/* Panel above the table (search + date nav) */
.commodities-filter-panel {
    margin-bottom: 12px;
}

.commodities-filter-panel .commodities-control__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.commodities-filter-panel .premium-search-container {
    padding: 0;
}

.commodities-filter-panel .commodities-control {
    width: auto;
    min-width: 0;
}

.commodities-intent-jump {
    display: none;
}

.commodity-intent-block {
    scroll-margin-top: 88px;
}

@media (max-width: 1200px) {
    .commodities-filter-panel .commodities-controls {
        flex-wrap: wrap;
        align-items: center;
    }

    .commodities-filter-panel .commodities-control--search {
        flex: 1 1 100%;
        min-width: 0;
    }

    .commodities-filter-panel .commodities-control--date {
        flex: 1 1 auto;
    }

    .commodities-intent-jump {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
        margin-top: 0;
    }

    .commodities-intent-jump__btn {
        min-height: 42px;
        border: 1px solid var(--border-color, #e5e7eb);
        border-radius: 10px;
        background: #fff;
        font-size: 13px;
        font-weight: 800;
        cursor: pointer;
        color: var(--text-secondary);
    }

    .commodities-intent-jump__btn--buy {
        border-color: #059669;
        background: rgba(16, 185, 129, 0.08);
        color: #047857;
    }

    .commodities-intent-jump__btn--sell {
        border-color: #dc2626;
        background: rgba(220, 38, 38, 0.08);
        color: #b91c1c;
    }

    .commodities-focus-shell.is-fullscreen .commodities-intent-jump {
        display: none;
    }
}

/* Make "Tafuta bidhaa" take remaining width */
.commodities-filter-panel .commodities-controls {
    width: 100%;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
    flex-direction: row;
}

.commodities-filter-panel .commodities-control--date {
    flex: 0 0 auto;
    max-width: none;
    min-width: 0;
}

.commodities-filter-panel .commodities-date-nav {
    margin: 0;
}

.commodities-filter-panel .commodities-date-controls {
    justify-content: flex-end;
    flex-wrap: nowrap;
    margin-bottom: 0;
}

.commodities-filter-panel .commodities-control--search {
    flex: 1 1 auto;
    max-width: none;
    min-width: min(100%, 12rem);
}

/* Match input size to the Leo button style */
.commodities-filter-panel .premium-search-input {
    height: 38px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    padding: 0 14px !important;
}

.commodities-filter-panel .premium-search-input:focus {
    box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.08), 0 2px 10px rgba(0, 0, 0, 0.04) !important;
}

.commodities-focus-shell #commodities-table .commodities-week-strip {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    margin: 0;
    border: none;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0;
    background: transparent;
}

.commodities-focus-shell #commodities-table .commodities-week-day {
    flex: 1 1 0;
    min-width: 0;
}

.commodities-focus-shell #commodities-table .premium-table-wrapper {
    padding-top: 0;
}

.commodities-focus-shell #commodities-table .table-container {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.commodities-focus-shell:not(.is-fullscreen) {
    display: flex;
    flex-direction: column;
    min-height: 22rem;
    height: calc(100vh - 13.75rem);
    max-height: calc(100vh - 13.75rem);
}

.commodities-focus-shell:not(.is-fullscreen) .commodities-filter-panel {
    flex-shrink: 0;
}

.commodities-focus-shell:not(.is-fullscreen) #commodities-table {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    margin-bottom: 0;
}

.commodities-focus-shell:not(.is-fullscreen) #commodities-table .commodities-week-strip {
    flex-shrink: 0;
}

.commodities-focus-shell:not(.is-fullscreen) #commodities-table .premium-table-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.commodities-focus-shell:not(.is-fullscreen) #commodities-table .table-container {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .commodities-focus-shell:not(.is-fullscreen) {
        height: auto;
        max-height: none;
        min-height: 0;
    }

    .commodities-focus-shell:not(.is-fullscreen) #commodities-table .premium-table-wrapper {
        overflow: visible;
    }

    .commodities-focus-shell:not(.is-fullscreen) #commodities-table .table-container {
        max-height: none;
        overflow-x: auto;
        overflow-y: visible;
    }
}

.commodities-filter-panel #selectedTags {
    margin-top: 0;
    min-height: 0;
}

.commodities-filter-panel #selectedTags:empty {
    display: none !important;
    margin: 0;
    min-height: 0;
    padding: 0;
}

.commodities-filter-panel #selectedTags:not(:empty) {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 8px;
    min-height: 0;
}

@media (max-width: 900px) {
    .commodities-fullscreen-label {
        display: none;
    }

    .commodities-fullscreen-btn {
        min-width: 38px;
        padding: 6px 10px;
    }
}

@media (max-width: 640px) {
    /* Stack search, then date nav on small phones */
    .commodities-filter-panel .commodities-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .commodities-fullscreen-label {
        display: none;
    }

    .commodities-fullscreen-btn {
        min-width: 38px;
        padding: 6px 10px;
    }

    .commodities-focus-shell.is-fullscreen {
        padding: 12px 12px 16px;
    }

    .commodities-filter-panel .commodities-control--date,
    .commodities-filter-panel .commodities-control--search {
        flex: 1 1 auto;
        max-width: none;
        width: 100%;
    }

    .commodities-filter-panel .commodities-date-controls {
        justify-content: flex-start;
    }

    .commodities-filter-panel #selectedTags:not(:empty) {
        margin-top: 8px;
    }

    /* Horizontally scrollable week strip — each day keeps readable width */
    .commodities-week-strip {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        justify-content: flex-start;
    }

    .commodities-week-strip::-webkit-scrollbar {
        display: none;
    }

    .commodities-week-day,
    .commodities-focus-shell #commodities-table .commodities-week-day {
        flex: 0 0 4.75rem;
        min-width: 4.75rem;
        padding: 8px 6px 10px;
    }

    .commodities-week-day .day-name {
        font-size: 10px;
        letter-spacing: 0.02em;
    }

    .commodities-week-day .day-date {
        font-size: 13px;
        margin-bottom: 3px;
    }

    .commodities-week-day .day-count {
        font-size: 0;
        line-height: 0;
    }

    .commodities-week-day .day-count.has-data::before {
        content: '';
        display: block;
        width: 6px;
        height: 6px;
        margin: 0 auto;
        border-radius: 50%;
        background: #059669;
    }

    /* Table fits phone width: name + price + weekly % only */
    .premium-table-wrapper .commodity-table {
        min-width: 0;
        width: 100%;
        table-layout: fixed;
    }

    .commodity-table th.col-monthly,
    .commodity-table td.col-monthly,
    .commodity-table th.col-yearly,
    .commodity-table td.col-yearly {
        display: none;
    }

    .commodity-table th,
    .commodity-table td {
        padding: 12px 10px;
        white-space: normal;
    }

    .commodity-table th.col-name,
    .commodity-table td.col-name {
        min-width: 0;
        width: 46%;
        position: static;
        box-shadow: none;
    }

    .commodity-table th.col-price,
    .commodity-table td.col-price {
        min-width: 0;
        width: 34%;
    }

    .commodity-table th.col-percent,
    .commodity-table td.col-percent {
        min-width: 0;
        width: 20%;
        padding-right: 8px;
    }

    .commodity-table th:first-child::after,
    .commodity-table td:first-child::after {
        display: none;
    }

    .commodity-table td:first-child {
        box-shadow: none;
    }

    .commodity-table .crop-name {
        font-size: 14px;
        line-height: 1.25;
    }

    .commodity-table .crop-meta {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 2px 6px;
    }

    .commodity-table .crop-date::before {
        content: '·';
        margin-right: 4px;
        color: var(--text-tertiary);
    }

    .commodity-table .col-price > div:first-child {
        font-size: 14px !important;
    }

    .commodity-table .col-price > div:last-child {
        font-size: 10px !important;
    }

    .commodity-table .badge-change {
        padding: 2px 4px;
        font-size: 11px;
    }

    .finance-detail-container .glass-data-card {
        border-radius: 18px;
        margin-bottom: 20px;
    }

    .finance-detail-container .finance-nav-layout {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .finance-detail-container .header-status-group {
        flex: 1 1 100%;
        align-items: flex-start;
    }

    .finance-detail-container .finance-detail-header-inner {
        padding-bottom: 14px;
    }

    .finance-detail-container .finance-title-row > .finance-title-group h1 {
        font-size: 22px;
    }
}

/* ========================================
   Commodities Date Week Strip (like Earnings)
   ======================================== */

.commodities-date-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.cal-btn {
    background: none;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    transition: all 0.15s ease;
}

.cal-btn:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-primary, #111827);
}

.cal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.commodities-week-strip {
    display: flex;
    gap: 0;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-light, #fff);
}

.commodities-week-strip--full {
    width: 100%;
}

.commodities-week-day {
    flex: 1;
    text-align: center;
    padding: 10px 6px 12px;
    cursor: pointer;
    border-right: 1px solid var(--border-color, #e5e7eb);
    transition: background 0.15s ease;
    user-select: none;
}

.commodities-week-day:last-child { border-right: none; }

.commodities-week-day:hover { background: rgba(0, 0, 0, 0.02); }
.commodities-week-day.active { background: rgba(16, 185, 129, 0.07); }

.commodities-week-day.disabled {
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.015);
}

.commodities-week-day.disabled:hover { background: rgba(0, 0, 0, 0.015); }

.commodities-week-day.today .day-name {
    color: #059669;
    font-weight: 900;
}

.commodities-week-day .day-name {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-secondary, #6b7280);
    text-transform: uppercase;
    margin-bottom: 3px;
}

.commodities-week-day .day-date {
    font-size: 14px;
    font-weight: 900;
    color: var(--text-primary, #111827);
    margin-bottom: 0;
}

.commodities-week-day.disabled .day-date {
    color: var(--text-secondary, #9ca3af);
}

.commodities-week-day .day-count {
    font-size: 11px;
    color: var(--text-tertiary, #9ca3af);
    font-weight: 700;
}

.commodities-week-day .day-count.has-data {
    color: #059669;
}


.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: background-color 0.2s;
}

.autocomplete-item:hover {
    background-color: #f3f4f6;
}

.autocomplete-item.selected {
    background-color: #dbeafe;
    color: #1e40af;
    font-weight: 500;
}

.commodities-table-wrapper {
    position: relative;
    min-height: 400px;
}

.loading-indicator {
    display: none;
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

.loading-indicator.active {
    display: block;
}

.table-container {
    max-height: 800px;
    overflow-y: auto;
    overflow-x: auto;
}

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

.commodity-table thead {
    position: sticky;
    top: -1px;
    background: white;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.commodity-table th,
.commodity-table td {
    white-space: nowrap;
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.commodity-table th:first-child,
.commodity-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 4; /* above non-sticky cells */
    background: var(--bg-light);
}

.commodity-table thead th:first-child {
    z-index: 20; /* always above scrolling body cells */
    background: rgba(0, 0, 0, 0.02);
}

/* Ensure header cells always paint above body cells (prevents overlap on pinned column) */
.commodity-table thead th {
    position: sticky;
    top: 0;
    z-index: 12;
    background: rgba(var(--bg-light-rgb, 255, 255, 255), 0.96);
    backdrop-filter: blur(8px);
}

/* Column sizing: keep widths stable while allowing horizontal scroll on mobile */
.commodity-table th.col-name,
.commodity-table td.col-name {
    min-width: 220px;
}

.commodity-table th.col-price,
.commodity-table td.col-price {
    min-width: 150px;
}

.commodity-table th.col-percent,
.commodity-table td.col-percent {
    min-width: 110px;
}

.commodity-table th.col-monthly,
.commodity-table td.col-monthly,
.commodity-table th.col-yearly,
.commodity-table td.col-yearly {
    min-width: 80px;
}

@media (min-width: 641px) and (max-width: 768px) {
    .premium-table-wrapper .commodity-table {
        min-width: 760px;
    }
}


.commodity-table th:first-child::after,
.commodity-table td:first-child::after {
    content: '';
    position: absolute;
    top: 0;
    right: -1px;
    width: 1px;
    height: 100%;
    background: #e5e7eb;
}

.commodity-table td:first-child {
    box-shadow: 12px 0 14px -16px rgba(0, 0, 0, 0.24);
}

.commodity-table tbody tr:hover {
    background-color: #f9fafb;
}

.filter-info {
    font-size: 13px;
    color: #6b7280;
    margin-top: 8px;
}

.commodity-row--link {
    cursor: pointer;
}

.commodity-row--link:hover {
    background-color: rgba(99, 102, 241, 0.06) !important;
}

.commodity-row--link:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.45);
    outline-offset: -2px;
}

/* Detail cards: padding so section titles are not clipped by overflow:hidden + border-radius */
.commodity-detail-view .glass-data-card {
    padding: 24px 28px 28px;
    overflow: hidden;
}

.commodity-detail-view .glass-data-card .premium-table-wrapper {
    padding-top: 0;
}

.commodity-detail-back {
    margin-bottom: 10px;
}

.commodity-detail-price-block {
    text-align: right;
    flex-shrink: 0;
}

.commodity-detail-price-range {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.commodity-detail-price-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.commodity-detail-price-range strong {
    font-family: var(--font-brand);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.commodity-detail-price-sep {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 0 4px;
}

.commodity-detail-unit {
    font-size: 12px;
    color: var(--text-secondary);
}

.commodity-detail-section-title {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 700;
}

.commodity-detail-chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.commodity-trend-chart {
    min-height: 340px;
}

.commodity-trend-chart.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.commodity-trend-chart.chart-loading::after {
    content: 'Inapakia mchoro...';
}

.commodities-seo-intro {
    margin: 12px 0 0;
    max-width: 52rem;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-secondary, #475569);
}

.commodities-orderbook {
    margin: 28px 0 8px;
    padding: 20px 18px;
    border: 1px solid var(--border-color, rgba(15, 23, 42, 0.08));
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.55);
}

.commodities-orderbook__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.commodities-orderbook__title {
    margin: 0 0 6px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
}

.commodities-orderbook__lede {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--text-secondary, #64748b);
    max-width: 42rem;
}

.commodities-orderbook__summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.commodities-orderbook__pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    color: #475569;
}

.commodities-orderbook__pill--buy strong { color: #16a34a; }
.commodities-orderbook__pill--sell strong { color: #d97706; }

.commodities-orderbook__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.commodities-orderbook__side {
    min-width: 0;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    overflow: hidden;
}

.commodities-orderbook__side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.commodities-orderbook__side--buy .commodities-orderbook__side-head {
    background: rgba(22, 163, 74, 0.06);
}

.commodities-orderbook__side--sell .commodities-orderbook__side-head {
    background: rgba(217, 119, 6, 0.06);
}

.commodities-orderbook__side-head h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.commodities-orderbook__side--buy .commodities-orderbook__side-head h3 { color: #15803d; }
.commodities-orderbook__side--sell .commodities-orderbook__side-head h3 { color: #b45309; }

.commodities-orderbook__side-count {
    font-size: 12px;
    font-weight: 800;
    color: #64748b;
}

.commodities-orderbook__empty {
    margin: 0;
    padding: 18px 12px;
    font-size: 13px;
    color: #64748b;
}

.commodities-orderbook__scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.commodities-orderbook__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.commodities-orderbook__table th,
.commodities-orderbook__table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    vertical-align: top;
}

.commodities-orderbook__table th {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
    background: rgba(248, 250, 252, 0.9);
    white-space: nowrap;
}

.commodities-orderbook__table th.num,
.commodities-orderbook__table td.num {
    text-align: right;
    white-space: nowrap;
}

.commodities-orderbook__crop {
    display: block;
    font-weight: 700;
    color: #0f172a;
    font-size: 13px;
}

.commodities-orderbook__loc,
.commodities-orderbook__date {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-top: 1px;
}

.commodities-orderbook__contact-name {
    display: block;
    font-weight: 600;
    color: #0f172a;
}

.commodities-orderbook__action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.25);
    background: #fff;
    color: #4f46e5;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
}

.commodities-orderbook__action-btn:hover {
    background: rgba(99, 102, 241, 0.06);
}

.commodities-orderbook__action-btn--primary {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
    font-size: 12px;
    padding: 8px 12px;
}

.commodities-orderbook__action-btn--primary:hover {
    background: #4f46e5;
}

.commodities-orderbook__empty-action {
    padding: 0 12px 14px;
}

.commodities-orderbook__row.is-filter-hidden {
    display: none;
}

.commodities-orderbook__disclaimer {
    margin: 12px 0 0;
    font-size: 11px;
    line-height: 1.45;
    color: #94a3b8;
}

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

.commodities-faq {
    margin: 28px 0 8px;
    padding: 20px 18px;
    border: 1px solid var(--border-color, rgba(15, 23, 42, 0.08));
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.55);
}

.commodities-faq__title {
    margin: 0 0 14px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
}

.commodity-fundamentals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.commodity-fundamentals-grid .metric-item--wide {
    grid-column: 1 / -1;
}

.commodity-detail-history-table {
    width: 100%;
}

@media (max-width: 720px) {
    .commodity-detail-price-block {
        text-align: left;
        width: 100%;
    }

    .commodity-detail-price-range {
        align-items: flex-start;
    }
}

/* Sidebar buy/sell interest widget */
.commodity-intent-block .pb-header {
    margin-bottom: 10px;
}

.commodity-intent-desc {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.commodity-intent-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.commodity-intent-ac {
    position: relative;
    z-index: 2;
}

.commodity-intent-ac:focus-within {
    z-index: 5;
}

.commodity-intent-ac .autocomplete-dropdown {
    top: calc(100% + 4px);
    border-top: 1px solid #d1d5db;
    border-radius: 10px;
    max-height: 220px;
}

.commodity-intent-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.commodity-intent-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}

.commodity-intent-side__opt {
    cursor: pointer;
}

.commodity-intent-side__opt input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.commodity-intent-side__opt span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-secondary);
}

.commodity-intent-side__opt input:checked + span {
    border-color: #059669;
    background: rgba(16, 185, 129, 0.08);
    color: #047857;
}

.commodity-intent-side__opt:last-child input:checked + span {
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
    color: #b91c1c;
}

.commodity-intent-label,
.commodity-intent-subhead {
    display: block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin: 10px 0 6px;
}

.commodity-intent-subhead {
    margin-top: 16px;
    color: var(--text-secondary);
}

.commodity-intent-input {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    box-sizing: border-box;
}

.commodity-intent-input:focus {
    outline: none;
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.commodity-intent-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.commodity-intent-error,
.commodity-intent-ok {
    margin: 10px 0 0;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
}

.commodity-intent-error {
    color: #b91c1c;
}

.commodity-intent-ok {
    color: #047857;
}

.commodity-intent-form .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    margin-top: 14px;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    background: var(--finance-primary, #00b894);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.commodity-intent-form .btn-primary:hover {
    filter: brightness(0.95);
}

.commodity-intent-form .btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    filter: none;
}

.commodity-intent-disclaimer {
    margin: 10px 0 0;
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-tertiary);
}
