/* markets.css — page layout for the free Markets page (Session 14, 17 Oct 2026). Cards, tables, buttons and text
   utilities come from styles.css; everything here is scoped to #view-markets. Colours follow the sector strip on the
   Scanners page (scanners.css .sx-tile): up #059669, down #dc2626, lit tile navy #0f172a. */

#view-markets { max-width: 1400px; }
#view-markets .mk-card { padding: 16px 18px 18px; margin-bottom: 14px; }
#view-markets .mk-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
#view-markets .mk-head > div:first-child { max-width: 760px; }
#view-markets .mk-title { margin: 0 0 4px; font-size: 1.7rem; letter-spacing: -0.01em; }
#view-markets .mk-asof { white-space: nowrap; padding-bottom: 6px; }
#view-markets .mk-card-head { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 12px; }
#view-markets .mk-h2 { font-size: 0.82rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; margin: 0; display: inline-flex; align-items: center; gap: 4px; }
#view-markets .mk-h2 .btn-icon { color: #94a3b8; }
#view-markets .mk-h2-sub { text-transform: none; letter-spacing: 0; font-weight: 700; color: #0f172a; margin-left: 6px; font-size: 0.95rem; }
#view-markets .mk-loading { color: #94a3b8; font-size: 0.9rem; padding: 18px 4px; }
#view-markets .mk-loading-sm { padding: 40px 4px; text-align: center; }
#view-markets .mk-foot { margin: 6px 4px 0; line-height: 1.5; max-width: 1100px; }

/* window pickers (1W · 1M · 3M · YTD · 1Y) — same look as the scanners' strip */
#view-markets .mk-win { margin-left: auto; display: inline-flex; border: 1px solid #e2e8f0; border-radius: 6px; overflow: hidden; }
#view-markets .mk-win-btn { border: none; background: #fff; color: #64748b; font: inherit; font-size: 0.74rem; font-weight: 700; padding: 4px 10px; cursor: pointer; line-height: 1.3; }
#view-markets .mk-win-btn + .mk-win-btn { border-left: 1px solid #e2e8f0; }
#view-markets .mk-win-btn:hover { background: #f1f5f9; color: #0f172a; }
#view-markets .mk-win-btn.active { background: #0f172a; color: #fff; }

/* (a) gauges */
#view-markets .mk-gauges { display: grid; gap: 10px; }
#view-markets .mk-gauges-main { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#view-markets .mk-gauges-more { margin-top: 10px; }
#view-markets .mk-gauges-more:empty { display: none; }
#view-markets .mk-gauge { display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: #0f172a; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px 10px; cursor: pointer; min-width: 0; transition: background 0.15s, border-color 0.15s, box-shadow 0.15s; }
#view-markets .mk-gauge:hover { background: #eef2f7; border-color: #cbd5e1; }
#view-markets .mk-gauge.active { background: #0f172a; border-color: #0f172a; color: #fff; box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18); }
#view-markets .mk-gauge.active .mk-g-name, #view-markets .mk-gauge.active .mk-g-sub, #view-markets .mk-gauge.active .mk-g-win { color: #cbd5e1; }
#view-markets .mk-gauge.active .mk-g-win b { color: #fff; }
#view-markets .mk-gauge.is-empty { cursor: default; opacity: 0.7; }
#view-markets .mk-g-name { font-size: 0.78rem; font-weight: 700; color: #475569; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#view-markets .mk-g-name .mk-g-sym { font-weight: 600; color: #94a3b8; font-size: 0.7rem; letter-spacing: 0.02em; }
#view-markets .mk-g-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
#view-markets .mk-g-last { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; line-height: 1.15; }
#view-markets .mk-g-chg { font-size: 0.88rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
#view-markets .mk-g-sub { font-size: 0.74rem; color: #64748b; line-height: 1.35; min-height: 1.35em; }
#view-markets .mk-g-win { font-size: 0.74rem; color: #64748b; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; font-variant-numeric: tabular-nums; }
#view-markets .mk-g-win b { font-weight: 700; color: #0f172a; }
#view-markets .mk-up { color: #059669; }
#view-markets .mk-down { color: #dc2626; }
#view-markets .mk-flat { color: #64748b; }
#view-markets .mk-gauge.active .mk-up { color: #34d399; }
#view-markets .mk-gauge.active .mk-down { color: #f87171; }
/* VIX: its place in the one-year range */
#view-markets .mk-range { margin-top: 4px; }
#view-markets .mk-range-bar { position: relative; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #a7f3d0 0%, #fde68a 50%, #fca5a5 100%); }
#view-markets .mk-range-dot { position: absolute; top: -3px; width: 12px; height: 12px; border-radius: 50%; background: #0f172a; border: 2px solid #fff; transform: translateX(-50%); box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
#view-markets .mk-gauge.active .mk-range-dot { background: #fff; border-color: #0f172a; }
#view-markets .mk-range-ends { display: flex; justify-content: space-between; font-size: 0.68rem; color: #64748b; margin-top: 4px; font-variant-numeric: tabular-nums; }
#view-markets .mk-gauge.active .mk-range-ends { color: #cbd5e1; }
/* the chart that opens under the strip */
#view-markets .mk-gauge-chart { margin-top: 12px; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px 4px; background: #fff; }
#view-markets .mk-chart-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
#view-markets .mk-chart-title { font-size: 0.86rem; font-weight: 700; color: #0f172a; }
#view-markets .mk-chart-sub { flex: 1 1 auto; }
#view-markets .mk-chart-close { margin-left: auto; }
#view-markets #mk-gauge-chart { min-height: 280px; }

