/* ==========================================================================
   Al-Narjis AI — design system
   Visual identity: ODSF v0.2 (see docs/design-system.md).
   Premium SaaS restraint: gold = the action colour, green = structure and
   Telegram, ivory = space. Cairo throughout, 8pt grid, soft radii, hairline
   first with one quiet shadow step.

   Token values verified against docs/design-system.md:
   accent #FF5A36, page #FAFAF9, surface #FFFFFF,
   text #292524, secondary #57534E, separator #E7E5E4.

   Rules for this file:
   - every colour, radius and font comes from a token; templates must not hard-code
     hex values (tests/test_design_system.py enforces it)
   - conversation surfaces stay rounder than a typical web UI on purpose: Telegram
     bubbles use a 16-20px radius with one tight corner
   - shadows stay almost flat; surfaces separate with hairlines, not depth
   ========================================================================== */

:root {
  /* --- brand: gold is the action colour, never a background ------------- */
  --tg-blue: #ff5a36;              /* fills, large type, accents */
  /* Small text on white / #FAFAF9. #FF5A36 is 3.10:1 / 2.97:1 (fails AA).
     #C2410C is 5.18:1 on #FFFFFF and 4.96:1 on #FAFAF9. #D93F1E is only 4.49:1. */
  --tg-blue-ink: #c2410c;
  --tg-blue-press: #d93f1e;
  --tg-blue-deep: #b83316;
  --tg-blue-tint: #f3f3f3;
  --tg-blue-tint-2: #f7f7f7;
  --tg-blue-soft: rgba(255, 90, 54, 0.12);

  /* --- surfaces (light, ivory) ------------------------------------------ */
  --n-sand: #fafaf9;   /* page background */
  --n-sand-2: #ffffff; /* raised surface */
  --n-cream: #ffffff;  /* card */
  --n-cream-2: #fbfaf8;/* nested card */
  --n-sidebar-bg: #ffffff; /* sidebar / footer base */

  /* --- ink ------------------------------------------------------------- */
  --n-brown: #292524;   /* primary text */
  --n-brown-2: #57534e; /* secondary text */
  --n-earth: #8a8580;   /* placeholder / tertiary */

  /* --- lines ----------------------------------------------------------- */
  --n-line: rgba(41, 37, 36, 0.09);
  --n-line-2: rgba(41, 37, 36, 0.16);

  /* --- status ---------------------------------------------------------- */
  --n-online: #ff5a36;   /* online dot */
  --n-danger: #9b2c2c;
  --n-warn: #d93f1e;

  /* --- accent: the single primary action --------------------------------
     Renamed from "gold" to "accent" on the owner's instruction. The hue is
     vermilion, chosen for 2026 rather than taste: one saturated accent on a
     near-black canvas, deliberately outside the 220-280 degree band that
     research now identifies as the AI-generated convergence zone (indigo,
     blue-to-purple gradients), and clear of the Telegram blue and green so a
     call to action never reads as a chat link.

     Measured, not eyeballed:
       vermilion on the dark canvas  #0C0C0E .......  6.30:1   AA
       near-black ink on vermilion .................  5.62:1   AA, body size
       white on vermilion .........................  3.10:1   FAILS AA

     That last line is why every accent-filled control uses ink, not white. */
  --odsf-accent: #ff5a36;
  --odsf-accent-deep: #d93f1e;
  --odsf-accent-wash: #ffeae4;

  /* --- legacy aliases kept so existing class names keep working ---------
     `--n-gold*` now resolves to the accent family. Retired, not deleted, so
     no template or stylesheet breaks; new code must use `--n-accent*`. */
  --odsf-gold: var(--odsf-accent);
  --odsf-gold-deep: var(--odsf-accent-deep);
  --odsf-gold-wash: var(--odsf-accent-wash);

  --n-accent: var(--odsf-accent);
  --n-accent-2: var(--odsf-accent-deep);
  --n-accent-soft: rgba(255, 90, 54, 0.32);

  --n-gold: var(--n-accent);
  --n-gold-2: var(--n-accent-2);
  --n-gold-soft: var(--n-accent-soft);

  /* --- type: Cairo is the only approved family (see docs/design-system) */
  --font-ar: "Cairo", "Segoe UI", system-ui, sans-serif;
  --font-head: "Cairo", "Segoe UI", system-ui, sans-serif;
  --fs-xs: 0.8125rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.625rem;
  --fs-2xl: clamp(1.9rem, 3.6vw, 2.9rem);

  /* --- radii: deliberately rounder, Telegram-style --------------------- */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-bubble: 20px;   /* conversation cards */
  --r-pill: 999px;

  /* --- elevation: hairline-first ---------------------------------------- */
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ar);
  background: var(--n-sand);
  color: var(--n-brown);
  min-height: 100vh;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  display: block;
  visibility: visible;
}

