/* ============================================================
   RawaCOD — Account Area (brand.css)
   Reuses the EXACT design tokens, fonts and visual language of
   the marketing site (assets/css/base.css) so dashboards feel
   100% native to the RawaCOD brand. Dark default + light mode,
   RTL-ready via logical properties.
   ============================================================ */

/* ---------- Self-hosted fonts (same files as the marketing site) ---------- */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/fonts/bricolage-grotesque-var-latin.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: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/instrument-sans-var-latin.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: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/assets/fonts/jetbrains-mono-var-latin.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: "Noto Sans Arabic";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/noto-sans-arabic-var-arabic.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;
}

/* ---------- Tokens: dark (default) — identical to marketing site ---------- */
:root, [data-theme="dark"] {
  --bg: #081a2e;
  --bg-2: #0a2138;
  --bg-3: #0d2740;
  --card: #0b2138;
  --card-2: #0e2843;
  --line: rgba(148, 166, 196, 0.14);
  --line-2: rgba(148, 166, 196, 0.24);
  --text: #eaf0f8;
  --text-2: #b4c1d6;
  --text-3: #7e8da6;
  --brand: #5d9fe0;
  --brand-2: #a5cff5;
  --brand-deep: #2e82d9;
  --on-brand: #ffffff;
  --accent: #5d9fe0;
  --accent-2: #a5cff5;
  --accent-deep: #2e82d9;
  --accent-ink: #ffffff;
  --cod: #f25868;
  --amber: #e8a33d;
  --green: #2fbf8f;
  --green-deep: #16a34a;
  --red: #e07a7a;
  --sky: #7dd3fc;
  --ring: rgba(46, 130, 217, 0.45);
  --shadow-1: 0 10px 30px -12px rgba(2, 8, 20, 0.6);
  --shadow-2: 0 30px 70px -25px rgba(2, 8, 20, 0.7);
  --shadow-accent: 0 14px 44px -14px rgba(0, 78, 153, 0.65);
  --header-bg: rgba(8, 26, 46, 0.8);
  --card-glass: rgba(11, 33, 56, 0.85);
  --grad-text: linear-gradient(94deg, #a5cff5 0%, #7db4ea 52%, #2e82d9 100%);
  --grad-brand: linear-gradient(135deg, #003c77 0%, #004e99 55%, #0a63bd 100%);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --header-h: 68px;
  color-scheme: dark;
}

/* ---------- Tokens: light — identical to marketing site ---------- */
[data-theme="light"] {
  --bg: #f5f5f7;
  --bg-2: #ffffff;
  --bg-3: #eceff3;
  --card: #ffffff;
  --card-2: #f6f8fb;
  --line: #e2e7ee;
  --line-2: #d3dbe5;
  --text: #13223a;
  --text-2: #4e5f79;
  --text-3: #61708a;
  --brand: #004e99;
  --brand-2: #0a63bd;
  --brand-deep: #003c77;
  --on-brand: #ffffff;
  --accent: #004e99;
  --accent-2: #004e99;
  --accent-deep: #003c77;
  --accent-ink: #ffffff;
  --cod: #d71932;
  --amber: #e8a33d;
  --green: #0e9f6e;
  --green-deep: #15803d;
  --red: #c21f35;
  --sky: #0284c7;
  --ring: rgba(0, 78, 153, 0.35);
  --shadow-1: 0 10px 30px -14px rgba(13, 40, 80, 0.18);
  --shadow-2: 0 30px 70px -30px rgba(13, 40, 80, 0.22);
  --shadow-accent: 0 14px 40px -16px rgba(0, 78, 153, 0.5);
  --header-bg: rgba(245, 245, 247, 0.85);
  --card-glass: rgba(255, 255, 255, 0.88);
  --grad-text: linear-gradient(94deg, #003c77 0%, #004e99 55%, #0a63bd 100%);
  --grad-brand: linear-gradient(135deg, #003c77 0%, #004e99 55%, #0a63bd 100%);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body.rc-body {
  font-family: "Instrument Sans", "Noto Sans Arabic", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  /* FIX (4.2.0): overflow-x: hidden on <body> turned the body into a scroll
     container (because html has overflow-x: clip, body's overflow no longer
     propagates to the viewport). That silently DISABLED position: sticky for
     .sidebar and .topbar — both scrolled away with the page, so the dashboard
     sidebar "disappeared" while scrolling long settings pages.
     overflow-x: clip does the same horizontal-overflow job WITHOUT creating a
     scroll container, so sticky keeps working. hidden stays as the legacy
     fallback for old browsers that don't support clip. */
  overflow-x: hidden;
  overflow-x: clip;
  transition: background-color 0.35s ease, color 0.35s ease;
  min-height: 100vh;
}

img, svg, video { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: "Bricolage Grotesque", "Instrument Sans", "Noto Sans Arabic", sans-serif; line-height: 1.18; letter-spacing: -0.01em; font-weight: 700; }
code, .mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.9em; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

.rc-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Buttons ---------- */
.btn {
  --btn-h: 46px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--btn-h); padding: 0 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600; font-size: 0.95rem; line-height: 1;
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn-primary {
  background: var(--grad-brand); color: var(--on-brand);
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover { filter: brightness(1.08); color: var(--on-brand); }

.btn-ghost {
  background: transparent; color: var(--text-2);
  border-color: var(--line-2);
}
.btn-ghost:hover { color: var(--text); border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }

.btn-soft {
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand); border-color: transparent;
}
.btn-soft:hover { background: color-mix(in srgb, var(--brand) 18%, transparent); }

.btn-danger {
  background: color-mix(in srgb, var(--red) 14%, transparent);
  color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent);
}
.btn-danger:hover { background: color-mix(in srgb, var(--red) 22%, transparent); }

.btn-green {
  background: color-mix(in srgb, var(--green) 16%, transparent);
  color: var(--green); border-color: color-mix(in srgb, var(--green) 35%, transparent);
}
.btn-green:hover { background: color-mix(in srgb, var(--green) 24%, transparent); }

.btn-sm { --btn-h: 38px; padding: 0 14px; font-size: 0.88rem; }
.btn-lg { --btn-h: 52px; padding: 0 26px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor; animation: rc-spin 0.7s linear infinite;
}
@keyframes rc-spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: transparent; color: var(--text-2);
  cursor: pointer; transition: border-color 0.2s, color 0.2s, background-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { color: var(--text); border-color: var(--brand); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; text-align: start; }
.field > label {
  display: block; font-size: 0.88rem; font-weight: 600; color: var(--text-2);
  margin-bottom: 7px;
}
.control {
  width: 100%; height: 48px; padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--bg-2); color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.control::placeholder { color: var(--text-3); }
.control:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.control.has-err { border-color: var(--red); }
textarea.control { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; }
select.control { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-end: 34px; }
html[dir="rtl"] select.control { background-position: 13px 50%, 18px 50%; }

.field-hint { font-size: 0.8rem; color: var(--text-3); margin-top: 6px; }
.field-err { font-size: 0.82rem; color: var(--red); margin-top: 6px; min-height: 1em; font-weight: 500; }

/* ---------- Cards / panels ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.card-pad { padding: 24px; }
.card-h {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.card-h h2, .card-h h3 { font-size: 1.06rem; }
.card-b { padding: 24px; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--brand);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700; letter-spacing: 0.02em;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-green { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.badge-red { background: color-mix(in srgb, var(--red) 13%, transparent); color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.badge-amber { background: color-mix(in srgb, var(--amber) 15%, transparent); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 32%, transparent); }
.badge-blue { background: color-mix(in srgb, var(--brand) 13%, transparent); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }

/* ---------- Inline alerts (dashboard + admin) ---------- */
.rc-alert {
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--line-2); border-inline-start: 3px solid var(--brand);
  border-radius: var(--radius-sm); padding: 14px 16px;
  background: color-mix(in srgb, var(--brand) 6%, var(--card-2));
  font-size: 0.92rem;
}
.rc-alert b { font-size: 0.95rem; }
.rc-alert span { color: var(--text-2); }
.rc-alert-warn {
  border-inline-start-color: var(--amber);
  background: color-mix(in srgb, var(--amber) 8%, var(--card-2));
  border-color: color-mix(in srgb, var(--amber) 30%, transparent);
}
.rc-alert-ok {
  border-inline-start-color: var(--green);
  background: color-mix(in srgb, var(--green) 8%, var(--card-2));
  border-color: color-mix(in srgb, var(--green) 30%, transparent);
}

/* ---------- Brand mark ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.brand-mark {
  display: inline-flex; width: 38px; height: 38px; border-radius: 11px;
  overflow: hidden; flex: none;
  box-shadow: 0 0 0 1px var(--line-2), var(--shadow-1);
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-word { font-family: "Bricolage Grotesque", sans-serif; font-size: 1.22rem; font-weight: 700; letter-spacing: -0.01em; }
.brand-word b { color: var(--cod); font-weight: 800; }

/* ---------- Auth shell ---------- */
.auth-wrap {
  min-height: 100vh;
  /* FIX (4.2.0): dvh keeps the layout correct when the mobile browser UI
     collapses/expands (iOS Safari address bar) — no premature scroll. */
  min-height: 100dvh;
  display: flex; flex-direction: column;
  background:
    radial-gradient(52rem 30rem at 85% -10%, color-mix(in srgb, var(--brand-deep) 30%, transparent), transparent 60%),
    radial-gradient(40rem 26rem at -10% 110%, color-mix(in srgb, var(--brand-deep) 22%, transparent), transparent 55%),
    var(--bg);
  position: relative;
}
.auth-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px clamp(16px, 4vw, 40px);
}
.auth-main {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: clamp(20px, 4vh, 36px) clamp(16px, 4vw, 40px) 48px;
}

/* 4.2.0 — split shell: brand pitch (desktop) + card. The pitch collapses
   away below 1080px so phones/tablets keep the proven centered card. */
.auth-shell {
  width: 100%; max-width: 1040px;
  margin-inline: auto;
  display: grid; grid-template-columns: minmax(0, 1fr);
  align-items: center; gap: clamp(28px, 4vw, 56px);
}
.auth-pitch { display: none; }
@media (min-width: 1080px) {
  .auth-shell { grid-template-columns: minmax(0, 1.05fr) minmax(0, 460px); }
  .auth-pitch { display: block; }
  /* register/forgot use the wide card — give it the same right column width */
  .auth-shell .auth-card-wide { max-width: none; }
}
.pitch-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.02em;
  color: var(--brand-2);
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
  border-radius: 999px; padding: 7px 14px;
  margin-bottom: 18px;
}
.pitch-title {
  font-size: clamp(1.55rem, 2.4vw, 2.05rem); line-height: 1.28;
  letter-spacing: 0; margin: 0 0 12px; color: var(--text);
}
.pitch-sub { color: var(--text-2); font-size: 0.98rem; line-height: 1.85; margin: 0 0 20px; max-width: 46ch; }
.pitch-list { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 12px; }
.pitch-list li { display: flex; align-items: flex-start; gap: 11px; color: var(--text-2); font-size: 0.94rem; line-height: 1.6; }
.pitch-list svg { flex: none; margin-top: 2px; color: var(--brand); }
.pitch-list b, .pitch-list span { min-width: 0; }
.pitch-shot {
  margin: 0;
  width: min(300px, 78%);
  border-radius: 18px 18px var(--radius-lg) var(--radius-lg);
  border: 1px solid var(--line-2);
  border-bottom: 0;
  box-shadow: var(--shadow-2);
  overflow: hidden;
  background: var(--card);
}
/* 4.2.0: cap the shot by viewport HEIGHT so the whole pitch fits on shorter
   laptops (1366×768) too — the top of the form (packages & fields) is the
   meaningful part; the crop trims the long footer of the form. */