/* (b) sectors */
#view-markets .mk-sector-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; margin-bottom: 14px; }
#view-markets .mk-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 7px 9px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; cursor: pointer; text-align: left; font: inherit; color: #0f172a; min-width: 0; transition: background 0.15s, border-color 0.15s; }
#view-markets .mk-tile:hover { background: #eef2f7; border-color: #cbd5e1; }
#view-markets .mk-tile-name { font-size: 0.72rem; font-weight: 600; color: #475569; line-height: 1.15; }
#view-markets .mk-tile-val { font-size: 0.95rem; font-weight: 800; font-variant-numeric: tabular-nums; }
#view-markets .mk-tile.active { background: #0f172a; border-color: #0f172a; }
#view-markets .mk-tile.active .mk-tile-name { color: #cbd5e1; }
#view-markets .mk-tile.active .mk-tile-val { color: #fff; }
#view-markets .mk-sector-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; margin-bottom: 8px; }
#view-markets .mk-sector-col { min-width: 0; }
#view-markets #mk-sector-bar { min-height: 300px; }
#view-markets #mk-sector-line { min-height: 300px; }
#view-markets .mk-table-box { margin-top: 8px; }
#view-markets .mk-table th, #view-markets .mk-table td { white-space: nowrap; font-variant-numeric: tabular-nums; }
#view-markets .mk-table td.text-left, #view-markets .mk-table th.text-left { text-align: left; }
#view-markets .mk-table tr.active td { background: #f1f5f9; }
#view-markets .mk-table .mk-name-btn { background: none; border: none; padding: 0; font: inherit; font-weight: 600; color: #0f172a; cursor: pointer; text-align: left; }
#view-markets .mk-table .mk-name-btn:hover { color: #2563eb; text-decoration: underline; }
#view-markets .mk-pe-rel { font-size: 0.78rem; }
#view-markets .mk-th-links { min-width: 150px; }
#view-markets .mk-links a { font-size: 0.8rem; font-weight: 600; color: #2563eb; margin-right: 10px; white-space: nowrap; }
#view-markets .mk-links a:hover { text-decoration: underline; }
#view-markets .mk-ind-links { margin-left: auto; display: inline-flex; gap: 12px; flex-wrap: wrap; }
#view-markets .mk-ind-links a { font-size: 0.8rem; font-weight: 600; color: #2563eb; }

