/* ==========================================================================
   Flash Finance — Market Intelligence (/market-intelligence/)
   Layered ON TOP of market.css: every token here comes from that file's :root,
   so this sheet only adds the mi-* components the exchange-data dashboards
   need and never redefines an ff-* rule.
   ========================================================================== */

.mi-crumbs { font-size: .82rem; color: var(--ff-text-soft); margin: 0 2px 10px;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mi-crumbs a { color: var(--ff-accent); text-decoration: none; }
.mi-crumbs a:hover { text-decoration: underline; }
.mi-crumbs span { color: var(--ff-text-faint); }

/* The section nav is 14 items wide — it scrolls horizontally on a phone
   rather than wrapping into a five-row block that buries the page. */
.mi-nav { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; }
.mi-nav a { flex: 0 0 auto; }
@media (min-width: 1100px) { .mi-nav { flex-wrap: wrap; overflow-x: visible; } }

.mi-card { background: var(--ff-card); border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius); box-shadow: var(--ff-shadow);
  padding: 16px 18px; margin-bottom: 14px; }
.mi-card > h2, .mi-card > h3 { margin: 0 0 10px; font-size: 1.02rem;
  color: var(--ff-primary); display: flex; align-items: center; gap: 8px; }
.mi-card p { margin: 6px 0; line-height: 1.55; font-size: .92rem; }
.mi-card p.lede { color: var(--ff-text-soft); max-width: 78ch; }

