/* Findit insights — glass over the brand's circle field, dark or light.
   Chart colours were run through the dataviz validator against each
   theme's glass surface (dark #122034, light #F5F8FC): --series-1 and
   --series-2 pass every check in both. The brand cyan (#00C2FF) is outside
   the data lightness band in either theme, so it is kept for UI accents.
   Layout uses logical properties, so the same rules serve Arabic (RTL) and
   English (LTR). */
@font-face { font-family: Plex; font-weight: 400; src: url(fonts/IBMPlexSansArabic-Regular.ttf); font-display: swap; }
@font-face { font-family: Plex; font-weight: 500; src: url(fonts/IBMPlexSansArabic-Medium.ttf); font-display: swap; }
@font-face { font-family: Plex; font-weight: 600; src: url(fonts/IBMPlexSansArabic-SemiBold.ttf); font-display: swap; }
@font-face { font-family: Plex; font-weight: 700; src: url(fonts/IBMPlexSansArabic-Bold.ttf); font-display: swap; }
@font-face { font-family: Inter; font-weight: 100 900; src: url(fonts/Inter.ttf); font-display: swap; }

:root {
  color-scheme: dark;
  --page: #07111F;
  --glass: rgba(18, 32, 52, 0.55);
  --glass-strong: rgba(18, 32, 52, 0.82);
  --glass-edge: rgba(255, 255, 255, 0.10);
  --glass-hi: rgba(255, 255, 255, 0.06);
  --glass-shadow: 0 20px 50px rgba(0, 0, 0, .28);
  --surface: #122034;
  --text-primary: #F0F4FA;
  --text-secondary: #B6C3D6;
  --text-muted: #8796AD;
  --grid: rgba(255, 255, 255, 0.07);
  --axis: rgba(255, 255, 255, 0.18);
  --crosshair: rgba(255, 255, 255, 0.35);
  --spark: rgba(182, 195, 214, 0.55);
  --db-link: rgba(255, 255, 255, 0.25);
  --wash: rgba(255, 255, 255, 0.035);
  --wash-edge: rgba(255, 255, 255, 0.05);
  --hover: rgba(255, 255, 255, 0.06);
  --pressed: rgba(255, 255, 255, 0.10);
  --chip: rgba(255, 255, 255, 0.07);
  --row-line: rgba(255, 255, 255, 0.04);
  --input: rgba(7, 17, 31, 0.55);
  --accent: #00C2FF;
  --accent-ink: #07111F;
  --series-1: #0B9AD3;
  --series-2: #d95926;
  --meter-track: rgba(11, 154, 211, 0.18);
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --delta-good: #0ca30c;
  --delta-bad: #ff8a8a;
  --critical-ink: #ff9b9b;
  --serious-ink: #ffb592;
  --warning-ink: #ffd477;
  --good-ink: #7fe07f;
  --banner-bg: rgba(250, 178, 25, 0.12);
  --banner-edge: rgba(250, 178, 25, 0.35);
  --banner-ink: #FFE2A6;
  --scene-1: #0E7FBF; --scene-2: #27456C; --scene-3: #00C2FF; --scene-4: #3C6E9E;
  --scene-veil: rgba(7, 17, 31, 0.55);
  --radius: 22px;
  --blur: blur(26px) saturate(150%);
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #E9EFF6;
  --glass: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(255, 255, 255, 0.92);
  --glass-edge: rgba(15, 35, 60, 0.10);
  --glass-hi: rgba(255, 255, 255, 0.75);
  --glass-shadow: 0 18px 44px rgba(30, 60, 100, .12);
  --surface: #F5F8FC;
  --text-primary: #0B1726;
  --text-secondary: #42546B;
  --text-muted: #66778D;
  --grid: rgba(11, 23, 38, 0.08);
  --axis: rgba(11, 23, 38, 0.22);
  --crosshair: rgba(11, 23, 38, 0.35);
  --spark: rgba(66, 84, 107, 0.45);
  --db-link: rgba(11, 23, 38, 0.22);
  --wash: rgba(255, 255, 255, 0.55);
  --wash-edge: rgba(15, 35, 60, 0.06);
  --hover: rgba(11, 23, 38, 0.05);
  --pressed: rgba(11, 23, 38, 0.08);
  --chip: rgba(11, 23, 38, 0.06);
  --row-line: rgba(11, 23, 38, 0.06);
  --input: rgba(255, 255, 255, 0.85);
  --series-1: #0A7FB8;
  --series-2: #e0602c;
  --meter-track: rgba(10, 127, 184, 0.16);
  --delta-good: #006300;
  --delta-bad: #b42323;
  --critical-ink: #a82323;
  --serious-ink: #a8481f;
  --warning-ink: #7a5300;
  --good-ink: #0a6b0a;
  --banner-bg: rgba(250, 178, 25, 0.16);
  --banner-edge: rgba(200, 140, 0, 0.35);
  --banner-ink: #6b4a00;
  --scene-1: #8CCDF2; --scene-2: #C3D4EA; --scene-3: #00C2FF; --scene-4: #A9C2E0;
  --scene-veil: rgba(233, 239, 246, 0.35);
}

