/* styles.css — Refined Current design language (mockup 3): paper/navy/teal
   tokens, IBM Plex Sans Hebrew, section rhythm with numbered labels, card
   chart treatments. RTL document; charts and tables are LTR islands. */

:root {
  color-scheme: light;
  --bg: #fbfbf8;
  --surface: #ffffff;
  --ink: #14202f;
  --muted: #64708a;
  --faint: #8b95a8;
  --line: #e1e5ec;
  --line-soft: #eef1f5;
  --soft: #f3f6f9;
  --navy: #243a5e;
  --teal: #128b86;
  --teal-ink: #0c6b67;
  --teal-soft: rgba(18, 139, 134, 0.13);
  --green: #1f7a4d;
  --amber: #b07d1a;
  --amber-soft: #f7edd6;
  --red: #b23a44;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(20, 32, 47, 0.05), 0 1px 1px rgba(20, 32, 47, 0.04);
  --shadow-md: 0 6px 22px rgba(20, 32, 47, 0.08), 0 2px 6px rgba(20, 32, 47, 0.05);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "IBM Plex Sans Hebrew", -apple-system, "Segoe UI", "Noto Sans Hebrew", Arial, sans-serif;
  line-height: 1.62; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
.wrap { width: min(1240px, calc(100% - 56px)); margin: 0 auto; }
h1, h2, h3, h4, p, figure, dl { margin: 0; }
[dir="ltr"] { unicode-bidi: isolate; }
b, i { font-style: normal; }
.num { font-variant-numeric: tabular-nums; }
button, input { font: inherit; }
.hidden { display: none !important; }

/* ---------- Header ---------- */
.site-header { padding: 64px 0 40px; border-bottom: 1px solid var(--line); }
.header-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; margin-bottom: 30px; }
.eyebrow {
  color: var(--teal-ink); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; direction: ltr;
}
.provenance-badge {
  display: inline-flex; align-items: center; gap: 9px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  padding: 7px 16px; color: var(--muted); font-size: 0.8rem; font-weight: 500;
  box-shadow: var(--shadow-sm); white-space: nowrap;
}
.provenance-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: 0 0 auto; }
.provenance-badge .sep { color: var(--line); }
h1 { font-size: clamp(2.5rem, 4.4vw, 3.6rem); font-weight: 700; line-height: 1.06; letter-spacing: -0.015em; max-width: 20ch; margin-bottom: 18px; }
.lede { max-width: 64ch; color: #3c4859; font-size: 1.16rem; font-weight: 400; }
.lede b { font-weight: 600; color: var(--ink); }

/* ---------- Sections ---------- */
main { padding-bottom: 100px; }
main section { padding: 72px 0; border-bottom: 1px solid var(--line); }
.section-label {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px;
  color: var(--teal-ink); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
}
.section-label .n { color: var(--faint); font-weight: 600; direction: ltr; }
h2 { font-size: clamp(1.7rem, 2.6vw, 2.2rem); font-weight: 700; letter-spacing: -0.01em; line-height: 1.16; margin-bottom: 14px; }
.section-lede { max-width: 70ch; color: var(--muted); font-size: 1.02rem; margin-bottom: 36px; }
.section-lede b { color: var(--ink); font-weight: 600; }
.section-foot { margin-top: 18px; color: var(--faint); font-size: 0.82rem; max-width: 80ch; }

/* ---------- 01 Methodology ---------- */
.method-prose { max-width: 76ch; margin-bottom: 34px; display: grid; gap: 14px; }
.method-prose p { font-size: 1.05rem; line-height: 1.7; color: #2c3a4e; }
.method-prose em { font-style: normal; color: var(--teal-ink); font-weight: 700; }
.method-prose b { font-weight: 600; }
.equation-band {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 22px 28px; margin-bottom: 18px; direction: ltr;
}
.equation-band .term { font-size: 1.06rem; font-weight: 600; color: var(--navy); white-space: nowrap; font-variant-numeric: tabular-nums; }
.equation-band .op { margin: 0 16px; color: var(--faint); font-weight: 500; font-size: 1.05rem; }
.equation-band .result { color: var(--teal-ink); font-weight: 700; font-size: 1.18rem; }
.equation-note { color: var(--faint); font-size: 0.85rem; margin-bottom: 36px; max-width: 75ch; }
.equation-note b { color: var(--muted); }
.steps { list-style: none; margin: 0 0 36px; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; counter-reset: step; }
.step {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); padding: 18px 16px 16px; counter-increment: step;
}
.step::before {
  content: counter(step); display: grid; place-items: center; width: 26px; height: 26px;
  margin-bottom: 12px; border-radius: 50%;
  background: var(--soft); color: var(--teal-ink); font-size: 0.82rem; font-weight: 700; direction: ltr;
}
.step strong { display: block; font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.step .what { color: var(--muted); font-size: 0.85rem; line-height: 1.55; margin-bottom: 10px; }
.step .why { color: var(--teal-ink); font-size: 0.82rem; font-weight: 500; line-height: 1.5; padding-top: 9px; border-top: 1px dashed var(--line-soft); }
.step .why::before { content: "למה ·"; font-weight: 700; margin-inline-end: 5px; }
.measure-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 26px; }
.measure-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); padding: 20px 22px; }
.measure-card.normalized { border-inline-start: 3px solid var(--teal); }
.measure-card h4 { font-size: 1.02rem; font-weight: 700; color: var(--navy); margin-bottom: 7px; }
.measure-card p { color: var(--muted); font-size: 0.9rem; }
.principles { display: flex; flex-wrap: wrap; gap: 10px; }
.principle {
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  padding: 7px 16px; color: var(--ink); font-size: 0.85rem; font-weight: 500;
}
.principle::before { content: "◆"; color: var(--teal); font-size: 0.6rem; margin-inline-end: 8px; vertical-align: 2px; }

