/* ==========================================================================
   ZeroSpread — Market Memory «ذاكرة السوق»
   .mm-* scope · Tajawal 400/500/700 · Latin digits · RTL
   ========================================================================== */

.mm-section,
.mm-drawer-root {
  --mm-font: var(--font-tajawal, 'Tajawal'), system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mm-bg: #f7f8fa;
  --mm-surface: #ffffff;
  --mm-pearl: #fafbfc;
  --mm-line: #e7e9ed;
  --mm-line-soft: #eff1f4;
  --mm-ink: #111317;
  --mm-ink-2: #2b2f36;
  --mm-muted: #6a707b;
  --mm-muted-2: #8b9099;
  --mm-up: #178a5a;
  --mm-up-bg: #eaf6f0;
  --mm-down: #cf3f37;
  --mm-down-bg: #fcecea;
  --mm-sage: #5f8672;
  --mm-sage-soft: #e7efe9;
  --mm-ridge: #aab1b9;
  --mm-ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  font-family: var(--mm-font);
  font-synthesis: none;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--mm-ink);
}
.mm-section {
  background: var(--mm-bg);
  padding: 44px 0 36px;
}
.mm-section *,
.mm-drawer-root * {
  box-sizing: border-box;
  letter-spacing: 0;
}
.mm-section :where(h2, h3, h4, p, ul, dl, dd, dt, figure),
.mm-drawer-root :where(h3, h4, p, ul, dl, dd, dt, figure) {
  margin: 0;
  padding: 0;
}
.mm-section :where(ul),
.mm-drawer-root :where(ul) {
  list-style: none;
}
.mm-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.mm-container {
  max-width: 1640px;
  margin: 0 auto;
  padding: 0 52px;
}

/*
 * Homepage mount: section sits inside `.zsph-wrap` (same as News / Overview / Reaction).
 * Neutralize nested max-width + horizontal gutter so edges align.
 */
.zsph-wrap > .mm-section,
.zsph-wrap .mm-section {
  width: 100%;
  max-width: none;
  padding-inline: 0;
  margin-inline: 0;
  background: transparent;
}

.zsph-wrap > .mm-section > .mm-container,
.zsph-wrap .mm-section > .mm-container {
  max-width: none;
  margin-inline: 0;
  width: 100%;
  padding-inline: 0;
}

/* ─── Header ─────────────────────────────────────────────────────────── */
.mm-head-title {
  display: flex;
  align-items: center;
  gap: 16px;
}
.mm-title {
  font-size: 40px;
  line-height: 1.25;
  font-weight: 700;
}
.mm-index {
  font-size: 22px;
  font-weight: 500;
  color: var(--mm-muted-2);
  padding-inline-start: 16px;
  border-inline-start: 1px solid var(--mm-line);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.mm-hook {
  margin-top: 10px;
  font-size: 17px;
  line-height: 1.7;
  color: var(--mm-muted);
}
.mm-hook b {
  color: var(--mm-ink-2);
  font-weight: 700;
}

/* ─── Surface (desktop composition, RTL: current | field | memories) ─── */
.mm-surface {
  margin-top: 26px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr) minmax(0, 1.18fr);
  gap: 20px;
  background: var(--mm-surface);
  border: 1px solid var(--mm-line);
  border-radius: 20px;
  padding: 18px 20px;
  min-height: 560px;
}
.mm-col-current,
.mm-col-memories {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.mm-col-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.mm-panel {
  border: 1px solid var(--mm-line);
  border-radius: 16px;
  background: var(--mm-surface);
  padding: 16px 18px;
}
.mm-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.mm-panel-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--mm-ink);
}
.mm-panel-title svg {
  color: #5d636d;
}
.mm-scope {
  font-size: 12.5px;
  color: var(--mm-muted-2);
}
.mm-note {
  font-size: 13px;
  line-height: 1.7;
  color: var(--mm-muted);
}
.mm-tone-up { color: var(--mm-up); }
.mm-tone-down { color: var(--mm-down); }
.mm-tone-neutral { color: var(--mm-ink-2); }