.pitch-shot img {
  width: 100%; height: auto; display: block;
  max-height: min(38vh, 380px);
  object-fit: cover; object-position: top;
}
@media (min-width: 1080px) and (max-height: 820px) {
  .pitch-badge { margin-bottom: 12px; }
  .pitch-title { margin-bottom: 8px; }
  .pitch-sub { margin-bottom: 14px; }
  .pitch-list { gap: 9px; margin-bottom: 16px; }
}
.pitch-tag {
  margin-top: 12px; font-size: 0.8rem; color: var(--text-3);
  display: flex; align-items: center; gap: 7px;
}
.pitch-tag::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); flex: none; }

.auth-card {
  width: 100%; max-width: 460px;
  margin-inline: auto;
  background: var(--card-glass); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2); padding: clamp(24px, 4vw, 38px);
  animation: rc-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.auth-card-wide { max-width: 560px; }
@media (min-width: 1080px) {
  .auth-card { margin-inline: 0; }
}
@keyframes rc-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.auth-title { font-size: clamp(1.5rem, 3.5vw, 1.9rem); margin: 10px 0 6px; }
.auth-sub { color: var(--text-2); font-size: 0.96rem; margin-bottom: 24px; }
.auth-foot { margin-top: 22px; font-size: 0.9rem; color: var(--text-2); text-align: center; }
.auth-foot a { font-weight: 600; }
.auth-back { display: inline-flex; align-items: center; gap: 6px; font-size: 0.88rem; color: var(--text-2); }
.auth-back:hover { color: var(--brand); }