/* ------------------------------- stat tiles ------------------------------- */
.mi-stats { display: grid; gap: 10px; margin-bottom: 14px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.mi-stat { background: var(--ff-card); border: 1px solid var(--ff-border);
  border-left: 3px solid var(--ff-neutral); border-radius: var(--ff-radius);
  box-shadow: var(--ff-shadow); padding: 12px 14px; }
.mi-stat-v { font-size: 1.32rem; font-weight: 700; color: var(--ff-primary);
  line-height: 1.2; letter-spacing: -.3px; }
.mi-stat-l { font-size: .76rem; color: var(--ff-text-soft); margin-top: 3px;
  text-transform: uppercase; letter-spacing: .3px; }
.mi-stat-s { font-size: .76rem; color: var(--ff-text-faint); margin-top: 5px; }
.mi-stat.good { border-left-color: var(--ff-success); }
.mi-stat.good .mi-stat-v { color: var(--ff-success-deep); }
.mi-stat.bad { border-left-color: var(--ff-danger); }
.mi-stat.bad .mi-stat-v { color: var(--ff-danger-deep); }
.mi-stat.warn { border-left-color: var(--ff-warning); }
.mi-stat.warn .mi-stat-v { color: var(--ff-warning-deep); }
.mi-stat.info { border-left-color: var(--ff-accent); }
.mi-stat.watch { border-left-color: var(--ff-watch); }
.mi-stat.watch .mi-stat-v { color: var(--ff-watch-deep); }

.mi-pos { color: var(--ff-success-deep) !important; }
.mi-neg { color: var(--ff-danger-deep) !important; }
.mi-mute { color: var(--ff-text-faint); }

/* ------------------------------ health score ------------------------------ */
.mi-score-wrap { display: grid; gap: 18px; align-items: center;
  grid-template-columns: minmax(180px, 220px) 1fr; }
@media (max-width: 720px) { .mi-score-wrap { grid-template-columns: 1fr; } }
.mi-score { text-align: center; padding: 8px; }
.mi-score-n { font-size: 3.6rem; font-weight: 700; line-height: 1;
  letter-spacing: -2px; color: var(--ff-primary); }
.mi-score-n small { font-size: 1.1rem; font-weight: 500; color: var(--ff-text-faint);
  letter-spacing: 0; }
.mi-score-lab { margin-top: 6px; font-size: .95rem; font-weight: 600; }
.mi-score-meter { height: 8px; border-radius: 4px; margin-top: 12px;
  background: linear-gradient(90deg, #dc2626 0%, #f59e0b 32%, #eab308 50%, #84cc16 70%, #16a34a 100%);
  position: relative; }
.mi-score-pin { position: absolute; top: -4px; width: 3px; height: 16px;
  background: var(--ff-text); border-radius: 2px; transform: translateX(-50%); }
.mi-score-scale { display: flex; justify-content: space-between;
  font-size: .68rem; color: var(--ff-text-faint); margin-top: 5px; }
.mi-band-strong { color: var(--ff-success-deep); }
.mi-band-good { color: var(--ff-success); }
.mi-band-neutral { color: var(--ff-warning-deep); }
.mi-band-weak { color: var(--ff-warning); }
.mi-band-poor { color: var(--ff-danger-deep); }

/* -------------------------------- bar rows -------------------------------- */
.mi-bar-row { display: grid; grid-template-columns: minmax(110px, 190px) 1fr auto;
  gap: 10px; align-items: center; padding: 5px 0; font-size: .85rem; }
.mi-bar-lab { color: var(--ff-text-soft); }
.mi-bar-track { background: var(--ff-neutral-soft); border-radius: 4px;
  height: 9px; overflow: hidden; }
.mi-bar-fill { display: block; height: 100%; border-radius: 4px;
  background: var(--ff-accent); transition: width .3s; }
.mi-bar-fill.good { background: var(--ff-success); }
.mi-bar-fill.bad { background: var(--ff-danger); }
.mi-bar-fill.warn { background: var(--ff-warning); }
.mi-bar-fill.watch { background: var(--ff-watch); }
.mi-bar-val { font-variant-numeric: tabular-nums; font-weight: 600;
  color: var(--ff-text); min-width: 62px; text-align: right; }

/* -------------------------------- quadrant -------------------------------- */
/* The 2x2 that carries the delivery and OI-buildup pages. Deliberately plain:
   the label and the count are the message, not the box. */
.mi-quad { display: grid; grid-template-columns: auto 1fr 1fr; gap: 2px;
  margin: 14px 0; font-size: .86rem; }
.mi-quad-h { background: var(--ff-neutral-soft); color: var(--ff-neutral-deep);
  font-weight: 600; padding: 9px 12px; text-align: center; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .4px; }
.mi-quad-rh { background: var(--ff-neutral-soft); color: var(--ff-neutral-deep);
  font-weight: 600; padding: 9px 12px; display: flex; align-items: center;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; }
.mi-quad-c { padding: 14px 14px; border-radius: var(--ff-radius-sm);
  background: var(--ff-neutral-soft); }
.mi-quad-c b { display: block; font-size: .95rem; margin-bottom: 3px; }
.mi-quad-c .n { font-size: 1.5rem; font-weight: 700; line-height: 1.15; }
.mi-quad-c .d { font-size: .78rem; color: var(--ff-text-soft); margin-top: 5px;
  line-height: 1.45; }
.mi-quad-c a { color: inherit; text-decoration: none; display: block; }
.mi-quad-c a:hover .n { text-decoration: underline; }
.mi-q-good { background: var(--ff-success-soft); color: var(--ff-success-deep); }
.mi-q-bad { background: var(--ff-danger-soft); color: var(--ff-danger-deep); }
.mi-q-warn { background: var(--ff-warning-soft); color: var(--ff-warning-deep); }
.mi-q-info { background: var(--ff-accent-soft); color: #1e40af; }

/* --------------------------------- tables --------------------------------- */
.mi-table-wrap { overflow-x: auto; border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius); background: var(--ff-card);
  box-shadow: var(--ff-shadow); margin-bottom: 14px; }
.mi-table-wrap table.ff-table td.num,
.mi-table-wrap table.ff-table th.num { text-align: right;
  font-variant-numeric: tabular-nums; }
.mi-sym { color: var(--ff-accent); text-decoration: none; font-weight: 600; }
.mi-sym:hover { text-decoration: underline; }
.mi-tag { display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: .7rem; font-weight: 600; background: var(--ff-neutral-soft);
  color: var(--ff-neutral-deep); white-space: nowrap; }
.mi-tag.good { background: var(--ff-success-soft); color: var(--ff-success-deep); }
.mi-tag.bad { background: var(--ff-danger-soft); color: var(--ff-danger-deep); }
.mi-tag.warn { background: var(--ff-warning-soft); color: var(--ff-warning-deep); }
.mi-tag.info { background: var(--ff-accent-soft); color: #1e40af; }
.mi-tag.watch { background: var(--ff-watch-soft); color: var(--ff-watch-deep); }

/* section heading above a table */
.mi-th { display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; margin: 18px 0 8px; flex-wrap: wrap; }
.mi-th h2, .mi-th h3 { margin: 0; font-size: 1rem; color: var(--ff-primary); }
.mi-th p { margin: 0; font-size: .82rem; color: var(--ff-text-soft); max-width: 70ch; }

/* --------------------------------- story ---------------------------------- */
.mi-story { display: grid; gap: 0; }
.mi-story-item { display: grid; grid-template-columns: 130px 1fr; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--ff-border-soft); }
.mi-story-item:last-child { border-bottom: none; }
.mi-story-item b { font-size: .74rem; text-transform: uppercase;
  letter-spacing: .6px; color: var(--ff-text-faint); padding-top: 2px; }
.mi-story-item p { margin: 0; font-size: .93rem; line-height: 1.6; }
@media (max-width: 620px) {
  .mi-story-item { grid-template-columns: 1fr; gap: 3px; }
}

/* --------------------------------- charts --------------------------------- */
.mi-chart { position: relative; height: 300px; margin: 10px 0 4px; }
.mi-chart.tall { height: 420px; }
.mi-chart.short { height: 210px; }
.mi-chart-note { font-size: .78rem; color: var(--ff-text-faint); margin: 2px 0 0; }

/* ------------------------------ hub cards --------------------------------- */
.mi-hub { display: grid; gap: 12px; margin: 14px 0;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.mi-hub a { display: block; background: var(--ff-card); border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius); box-shadow: var(--ff-shadow); padding: 15px 16px;
  text-decoration: none; color: inherit; transition: all .15s; }
.mi-hub a:hover { box-shadow: var(--ff-shadow-hover); border-color: var(--ff-accent);
  transform: translateY(-1px); }
.mi-hub b { display: block; color: var(--ff-primary); font-size: .95rem; margin-bottom: 4px; }
.mi-hub span { display: block; color: var(--ff-text-soft); font-size: .83rem; line-height: 1.5; }
.mi-hub em { display: block; margin-top: 8px; font-style: normal; font-weight: 600;
  font-size: .82rem; color: var(--ff-accent); font-variant-numeric: tabular-nums; }

/* ------------------------------- related/faq ------------------------------ */
.mi-related { margin: 22px 0 14px; }
.mi-related h2 { font-size: 1rem; color: var(--ff-primary); margin: 0 0 10px; }
.mi-related-grid { display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.mi-related-grid a { display: block; padding: 12px 14px; background: var(--ff-card);
  border: 1px solid var(--ff-border); border-radius: var(--ff-radius);
  text-decoration: none; color: inherit; transition: all .15s; }
.mi-related-grid a:hover { border-color: var(--ff-accent); background: var(--ff-accent-soft); }
.mi-related-grid b { display: block; color: var(--ff-primary); font-size: .88rem; }
.mi-related-grid span { display: block; color: var(--ff-text-soft); font-size: .79rem;
  margin-top: 3px; line-height: 1.45; }

.mi-faq { margin: 22px 0 14px; max-width: 80ch; }
.mi-faq h2 { font-size: 1rem; color: var(--ff-primary); margin: 0 0 8px; }
.mi-faq details { background: var(--ff-card); border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius); margin-bottom: 8px; }
.mi-faq summary { padding: 11px 14px; cursor: pointer; font-weight: 600;
  font-size: .89rem; color: var(--ff-primary); }
.mi-faq details[open] summary { border-bottom: 1px solid var(--ff-border-soft); }
.mi-faq p { margin: 0; padding: 11px 14px; font-size: .88rem; line-height: 1.6;
  color: var(--ff-text); }

/* ----------------------------- fresh + legal ------------------------------ */
.mi-fresh { font-size: .78rem; color: var(--ff-text-faint); margin: 14px 0 6px;
  line-height: 1.6; }
.mi-disclaimer { margin: 18px 0 8px; padding: 13px 15px; background: #fbfcfe;
  border: 1px solid var(--ff-border-soft); border-radius: var(--ff-radius); max-width: 84ch; }
.mi-disclaimer p { margin: 0 0 7px; font-size: .84rem; line-height: 1.6;
  color: var(--ff-text-soft); }
.mi-disclaimer p:last-child { margin-bottom: 0; }
.mi-disc-small { font-size: .78rem !important; color: var(--ff-text-faint) !important; }

/* ------------------------------ switcher pills ---------------------------- */
.mi-switch { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.mi-switch a { padding: 6px 13px; border-radius: 16px; font-size: .82rem;
  font-weight: 600; text-decoration: none; background: var(--ff-neutral-soft);
  color: var(--ff-neutral-deep); border: 1px solid transparent; }
.mi-switch a:hover { background: var(--ff-accent-soft); color: var(--ff-accent); }
.mi-switch a.active { background: var(--ff-primary); color: #fff; }

/* ------------------------------ option ladder ----------------------------- */
/* A two-sided bar chart drawn in CSS grid: call OI grows leftwards from the
   centre, put OI rightwards, so the "walls" are visible without a chart lib
   and without JavaScript. */
.mi-ladder { font-size: .8rem; margin: 10px 0; }
.mi-ladder-row { display: grid; grid-template-columns: 1fr 88px 1fr;
  gap: 6px; align-items: center; padding: 1px 0; }
.mi-ladder-row.atm { background: var(--ff-warning-soft); border-radius: 4px; }
.mi-ladder-row.atm .mi-ladder-k { font-weight: 700; }
.mi-ladder-k { text-align: center; font-variant-numeric: tabular-nums;
  font-weight: 600; color: var(--ff-text); }
.mi-ladder-c, .mi-ladder-p { display: flex; align-items: center; gap: 6px;
  height: 17px; }
.mi-ladder-c { justify-content: flex-end; }
.mi-ladder-c i, .mi-ladder-p i { display: block; height: 11px; border-radius: 2px; }
.mi-ladder-c i { background: var(--ff-danger); opacity: .78; }
.mi-ladder-p i { background: var(--ff-success); opacity: .78; }
.mi-ladder-c s, .mi-ladder-p s { text-decoration: none; font-size: .72rem;
  color: var(--ff-text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mi-ladder-head { display: grid; grid-template-columns: 1fr 88px 1fr; gap: 6px;
  font-size: .74rem; text-transform: uppercase; letter-spacing: .4px;
  color: var(--ff-text-soft); font-weight: 600; padding-bottom: 6px;
  border-bottom: 1px solid var(--ff-border); margin-bottom: 6px; }
.mi-ladder-head .c { text-align: right; color: var(--ff-danger-deep); }
.mi-ladder-head .p { color: var(--ff-success-deep); }
.mi-ladder-head .k { text-align: center; }
.mi-wall { outline: 2px solid var(--ff-primary); outline-offset: 1px; border-radius: 4px; }

/* -------------------------------- heat grid ------------------------------- */
.mi-heat { display: grid; gap: 4px;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); margin: 10px 0; }
.mi-heat a { display: block; padding: 8px 9px; border-radius: var(--ff-radius-sm);
  text-decoration: none; color: inherit; background: var(--ff-neutral-soft); }
.mi-heat b { display: block; font-size: .78rem; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-heat span { display: block; font-size: .74rem; opacity: .85;
  font-variant-numeric: tabular-nums; }

/* -------------------------------- print/dark ------------------------------ */
/* base_news is a light-only shell; these pages follow it rather than inventing
   a second theme. Honour the OS preference only for the page background so a
   dark-mode browser does not flash white around a light card. */
@media (prefers-color-scheme: dark) {
  .mi-card, .mi-stat { color-scheme: light; }
}