/* ─── Current state ──────────────────────────────────────────────────── */
.mm-current-body {
  margin-top: 12px;
}
.mm-current-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.mm-asset {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mm-asset-mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.mm-ticker {
  font-size: 16px;
  font-weight: 700;
}
.mm-asset-name {
  font-size: 12.5px;
  color: var(--mm-muted-2);
  direction: rtl;
  text-align: left;
}
.mm-change {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 12px;
  border-radius: 10px;
  background: #f4f6f5;
  font-variant-numeric: tabular-nums;
}
.mm-change.mm-tone-up { background: var(--mm-up-bg); }
.mm-change.mm-tone-down { background: var(--mm-down-bg); }
.mm-change b { font-size: 15px; font-weight: 700; }
.mm-change small { font-size: 11px; color: var(--mm-muted-2); }
.mm-price-row {
  margin-top: 10px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.mm-price {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
}
.mm-quote-unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--mm-muted-2);
}
.mm-state-line {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}
.mm-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.mm-current-chart {
  margin-top: 10px;
}
.mm-range {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}
.mm-range-btn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--mm-line);
  background: #fff;
  color: var(--mm-muted);
  cursor: pointer;
  transition: border-color 200ms var(--mm-ease), color 200ms var(--mm-ease);
}
.mm-range-btn[aria-selected='true'] {
  border-color: #c9cdd4;
  color: var(--mm-ink);
  font-weight: 700;
}
.mm-dims {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mm-dim {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--mm-pearl);
  border: 1px solid var(--mm-line-soft);
}
.mm-dim dt {
  font-size: 11.5px;
  color: var(--mm-muted-2);
}
.mm-dim dd {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.mm-fresh {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--mm-muted-2);
  font-variant-numeric: tabular-nums;
}

