/*
 * TNPayoff — interactive options payoff diagram (pairs with assets/js/payoff.js)
 * BullBridge News
 *
 * Colours, radii, shadows and fonts come ONLY from the site token contract
 * (--bg … --font-num); every token has a dark fallback so the tool also works standalone.
 * All selectors are prefixed .pf- ; the surrounding UI is RTL, the chart itself is LTR.
 * Accent: sliders/tints follow the nearest [data-accent] (e.g. academy violet), else --brand-2.
 * Every rendered label is ≥ 12px (the SVG is drawn at container pixel size).
 * Variant: add class "pf-compact" to the host for a lean card (chart + 3 key metrics + its controls).
 * Inside editorial text (.prose h3/h4/p/ul/li…) the tool keeps its own type: every element rule that such
 * wrappers also set is written as ".pf .pf-x" (0,2,0), which outranks ".prose h3" (0,1,1) and ".prose li + li" (0,1,2).
 */

/* ---------- token aliases (resolve against the contract, dark fallbacks) ---------- */
.pf,
.pf-glyph-host {
  --pf-bg: var(--bg, #070b14);
  --pf-bg-soft: var(--bg-soft, #0c1322);
  --pf-surface: var(--surface, #0f1727);
  --pf-surface-2: var(--surface-2, #151f33);
  --pf-border: var(--border, rgba(148, 163, 184, 0.14));
  --pf-border-strong: var(--border-strong, rgba(148, 163, 184, 0.3));
  --pf-text: var(--text, #e8eef8);
  --pf-text-2: var(--text-2, #a9b5c9);
  --pf-text-3: var(--text-3, #7a889e);
  --pf-brand: var(--brand, #2dd4bf);
  --pf-brand-2: var(--brand-2, #818cf8);
  --pf-brand-ink: var(--brand-ink, #032a26);
  --pf-pos: var(--pos, #22c55e);
  --pf-pos-soft: var(--pos-soft, rgba(34, 197, 94, 0.15));
  --pf-neg: var(--neg, #f43f5e);
  --pf-neg-soft: var(--neg-soft, rgba(244, 63, 94, 0.15));
  --pf-warn: var(--warn, #f59e0b);
  --pf-warn-soft: var(--warn-soft, rgba(245, 158, 11, 0.15));
  --pf-info: var(--info, #60a5fa);
  --pf-info-soft: var(--info-soft, rgba(96, 165, 250, 0.15));
  --pf-radius-sm: var(--radius-sm, 8px);
  --pf-radius: var(--radius, 12px);
  --pf-radius-lg: var(--radius-lg, 18px);
  --pf-radius-xl: var(--radius-xl, 24px);
  --pf-shadow-sm: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.3));
  --pf-shadow: var(--shadow, 0 10px 30px rgba(0, 0, 0, 0.28));
  --pf-shadow-lg: var(--shadow-lg, 0 18px 48px rgba(0, 0, 0, 0.42));
  --pf-font-body: var(--font-body, "IBM Plex Sans Arabic", "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif);
  --pf-font-head: var(--font-head, var(--pf-font-body));
  --pf-font-num: var(--font-num, var(--pf-font-body));
  --pf-accent: var(--accent, var(--brand-2, #8cb2ff));
  --pf-focus: var(--focus, var(--pf-accent));
}

.pf-host { display: block; }

/* ---------- card ---------- */
.pf {
  container-type: inline-size;
  position: relative;
  isolation: isolate;
  padding: clamp(14px, 2.2vw, 24px);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-lg);
  background: var(--pf-surface);
  background:
    radial-gradient(90% 60% at 100% 0%, color-mix(in srgb, var(--pf-accent) 8%, transparent), transparent 65%),
    radial-gradient(70% 50% at 0% 100%, color-mix(in srgb, var(--pf-accent) 4%, transparent), transparent 70%),
    var(--pf-surface);
  box-shadow: var(--pf-shadow);
  color: var(--pf-text);
  font-family: var(--pf-font-body);
  font-size: 15px;
  line-height: 1.6;
  text-align: start;
}
.pf *, .pf *::before, .pf *::after { box-sizing: border-box; }
.pf [hidden] { display: none !important; }

.pf-num { font-family: var(--pf-font-num); unicode-bidi: isolate; }
/* numeric runs isolated inside Arabic text («$90–$95», «+1.5%») and Latin runs («Covered Call») never break */
.pf .pf-iso { unicode-bidi: isolate; white-space: nowrap; }
.pf [lang="en"] { white-space: nowrap; }

/* ---------- header ---------- */
.pf-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 28px;
  margin-bottom: 16px;
}
.pf-titles { flex: 1 1 340px; min-width: 0; }
.pf .pf-title {
  margin: 0;
  padding: 0;
  font-family: var(--pf-font-head);
  font-size: clamp(1.08rem, 0.95rem + 0.55vw, 1.32rem);
  font-weight: 700;
  line-height: 1.4;
  color: var(--pf-text);
}
.pf .pf-sub { margin: 4px 0 0; max-width: 64ch; color: var(--pf-text-2); font-size: 0.9rem; line-height: 1.6; }
.pf .pf-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.pf-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border: 1px solid var(--pf-border);
  border-radius: 999px;
  background: var(--pf-surface-2);
  color: var(--pf-text-2);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pf-chip--brand {
  border-color: color-mix(in srgb, var(--pf-accent) 32%, transparent);
  background: color-mix(in srgb, var(--pf-accent) 12%, transparent);
  color: var(--pf-text);
}
.pf-chip-num { font-weight: 800; color: var(--pf-text); }

.pf .pf-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--pf-text-2);
  font-size: 12.5px;
  line-height: 1.6;
}
.pf .pf-legend li { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 0; white-space: nowrap; }
.pf .pf-legend li::marker { content: none; }
.pf-legend-key svg, .pf-tip-key svg { display: block; }
.pf-k-pos, .pf-k-neg, .pf-k-now, .pf-k-strike, .pf-k-spot { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.pf-k-pos { stroke: var(--pf-pos); }
.pf-k-neg { stroke: var(--pf-neg); }
.pf-k-now { stroke: var(--pf-info); stroke-width: 2; stroke-dasharray: 5 4; }
.pf-k-strike { stroke: var(--pf-text-3); stroke-width: 2; stroke-dasharray: 0.5 4.5; }
.pf-k-spot { stroke: var(--pf-text-2); stroke-width: 1.6; stroke-dasharray: 4 3; stroke-linecap: butt; }

.pf .pf-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--pf-info) 26%, transparent);
  border-radius: var(--pf-radius);
  background: var(--pf-info-soft);
  color: var(--pf-text);
  font-size: 0.88rem;
  line-height: 1.7;
}
.pf-note-icon { flex: none; margin-top: 3px; color: var(--pf-info); }
.pf-note-icon svg { display: block; }

/* ---------- layout ---------- */
.pf-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "chart" "side" "metrics" "greeks" "legs" "values";
  gap: 14px;
}
.pf-main { display: contents; }
.pf-chart { grid-area: chart; }
.pf-side { grid-area: side; }
.pf-metrics { grid-area: metrics; }
.pf-greeks { grid-area: greeks; }
.pf-legs { grid-area: legs; }
.pf-values { grid-area: values; }

@container (min-width: 820px) {
  .pf-grid {
    grid-template-columns: minmax(0, 1fr) clamp(260px, 30%, 312px);
    grid-template-rows: auto auto 1fr auto auto;
    grid-template-areas:
      "chart side"
      "metrics side"
      "greeks side"
      "legs legs"
      "values values";
    gap: 16px 20px;
  }
  .pf-grid--solo {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "chart" "metrics" "greeks" "legs" "values";
  }
  .pf-greeks { align-self: start; }
}

/* ---------- chart ---------- */
.pf-chart {
  position: relative;
  min-width: 0;
  direction: ltr;
  border-radius: var(--pf-radius);
  outline: none;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}
.pf-chart:focus-visible { box-shadow: 0 0 0 2px var(--pf-surface), 0 0 0 4px var(--pf-focus); }
.pf-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  font-family: var(--pf-font-body);
  -webkit-user-select: none;
  user-select: none;
}
.pf-gridline { stroke: var(--pf-border); stroke-width: 1; shape-rendering: crispEdges; }
.pf-baseline, .pf-tickmark { stroke: var(--pf-border-strong); stroke-width: 1; shape-rendering: crispEdges; }
.pf-tick {
  fill: var(--pf-text-3);
  font-family: var(--pf-font-num);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.pf-tick.is-hidden { opacity: 0; }
.pf-axis-cap { fill: var(--pf-text-3); font-size: 12px; font-weight: 600; }
.pf-zero { stroke: var(--pf-border-strong); stroke-width: 1.5; }
.pf-strike {
  stroke: var(--pf-text-3);
  stroke-width: 1.6;
  stroke-dasharray: 0.5 5;
  stroke-linecap: round;
  opacity: 0.85;
}
.pf-strike-label,
.pf-be-label {
  paint-order: stroke;
  stroke: var(--pf-surface);
  stroke-width: 4px;
  stroke-linejoin: round;
}
.pf-strike-label {
  fill: var(--pf-text-2);
  font-family: var(--pf-font-num);
  font-size: 12px;
  font-weight: 700;
}
.pf-area-pos { fill: var(--pf-pos-soft); }
.pf-area-neg { fill: var(--pf-neg-soft); }
.pf-stop-pos { stop-color: var(--pf-pos); }
.pf-stop-neg { stop-color: var(--pf-neg); }
.pf-glow { pointer-events: none; }
.pf-curve { fill: none; stroke-width: 2.75; stroke-linejoin: round; stroke-linecap: round; }
.pf-curve-pos { stroke: var(--pf-pos); }
.pf-curve-neg { stroke: var(--pf-neg); }
.pf-curve-now {
  fill: none;
  stroke: var(--pf-info);
  stroke-width: 2;
  stroke-dasharray: 6 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pf-spot { stroke: var(--pf-text-2); stroke-width: 1.25; stroke-dasharray: 4 4; }
.pf-spot-pill rect { fill: var(--pf-text); }
.pf-spot-pill text { fill: var(--pf-surface); font-size: 12px; font-weight: 600; }
.pf-be { fill: var(--pf-text); stroke: var(--pf-surface); stroke-width: 2.5; }
.pf-be-label { fill: var(--pf-text); font-size: 12px; font-weight: 700; }
.pf-cross { stroke: var(--pf-text-2); stroke-width: 1; stroke-dasharray: 2 3; }
.pf-dot { stroke: var(--pf-surface); stroke-width: 2.5; }
.pf-dot-exp.is-pos { fill: var(--pf-pos); }
.pf-dot-exp.is-neg { fill: var(--pf-neg); }
.pf-dot-now { fill: var(--pf-info); }
.pf-xread-bg { fill: var(--pf-text); }
.pf-xread-text {
  fill: var(--pf-surface);
  font-family: var(--pf-font-num);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* tooltip */
.pf-tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  min-width: 176px;
  padding: 10px 12px;
  border: 1px solid var(--pf-border-strong);
  border-radius: var(--pf-radius-sm);
  background: var(--pf-surface);
  box-shadow: var(--pf-shadow-lg);
  color: var(--pf-text);
  font-size: 13px;
  line-height: 1.45;
  text-align: start;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0s linear 0.12s;
}
.pf-tip.is-on { opacity: 1; visibility: visible; transform: none; transition: opacity 0.12s ease, transform 0.12s ease; }
.pf-tip-hint { display: none; }
.pf-tip-cell { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 5px; }
.pf-tip-cell--price { margin: 0 0 6px; padding-bottom: 7px; border-bottom: 1px solid var(--pf-border); }
.pf-tip-k { display: inline-flex; align-items: center; gap: 7px; color: var(--pf-text-2); }
.pf-tip-cell--price .pf-tip-k { color: var(--pf-text-3); }
.pf-tip-v { color: var(--pf-text); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pf-tip-price { font-size: 0.95rem; }
.pf-tip-move { color: var(--pf-text-3); font-size: 12px; font-weight: 500; }

.pf-pos { color: var(--pf-pos); }
.pf-neg { color: var(--pf-neg); }

/* ---------- metrics ---------- */
.pf-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.pf-metric {
  position: relative;
  min-width: 0;
  padding: 12px 16px 12px 14px;
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius);
  background: var(--pf-surface-2);
  overflow: hidden;
}
.pf-metric::before {
  content: "";
  position: absolute;
  inset-block: 12px;
  inset-inline-start: 0;
  width: 3px;
  border-start-end-radius: 3px;
  border-end-end-radius: 3px;
  background: var(--pf-border-strong);
}
.pf-metric--pos::before { background: var(--pf-pos); }
.pf-metric--neg::before { background: var(--pf-neg); }
.pf-metric--debit::before { background: var(--pf-warn); }
.pf-metric--credit::before { background: var(--pf-info); }
.pf-metric-label { color: var(--pf-text-3); font-size: 12.5px; font-weight: 600; }
.pf-metric-value {
  margin-top: 2px;
  color: var(--pf-text);
  font-size: clamp(1.02rem, 0.92rem + 0.45vw, 1.24rem);
  font-weight: 800;
  line-height: 1.35;
}
.pf-metric--pos .pf-metric-value { color: var(--pf-pos); }
.pf-metric--neg .pf-metric-value { color: var(--pf-neg); }
.pf-metric-num { font-family: var(--pf-font-head); font-variant-numeric: tabular-nums; }
.pf-metric-sub { margin-top: 3px; color: var(--pf-text-3); font-size: 12px; line-height: 1.5; }
.pf-meter {
  height: 6px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--pf-neg-soft);
}
.pf-meter-fill { display: block; height: 100%; border-radius: inherit; background: var(--pf-pos); transition: width 0.25s ease; }

.pf-greeks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  color: var(--pf-text-3);
  font-size: 12.5px;
}
.pf-greeks-title { margin-inline-end: 2px; font-weight: 700; }
.pf-greeks-when { font-weight: 500; color: var(--pf-text-3); }
.pf-greek {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 2px 10px;
  border: 1px solid var(--pf-border);
  border-radius: 999px;
  background: var(--pf-bg-soft);
  cursor: help;
}
.pf-greek-k { color: var(--pf-text-3); }
.pf-greek-v { color: var(--pf-text); font-weight: 700; font-family: var(--pf-font-num); font-variant-numeric: tabular-nums; }

/* ---------- controls ---------- */
.pf-side {
  align-self: start;
  padding: 16px;
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius);
  background: var(--pf-surface-2);
}
.pf .pf-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; }
.pf .pf-side-title { margin: 0; padding: 0; font-family: var(--pf-font-head); font-size: 0.95rem; font-weight: 800; line-height: 1.45; color: var(--pf-text); }
/* tap target: 44px on every device (touch laptops report a fine pointer) */
.pf .pf-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-height: 44px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--pf-border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--pf-text-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.pf .pf-reset:hover { border-color: var(--pf-accent); background: color-mix(in srgb, var(--pf-accent) 10%, transparent); color: var(--pf-text); }
.pf .pf-reset:focus-visible { outline: 2px solid var(--pf-focus); outline-offset: 2px; }
.pf-reset-icon svg { display: block; }
.pf-ctl-list { display: flex; flex-direction: column; gap: 14px; }
.pf-ctl-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.pf-ctl-label { color: var(--pf-text-2); font-size: 13.5px; font-weight: 600; line-height: 1.45; }
.pf-ctl-val {
  flex: none;
  padding: 1px 8px;
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-sm);
  background: var(--pf-bg-soft);
  color: var(--pf-text);
  font-family: var(--pf-font-num);
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pf .pf-side-hint { margin: 14px 0 0; color: var(--pf-text-3); font-size: 12.5px; line-height: 1.65; }

.pf-range {
  --pf-fill: 50%;
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  direction: ltr;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.pf-range:focus { outline: none; }
.pf-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--pf-accent) 0 var(--pf-fill), var(--pf-border-strong) var(--pf-fill) 100%);
}
.pf-range::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border: 3px solid var(--pf-accent);
  border-radius: 50%;
  background: var(--pf-surface);
  box-shadow: var(--pf-shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  -webkit-appearance: none;
  appearance: none;
}
.pf-range:active::-webkit-slider-thumb { transform: scale(1.12); }
.pf-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px color-mix(in srgb, var(--pf-focus) 35%, transparent); }
.pf-range::-moz-range-track { height: 6px; border-radius: 999px; background: var(--pf-border-strong); }
.pf-range::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--pf-accent); }
.pf-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid var(--pf-accent);
  border-radius: 50%;
  background: var(--pf-surface);
  box-shadow: var(--pf-shadow-sm);
}
.pf-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 5px color-mix(in srgb, var(--pf-focus) 35%, transparent); }

