.mxx {
  /* Themed via mx-theme --mx-* tokens (dark/light aware); literals are
     standalone fallbacks preserving the pre-2.1 look. --mx-bg/--mx-ink
     renamed --mxx-* (theme defines those names globally). */
  --mx-orange: var(--mx-brand, #f59e0b);
  --mx-orange-deep: var(--mx-brand-pressed, #d97706);
  --mx-orange-soft: color-mix(in srgb, var(--mx-brand, #f59e0b) 14%, transparent);
  --mx-orange-wash: color-mix(in srgb, var(--mx-brand, #f59e0b) 7%, transparent);
  --mxx-bg: var(--mx-bg, #fafafa);
  --mx-surface: var(--mx-card, #ffffff);
  --mx-surface-2: var(--mx-bg-elevated, #f8fafc);
  --mx-surface-3: var(--mx-card-elevated, #f1f5f9);
  --mx-line: var(--mx-divider, #e5e7eb);
  --mx-line-soft: var(--mx-divider, #f1f5f9);
  --mxx-ink: var(--mx-text, #0a0e0c);
  --mxx-ink-2: var(--mx-text, #2d3338);
  --mxx-ink-3: var(--mx-text-2, #5a6470);
  --mx-mute: var(--mx-text-2, #8a929c);
  --mx-mute-2: var(--mx-nav-inactive, #b4bac1);
  --mx-up: var(--mx-compliant, #047857);
  --mx-up-soft: color-mix(in srgb, var(--mx-compliant, #047857) 12%, transparent);
  --mx-up-border: color-mix(in srgb, var(--mx-compliant, #047857) 35%, transparent);
  --mx-down: var(--mx-noncompliant, #b91c1c);
  --mx-down-soft: color-mix(in srgb, var(--mx-noncompliant, #b91c1c) 10%, transparent);
  --mx-down-border: color-mix(in srgb, var(--mx-noncompliant, #b91c1c) 35%, transparent);
  --mx-warn: var(--mx-doubtful, #b45309);

  color: var(--mxx-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  max-width: 1280px;
  margin: 0 auto;
}

.mxx *, .mxx *::before, .mxx *::after { box-sizing: border-box; }
.mxx a { color: inherit; text-decoration: none; }
.mxx table { border-collapse: collapse; }
.mxx h1, .mxx h2, .mxx h3, .mxx h4 { margin: 0; padding: 0; }

/* ============ STATUS BAR ============ */
.mxx-statusbar {
  background: var(--mx-surface-3);
  color: var(--mxx-ink-2);
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.mxx-statusbar-left { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
/* 2.1.5: inherit the bar's current text color so light-mode overrides
   (which restyle .mxx-statusbar) keep this line readable — the old
   inline rgba(255,255,255,.6) could not be overridden by any theme. */
.mxx-statusbar-cert { color: inherit; opacity: .65; }
.mxx-dot {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--mx-orange);
  margin-right: 6px; vertical-align: middle;
  animation: mxx-pulse 2s infinite;
}
@keyframes mxx-pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* ============ STOCK HEADER CARD ============ */
.mxx-stock-header {
  background: var(--mx-surface);
  border: 1px solid var(--mx-line);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  padding: 24px 28px;
  margin-bottom: 20px;
}
.mxx-header-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: flex-start;
}
.mxx-identity { display: flex; gap: 16px; align-items: flex-start; min-width: 0; }
.mxx-logo {
  width: 56px; height: 56px; border-radius: 12px;
  background: linear-gradient(135deg, var(--mx-orange-soft), var(--mx-orange-soft));
  border: 1px solid var(--mx-orange);
  display: grid; place-items: center;
  font-weight: 700; font-size: 22px;
  color: var(--mx-orange-deep);
  letter-spacing: -.02em; flex-shrink: 0;
}
.mxx-title-block { min-width: 0; }
.mxx-title-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.mxx-title {
  font-size: 26px; font-weight: 700;
  letter-spacing: -.025em; color: var(--mxx-ink);
}
.mxx-ticker-tag {
  font-family: ui-monospace, monospace; font-size: 13px;
  padding: 3px 10px; background: var(--mx-surface-2);
  color: var(--mxx-ink-2); border-radius: 5px;
  border: 1px solid var(--mx-line); font-weight: 600;
}
.mxx-subtitle {
  margin-top: 6px; font-size: 14px; color: var(--mxx-ink-3);
}
.mxx-subtitle .dot { color: var(--mx-mute-2); margin: 0 5px; }
.mxx-tags { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.mxx-tag {
  font-size: 11px; font-weight: 500; padding: 3px 9px;
  border-radius: 5px; background: var(--mx-surface-2);
  color: var(--mxx-ink-3); border: 1px solid var(--mx-line);
}
.mxx-tag.orange {
  background: var(--mx-orange-wash); color: var(--mx-orange-deep);
  border-color: var(--mx-orange); font-weight: 600;
}

.mxx-compliance-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
}
.mxx-compliance-badge.pass {
  background: var(--mx-up); color: var(--mx-on-compliant, #ffffff);
  border: 0;
}
.mxx-compliance-badge.fail {
  background: var(--mx-down); color: var(--mx-on-noncompliant, #ffffff);
  border: 0;
}

/* Price block */
.mxx-price-block { text-align: right; min-width: 200px; }
.mxx-price-label {
  font-size: 11px; color: var(--mx-mute);
  text-transform: uppercase; letter-spacing: .06em;
  font-weight: 600; margin-bottom: 4px;
}
.mxx-price-main {
  font-size: 38px; font-weight: 700;
  letter-spacing: -.035em; line-height: 1;
  color: var(--mxx-ink); font-variant-numeric: tabular-nums;
}
.mxx-price-change-row {
  margin-top: 8px; display: flex;
  justify-content: flex-end; align-items: center; gap: 8px;
}
.mxx-price-meta {
  font-size: 12px; color: var(--mx-mute);
  margin-top: 6px; text-align: right;
}

/* ============ MAIN GRID ============ */
.mxx-main {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}
.mxx-main-col { min-width: 0; }
.mxx-sidebar { display: flex; flex-direction: column; gap: 16px; }

/* ============ SECTION CARDS ============ */
.mxx-section {
  background: var(--mx-surface);
  border: 1px solid var(--mx-line);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}
.mxx-card-section {
  background: transparent;
  border: 0px;
  border-radius: 0px;
  margin-bottom: 16px;
  overflow: hidden;
}
.mxx-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--mx-line); gap: 12px;
}
.mxx-section-title {
  font-size: 14px; font-weight: 700; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 8px; color: var(--mxx-ink);
}
.mxx-section-icon { width: 18px; height: 18px; color: var(--mx-orange); }
.mxx-section-tag {
  font-size: 11px; color: var(--mx-mute); letter-spacing: .02em;
  padding: 4px 8px; background: var(--mx-surface-2);
  border-radius: 4px; font-weight: 500;
}
.mxx-section-tag.green { background: var(--mx-up-soft); color: var(--mx-up); }
.mxx-section-tag.red { background: var(--mx-down-soft); color: var(--mx-down); }
.mxx-section-body { padding: 20px; }

/* ============ CHART ============ */
.mxx-chart-area {
  height: 400px;
  background: var(--mx-surface);
  position: relative;
  overflow: hidden;
}

/* ============ KPI GRID ============ */
.mxx-kpi-grid { display: grid; grid-template-columns: repeat(6, 1fr); }
.mxx-kpi-cell {
  padding: 16px 18px;
  border-right: 1px solid var(--mx-line);
  border-bottom: 1px solid var(--mx-line);
}
.mxx-kpi-cell:nth-child(6n) { border-right: 0; }
.mxx-kpi-cell:nth-last-child(-n+6) { border-bottom: 0; }
.mxx-kpi-cell:hover { background: var(--mx-orange-wash); }
.mxx-kpi-label {
  font-size: 11px; color: var(--mx-mute);
  font-weight: 600; margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .04em;
}
.mxx-kpi-value {
  font-size: 18px; font-weight: 700;
  letter-spacing: -.02em; color: var(--mxx-ink);
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.mxx-kpi-context {
  margin-top: 4px; font-size: 11px; color: var(--mx-mute);
}

/* ============ SHARIAH COMPLIANCE ============ */
.mxx-shariah-section {
  background: linear-gradient(135deg, var(--mx-orange-wash) 0%, var(--mx-surface) 60%);
  border: 1px solid var(--mx-line);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  position: relative;
}
.mxx-shariah-section::before {
  content: "";
  position: absolute; top: 0; right: 0;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(245,158,11,.10), transparent 70%);
  pointer-events: none;
}

/* 8 Standards row (same styling for every methodology) */
.mxx-standards-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 20px;
}
.mxx-standard-card {
  text-align: center;
  padding: 12px 8px;
  border: 1px solid var(--mx-line);
  border-radius: 8px;
  background: var(--mx-surface);
  position: relative;
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
}
.mxx-standard-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--mxx-ink);
  margin-bottom: 6px;
  letter-spacing: -.01em;
}
.mxx-standard-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
}
.mxx-standard-badge.pass { background: var(--mx-up-soft); color: var(--mx-up); }
.mxx-standard-badge.fail { background: var(--mx-down-soft); color: var(--mx-down); }

.mxx-reason-banner {
  margin: 0 20px 16px;
  padding: 14px 18px;
  border-radius: 8px;
  border: 1px solid var(--mx-line);
  border-left-width: 4px;
  font-size: 14px;
  line-height: 1.55;
}
.mxx-reason-banner.pass {
  background: var(--mx-up-soft);
  border-color: var(--mx-up-border);
  border-left-color: var(--mx-up);
  color: var(--mx-up);
}
.mxx-reason-banner.fail {
  background: var(--mx-down-soft);
  border-color: var(--mx-down-border);
  border-left-color: var(--mx-down);
  color: var(--mx-down);
}
.mxx-reason-banner b { font-weight: 700; color: var(--mxx-ink); }

/* ============ COMPLIANCE MATRIX ============ */
.mxx-compliance-table-wrap { padding: 0 20px 20px; }
.mxx-compliance-table-title {
  font-size: 13px; font-weight: 700; color: var(--mxx-ink);
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: .05em;
}
.mxx-compliance-table-sub {
  font-size: 12px; color: var(--mxx-ink-3); margin-bottom: 12px;
}
.mxx-compliance-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mxx-methodology-table {
  width: 100%;
  min-width: 860px;
  border: 1px solid var(--mx-line);
  border-radius: 12px;
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--mx-surface);
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
}
.mxx-methodology-table thead th {
  background: linear-gradient(180deg, var(--mx-surface-2) 0%, var(--mx-surface-3) 100%);
  padding: 11px 12px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--mxx-ink-2);
  border-right: 1px solid var(--mx-line);
  border-bottom: 1px solid var(--mx-line);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .055em;
  white-space: nowrap;
}
.mxx-methodology-table thead th:last-child { border-right: 0; }
.mxx-methodology-table tbody td {
  padding: 12px;
  border-right: 1px solid var(--mx-line-soft);
  border-bottom: 1px solid var(--mx-line-soft);
  vertical-align: middle;
  font-size: 12px;
}
.mxx-methodology-table tbody td:last-child { border-right: 0; }
.mxx-methodology-table tbody tr:last-child td { border-bottom: 0; }
.mxx-methodology-table tbody tr:hover td { background: var(--mx-orange-wash); }
.mxx-methodology-cell {
  width: 116px;
  background: var(--mx-surface);
}
.mxx-methodology-name {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--mxx-ink);
  letter-spacing: -.01em;
}
.mxx-methodology-basis {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--mx-mute);
  line-height: 1.3;
}
.mxx-ratio-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--mx-line);
  border-radius: 8px;
  background: var(--mx-surface);
  line-height: 1;
  white-space: nowrap;
}
.mxx-ratio-chip.pass { border-color: var(--mx-up-border); background: #f7fefb; }
.mxx-ratio-chip.fail { border-color: var(--mx-down-border); background: #fff8f8; }
.mxx-ratio-value {
  font-weight: 800;
  color: var(--mxx-ink);
  font-family: ui-monospace, monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.mxx-ratio-status {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
}
.mxx-ratio-chip.pass .mxx-ratio-status { background: var(--mx-up-soft); color: var(--mx-up); }
.mxx-ratio-chip.fail .mxx-ratio-status { background: var(--mx-down-soft); color: var(--mx-down); }
.mxx-ratio-limit {
  display: block;
  margin-top: 5px;
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--mx-mute);
}
.mxx-na {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  color: var(--mx-mute-2);
  font-weight: 700;
}
.mxx-overall-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
}
.mxx-overall-mini.pass { background: var(--mx-up-soft); color: var(--mx-up); border: 1px solid var(--mx-up-border); }
.mxx-overall-mini.fail { background: var(--mx-down-soft); color: var(--mx-down); border: 1px solid var(--mx-down-border); }
.mxx-impure-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.mxx-impure-item {
  border: 1px solid var(--mx-line);
  border-radius: 10px;
  background: var(--mx-surface);
  padding: 12px;
  min-width: 0;
}
.mxx-impure-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .055em;
  color: var(--mx-mute);
  font-weight: 800;
  margin-bottom: 4px;
}
.mxx-impure-value {
  font-family: ui-monospace, monospace;
  font-size: 15px;
  font-weight: 800;
  color: var(--mxx-ink);
  overflow-wrap: anywhere;
}
.mxx-impure-note {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--mx-line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--mx-bg, #ffffff) 65%, transparent);
  color: var(--mxx-ink-3);
  font-size: 11.5px;
  line-height: 1.45;
}

/* ============ STANDARDS PICKER (v5) ============ */
.mxx-std-pick {
  cursor: pointer;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.mxx-std-pick .mxx-standard-name {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--mxx-ink);
  margin-bottom: 6px;
  letter-spacing: -.01em;
}
.mxx-std-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  background: var(--mx-surface-3);
  color: var(--mx-mute);
  border: 1px solid var(--mx-line);
}
.mxx-std-dot.pass {
  background: var(--mx-up-soft);
  color: var(--mx-up);
  border-color: var(--mx-up-border);
}
.mxx-std-dot.fail {
  background: var(--mx-down-soft);
  color: var(--mx-down);
  border-color: var(--mx-down-border);
}
.mxx-std-pick:hover {
  border-color: var(--mx-orange);
  box-shadow: 0 0 0 1px var(--mx-orange-soft);
}
.mxx-std-pick.is-active {
  border-color: var(--mx-orange-deep);
  background: var(--mx-orange-wash);
  box-shadow: 0 0 0 2px var(--mx-orange-soft);
}
.mxx-std-pick:focus-visible {
  border-color: var(--mx-orange-deep);
  box-shadow: 0 0 0 3px var(--mx-orange-soft);
}

/* ============ METHODOLOGY DETAIL PANELS (v5) ============ */
.mxx-method-panel {
  display: none;
  background: var(--mx-surface);
  border: 1px solid var(--mx-line);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
}
.mxx-method-panel.is-active { display: block; }
.mxx-method-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--mx-line-soft);
}
.mxx-method-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.015em;
  color: var(--mxx-ink);
}
.mxx-method-basis {
  margin-top: 4px;
  font-size: 12px;
  color: var(--mxx-ink-3);
  line-height: 1.45;
}
.mxx-method-status {
  flex-shrink: 0;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}
.mxx-method-status.pass {
  background: var(--mx-up-soft);
  color: var(--mx-up);
  border: 1px solid var(--mx-up-border);
}
.mxx-method-status.fail {
  background: var(--mx-down-soft);
  color: var(--mx-down);
  border: 1px solid var(--mx-down-border);
}

/* ratio bar rows */
.mxx-method-bars {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.mxx-ratio-row { display: block; }
.mxx-ratio-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 7px;
  font-size: 12px;
}
.mxx-ratio-row-label {
  color: var(--mxx-ink-2);
  font-weight: 600;
}
.mxx-ratio-row-val {
  text-align: right;
  white-space: nowrap;
}
.mxx-ratio-row-val strong {
  font-family: ui-monospace, monospace;
  font-weight: 800;
  font-size: 13px;
  color: var(--mxx-ink);
  font-variant-numeric: tabular-nums;
}
.mxx-ratio-row.pass .mxx-ratio-row-val strong { color: var(--mx-up); }
.mxx-ratio-row.fail .mxx-ratio-row-val strong { color: var(--mx-down); }
.mxx-ratio-row-limit {
  color: var(--mx-mute);
  font-size: 11px;
  margin-left: 4px;
}
.mxx-ratio-row-basis { color: var(--mx-mute-2); }
.mxx-ratio-row-bar {
  position: relative;
  height: 7px;
  border-radius: 999px;
  background: var(--mx-surface-3);
  overflow: hidden;
}
.mxx-ratio-row-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 999px;
  transition: width .35s cubic-bezier(.4,0,.2,1);
}
.mxx-ratio-row-fill.pass { background: var(--mx-up); }
.mxx-ratio-row-fill.fail { background: var(--mx-down); }
.mxx-ratio-row-fill.na { background: var(--mx-mute-2); width: 0; }
.mxx-ratio-row-over {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  background: repeating-linear-gradient(
    45deg,
    var(--mx-down) 0,
    var(--mx-down) 4px,
    var(--mx-down) 4px,
    var(--mx-down) 8px
  );
  border-radius: 0 999px 999px 0;
}
.mxx-na-inline {
  color: var(--mx-mute-2);
  font-weight: 700;
  font-size: 12px;
}

/* impure income strip inside each panel */
.mxx-method-impure {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--mx-line-soft);
}
.mxx-method-impure-item {
  background: var(--mx-surface-2);
  border-radius: 8px;
  padding: 12px 14px;
  min-width: 0;
}
.mxx-method-impure-item.business { background: var(--mx-orange-wash); }
.mxx-method-impure-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .055em;
  color: var(--mx-mute);
  font-weight: 800;
  margin-bottom: 4px;
}
.mxx-method-impure-val {
  display: block;
  font-family: ui-monospace, monospace;
  font-size: 16px;
  font-weight: 800;
  color: var(--mxx-ink);
  font-variant-numeric: tabular-nums;
}
.mxx-method-impure-segment {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--mxx-ink-3);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.mxx-method-impure-segment::before {
  content: "from ";
  color: var(--mx-mute);
  font-style: italic;
}

/* "why do shared ratios differ" disclosure */
.mxx-method-note {
  margin-top: 14px;
  border: 1px solid var(--mx-line);
  border-radius: 10px;
  background: var(--mx-surface-2);
  font-size: 12px;
  color: var(--mxx-ink-3);
}
.mxx-method-note summary {
  list-style: none;
  cursor: pointer;
  padding: 11px 14px;
  font-weight: 600;
  color: var(--mxx-ink-2);
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.mxx-method-note summary::-webkit-details-marker { display: none; }
.mxx-method-note summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 16px; height: 16px;
  border-radius: 999px;
  background: var(--mx-surface);
  border: 1px solid var(--mx-line);
  font-weight: 800;
  color: var(--mx-orange-deep);
  font-size: 12px;
  line-height: 1;
}
.mxx-method-note[open] summary::before { content: "−"; }
.mxx-method-note p {
  margin: 0;
  padding: 0 14px 14px;
  line-height: 1.55;
}

/* ============ PURIFICATION CALCULATOR ============ */
.mxx-calc-section {
  padding: 0 20px 20px;
}
.mxx-calc-grid {
  display: grid; grid-template-columns: 1.5fr 1fr;
  gap: 16px;
}
.mxx-calc-box, .mxx-info-box {
  background: var(--mx-surface); border: 1px solid var(--mx-line);
  border-radius: 8px; padding: 18px;
}
.mxx-calc-title {
  font-size: 14px; font-weight: 700; color: var(--mxx-ink);
  margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px;
}
.mxx-calc-title svg { color: var(--mx-orange); }
.mxx-calc-sub { font-size: 11px; color: var(--mxx-ink-3); margin-bottom: 14px; }

.mxx-calc-field { margin-bottom: 12px; }
.mxx-calc-label {
  display: block;
  font-size: 11px; font-weight: 600;
  color: var(--mxx-ink-2); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: .04em;
}
.mxx-calc-input, .mxx-calc-select {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--mx-line); border-radius: 6px;
  font-size: 13px; font-family: inherit;
  background: var(--mx-surface); outline: none;
  appearance: none; -webkit-appearance: none;
  color: var(--mxx-ink);
}
.mxx-calc-select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a929c' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 32px;
}
.mxx-calc-input:focus, .mxx-calc-select:focus {
  border-color: var(--mx-orange);
  box-shadow: 0 0 0 3px var(--mx-orange-soft);
}
.mxx-calc-results {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; margin-top: 12px;
}
.mxx-calc-result {
  padding: 10px 12px;
  border: 1px solid var(--mx-line); border-radius: 6px;
  background: var(--mx-orange-wash);
}
.mxx-calc-result .lbl {
  font-size: 10px; color: var(--mxx-ink-3);
  text-transform: uppercase; letter-spacing: .04em; font-weight: 700;
}
.mxx-calc-result .val {
  font-family: ui-monospace, monospace;
  font-size: 16px; font-weight: 700;
  color: var(--mx-orange-deep);
  margin-top: 2px;
}
.mxx-calc-result.total {
  background: var(--mx-up-soft); border-color: var(--mx-up-border);
}
.mxx-calc-result.total .val { color: var(--mx-up); }

.mxx-info-title {
  font-size: 11px; color: var(--mxx-ink-3);
  text-transform: uppercase; letter-spacing: .06em;
  font-weight: 700; margin-bottom: 8px;
}
.mxx-info-heading {
  font-size: 13px; font-weight: 700;
  color: var(--mx-orange-deep); margin-bottom: 10px;
}
.mxx-info-box ul {
  list-style: none; padding: 0; margin: 0;
  font-size: 11.5px; line-height: 1.55; color: var(--mxx-ink-2);
}
.mxx-info-box li {
  padding-left: 12px; position: relative; margin-bottom: 8px;
}
.mxx-info-box li::before {
  content: "•"; position: absolute; left: 0;
  color: var(--mx-orange); font-weight: 700;
}

/* ============ PERFORMANCE STRIP ============ */
.mxx-perf-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.mxx-perf-cell {
  padding: 14px 12px; text-align: center;
  border-right: 1px solid var(--mx-line);
}
.mxx-perf-cell:last-child { border-right: 0; }
.mxx-perf-label {
  font-size: 11px; color: var(--mx-mute);
  font-weight: 600; margin-bottom: 4px;
}
.mxx-perf-value {
  font-family: ui-monospace, monospace;
  font-size: 14px; font-weight: 700;
}
.mxx-perf-value.up { color: var(--mx-up); }
.mxx-perf-value.down { color: var(--mx-down); }

/* ============ TWO-COL DATA ============ */
.mxx-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 18px;
}
.mxx-two-col table {
  width: 100%;
  font-size: 13px;
  border: 1px solid var(--mx-line);
  border-radius: 12px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: var(--mx-surface);
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
}
.mxx-two-col table tr:nth-child(odd) { background: var(--mx-surface-2); }
.mxx-two-col table tr:hover { background: var(--mx-orange-wash); }
.mxx-two-col table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--mx-line-soft);
  vertical-align: middle;
}
.mxx-two-col table tr:last-child td { border-bottom: 0; }
.mxx-two-col table td:first-child {
  color: var(--mxx-ink-3);
  font-weight: 600;
  width: 56%;
}
.mxx-two-col table td:last-child {
  text-align: right;
  font-family: ui-monospace, monospace;
  font-weight: 800;
  color: var(--mxx-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mxx-up { color: var(--mx-up) !important; }
.mxx-down { color: var(--mx-down) !important; }

/* ============ SIDEBAR ============ */
.mxx-analyst-card {
  background: var(--mx-surface);
  border: 1px solid var(--mx-line);
  border-radius: 12px;
  padding: 20px;
}
.mxx-analyst-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 10px;
}
.mxx-analyst-rating {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  border: 1px solid var(--mx-line);
  background: var(--mx-surface-2);
  color: var(--mxx-ink-2);
  white-space: nowrap;
}
.mxx-analyst-rating.buy { background: var(--mx-up-soft); color: var(--mx-up); border-color: var(--mx-up-border); }
.mxx-analyst-rating.hold { background: var(--mx-orange-wash); color: var(--mx-orange-deep); border-color: var(--mx-orange); }
.mxx-analyst-rating.sell { background: var(--mx-down-soft); color: var(--mx-down); border-color: var(--mx-down-border); }
.mxx-analyst-rating.neutral { background: var(--mx-surface-2); color: var(--mxx-ink-3); }
.mxx-target-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.mxx-target-stat {
  border: 1px solid var(--mx-line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--mx-surface);
}
.mxx-target-stat .l {
  display: block;
  color: var(--mx-mute);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 3px;
}
.mxx-target-stat strong {
  display: block;
  font-family: ui-monospace, monospace;
  font-weight: 800;
  color: var(--mxx-ink);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.mxx-target-stat.target strong { color: var(--mx-orange-deep); }
.mxx-range-card {
  border: 1px solid var(--mx-line);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--mx-surface) 0%, var(--mx-surface-2) 100%);
  padding: 14px 14px 12px;
}
.mxx-range-title-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 30px;
  font-size: 11px;
  color: var(--mx-mute);
}
.mxx-range-title-row strong {
  display: block;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--mxx-ink);
  font-weight: 800;
  margin-top: 2px;
}
.mxx-range-title-row span:last-child { text-align: right; }
.mxx-range-bar {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: var(--mx-line);
  margin: 0 4px 32px;
}
.mxx-range-track {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #dbeafe 0%, var(--mx-orange-soft) 52%, var(--mx-orange-soft) 100%);
}
.mxx-range-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}
.mxx-marker-dot {
  width: 14px;
  height: 14px;
  display: block;
  border-radius: 999px;
  background: var(--mxx-ink);
  border: 2px solid white;
  box-shadow: 0 0 0 1px rgba(15,23,42,.25), 0 4px 10px rgba(15,23,42,.15);
}
.mxx-range-marker.target .mxx-marker-dot {
  background: var(--mx-orange);
  box-shadow: 0 0 0 1px rgba(217,119,6,.35), 0 4px 10px rgba(217,119,6,.18);
}
.mxx-marker-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .04em;
  white-space: nowrap;
  padding: 2px 5px;
  border-radius: 999px;
  background: var(--mx-surface);
  border: 1px solid var(--mx-line);
  color: var(--mxx-ink);
}
.mxx-range-marker.current .mxx-marker-label { bottom: 17px; }
.mxx-range-marker.target .mxx-marker-label { top: 17px; color: var(--mx-orange-deep); }
.mxx-range-scale {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  color: var(--mx-mute);
  font-family: ui-monospace, monospace;
  margin-top: 4px;
}
.mxx-target-legend {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 10.5px;
  color: var(--mxx-ink-3);
}
.mxx-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.mxx-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--mxx-ink);
}
.mxx-legend-dot.target { background: var(--mx-orange); }
.mxx-target-upside {
  font-size: 11px;
  color: var(--mx-mute);
  text-align: center;
  margin-top: 12px;
}
.mxx-target-upside strong { font-weight: 800; }
.mxx-target-upside .pos { color: var(--mx-up); }
.mxx-target-upside .neg { color: var(--mx-down); }

.mxx-id-list { display: flex; flex-direction: column; padding: 0 16px; }
.mxx-id-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--mx-line-soft);
  font-size: 12px; gap: 8px;
}
.mxx-id-row:last-child { border-bottom: 0; }
.mxx-id-row .label {
  color: var(--mx-mute); text-transform: uppercase;
  font-weight: 600; letter-spacing: .04em; font-size: 11px;
}
.mxx-id-row .value {
  font-family: ui-monospace, monospace; font-weight: 600;
  color: var(--mxx-ink); text-align: right;
  word-break: break-all; font-size: 12px;
}
.mxx-id-row .value .mxx-id-sub {
  display: block; font-family: inherit; font-weight: 500;
  color: var(--mx-mute); font-size: 10.5px; margin-top: 1px;
  word-break: normal;
}
.mxx-id-row .value abbr { text-decoration: none; border-bottom: 1px dotted var(--mx-line); cursor: help; }