/* ─── Reading ────────────────────────────────────────────────────────── */
.mm-reading-closest {
  font-size: 12.5px;
  color: var(--mm-muted);
}
.mm-reading-closest b {
  color: var(--mm-sage);
  font-weight: 700;
}
.mm-reading-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mm-reading-col {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--mm-pearl);
  border: 1px solid var(--mm-line-soft);
}
.mm-reading-col h4 {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 8px;
}
.mm-reading-col ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.mm-reading-col li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  line-height: 1.5;
}
.mm-rep svg { color: var(--mm-sage); flex: none; }
.mm-diff svg { color: #a86c1d; flex: none; }
.mm-afterwards {
  margin-top: 10px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--mm-ink-2);
}
.mm-reading-foot {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--mm-line-soft);
}
.mm-conf {
  font-size: 13px;
  color: var(--mm-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}
.mm-conf b { font-weight: 700; }
.mm-conf-high { color: var(--mm-sage); }
.mm-conf-medium { color: var(--mm-ink-2); }
.mm-conf-low { color: #a86c1d; }
.mm-prelim {
  margin-inline-start: 6px;
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff5e6;
  color: #8a5a12;
}
.mm-disclaimer {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.6;
  color: var(--mm-muted-2);
}
.mm-disclaimer svg { flex: none; margin-top: 3px; }

/* ─── Memory field ───────────────────────────────────────────────────── */
.mm-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
}
.mm-field-head {
  text-align: center;
}
.mm-chip {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 12px;
  border: 1px solid var(--mm-line);
  border-radius: 8px;
  background: #fff;
}
.mm-field-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--mm-muted-2);
}
.mm-field-stage {
  position: relative;
  width: 100%;
  max-width: 470px;
  aspect-ratio: 1 / 1;
}
.mm-field-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.mm-ridge {
  fill: none;
  stroke: #9aa2ab;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transition: stroke 240ms var(--mm-ease), stroke-width 240ms var(--mm-ease);
}
.mm-scan-ridge {
  fill: none;
  stroke: var(--mm-sage);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
  opacity: 0;
}
.mm-point {
  cursor: pointer;
}
.mm-point-halo {
  fill: var(--mm-sage-soft);
  opacity: 0;
  transition: opacity 220ms var(--mm-ease);
}
.mm-point-ring {
  fill: #fff;
  stroke: var(--mm-sage);
  stroke-width: 1.2;
}
.mm-point-core {
  fill: var(--mm-sage);
}
.mm-point--r1 .mm-point-core {
  fill: #1f5c43;
}
.mm-point-label {
  font-size: 13px;
  font-weight: 700;
  fill: var(--mm-ink-2);
  font-family: var(--mm-font);
}
.mm-field-core {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 46%;
  height: 26%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--mm-line);
  border-radius: 16px;
  pointer-events: none;
}
.mm-core-icon {
  color: var(--mm-ink-2);
}
.mm-field-core strong {
  font-size: 16px;
  font-weight: 700;
}
.mm-field-core span {
  font-size: 11.5px;
  color: var(--mm-muted-2);
  font-variant-numeric: tabular-nums;
}
.mm-field-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--mm-muted-2);
}
.mm-lg {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.mm-lg-1 { background: #1f5c43; }
.mm-lg-2 { background: var(--mm-sage); }
.mm-lg-3 { background: #c6d3cb; }

.mm-strip {
  display: none;
}

/* hover linkage (card ↔ point ↔ ridge) — no colour-only meaning: rank numbers + text stay */
.mm-surface[data-hover='m1'] .mm-point[data-id='m1'] .mm-point-halo,
.mm-surface[data-hover='m2'] .mm-point[data-id='m2'] .mm-point-halo,
.mm-surface[data-hover='m3'] .mm-point[data-id='m3'] .mm-point-halo {
  opacity: 1;
}
.mm-surface[data-hover='m1'] .mm-ridge[data-for~='m1'],
.mm-surface[data-hover='m2'] .mm-ridge[data-for~='m2'],
.mm-surface[data-hover='m3'] .mm-ridge[data-for~='m3'] {
  stroke: var(--mm-sage);
  stroke-width: 1.8;
  opacity: 0.9 !important;
}
.mm-surface[data-hover='m1'] .mm-card[data-memory-id='m1'],
.mm-surface[data-hover='m2'] .mm-card[data-memory-id='m2'],
.mm-surface[data-hover='m3'] .mm-card[data-memory-id='m3'] {
  border-color: #b9c9bf;
  background: #fcfdfc;
}

/* ─── Memory cards ───────────────────────────────────────────────────── */
.mm-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 30px;
}
.mm-stale-note {
  font-size: 12px;
  color: #8a5a12;
}
.mm-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.mm-card {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 16px;
  border: 1px solid var(--mm-line);
  border-radius: 14px;
  padding: 14px 16px;
  background: #fff;
  cursor: pointer;
  outline: none;
  transition: border-color 200ms var(--mm-ease), background-color 200ms var(--mm-ease), box-shadow 200ms var(--mm-ease);
}
.mm-card:hover {
  box-shadow: 0 8px 24px -18px rgba(16, 24, 40, 0.25);
}
.mm-card:focus-visible,
.mm-range-btn:focus-visible,
.mm-icon-btn:focus-visible {
  outline: 2px solid var(--mm-ink);
  outline-offset: 2px;
}
.mm-card--closest {
  border-color: #cfdcd4;
}
.mm-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mm-rank {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: #f2f3f5;
  font-variant-numeric: tabular-nums;
}
.mm-rank-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--mm-muted);
}
.mm-card--closest .mm-rank {
  background: var(--mm-sage-soft);
  color: #1f5c43;
}
.mm-card--closest .mm-rank-label {
  color: #1f5c43;
}
.mm-card-date {
  margin-top: 6px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}
