/* EGP price monitor — "The Mix" design system. Self-contained (self-hosted font,
   no external requests), theme-aware (light default + dark), RTL-safe, mobile-first. */

/* ONE typeface for the whole app: Cairo, for BOTH scripts and the numbers. Self-hosted woff2
   under font-src 'self' (no external calls), split into latin / latin-ext / arabic subsets by
   unicode-range so the browser fetches only what a page needs. Because a single font renders
   Latin and Arabic, there is NO cross-font baseline mismatch, so Cairo keeps its NATURAL
   metrics (the old ascent/descent overrides that pinned it to Plus Jakarta Sans are gone,
   along with Jakarta itself). Weights 400-800. Add a weight = add its three subset faces. */
@font-face { font-family: "Cairo"; font-weight: 400; font-display: swap; src: url("/fonts/cairo/cairo-arabic-400.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: "Cairo"; font-weight: 400; font-display: swap; src: url("/fonts/cairo/cairo-latin-ext-400.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cairo"; font-weight: 400; font-display: swap; src: url("/fonts/cairo/cairo-latin-400.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cairo"; font-weight: 500; font-display: swap; src: url("/fonts/cairo/cairo-arabic-500.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: "Cairo"; font-weight: 500; font-display: swap; src: url("/fonts/cairo/cairo-latin-ext-500.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cairo"; font-weight: 500; font-display: swap; src: url("/fonts/cairo/cairo-latin-500.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cairo"; font-weight: 600; font-display: swap; src: url("/fonts/cairo/cairo-arabic-600.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: "Cairo"; font-weight: 600; font-display: swap; src: url("/fonts/cairo/cairo-latin-ext-600.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cairo"; font-weight: 600; font-display: swap; src: url("/fonts/cairo/cairo-latin-600.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cairo"; font-weight: 700; font-display: swap; src: url("/fonts/cairo/cairo-arabic-700.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: "Cairo"; font-weight: 700; font-display: swap; src: url("/fonts/cairo/cairo-latin-ext-700.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cairo"; font-weight: 700; font-display: swap; src: url("/fonts/cairo/cairo-latin-700.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cairo"; font-weight: 800; font-display: swap; src: url("/fonts/cairo/cairo-arabic-800.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: "Cairo"; font-weight: 800; font-display: swap; src: url("/fonts/cairo/cairo-latin-ext-800.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cairo"; font-weight: 800; font-display: swap; src: url("/fonts/cairo/cairo-latin-800.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f3f6f5; --card: #ffffff; --panel: #ffffff; --ink: #16211e; --mut: #6a7975; --line: #e9efed;
  --teal: #0f9d8f; --tealbg: #e6f5f2; --gold: #dfa63a; --violet: #8b8bff;
  --up: #0aa06e; --upbg: #e6f7ef; --dn: #e0426a; --warn: #b5561f; --warnbg: #fbeee6;
  --gtrack: #eef3f1; --sel: #eef4f2; --shadow: 0 8px 26px rgba(20,40,35,.05);
}
/* Light is the DEFAULT theme (no OS-follow). Dark applies only when the user picks it
   via the manual toggle, which sets data-theme="dark" (persisted, applied pre-paint). */
:root[data-theme="dark"] {
  --bg: #0c1512; --card: #12201c; --panel: #12201c; --ink: #e7f2ee; --mut: #8aa39c; --line: #203029;
  --teal: #3fd0bf; --tealbg: #123028; --gold: #e6b84e; --violet: #9d9dff;
  --up: #3fca8e; --upbg: #0f2b1f; --dn: #ff6b86; --warn: #e0a86a; --warnbg: #2a1e12;
  --gtrack: #1a2b25; --sel: #16261f; --shadow: none;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Cairo", system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; line-height: 1.5; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.up { color: var(--up); } .dn { color: var(--dn); } .mut { color: var(--mut); } .warn { color: var(--warn); }
a { color: var(--teal); } a:hover { color: var(--teal); }
.wrap { max-width: 940px; margin: 0 auto; padding: 22px 18px 50px; }

/* top bar */
.top { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
.brand .mk { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(140deg, var(--teal), #0b7d72); display: grid; place-items: center; box-shadow: 0 5px 14px rgba(15,157,143,.3); flex: none; }
.topright { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.lang { font-size: 13px; font-weight: 600; color: var(--mut); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; text-decoration: none; }
.theme { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; color: var(--mut); background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.theme[hidden] { display: none; }
.theme:hover { color: var(--teal); border-color: var(--teal); }
.theme svg { width: 17px; height: 17px; }
.theme .ic-sun { display: none; }
:root[data-theme="dark"] .theme .ic-sun { display: inline; }
:root[data-theme="dark"] .theme .ic-moon { display: none; }

/* scalable asset selector: filter chips + tiles share ONE horizontally-scrolling row.
   Everything fits on wide screens; on narrow screens you swipe. Always one row tall. */
/* Vertical padding gives the tiles' hover lift + shadow room: overflow-x:auto also clips
   the y-axis, so without it the hover/selected effects get trimmed top and bottom. */
.assetbar { margin-bottom: 4px; display: flex; align-items: center; gap: 12px; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; padding: 8px 2px 16px; }
.assetbar::-webkit-scrollbar { display: none; }
.filters { display: flex; gap: 6px; flex: none; }
.filters[hidden] { display: none; }
.fchip { font-size: 12.5px; font-weight: 700; color: var(--mut); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; cursor: pointer; font-family: inherit; transition: .15s; white-space: nowrap; }
/* Active filter + tile visibility are driven by <html data-cat> (set pre-paint by theme.js,
   toggled by app.js) — not a JS-added class — so the state survives navigation with no flash.
   Kinds are a controlled set; add a pair of selectors when a new asset kind lands. */
:root[data-cat="fx"] .fchip[data-k="fx"],
:root[data-cat="metal"] .fchip[data-k="metal"] { color: #fff; background: var(--teal); border-color: var(--teal); }
:root[data-cat="fx"] .tile:not([data-kind="fx"]),
:root[data-cat="metal"] .tile:not([data-kind="metal"]) { display: none; }
.filters::after { content: ""; align-self: stretch; width: 1px; margin-inline-start: 6px; background: var(--line); }
.strip-wrap { position: relative; flex: none; display: flex; }
.strip { display: flex; gap: 9px; }
.tile { scroll-snap-align: start; flex: 0 0 auto; display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 9px 14px 9px 12px; cursor: pointer; transition: .16s; text-decoration: none; color: var(--ink); }
.tile.on, .tile[aria-current="true"] { border-color: var(--teal); box-shadow: 0 4px 12px rgba(15,157,143,.13); }
.tile .tsym { flex: none; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 14px; line-height: 1; }
.tile .tsym.fx { background: color-mix(in srgb, var(--teal) 13%, var(--card)); color: var(--teal); }
/* 3-letter currency codes: MONOSPACE so every code (KWD, AED, SAR) renders at the exact
   same width — a proportional font makes wide letters (K/W/D) wider than narrow ones. */
.tile .tsym.fx.sm { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace; font-size: 8.5px; font-weight: 700; letter-spacing: 0; }
.tile .tsym.metal { border-radius: 50%; }             /* circle = coin: metal, not money */
.tile .tsym.metal.sm { font-size: 10.5px; }
.tile .tsym.metal.gold { background: rgba(197,152,45,.16); color: #b0851c; }
.tile .tsym.metal.silver { background: rgba(120,132,144,.18); color: #6f7883; }
.tile .tsym.metal.platinum { background: rgba(92,120,150,.16); color: #5f7d99; }
[data-theme="dark"] .tile .tsym.metal.gold { color: #d8b25a; }
[data-theme="dark"] .tile .tsym.metal.silver { color: #b9c2cc; }
[data-theme="dark"] .tile .tsym.metal.platinum { color: #9db8d0; }
.tile .spark { flex: none; }
.tile .tn { display: flex; flex-direction: column; line-height: 1.2; }
.tile .tv { font-weight: 800; font-size: 13.5px; white-space: nowrap; }
.tile .tc { font-size: 11px; font-weight: 700; margin-top: 1px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.msg-card, .legal-card { padding: 26px; }
.msg { color: var(--mut); font-size: 16px; }

/* empty / building states (one consistent placeholder everywhere) */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 34px 22px; color: var(--mut); }
.empty svg { color: var(--mut); opacity: .4; margin-bottom: 6px; }
.empty-t { font-size: 15.5px; font-weight: 800; color: var(--ink); margin: 0; }
.empty-s { font-size: 13.5px; line-height: 1.55; margin: 0; max-width: 340px; }
.empty-link { margin-top: 14px; font-size: 13px; font-weight: 700; color: var(--teal); text-decoration: none; }
.empty-card { display: flex; align-items: center; justify-content: center; min-height: 240px; }
.chart-empty .empty { flex: 1 1 auto; min-height: 260px; }
.hero.hero-empty { grid-template-columns: 1fr; grid-template-areas: none; }
.hero.hero-empty .empty { min-height: 180px; align-items: flex-start; text-align: start; padding: 24px 2px 6px; }
.spark.spark-empty { color: var(--mut); opacity: .5; }

/* hero: semantic blocks placed by grid-areas. Desktop = gauge in a left column beside the
   reading; the reading stacks context -> answer -> assessment on the right. */
.hero { display: grid; grid-template-columns: 238px 1fr; column-gap: 8px; row-gap: 0; align-items: start;
  grid-template-areas: "gauge context" "gauge answer" "gauge assess"; padding: 22px 26px; margin-bottom: 14px; }
.h-gauge { grid-area: gauge; align-self: center; justify-self: center; }
.h-context { grid-area: context; min-width: 0; }
.h-answer { grid-area: answer; min-width: 0; }
.h-assess { grid-area: assess; min-width: 0; }
.gauge { position: relative; width: 210px; justify-self: center; }
.gauge svg { display: block; width: 100%; height: auto; }
.gaxis { fill: color-mix(in srgb, var(--mut) 65%, transparent); font-size: 10px; font-weight: 700; letter-spacing: .06em; font-family: "Cairo", sans-serif; text-transform: uppercase; }
/* RTL: mirror the whole dial (low->right, high->left, knob sweeps right->left) by flipping
   the SVG, then counter-flip the two axis labels so they read normally at their new sides.
   The centre word lives in .gc (HTML, outside the SVG), so it stays upright. */
[dir="rtl"] .gauge svg { transform: scaleX(-1); }
[dir="rtl"] .gauge .gaxis { transform-box: fill-box; transform-origin: center; transform: scaleX(-1); }
.gc { position: absolute; inset-inline: 0; top: 47%; transform: translateY(-50%); text-align: center; pointer-events: none; }
.gword { font-size: 17px; font-weight: 800; color: var(--teal); letter-spacing: -.01em; }
.gword.muted { color: var(--mut); font-size: 15px; }
.read { min-width: 0; }
.read-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.eyebrow { font-size: 13px; color: var(--mut); font-weight: 700; }
.toggle { display: inline-flex; background: var(--bg); border-radius: 11px; padding: 3px; }
.seg { font-size: 12.5px; font-weight: 700; color: var(--mut); padding: 6px 12px; border-radius: 8px; text-decoration: none; }
.seg[aria-selected="true"] { background: var(--card); color: var(--teal); box-shadow: 0 2px 6px rgba(20,40,35,.08); }
.big { font-size: 60px; font-weight: 800; line-height: .98; margin: 8px 0 2px; display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.big b { color: var(--ink); }
.big small { font-size: 14px; font-weight: 700; color: var(--mut); letter-spacing: 0; }
.seller { font-size: 15px; font-weight: 600; color: var(--mut); }
.seller b { color: var(--ink); font-weight: 800; }
.tiemore { font-size: 13px; font-weight: 600; color: var(--mut); margin-inline-start: 9px; white-space: nowrap; unicode-bidi: isolate; }
.tiemore::before { content: ""; display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: color-mix(in srgb, var(--mut) 55%, transparent); vertical-align: middle; margin-inline-end: 9px; }
.verdrow { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; padding: 6px 13px; border-radius: 999px; }
.chip.good { color: var(--up); background: var(--upbg); }
.chip.warn, .chip.stale { color: var(--warn); background: var(--warnbg); }
.chip.neutral { color: var(--mut); background: var(--sel); }
.chip .ok { flex: none; }
.say { font-size: 15.5px; font-weight: 500; line-height: 1.5; margin-top: 12px; color: color-mix(in srgb, var(--ink) 85%, var(--mut)); }
.because { font-size: 14px; color: var(--mut); margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* chart + panel row */
/* Equal-height cards: the chart card always matches the panel, even when it's empty. */
.row { display: grid; grid-template-columns: 1fr 292px; gap: 14px; align-items: stretch; }   /* both cards share a height; the panel (content-sized) drives it, the chart follows */
.chartcard, .panel { padding: 18px 20px; }
.chartcard { display: flex; flex-direction: column; }
.chhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.ctitle { font-size: 13px; font-weight: 800; }
.rng { display: inline-flex; gap: 3px; flex: none; }
.rng .rb { font-size: 12px; font-weight: 700; color: var(--mut); padding: 5px 10px; border-radius: 8px; text-decoration: none; white-space: nowrap; }
.rng .rb[aria-selected="true"] { color: var(--teal); background: var(--tealbg); }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--mut); font-weight: 600; margin: 8px 2px 8px; flex-wrap: wrap; }
.legend .swatch { display: inline-block; width: 13px; border-top: 2px solid; vertical-align: middle; margin-inline-end: 5px; }
.legend .swatch.mark { border-color: var(--teal); }
.legend .swatch.dash-o { border-color: var(--violet); }
.legend .swatch.dash-g { border-color: var(--gold); border-top-style: dashed; }
/* The chart fills the leftover card height. The SVG is absolutely positioned so its intrinsic
   (aspect-locked) height does NOT feed the grid row sizing — that lets the content-sized panel
   drive the shared row height and the chart FOLLOW it. The SVG then scales UNIFORMLY to fit
   the area (default preserveAspectRatio), so no distortion whichever card is taller. */
.chart { position: relative; flex: 1 1 auto; min-height: 120px; }
.chart svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); }
.chart .axis { fill: color-mix(in srgb, var(--mut) 75%, transparent); font-size: 12px; font-family: "Cairo", sans-serif; font-weight: 600; }
.chart .cref-o { stroke: var(--violet); stroke-width: 1.3; opacity: .6; }
.chart .cref-g { stroke: var(--gold); stroke-width: 1.3; opacity: .6; }
.chart .chair { stroke: color-mix(in srgb, var(--teal) 40%, transparent); stroke-width: 1.4; }
.chart .cdot { fill: var(--card); stroke: var(--teal); stroke-width: 2.5; }
.ctip { position: absolute; pointer-events: none; background: var(--ink); color: var(--card); border-radius: 11px; padding: 9px 11px; transform: translate(-50%, -116%); opacity: 0; transition: .1s; white-space: nowrap; z-index: 5; box-shadow: 0 8px 22px rgba(10,25,22,.3); min-width: 148px; }
.ctip .d { font-size: 10.5px; font-weight: 600; opacity: .55; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.ctip .tr { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; margin-top: 4px; }
.ctip .tr .sw { width: 9px; height: 9px; border-radius: 2.5px; flex: none; }
.ctip .tr b { margin-inline-start: auto; font-weight: 800; padding-inline-start: 14px; }

.panel .kv { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.panel .kv:first-child { padding-top: 0; }
.panel .k { font-size: 12.5px; color: var(--mut); font-weight: 600; display: inline-flex; align-items: center; }
.panel .v { font-size: 15px; font-weight: 800; }
.panel .v.ok-t { color: var(--teal); display: inline-flex; align-items: center; gap: 5px; }
.sub { font-size: 11px; font-weight: 800; color: var(--mut); text-transform: uppercase; letter-spacing: .05em; margin: 14px 0 6px; }
.srow { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; padding: 6px 0; }
.srow .sn { font-size: 12.5px; font-weight: 600; }
.srow .sn .tagb { vertical-align: middle; }
.srow .sv { font-size: 12.5px; font-weight: 800; }
.srow .sbar { grid-column: 1 / 3; height: 5px; background: var(--bg); border-radius: 3px; position: relative; }
.srow .sbar > i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--teal); opacity: .35; border-radius: 3px; }
.srow.best .sbar > i { opacity: .8; }
.tagb { font-size: 9.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--teal); background: var(--tealbg); border-radius: 5px; padding: 2px 6px; margin-inline-start: 6px; }
.tagb.ref { color: var(--mut); background: var(--sel); }
.showall { font-size: 12.5px; font-weight: 700; color: var(--teal); margin-top: 10px; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }

/* full seller table (disclosed) + generic details */
/* dedicated "all sellers" page */
.sellerspage { margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; color: var(--mut); text-decoration: none; margin-bottom: 12px; }
.back:hover { color: var(--teal); }
[dir="rtl"] .back svg, [dir="rtl"] .showall svg { transform: scaleX(-1); }   /* chevrons point the RTL way */
.shead { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.shead .toggle { flex: none; }
.ptitle { font-size: 20px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 6px; }
.ptitle .pdim { color: var(--mut); font-weight: 700; }
.pcaption { font-size: 13px; color: var(--mut); margin: 0; }
.allsellers { padding: 6px 18px 10px; }
.tbl-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: start; font-size: 10px; color: var(--mut); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; padding: 6px 8px; }
th.nowrap { white-space: nowrap; }
td { padding: 9px 8px; border-top: 1px solid var(--line); font-size: 13px; }
tbody tr:not(.best):hover td { background: var(--sel); }
tr.best td { background: color-mix(in srgb, var(--tealbg) 55%, transparent); }
/* the column that matters for the direction is emphasized; the other is muted */
th.rel { color: var(--ink); }
td.rel { color: var(--ink); font-weight: 800; }
th.mut-col, td.mut-col { color: color-mix(in srgb, var(--mut) 82%, transparent); }
th.vscol, td.vscol { color: var(--mut); }
td.vscol { font-size: 12px; }
th.vscol .explain { vertical-align: baseline; }
/* reference row (official rate) sits apart from the sellers */
tr.bench td { border-top: 2px solid var(--line); color: var(--mut); }
tr.bench td.rel { font-weight: 700; }
/* downward tooltip variant: for triggers near the top (e.g. a table header) */
.explain.down .explain-body { bottom: auto; top: calc(100% + 9px); left: auto; right: -6px; transform: translateY(-5px); }
.explain.down:hover .explain-body, .explain.down:focus .explain-body, .explain.down:focus-within .explain-body { transform: translateY(0); }
.explain.down .explain-body::after { top: auto; bottom: 100%; left: auto; right: 9px; transform: none; border-top-color: transparent; border-bottom-color: var(--ink); }

/* teach-in-context explainer */
/* teach-in-context: a "?" that reveals a note as a hover/focus OVERLAY (never in flow) */
.explain { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-inline-start: 5px; border: 1px solid var(--line); border-radius: 50%; color: var(--mut); font-size: 10px; font-weight: 700; line-height: 1; cursor: help; vertical-align: middle; transition: color .15s, border-color .15s, background-color .15s; }
.explain::after { content: "?"; }
[dir="rtl"] .explain::after { content: "؟"; }
.explain:hover, .explain:focus-visible { color: #fff; background: var(--teal); border-color: var(--teal); outline: none; }
.explain-body { position: absolute; bottom: calc(100% + 9px); left: 50%; width: max-content; max-width: 220px; transform: translateX(-50%) translateY(5px); background: var(--ink); color: var(--bg); font-size: 12.5px; line-height: 1.5; font-weight: 500; text-transform: none; letter-spacing: normal; white-space: normal; text-align: start; padding: 9px 12px; border-radius: 10px; box-shadow: 0 10px 30px rgba(20,40,35,.28); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .17s ease, transform .17s ease; z-index: 60; }
.explain-body::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--ink); }
.explain:hover .explain-body, .explain:focus .explain-body, .explain:focus-within .explain-body { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* footer */
footer { margin-top: 22px; text-align: center; }
.trust { display: flex; align-items: center; gap: 7px; justify-content: center; flex-wrap: wrap; font-size: 12.5px; color: var(--mut); font-weight: 600; }
.trust .cue { font-weight: 800; }
.trust .cue.ok-t { color: var(--teal); }
.disclaimer { font-size: 12px; color: var(--mut); max-width: 620px; margin: 12px auto 0; line-height: 1.6; }
.foot-links { margin-top: 12px; font-size: 13px; }
.foot-links a { color: var(--mut); text-decoration: none; font-weight: 600; }
.dotsep { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--mut); vertical-align: middle; margin: 0 8px; opacity: .6; }
.legalpage { max-width: 700px; margin: 0 auto; }
.legal-card { padding: 26px 28px; }
.legal-card h1 { font-size: 22px; margin: 0 0 12px; letter-spacing: -.01em; }
.legal { text-align: start; }
.legal p { color: color-mix(in srgb, var(--ink) 85%, var(--mut)); font-size: 14.5px; line-height: 1.7; margin: 0 0 13px; }
.legal p:last-child { margin-bottom: 0; }
.legalpage footer { margin-top: 16px; }
.foot-links a[aria-current="page"] { color: var(--ink); font-weight: 800; pointer-events: none; }

/* ---- interaction states: hover / active / focus-visible (keyboard) ---- */
a { transition: color .15s ease; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
.tile, .fchip, .seg, .rng .rb, .lang, .theme, .showall, .back, .empty-link, .foot-links a, .explain { -webkit-tap-highlight-color: transparent; }

.tile { transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.tile:hover { color: var(--ink); border-color: color-mix(in srgb, var(--teal) 45%, var(--line)); transform: translateY(-2px); box-shadow: 0 9px 20px rgba(15,157,143,.14); }   /* keep text colour steady: the lift + border + shadow are enough */
.tile:active { transform: translateY(0); box-shadow: none; }

.fchip { transition: color .15s ease, border-color .15s ease, background-color .15s ease, transform .1s ease; }
.fchip:hover { color: var(--ink); border-color: color-mix(in srgb, var(--teal) 40%, var(--line)); }   /* active chip wins by specificity via [data-cat] */
.fchip:active { transform: scale(.96); }

.seg { transition: color .15s ease, background-color .15s ease, box-shadow .15s ease; }
.seg:hover:not([aria-selected="true"]) { color: var(--ink); }
.rng .rb { transition: color .15s ease, background-color .15s ease; }
.rng .rb:hover:not([aria-selected="true"]) { color: var(--ink); background: var(--sel); }

.lang { transition: color .15s ease, border-color .15s ease; }
.lang:hover { color: var(--teal); border-color: color-mix(in srgb, var(--teal) 45%, var(--line)); }
.theme { transition: color .15s ease, border-color .15s ease, transform .1s ease; }
.theme:active { transform: scale(.93); }

.showall, .back, .empty-link { transition: color .15s ease, gap .15s ease; }
.showall:hover, .empty-link:hover { color: color-mix(in srgb, var(--teal) 78%, var(--ink)); gap: 8px; }
.back:hover { color: var(--teal); gap: 8px; }
.foot-links a { transition: color .15s ease; }
.foot-links a:hover, .nav a:hover { color: var(--teal); }

/* ---- relevant micro-animations (guarded by prefers-reduced-motion below) ---- */
@keyframes barGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.sbar i { transform-origin: left center; animation: barGrow .6s cubic-bezier(.34,.8,.3,1) both; }
[dir="rtl"] .sbar i { transform-origin: right center; }   /* bar is anchored right in RTL, so grow from the right */
.hero .big { animation: riseIn .38s ease-out both; }
/* Same-view re-render (e.g. a language toggle): don't replay the entrance animations. */
:root[data-still] .sbar i, :root[data-still] .hero .big { animation: none; }

/* Gauge fill + knob are driven by ONE registered custom property --p (0..1). Registering it
   makes it ANIMATABLE, so a change to --p moves the arc reveal (dashoffset) and the knob angle
   (rotate about the dial centre) together — identically whichever way the value moves. SSR sets
   --p to the FINAL value (correct with no JS, and stays correct even if the sweep is skipped);
   app.js sets --p0 (previous side's value) + .gmove to sweep --p0 -> the final value ONCE, so
   switching sell<->buy moves the knob forward AND back the same smooth way. */
@property --p { syntax: "<number>"; inherits: true; initial-value: 0; }
@keyframes gaugeSweep { from { --p: var(--p0, 0); } to { --p: var(--pt, 0); } }
.gauge.gmove { animation: gaugeSweep .7s cubic-bezier(.34,.8,.3,1); }
.gfill { stroke-dashoffset: calc((1 - var(--p, 0)) * var(--arc, 377)); }
.gknob { transform-box: view-box; transform-origin: 105px 98px; transform: rotate(calc(var(--p, 0) * 270deg)); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* responsive */
@media (max-width: 720px) {
  .wrap { padding: 18px 14px 40px; }
  /* Hero flow (mobile): mode + label -> rate + seller -> gauge + verdict. The gauge sits
     with the assessment, not up top, so the read order is logical. */
  .hero { grid-template-columns: 1fr; grid-template-areas: "context" "answer" "gauge" "assess"; padding: 18px 20px 20px; row-gap: 0; }
  .h-gauge { margin: 8px 0; }
  .gauge { width: 210px; justify-self: center; margin-bottom: 0; }
  /* Stack the reading: tabs first (the control), then the "Best place to…" label right
     above the number it introduces. */
  .read-top { flex-direction: column; align-items: stretch; gap: 12px; }
  .read-top .toggle { order: -1; align-self: flex-start; }
  .h-assess .verdrow { margin-top: 0; }
  /* Tie note wraps to its own line flush-left (no leading dot / indent). */
  .tiemore { display: block; margin-inline-start: 0; margin-top: 1px; }
  .tiemore::before { display: none; }
  .big { justify-content: flex-start; font-size: 54px; }
  .row { grid-template-columns: 1fr; }
  /* Compact asset tiles so the selected one does not dominate the strip. */
  .tile { padding: 7px 12px 7px 9px; gap: 8px; }
  .tile .tsym { width: 21px; height: 21px; border-radius: 7px; font-size: 12.5px; }
  .tile .tsym.fx.sm { font-size: 7.5px; }
  .tile .spark { width: 32px; height: auto; }
  .tile .tv { font-size: 12.5px; }
  .tile .tc { font-size: 10.5px; }
  /* The chart SVG scales down on narrow screens, so bump the axis text to stay legible. */
  .chart .axis { font-size: 19px; }
}

