/* ── CMC Metals Futures Grid  [cmc_metals_grid] ──────────────────────────── */

.cmc-mg-wrap {
    width: 100%;
    font-family: inherit;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    direction: rtl;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.cmc-mg-header {
    padding: 13px 16px 11px;
    direction: rtl;
    border-bottom: 1px solid #f1f5f9;
}

.cmc-mg-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cmc-mg-title-arr {
    font-size: 16px;
    color: #4D5B72;
    font-weight: 400;
    line-height: 1;
}

/* ── 2-column RTL grid ───────────────────────────────────────────────────── */

.cmc-mg-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    direction: rtl;
}

.cmc-mg-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid #f1f5f9;
    direction: rtl;
    min-width: 0;
}

/* Right-column cells (odd in RTL grid) get center divider */
.cmc-mg-cell:nth-child(odd) {
    border-left: 1px solid #f1f5f9;
}

/* Last row: no bottom border */
.cmc-mg-cell:nth-last-child(-n+2) {
    border-bottom: none;
}

/* ── Icon circle ── */

.cmc-mg-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cmc-mg-icon--gold      { background: #d97706; }
.cmc-mg-icon--platinum  { background: #64748b; }
.cmc-mg-icon--palladium { background: #475569; }
.cmc-mg-icon--silver    { background: #94a3b8; }
.cmc-mg-icon--copper    { background: #c2410c; }
.cmc-mg-icon--aluminium { background: #334155; }

/* SVG fills */
.cmc-mg-ico       { fill: rgba(255, 255, 255, 0.92); }
.cmc-mg-ico-inner { fill: rgba(255, 255, 255, 0.35); }

.cmc-mg-ico--medal { width: 12px; height: 14px; }
.cmc-mg-ico--std   { width: 13px; height: 13px; }

/* ── Label: name + code ── */

.cmc-mg-label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    text-align: right;
}

.cmc-mg-nameline {
    display: flex;
    align-items: center;
    gap: 7px;
    direction: rtl;
}

.cmc-mg-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #f97316;
}

.cmc-mg-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.cmc-mg-code {
    font-size: 10.5px;
    color: #94a3b8;
    direction: ltr;
    font-family: 'Courier New', monospace;
    line-height: 1.3;
    padding-right: 15px;
}

/* ── Meta: price + change (leftmost in RTL flex) ── */

.cmc-mg-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex-shrink: 0;
    min-width: 110px;
}

.cmc-mg-priceline {
    display: flex;
    align-items: baseline;
    gap: 4px;
    direction: ltr;
    flex-wrap: wrap;
}

.cmc-mg-price {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    direction: ltr;
    white-space: nowrap;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.cmc-mg-unit {
    font-size: 9.5px;
    font-weight: 400;
    color: #64748b;
    direction: ltr;
    white-space: nowrap;
}

.cmc-mg-chg {
    font-size: 12px;
    font-weight: 700;
    direction: ltr;
    white-space: nowrap;
    margin-top: 3px;
}

.cmc-mg-chg--pos { color: #16a34a; }
.cmc-mg-chg--neg { color: #dc2626; }

/* ── Footer ──────────────────────────────────────────────────────────────── */

.cmc-mg-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 20px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    direction: rtl;
    flex-wrap: wrap;
    gap: 8px;
}

.cmc-mg-link {
    font-size: 12px;
    font-weight: 600;
    color: #4D5B72;
    text-decoration: none;
    white-space: nowrap;
}

.cmc-mg-link:hover { color: #1e293b; text-decoration: underline; }

.cmc-mg-disclaimer {
    font-size: 10px;
    color: #94a3b8;
    white-space: nowrap;
}

/* ── Responsive: single column on narrow screens ─────────────────────────── */

@media (max-width: 600px) {
    .cmc-mg-grid {
        grid-template-columns: 1fr;
    }

    .cmc-mg-cell:nth-child(odd) {
        border-left: none;
    }

    .cmc-mg-cell:nth-last-child(-n+2) {
        border-bottom: 1px solid #f1f5f9;
    }

    .cmc-mg-cell:last-child {
        border-bottom: none;
    }

    .cmc-mg-price { font-size: 17px; }
    .cmc-mg-meta  { min-width: 90px; }
}