.mm-card-meta {
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 12px;
  color: var(--mm-muted-2);
  font-variant-numeric: tabular-nums;
}
.mm-card-after {
  margin-top: 10px;
}
.mm-after-title {
  font-size: 11.5px;
  color: var(--mm-muted-2);
}
.mm-outcomes {
  margin-top: 4px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.mm-outcome {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-inline: 8px;
  border-inline-start: 1px solid var(--mm-line-soft);
}
.mm-outcome:first-child {
  padding-inline-start: 0;
  border-inline-start: 0;
}
.mm-outcome dd {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.mm-outcome dt {
  font-size: 11.5px;
  color: var(--mm-muted-2);
}
.mm-outcome[data-tone='up'] dd { color: var(--mm-up); }
.mm-outcome[data-tone='down'] dd { color: var(--mm-down); }
.mm-outcome[data-tone='none'] dd { color: var(--mm-muted-2); }
.mm-card-visual {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.mm-sim {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.mm-sim-value {
  font-size: 24px;
  font-weight: 700;
  color: #1f5c43;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.mm-sim-label {
  font-size: 11.5px;
  color: var(--mm-muted-2);
}
.mm-card-chart {
  flex: 1;
  max-height: 128px;
}
.mm-fewer-note { order: 7; margin: 2px 0 0; padding: 10px 12px; border: 1px dashed var(--mm-line); border-radius: 12px; font-size: 12.5px; color: var(--mm-muted-2); line-height: 1.7; }
@media (max-width: 1180px) { .mm-fewer-note { grid-column: 1 / -1; } }
/* 1–2 memories: cards keep their natural height (no stretched placeholders) */
.mm-surface--n1 .mm-card,
.mm-surface--n2 .mm-card { flex: 0 0 auto; }
.mm-surface--n1 .mm-card-chart,
.mm-surface--n2 .mm-card-chart { flex: 0 0 auto; }
.mm-no-chart {
  font-size: 12px;
  color: var(--mm-muted-2);
}
.mm-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mm-tag {
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f2f3f5;
  color: var(--mm-ink-2);
  white-space: nowrap;
}
.mm-tag--diff {
  background: #fdf5ea;
  color: #8a5a12;
}

/* ─── Building / unavailable ────────────────────────────────────────── */
.mm-building {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  border: 1px solid var(--mm-line);
  border-radius: 14px;
  background: var(--mm-pearl);
  padding: 28px 24px;
}
.mm-building-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--mm-line);
  background: #fff;
}
.mm-building h4 { font-size: 17px; font-weight: 700; }
.mm-building p { font-size: 13.5px; line-height: 1.7; color: var(--mm-muted); max-width: 360px; }
.mm-surface--building { min-height: 0; }
.mm-surface--n0 .mm-field-core { width: 56%; }

/* Live BUILDING panel (factual metrics + stages) */
.mm-building-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
  padding: 4px 2px 0;
}
.mm-build-stages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--mm-line);
  border-radius: 12px;
  background: #fff;
  list-style: none;
  counter-reset: none;
}
.mm-build-stage {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--mm-muted-2);
}
.mm-build-stage--active {
  color: var(--mm-ink-2);
  font-weight: 700;
}
.mm-build-stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--mm-line);
  background: #eef0f3;
  flex-shrink: 0;
}
.mm-build-stage--active .mm-build-stage-dot {
  background: var(--mm-sage);
  border-color: var(--mm-sage);
  box-shadow: 0 0 0 3px var(--mm-sage-soft);
}
.mm-build-metrics {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  border: 1px solid var(--mm-line);
  border-radius: 12px;
  background: var(--mm-pearl);
  overflow: hidden;
}
.mm-build-metric {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 10px 14px;
  border-top: 1px solid var(--mm-line-soft);
}
.mm-build-metric:first-child { border-top: 0; }
.mm-build-metric dt {
  font-size: 12px;
  font-weight: 500;
  color: var(--mm-muted);
}
.mm-build-metric dd {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--mm-ink);
  font-variant-numeric: tabular-nums;
  text-align: end;
}
.mm-build-note {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--mm-muted);
  padding: 0 2px;
}