/* ---------- Charts shared ---------- */
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 28px 28px 20px; }
.chart-host { direction: ltr; }
.chart-host svg { width: 100%; height: auto; display: block; }
.chart-svg text { font-family: "IBM Plex Sans Hebrew", sans-serif; }
.chart-svg .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart-svg .grid-zero { stroke: #c3ccd8; stroke-width: 1.4; }
.chart-svg .grid-label { fill: var(--faint); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.chart-svg .row-label { fill: var(--ink); font-size: 16px; font-weight: 700; }
.chart-svg .row-sub { fill: var(--faint); font-size: 11.5px; font-weight: 500; }
.chart-svg .bar-main { fill: var(--teal); }
.chart-svg .bar-norm { fill: var(--teal-soft); }
.chart-svg .norm-tick { stroke: var(--navy); stroke-width: 2.4; stroke-linecap: round; }
.chart-svg .val-main-in { fill: #fff; font-size: 14.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-svg .val-main-out { fill: var(--teal-ink); font-size: 14.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-svg .val-norm { fill: var(--navy); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-svg .line-label { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-svg .hit, .mm-svg .hit { fill: transparent; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 26px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 0.84rem; }
.chart-legend .key { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.chart-legend .swatch { width: 18px; height: 11px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }
.chart-legend .swatch.main { background: var(--teal); }
.chart-legend .swatch.norm { background: var(--teal-soft); border-inline-end: 2.4px solid var(--navy); }
.chart-legend .swatch.est { background: repeating-linear-gradient(45deg, rgba(18,139,134,0.5) 0 2px, rgba(18,139,134,0.15) 2px 5px); border: 1px solid var(--teal); }

/* hover tooltip (shared across all charts) */
.chart-tip {
  position: fixed; z-index: 60; pointer-events: none; opacity: 0;
  background: var(--ink); color: #fff; border-radius: 8px; padding: 7px 11px;
  font-size: 0.8rem; font-weight: 500; line-height: 1.45; box-shadow: var(--shadow-md);
  max-width: 280px; transition: opacity 120ms var(--ease);
  font-variant-numeric: tabular-nums;
}
.chart-tip.visible { opacity: 1; }
.chart-tip b { font-weight: 700; direction: ltr; unicode-bidi: isolate; }

/* ---------- 02 Results table ---------- */
.headline-note { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); color: #36425a; font-size: 0.95rem; }
.headline-note b { color: var(--ink); direction: ltr; unicode-bidi: isolate; }
.results-table-wrap { direction: ltr; margin-top: 22px; overflow-x: auto; }
table { direction: ltr; width: 100%; border-collapse: collapse; }
th, td { padding: 11px 16px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td { font-size: 0.98rem; }
td.num { color: var(--muted); font-weight: 500; }
td.num.main-col { color: var(--ink); font-weight: 700; font-size: 1.05rem; }
.t-name strong { font-weight: 700; }
.t-name span { display: block; color: var(--muted); font-size: 0.78rem; }
.est-chip {
  display: inline-block; margin-inline-start: 10px; padding: 2px 9px; border-radius: 999px;
  background: var(--amber-soft); color: var(--amber); font-size: 0.7rem; font-weight: 700; vertical-align: 2px; direction: rtl;
}
.t-delta[data-tone="pos"] { color: var(--green); font-weight: 700; }
.t-delta[data-tone="neg"] { color: var(--red); font-weight: 700; }
.t-delta[data-tone="flat"] { color: var(--faint); }
.just-changed { animation: pulse 650ms var(--ease); border-radius: 6px; }
@keyframes pulse { 0% { background: rgba(18, 139, 134, 0.22); } 100% { background: transparent; } }

/* ---------- 03 Trend ---------- */
.story-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 22px; }
.story-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); padding: 18px 20px; border-top: 3px solid var(--story); }
.story-card .co { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.story-card .co strong { font-size: 1rem; font-weight: 700; direction: ltr; }
.story-card .tag { color: var(--story); font-size: 0.78rem; font-weight: 700; }
.story-card .delta { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; direction: ltr; text-align: right; margin-bottom: 8px; color: var(--ink); }
.story-card .delta .arrow { color: var(--faint); font-weight: 400; margin: 0 6px; }
.story-card p { color: var(--muted); font-size: 0.84rem; line-height: 1.55; }

/* ---------- 04 Momentum ---------- */
.line-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 14px; direction: ltr; }
.line-legend .key { display: inline-flex; align-items: center; gap: 7px; font-size: 0.82rem; font-weight: 700; color: var(--ink); }
.line-legend .key i { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.momentum-table td.num strong { display: block; color: var(--ink); font-weight: 700; }
.momentum-table .period-label { display: block; color: var(--faint); font-size: 0.72rem; font-weight: 600; }
.growth { font-weight: 700 !important; }
.growth[data-tone="pos"] { color: var(--green) !important; }
.growth[data-tone="neg"] { color: var(--red) !important; }
.growth[data-tone="flat"] { color: var(--faint) !important; }

/* ---------- 05 CapEx small multiples ---------- */
.mm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mm-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); padding: 18px 18px 12px; }
.mm-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.mm-id strong { display: block; font-size: 1.04rem; font-weight: 700; direction: ltr; text-align: start; }
.mm-id span { color: var(--faint); font-size: 0.76rem; font-weight: 500; direction: ltr; }
.mm-num { text-align: left; direction: ltr; }
.mm-num b { display: block; font-size: 1.55rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.mm-num span { color: var(--muted); font-size: 0.76rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.mm-num span i { color: var(--teal-ink); font-weight: 700; }
.mm-svg { width: 100%; height: auto; display: block; }
.mm-svg .mbar { fill: var(--navy); }
.mm-svg .mm-base { stroke: var(--line); stroke-width: 1.2; }
.mm-svg .mm-axis { fill: var(--faint); font-size: 9.5px; font-weight: 500; font-family: "IBM Plex Sans Hebrew", sans-serif; font-variant-numeric: tabular-nums; }

/* ---------- 06 Projections ---------- */
.chart-blurb { margin: 14px 0 0; color: var(--faint); font-size: 0.82rem; }
.projection-table { min-width: 920px; }
.projection-table th span { display: block; font-size: 0.62rem; color: var(--faint); font-weight: 600; text-transform: none; letter-spacing: 0; }
.projection-table td.num strong { display: block; color: var(--ink); font-weight: 700; }
.projection-table td.num span { display: block; font-size: 0.76rem; }
.proj-multiline { fill: none; stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }

/* ---------- 07 Assumptions ---------- */
.lab-grid { display: grid; grid-template-columns: 5fr 4fr 232px; gap: 34px; align-items: start; }

/* ---- Live readout beside the dials ---- */
.lab-readout {
  position: sticky; top: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 18px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 14px;
}
.readout-head h3 { margin: 0 0 2px; font-size: 0.98rem; }
.readout-head .mini-note { margin: 0; }
.readout-block h4 {
  margin: 0 0 8px; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.06em;
  color: var(--teal-ink); text-transform: uppercase;
}
.readout-row {
  display: grid; grid-template-columns: 44px 1fr auto 52px; gap: 8px;
  align-items: center; padding: 3px 0; font-size: 0.82rem;
}
.readout-row--growth { grid-template-columns: 44px 1fr auto 52px; }
.readout-tk { color: var(--muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; }
.readout-bar { display: block; height: 6px; background: var(--soft); border-radius: 3px; overflow: hidden; direction: ltr; }
.readout-bar i { display: block; height: 100%; background: var(--teal); border-radius: 3px; transition: width 0.45s var(--ease); }
.readout-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.readout-row .t-delta { font-size: 0.76rem; text-align: left; font-variant-numeric: tabular-nums; }
.lab-col-head { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; margin-bottom: 18px; }
.lab-col-head h3 { font-size: 1.06rem; font-weight: 700; }
.reset-pill {
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  padding: 6px 15px; color: var(--muted); font-size: 0.8rem; font-weight: 600; cursor: pointer;
  transition: color 160ms var(--ease), border-color 160ms var(--ease);
}
.reset-pill:hover, .reset-pill:focus-visible { color: var(--teal-ink); border-color: var(--teal); }
.mini-note { margin: -8px 0 14px; color: var(--muted); font-size: 0.85rem; }
.dials { display: grid; gap: 12px; }
.dial { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); padding: 16px 20px 14px; }
.dial.changed { border-color: var(--teal); }
.dial-head { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; margin-bottom: 8px; }
.dial-head .label-with-tip { display: inline-flex; gap: 6px; align-items: center; min-width: 0; }
.dial-head b { font-size: 0.9rem; font-weight: 600; }
.dial.changed .dial-head b::after {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-start: 8px;
  border-radius: 50%; background: var(--teal); vertical-align: 1px;
}
.dial-val { color: var(--teal-ink); direction: ltr; font-style: normal; font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dial input[type="range"] { width: 100%; height: 22px; accent-color: var(--teal); cursor: pointer; direction: ltr; display: block; }
.dial-range { display: flex; justify-content: space-between; margin-top: 2px; color: var(--faint); font-size: 0.72rem; direction: ltr; font-variant-numeric: tabular-nums; }

/* company rows: collapsed → progressive disclosure */
.company-rows { display: grid; gap: 10px; }
.company-row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.company-row.open { border-color: var(--teal); box-shadow: var(--shadow-md); }
.company-row-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  width: 100%; border: 0; background: transparent; cursor: pointer; text-align: start;
  padding: 14px 20px; border-radius: var(--radius-sm);
}
.company-row-head .nm { font-weight: 700; font-size: 0.98rem; direction: ltr; }
.company-row-head .nm small { display: block; color: var(--muted); font-size: 0.74rem; font-weight: 500; }
.company-row-head .fields { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.field-tag { border: 1px solid var(--line-soft); background: var(--soft); border-radius: 999px; padding: 3px 11px; color: var(--muted); font-size: 0.73rem; font-weight: 500; white-space: nowrap; }
.field-tag.changed { border-color: var(--teal); color: var(--teal-ink); }
.company-row-head .chev { color: var(--faint); font-size: 0.8rem; flex: 0 0 auto; transition: transform 200ms var(--ease); }
.company-row.open .company-row-head .chev { transform: rotate(180deg); }
.company-row-body { display: none; padding: 4px 20px 18px; }
.company-row.open .company-row-body { display: block; animation: fade-in 220ms var(--ease); }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.co-open-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.co-open-head span { color: var(--faint); font-size: 0.76rem; }
.company-reset {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 4px 12px; font-size: 0.72rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; flex: 0 0 auto;
  transition: border-color 140ms var(--ease), color 140ms var(--ease);
}
.company-reset:hover, .company-reset:focus-visible { border-color: var(--teal); color: var(--teal-ink); }
.company-assumption-group { direction: ltr; display: grid; gap: 8px; min-width: 0; padding: 10px 0; }
.company-assumption-group + .company-assumption-group { border-top: 1px solid var(--line-soft); }
.group-title { display: inline-flex; gap: 6px; align-items: center; color: var(--ink); font-weight: 700; font-size: 0.85rem; }
.mini-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mini-fields.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.label-with-tip { position: relative; display: inline-flex; gap: 6px; align-items: center; min-width: 0; }

.number-field { direction: ltr; display: grid; gap: 5px; color: var(--muted); font-size: 0.78rem; }
.number-field > .label-with-tip { justify-content: flex-start; }
.number-input {
  display: flex; align-items: center; gap: 2px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 2px;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.number-input:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(18, 139, 134, 0.12); }
.number-field.changed .number-input { border-color: var(--teal); }
.number-field.changed > .label-with-tip::after {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-inline-start: 2px;
  border-radius: 50%; background: var(--teal);
}
.number-input input {
  width: 100%; min-width: 0; border: 0; background: transparent; padding: 5px 4px; text-align: center;
  font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.number-input input::-webkit-outer-spin-button,
.number-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.number-input small { color: var(--faint); padding-inline-end: 4px; }
.number-input .step-btn {
  flex: 0 0 22px; height: 26px; border: 0; border-radius: 6px; background: var(--soft);
  color: var(--muted); cursor: pointer; font-weight: 700; line-height: 1;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}
.number-input .step-btn:hover { background: #e7edf2; color: var(--teal-ink); }

.flag-note { display: flex; gap: 8px; align-items: baseline; margin-top: 8px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--amber-soft); color: #6b4a08; font-size: 0.8rem; line-height: 1.5; direction: rtl; }
.flag-note::before { content: "⚑"; color: var(--amber); }
.lab-flow-note { margin-top: 26px; color: var(--muted); font-size: 0.88rem; max-width: 70ch; }
.lab-flow-note b { color: var(--ink); font-weight: 600; }

/* Info dot tooltip (assumption explanations) */
.info-dot {
  position: relative; display: inline-grid; width: 17px; height: 17px; flex: 0 0 17px;
  place-items: center; border: 1px solid #c0cad6; border-radius: 50%; background: #fff;
  color: var(--muted); cursor: help; font-size: 0.7rem; font-weight: 700; line-height: 1; padding: 0;
}
.info-dot::after {
  position: absolute; bottom: calc(100% + 8px); inset-inline-end: 0; z-index: 30;
  width: 290px; max-width: calc(100vw - 32px); padding: 10px 12px; border-radius: 8px;
  background: var(--ink); color: #fff; content: attr(data-tip); direction: rtl;
  font-size: 0.78rem; font-weight: 500; line-height: 1.5; text-align: right;
  opacity: 0; pointer-events: none; transform: translateY(4px);
  transition: opacity 150ms var(--ease), transform 150ms var(--ease); box-shadow: var(--shadow-md);
}
.info-dot:hover::after, .info-dot:focus-visible::after { opacity: 1; transform: translateY(0); }
.number-field .info-dot::after { inset-inline-end: auto; inset-inline-start: 0; }

/* ---------- Glossary ---------- */
.glossary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 28px; margin: 22px 0 0; }
.glossary-term { padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.glossary-term dt { color: var(--navy); font-weight: 700; direction: ltr; text-align: right; margin-bottom: 3px; }
.glossary-term dd { margin: 0; color: var(--muted); font-size: 0.88rem; }
.estimate-head { margin-top: 30px; color: var(--navy); font-size: 1.05rem; }
.estimate-notes { margin: 10px 0 0; padding-inline-start: 18px; color: var(--muted); font-size: 0.9rem; }
.estimate-notes li { margin-bottom: 6px; }
.estimate-notes b { color: var(--ink); direction: ltr; unicode-bidi: isolate; }

/* ---------- Footer / banner / error ---------- */
footer { padding: 36px 0 64px; color: var(--faint); font-size: 0.84rem; }
footer .src { direction: ltr; text-align: end; unicode-bidi: plaintext; }
footer .row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 26px; align-items: baseline; }
.reconcile-banner { background: #fbe9c8; color: #6b4a08; padding: 10px 16px; font-size: 0.86rem; text-align: center; }
.error { padding: 48px; width: min(720px, 92%); margin: 0 auto; }
.error pre { background: var(--soft); padding: 14px; border-radius: 8px; overflow-x: auto; }

/* ---------- Responsive (1024 must hold) ---------- */
@media (max-width: 1120px) {
  .steps { gap: 10px; }
  .step { padding: 15px 13px 13px; }
  .lab-grid { gap: 26px; }
  .story-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .wrap { width: calc(100% - 44px); }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .mm-grid { grid-template-columns: repeat(2, 1fr); }
  .lab-grid { grid-template-columns: 1fr; }
  .lab-readout { position: static; order: -1; }
  .lab-readout .readout-block { display: inline-block; vertical-align: top; width: 48%; }
}
@media (max-width: 680px) {
  .wrap { width: calc(100% - 28px); }
  .provenance-badge {
    max-width: 100%; flex-wrap: wrap; white-space: normal;
    row-gap: 3px; border-radius: 16px;
  }
  .steps { grid-template-columns: 1fr 1fr; }
  .measure-grid, .mm-grid, .story-grid { grid-template-columns: 1fr; }
  .mini-fields, .mini-fields.compact { grid-template-columns: 1fr 1fr; }
  .glossary { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
