/* ── Variables ── */
:root {
    --mf-bg:         #1a3d2b;
    --mf-bg-head:    #15331f;
    --mf-bg-avg:     #1f4a34;
    --mf-bg-row:     #1a3d2b;
    --mf-bg-row-alt: #1e4430;
    --mf-border:     rgba(255,255,255,.10);
    --mf-text:       #e8f0eb;
    --mf-text-sub:   rgba(255,255,255,.55);
    --mf-accent:     #4ade80;
    --mf-radius:     8px;
}

/* ── Wrapper ── */
.mf-wrap {
    font-family: inherit;
    font-size: 14px;
    color: var(--mf-text);
    background: var(--mf-bg);
    border-radius: var(--mf-radius);
    overflow: hidden;
}

/* ── Header ── */
.mf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px 24px 16px;
    background: var(--mf-bg-head);
}

.mf-title {
    margin: 0;
    font-size: 1.45em;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.01em;
}

/* ── Selectors ── */
.mf-selectors {
    display: flex;
    gap: 10px;
}

.mf-select-wrap {
    position: relative;
}

.mf-select-wrap::after {
    content: '▾';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--mf-text-sub);
    font-size: 12px;
}

.mf-month-select,
.mf-currency-select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255,255,255,.08);
    border: 1px solid var(--mf-border);
    border-radius: 20px;
    color: var(--mf-text);
    padding: 6px 30px 6px 14px;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: background .15s;
}

.mf-month-select:hover,
.mf-currency-select:hover {
    background: rgba(255,255,255,.14);
}

.mf-month-select option,
.mf-currency-select option {
    background: #1a3d2b;
    color: #fff;
}

/* ── Table wrap ── */
.mf-table-wrap {
    overflow-x: auto;
}

/* ── Table ── */
.mf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88em;
}

.mf-table thead tr {
    background: var(--mf-bg-head);
}

.mf-table th {
    padding: 12px 16px;
    font-weight: 600;
    font-size: .85em;
    text-align: right;
    color: var(--mf-text);
    border-bottom: 1px solid var(--mf-border);
    white-space: nowrap;
}

.mf-table th span {
    display: block;
    font-weight: 400;
    color: var(--mf-text-sub);
    font-size: .9em;
}

.mf-th-date {
    text-align: left !important;
    min-width: 100px;
}

.mf-th-metal {
    text-align: center !important;
    min-width: 110px;
}

.mf-td-metal{
    text-align: center !important;
}

/* ── Rows ── */
.mf-table tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--mf-border);
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--mf-text);
}

.mf-table tbody tr:nth-child(even):not(.mf-avg-row) {
    background: var(--mf-bg-row-alt);
}

.mf-table tbody tr:hover:not(.mf-avg-row) {
    background: rgba(255,255,255,.06);
}

.mf-table tbody td:first-child {
    text-align: left;
    color: var(--mf-text);
    white-space: nowrap;
}

/* ── Average row ── */
.mf-avg-row {
    background: var(--mf-bg-avg) !important;
}

.mf-avg-row td {
    font-weight: 600;
    border-bottom: 2px solid var(--mf-border);
    color: var(--mf-text) !important;
}

.mf-avg-row td:first-child {
    font-size: .82em;
    line-height: 1.4;
    color: var(--mf-text-sub) !important;
    font-weight: 400;
}

/* ── States ── */
.mf-loading,
.mf-empty {
    display: block;
    padding: 24px;
    color: var(--mf-text-sub);
    font-style: italic;
}

/* ═══════════════════════════════════════════════════
   CHART
   ═══════════════════════════════════════════════════ */

.mf-chart-wrap {
    --ch-bg:      #0d2137;
    --ch-border:  rgba(255,255,255,.08);
    --ch-btn-bg:  rgba(255,255,255,.06);
    --ch-btn-act: #0e4a5a;
    --ch-text:    #8ab0bc;
    --ch-white:   #e8f4f8;

    background:    var(--ch-bg);
    border-radius: var(--mf-radius);
    overflow:      hidden;
    font-family:   inherit;
    font-size:     14px;
    color:         var(--ch-white);
    margin-bottom: 24px;
}

/* ── Top bar ── */
.mf-chart-top {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    flex-wrap:       wrap;
    gap:             10px;
    padding:         14px 20px;
    border-bottom:   1px solid var(--ch-border);
}

.mf-chart-left,
.mf-chart-right {
    display:     flex;
    align-items: center;
    gap:         8px;
}

/* Metal dropdown */
.mf-chart-metal {
    appearance:       none;
    -webkit-appearance: none;
    background:       var(--ch-btn-bg);
    border:           1px solid var(--ch-border);
    border-radius:    6px;
    color:            var(--ch-white);
    padding:          6px 32px 6px 12px;
    font-size:        13px;
    cursor:           pointer;
    outline:          none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238ab0bc'/%3E%3C/svg%3E");
    background-repeat:   no-repeat;
    background-position: right 10px center;
}

.mf-chart-metal option { background: #0d2137; }

/* Shared button group */
.mf-chart-group {
    display:    flex;
    align-items: center;
    gap:        2px;
}

.mf-chart-btn {
    background:    transparent;
    border:        none;
    color:         var(--ch-text);
    padding:       5px 12px;
    font-size:     13px;
    cursor:        pointer;
    border-radius: 4px;
    transition:    background .15s, color .15s;
    white-space:   nowrap;
}

.mf-chart-btn:hover {
    background: var(--ch-btn-bg);
    color:      var(--ch-white);
}

.mf-chart-btn.active {
    background: var(--ch-btn-act);
    color:      var(--ch-white);
    font-weight: 600;
}

/* ── Canvas ── */
.mf-chart-canvas-wrap {
    position: relative;
    height:   320px;
    padding:  12px 0;
}

#mf-price-chart {
    display: block;
    width:   100% !important;
    height:  100% !important;
}