/* ============ COMPANY PROFILE ============ */
.mxx-profile-body { padding: 14px 16px; }
.mxx-profile-text {
  margin: 0 0 10px; color: var(--mxx-ink);
  font-size: 13.5px; line-height: 1.65;
}
.mxx-profile-text:last-child { margin-bottom: 0; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
  .mxx-main { grid-template-columns: 1fr; }
  .mxx-kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .mxx-kpi-cell:nth-child(3n) { border-right: 0; }
  .mxx-kpi-cell:nth-child(6n) { border-right: 1px solid var(--mx-line); }
  .mxx-perf-grid { grid-template-columns: repeat(4, 1fr); }
  .mxx-perf-cell:nth-child(4n) { border-right: 0; }
  .mxx-calc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  /* ===== STATUS BAR — one compact line ===== */
  .mxx-statusbar {
    padding: 6px 12px;
    font-size: 11px;
    flex-wrap: nowrap;
    overflow: hidden;
  }
  .mxx-statusbar-left { gap: 10px; flex: 1; min-width: 0; }
  .mxx-statusbar-left > span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mxx-statusbar > div:last-child { display: none; }     /* hide "Trusted by..." */
  .mxx-statusbar-left > span:nth-child(2) { display: none; } /* hide "Certified by..." */

  /* ===== HEADER ===== */
  .mxx-stock-header { padding: 16px 16px 14px; }
  .mxx-header-row { grid-template-columns: 1fr; gap: 14px; }
  .mxx-identity { gap: 12px; }
  .mxx-logo { width: 44px; height: 44px; font-size: 16px; border-radius: 10px; }
  .mxx-title { font-size: 20px; }
  .mxx-title-row { gap: 8px; }
  .mxx-subtitle { font-size: 12px; margin-top: 4px; }
  .mxx-tags { margin-top: 8px; }
  /* compliance badge stays on title row but compact */
  .mxx-compliance-badge { padding: 3px 9px; font-size: 10.5px; }

  /* Price block: left-align, smaller, single row with badge */
  .mxx-price-block {
    text-align: left;
    min-width: 0;
    padding-top: 10px;
    border-top: 1px solid var(--mx-line-soft);
  }
  .mxx-price-label { font-size: 10px; margin-bottom: 2px; }
  .mxx-price-main { font-size: 26px; display: inline-block; vertical-align: middle; }
  .mxx-price-change-row {
    display: inline-flex;
    margin-top: 0;
    margin-left: 8px;
    vertical-align: middle;
    justify-content: flex-start;
  }
  .mxx-price-meta { text-align: left; font-size: 11px; margin-top: 4px; }

  /* ===== KEY METRICS GRID — fix missing borders ===== */
  .mxx-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  /* Reset all border overrides first, then apply 2-col rules */
  .mxx-kpi-cell { border-right: 1px solid var(--mx-line); }
  .mxx-kpi-cell:nth-child(2n) { border-right: 0; }
  .mxx-kpi-cell:nth-child(6n) { border-right: 0; }
  .mxx-kpi-cell:nth-child(3n) { border-right: 1px solid var(--mx-line); }
  .mxx-kpi-cell:nth-child(6n) { border-right: 0; }
  /* Bottom borders: clear all, then last 2 children get none */
  .mxx-kpi-cell { border-bottom: 1px solid var(--mx-line); }
  .mxx-kpi-cell:nth-last-child(-n+2) { border-bottom: 0; }
  .mxx-kpi-cell:nth-last-child(-n+6) { border-bottom: 1px solid var(--mx-line); }
  .mxx-kpi-cell:nth-last-child(-n+2) { border-bottom: 0; }

  /* ===== PERFORMANCE GRID ===== */
  .mxx-perf-grid { grid-template-columns: repeat(2, 1fr); }
  .mxx-perf-cell { border-right: 1px solid var(--mx-line); border-bottom: 1px solid var(--mx-line); }
  .mxx-perf-cell:nth-child(2n) { border-right: 0; }
  .mxx-perf-cell:nth-last-child(-n+2) { border-bottom: 0; }

  /* ===== COMPLIANCE PICKER & PANELS ===== */
  .mxx-standards-row { grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 14px; }
  .mxx-impure-panel { grid-template-columns: 1fr 1fr; }
  .mxx-method-impure { grid-template-columns: 1fr; }
  /* keep method-head as a row so PASS pill sits next to title */
  .mxx-method-head { flex-direction: row; align-items: flex-start; gap: 10px; }
  .mxx-method-title { font-size: 15px; }
  .mxx-method-basis { font-size: 11.5px; }

  /* ===== MOBILE LAYOUT: sidebar stacks after main column (default behaviour) =====
     We rely on .mxx-main { grid-template-columns: 1fr } from the 1100px breakpoint,
     which already collapses sidebar below main-col. No display:contents tricks. */

  .mxx-target-row { grid-template-columns: 1fr; }
  .mxx-two-col { grid-template-columns: 1fr; padding: 14px; }
}