[dir="ltr"] body { font-family: "Cairo", "Segoe UI", system-ui, sans-serif; }

::selection { background: var(--odsf-gold-wash); color: var(--n-brown); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--n-sand); }
::-webkit-scrollbar-thumb { background: #d6d3d1; border-radius: var(--r-pill); border: 2px solid var(--n-sand); }
::-webkit-scrollbar-thumb:hover { background: #a8a29e; }

a { text-decoration: none; color: inherit; }

.n-geo {
  background-image:
    linear-gradient(45deg, rgba(255, 90, 54, 0.05) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 90, 54, 0.05) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 90, 54, 0.05) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(36, 129, 204, 0.05) 75%);
  background-size: 48px 48px;
  background-position: 0 0, 0 24px, 24px -24px, -24px 0;
}

.arch {
  border-radius: 46% 46% var(--r-xl) var(--r-xl);
  border: 1.5px solid var(--tg-blue-tint);
  border-bottom-color: transparent;
  overflow: hidden;
  background: var(--n-cream);
}
.arch-inner {
  border-radius: 44% 44% var(--r-lg) var(--r-lg);
  border: 1px solid var(--tg-blue-soft);
}

.n-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: var(--fs-sm);
  letter-spacing: 3px;
  color: var(--tg-blue-ink);
  font-weight: 700;
}
.n-divider::before,
.n-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--tg-blue-soft));
}
.n-divider::after { background: linear-gradient(90deg, var(--tg-blue-soft), transparent); }

.n-title {
  font-family: var(--font-head);
  font-weight: 800;
  line-height: 1.25;
  color: var(--n-brown);
  letter-spacing: -0.4px;
}
.n-title .gold { color: var(--tg-blue-ink); }
.n-sub { color: var(--n-brown-2); font-size: var(--fs-md); }

/* --- buttons: flat Telegram blue, rounder, no heavy lift ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: var(--fs-base);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  color: var(--n-brown);
}
.btn-gold {
  background: var(--tg-blue);
  color: #000000;
  box-shadow: var(--shadow);
  border-color: transparent;
}
.btn-outline {
  background: var(--n-sand-2);
  color: var(--tg-blue-ink);
  border: 1px solid var(--n-line-2);
}
.btn-outline:hover { border-color: var(--tg-blue); color: var(--tg-blue-ink); }
.btn-gold:hover { background: var(--tg-blue-press); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { background: var(--tg-blue-deep); transform: translateY(0); }

/* --- cards: hairline + barely-there shadow, rounder corners ------------ */
.n-card {
  background: var(--n-cream);
  border-radius: var(--r-lg);
  padding: 30px;
  box-shadow: var(--shadow);
  border: 1px solid var(--n-line);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}
.n-card::before { content: none; }
.n-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--tg-blue-soft);
}

.n-sidebar {
  background: var(--n-cream);
  color: var(--n-brown);
  border-inline-end: 1px solid var(--n-line);
}
.n-sidebar .brand {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--tg-blue);
  display: flex;
  align-items: center;
  gap: 12px;
}
.n-sidebar nav a {
  color: var(--n-brown-2);
  border-radius: var(--r-md);
  transition: background 0.15s ease, color 0.15s ease;
}
.n-sidebar nav a:hover { background: var(--tg-blue-soft); color: var(--tg-blue-ink); }
.n-sidebar nav a.active {
  background: var(--tg-blue);
  color: #000000;
  font-weight: 600;
}