/* Building field — calm ambient scan, no neon */
.mm-field--building .mm-scan-ridge {
  animation: mm-build-scan 9s var(--mm-ease) infinite;
}
.mm-field--building .mm-ridge--fresh {
  stroke: var(--mm-sage);
  opacity: 0.55 !important;
  transition: opacity 600ms var(--mm-ease);
}
.mm-build-trace {
  fill: var(--mm-sage);
  opacity: 0.35;
  animation: mm-build-trace 5.5s var(--mm-ease) infinite;
  animation-delay: calc(var(--k, 0) * 0.55s);
}
.mm-field-build-foot {
  margin-top: 8px;
  font-size: 12px;
  color: var(--mm-muted-2);
  text-align: center;
  line-height: 1.55;
}
.mm-field--building .mm-field-core strong {
  font-size: 15px;
  font-weight: 700;
}
.mm-field--building .mm-field-core span {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--mm-muted);
}

@keyframes mm-build-scan {
  0%, 100% { stroke-dashoffset: 1; opacity: 0.15; }
  45% { stroke-dashoffset: 0; opacity: 0.45; }
  70% { opacity: 0.2; }
}
@keyframes mm-build-trace {
  0%, 100% { opacity: 0.18; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
  .mm-field--building .mm-scan-ridge,
  .mm-build-trace {
    animation: none !important;
  }
}

.mm-foot-disclaimer {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--mm-muted-2);
}

/* ─── Drawer ─────────────────────────────────────────────────────────── */
.mm-drawer-root {
  position: fixed;
  inset: 0;
  z-index: var(--zs-z-d-drawer, 1200); /* Desktop V2: drawer layer (was 1000) */
}
.mm-scrim {
  position: absolute;
  inset: 0;
  background: rgba(17, 19, 23, 0.26);
  animation: mm-fade-in 240ms var(--mm-ease) both;
}
.mm-drawer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(540px, 100%);
  background: #fff;
  border-right: 1px solid var(--mm-line);
  display: flex;
  flex-direction: column;
  animation: mm-drawer-in 360ms var(--mm-ease) both;
}
.mm-drawer-root.is-closing .mm-drawer { animation: mm-drawer-out 240ms cubic-bezier(0.4, 0, 1, 1) both; }
.mm-drawer-root.is-closing .mm-scrim { animation: mm-fade-out 240ms ease both; }
.mm-drawer-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 22px;
  border-bottom: 1px solid var(--mm-line-soft);
}
.mm-drawer-title {
  margin-top: 4px;
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.mm-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--mm-line);
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.mm-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 22px 26px;
}
.mm-drawer-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.mm-drawer-kpis > div {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--mm-pearl);
  border: 1px solid var(--mm-line-soft);
  display: flex;
  flex-direction: column;
}
.mm-drawer-kpis b { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mm-drawer-kpis span { font-size: 11.5px; color: var(--mm-muted-2); }
.mm-drawer-chart { margin-top: 16px; }
.mm-drawer-chart figcaption { margin-top: 6px; font-size: 12px; color: var(--mm-muted-2); }
.mm-dsec { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--mm-line-soft); }
.mm-dsec h4 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.mm-compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.mm-compare th,
.mm-compare td {
  text-align: right;
  padding: 8px 6px;
  border-bottom: 1px solid var(--mm-line-soft);
  font-weight: 400;
}
.mm-compare thead th { font-size: 12px; color: var(--mm-muted-2); font-weight: 500; }
.mm-compare tbody th { font-weight: 500; }
.mm-verdict { font-weight: 500; white-space: nowrap; }
.mm-verdict[data-verdict='match'] { color: var(--mm-sage); }
.mm-verdict[data-verdict='close'] { color: var(--mm-ink-2); }
.mm-verdict[data-verdict='different'] { color: #a86c1d; }
.mm-sources { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--mm-ink-2); }

