/* Liquidity monitor: builds on ../style.css (the site's tokens and base). */

:root {
  /* Status colours: fixed in both themes, always shown with a shape and a label. */
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --neutral: #898781;
  --band-repricing: rgba(250, 178, 25, 0.13);
  --band-crunch: rgba(208, 59, 59, 0.11);
  --grid: var(--line);
  --axis: var(--muted);
  --series: var(--accent);
}

@media (prefers-color-scheme: dark) {
  :root {
    --band-repricing: rgba(250, 178, 25, 0.11);
    --band-crunch: rgba(208, 59, 59, 0.16);
  }
}

.wrap.wide { max-width: 1040px; }

.crumbs { padding-top: 28px; font-size: 0.9rem; }
.crumbs a { font-weight: 600; text-decoration: none; }
.crumbs a::before { content: "\2190\00a0"; }
.intro { padding-top: 12px; }

.panel {
  margin-top: 16px; padding: 20px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow);
}
.panel h2 { margin-top: 0; }
.panel p { margin: 6px 0; }

.eyebrow { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.meta { color: var(--muted); font-size: 0.9rem; }
.empty { color: var(--muted); }
.regime { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
.regime-rule { font-weight: 600; }
.warning {
  margin-top: 12px !important; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); font-weight: 600;
}
.warning .status { display: flex; margin-bottom: 2px; }

/* status chip: a shape in the status colour + a text label, never colour alone */
.status { display: inline-flex; align-items: center; gap: 0.4em; font-weight: 650; white-space: nowrap; }
.status .shape { width: 0.62em; height: 0.62em; flex: none; background: var(--neutral); }
.s-green .shape { background: var(--good); border-radius: 50%; }
.s-amber .shape { background: var(--warning); clip-path: polygon(50% 0, 100% 100%, 0 100%); width: 0.72em; height: 0.66em; }
.s-red .shape { background: var(--critical); transform: rotate(45deg); width: 0.56em; height: 0.56em; }
.s-stale .shape, .s-unknown .shape, .s-none .shape {
  background: transparent; border: 2px solid var(--neutral); border-radius: 50%; box-sizing: border-box;
}

/* index */
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 4px 0 6px; }
.hero-figure { font-size: 3.4rem; font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.hero-side { display: flex; flex-direction: column; gap: 2px; font-size: 1.05rem; }
.method { margin-top: 10px; }
.method p { color: var(--muted); font-size: 0.92rem; }

.toggle { display: inline-flex; gap: 2px; margin: 12px 0 6px; padding: 2px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.toggle button {
  font: inherit; font-size: 0.85rem; font-weight: 650; color: var(--muted);
  background: transparent; border: 0; border-radius: 8px; padding: 4px 12px; cursor: pointer;
}
.toggle button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* charts */
.chart { position: relative; width: 100%; }
.chart-svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis { fill: var(--axis); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .band-repricing { fill: var(--band-repricing); }
.chart .band-crunch { fill: var(--band-crunch); }
.chart .band-label {
  fill: var(--muted); font-size: 11px; font-weight: 650;
  paint-order: stroke; stroke: var(--card); stroke-width: 3px; stroke-linejoin: round;
}
.chart .crosshair { stroke: var(--muted); stroke-width: 1; shape-rendering: crispEdges; }
.chart .dot { fill: var(--series); stroke: var(--card); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: crosshair; touch-action: pan-y; outline: none; }
.chart .hit:focus-visible { stroke: var(--accent); stroke-width: 2; }
.tooltip {
  position: absolute; z-index: 2; min-width: 150px; max-width: 260px; pointer-events: none;
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); box-shadow: 0 4px 18px rgba(20, 22, 30, 0.12); font-size: 0.85rem;
}
.tip-value { font-weight: 700; font-size: 1rem; }
.tip-title { color: var(--muted); margin-bottom: 4px; }
.tip-row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.tip-num { color: var(--ink); font-variant-numeric: tabular-nums; }

/* indicator tiles */
.group h2 { margin-top: 32px; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.tile {
  display: flex; flex-direction: column; gap: 4px; width: 100%; height: 100%; padding: 16px; text-align: left;
  font: inherit; color: inherit; cursor: pointer;
  border-radius: 16px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.tile:hover { border-color: var(--accent); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.tile-label { font-weight: 700; }
.tile-head .status { font-size: 0.85rem; }
.tile-value { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.01em; }
.tile-rule { color: var(--muted); font-size: 0.82rem; line-height: 1.4; margin-top: 2px; }
.tile .meta { font-size: 0.85rem; }
.spark { position: relative; display: block; height: 30px; margin: 4px 0; }
.spark-svg { display: block; width: 100%; height: 30px; overflow: visible; }
.spark-line { fill: none; stroke: var(--muted); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark-dot {
  position: absolute; right: -4px; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%;
  background: var(--series); box-shadow: 0 0 0 2px var(--card);
}

/* detail dialog */
dialog#detail {
  width: min(880px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0;
  border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink);
}
dialog#detail::backdrop { background: rgba(10, 12, 16, 0.45); }
.detail-body { padding: 20px; }
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.detail-head h2 { margin: 0; font-size: 1.25rem; text-transform: none; letter-spacing: -0.01em; color: var(--ink); }
.close {
  font: inherit; font-weight: 650; font-size: 0.9rem; cursor: pointer; padding: 6px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 12px 0; font-size: 0.92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* tables and lists */
.table-view { margin-top: 10px; font-size: 0.9rem; }
.table-view summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.table-view table { border-collapse: collapse; margin-top: 8px; }
.table-view th, .table-view td { text-align: left; padding: 3px 14px 3px 0; border-bottom: 1px solid var(--line); }
.table-view .num { text-align: right; font-variant-numeric: tabular-nums; }
.regime-rules { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.sources { margin: 6px 0 12px; padding-left: 18px; }
.sources li { margin: 2px 0; }
.foot p { margin: 6px 0; }

@media (max-width: 520px) {
  .panel { padding: 16px; }
  .hero-figure { font-size: 3rem; }
  .regime { font-size: 1.4rem; }
  dialog#detail { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; margin: 0; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) { .tile { transition: none; } }