/* 4.2.0 — form rhythm shared by login/register/forgot/reset */
.auth-card .field { margin-bottom: 16px; }
.auth-card .btn-block { width: 100%; margin-top: 4px; }

/* 6.0.0 — the "Continue with Google" UI option was removed from the
   auth experience by product decision. The divider + button styles are
   gone with it; server-side OAuth files and the admin settings card
   remain untouched for existing linked accounts. */

/* Auth-pages visually-hidden helper (screen-reader only). */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.auth-ok {
  display: flex; gap: 10px; align-items: flex-start;
  background: color-mix(in srgb, var(--green) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
  color: var(--green); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 0.9rem; margin-bottom: 16px;
  word-break: break-word;
  animation: rc-rise 0.35s ease both;
}
.auth-alert {
  display: flex; gap: 10px; align-items: flex-start;
  background: color-mix(in srgb, var(--red) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
  color: var(--red); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 0.9rem; margin-bottom: 16px;
  word-break: break-word;
  /* 4.2.0: the banner animates in WITHOUT any layout jump — the card grows
     smoothly, error text never overlaps the form below. */
  animation: rc-rise 0.35s ease both;
}
.auth-alert svg, .auth-ok svg { flex: none; }
.pw-meter { display: flex; gap: 5px; margin-top: 8px; }
.pw-meter span { height: 4px; flex: 1; border-radius: 4px; background: var(--line-2); transition: background-color 0.25s; }
.pw-1 span:nth-child(1) { background: var(--red); }
.pw-2 span:nth-child(-n+2) { background: var(--amber); }
.pw-3 span:nth-child(-n+3) { background: var(--green); }

/* ---------- Lang / theme controls ---------- */
.seg {
  display: inline-flex; align-items: center; padding: 3px; gap: 2px;
  flex-wrap: wrap; max-width: 100%;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-3) 60%, transparent);
}
.seg button,
/* FIX (2.0.1): the language switch renders <a> elements — give them the
   same segment styling as buttons instead of bare unstyled links. */
