/* dash-builder.css — the widget builder, the charts it previews, and the marks
 * both of them wear.
 *
 * Three layers, in the order they are used:
 *   .rm-mark   — the ONE face an app / company / person shows (dash-marks.js)
 *   .rmv-*     — the native chart set (dash-viz.js) + the chrome under a widget
 *   .dwb-*     — the builder sheet (dash-builder.js)
 *
 * The chart layer is written against custom properties set inline by
 * dash-viz.js, so a light and a dark surface are one substitution rather than a
 * second stylesheet. The site is light today; the dark block below is there so
 * that stays true if it ever isn't.
 */

/* ═══════════════════════════════════════════════════════════════════════════
   1 · THE MARK
   White ground, hairline ring, rounded SQUARE, contain — never cover, which
   zoom-crops a wide wordmark. With no logo the LETTERS take the tint; flooding
   the tile in a brand colour is what makes logo-less rows read as a different
   component altogether.
   ═══════════════════════════════════════════════════════════════════════════ */

.rm-mark {
  --rm-mark-size: 26px;
  --rm-mark-radius: 8px;
  width: var(--rm-mark-size); height: var(--rm-mark-size);
  flex: 0 0 var(--rm-mark-size);
  border-radius: var(--rm-mark-radius);
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .10);
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden; vertical-align: middle;
}
.rm-mark img { width: 100%; height: 100%; object-fit: contain; display: block; padding: 2px; }
.rm-mark.is-round, .rm-mark.is-round img { border-radius: 50%; }
.rm-mark.is-round img { padding: 0; object-fit: cover; }
.rm-mark.is-ini::after {
  content: attr(data-ini);
  font: 700 calc(var(--rm-mark-size) * .40) / 1 "Inter", system-ui, sans-serif;
  letter-spacing: .01em;
  color: currentColor;        /* the LETTERS carry the tint, not the tile */
}
.rm-mark--xs { --rm-mark-size: 18px; --rm-mark-radius: 5px; }
.rm-mark--sm { --rm-mark-size: 22px; --rm-mark-radius: 6px; }
.rm-mark--lg { --rm-mark-size: 34px; --rm-mark-radius: 10px; }

/* ═══════════════════════════════════════════════════════════════════════════
   2 · THE CHARTS
   ═══════════════════════════════════════════════════════════════════════════ */

.rmv {
  --rmv-surface: #fff; --rmv-ink: #0b0b0b; --rmv-ink2: #52514e;
  --rmv-muted: #898781; --rmv-grid: #e8e8e3;
  position: relative;
  display: flex; flex-direction: column;
  width: 100%; height: 100%; min-height: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--rmv-ink);
}
.rmv-plot { position: relative; flex: 1 1 auto; min-height: 0; width: 100%; }
.rmv-plot svg { display: block; }

/* Axis ticks and category labels are TEXT — they wear text tokens, never the
   series colour. A light categorical hue is illegible as type. */
.rmv text { font-family: inherit; }
.rmv-tick { font: 500 10px/1 "Inter", system-ui, sans-serif; fill: var(--rmv-muted); font-variant-numeric: tabular-nums; }
.rmv-cat  { font: 500 11.5px/1 "Inter", system-ui, sans-serif; fill: var(--rmv-ink2); }
.rmv-val  { font: 650 11.5px/1 "Inter", system-ui, sans-serif; fill: var(--rmv-ink); }

.rmv-bar { transition: opacity 140ms ease; }
.rmv-plot:hover .rmv-bar { opacity: .82; }
.rmv-plot .rmv-bar:hover { opacity: 1; }

/* ── Legend — present whenever there are two or more series, absent for one
      (the title already names it, and a box with one swatch costs a row). ── */
.rmv-legend {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  margin: 0 0 8px; flex: 0 0 auto;
}
.rmv-lg {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 11px/1.2 "Inter", system-ui, sans-serif; color: var(--rmv-ink2);
}
.rmv-key { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 9px; }