/* (d) world + universe side by side */
#view-markets .mk-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
#view-markets .mk-two .mk-card { margin-bottom: 14px; }
#view-markets .mk-region { margin-bottom: 10px; }
#view-markets .mk-region-h { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; margin: 6px 0 6px; }
#view-markets .mk-world-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
#view-markets .mk-wtile { display: flex; flex-direction: column; gap: 1px; padding: 7px 9px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; min-width: 0; }
#view-markets .mk-wtile-name { font-size: 0.74rem; font-weight: 600; color: #475569; line-height: 1.2; display: flex; justify-content: space-between; gap: 6px; }
#view-markets .mk-wtile-name span { color: #94a3b8; font-weight: 600; font-size: 0.68rem; }
#view-markets .mk-wtile-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
#view-markets .mk-wtile-last { font-size: 0.92rem; font-weight: 700; font-variant-numeric: tabular-nums; }
#view-markets .mk-wtile-chg { font-size: 0.82rem; font-weight: 700; font-variant-numeric: tabular-nums; }
#view-markets .mk-ws { display: inline-block; min-width: 2.2em; text-align: center; border-radius: 5px; padding: 1px 6px; font-size: 0.78rem; font-weight: 700; }
#view-markets .mk-ws-prime { background: #d1fae5; color: #047857; }
#view-markets .mk-ws-good { background: #dbeafe; color: #1d4ed8; }
#view-markets .mk-ws-fair { background: #fef3c7; color: #b45309; }
#view-markets .mk-ws-weak { background: #fee2e2; color: #b91c1c; }

/* (e) yield curve */
#view-markets .mk-curve-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(260px, 3fr); gap: 16px; align-items: start; }
#view-markets #mk-curve-chart { min-height: 320px; }
#view-markets .mk-curve-side { font-size: 0.9rem; color: #334155; line-height: 1.55; }
#view-markets .mk-curve-side .mk-shape { display: inline-block; font-weight: 800; border-radius: 6px; padding: 2px 10px; margin-bottom: 8px; }
#view-markets .mk-shape-normal { background: #d1fae5; color: #047857; }
#view-markets .mk-shape-flat { background: #fef3c7; color: #b45309; }
#view-markets .mk-shape-inverted { background: #fee2e2; color: #b91c1c; }
#view-markets .mk-curve-side table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 0.84rem; }
#view-markets .mk-curve-side td { padding: 3px 0; border-bottom: 1px solid #f1f5f9; font-variant-numeric: tabular-nums; }
#view-markets .mk-curve-side td:last-child { text-align: right; font-weight: 700; }

/* (f) the economy */
#view-markets .mk-gauges-more { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#view-markets .mk-econ { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }   /* five or six tiles fill the row either way */
#view-markets .mk-etile { display: flex; flex-direction: column; gap: 3px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px 8px; min-width: 0; }
#view-markets .mk-e-name { font-size: 0.78rem; font-weight: 700; color: #475569; }
#view-markets .mk-e-val { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; line-height: 1.15; }
#view-markets .mk-e-val small { font-size: 0.8rem; font-weight: 600; color: #64748b; margin-left: 2px; }
#view-markets .mk-e-sub { font-size: 0.72rem; color: #64748b; line-height: 1.35; }
#view-markets .mk-e-spark { height: 44px; margin: 4px -6px 0; }

/* phones + narrow laptops */
@media (max-width: 1100px) {
    #view-markets .mk-sector-grid, #view-markets .mk-two, #view-markets .mk-curve-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 768px) {
    #view-markets .mk-card { padding: 12px 12px 14px; }
    #view-markets .mk-title { font-size: 1.4rem; }
    #view-markets .mk-asof { white-space: normal; }
    #view-markets .mk-win { margin-left: 0; }
    #view-markets .mk-gauges-main, #view-markets .mk-gauges-more { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #view-markets .mk-econ { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #view-markets .mk-g-last { font-size: 1.25rem; }
    #view-markets .mk-g-win { gap: 8px; }
    #view-markets .mk-sector-tiles { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
    #view-markets .mk-tile { flex: 0 0 104px; }
    #view-markets .mk-world-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #view-markets .mk-ind-links { margin-left: 0; }
    #view-markets #mk-gauge-chart, #view-markets #mk-sector-bar, #view-markets #mk-sector-line, #view-markets #mk-curve-chart { min-height: 240px; }
}