.seg a {
  border: 0; background: transparent; color: var(--text-3);
  font-size: 0.78rem; font-weight: 700; padding: 6px 10px; border-radius: 8px;
  cursor: pointer; letter-spacing: 0.04em; min-height: 32px;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  transition: background-color 0.2s, color 0.2s;
}
.seg button:hover, .seg a:hover { color: var(--text); }
.seg button.is-active, .seg a.is-active { background: var(--card-2); color: var(--brand); box-shadow: var(--shadow-1); }

/* ---------- Dashboard shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.shell-body { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: 258px; flex: none;
  border-inline-end: 1px solid var(--line);
  background: var(--bg-2);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  scrollbar-width: thin;
  padding: 18px 14px;
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 6px 16px; }
.side-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.side-nav .nav-group {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3); padding: 14px 12px 6px;
}
.side-link {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 600; font-size: 0.93rem;
  transition: background-color 0.18s, color 0.18s;
  min-height: 44px;
}
.side-link svg { width: 19px; height: 19px; flex: none; opacity: 0.85; }
.side-link:hover { background: color-mix(in srgb, var(--brand) 9%, transparent); color: var(--text); }
.side-link.is-active {
  background: var(--grad-brand); color: var(--on-brand);
  box-shadow: var(--shadow-accent);
}
.side-link .pill {
  margin-inline-start: auto; font-size: 0.72rem; font-weight: 800;
  background: var(--red); color: #fff; border-radius: 999px;
  min-width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 6px;
}
.side-link.is-active .pill { background: rgba(255, 255, 255, 0.25); }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px 8px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--grad-brand); color: var(--on-brand);
  font-weight: 800; font-size: 0.9rem; letter-spacing: 0.02em;
}
.side-user .who { min-width: 0; }
.side-user .who b { display: block; font-size: 0.88rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who span { display: block; font-size: 0.76rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mainbar { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 clamp(14px, 3vw, 28px);
  background: var(--header-bg); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 1.06rem; font-weight: 700; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.burger { display: none; }

.content { padding: clamp(16px, 3vw, 28px); flex: 1; width: 100%; max-width: 1160px; }
.content-full { max-width: none; }

/* ---------- Grids / stats ---------- */
/* FIX (4.1.0): explicit single track with min 0 — an implicit auto track
   sized itself to the widest item's min-content (tbl min-width 640, wide
   controls) and pushed cards beyond the viewport on mobile. */
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
/* FIX (2.0.1): grid-2/3/4 were declared without display:grid, so every
   standalone use (class="grid-2" without "grid") silently collapsed to
   a single column — 2/3/4-column forms rendered stacked. */
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1080px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } .grid-sm-2 { grid-template-columns: repeat(2, minmax(0,1fr)); } }