* { box-sizing: border-box; margin: 0; }
html, body { min-height: 100%; }
body {
  background: var(--page);
  color: var(--text-primary);
  font: 400 15px/1.6 Plex, system-ui, sans-serif;
  overflow-x: hidden;
  transition: background-color .3s ease;
}
:root[lang="en"] body { font-family: Inter, Plex, system-ui, sans-serif; }
button, input { font: inherit; color: inherit; }
.num, .tabular { font-family: Inter, Plex, system-ui, sans-serif; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---- The scene behind the glass: the logo's circles, out of focus. ---- */
.scene { position: fixed; inset: -10vmax; z-index: 0; pointer-events: none; overflow: hidden; }
.scene i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; }
.scene i:nth-child(1) { width: 38vmax; height: 38vmax; background: var(--scene-1); top: -4vmax; right: 2vmax; }
.scene i:nth-child(2) { width: 30vmax; height: 30vmax; background: var(--scene-2); bottom: 0; left: 6vmax; opacity: .8; }
.scene i:nth-child(3) { width: 16vmax; height: 16vmax; background: var(--scene-3); top: 38%; left: 38%; opacity: .32; }
.scene i:nth-child(4) { width: 22vmax; height: 22vmax; background: var(--scene-4); bottom: 12vmax; right: 18vmax; opacity: .45; }
.scene::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 0%, transparent 0%, var(--scene-veil) 70%); }

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--glass-shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-radius: var(--radius);
}

/* ---- Shell ---- */
.shell { position: relative; z-index: 1; max-width: 1280px; margin: 0 auto; padding: 20px 20px 120px; }
.topbar { display: flex; align-items: center; gap: 10px; padding-block: 10px; padding-inline: 16px 12px; border-radius: 999px; position: sticky; top: 14px; z-index: 5; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #0E7FBF, #00C2FF); display: grid; place-items: center; font-weight: 700; color: var(--accent-ink); flex: none; }
.who b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.who small { display: block; color: var(--text-muted); font-size: 12px; line-height: 1.2; }
.stamp { margin-inline-start: auto; color: var(--text-secondary); font-size: 13px; white-space: nowrap; }
.wm { font: 800 22px Inter, sans-serif; letter-spacing: -.5px; direction: ltr; margin-inline-end: 4px; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--glass-edge); background: var(--wash); display: grid; place-items: center; cursor: pointer; transition: background .2s; flex: none; }
.icon-btn:hover { background: var(--pressed); }
.icon-btn:focus-visible, .dock button:focus-visible, .btn:focus-visible, .tbl-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
.lang-btn { font: 700 13px Inter, Plex, sans-serif; }
.lang-btn:lang(ar) { font: 700 15px Plex, sans-serif; }
@keyframes spin { to { transform: rotate(360deg); } }
.corner-prefs { position: fixed; top: 16px; inset-inline-end: 16px; z-index: 5; display: flex; gap: 8px; }

.demo-banner { margin: 14px 0 0; padding: 10px 16px; border-radius: 14px; background: var(--banner-bg); border: 1px solid var(--banner-edge); color: var(--banner-ink); font-size: 14px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 30px 4px 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; font-weight: 700; line-height: 1.3; }
.page-head p { color: var(--text-secondary); max-width: 62ch; }

/* Page swap — out of focus and back, like a lens pulling. */
.page { transition: opacity .28s ease, filter .28s ease, transform .28s ease; }
.page.leaving { opacity: 0; filter: blur(14px); transform: scale(.985); }
.page.entering { opacity: 0; filter: blur(14px); transform: scale(1.015); }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; }
@media (max-width: 1080px) { .span-3 { grid-column: span 6; } .span-4, .span-5, .span-7, .span-8 { grid-column: span 12; } .span-6 { grid-column: span 12; } }
@media (max-width: 560px) {
  .action { grid-template-columns: auto 1fr; } .action .area { display: none; }
  .span-3 { grid-column: span 12; } .shell { padding: 12px 16px 120px; } .stamp { display: none; }
  .page-head h1 { font-size: 24px; } .topbar .wm { display: none; } .topbar { gap: 6px; padding-inline: 10px 8px; }
  .topbar .icon-btn { width: 34px; height: 34px; } .who small { display: none; }
}