/* ─── Debug (admin/dev only) ────────────────────────────────────────── */
.mm-section[data-debug='true'] .mm-surface > * { outline: 1px dashed #d9a441; outline-offset: -1px; }
.mm-section[data-debug='true'] .mm-field-stage { outline: 1px dashed #4d7cfe; }
.mm-debug-label { font-size: 10px; fill: #4d7cfe; font-family: ui-monospace, monospace; }

/* ─── Motion ─────────────────────────────────────────────────────────── */
@keyframes mm-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes mm-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes mm-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes mm-draw { from { stroke-dasharray: 1; stroke-dashoffset: 1; } to { stroke-dasharray: 1; stroke-dashoffset: 0; } }
@keyframes mm-scan {
  0% { opacity: 0; }
  35% { opacity: 0.85; }
  100% { opacity: 0; }
}
@keyframes mm-point-in { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@keyframes mm-drawer-in { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes mm-drawer-out { from { transform: none; } to { transform: translateX(-100%); } }
@keyframes mm-sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes mm-sheet-out { from { transform: none; } to { transform: translateY(100%); } }

.mm-js .mm-surface:not(.is-in) .mm-current,
.mm-js .mm-surface:not(.is-in) .mm-reading,
.mm-js .mm-surface:not(.is-in) .mm-card,
.mm-js .mm-surface:not(.is-in) .mm-field-core,
.mm-js .mm-surface:not(.is-in) .mm-point,
.mm-js .mm-surface:not(.is-in) .mm-ridge {
  opacity: 0;
}
/* 1. current state resolves first */
.mm-js .mm-surface.is-in .mm-current { animation: mm-rise 380ms var(--mm-ease) both; }
/* 2. fingerprint draws in, inside → out */
.mm-js .mm-surface.is-in .mm-ridge { animation: mm-draw 900ms cubic-bezier(0.33, 0.7, 0.2, 1) both; animation-delay: calc(180ms + var(--k) * 45ms); }
.mm-js .mm-surface.is-in .mm-field-core { animation: mm-rise 420ms var(--mm-ease) both; animation-delay: 520ms; }
/* 3. memory scan — one contour sweep outward, once */
.mm-js .mm-surface.is-in .mm-scan-ridge { animation: mm-scan 520ms ease-out both; animation-delay: calc(1000ms + var(--k) * 60ms); }
/* 4. memories illuminate in engine rank order */
.mm-js .mm-surface.is-in .mm-point { animation: mm-point-in 360ms var(--mm-ease) both; animation-delay: calc(1500ms + var(--r) * 140ms); transform-box: fill-box; transform-origin: center; }
.mm-js .mm-surface.is-in .mm-card { animation: mm-rise 380ms var(--mm-ease) both; animation-delay: calc(1550ms + var(--i) * 110ms); }
/* 5. reading resolves last */
.mm-js .mm-surface.is-in .mm-reading { animation: mm-rise 400ms var(--mm-ease) both; animation-delay: 2000ms; }

/* ─── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1500px) {
  .mm-container { padding: 0 40px; }
}
@media (max-width: 1360px) {
  .mm-surface { grid-template-columns: minmax(0, 1fr) minmax(0, 0.78fr) minmax(0, 1.2fr); gap: 18px; padding: 18px; }
  .mm-card { grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr); gap: 12px; }
  .mm-reading-grid { grid-template-columns: 1fr; }
}
/* Tablet: current + closest first, field beside, remaining memories below */
@media (max-width: 1180px) {
  .mm-container { padding: 0 32px; }
  .mm-surface {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      'current field'
      'memories memories';
  }
  .mm-col-current { grid-area: current; }
  .mm-col-field { grid-area: field; }
  .mm-col-memories { grid-area: memories; }
  .mm-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mm-card--closest { grid-column: 1 / -1; }
  .mm-surface--n2 .mm-card--closest { grid-column: auto; }
  .mm-reading-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .mm-title { font-size: 32px; }
  .mm-surface { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'current' 'field' 'memories'; }
  .mm-field-stage { max-width: 380px; }
}
/* Mobile: title → current → closest memory → reading → other memories; field becomes a strip */
@media (max-width: 720px) {
  .mm-container { padding: 0 16px; }
  .mm-title { font-size: 28px; }
  .mm-index { font-size: 18px; }
  .mm-hook { font-size: 15px; }
  .mm-surface { display: flex; flex-direction: column; padding: 12px; border-radius: 16px; gap: 14px; }
  .mm-col-current, .mm-col-memories, .mm-col-field { display: contents; }
  .mm-current { order: 1; }
  .mm-col-head { order: 2; }
  .mm-cards { display: contents; }
  .mm-card { order: 4; grid-template-columns: minmax(0, 1fr); }
  .mm-card--closest { order: 3; }
  .mm-reading { order: 5; }
  .mm-cards .mm-card:not(.mm-card--closest) { order: 6; }
  .mm-strip { order: 2; display: block; }
  .mm-field { display: none; }
  .mm-building { order: 3; }
  .mm-building-panel { order: 3; }
  .mm-reading-grid { grid-template-columns: 1fr; }
  .mm-price { font-size: 26px; }
  .mm-drawer {
    top: auto;
    width: 100%;
    max-height: 92dvh;
    border-right: 0;
    border-radius: 20px 20px 0 0;
    animation: mm-sheet-in 360ms var(--mm-ease) both;
  }
  .mm-drawer-root.is-closing .mm-drawer { animation: mm-sheet-out 240ms cubic-bezier(0.4, 0, 1, 1) both; }
  /* lighter motion on mobile: no ridge draw / scan */
  .mm-js .mm-surface.is-in .mm-card,
  .mm-js .mm-surface.is-in .mm-reading { animation-delay: calc(200ms + var(--i, 2) * 80ms); }
}
.mm-strip {
  padding: 12px 14px;
  border: 1px solid var(--mm-line);
  border-radius: 12px;
  background: var(--mm-pearl);
}
.mm-strip-rail {
  position: relative;
  height: 26px;
  border-bottom: 1px solid var(--mm-line);
  margin: 0 12px;
}
.mm-strip-dot {
  position: absolute;
  bottom: -9px;
  transform: translateX(50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid var(--mm-sage);
  display: grid;
  place-items: center;
  font-size: 10px;
}
.mm-strip-dot b { font-weight: 700; }
.mm-strip-scale {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--mm-muted-2);
}

@media (prefers-reduced-motion: reduce) {
  .mm-section *,
  .mm-drawer-root * {
    animation: none !important;
    transition: none !important;
  }
  .mm-js .mm-surface .mm-current,
  .mm-js .mm-surface .mm-reading,
  .mm-js .mm-surface .mm-card,
  .mm-js .mm-surface .mm-field-core,
  .mm-js .mm-surface .mm-point {
    opacity: 1 !important;
  }
  .mm-scan-ridge { display: none; }
}

/* ── Admin QA (admin route only) ── */
.mmqa { font-family: var(--mm-font, 'Tajawal'), system-ui, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: 0; font-size: 12px; color: #1b1f1d; max-width: 1200px; margin: 0 auto; padding: 24px 16px; }
.mmqa h2 { font-size: 18px; margin: 0 0 6px; }
.mmqa h3 { font-size: 14px; margin: 22px 0 8px; }
.mmqa-note { color: #5d6661; margin: 0 0 12px; }
.mmqa-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; table-layout: fixed; }
.mmqa-table caption { text-align: start; font-weight: 700; padding: 6px 0; }
.mmqa-table th, .mmqa-table td { border: 1px solid #e3e7e4; padding: 5px 8px; text-align: start; vertical-align: top; overflow-wrap: anywhere; }
.mmqa-table th[scope='row'] { width: 240px; background: #f6f8f7; font-weight: 700; }
.mmqa-status { padding: 1px 6px; border-radius: 4px; }
.mmqa-status--pass { background: #e4f4ea; color: #146c3a; }
.mmqa-status--warn { background: #fdf2dc; color: #8a5a00; }
.mmqa-status--fail { background: #fde4e4; color: #a01d1d; }