.stat {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-1);
}
.stat-ic {
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--brand) 13%, transparent); color: var(--brand);
}
.stat-ic svg { width: 22px; height: 22px; }
.stat-ic.is-green { background: color-mix(in srgb, var(--green) 13%, transparent); color: var(--green); }
.stat-ic.is-amber { background: color-mix(in srgb, var(--amber) 15%, transparent); color: var(--amber); }
.stat-ic.is-red { background: color-mix(in srgb, var(--red) 13%, transparent); color: var(--red); }
.stat b { display: block; font-size: 1.45rem; font-family: "JetBrains Mono", monospace; line-height: 1.15; }
/* FIX (2.0.1): was ".stat span" which out-specified ".stat-ic" and stripped
   the icon chip of its color/centering. Target only the trailing label. */
.stat > span:last-child { display: block; font-size: 0.82rem; color: var(--text-3); font-weight: 600; }

/* ---------- Rows / lists ---------- */
.row-list { display: flex; flex-direction: column; }
.row-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
  transition: background-color 0.15s;
  min-height: 56px;
}
.row-item:last-child { border-bottom: 0; }
.row-item:hover { background: color-mix(in srgb, var(--brand) 5%, transparent); }
.row-main { min-width: 0; flex: 1; }
.row-main b { display: block; font-size: 0.94rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main span { display: block; font-size: 0.8rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* FIX (4.1.0): allow the side cluster to wrap/shrink instead of forcing the
   row (and the whole page) wider than the viewport on long filter rows. */
.row-side { display: flex; align-items: center; gap: 10px; flex: 0 1 auto; flex-wrap: wrap; min-width: 0; }

/* ---------- Tables (desktop) → cards (mobile) ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 640px; }
.tbl th {
  text-align: start; font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3); font-weight: 700; padding: 12px 24px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 14px 24px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background-color 0.15s; }
.tbl tbody tr:hover { background: color-mix(in srgb, var(--brand) 5%, transparent); }

/* ---------- Messages thread ---------- */
/* FIX (2.0.1): the thread now actually scrolls so dash.js auto-scroll
   (scrollThread) reaches the newest message on long conversations. */
.thread { display: flex; flex-direction: column; gap: 14px; padding: 20px 24px; max-height: 460px; overflow-y: auto; }
.bubble {
  max-width: min(86%, 640px);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 12px 16px;
  background: var(--card-2);
  animation: rc-rise 0.3s ease both;
}
.bubble .meta { display: flex; align-items: center; gap: 8px; font-size: 0.74rem; color: var(--text-3); margin-bottom: 5px; flex-wrap: wrap; }
.bubble .meta b { color: var(--text-2); font-size: 0.78rem; }
.bubble p { font-size: 0.94rem; white-space: pre-wrap; word-break: break-word; }
.bubble.mine { align-self: flex-end; background: var(--grad-brand); border-color: transparent; color: var(--on-brand); }
.bubble.mine .meta b, .bubble.mine .meta { color: rgba(255, 255, 255, 0.75); }
.bubble.theirs { align-self: flex-start; }
/* FIX (2.0.1): the dashboard + admin actually render "is-mine"/
   "bubble-who"/"bubble-when" classes (support.php, user.php). These alias
   rules restore the intended styling that the old selectors never matched. */
.bubble.is-mine { align-self: flex-end; background: var(--grad-brand); border-color: transparent; color: var(--on-brand); }
.bubble .bubble-who { display: block; font-size: 0.78rem; font-weight: 700; color: var(--text-2); margin-bottom: 5px; }
.bubble .bubble-when { display: block; font-size: 0.74rem; color: var(--text-3); margin-top: 6px; }
.bubble.is-mine .bubble-who, .bubble.is-mine .bubble-when { color: rgba(255, 255, 255, 0.75); }
.bubble.is-theirs { align-self: flex-start; }

/* ---------- Misc ---------- */
.empty {
  text-align: center; padding: 44px 20px; color: var(--text-3);
}
.empty svg { width: 44px; height: 44px; margin: 0 auto 12px; opacity: 0.5; }
.empty b { display: block; color: var(--text-2); font-size: 1rem; margin-bottom: 4px; }

.toast-stack {
  position: fixed; inset-block-end: 18px; inset-inline-end: 18px; z-index: 90;
  display: flex; flex-direction: column; gap: 10px; max-width: min(92vw, 380px);
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--card); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-2);
  padding: 13px 16px; font-size: 0.9rem; font-weight: 500;
  animation: rc-toast-in 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.toast.is-ok { border-inline-start: 3px solid var(--green); }
.toast.is-err { border-inline-start: 3px solid var(--red); }
@keyframes rc-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--card-2) 50%, var(--bg-3) 75%);
  background-size: 200% 100%;
  animation: rc-shimmer 1.3s infinite;
}
@keyframes rc-shimmer { to { background-position: -200% 0; } }

