/* مرصد الذهب . Pulse style . navy and gold palette */
:root {
  /* الباليت الخماسية الثابتة */
  --navy-900: #0B1F3B;
  --navy-700: #0F4C81;
  --navy-400: #2F86C7;
  --gold:     #D4AF37;
  --cream:    #F3EFE6;

  /* خرائط الاستخدام */
  --bg:        #F3EFE6;
  --bg-soft:   #E8E3D5;
  --bg-warm:   #EDE5CD;
  --surface:   #FFFFFF;
  --fg:        #0B1F3B;
  --fg-2:      #0F4C81;
  --muted:     #58647E;
  --line:      #DAD4C2;
  --line-strong: #B9B1A0;

  --accent:      #D4AF37;
  --accent-ink:  #7A5F0E;
  --accent-soft: #F0E6C2;

  --up:        #0F4C81;
  --up-soft:   #DCEAF5;
  --down:      #B22A2A;
  --down-soft: #F6E2E2;

  --band:        #0B1F3B;
  --band-fg:     #F3EFE6;
  --band-muted:  #8CA3C6;
  --band-accent: #D4AF37;

  --whatsapp:  #25A35A;

  /* التدرجات */
  --grad-hero: linear-gradient(135deg, #0B1F3B 0%, #0F4C81 55%, #2F86C7 110%);
  --grad-side: linear-gradient(135deg, #0F4C81 0%, #2F86C7 100%);
  --grad-hl:   linear-gradient(135deg, #D4AF37 0%, #E6C76E 100%);

  /* الخطوط: المراعي للعربية (300 . 400 . 700 . 800) */
  --font:      'Almarai', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --font-num:  'Space Grotesk', 'Almarai', system-ui, sans-serif;
  --font-head: 'Almarai', 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;

  --radius:     12px;
  --radius-lg:  20px;
  --radius-xl:  24px;
  --maxw:       1240px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1F3B; --bg-soft: #112A4D; --bg-warm: #163A68; --surface: #112A4D;
    --fg: #F3EFE6; --fg-2: #D4C9A8; --muted: #8CA3C6;
    --line: #1E3761; --line-strong: #294877;
    --accent: #E6C76E; --accent-ink: #FFD886; --accent-soft: #2A2110;
    --up: #D4AF37; --up-soft: #163A2A; --down: #F2978F; --down-soft: #3A1A17;
    --band: #061531; --band-fg: #F3EFE6; --band-muted: #8CA3C6; --band-accent: #D4AF37;
    --grad-hero: linear-gradient(135deg, #0F4C81 0%, #2F86C7 70%, #D4AF37 150%);
    --grad-side: linear-gradient(135deg, #0B1F3B 0%, #0F4C81 60%, #2F86C7 110%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1F3B; --bg-soft: #112A4D; --bg-warm: #163A68; --surface: #112A4D;
  --fg: #F3EFE6; --fg-2: #D4C9A8; --muted: #8CA3C6;
  --line: #1E3761; --line-strong: #294877;
  --accent: #E6C76E; --accent-ink: #FFD886; --accent-soft: #2A2110;
  --up: #D4AF37; --up-soft: #163A2A; --down: #F2978F; --down-soft: #3A1A17;
  --band: #061531; --band-fg: #F3EFE6; --band-muted: #8CA3C6; --band-accent: #D4AF37;
  --grad-hero: linear-gradient(135deg, #0F4C81 0%, #2F86C7 70%, #D4AF37 150%);
  --grad-side: linear-gradient(135deg, #0B1F3B 0%, #0F4C81 60%, #2F86C7 110%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  color-scheme: light dark;
}
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 16px; line-height: 1.65; min-height: 100dvh; }

/* Skip link (الوصول إلى المحتوى الرئيسي بالكيبورد) */
.skip-link {
  position: absolute; inset-inline-start: 50%; top: 8px; transform: translateX(50%);
  background: var(--navy-900); color: var(--cream);
  padding: 10px 18px; border-radius: 999px;
  font-weight: 600; font-size: 14px; text-decoration: none;
  z-index: 100; opacity: 0; pointer-events: none;
}
html[dir="ltr"] .skip-link { transform: translateX(-50%); }
.skip-link:focus-visible { opacity: 1; pointer-events: auto; outline: 2px solid var(--gold); outline-offset: 2px; }

a { color: var(--accent-ink); text-decoration: none; }
@media (hover: hover) and (pointer: fine) {
  a:hover { text-decoration: underline; }
}
h1, h2, h3 { margin: 0; line-height: 1.3; font-family: var(--font-head); font-weight: 600; letter-spacing: 0.005em; text-wrap: balance; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
p { margin: 0; text-wrap: pretty; }
img { max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 16px; text-align: start; }
th { background: var(--bg-soft); font-weight: 500; font-family: var(--font-head); font-size: 13px; color: var(--muted); letter-spacing: 0.03em; }
tbody tr { border-top: 1px solid var(--line); }
tr.hl { background: var(--accent-soft); }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
main.wrap { padding-block: 24px 64px; display: flex; flex-direction: column; gap: 36px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.row > .grow { flex: 999 1 520px; min-width: 0; }
.row > .side { flex: 1 1 300px; min-width: 0; }
.between { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid-wide { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
/* روابط النصوص الصغيرة في الـ headers تحتاج هدف لمس 24 بكسل حسب WCAG */
a.small, .small > a, .between > a { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 8px; margin-inline: -8px; border-radius: 6px; touch-action: manipulation; }
@media (hover: hover) and (pointer: fine) { a.small:hover, .small > a:hover, .between > a:hover { background: var(--bg-soft); } }
.lead { font-size: 17px; color: var(--fg-2); }
.scroll { overflow-x: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.scroll table { min-width: 560px; }

/* ======== Site header ======== */
.site-header { background: var(--bg); padding-top: 4px; }
.site-header .wrap { padding-block: 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); font-size: 19px; font-weight: 600; font-family: var(--font); }
@media (hover: hover) and (pointer: fine) { .brand:hover { text-decoration: none; } }
/* Approved Gold Price lockup, B · PIVOT: [place | Gold Price] mark [أسعار الذهب | المكان] (colors fixed by the logo spec) */
.brand { --logo-mark: #142B4A; --logo-g1: #142B4A; --logo-g2: #4A72AD; --logo-loc: #4A72AD; direction: ltr; gap: 10px; font-size: 22px; }
.brand-pivot { gap: .5em; white-space: nowrap; min-height: 44px; }
.brand-logo-mark { height: .95em; width: auto; flex-shrink: 0; fill: var(--logo-mark); display: block; }
.bp-side { display: inline-flex; align-items: baseline; gap: .34em; }
.bp-en { direction: ltr; } .bp-ar { direction: rtl; }
.bp-word, .bp-word-ar { -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: var(--logo-g1); white-space: nowrap; font-size: .9em; }
.bp-word { font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif; font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; background-image: linear-gradient(90deg, var(--logo-g1), var(--logo-g2)); }
.bp-word-ar { font-family: 'Cairo', var(--font); font-weight: 700; line-height: 1.5; padding-top: .12em; background-image: linear-gradient(270deg, var(--logo-g1), var(--logo-g2)); }
.bp-bar { align-self: stretch; width: .045em; min-width: 1.5px; background: var(--logo-loc); opacity: .55; margin-block: .14em .06em; border-radius: 2px; }
.bp-place { font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif; font-weight: 500; font-size: .46em; letter-spacing: .12em; text-transform: uppercase; color: var(--logo-loc); line-height: 1.3; align-self: center; }
.bp-place-ar { font-family: 'Cairo', var(--font); font-weight: 600; font-size: .62em; color: var(--logo-loc); line-height: 1.5; padding-top: .1em; }
:root[data-theme="dark"] .brand { --logo-mark: #EAF1FC; --logo-g1: #EAF1FC; --logo-g2: #8FB4E8; --logo-loc: #8FB4E8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand { --logo-mark: #EAF1FC; --logo-g1: #EAF1FC; --logo-g2: #8FB4E8; --logo-loc: #8FB4E8; } }
@media (max-width: 1100px) { .brand { font-size: 19px; } }
@media (max-width: 640px) { .brand { font-size: clamp(14px, 4.2vw, 18px); } .site-header .brand { order: 0; } }

/* nav-pill: الـ pill nav الجديد */
.nav-pill {
  display: flex; gap: 2px; padding: 5px;
  background: var(--surface); border-radius: 999px;
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(11, 31, 59, 0.04);
}
.nav-pill a {
  padding: 9px 18px; border-radius: 999px;
  text-decoration: none; color: var(--fg-2);
  font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center; min-height: 36px;
  touch-action: manipulation;
}
@media (hover: hover) and (pointer: fine) {
  .nav-pill a:hover { background: var(--bg-soft); color: var(--fg); text-decoration: none; }
}
.nav-pill a:active { background: var(--bg-soft); }
.nav-pill a.on { background: var(--navy-900); color: var(--cream); font-weight: 600; }
:root[data-theme="dark"] .nav-pill a.on, :root:not([data-theme="light"]) .nav-pill a.on { background: var(--gold); color: var(--navy-900); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav-pill a.on { background: var(--gold); color: var(--navy-900); }
}

.site-ctl { display: flex; align-items: center; gap: 8px; }
.site-ctl .lang {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--fg-2); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; font-family: var(--font-num); font-size: 14px;
  touch-action: manipulation;
}
.site-ctl .lang:active { background: var(--bg-soft); }

/* ======== Ticker ======== */
.ticker-wrap { padding: 0 20px; }
.ticker {
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 4px; overflow: hidden; position: relative;
}
.ticker::before, .ticker::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 60px; z-index: 2; pointer-events: none;
}
html[dir="rtl"] .ticker::before { inset-inline-start: 0; background: linear-gradient(270deg, var(--surface), transparent); }
html[dir="rtl"] .ticker::after  { inset-inline-end: 0;  background: linear-gradient(90deg, var(--surface), transparent); }
html[dir="ltr"] .ticker::before { inset-inline-start: 0; background: linear-gradient(90deg, var(--surface), transparent); }
html[dir="ltr"] .ticker::after  { inset-inline-end: 0;  background: linear-gradient(270deg, var(--surface), transparent); }
.ticker .track {
  display: flex; gap: 40px; width: max-content; white-space: nowrap;
  animation: gp-tick 40s linear infinite; padding-inline: 24px;
}
.ticker .track:hover { animation-play-state: paused; }
@keyframes gp-tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }
html[dir="rtl"] .ticker .track { animation-name: gp-tick-rtl; }
@keyframes gp-tick-rtl { from { transform: translateX(0); } to { transform: translateX(50%); } }
@media (prefers-reduced-motion: reduce) { .ticker .track { animation: none; width: auto; flex-wrap: wrap; } .ticker .track .dup { display: none; } }
.ticker span.item { display: inline-flex; gap: 8px; align-items: baseline; white-space: nowrap; padding: 2px 10px; font-size: 14px; }
.ticker .k { color: var(--navy-700); font-weight: 500; }
.ticker .v { font-family: var(--font-num); font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums; }
.ticker .chg { font-family: var(--font-num); font-size: 13px; font-weight: 600; }
.ticker .chg.up { color: #0D7A42; }
.ticker .chg.down { color: #C53030; }
.ticker .chg.flat { color: var(--muted); }
:root[data-theme="dark"] .ticker .chg.up, :root:not([data-theme="light"]) .ticker .chg.up { color: #4FDA87; }
:root[data-theme="dark"] .ticker .chg.down, :root:not([data-theme="light"]) .ticker .chg.down { color: #FF8080; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ticker .chg.up { color: #4FDA87; }
  :root:not([data-theme="light"]) .ticker .chg.down { color: #FF8080; }
}
:root[data-theme="dark"] .ticker .k, :root:not([data-theme="light"]) .ticker .k { color: var(--gold); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ticker .k { color: var(--gold); }
}

/* Breadcrumb */
.crumbs { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; font-family: var(--font); align-items: center; }
.crumbs a { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 8px; margin-inline: -8px; border-radius: 6px; touch-action: manipulation; }
@media (hover: hover) and (pointer: fine) { .crumbs a:hover { background: var(--bg-soft); } }
/* روابط النص داخل الجداول (مثل روابط العيارات) تحتاج هدف لمس أيضًا */
td a, tbody a { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 4px; margin-inline: -4px; touch-action: manipulation; }

/* ======== Cards and tiles ======== */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl);
  padding: 28px; display: flex; flex-direction: column; gap: 20px; min-width: 0;
  box-shadow: 0 1px 2px rgba(11, 31, 59, 0.04);
}
.card-sm { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* البطاقة الرئيسية في الهيرو تأخذ التدرج الكحلي */
.row > .card.grow {
  background: var(--grad-hero);
  color: var(--cream);
  border: 0;
  box-shadow: 0 4px 24px rgba(11, 31, 59, 0.18);
  position: relative; overflow: hidden;
}
.row > .card.grow h1,
.row > .card.grow h2 { color: var(--cream); }
.row > .card.grow .muted,
.row > .card.grow .small.muted { color: rgba(243, 239, 230, 0.75); }
.row > .card.grow a { color: var(--gold); }
.row > .card.grow .badge { background: rgba(243, 239, 230, 0.14); color: var(--cream); backdrop-filter: blur(10px); border: 1px solid rgba(243, 239, 230, 0.2); }
.row > .card.grow .tile { background: rgba(0, 0, 0, 0.18); backdrop-filter: blur(10px); border: 1px solid rgba(243, 239, 230, 0.12); }
.row > .card.grow .tile .k { color: rgba(243, 239, 230, 0.72); }
.row > .card.grow .tile .v { color: var(--cream); }
.row > .card.grow .tile.hl { background: var(--grad-hl); border-color: transparent; }
.row > .card.grow .tile.hl .k { color: var(--navy-900); font-weight: 600; }
.row > .card.grow .tile.hl .v { color: var(--navy-900); }
.row > .card.grow .callout { background: rgba(0, 0, 0, 0.2); border-inline-start: 3px solid var(--gold); color: rgba(243, 239, 230, 0.9); backdrop-filter: blur(10px); }
.row > .card.grow .callout b { color: var(--cream); }

.card-warm { background: var(--bg-warm); border-color: var(--accent-soft); }
.card-dark { background: var(--band); color: var(--band-fg); border-color: var(--band); }
.card-dark p { color: var(--band-muted); }

.tile { background: var(--bg-soft); border-radius: var(--radius); padding: 14px 16px; min-width: 0; border: 1px solid var(--line); }
.tile.hl { background: var(--grad-hl); border-color: transparent; }
.tile.hl .k { color: var(--navy-900); font-weight: 600; }
.tile.hl .v { color: var(--navy-900); }
.tile .k { font-size: 13px; color: var(--muted); font-weight: 500; }
.tile .v { font-size: 18px; font-weight: 600; font-family: var(--font-num); font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile .v.big { font-size: 24px; font-weight: 700; }

.big-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 16px; }
.big-price .n { font-size: 64px; font-weight: 700; line-height: 1.05; font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.big-price .u { font-size: 20px; color: rgba(243, 239, 230, 0.75); }
.row > .card.grow .big-price .u { color: rgba(243, 239, 230, 0.75); }
@media (max-width: 560px) { .big-price .n { font-size: 48px; } }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px; border-radius: 999px; font-size: 15px; font-weight: 600; font-family: var(--font-num); }
.pill.up { background: var(--gold); color: var(--navy-900); }
.pill.down { background: rgba(243, 239, 230, 0.14); color: var(--cream); backdrop-filter: blur(10px); }
.pill.flat { background: rgba(243, 239, 230, 0.14); color: var(--cream); backdrop-filter: blur(10px); }
/* pills خارج hero card تاخذ ألوان النهاري */
.card:not(.grow) .pill.up, section:not(.row) .pill.up { background: var(--up-soft); color: var(--up); }
.card:not(.grow) .pill.down, section:not(.row) .pill.down { background: var(--down-soft); color: var(--down); }
.card:not(.grow) .pill.flat, section:not(.row) .pill.flat { background: var(--bg-soft); color: var(--muted); }

.badge { font-size: 13px; background: var(--bg-soft); color: var(--muted); border-radius: 999px; padding: 6px 12px; font-weight: 500; }
.chip { font-size: 12px; background: var(--bg-soft); color: var(--muted); border-radius: 6px; padding: 2px 8px; }
.callout { background: var(--bg-warm); border-inline-start: 3px solid var(--accent); padding: 14px 18px; color: var(--fg-2); font-size: 15px; border-radius: var(--radius); }
.quote { background: var(--bg-soft); border-inline-start: 3px solid var(--accent); padding: 16px 20px; color: var(--fg-2); border-radius: var(--radius); }

.link-card { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; text-decoration: none; color: var(--fg); min-width: 0; background: var(--surface); touch-action: manipulation; transition: border-color .15s, transform .1s; }
@media (hover: hover) and (pointer: fine) { .link-card:hover { border-color: var(--navy-400); text-decoration: none; } }
.link-card:active { transform: scale(.99); }
.link-card .t { font-size: 17px; font-weight: 600; font-family: var(--font-head); }
.link-card .d { font-size: 14px; color: var(--muted); }

.link-row { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; text-decoration: none; color: var(--fg); gap: 12px; background: var(--surface); touch-action: manipulation; transition: border-color .15s, transform .1s; }
@media (hover: hover) and (pointer: fine) { .link-row:hover { text-decoration: none; border-color: var(--navy-400); } }
.link-row:active { transform: scale(.99); }

/* ======== Buttons and forms ======== */
.btn {
  font: inherit; font-weight: 500; min-height: 44px; padding: 10px 20px;
  border-radius: 999px; border: 1px solid var(--navy-900); background: var(--navy-900); color: var(--cream);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform .1s ease-out, opacity .15s;
}
@media (hover: hover) and (pointer: fine) { .btn:hover { text-decoration: none; opacity: .92; } }
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--surface); color: var(--fg); border-color: var(--line-strong); }
.btn.green { background: var(--whatsapp); border-color: var(--whatsapp); color: #FFFFFF; }
.btn.outline-green { background: transparent; border-color: var(--up); color: var(--up); }
.btn.sm { min-height: 36px; padding: 4px 14px; font-size: 13px; font-weight: 500; }
.btn.light { background: var(--surface); color: var(--fg); border-color: var(--line-strong); }
@media (hover: hover) and (pointer: fine) { .btn.light:hover { background: var(--bg-soft); } }
.btn.light:active { background: var(--bg-soft); }

/* hero card buttons: gold accent */
.row > .card.grow .btn { background: var(--gold); color: var(--navy-900); border-color: var(--gold); }
.row > .card.grow .btn.outline-green { background: transparent; color: var(--cream); border-color: rgba(243, 239, 230, 0.4); }
.row > .card.grow .btn.ghost { background: rgba(243, 239, 230, 0.14); color: var(--cream); border-color: rgba(243, 239, 230, 0.3); }

/* dark subscribe card buttons */
.card.card-dark .btn.ghost { background: rgba(243, 239, 230, 0.14); color: var(--cream); border-color: rgba(243, 239, 230, 0.3); }
.card.card-dark .btn.ghost:hover { background: rgba(243, 239, 230, 0.22); color: var(--cream); }
.card.card-dark .btn { background: var(--gold); color: var(--navy-900); border-color: var(--gold); }
.card.card-dark .btn.green { background: var(--whatsapp); color: #FFFFFF; border-color: var(--whatsapp); }

label.f { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; min-width: 0; color: var(--fg-2); }
input, select, textarea {
  font: inherit; font-size: 16px; min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--fg); width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--navy-400); outline: 2px solid rgba(47, 134, 199, 0.2); outline-offset: 0; }
fieldset { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: var(--fg-2); }

.seg { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); padding: 4px; background: var(--bg-soft); border-radius: var(--radius); }
.seg button {
  font: inherit; min-height: 44px; padding: 6px 8px; border-radius: 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; line-height: 1.2;
  background: transparent; color: var(--fg-2); border: 0;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.seg button .s { font-size: 12px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); font-weight: 600; box-shadow: 0 1px 3px rgba(11, 31, 59, 0.1); }

.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.form-grid .full { grid-column: 1 / -1; }

.result { background: var(--bg-warm); border: 1px solid var(--accent-soft); border-radius: var(--radius-lg); padding: 18px 22px; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.result .k { font-size: 13px; color: var(--muted); font-weight: 500; }
.result .v { font-size: 18px; font-weight: 600; font-family: var(--font-num); font-variant-numeric: tabular-nums; margin-top: 2px; }
.result .v.hero { font-size: 26px; font-weight: 700; color: var(--navy-700); }
.err { color: var(--down); font-size: 13px; font-weight: 500; }

/* FAQ */
details { border-bottom: 1px solid var(--line); padding: 18px 22px; }
details:last-child { border-bottom: 0; }
summary { font-weight: 600; cursor: pointer; font-size: 16px; font-family: var(--font-head); min-height: 28px; }
details p { margin-top: 10px; color: var(--fg-2); font-size: 15px; }
.faq { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }

/* Range bar in yearly table */
.bar { display: block; height: 8px; border-radius: 4px; background: var(--bg-soft); position: relative; min-width: 120px; }
.bar i { position: absolute; top: 0; height: 8px; border-radius: 4px; background: var(--gold); }

/* Charts */
.chart-box { position: relative; width: 100%; min-height: 320px; background: var(--surface); border-radius: var(--radius); padding: 12px; }
.chart-box canvas { width: 100% !important; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 14px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 6px; }
.row > .card.grow .chart-box { background: rgba(243, 239, 230, 0.96); backdrop-filter: blur(10px); color: var(--navy-900); }
.row > .card.grow .legend { color: var(--navy-900); }
.row > .card.grow .legend .sw { outline: 1px solid rgba(11, 31, 59, 0.15); }

/* Article / guide body */
.prose { max-width: 760px; font-size: 17px; }
.prose h2 { font-size: 22px; margin-top: 20px; }
.prose h3 { font-size: 18px; margin-top: 12px; }
.prose p, .prose ul, .prose ol { margin: 0 0 18px; }
.prose li { margin-bottom: 4px; }
.prose table { font-size: 15px; margin-bottom: 18px; }
.prose blockquote { margin: 0 0 18px; }
.meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--muted); padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-family: var(--font); }

/* ======== Footer ======== */
.site-footer { background: var(--navy-900); color: var(--cream); border-top: 1px solid var(--line); margin-top: 48px; }
.site-footer .wrap { padding-block: 40px; display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.site-footer .col { display: flex; flex-direction: column; gap: 10px; }
.site-footer .col b { font-weight: 600; color: var(--gold); font-size: 14px; font-family: var(--font-head); letter-spacing: 0.04em; }
.site-footer a { font-size: 14px; text-decoration: none; color: rgba(243, 239, 230, 0.78); display: inline-flex; align-items: center; min-height: 28px; padding: 2px 0; touch-action: manipulation; }
.site-footer a:hover { color: var(--cream); text-decoration: underline; }
.site-footer .legal { grid-column: 1 / -1; border-top: 1px solid rgba(243, 239, 230, 0.15); padding-top: 18px; font-size: 12px; color: rgba(243, 239, 230, 0.6); display: flex; flex-direction: column; gap: 6px; font-family: var(--font); }

/* ======== Theme toggle ======== */
.theme-btn {
  font: inherit; min-height: 42px; min-width: 42px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg-2); cursor: pointer;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-btn:active { background: var(--bg-soft); }
.theme-btn .icon { display: block; }
.theme-btn .icon-moon { display: none; }
:root[data-theme="dark"] .theme-btn .icon-sun { display: none; }
:root[data-theme="dark"] .theme-btn .icon-moon { display: block; color: var(--gold); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .icon-moon { display: block; color: var(--gold); }
}

/* ======== Mobile scroll containers keep their own bounce ======== */
.scroll { overscroll-behavior: contain; }

/* ======== Prevent iOS from zooming into number fields ======== */
@media (pointer: coarse) {
  input[type="number"], input[type="text"], input[type="email"], input[type="tel"], select { font-size: 16px; }
}

/* ======== Sticky aside on desktop ======== */
@media (min-width: 900px) { .sticky { position: sticky; top: 16px; } }
@media (prefers-reduced-motion: no-preference) { .chg { transition: color .2s; } }

/* Global change colors (tables, tiles, mini stats): اخضر صعود، احمر هبوط */
.chg.up { color: #0D7A42; font-weight: 600; }
.chg.down { color: #C53030; font-weight: 600; }
.chg.flat { color: var(--muted); }
:root[data-theme="dark"] .chg.up { color: #4FDA87; }
:root[data-theme="dark"] .chg.down { color: #FF8080; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chg.up { color: #4FDA87; }
  :root:not([data-theme="light"]) .chg.down { color: #FF8080; }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ======== PWA install section (replaces old alert_form + subscribe_band) ======== */
.pwa-section {
  background: var(--grad-hero); color: var(--cream);
  border-radius: var(--radius-xl); padding: 36px;
  display: flex; flex-direction: column; gap: 28px;
  box-shadow: 0 4px 24px rgba(11, 31, 59, 0.18);
  position: relative; overflow: hidden;
}
.pwa-section h2 { color: var(--cream); font-size: 26px; }
.pwa-section .lead { color: rgba(243, 239, 230, 0.9); font-size: 16px; max-width: 68ch; }
.pwa-section .pwa-eyebrow {
  font-family: var(--font); font-size: 12px; letter-spacing: 0.04em;
  color: var(--gold); font-weight: 700;
}
.pwa-benefits { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.pwa-benefit {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; background: rgba(243, 239, 230, 0.12);
  border: 1px solid rgba(243, 239, 230, 0.2); border-radius: 999px;
  font-size: 13px; font-weight: 500; backdrop-filter: blur(10px);
}
.pwa-benefit svg { color: var(--gold); }

.pwa-steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.pwa-step-card {
  background: rgba(243, 239, 230, 0.08); border: 1px solid rgba(243, 239, 230, 0.18);
  border-radius: var(--radius-lg); padding: 20px 22px;
  display: flex; flex-direction: column; gap: 12px;
  backdrop-filter: blur(10px);
}
.pwa-step-head { display: flex; align-items: center; gap: 10px; }
.pwa-step-head svg { color: var(--gold); flex-shrink: 0; }
.pwa-step-head h3 { color: var(--cream); font-size: 16px; margin: 0; }
.pwa-step-list {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 10px;
  counter-reset: pwa-step;
}
.pwa-step-list li {
  counter-increment: pwa-step;
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: rgba(243, 239, 230, 0.92);
}
.pwa-step-list li::before {
  content: counter(pwa-step);
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--gold); color: var(--navy-900);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-num); font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.pwa-icon-inline { color: var(--gold); margin-inline-start: 4px; vertical-align: middle; }
.pwa-step-card .tiny.muted { color: rgba(243, 239, 230, 0.6); margin-top: auto; }

.pwa-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pwa-actions .btn { background: var(--gold); color: var(--navy-900); border-color: var(--gold); }
.pwa-actions .btn.ghost {
  background: rgba(243, 239, 230, 0.14); color: var(--cream);
  border-color: rgba(243, 239, 230, 0.3); backdrop-filter: blur(10px);
}
.pwa-actions .btn.outline-green {
  background: var(--whatsapp); color: #FFFFFF; border-color: var(--whatsapp);
}
.pwa-installed-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; background: rgba(13, 159, 79, 0.2);
  border: 1px solid rgba(79, 198, 139, 0.5); border-radius: 999px;
  color: #AEEBC4; font-weight: 600; font-size: 14px;
}
.pwa-installed-badge svg { color: #AEEBC4; }

.pwa-foot { border-top: 1px dashed rgba(243, 239, 230, 0.2); padding-top: 20px; }
.pwa-manage-link {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--gold); font-weight: 600; font-size: 14px;
  text-decoration: none; min-height: 28px;
}
.pwa-manage-link:hover { text-decoration: underline; color: var(--cream); }
.pwa-manage-link svg { flex-shrink: 0; }
.pwa-manage-link .arrow-end { opacity: 0.7; }
html[dir="rtl"] .pwa-manage-link .arrow-end { transform: scaleX(-1); }

@media (max-width: 640px) {
  .pwa-section { padding: 24px 22px; gap: 22px; }
  .pwa-section h2 { font-size: 22px; }
  .pwa-section .lead { font-size: 15px; }
}

/* ======== Charts page CTA to alerts ======== */
.alerts-cta {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 22px 26px; background: var(--grad-side); color: var(--cream);
  border-radius: var(--radius-xl); margin-top: 8px;
}
.alerts-cta-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(243, 239, 230, 0.14); color: var(--gold);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.alerts-cta-body { flex: 999 1 360px; min-width: 0; }
.alerts-cta-body h3 { color: var(--cream); font-size: 18px; margin: 0 0 4px; }
.alerts-cta-body .small { color: rgba(243, 239, 230, 0.85); margin: 0; }
.alerts-cta-btn { background: var(--gold); color: var(--navy-900); border-color: var(--gold); flex-shrink: 0; }
html[dir="rtl"] .alerts-cta-btn svg { transform: scaleX(-1); }

/* ======== Alerts page specific ======== */
.alerts-status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 16px; }
.status-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--bg-soft); border-radius: var(--radius);
  border: 1px solid var(--line);
}
.status-item svg { color: var(--muted); flex-shrink: 0; }
.status-item .num { font-family: var(--font-num); font-size: 18px; font-weight: 600; color: var(--fg); }
.status-item[data-ok="1"] { background: rgba(13, 159, 79, 0.08); border-color: rgba(13, 159, 79, 0.3); }
.status-item[data-ok="1"] svg { color: var(--up); }
.status-item[data-ok="0"] { background: var(--down-soft); border-color: rgba(178, 42, 42, 0.3); }
.status-item[data-ok="0"] svg { color: var(--down); }

.alerts-list { display: flex; flex-direction: column; gap: 10px; }
.alerts-list .alert-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.alerts-list .alert-row.triggered { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); border-color: var(--gold); }
.alert-row .asset { font-family: var(--font-head); font-weight: 600; color: var(--fg); }
.alert-row .cond { color: var(--muted); font-size: 14px; }
.alert-row .target { font-family: var(--font-num); font-weight: 700; color: var(--navy-700); font-size: 18px; }
.alert-row .state { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; font-size: 13px; }
.alert-row .state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.alert-row.triggered .state .dot { background: var(--gold); animation: gpPulse 2s infinite; }
.alert-row.armed .state .dot { background: var(--up); }
.alert-row .del-btn {
  background: transparent; border: 1px solid var(--line-strong); color: var(--muted);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.alert-row .del-btn:hover { color: var(--down); border-color: var(--down); }
.alerts-empty { text-align: center; padding: 20px; }
.alerts-list:not(:empty) + .alerts-empty { display: none; }

/* ======== Mini stats + distribution bar (hero sidebar chart) ======== */
.mini-stats { display: flex; flex-direction: column; gap: 10px; }
.mini-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-pill {
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 4px 11px; border-radius: 999px;
  font-family: var(--font-num); font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.mini-pill .k { font-family: var(--font); font-weight: 500; font-size: 11px; opacity: 0.75; }
.mini-pill.now { background: var(--gold); color: var(--navy-900); }
.mini-pill.ath { background: var(--surface); color: var(--navy-900); border: 1px solid var(--gold); }
.mini-pill.atl { background: var(--up-soft); color: var(--navy-900); }

/* شريط التوزيع */
.dist-bar {
  height: 10px; border-radius: 999px; position: relative; margin-top: 2px;
  background: linear-gradient(90deg, var(--up-soft) 0%, var(--accent-soft) 50%, var(--up-soft) 100%);
  overflow: visible;
}
html[dir="rtl"] .dist-bar { background: linear-gradient(270deg, var(--up-soft) 0%, var(--accent-soft) 50%, var(--up-soft) 100%); }
.dist-marker {
  position: absolute; top: 50%; width: 18px; height: 18px;
  border-radius: 50%; background: var(--gold); border: 3px solid var(--surface);
  box-shadow: 0 1px 4px rgba(11, 31, 59, 0.3);
  transform: translate(50%, -50%);
  transition: inset-inline-start 0.4s ease-out;
}
html[dir="ltr"] .dist-marker { transform: translate(-50%, -50%); }
.dist-note { margin: 0; font-size: 13px; }
.dist-note b { color: var(--fg); font-weight: 600; font-family: var(--font-num); }

/* داخل الكرت المتدرج الكحلي: ألوان متكيفة */
.row > .card.grow .mini-pill.now { background: var(--gold); color: var(--navy-900); }
.row > .card.grow .mini-pill.ath { background: rgba(243, 239, 230, 0.12); color: var(--cream); border-color: var(--gold); backdrop-filter: blur(10px); }
.row > .card.grow .mini-pill.ath .k { color: var(--gold); opacity: 1; }
.row > .card.grow .mini-pill.atl { background: rgba(47, 134, 199, 0.25); color: var(--cream); backdrop-filter: blur(10px); }
.row > .card.grow .mini-pill.atl .k { color: var(--cream); opacity: 0.75; }
.row > .card.grow .dist-bar {
  background: linear-gradient(90deg, rgba(47, 134, 199, 0.3) 0%, rgba(212, 175, 55, 0.5) 50%, rgba(47, 134, 199, 0.3) 100%);
}
html[dir="rtl"] .row > .card.grow .dist-bar {
  background: linear-gradient(270deg, rgba(47, 134, 199, 0.3) 0%, rgba(212, 175, 55, 0.5) 50%, rgba(47, 134, 199, 0.3) 100%);
}
.row > .card.grow .dist-marker { border-color: var(--navy-900); background: var(--gold); }
.row > .card.grow .dist-note { color: rgba(243, 239, 230, 0.85); }
.row > .card.grow .dist-note b { color: var(--cream); }

/* ======== News strip (top of home) ======== */
.news-strip { display: flex; flex-direction: column; gap: 10px; }
.news-strip .news-h { font-size: 20px; font-family: var(--font-head); font-weight: 600; display: inline-flex; align-items: center; gap: 10px; }
.news-strip .news-h::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: gpPulse 2s infinite; }
.news-strip .news-all { color: var(--accent-ink); font-weight: 500; text-decoration: none; }
.news-strip .news-all:hover { text-decoration: underline; }
.news-strip .news-intro { margin: 0 0 6px; }
.news-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.news-item {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 20px 22px;
  text-decoration: none; color: var(--fg); min-width: 0;
  touch-action: manipulation; transition: border-color .15s, transform .1s;
  position: relative;
}
.news-item::before {
  content: ''; position: absolute; top: 0; inset-inline-start: 20px;
  width: 36px; height: 3px; background: var(--gold); border-radius: 0 0 2px 2px;
}
@media (hover: hover) and (pointer: fine) {
  .news-item:hover { border-color: var(--navy-400); text-decoration: none; }
}
.news-item:active { transform: scale(.99); }
.news-item .news-tag {
  font-family: var(--font); font-size: 11px; letter-spacing: 0.04em;
  color: var(--navy-700); background: var(--up-soft);
  padding: 3px 10px; border-radius: 999px; align-self: flex-start;
  font-weight: 700;
}
.news-item .news-t { font-size: 16px; font-weight: 700; line-height: 1.4; color: var(--fg); font-family: var(--font); margin: 0; }
.news-item .news-d { font-size: 14px; color: var(--muted); line-height: 1.6; margin: 0; flex: 1; font-family: var(--font); }
.news-item .news-meta { font-family: var(--font); font-size: 12px; color: var(--muted); margin-top: 4px; }

@media (max-width: 820px) { .news-grid { grid-template-columns: 1fr; } }

/* ======== pulse animation للنقطة الحية ======== */
@keyframes gpPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.3); } }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: gpPulse 2s infinite; margin-inline-end: 6px; vertical-align: middle; }

/* ======== Small mobile adjustments ======== */
@media (max-width: 640px) {
  main.wrap { gap: 24px; padding-block: 16px 40px; }
  .card { padding: 22px 20px; }
  .nav-pill { padding: 4px; gap: 2px; }
  .nav-pill a { padding: 8px 14px; font-size: 13px; }
  .site-ctl .lang { width: 38px; height: 38px; }
  .theme-btn { min-height: 38px; min-width: 38px; }
  h1 { font-size: 22px; }
  h2 { font-size: 18px; }
}

/* hero status chip: gold tint so the live/as-of line stands out on the navy card */
.live-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: #F0D57A; background: rgba(212, 175, 55, 0.16); border: 1px solid rgba(212, 175, 55, 0.5); border-radius: 999px; padding: 6px 12px; }
.live-chip [data-p] { color: #FFF4CC; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #D4AF37; box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.6); animation: gp-live 2s ease-out infinite; flex-shrink: 0; }
@keyframes gp-live { 0% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.6); } 70% { box-shadow: 0 0 0 7px rgba(212, 175, 55, 0); } 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