/* ---------- tables ---------- */
.pf .pf-sec-title { margin: 0 0 8px; padding: 0; font-family: var(--pf-font-head); font-size: 0.95rem; font-weight: 800; line-height: 1.45; color: var(--pf-text); }
.pf-legs { min-width: 0; }
.pf .pf-table-wrap {
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius);
  -webkit-overflow-scrolling: touch;
}
.pf-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.pf-table th,
.pf-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--pf-border);
  text-align: start;
  vertical-align: middle;
  white-space: nowrap;
}
.pf-table thead th { background: var(--pf-surface-2); color: var(--pf-text-3); font-size: 12.5px; font-weight: 700; }
.pf-table tbody tr:last-child th,
.pf-table tbody tr:last-child td { border-bottom: 0; }
.pf-table tbody tr:hover { background: var(--pf-bg-soft); }
.pf-legs-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--pf-border-strong);
  background: var(--pf-surface-2);
  font-size: 0.85rem;
  font-weight: 700;
}
/* two breakevens stack (low → high) instead of wrapping with a dangling separator in a narrow card */
.pf-be-list { display: flex; flex-direction: column; align-items: flex-start; }
.pf-be-sep { display: none; }
.pf-table td { font-variant-numeric: tabular-nums; }
.pf-leg-name { color: var(--pf-text); font-weight: 700; }
.pf-leg-idx {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-inline-end: 8px;
  border: 1px solid var(--pf-border);
  border-radius: 7px;
  background: var(--pf-bg-soft);
  color: var(--pf-text-2);
  font-size: 12px;
}
.pf-side-chip { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pf-side-chip--long { background: var(--pf-info-soft); color: var(--pf-info); }
.pf-side-chip--short { background: var(--pf-warn-soft); color: var(--pf-warn); }
.pf-flow { display: block; margin-top: 1px; color: var(--pf-text-3); font-size: 12px; font-weight: 500; white-space: normal; }
.pf-strong { font-weight: 800; }

.pf-values > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius);
  background: var(--pf-surface-2);
  color: var(--pf-text-2);
  font-size: 0.86rem;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}