.callout {
  display: flex; gap: 12px; align-items: flex-start;
  background: color-mix(in srgb, var(--brand) 8%, var(--card));
  border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
  border-radius: var(--radius); padding: 16px 18px;
}
.callout svg { width: 20px; height: 20px; color: var(--brand); flex: none; margin-top: 2px; }
.callout b { display: block; font-size: 0.94rem; margin-bottom: 2px; }
.callout p { font-size: 0.88rem; color: var(--text-2); }

.divider { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 18px; font-size: 0.92rem; }
.kv dt { color: var(--text-3); font-weight: 600; }
.kv dd { color: var(--text); word-break: break-word; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 10px; } }

/* Search input with icon */
.search-box { position: relative; flex: 1; min-width: 180px; max-width: 420px; }
.search-box .control { padding-inline-start: 40px; }
.search-box svg {
  position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--text-3); pointer-events: none;
}

/* ---------- Responsive: sidebar becomes drawer ---------- */
.sidebar.is-mobile { display: none; }
.back-label { display: none; }
.lang-wrap { display: inline-flex; }

.scrim {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(4, 10, 22, 0.6); backdrop-filter: blur(2px);
  animation: rc-fade 0.25s ease both;
}
@keyframes rc-fade { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 960px) {
  /* Desktop sidebar is replaced by the drawer */
  .sidebar:not(.is-mobile) { display: none; }

  .sidebar.is-mobile {
    display: flex;
    position: fixed; z-index: 60; inset-block: 0; inset-inline-start: 0;
    width: min(84vw, 300px);
    transform: translateX(calc(var(--dir, 1) * -105%));
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s linear 0.3s;
    box-shadow: var(--shadow-2); height: 100dvh;
  }
  html[dir="rtl"] .sidebar.is-mobile { --dir: -1; }
  .sidebar.is-mobile.is-open {
    transform: none;
    visibility: visible;
    transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
  }
  .burger { display: inline-flex; }
  .back-label { display: inline; }
}

@media (max-width: 560px) {
  .lang-wrap { display: none; }
  .back-label { display: none; }
}