.card { padding: 20px 22px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 16px; font-weight: 600; }
.card-head p { color: var(--text-muted); font-size: 13px; }
.tbl-toggle { border: 1px solid var(--glass-edge); background: transparent; border-radius: 999px; padding: 2px 12px; font-size: 12px; color: var(--text-secondary); cursor: pointer; white-space: nowrap; }
.tbl-toggle[aria-pressed="true"] { background: var(--pressed); color: var(--text-primary); }

/* ---- Figures ---- */
.hero { display: flex; flex-direction: column; gap: 6px; align-self: start; }
.hero .label { color: var(--text-secondary); font-size: 15px; }
/* Numbers stay left-to-right inside, but sit at the reading start. */
.hero .value, .tile .value { direction: ltr; text-align: right; }
:root[dir="ltr"] .hero .value, :root[dir="ltr"] .tile .value { direction: ltr; text-align: left; }
:root[dir="ltr"] .tile .value small { margin-inline-start: 6px; }
.hero .value { font: 700 64px/1.05 Inter, sans-serif; letter-spacing: -2px; margin: 10px 0 6px; }
.tile .label { color: var(--text-secondary); font-size: 14px; }
.tile .value { font: 650 32px/1.15 Inter, sans-serif; letter-spacing: -.8px; margin-top: 6px; }
.tile .value small { font: 500 15px Plex, sans-serif; color: var(--text-secondary); letter-spacing: 0; margin-inline-start: 4px; }
:root[lang="en"] .tile .value small { font-family: Inter, sans-serif; }
.delta { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.delta b { font-weight: 600; }
.delta .up-good, .delta .down-good { color: var(--delta-good); }
.delta .up-bad, .delta .down-bad { color: var(--delta-bad); }
.spark { display: block; width: 100%; height: 38px; margin-top: 12px; }

.meter { height: 10px; border-radius: 999px; background: var(--meter-track); overflow: hidden; margin-top: 14px; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--series-1); }
.meter.warn > span { background: var(--warning); } .meter.bad > span { background: var(--critical); }

/* ---- Actions (what to work on) ---- */
.actions { display: flex; flex-direction: column; gap: 8px; }
.action { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 12px 14px; border-radius: 16px; background: var(--wash); border: 1px solid var(--wash-edge); }
.action .badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap; margin-top: 2px; }
.action .badge svg { width: 13px; height: 13px; }
.badge.critical { background: rgba(208, 59, 59, .16); color: var(--critical-ink); }
.badge.serious { background: rgba(236, 131, 90, .16); color: var(--serious-ink); }
.badge.warning { background: rgba(250, 178, 25, .16); color: var(--warning-ink); }
.badge.good { background: rgba(12, 163, 12, .14); color: var(--good-ink); }
.action h3 { font-size: 15px; font-weight: 600; line-height: 1.45; }
.action p { color: var(--text-secondary); font-size: 13.5px; }
.action .area { color: var(--text-muted); font-size: 12px; white-space: nowrap; margin-top: 3px; }
.empty { color: var(--text-muted); padding: 18px 0; text-align: center; }