.n-nav {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--n-line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.lang-pill {
  display: flex;
  background: var(--n-sand);
  border-radius: var(--r-pill);
  padding: 3px;
  border: 1px solid var(--n-line);
}
.lang-pill button {
  border: none;
  background: transparent;
  padding: 7px 16px;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--n-brown-2);
  cursor: pointer;
  transition: all 0.15s ease;
}
.lang-pill button.active { background: var(--tg-blue); color: #000000; }
[dir="ltr"] .lang-pill button.arabic { order: 1; }
[dir="ltr"] .lang-pill button.english { order: 0; }

body [data-lang] { display: none; }
body[data-lang="ar"] [data-lang="ar"] { display: inherit; }
body[data-lang="en"] [data-lang="en"] { display: inherit; }
body[data-lang="en"] [data-lang="en"][data-inline] { display: inline; }
body[data-lang="ar"] [data-lang="ar"][data-inline] { display: inline; }

/* --- hero: light, airy, Telegram-blue glow ----------------------------- */
.n-hero {
  background:
    radial-gradient(circle at 85% 15%, rgba(36, 129, 204, 0.12), transparent 40%),
    radial-gradient(circle at 10% 80%, rgba(36, 129, 204, 0.07), transparent 45%),
    linear-gradient(170deg, #ffffff, #fafaf9 75%);
  color: var(--n-brown);
  position: relative;
  overflow: hidden;
}
.n-hero .edge {
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 70px;
  background: var(--n-sand);
  border-radius: 50% 50% 0 0 / 26px 26px 0 0;
}
.n-hero h1 {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: var(--fs-2xl);
  line-height: 1.22;
  color: var(--n-brown);
}
.n-hero h1 .accent { color: var(--tg-blue); }
.n-hero .stat {
  background: var(--n-sand-2);
  border: 1px solid var(--n-line);
  border-radius: var(--r-lg);
  padding: 18px 22px;
}
.n-hero .stat .num {
  font-family: var(--font-head);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--tg-blue);
}

.pkg { position: relative; overflow: hidden; }
.pkg.featured {
  border: 1.5px solid var(--tg-blue);
  background: linear-gradient(180deg, var(--tg-blue-tint-2), var(--n-cream) 45%);
}
.pkg.featured::after {
  content: "\2605";
  position: absolute;
  top: 14px;
  right: 18px;
  font-size: 1.1rem;
  color: var(--tg-blue-ink);
}
[dir="ltr"] .pkg.featured::after { right: auto; left: 18px; }
.pkg.selected {
  border-color: var(--tg-blue);
  box-shadow: 0 0 0 1px var(--tg-blue), var(--shadow-md);
}
.pkg .price {
  font-family: var(--font-head);
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--tg-blue);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}
.pkg .price small { font-size: var(--fs-base); color: var(--n-brown-2); }
.pkg ul { list-style: none; }
.pkg ul li {
  padding: 9px 0 9px 30px;
  position: relative;
  border-bottom: 1px dashed var(--n-line);
  font-size: var(--fs-base);
  color: var(--n-brown-2);
}
.pkg ul li::before {
  content: "\25C6";
  position: absolute;
  left: 0;
  color: var(--tg-blue-ink);
  font-size: 0.7rem;
  top: 13px;
}
[dir="ltr"] .pkg ul li { padding: 9px 30px 9px 0; }
[dir="ltr"] .pkg ul li::before { left: auto; right: 0; }

/* --- forms: flat fields, Telegram focus ring ---------------------------- */
.n-form input,
.n-form select,
.n-form textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--n-line-2);
  border-radius: var(--r-md);
  background: var(--n-sand-2);
  font-family: var(--font-ar);
  font-size: var(--fs-base);
  color: var(--n-brown);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.n-form input:focus,
.n-form select:focus,
.n-form textarea:focus {
  outline: none;
  border-color: var(--tg-blue);
  box-shadow: 0 0 0 3px var(--tg-blue-soft);
}
.n-form label { font-weight: 600; font-size: var(--fs-sm); color: var(--n-brown-2); margin-bottom: 7px; display: block; }
.n-form select option { background: #ffffff; color: var(--n-brown); }

input, select, textarea {
  background: var(--n-sand-2);
  border: 1px solid var(--n-line-2);
  color: var(--n-brown);
  border-radius: var(--r-md);
}
input::placeholder, textarea::placeholder { color: var(--n-earth); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--tg-blue);
  box-shadow: 0 0 0 3px var(--tg-blue-soft);
}
select option { background: #ffffff; color: var(--n-brown); }

/* --- Telegram mark ------------------------------------------------------
   The paper plane and the blue disc come from templates/partials/_telegram_mark.html,
   so they need no icon font and follow currentColor everywhere. */
.tg-icon {
  width: 1.15em;
  height: 1.15em;
  flex: 0 0 auto;
  vertical-align: -0.18em;
}
.tg-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 6px 18px rgba(36, 129, 204, 0.3);
}
.tg-icon-sm { width: 1em; height: 1em; }
.tg-icon-lg { width: 1.5em; height: 1.5em; }