@media (max-width: 640px) {
  .card-pad, .card-b { padding: 16px; }
  .card-h { padding: 14px 16px; }
  .row-item { padding: 13px 16px; }
  .thread { padding: 16px; }
  .bubble { max-width: 94%; }
  .tbl th, .tbl td { padding-inline: 16px; }
  .btn { --btn-h: 48px; }
  .toast-stack { inset-inline: 12px; inset-block-end: 12px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------- Installer wizard ---------------- */

.inst-steps {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.inst-step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-3);
  font-size: 0.8rem;
  white-space: nowrap;
}
.inst-step-n {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--line);
  color: var(--text-2);
  font-size: 0.72rem;
  font-weight: 700;
}
.inst-step.is-current {
  border-color: var(--brand, #0a7d55);
  color: var(--text-1);
}
.inst-step.is-current .inst-step-n { background: var(--brand, #0a7d55); color: #fff; }
.inst-step.is-done { color: var(--text-2); border-style: dashed; }
.inst-step.is-done .inst-step-n { background: transparent; border: 1px solid var(--line); }

@media (max-width: 640px) {
  .inst-steps { gap: 4px; }
  .inst-step { padding: 5px 8px; font-size: 0.72rem; }
}

/* ---------- Plan checkout (dashboard/checkout.php) ---------- */
.auth-plan-note {
  display: flex; gap: 9px; align-items: center;
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 32%, transparent);
  color: var(--brand-2, var(--brand));
  border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 0.9rem; font-weight: 600;
  margin-bottom: 18px;
}
.ck-summary {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 18px;
}
.ck-summary-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 16px; padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.ck-summary-row:last-child { border-bottom: 0; }
.ck-summary-row:nth-child(odd) { background: color-mix(in srgb, var(--bg-3, var(--card-2)) 45%, transparent); }
.ck-summary-label { color: var(--text-3); font-size: 0.86rem; flex: none; }
.ck-summary-desc { color: var(--text-2); font-size: 0.88rem; text-align: end; }
.ck-summary-total { align-items: center; }
.ck-summary-price { font-size: 1.35rem; color: var(--text); }
.ck-summary-price small { font-size: 0.82rem; color: var(--text-3); font-weight: 600; }

.ck-pick { display: grid; gap: 10px; }
.ck-pick-item {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; color: var(--text);
  transition: border-color 0.2s, background-color 0.2s, transform 0.2s;
}
.ck-pick-item:hover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); transform: translateY(-1px); }
.ck-pick-item:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.ck-pick-info { display: grid; gap: 3px; min-width: 0; }
.ck-pick-info b { font-size: 0.97rem; }
.ck-pick-info span { color: var(--text-3); font-size: 0.84rem; overflow-wrap: anywhere; }
.ck-pick-price { flex: none; font-weight: 700; font-size: 1.05rem; }
.ck-pick-price small { font-size: 0.8rem; color: var(--text-3); }