/* ---- Charts ---- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .tick { fill: var(--text-muted); font: 500 11px Inter, Plex, sans-serif; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .crosshair { stroke: var(--crosshair); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .col { transition: opacity .15s; }
.chart .col.dim { opacity: .45; }
.chart .endlabel { fill: var(--text-primary); font: 600 12px Inter, Plex, sans-serif; }

.tooltip { position: fixed; z-index: 50; pointer-events: none; padding: 8px 12px; border-radius: 12px; background: var(--glass-strong); color: var(--text-primary); border: 1px solid var(--glass-edge); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); font-size: 13px; min-width: 120px; opacity: 0; transition: opacity .12s; box-shadow: var(--glass-shadow); }
.tooltip.show { opacity: 1; }
.tooltip .t-label { color: var(--text-muted); font-size: 12px; }
.tooltip .t-row { display: flex; align-items: center; gap: 8px; }
.tooltip .t-row i { width: 12px; height: 2px; border-radius: 2px; flex: none; }
.tooltip .t-row b { font: 650 15px Inter, Plex, sans-serif; }

/* Horizontal bars — grow from the reading start (right in Arabic, left in English). */
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr; align-items: center; gap: 12px; border-radius: 10px; padding: 2px 4px; }
.hbar:hover, .hbar:focus-visible { background: var(--hover); outline: none; }
.hbar .name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .name small { color: var(--text-muted); margin-inline-start: 6px; }
.hbar .track { display: flex; align-items: center; gap: 8px; min-width: 0; }
/* Square at the baseline (inline start), rounded at the data end. */
.hbar .bar { height: 14px; border-radius: 0; border-start-end-radius: 4px; border-end-end-radius: 4px; background: var(--series-1); flex: none; min-width: 2px; }
.hbar .val { font: 600 13px Inter, sans-serif; color: var(--text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.stack { display: flex; gap: 2px; height: 14px; flex: 1; min-width: 0; }
.stack span { height: 100%; }
.stack span:last-child { border-start-end-radius: 4px; border-end-end-radius: 4px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.dot { border-radius: 50%; }

/* Budget vs nearest price. */
.dumbbells { display: flex; flex-direction: column; gap: 14px; }
.db-row { display: grid; grid-template-columns: minmax(90px, 30%) 1fr; gap: 12px; align-items: center; min-height: 52px; }
.db-row .name { font-size: 14px; }
.db-row .name small { display: block; color: var(--text-muted); font-size: 12px; }
.db-track { position: relative; height: 26px; margin: 0 22px; }
.db-track .rail { position: absolute; top: 12px; inset-inline: 0; height: 1px; background: var(--grid); }
.db-track .db-link { position: absolute; top: 11px; height: 3px; background: var(--db-link); border-radius: 2px; }
.db-track .pt { position: absolute; top: 4px; width: 18px; height: 18px; margin-inline-start: -9px; border-radius: 50%; border: 2px solid var(--surface); }
.db-track .pt-l { position: absolute; top: -15px; font: 600 11px Inter, sans-serif; color: var(--text-secondary); transform: translateX(50%); white-space: nowrap; }
:root[dir="ltr"] .db-track .pt-l { transform: translateX(-50%); }
.db-track .pt-l.below { top: 24px; }

/* ---- Tables ---- */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: start; color: var(--text-muted); font-weight: 500; font-size: 12.5px; padding: 6px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--row-line); vertical-align: top; }
td.n { font-family: Inter, sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.chip { display: inline-block; font-size: 12px; padding: 1px 9px; border-radius: 999px; background: var(--chip); color: var(--text-secondary); margin-block: 2px; margin-inline-end: 4px; white-space: nowrap; }
.q { font-weight: 500; }
.muted { color: var(--text-muted); }

/* ---- Dock (the reference's bottom tab bar) ---- */
.dock { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 10; display: flex; gap: 4px; padding: 6px; border-radius: 999px; max-width: calc(100vw - 24px); overflow-x: auto; scrollbar-width: none; }
.dock button { border: 0; background: transparent; padding: 9px 16px; border-radius: 999px; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--text-secondary); white-space: nowrap; font-size: 14px; transition: background .2s, color .2s; }
.dock button svg { width: 17px; height: 17px; flex: none; }
.dock button:hover { color: var(--text-primary); background: var(--hover); }
.dock button[aria-current="page"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.dock .count { font: 700 11px Inter, sans-serif; background: var(--critical); color: #fff; border-radius: 999px; padding: 0 6px; line-height: 17px; }
@media (max-width: 720px) { .dock button span.lbl { display: none; } .dock button[aria-current="page"] span.lbl { display: inline; } }

/* ---- Sign in ---- */
.signin { min-height: 100vh; display: grid; place-items: center; position: relative; z-index: 1; padding: 16px; }
.signin .card { width: min(420px, 100%); padding: 34px 30px; }
.signin .wm { font-size: 44px; display: block; text-align: center; letter-spacing: -1.5px; margin: 0; }
.signin h1 { text-align: center; font-size: 18px; font-weight: 500; color: var(--text-secondary); margin: 4px 0 26px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.field input { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--glass-edge); background: var(--input); outline: none; transition: border-color .2s; }
.field input:focus { border-color: var(--accent); }
.field input[type="email"], .field input[type="password"] { direction: ltr; text-align: left; }
.btn { width: 100%; padding: 12px; border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; margin-top: 6px; }
.btn:disabled { opacity: .6; cursor: progress; }
.link { display: block; width: 100%; text-align: center; background: none; border: 0; color: var(--text-secondary); margin-top: 16px; cursor: pointer; font-size: 14px; text-decoration: underline; text-underline-offset: 4px; }
.err { color: var(--critical-ink); font-size: 13.5px; min-height: 22px; margin-top: 10px; text-align: center; }

@media (prefers-reduced-motion: reduce) { .page, .tooltip, body { transition: none; } .icon-btn.spin svg { animation: none; } }
@media (forced-colors: active) { .glass { border: 1px solid CanvasText; } .hbar .bar, .stack span, .meter > span { forced-color-adjust: none; } }
