/* UK & Global Finance Monitor (tools/finance-monitor). Theme-aware: uses the site tokens; dark via [data-theme="dark"]. */
.fm-page .gm-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; }
.fm-page .gm-head .gas-range { margin-left: auto; }

/* scores */
.fm-scores { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 12px; }
.fm-score { border: 1px solid var(--border); border-top: 4px solid var(--fm); border-radius: 12px; padding: 14px 16px; background: var(--surface); }
.fm-score-t { font-size: .85rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.fm-score-row { display: flex; align-items: baseline; gap: 6px; margin: 4px 0 8px; }
.fm-score-v { font-size: 2.6rem; font-weight: 800; line-height: 1; color: var(--fm); font-variant-numeric: tabular-nums; }
.fm-score-of { color: var(--muted); font-size: .95rem; }
.fm-score-lv { margin-left: auto; font-weight: 800; font-size: 1.1rem; color: var(--fm); }
.fm-score-bar { position: relative; height: 10px; border-radius: 5px; background: var(--bg-2); overflow: hidden; border: 1px solid var(--border); }
.fm-score-bar span { display: block; height: 100%; background: var(--fm); border-radius: 5px; }
.fm-score-bar i { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); }
.fm-score-s { margin-top: 8px; }
.fm-brief { margin-top: 14px; border: 1px solid var(--border); border-left: 4px solid var(--link); border-radius: 10px; padding: 12px 16px; background: var(--bg-2); }
.fm-brief-k { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--link); }
.fm-brief-h { margin: 4px 0 0; font-size: 1.08rem; font-weight: 600; line-height: 1.45; }
.fm-brief-r { margin: 8px 0 0; }
.fm-tag { display: inline-block; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; border: 1px solid #b45309; color: #b45309; border-radius: 5px; padding: 1px 6px; margin-right: 8px; vertical-align: 1px; }
:root[data-theme="dark"] .fm-tag { border-color: #fbbf24; color: #fbbf24; }
.fm-tag-up { border-color: #15803d; color: #15803d; } .fm-tag-down { border-color: #b91c1c; color: #b91c1c; }
:root[data-theme="dark"] .fm-tag-up { border-color: #4ade80; color: #4ade80; } :root[data-theme="dark"] .fm-tag-down { border-color: #f87171; color: #f87171; }
.fm-legend { margin-top: 10px; }
.fm-legend span { font-weight: 700; }

/* drivers */
.fm-parts3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.fm-part { padding: 6px 0; border-bottom: 1px solid var(--border); }
.fm-part:last-child { border-bottom: 0; }
.fm-part-top { display: flex; justify-content: space-between; gap: 8px; font-size: .92rem; }
.fm-part-l { font-weight: 600; }
.fm-part-p { font-weight: 800; font-variant-numeric: tabular-nums; }
.fm-part-bar { height: 6px; border-radius: 3px; background: var(--bg-2); margin: 4px 0 3px; overflow: hidden; }
.fm-part-bar span { display: block; height: 100%; border-radius: 3px; }
.fm-part-n { line-height: 1.35; }

/* briefing */
.fm-brief3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.fm-brief3 .gx-h3 { margin-top: 0; }
.fm-brief3 p { margin: 0; line-height: 1.55; }
.fm-outlook { margin-top: 14px; }
.fm-outlook .gx-h3 { margin-top: 0; }
.fm-outlook ul { margin: 0 0 8px; padding-left: 20px; line-height: 1.55; }

/* market tiles */
.fm-gh { margin-top: 18px; }
.fm-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.fm-tile { display: grid; grid-template-columns: 1fr; gap: 3px; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 8px; cursor: pointer; transition: border-color .15s, transform .15s; }
.fm-tile:hover { border-color: var(--link); }
.fm-tile:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.fm-tile-n { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-tile-v { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.fm-tile-v small { font-size: .72rem; font-weight: 600; color: var(--muted); margin-left: 2px; }
.fm-tile-c { display: flex; gap: 10px; font-size: .8rem; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.fm-tile-c b { font-weight: 600; color: var(--muted); font-size: .7rem; }
.fm-spark { display: block; height: 26px; }
.fm-spark-s { width: 90px; height: 22px; }
.fm-spark-svg { width: 100%; height: 100%; display: block; }
.fm-spark-svg path { stroke: #64748b; }
.spark-good path { stroke: #16a34a; } .spark-bad path { stroke: #dc2626; } .spark-neutral path { stroke: #2563eb; }
:root[data-theme="dark"] .spark-neutral path { stroke: #60a5fa; }
.fin-good { color: #15803d; } .fin-bad { color: #b91c1c; } .fin-neutral { color: var(--text); } .fin-flat { color: var(--muted); }
:root[data-theme="dark"] .fin-good { color: #4ade80; } :root[data-theme="dark"] .fin-bad { color: #f87171; }

/* charts */
.fm-plot { position: relative; min-height: 120px; }
.fm-plot-lg { min-height: 260px; }
.fm-svg { width: 100%; height: auto; display: block; overflow: visible; }
.fm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 26px; }
.fm-chart .gx-h3 { margin-top: 14px; }
.fm-chart p { margin: 4px 0 0; }
.fm-band { fill: var(--muted); opacity: .12; }
.fm-zero { stroke: var(--muted); stroke-width: 1; }
.fm-ref { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; opacity: .7; }
.fm-ref-l { fill: var(--muted); font-size: 10px; font-family: inherit; }
.fm-mark { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; opacity: .55; }
.fm-mark-l { fill: var(--muted); font-size: 10px; font-family: inherit; }
.fm-empty { padding: 30px 0; text-align: center; }

/* shares */
.fm-movers { display: grid; gap: 6px; margin-bottom: 8px; font-size: .9rem; }
.fm-mover { white-space: nowrap; margin-right: 10px; }
.fm-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.fm-tablewrap { overflow-x: auto; }
.fm-table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.fm-table th, .fm-table td { padding: 5px 6px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.fm-table th[scope="row"], .fm-table thead th:first-child { text-align: left; font-weight: 600; }
.fm-table thead th { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.fm-sym { font-size: .74rem; font-weight: 400; }
.fm-td-spark { width: 96px; }
.fm-trend { max-width: 620px; }

/* warning signs */
.fm-signals { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 22px; }
.fm-signals li { display: grid; grid-template-columns: 22px 1fr; gap: 0 6px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.fm-sig-i { grid-row: span 2; font-weight: 800; }
.fm-signals .is-on .fm-sig-i { color: #c2410c; } .fm-signals .is-off .fm-sig-i { color: #15803d; }
:root[data-theme="dark"] .fm-signals .is-on .fm-sig-i { color: #fb923c; } :root[data-theme="dark"] .fm-signals .is-off .fm-sig-i { color: #4ade80; }
.fm-signals .is-on .fm-sig-n { font-weight: 700; }

/* headlines */
.fm-news { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; }
.fm-news li { padding: 7px 0; border-bottom: 1px solid var(--border); line-height: 1.4; }
.fm-news a { color: var(--text); text-decoration: none; font-weight: 600; }
.fm-news a:hover { color: var(--link); text-decoration: underline; }

@media (max-width: 960px) {
  .fm-parts3, .fm-brief3 { grid-template-columns: 1fr; }
  .fm-scores { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .fm-grid, .fm-two, .fm-signals, .fm-news { grid-template-columns: minmax(0, 1fr); }
  .fm-trend th, .fm-trend td { white-space: normal; }
  .fm-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fm-tile-v { font-size: 1.08rem; }
  .fm-page .gm-head .gas-range { margin-left: 0; }
}
@media (max-width: 520px) {
  .fm-td-spark, .fm-table thead th:last-child { display: none; }
  .fm-table th[scope="row"] { white-space: normal; }
  .fm-table th, .fm-table td { padding: 5px 4px; }
}
@media (max-width: 400px) { .fm-tiles { grid-template-columns: minmax(0, 1fr); } }

/* households: why the averages look better than it feels */
.fm-squeeze { border: 1px solid var(--border); border-left: 4px solid #ea580c; border-radius: 10px; padding: 14px 16px; background: var(--bg-2); margin: 10px 0 6px; }
.fm-squeeze h3 { margin: 0 0 10px; font-size: 1.02rem; }
.fm-sq-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 10px; }
.fm-sq-stats div { display: grid; gap: 2px; }
.fm-sq-stats b { font-size: 1.6rem; font-weight: 800; color: #c2410c; font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .fm-sq-stats b { color: #fb923c; }
.fm-sq-stats span { font-size: .84rem; color: var(--muted); line-height: 1.4; }
.fm-squeeze ul { margin: 0; padding-left: 18px; line-height: 1.5; color: var(--text); }
.fm-squeeze li + li { margin-top: 4px; }
@media (max-width: 960px) { .fm-sq-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .fm-sq-stats { grid-template-columns: minmax(0, 1fr); } }

/* road tax card */
.fm-ved { margin-top: 18px; }
.fm-ved .gx-h3 { margin-top: 0; }
.fm-ved .fm-sq-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* countries */
.fm-cty { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr); gap: 26px; align-items: start; }
.fm-cty-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 34px; gap: 2px 10px; align-items: center; padding: 6px 8px; border-radius: 8px; }
.fm-cty-row.is-uk { background: var(--bg-2); outline: 2px solid var(--link); }
.fm-cty-n { font-weight: 700; }
.fm-cty-bar { height: 10px; border-radius: 5px; background: var(--bg-2); overflow: hidden; border: 1px solid var(--border); }
.fm-cty-bar span { display: block; height: 100%; border-radius: 5px; }
.fm-cty-s { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.fm-cty-d { grid-column: 1 / -1; }
.fm-cty-ctl { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-bottom: 8px; }
.fm-cty-ctl .gas-range { margin-left: 0; }
.fm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.fm-chip { font: inherit; font-size: .8rem; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); cursor: pointer; }
.fm-chip i { width: 10px; height: 10px; border-radius: 50%; opacity: .45; }
.fm-chip[aria-pressed="true"] { color: var(--text); border-color: var(--link); font-weight: 600; }
.fm-chip[aria-pressed="true"] i { opacity: 1; }
.fm-chip:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
@media (max-width: 960px) { .fm-cty { grid-template-columns: minmax(0, 1fr); } .fm-ved .fm-sq-stats { grid-template-columns: minmax(0, 1fr); } }

.fm-tile-static { cursor: default; }
.fm-tile-static:hover { border-color: var(--border); }

/* population pyramid + top migration nationalities */
.fm-pyr-then { fill: none; stroke: var(--text); stroke-width: 1; opacity: .45; }
.uh-leg i.fm-pyr-key { background: none !important; border: 1px solid var(--text); opacity: .6; }
.fm-migtop { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.fm-migtop-h { font-weight: 700; font-size: .88rem; margin-bottom: 4px; }
.fm-migtop-row { display: grid; grid-template-columns: minmax(0, 9em) minmax(0, 1fr) 3.4em; gap: 2px 8px; align-items: center; padding: 4px 0; }
.fm-migtop-n { font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-migtop-v { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; font-size: .86rem; }
.fm-migtop-d { grid-column: 1 / -1; }
@media (max-width: 520px) { .fm-migtop { grid-template-columns: minmax(0, 1fr); } }

.fm-sched th, .fm-sched td { white-space: normal; text-align: left; vertical-align: top; }
.fm-sched td:last-child { white-space: nowrap; }