@media (max-width: 560px) {
  .ck-summary-row { flex-direction: column; gap: 4px; padding: 10px 14px; }
  .ck-summary-desc { text-align: start; }
  .ck-pick-item { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ============================================================
   2.2.0 — Payment details (orders tables) + admin gateway editor
   ============================================================ */
.paydet-cell { margin-top: 6px; }
details.paydet { border: 1px solid var(--line, #e3e8f1); border-radius: 10px; background: var(--card-2, #f6f8fb); }
details.paydet > summary {
  cursor: pointer; padding: 7px 10px;
  font-size: .78rem; font-weight: 700; color: var(--brand, #004e99);
  list-style: none; display: flex; align-items: center; gap: 6px;
}
details.paydet > summary::-webkit-details-marker { display: none; }
details.paydet > summary::before { content: "▸"; font-size: .7rem; transition: transform .15s ease; }
details.paydet[open] > summary::before { transform: rotate(90deg); }
.paydet-body { padding: 4px 10px 10px; display: grid; gap: 6px; border-top: 1px dashed var(--line, #e3e8f1); }
.paydet-row { display: flex; justify-content: space-between; gap: 12px; font-size: .8rem; }
.paydet-row > span { color: var(--text-3, inherit); flex: none; }
.paydet-row > b { text-align: end; word-break: break-word; }

details.adm-gw {
  border: 1px solid var(--line, #e3e8f1); border-radius: 12px;
  background: var(--card-2, #f6f8fb);
  margin: 12px 0 0; padding: 10px 14px;
}
details.adm-gw > summary {
  cursor: pointer; font-weight: 700; font-size: .9rem;
  color: var(--text, inherit); list-style: none;
  display: flex; align-items: center; gap: 8px;
}
details.adm-gw > summary::-webkit-details-marker { display: none; }
details.adm-gw > summary::before {
  content: "▸"; color: var(--brand, #004e99); font-size: .75rem;
  transition: transform .15s ease;
}
details.adm-gw[open] > summary::before { transform: rotate(90deg); }
details.adm-gw.adm-gw-creds { margin-top: 10px; }

/* ---------- 5.4.0 — marketing consent checkbox (register form) ---------- */
.auth-consent {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 2px 0 16px; font-size: 0.86rem; line-height: 1.55;
  color: var(--text-2); cursor: pointer; text-align: start;
}
.auth-consent input {
  width: 17px; height: 17px; margin-top: 1px; flex: none;
  accent-color: var(--brand); cursor: pointer;
}
.auth-consent:hover { color: var(--text-1, var(--text)); }

/* ---------- 5.5.0 — registration upgrade: phone, pw toggle, inline
   errors, consent rows, submit lock, pitch v2 ---------- */

/* phone input always reads left-to-right, even on the Arabic page */
.control-ltr { direction: ltr; text-align: start; }
[dir="rtl"] .control-ltr { text-align: left; }

/* password show/hide */
.field-pw .pw-wrap { position: relative; }
.field-pw .pw-wrap .control { padding-inline-end: 46px; }
.pw-toggle {
  position: absolute; inset-inline-end: 7px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-3, #8b97a8); cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.pw-toggle:hover { color: var(--text-1, var(--text)); background: color-mix(in srgb, var(--brand) 8%, transparent); }
.pw-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.pw-toggle[aria-pressed="true"] { color: var(--brand); }

/* inline field errors (client) — never replace the server-side banner */
.field-err {
  display: none; margin-top: 6px; font-size: 0.8rem; line-height: 1.5;
  color: var(--red, #E53935); font-weight: 600;
}
.field-err:not(:empty) { display: flex; gap: 6px; align-items: baseline; }
.field-err:not(:empty)::before { content: "⚠"; font-size: .85em; flex: none; }
.control.is-invalid { border-color: var(--red, #E53935); }
.control.is-invalid:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--red, #E53935) 18%, transparent); }

/* mandatory consent row carries a subtle emphasis, stays honest: NOT pre-ticked */
.consent-required {
  padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1px dashed color-mix(in srgb, var(--brand) 34%, transparent);
  background: color-mix(in srgb, var(--brand) 6%, transparent);
  margin-bottom: 12px;
}
.auth-consent a { color: var(--brand); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.auth-consent a:hover { color: var(--brand-deep, var(--brand)); }

/* submit lock + spinner */
.btn[data-loading="1"] { pointer-events: none; opacity: .82; }
.btn[data-loading="1"] .btn-label { display: inline-flex; align-items: center; gap: 9px; }
.btn[data-loading="1"] .btn-label::before {
  content: ""; width: 15px; height: 15px; flex: none; border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor; animation: rc-spin .7s linear infinite;
}
@keyframes rc-spin { to { transform: rotate(360deg); } }

/* register pitch: value checklist + trust row */
.pitch-get {
  margin: 0 0 12px; font-size: 0.82rem; font-weight: 800;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-3, var(--text-2));
}
.pitch-trust {
  display: flex; align-items: flex-start; gap: 9px;
  margin: 18px 0 0; padding-top: 15px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem; line-height: 1.6; color: var(--text-3, var(--text-2));
}
.pitch-trust svg { flex: none; margin-top: 2px; color: var(--green, #0e9f6e); }

/* keep the wide register card readable on mid screens */
@media (min-width: 1080px) {
  .auth-shell .auth-card-wide { max-width: 520px; }
}
@media (max-width: 420px) {
  .auth-consent { font-size: 0.84rem; }
  .pw-toggle { width: 30px; height: 30px; }
}