/* ════════════ TEASER (locked Shariah view) ════════════ */

.mxx-teaser-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid var(--mx-line);
  border-radius: 999px;
  color: var(--mx-mute);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.mxx-teaser-chip:hover {
  color: var(--mx-orange-deep);
  border-color: var(--mx-orange);
  text-decoration: none;
}

.mxx-teaser-shariah {
  background: var(--mx-surface);
  border: 1px solid var(--mx-line);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 18px;
}

.mxx-teaser-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--mx-line);
  font-weight: 700;
  color: var(--mxx-ink);
}

.mxx-teaser-head svg { width: 18px; height: 18px; color: var(--mx-orange-deep); }

.mxx-teaser-tag {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--mx-mute);
  border: 1px solid var(--mx-line);
  border-radius: 999px;
  padding: 2px 9px;
}

.mxx-teaser-standards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 22px;
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.mxx-teaser-standards li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--mx-line-soft);
  color: var(--mxx-ink-2);
  font-size: 14px;
}

.mxx-teaser-standards svg { width: 13px; height: 13px; color: var(--mx-mute-2); flex: 0 0 auto; }

.mxx-teaser-standards .mxx-teaser-val { margin-left: auto; color: var(--mx-mute-2); font-size: 12px; }

.mxx-teaser-ctaband {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.mxx-teaser-cta {
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  background: var(--mx-orange);
  color: var(--mx-on-brand, #ffffff);
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}

.mxx-teaser-cta:hover { background: var(--mx-orange-deep); color: var(--mx-on-brand, #ffffff); text-decoration: none; }

.mxx-teaser-note { color: var(--mx-mute); font-size: 12.5px; margin: 0; }

.mxx-teaser-faq { margin-top: 18px; }

.mxx-teaser-faq h3 { font-size: 14.5px; margin: 14px 0 4px; color: var(--mxx-ink); }

.mxx-teaser-faq p { font-size: 13.5px; color: var(--mxx-ink-3); margin: 0; }

@media (max-width: 640px) {
  .mxx-teaser-standards { grid-template-columns: 1fr; }
}

.mxx-teaser-verdict {
  margin: 14px 0 2px;
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
}

.mxx-teaser-verdict.pass {
  background: var(--mx-up-soft);
  color: var(--mx-up);
  border: 1px solid var(--mx-up-border);
}

.mxx-teaser-verdict.fail {
  background: var(--mx-down-soft);
  color: var(--mx-down);
  border: 1px solid var(--mx-down-border);
}