/* ── Tooltip — where every value we deliberately did not print lives ─────── */
.rmv-tip {
  position: absolute; left: 0; top: 0; z-index: 6; pointer-events: none;
  min-width: 116px; max-width: 260px;
  padding: 8px 10px; border-radius: 9px;
  background: rgba(15, 23, 42, .95);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .28);
  color: #fff; font: 500 11px/1.4 "Inter", system-ui, sans-serif;
  transition: transform 90ms cubic-bezier(.2, .8, .2, 1);
}
.rmv-tip-h { font-weight: 700; margin-bottom: 4px; opacity: .82; font-size: 10.5px; letter-spacing: .01em; }
.rmv-tip-row { display: flex; align-items: center; gap: 7px; padding: 1.5px 0; }
.rmv-tip-row i { width: 8px; height: 8px; border-radius: 2.5px; flex: 0 0 8px; }
.rmv-tip-row span { flex: 1 1 auto; opacity: .82; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rmv-tip-row b { font-weight: 700; font-variant-numeric: tabular-nums; }

.rmv-empty {
  margin: auto; padding: 18px 12px; text-align: center; max-width: 34ch;
  font: 500 12px/1.55 "Inter", system-ui, sans-serif; color: var(--rmv-muted);
}

/* ── Stat ────────────────────────────────────────────────────────────────── */
.rmv-stat { justify-content: center; gap: 12px; }
.rmv-stat.is-multi {
  flex-direction: row; flex-wrap: wrap; align-items: stretch;
  gap: 6px 22px;
}
.rmv-stat.is-multi .rmv-stat-cell { flex: 1 1 130px; min-width: 0; }
.rmv-stat-lab {
  display: flex; align-items: center; gap: 6px;
  font: 600 11px/1.3 "Inter", system-ui, sans-serif; color: var(--rmv-ink2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rmv-stat-val {
  /* Proportional figures: tabular-nums gives every digit a zero's width, which
     makes a number like 121 look loose at display size. */
  font: 650 clamp(26px, 6.4cqw, 46px)/1.05 "Inter", system-ui, sans-serif;
  letter-spacing: -.018em; margin-top: 2px; color: var(--rmv-ink);
}
.rmv-stat.is-multi .rmv-stat-val { font-size: clamp(20px, 4cqw, 30px); }
.rmv-stat-d {
  margin-top: 3px; font: 650 11.5px/1.3 "Inter", system-ui, sans-serif;
  display: flex; align-items: baseline; gap: 5px;
}
.rmv-stat-d span { font-weight: 500; color: var(--rmv-muted); }
.rmv-stat-d--none { color: var(--rmv-muted); font-weight: 500; }
.rmv-spark { width: 100%; height: 22px; margin-top: 8px; display: block; }

/* ── Table ───────────────────────────────────────────────────────────────── */
.rmv-table { min-height: 0; }
.rmv-tbl-scroll { overflow: auto; flex: 1 1 auto; min-height: 0; }
.rmv-tbl { width: 100%; border-collapse: collapse; font: 500 12px/1.35 "Inter", system-ui, sans-serif; }
.rmv-tbl th, .rmv-tbl td { padding: 6px 8px; text-align: left; }
.rmv-tbl thead th {
  position: sticky; top: 0; z-index: 1; background: var(--rmv-surface);
  font: 700 9.5px/1 "Inter", system-ui, sans-serif; letter-spacing: .07em; text-transform: uppercase;
  color: var(--rmv-muted); padding-bottom: 7px;
  box-shadow: inset 0 -1px 0 var(--rmv-grid);
}
.rmv-tbl tbody tr { transition: background 120ms ease; }
.rmv-tbl tbody tr:hover { background: rgba(15, 23, 42, .035); }
.rmv-tbl-rank { width: 22px; color: var(--rmv-muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.rmv-tbl-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rmv-tbl-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--rmv-ink); font-weight: 600; }
.rmv-tbl-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rmv-tbl-num b { font-weight: 700; }
.rmv-tbl-num em { font-style: normal; font-weight: 650; font-size: 10.5px; margin-left: 6px; }
.rmv-tbl-barwrap {
  display: inline-block; vertical-align: middle; width: 54px; height: 5px;
  border-radius: 3px; background: var(--rmv-grid); margin-right: 8px; overflow: hidden;
}
.rmv-tbl-barwrap i { display: block; height: 100%; border-radius: 3px; transition: width 420ms cubic-bezier(.2, .8, .2, 1); }

/* ── Donut ───────────────────────────────────────────────────────────────── */
.rmv-donut { flex-direction: row; align-items: center; gap: 16px; }
/* aspect-ratio + max-height so a short widget shrinks the ring instead of
   cropping it — the same failure the gauge had. */
.rmv-donut-plot {
  position: relative; flex: 0 0 auto;
  width: min(46%, 132px); aspect-ratio: 1; max-height: 100%;
}
.rmv-donut-plot svg { width: 100%; height: 100%; }
.rmv-donut-mid {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; pointer-events: none;
}
.rmv-donut-mid b { font: 650 clamp(15px, 3.4cqw, 22px)/1 "Inter", system-ui, sans-serif; letter-spacing: -.015em; }
.rmv-donut-mid span { font: 500 9.5px/1.2 "Inter", system-ui, sans-serif; color: var(--rmv-muted); margin-top: 3px; max-width: 88%; }
.rmv-donut-key { flex: 1 1 auto; min-width: 0; overflow: auto; max-height: 100%; }
.rmv-dk {
  display: flex; align-items: center; gap: 8px; padding: 3px 0;
  font: 500 11.5px/1.3 "Inter", system-ui, sans-serif; color: var(--rmv-ink2); cursor: default;
}
.rmv-dk i { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 9px; }
.rmv-dk span { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rmv-dk b { font-weight: 700; color: var(--rmv-ink); font-variant-numeric: tabular-nums; }

/* ── Heatmap — sequential, one hue, light→dark. Magnitude is lightness. ──── */
.rmv-heat { gap: 8px; }
.rmv-heat-grid {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column;
  grid-auto-columns: 1fr; gap: 3px;
}
.rmv-heat-grid i { border-radius: 2.5px; display: block; transition: transform 120ms ease; }
.rmv-heat-grid i:hover { transform: scale(1.28); }
.rmv-heat-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font: 500 10px/1 "Inter", system-ui, sans-serif; color: var(--rmv-muted); flex: 0 0 auto;
}
.rmv-heat-scale { display: inline-flex; align-items: center; gap: 3px; }
.rmv-heat-scale i { width: 9px; height: 9px; border-radius: 2px; }

/* ── Gauge ───────────────────────────────────────────────────────────────── */
.rmv-gauge { align-items: center; gap: 6px; }
/* The dial is drawn to the box, not the box to the dial (dash-viz measures it),
   so this only has to give it a box and centre what lands in it. */
.rmv-gauge-plot {
  position: relative; flex: 1 1 auto; min-height: 0; width: 100%;
  display: flex; align-items: center; justify-content: center;
}
.rmv-gauge-plot svg { display: block; }
.rmv-gauge-mid {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 2%;
  display: flex; flex-direction: column; align-items: center;
}
.rmv-gauge-mid b { font: 650 clamp(19px, 5cqw, 30px)/1 "Inter", system-ui, sans-serif; letter-spacing: -.018em; }
.rmv-gauge-mid span { font: 500 10.5px/1.2 "Inter", system-ui, sans-serif; color: var(--rmv-muted); margin-top: 3px; }
.rmv-gauge-foot {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 11px/1.2 "Inter", system-ui, sans-serif; color: var(--rmv-ink2);
}
.rmv-gauge-foot i { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }

/* ── Activity ────────────────────────────────────────────────────────────── */
.rmv-act { overflow: auto; gap: 0; }
.rmv-act-row {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 0; border-bottom: 1px solid var(--rmv-grid);
}
.rmv-act-row:last-child { border-bottom: 0; }
.rmv-act-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--rmv-grid); flex: 0 0 22px; }
.rmv-act-txt { flex: 1 1 auto; min-width: 0; font: 500 11.5px/1.4 "Inter", system-ui, sans-serif; color: var(--rmv-ink2); }
.rmv-act-txt b { color: var(--rmv-ink); font-weight: 650; }
.rmv-act-txt span { font-weight: 650; color: var(--rmv-ink); }
.rmv-act-txt em { display: block; font-style: normal; color: var(--rmv-muted); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rmv-act-row time { font: 500 10.5px/1 "Inter", system-ui, sans-serif; color: var(--rmv-muted); white-space: nowrap; }

/* ── The numbers behind a chart ──────────────────────────────────────────── */
.rmv-num { width: 100%; border-collapse: collapse; font: 500 11px/1.35 "Inter", system-ui, sans-serif; }
.rmv-num th, .rmv-num td { padding: 4px 7px; text-align: right; font-variant-numeric: tabular-nums; }
.rmv-num thead th { color: #94a3b8; font: 700 9px/1 "Inter", system-ui, sans-serif; letter-spacing: .07em; text-transform: uppercase; }
.rmv-num tbody th { text-align: left; font-weight: 600; color: #334155; }
.rmv-num tbody tr:nth-child(odd) { background: rgba(15, 23, 42, .028); }

/* ── The widget host ─────────────────────────────────────────────────────── */
.rm-chart-host {
  display: flex; flex-direction: column; gap: 6px;
  width: 100%; height: 100%; min-height: 0;
  container-type: inline-size;         /* the cqw units the figures scale on */
}
/* Nothing a chart draws may spill out of its widget — the grid clips at the
   card edge and a half-drawn mark reads as a rendering bug. */
.rm-chart-plot { flex: 1 1 auto; min-height: 0; overflow: hidden; }
.rm-chart-foot {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  justify-content: space-between; flex-wrap: wrap;
}
.rm-chart-nums, .rm-chart-flag {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: 600 10.5px/1.3 "Inter", system-ui, sans-serif; color: #94a3b8;
  transition: color 140ms ease;
}
.rm-chart-nums:hover { color: #0b63a6; text-decoration: underline; text-underline-offset: 2px; }
/* Amber, not red: the number is useful, it is just not exact. */
.rm-chart-flag { display: inline-flex; align-items: center; gap: 6px; color: #92400e; text-align: left; max-width: 100%; }
.rm-chart-flag-dot { width: 6px; height: 6px; border-radius: 50%; background: #f59e0b; flex: 0 0 6px; }
.rm-chart-flag-full { font-weight: 500; line-height: 1.45; }
.rm-chart-numsbox {
  flex: 0 0 auto; max-height: 42%; overflow: auto;
  border-top: 1px solid #e2e8f0; padding-top: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   3 · THE BUILDER
   ═══════════════════════════════════════════════════════════════════════════ */

body.dwb-lock { overflow: hidden; }

.dwb-scrim {
  position: fixed; inset: 0; z-index: 100000;
  background: rgba(15, 23, 42, .42);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity 240ms cubic-bezier(.2, .8, .2, 1);
}
.dwb-scrim.is-open { opacity: 1; }

.dwb {
  position: fixed; z-index: 100001;
  inset: 22px; max-width: 1520px; margin: 0 auto;
  background: #fff; border-radius: 20px;
  box-shadow: 0 40px 100px rgba(15, 23, 42, .30), 0 0 0 1px rgba(15, 23, 42, .06);
  display: flex; flex-direction: column; overflow: hidden;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  opacity: 0; transform: translateY(14px) scale(.985);
  transition: opacity 260ms cubic-bezier(.2, .8, .2, 1), transform 260ms cubic-bezier(.2, .8, .2, 1);
}
.dwb.is-open { opacity: 1; transform: none; }

/* ── Header — the name is a document title, not a labelled field ─────────── */
.dwb-hd {
  flex: 0 0 auto; display: flex; align-items: flex-start; gap: 20px;
  padding: 18px 20px 15px 26px; border-bottom: 1px solid #eef1f4;
}
/* Capped so the AI button sits BESIDE the words it writes. Left to grow with
   the header it drifted to the far right of a 1500px bar and read as a
   toolbar action for the whole dialog. */
.dwb-hd-txt { flex: 1 1 auto; min-width: 0; max-width: 520px; }
.dwb-hd-row { display: flex; align-items: center; gap: 10px; }
/* The AI button belongs to the box beside it, not to the dialog — a hairline
   ties it to its own row so two of them stacked don't read as a toolbar. */
.dwb-hd-row .wk-aifill-field { border-left: 1px solid #eef1f4; padding-left: 10px; flex: 0 0 auto; }
.dwb-title, .dwb-sub {
  flex: 1 1 auto; min-width: 0; width: 100%;
  border: 0; background: none; padding: 2px 0; outline: none; color: #0f172a;
  font-family: inherit;
}
.dwb-title { font: 700 21px/1.25 "Inter", system-ui, sans-serif; letter-spacing: -.018em; }
.dwb-sub { font: 500 12.5px/1.4 "Inter", system-ui, sans-serif; color: #64748b; }
.dwb-title::placeholder { color: #cbd5e1; }
.dwb-sub::placeholder { color: #cbd5e1; }
.dwb-title:focus, .dwb-sub:focus { box-shadow: 0 1px 0 0 #0b63a6; }

.dwb-hd-act { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.dwb-cancel, .dwb-save, .dwb-x {
  border: 0; cursor: pointer; font: 650 12.5px/1 "Inter", system-ui, sans-serif; border-radius: 9px;
  transition: background 140ms ease, transform 120ms ease, box-shadow 140ms ease;
}
.dwb-cancel { background: none; color: #64748b; padding: 10px 12px; }
.dwb-cancel:hover { background: #f1f5f9; color: #334155; }
.dwb-save {
  background: #0b63a6; color: #fff; padding: 10px 18px;
  box-shadow: 0 6px 16px rgba(11, 99, 166, .26);
}
.dwb-save:hover { background: #095389; transform: translateY(-1px); }
.dwb-save:active { transform: none; }
.dwb-x { background: none; color: #94a3b8; width: 32px; height: 32px; font-size: 14px; }
.dwb-x:hover { background: #f1f5f9; color: #334155; }

/* ── Three panes ─────────────────────────────────────────────────────────── */
.dwb-body {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: 246px minmax(0, 1fr) minmax(320px, 420px);
}
.dwb-rail, .dwb-side { overflow: auto; }
.dwb-rail { border-right: 1px solid #eef1f4; padding: 18px 16px 22px; background: #fbfcfd; }
.dwb-mid { overflow: auto; padding: 26px 30px 34px; min-width: 0; }
.dwb-side { border-left: 1px solid #eef1f4; padding: 18px 20px 24px; background: #fbfcfd; }

.dwb-rail-lbl, .dwb-side-lbl {
  font: 700 9.5px/1 "Inter", system-ui, sans-serif; letter-spacing: .09em; text-transform: uppercase;
  color: #94a3b8; margin-bottom: 11px;
}
.dwb-rail-lbl--2 { margin-top: 22px; }

/* ── The series list ─────────────────────────────────────────────────────── */
.dwb-srow {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; margin-bottom: 6px; border-radius: 11px;
  border: 1px solid transparent; background: #fff; cursor: pointer; text-align: left;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}
.dwb-srow:hover { border-color: #dbe3ea; transform: translateY(-1px); }
.dwb-srow.is-sel { border-color: #0b63a6; box-shadow: 0 2px 10px rgba(11, 99, 166, .14); }
.dwb-sdot {
  width: 13px; height: 13px; border-radius: 4px; flex: 0 0 13px;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(15, 23, 42, .10);
  transition: transform 130ms ease;
}
.dwb-sdot:hover { transform: scale(1.18); }
.dwb-stxt { flex: 1 1 auto; min-width: 0; display: block; }
.dwb-stxt b { display: block; font: 650 12px/1.3 "Inter", system-ui, sans-serif; color: #0f172a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dwb-stxt small { display: block; font: 500 10px/1.3 "Inter", system-ui, sans-serif; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dwb-sdel { flex: 0 0 auto; color: #cbd5e1; font-size: 10px; padding: 3px; border-radius: 5px; transition: color 130ms ease, background 130ms ease; }
.dwb-sdel:hover { color: #c73127; background: #fef2f2; }
.dwb-sadd {
  width: 100%; border: 1px dashed #cbd5e1; background: none; cursor: pointer;
  border-radius: 11px; padding: 9px 10px; margin-top: 2px;
  font: 600 11.5px/1.3 "Inter", system-ui, sans-serif; color: #64748b; text-align: left;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}
.dwb-sadd:hover { border-color: #0b63a6; color: #0b63a6; background: #f4f9fd; }

/* ── The form strip — the one place a picture beats a word ───────────────── */
.dwb-forms { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dwb-form {
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
  padding: 9px 10px; border-radius: 10px; cursor: pointer; text-align: left;
  border: 1px solid #e8edf1; background: #fff; color: #475569;
  font: 600 11px/1.2 "Inter", system-ui, sans-serif;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease, opacity 140ms ease;
}
.dwb-form:hover { border-color: #b9c8d6; color: #0f172a; }
.dwb-form.is-sel { border-color: #0b63a6; background: #f4f9fd; color: #0b5387; box-shadow: inset 0 0 0 1px #0b63a6; }
.dwb-form.is-off { opacity: .38; cursor: not-allowed; }
.dwb-form-g { display: block; height: 18px; }
.dwb-form-g svg { height: 18px; width: 26px; fill: currentColor; }

/* ── The sentence ────────────────────────────────────────────────────────── */
.dwb-quick {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin: 0 0 24px; padding-bottom: 20px; border-bottom: 1px solid #f1f5f9;
  overflow: hidden;
  transition: opacity 200ms ease, height 220ms cubic-bezier(.2, .8, .2, 1),
              margin 220ms cubic-bezier(.2, .8, .2, 1), padding 220ms cubic-bezier(.2, .8, .2, 1);
}
.dwb-quick.is-gone { opacity: 0; height: 0 !important; margin-bottom: 0; padding-bottom: 0; }
.dwb-quick-l { font: 700 9.5px/1 "Inter", system-ui, sans-serif; letter-spacing: .09em; text-transform: uppercase; color: #94a3b8; margin-right: 3px; }
.dwb-qbtn {
  border: 1px solid #e8edf1; background: #fff; cursor: pointer;
  border-radius: 999px; padding: 6px 13px; font: 600 11.5px/1.3 "Inter", system-ui, sans-serif; color: #475569;
  transition: border-color 140ms ease, color 140ms ease, transform 120ms ease;
}
.dwb-qbtn:hover { border-color: #0b63a6; color: #0b63a6; transform: translateY(-1px); }

.dwb-sentence { max-width: 780px; }
.dwb-line {
  margin: 0 0 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  font: 500 19px/1.55 "Inter", system-ui, sans-serif; color: #0f172a; letter-spacing: -.008em;
}
.dwb-w { color: #94a3b8; font-weight: 500; }
.dwb-dim { font-size: 15px; }

/* A token reads as a word you can change, not as a form field. */
.dwb-tok {
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; cursor: pointer; font: inherit; font-weight: 650; color: #0b63a6;
  background: #f2f7fc; border-radius: 10px; padding: 3px 10px 3px 8px;
  box-shadow: inset 0 0 0 1px rgba(11, 99, 166, .16);
  transition: background 140ms ease, box-shadow 140ms ease, transform 110ms ease;
  max-width: 100%;
}
.dwb-tok > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dwb-tok:hover { background: #e7f1fa; box-shadow: inset 0 0 0 1px rgba(11, 99, 166, .34); }
.dwb-tok:active { transform: scale(.985); }
.dwb-tok[aria-expanded="true"] { background: #e2eefa; box-shadow: inset 0 0 0 1.5px #0b63a6; }
.dwb-tok-c {
  width: 0; height: 0; flex: 0 0 auto; margin-left: 1px;
  border-left: 3.5px solid transparent; border-right: 3.5px solid transparent;
  border-top: 4px solid currentColor; opacity: .5;
}
.dwb-tok-x { font-style: normal; font-size: 10px; opacity: .5; padding: 0 1px; border-radius: 4px; }
.dwb-tok-x:hover { opacity: 1; color: #c73127; }
.dwb-tokimg { width: 17px; height: 17px; object-fit: contain; border-radius: 4px; background: #fff; }
.dwb-tok .rm-mark { --rm-mark-size: 19px; --rm-mark-radius: 5px; }

/* ── What this can claim ─────────────────────────────────────────────────
   The widget has room for a truncated flag; this is where the whole sentence
   lives. Amber, not red — the number is useful, it is just not exact. */
.dwb-read { max-width: 720px; margin-top: 30px; padding-top: 22px; border-top: 1px solid #f1f5f9; }
.dwb-read:empty { border-top: 0; margin: 0; padding: 0; }
.dwb-read-lbl {
  font: 700 9.5px/1 "Inter", system-ui, sans-serif; letter-spacing: .09em; text-transform: uppercase;
  color: #94a3b8; margin-bottom: 11px;
}
.dwb-read-b {
  display: flex; gap: 9px; margin: 0 0 9px;
  font: 500 12.5px/1.6 "Inter", system-ui, sans-serif; color: #475569;
}
.dwb-read-b i { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; margin-top: 8px; }
.dwb-read-b.is-warn i { background: #f59e0b; }
.dwb-read-b.is-ok i { background: #0ca30c; }
.dwb-read-b.is-ok span { color: #64748b; }

.dwb-addf {
  border: 1px dashed #cbd5e1; background: none; cursor: pointer;
  border-radius: 9px; padding: 3px 11px; font: 600 14px/1.5 "Inter", system-ui, sans-serif; color: #64748b;
  transition: border-color 140ms ease, color 140ms ease;
}
.dwb-addf:hover { border-color: #0b63a6; color: #0b63a6; }

/* ── The preview — the real widget, at the shape it will be placed at ────── */
.dwb-prev-body {
  aspect-ratio: var(--dwb-ar, 1.1);
  min-height: 190px; max-height: 340px;
  transition: opacity 130ms ease;
}
.dwb-prev-body.is-fading { opacity: 0; }
.dwb-prev-card {
  width: 100%; height: 100%;
  background: #fff; border: 1px solid #e8edf1; border-radius: 14px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .06);
  padding: 13px 14px 11px; display: flex; flex-direction: column; gap: 8px;
  overflow: hidden;
}
.dwb-prev-hd { flex: 0 0 auto; min-width: 0; }
.dwb-prev-hd b { display: block; font: 650 13px/1.3 "Inter", system-ui, sans-serif; color: #0f172a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dwb-prev-hd small { display: block; font: 500 10.5px/1.35 "Inter", system-ui, sans-serif; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dwb-prev-plot { flex: 1 1 auto; min-height: 0; }

.dwb-facts { margin-top: 13px; display: flex; flex-direction: column; gap: 6px; }
.dwb-fact { font: 500 11px/1.5 "Inter", system-ui, sans-serif; color: #64748b; }
.dwb-fact--src { display: flex; align-items: center; gap: 6px; color: #94a3b8; font-size: 10.5px; }
.dwb-live { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; flex: 0 0 6px; }
.dwb-live.is-live { background: #0ca30c; box-shadow: 0 0 0 3px rgba(12, 163, 12, .16); }

/* ── The token popover ───────────────────────────────────────────────────── */
.dwb-pop {
  position: fixed; z-index: 100010;
  background: #fff; border-radius: 13px;
  box-shadow: 0 20px 52px rgba(15, 23, 42, .22), 0 0 0 1px rgba(15, 23, 42, .07);
  overflow: hidden; max-height: min(420px, 72vh);
  display: flex; flex-direction: column;
  font-family: "Inter", system-ui, sans-serif;
  opacity: 0; transform: translateY(-5px) scale(.985);
  transition: opacity 150ms cubic-bezier(.2, .8, .2, 1), transform 150ms cubic-bezier(.2, .8, .2, 1);
}
.dwb-pop.is-open { opacity: 1; transform: none; }
.dwb-pop-find { flex: 0 0 auto; padding: 9px 10px; border-bottom: 1px solid #f1f5f9; }
.dwb-pop-find input {
  width: 100%; border: 1px solid #e2e8f0; border-radius: 8px; padding: 7px 10px;
  font: 500 12px/1.3 "Inter", system-ui, sans-serif; color: #0f172a; outline: none;
  transition: border-color 130ms ease, box-shadow 130ms ease;
}
.dwb-pop-find input:focus { border-color: #0b63a6; box-shadow: 0 0 0 3px rgba(11, 99, 166, .12); }
.dwb-pop-list { overflow: auto; padding: 5px; flex: 1 1 auto; }
.dwb-pop-grp {
  font: 700 9px/1 "Inter", system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase;
  color: #94a3b8; padding: 9px 9px 5px;
}
.dwb-pop-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: 9px; cursor: pointer;
  transition: background 110ms ease;
}
.dwb-pop-row:hover, .dwb-pop-row.is-cursor { background: #f4f7fa; }
.dwb-pop-row.is-on { background: #f2f7fc; }
.dwb-pop-row.is-off { opacity: .42; cursor: not-allowed; }
.dwb-pop-txt { flex: 1 1 auto; min-width: 0; }
.dwb-pop-txt b { display: block; font: 600 12.5px/1.35 "Inter", system-ui, sans-serif; color: #0f172a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dwb-pop-txt small { display: block; font: 500 10.5px/1.4 "Inter", system-ui, sans-serif; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dwb-pop-why { font: 500 9.5px/1.2 "Inter", system-ui, sans-serif; color: #94a3b8; white-space: nowrap; }
.dwb-pop-tick {
  width: 15px; height: 15px; flex: 0 0 15px; border-radius: 5px;
  box-shadow: inset 0 0 0 1.5px #dbe3ea; position: relative;
  transition: background 130ms ease, box-shadow 130ms ease;
}
.dwb-pop-row.is-on .dwb-pop-tick { background: #0b63a6; box-shadow: inset 0 0 0 1.5px #0b63a6; }
.dwb-pop-row.is-on .dwb-pop-tick::after {
  content: ''; position: absolute; left: 4.5px; top: 2px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 1.8px 1.8px 0; transform: rotate(42deg);
}
.dwb-pop-img { width: 22px; height: 22px; object-fit: contain; border-radius: 6px; background: #fff; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .10); flex: 0 0 22px; }
.dwb-swatch { width: 22px; height: 22px; border-radius: 6px; flex: 0 0 22px; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .12); }
.dwb-pop-foot {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 8px 10px; border-top: 1px solid #f1f5f9;
}
.dwb-pop-n { font: 600 11px/1 "Inter", system-ui, sans-serif; color: #94a3b8; }
.dwb-pop-done {
  border: 0; background: #0b63a6; color: #fff; cursor: pointer;
  border-radius: 8px; padding: 7px 15px; font: 650 11.5px/1 "Inter", system-ui, sans-serif;
  transition: background 130ms ease;
}
.dwb-pop-done:hover { background: #095389; }
.dwb-pop-note {
  flex: 0 0 auto; padding: 9px 11px; border-top: 1px solid #f1f5f9;
  font: 500 10.5px/1.5 "Inter", system-ui, sans-serif; color: #94a3b8;
}

.dwb-toast {
  position: fixed; left: 50%; bottom: 34px; z-index: 100020;
  transform: translate(-50%, 12px); opacity: 0;
  background: #0f172a; color: #fff; border-radius: 10px; padding: 11px 18px;
  font: 600 12px/1 "Inter", system-ui, sans-serif;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .3);
  transition: opacity 200ms ease, transform 200ms cubic-bezier(.2, .8, .2, 1);
}
.dwb-toast.is-open { opacity: 1; transform: translate(-50%, 0); }

/* ── Narrow ──────────────────────────────────────────────────────────────
   The preview is the first thing to go: on a phone you are editing, and the
   grid it lands on is not that shape anyway. */
@media (max-width: 1180px) {
  .dwb-body { grid-template-columns: 220px minmax(0, 1fr); }
  .dwb-side { display: none; }
}
@media (max-width: 820px) {
  .dwb { inset: 0; border-radius: 0; }
  .dwb-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .dwb-rail { border-right: 0; border-bottom: 1px solid #eef1f4; }
  .dwb-forms { grid-template-columns: repeat(4, 1fr); }
  .dwb-line { font-size: 16px; }
  .dwb-mid { padding: 18px; }
}

/* ── Dark ─────────────────────────────────────────────────────────────────
   Selected, not flipped. Nothing on runmai.app stamps a dark theme today; this
   is here so the charts do not have to be rewritten the day something does. */
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .rmv-num tbody tr:nth-child(odd) { background: rgba(255, 255, 255, .04); }
  :root:where(:not([data-theme="light"])) .rmv-num tbody th { color: #c3c2b7; }
  :root:where(:not([data-theme="light"])) .rmv-tbl tbody tr:hover { background: rgba(255, 255, 255, .05); }
  :root:where(:not([data-theme="light"])) .rm-mark { background: #f7f7f5; }
}
:root[data-theme="dark"] .rmv-num tbody tr:nth-child(odd) { background: rgba(255, 255, 255, .04); }
:root[data-theme="dark"] .rmv-num tbody th { color: #c3c2b7; }
:root[data-theme="dark"] .rmv-tbl tbody tr:hover { background: rgba(255, 255, 255, .05); }
:root[data-theme="dark"] .rm-mark { background: #f7f7f5; }

@media (prefers-reduced-motion: reduce) {
  .dwb, .dwb-scrim, .dwb-pop, .rmv-tip, .dwb-prev-body { transition: none !important; }
  .rmv-path, .rmv-bar, .rmv-arc, .rmv-g-fill, .rmv-stat-val, .rmv-act-row { transition: none !important; animation: none !important; }
}