.pf-values > summary::-webkit-details-marker { display: none; }
.pf-values > summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(135deg);
  transition: transform 0.15s ease;
}
.pf-values[open] > summary::before { transform: rotate(45deg); }
.pf-values > summary:hover { color: var(--pf-text); }
.pf-values > summary:focus-visible { outline: 2px solid var(--pf-focus); outline-offset: 2px; }
.pf-values[open] > summary { margin-bottom: 8px; }
.pf-values-table th[scope="row"] { font-weight: 700; }

.pf-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- narrow containers (phones, sidebars) ---------- */
@container (max-width: 640px) {
  .pf-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pf-metric { padding: 10px 14px 10px 12px; }
}
/* phones: the readout docks above the chart as a fixed-height bar (never covers the plot) */
@container (max-width: 559px) {
  .pf-chart { display: flex; flex-direction: column; }
  .pf-tip {
    position: relative;
    top: auto !important;
    left: auto !important;
    order: -1;
    display: grid;
    grid-template-columns: 1.15fr 1fr 1fr;
    align-items: start;
    gap: 8px;
    min-width: 0;
    min-height: 56px;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-color: var(--pf-border);
    background: var(--pf-surface-2);
    box-shadow: none;
    white-space: normal;
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .pf-tip-cell, .pf-tip-cell--price {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 2px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .pf-tip-k { gap: 5px; font-size: 12px; white-space: nowrap; }
  .pf-tip-k .pf-tip-key svg { width: 16px; }
  .pf-tip-hint { display: block; grid-column: 1 / -1; align-self: center; color: var(--pf-text-3); font-size: 12.5px; line-height: 1.55; }
  .pf-tip:not(.is-on) .pf-tip-cell { display: none; }
  .pf-tip.is-on .pf-tip-hint { display: none; }
  .pf-legs-table .pf-col-type, .pf-legs-table .pf-col-side { display: none; }
}
@container (max-width: 520px) {
  .pf-head { gap: 10px; margin-bottom: 12px; }
  .pf .pf-legend { gap: 4px 12px; font-size: 12px; }
  .pf-side { padding: 14px; }
  .pf-table { font-size: 13px; }
  .pf-table th, .pf-table td { padding: 8px 10px; }
  .pf-legs-table th, .pf-legs-table td { padding-inline: 8px; }
  .pf-legs-table .pf-leg-name { white-space: normal; min-width: 7.5em; }
  .pf-leg-idx { display: none; }
}

/* ---------- glyph (card sparkline) ---------- */
.pf-glyph-host { display: inline-block; line-height: 0; }
.pf-glyph { display: block; max-width: 100%; height: auto; overflow: visible; }
.pf-g-zero { stroke: var(--pf-border-strong); stroke-width: 1; }
.pf-g-area-pos { fill: var(--pf-pos-soft); }
.pf-g-area-neg { fill: var(--pf-neg-soft); }
.pf-g-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pf-g-line-pos { stroke: var(--pf-pos); }
.pf-g-line-neg { stroke: var(--pf-neg); }

/* ---------- compact variant (host has .pf-compact): home/academy feature cards ---------- */
.pf-compact .pf { padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.pf-compact .pf-titles, .pf-compact .pf-note, .pf-compact .pf-greeks, .pf-compact .pf-legs,
.pf-compact .pf-values, .pf-compact .pf-side-hint { display: none !important; }
.pf-compact .pf .pf-head { margin-bottom: 8px; justify-content: flex-start; }
.pf-compact .pf-grid,
.pf-compact .pf-grid--solo { grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: none !important; grid-template-areas: "chart" "metrics" "side" !important; gap: 12px !important; }
.pf-compact .pf-chart { padding: 8px 8px 0; border-radius: var(--pf-radius); background: var(--pf-surface-2); border: 1px solid var(--pf-border); }
.pf-compact .pf-metric:nth-child(n+4) { display: none; }
.pf-compact .pf-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pf-compact .pf-metric { padding: 10px 12px 10px 10px; }
.pf-compact .pf-metric-sub { display: none; }
.pf-compact .pf-side { padding: 10px 14px 6px; }
.pf-compact .pf .pf-side-head { margin-bottom: 0; }
.pf-compact .pf .pf-side-title { font-size: 13.5px; color: var(--pf-text-2); font-weight: 700; }
@container (max-width: 420px) {
  .pf-compact .pf-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pf-compact .pf-metric-value { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .pf-tip, .pf-tip.is-on, .pf-meter-fill, .pf .pf-reset, .pf-values > summary::before, .pf-range::-webkit-slider-thumb { transition: none; }
}
@media (forced-colors: active) {
  .pf-curve-pos, .pf-curve-neg, .pf-g-line { stroke: CanvasText; }
  .pf-curve-now { stroke: Highlight; }
}
@media print {
  .pf { box-shadow: none; }
  .pf-side, .pf-tip { display: none !important; }
  .pf-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "chart" "metrics" "greeks" "legs" "values"; }
}