/* --- floating contact: circular Telegram disc --------------------------- */
.tg-float {
  position: fixed;
  bottom: 24px;
  inset-inline-end: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--tg-blue);
  color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  transition: transform 0.15s ease, background 0.15s ease;
}
.tg-float:hover { transform: translateY(-2px); background: var(--tg-blue-press); }
.tg-float .tg-icon { width: 26px; height: 26px; }

/* Telegram CTAs read as one channel: same blue, rounder, same radius */
.btn-tg,
.tg-agent,
.m-tg {
  background: var(--tg-blue);
  color: #000000;
  border-color: transparent;
}
.btn-tg:hover,
.tg-agent:hover { background: var(--tg-blue-press); }
.btn-tg .tg-icon,
.tg-agent .tg-icon,
.m-tg .tg-icon { color: #000000; }

.n-footer {
  background: var(--n-cream);
  color: var(--n-brown-2);
  border-block-start: 1px solid var(--n-line);
}
.n-footer a { color: var(--tg-blue-ink); text-decoration: none; }
.n-footer a:hover { text-decoration: underline; }

.bg-sand { background: var(--n-sand); }
.bg-cream { background: var(--n-cream); }
.bg-green { background: var(--tg-blue); }
.bg-green-3 { background: var(--n-sidebar-bg); }
.text-green { color: var(--tg-blue-ink); }
.text-gold { color: var(--tg-blue-ink); }

.emp-card.dormant { filter: none; opacity: 0.94; }
.emp-card.dormant .emp-ava { background: repeating-linear-gradient(45deg, rgba(36,129,204,0.10) 0 12px, rgba(36,129,204,0.03) 12px 24px); }
.emp-card .emp-ava { display: grid; place-items: center; }
.awake-pulse { animation: pulseBlue 1.6s ease-in-out infinite; }
@keyframes pulseBlue {
  0%, 100% { box-shadow: 0 0 0 0 rgba(36, 129, 204, 0.35); }
  50% { box-shadow: 0 0 0 12px rgba(36, 129, 204, 0); }
}

.chip {
  display: inline-block;
  background: var(--n-sand-2);
  border: 1px solid var(--n-line);
  color: var(--n-brown-2);
  padding: 7px 15px;
  border-radius: var(--r-pill);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: 0.15s;
  font-family: var(--font-ar);
}
.chip:hover { background: var(--tg-blue); color: #000000; border-color: var(--tg-blue); }

/* --- conversation surfaces: rounder, Telegram bubbles ------------------- */
.cmsg,
.msg-agent,
.chat-box .msg {
  background: var(--n-sand-2);
  color: var(--n-brown);
  border: 1px solid var(--n-line);
  border-radius: var(--r-bubble);
  padding: 12px 18px;
  line-height: 1.7;
}
.cmsg.ai,
.msg-agent,
.chat-box .msg {
  border-start-start-radius: 8px; /* the one tight corner, like a Telegram bubble */
}
.cmsg.me,
.msg-client {
  background: var(--tg-blue-tint);
  color: var(--n-brown);
  border: 1px solid var(--tg-blue-soft);
  border-start-end-radius: 8px;
}
.msg-row { display: flex; gap: 10px; margin-bottom: 10px; }
.msg-row.me { justify-content: flex-start; }
.bubble-tail {
  width: 10px;
  height: 10px;
  background: var(--tg-blue-tint);
  border-start-end-radius: 8px;
  margin-inline-end: -6px;
}

  @media (max-width: 768px) {
    .n-hero .edge { height: 34px; }
  }
  

/* cookie consent banner open: keep page content clear of it */
body.has-consent-banner { padding-bottom: 140px; }
