/* ═══════════════════════════════════════════════════════════
   EWI Market Movers: compact layout, news in a right sidebar
   ═══════════════════════════════════════════════════════════ */

.mm-page {
    max-width: 1360px;
    margin: 0 auto;
    padding: 24px 24px 56px;
    box-sizing: border-box;
}

.mm-up   { color: var(--navy-up, #2e9e6a); }
.mm-down { color: var(--navy-down, #d64545); }
body.light-mode .mm-up   { color: #1f7a52; }
body.light-mode .mm-down { color: #b3261e; }

.mm-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ── Header ── */

.mm-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.mm-title {
    margin: 0 0 2px;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
}

.mm-subtitle {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.mm-head__side {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.mm-periods {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.mm-period {
    min-height: 34px;
    padding: 0 14px;
    border: 0;
    border-left: 1px solid var(--border);
    background: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}

.mm-period:first-child { border-left: 0; }
.mm-period:hover { color: var(--text); }

.mm-period.is-active {
    background: var(--accent);
    color: var(--navy-on-accent, #06101F);
}

.mm-updated {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-faint);
}

.mm-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--navy-up, #2e9e6a);
}

/* ── Loading / empty ── */

.mm-loading,
.mm-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.mm-loading[hidden],
.mm-empty[hidden],
.mm-body[hidden] {
    display: none;
}

.mm-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border, rgba(255,255,255,.08));
    border-top-color: var(--accent, #4da3ff);
    border-radius: 50%;
    animation: mm-spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes mm-spin {
    to { transform: rotate(360deg); }
}

/* ── Layout ── */

.mm-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mm-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.mm-layout--side {
    grid-template-columns: minmax(0, 1fr) 320px;
}

.mm-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.mm-side {
    position: sticky;
    top: calc(var(--ewi-nav-h, 70px) + 16px);
}

body.admin-bar .mm-side { top: calc(var(--ewi-nav-h, 70px) + 48px); }

/* ── Cards ── */

.mm-card {
    background: var(--bg-card, var(--bg-alt));
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 16px;
}

.mm-card__title {
    margin: 0 0 8px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.mm-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.mm-card__head .mm-card__title { margin: 0; }

/* ── Headline stats: one strip ── */

.mm-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    background: var(--bg-card, var(--bg-alt));
    border: 1px solid var(--border);
    border-radius: 6px;
}

.mm-stat {
    padding: 12px 16px;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.mm-stat:first-child { border-left: 0; }

.mm-stat__label {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.mm-stat__line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
}

.mm-stat__name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mm-stat__value {
    font-size: 0.9375rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mm-stat__breadth {
    display: flex;
    justify-content: space-between;
    font-size: 0.9375rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.mm-breadth {
    display: flex;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    background: var(--bg-hover, #16233A);
}

.mm-breadth__up   { background: var(--navy-up, #2e9e6a); }
.mm-breadth__down { background: var(--navy-down, #d64545); }

/* ── Filters: tab bar ── */

.mm-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 1px solid var(--border);
}

.mm-cat {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 8px;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.mm-cat:hover { color: var(--text); }

.mm-cat.is-active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

/* ── Heatmap ── */

.mm-heat__legend {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.6875rem;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

.mm-heat__scale {
    width: 120px;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, rgba(143, 61, 72, 0.8), rgba(22, 35, 58, 1), rgba(47, 125, 96, 0.8));
}

#mm-heat {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-start;
}

.mm-heat__group {
    flex: 1 1 280px;
    min-width: 0;
}

/* ── Sector filter (stock tabs) ── */

.mm-sectors {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mm-sectors[hidden] { display: none; }

.mm-sector {
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}

.mm-sector:hover { color: var(--text); }

.mm-sector.is-active {
    border-color: var(--accent);
    color: var(--text);
    background: rgba(77, 163, 255, 0.12);
}

.mm-heat__label {
    margin: 0 0 6px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.mm-heat__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 3px;
}

.mm-tile {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2px;
    min-height: 46px;
    padding: 6px 8px;
    border-radius: 3px;
    box-sizing: border-box;
    color: var(--navy-head, #F3F6FB);
    text-decoration: none;
}

a.mm-tile:hover { outline: 1px solid rgba(255, 255, 255, 0.35); }

.mm-tile__name {
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mm-tile__chg {
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

body.light-mode .mm-tile { color: #0A1222; }

/* ── Gainers / losers ── */

.mm-lists {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.mm-row {
    display: grid;
    grid-template-columns: 1fr auto 64px;
    align-items: center;
    gap: 4px 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
}

.mm-row:last-child { border-bottom: 0; }

a.mm-row:hover .mm-row__name { color: var(--accent); }

.mm-row__name { font-weight: 600; }

.mm-row__price {
    font-size: 0.8125rem;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

.mm-row__chg {
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.mm-row__bar {
    grid-column: 1 / -1;
    height: 2px;
    background: var(--bg-hover, #16233A);
    overflow: hidden;
}

.mm-row__fill {
    display: block;
    height: 2px;
}

.mm-row__fill.mm-up   { background: var(--navy-up, #2e9e6a); }
.mm-row__fill.mm-down { background: var(--navy-down, #d64545); }

.mm-list__empty {
    margin: 0;
    padding: 10px 0;
    font-size: 0.8125rem;
    color: var(--text-faint);
}

/* ── Full table ── */

.mm-all { padding-bottom: 12px; }

.mm-search {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 220px;
    max-width: 100%;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-faint);
    box-sizing: border-box;
}

.mm-search input {
    flex: 1;
    min-width: 0;
    background: none;
    border: 0;
    outline: none;
    color: var(--text);
    font: inherit;
    font-size: 0.8125rem;
}

.mm-table-wrap {
    overflow-x: auto;
    margin: 0 -16px;
}

.mm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.mm-table th {
    padding: 8px 16px;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-faint);
    background: var(--bg-alt, rgba(255, 255, 255, 0.02));
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.mm-table th.mm-num { text-align: right; }

.mm-sort {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
}

.mm-sort.is-active { color: var(--accent); }
.mm-sort.is-active::after { content: ' \25BE'; }

.mm-table td {
    padding: 7px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    white-space: nowrap;
}

.mm-table tbody tr:hover td { background: var(--bg-hover, rgba(255, 255, 255, 0.03)); }
.mm-table tr:last-child td { border-bottom: 0; }

.mm-table td.mm-up   { color: var(--navy-up, #2e9e6a); font-weight: 600; }
.mm-table td.mm-down { color: var(--navy-down, #d64545); font-weight: 600; }
body.light-mode .mm-table td.mm-up   { color: #1f7a52; }
body.light-mode .mm-table td.mm-down { color: #b3261e; }

.mm-table__name,
.mm-table__name a {
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

.mm-table__name a:hover { color: var(--accent); }

.mm-table__empty {
    text-align: center;
    color: var(--text-faint);
}

.mm-view {
    display: inline-block;
    max-width: 160px;
    padding: 2px 8px;
    border-radius: 3px;
    background: var(--bg-hover, #16233A);
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.mm-view.is-bull { background: rgba(95, 211, 166, 0.12); color: var(--navy-up, #2e9e6a); }
.mm-view.is-bear { background: rgba(247, 154, 161, 0.12); color: var(--navy-down, #d64545); }

.mm-note {
    margin: 10px 0 0;
    font-size: 0.6875rem;
    color: var(--text-faint);
}

/* ── News sidebar ── */

.mm-news .ewi-news__item { padding: 9px 0; gap: 3px; }
.mm-news .ewi-news__item:last-child { border-bottom: 0; }
.mm-news .ewi-news__title { font-size: 0.8125rem; }
.mm-news .ewi-news__desc { display: none; }

/* ── Access gate ─────────────────────────────────────────────────────────── */

.mm-gate {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    padding: 60px 20px;
}

.mm-gate__inner {
    text-align: center;
    max-width: 440px;
}

.mm-gate__icon {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.mm-gate__title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text, #f9fafb);
    margin: 0 0 14px;
}

.mm-gate__desc {
    font-size: 0.95rem;
    color: var(--text-muted, #9ca3af);
    line-height: 1.6;
    margin: 0 0 28px;
}

.mm-gate__btn {
    display: inline-block;
    padding: 14px 32px;
    background: var(--accent, #4da3ff);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 10px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.mm-gate__btn:hover {
    opacity: 0.88;
    color: #fff;
    text-decoration: none;
}

/* ── Smaller screens ── */

@media (max-width: 1100px) {
    .mm-layout--side { grid-template-columns: minmax(0, 1fr); }
    .mm-side { position: static; }
}

@media (max-width: 860px) {
    .mm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mm-stat:nth-child(3) { border-left: 0; }
    .mm-stat:nth-child(n+3) { border-top: 1px solid var(--border); }
}

@media (max-width: 700px) {
    .mm-page { padding: 20px 16px 48px; }
    .mm-head__side { width: 100%; justify-content: space-between; }
    .mm-lists { grid-template-columns: 1fr; }
    .mm-cats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
    .mm-heat__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .mm-heat__group { flex-basis: 100% !important; }
    .mm-search { width: 100%; }
}
