/* ============================================================================
 *  فبريكا — css/main.css
 * ============================================================================
 *  الأنماط النووية + أنماط الصفحة الرئيسية:
 *    الرموز التصميمية، إعادة الضبط، الأساسيات، التخطيط، المكوّنات العامة
 *    (الأزرار، الهيدر، البطل، محرك البحث، اللوحة المصرية، الأقسام، البطاقات،
 *     المساحات الإعلانية، enhancements) وطبقة الاستجابة.
 *
 *  أنماط المصادقة موجودة في css/auth.css (تُحمَّل بعد هذا الملف).
 *  أنماط لوحة التحكم موجودة في css/dashboard.css.
 * ========================================================================== */

/* ==========================================================================
   فبريكا — Design System
   Premium, minimal, trust-forward UI for an independent vehicle-inspection
   platform. Teal/emerald branding, soft depth, glass surfaces, RTL-first.
   --------------------------------------------------------------------------
   NOTE: Google Fonts are imported here so index.html stays untouched.
         For best performance move these to <link> tags with preconnect
         in the <head> of index.html.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Tajawal:wght@400;500;700;800;900&display=swap");

/* --------------------------------------------------------------------------
   CASCADE LAYERS — explicit ordering keeps specificity predictable
   -------------------------------------------------------------------------- */
@layer reset, tokens, base, layout, components, utilities;

.form-field-error {
  display: block;
  margin-block-start: 0.35rem;
  color: #b91c1c;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.form-field-error[hidden] { display: none; }
[aria-invalid="true"] { border-color: #dc2626 !important; }

/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */
@layer tokens {
  :root {
    /* --- Teal: primary brand / CTAs (high trust, calm authority) --- */
    --teal-50:  #F0FDFA;
    --teal-100: #CCFBF1;
    --teal-200: #99F6E4;
    --teal-300: #5EEAD4;
    --teal-400: #2DD4BF;
    --teal-500: #14B8A6;
    --teal-600: #0D9488;
    --teal-700: #0F766E;
    --teal-800: #115E59;
    --teal-900: #134E4A;

    /* --- Emerald: verified badges & positive states --- */
    --emerald-50:  #ECFDF5;
    --emerald-100: #D1FAE5;
    --emerald-200: #A7F3D0;
    --emerald-300: #6EE7B7;
    --emerald-400: #34D399;
    --emerald-500: #10B981;
    --emerald-600: #059669;
    --emerald-700: #047857;
    --emerald-800: #065F46;
    --emerald-900: #064E3B;

    /* --- Slate: crisp neutral typography & surfaces --- */
    --slate-50:  #F8FAFC;
    --slate-100: #F1F5F9;
    --slate-200: #E2E8F0;
    --slate-300: #CBD5E1;
    --slate-400: #94A3B8;
    --slate-500: #64748B;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1E293B;
    --slate-900: #0F172A;
    --slate-950: #020617;

    /* --- Semantic surface roles --- */
    --bg-canvas:    var(--slate-50);
    --bg-surface:   #FFFFFF;
    --bg-subtle:    var(--slate-100);
    --bg-muted:     var(--slate-50);
    --bg-inverse:   var(--slate-900);
    --border-subtle: var(--slate-200);
    --border-medium: var(--slate-300);
    --border-accent:  var(--teal-200);

    /* --- Text roles --- */
    --text-strong:  var(--slate-900);
    --text-body:    var(--slate-700);
    --text-muted:   var(--slate-500);
    --text-subtle:  var(--slate-400);
    --text-inverse: #FFFFFF;
    --text-brand:   var(--teal-700);

    /* --- Typography --- */
    --font-sans: "Inter", "Tajawal", "Segoe UI", "Noto Kufi Arabic", system-ui, -apple-system, sans-serif;
    --font-display: "Tajawal", "Inter", "Segoe UI", system-ui, sans-serif;
    --font-mono: "Inter", ui-monospace, "SFMono-Regular", Consolas, monospace;

    --fs-2xs: 0.6875rem;
    --fs-xs:  0.75rem;
    --fs-sm:  0.8125rem;
    --fs-md:  0.875rem;
    --fs-base:0.9375rem;
    --fs-lg:  1rem;
    --fs-xl:  1.125rem;
    --fs-2xl: 1.375rem;
    --fs-3xl: 1.75rem;
    --fs-4xl: 2.25rem;
    --fs-5xl: 3rem;

    --lh-tight: 1.2;
    --lh-snug:  1.4;
    --lh-normal:1.65;
    --lh-relaxed:1.85;

    /* --- Spacing scale --- */
    --sp-1: 0.25rem;  --sp-2: 0.5rem;   --sp-3: 0.75rem;  --sp-4: 1rem;
    --sp-5: 1.25rem;  --sp-6: 1.5rem;   --sp-7: 1.75rem;  --sp-8: 2rem;
    --sp-10: 2.5rem;  --sp-12: 3rem;    --sp-14: 3.5rem;  --sp-16: 4rem;
    --sp-20: 5rem;    --sp-24: 6rem;    --sp-32: 8rem;

    /* --- Radii --- */
    --r-xs:   6px;
    --r-sm:   8px;
    --r-md:   12px;
    --r-lg:   16px;
    --r-xl:   20px;
    --r-2xl:  28px;
    --r-3xl:  36px;
    --r-full: 9999px;

    /* --- Soft, layered elevation (low-contrast, premium) --- */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 2px 8px -2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 6px 16px -4px rgba(15, 23, 42, 0.07);
    --shadow-lg: 0 12px 32px -6px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 18px 40px -12px rgba(15, 23, 42, 0.14);
    --shadow-2xl: 0 32px 64px -24px rgba(15, 23, 42, 0.20);
    --shadow-brand: 0 12px 28px -10px rgba(15, 118, 110, 0.42);
    --shadow-brand-sm: 0 6px 16px -6px rgba(15, 118, 110, 0.36);
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.6);
    /* Hairline highlight for dark glass surfaces */
    --highlight-dark: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    --highlight-soft: inset 0 1px 0 rgba(255, 255, 255, 0.9);

    /* --- Glass surfaces --- */
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.55);
    --glass-blur: saturate(180%) blur(16px);

    /* --- Motion --- */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --t-fast: 150ms;
    --t-base: 250ms;
    --t-slow: 400ms;

    /* --- Layout --- */
    --container: 1200px;
    --container-wide: 1320px;
    --header-h: 76px;
    --gutter: var(--sp-6);

    /* --- Egyptian plate typography ---
       Tracking between the Arabic characters of a license plate, so they sit
       in their own evenly spaced cells like the real thing. The same value is
       reused for `text-indent`, which cancels the trailing letter-space and
       keeps the characters optically centred (RTL and LTR alike). */
    --plate-letter-spacing: 0.5rem;

    /* --- Focus --- */
    --focus-ring: 0 0 0 3px rgba(20, 184, 166, 0.35);
    --focus-ring-strong: 0 0 0 4px rgba(20, 184, 166, 0.45);
  }
}

/* ==========================================================================
   2. RESET
   ========================================================================== */
@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  * {
    margin: 0;
    padding: 0;
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + var(--sp-4));
    -webkit-tap-highlight-color: transparent;
  }

  body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
  }

  ul, ol {
    list-style: none;
  }

  img, svg, video, canvas, picture {
    display: block;
    max-width: 100%;
    height: auto;
  }

  input, button, textarea, select {
    font: inherit;
    color: inherit;
  }

  button {
    background: none;
    border: 0;
    cursor: pointer;
  }

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

  table {
    border-collapse: collapse;
  }
}

/* ==========================================================================
   3. BASE
   ========================================================================== */
@layer base {
  body {
    background-color: var(--bg-canvas);
    color: var(--text-body);
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    font-weight: 400;
    line-height: var(--lh-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  /* Arabic-first display type: Tajawal reads better at large sizes */
  h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--text-strong);
    font-weight: 800;
    line-height: var(--lh-tight);
    letter-spacing: -0.02em;
    text-wrap: balance;
  }

  p {
    text-wrap: pretty;
  }

  strong {
    font-weight: 700;
    color: var(--text-strong);
  }

  code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    direction: ltr;
    display: inline-block;
    background: var(--slate-100);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-xs);
    padding: 0.15em 0.45em;
  }

  ::selection {
    background: var(--teal-100);
    color: var(--teal-900);
  }

  /* --- Focus: high-contrast, always visible --- */
  :focus-visible {
    outline: 2px solid var(--teal-600);
    outline-offset: 2px;
    border-radius: var(--r-xs);
  }

  /* --- Scrollbar (WebKit) --- */
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--slate-300) transparent;
  }

  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  ::-webkit-scrollbar-track {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: var(--r-full);
    border: 3px solid var(--bg-canvas);
  }

  ::-webkit-scrollbar-thumb:hover {
    background: var(--slate-400);
  }
}

/* ==========================================================================
   4. LAYOUT
   ========================================================================== */
@layer layout {
  .container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }
}

/* ==========================================================================
   5. UTILITIES
   ========================================================================== */
@layer utilities {
  .visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .skip-link {
    position: absolute;
    top: var(--sp-3);
    inset-inline-start: 50%;
    transform: translate(50%, -200%);
    z-index: 999;
    padding: var(--sp-3) var(--sp-6);
    background: var(--teal-700);
    color: var(--text-inverse);
    font-size: var(--fs-md);
    font-weight: 700;
    border-radius: var(--r-full);
    box-shadow: var(--shadow-xl);
    transition: transform var(--t-base) var(--ease-out);
  }

  .skip-link:focus {
    transform: translate(50%, 0);
  }
}

/* ==========================================================================
   5. COMPONENTS — Buttons
   ========================================================================== */
@layer components {
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    min-height: 44px;
    max-width: 100%;
    padding: 0.7rem 1.35rem;
    border-radius: var(--r-full);
    border: 1px solid transparent;
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.01em;
    white-space: normal;
    overflow-wrap: anywhere;
    cursor: pointer;
    user-select: none;
    transition:
      transform var(--t-base) var(--ease),
      box-shadow var(--t-base) var(--ease),
      background-color var(--t-base) var(--ease),
      border-color var(--t-base) var(--ease),
      color var(--t-base) var(--ease);
  }

  .btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring-strong);
  }

  /* --- Primary: teal gradient CTA --- */
  .btn--primary {
    background: linear-gradient(135deg, var(--teal-700) 0%, var(--teal-800) 55%, var(--teal-900) 100%);
    color: var(--text-inverse);
    box-shadow: var(--shadow-brand-sm);
  }

  .btn--primary:hover {
    color: var(--text-inverse);
    transform: translateY(-2px);
    box-shadow: var(--shadow-brand);
  }

  .btn--primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-xs);
  }

  /* --- Secondary: soft outline --- */
  .btn--secondary {
    background: var(--bg-surface);
    color: var(--text-brand);
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-xs);
  }

  .btn--secondary:hover {
    border-color: var(--teal-300);
    background: var(--teal-50);
    color: var(--teal-800);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }

  /* --- Gold: premium CTA (featured center upgrade) --- */
  .btn--gold {
    background: linear-gradient(135deg, #fbbf24, #b7791f);
    color: #241505;
    border-color: #b7791f;
  }

  .btn--gold:hover {
    color: #241505;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(180, 126, 10, .28);
  }

  .btn[disabled],
  .btn[aria-disabled="true"] {
    opacity: 0.72;
    cursor: not-allowed;
    filter: saturate(0.65);
  }

  /* Ghost buttons are also used on light surfaces, not only in the dark header. */
  .btn--ghost {
    background: var(--bg-surface);
    color: var(--teal-800);
    border-color: var(--teal-300);
  }

  .btn--ghost:hover {
    background: var(--teal-50);
    color: var(--teal-900);
    border-color: var(--teal-500);
  }

  .site-header .btn--ghost,
  .auth-page__header .btn--ghost {
    background: rgba(255, 255, 255, 0.08);
    color: var(--slate-100);
    border-color: rgba(148, 163, 184, 0.45);
  }

  .site-header .btn--ghost:hover,
  .auth-page__header .btn--ghost:hover {
    background: rgba(45, 212, 191, 0.20);
    color: #FFFFFF;
    border-color: rgba(94, 234, 212, 0.75);
  }

  /* ==========================================================================
     6. COMPONENTS — Header / Navbar
     --------------------------------------------------------------------------
     Sleek dark glass bar: deep slate surface + teal accent lighting.
     ========================================================================== */
  .site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.94) 0%, rgba(15, 23, 42, 0.82) 100%);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 12px 32px -6px rgba(0, 0, 0, 0.06), var(--highlight-dark);
    transition: box-shadow var(--t-base) var(--ease),
                background-color var(--t-base) var(--ease);
  }

  /* Teal light-bleed along the bottom edge of the bar */
  .site-header::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(45, 212, 191, 0.55), transparent);
    pointer-events: none;
  }

  .navbar {
    position: relative;
    flex: 1 1 auto;
  }

  .navbar__inner {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: var(--sp-4);
    min-height: var(--header-h);
    padding-block: var(--sp-2);
  }

  .navbar__brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
  }

  /* ==========================================================================
   * SHARED HEADER — يستخدم في login.html و dashboard.html
   * --------------------------------------------------------------------------
   * كل الصفحات تشترك في هيدر داكن واحد (شريط زجاجي عميق) لضمان الهوية
   * البصرية الموحّدة وتباين عالٍ للنصوص الفاتحة فوق الخلفية الداكنة.
   * ملاحظة: لا تُكرَّر خصائص background هنا — فهي معرَّفة في القاعدة أعلاه
   * (L446) حتى لا تتعارض نسختان من .site-header.
   * ========================================================================== */
  .site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-5);
    min-height: var(--header-h);
    padding-block: var(--sp-3);
  }

  .site-nav {
    display: flex;
    align-items: center;
    gap: var(--sp-5);
    margin-inline-start: auto;
  }

  /* روابط التنقل فوق خلفية داكنة — نص فاتح عالي التباين */
  .site-nav__link {
    position: relative;
    display: block;
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-full);
    color: rgba(226, 232, 240, 0.78);
    font-size: var(--fs-md);
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    transition: color var(--t-base) var(--ease),
                background-color var(--t-base) var(--ease);
  }

  .site-nav__link:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.08);
  }

  .site-nav__link[aria-current="page"] {
    color: var(--teal-200);
    background: rgba(45, 212, 191, 0.12);
    font-weight: 700;
  }

  .site-nav__link:focus-visible {
    outline: 2px solid var(--teal-400);
    outline-offset: 2px;
  }

  .site-header__actions {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex-shrink: 0;
  }

  /* شعار مضغوط يُستخدم في الصفحات الفرعية (نفس هوية الشعار الرئيسي) */
  .brand__mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: var(--r-md);
    background: linear-gradient(140deg, var(--teal-400) 0%, var(--teal-600) 45%, var(--emerald-700) 100%);
    color: var(--text-inverse);
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 900;
    box-shadow: var(--shadow-brand-sm), var(--highlight-dark);
  }

  /* Shared navigation stays reachable on small screens as a scrollable row. */
  @media (max-width: 860px) {
    body:has(.site-nav) {
      --header-h: 112px;
    }

    .site-header__inner {
      flex-wrap: wrap;
      gap: var(--sp-2) var(--sp-3);
      padding-block: var(--sp-2);
    }

    .site-nav {
      order: 3;
      width: 100%;
      margin-inline-start: 0;
      gap: var(--sp-2);
      padding-block: var(--sp-1) var(--sp-2);
      overflow-x: auto;
      overscroll-behavior-inline: contain;
      scrollbar-width: thin;
      scrollbar-color: rgba(45, 212, 191, 0.55) transparent;
      -webkit-overflow-scrolling: touch;
    }

    .site-nav__link {
      flex: 0 0 auto;
      padding: var(--sp-2) var(--sp-3);
      font-size: var(--fs-sm);
    }

    .site-header__actions {
      margin-inline-start: auto;
    }
  }

  /* --- Brand lockup --- */
  .brand {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-3);
    transition: opacity var(--t-base) var(--ease);
  }

  .brand:hover {
    opacity: 0.9;
  }

  .brand__logo {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: var(--r-md);
    background: linear-gradient(140deg, var(--teal-400) 0%, var(--teal-600) 45%, var(--emerald-700) 100%);
    color: var(--text-inverse);
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 900;
    box-shadow: var(--shadow-brand-sm), var(--highlight-dark);
    transition: transform var(--t-base) var(--ease-spring),
                box-shadow var(--t-base) var(--ease);
  }

  .brand:hover .brand__logo {
    transform: scale(1.06) rotate(-3deg);
    box-shadow: var(--shadow-brand);
  }

  .brand__name {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    white-space: nowrap;
    background: linear-gradient(120deg, #FFFFFF 0%, var(--teal-200) 55%, var(--emerald-300) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  /* --- Primary nav --- */
  .navbar__nav {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    margin-inline-end: auto;
  }

  .navbar__nav a {
    position: relative;
    display: block;
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-full);
    color: rgba(226, 232, 240, 0.76);
    font-size: var(--fs-md);
    font-weight: 500;
    /* Nav labels must never wrap onto a second line */
    white-space: nowrap;
    transition: color var(--t-base) var(--ease),
                background-color var(--t-base) var(--ease);
  }

  .navbar__nav a::after {
    content: "";
    position: absolute;
    bottom: 6px;
    inset-inline-start: 50%;
    width: 0;
    height: 2px;
    border-radius: var(--r-full);
    background: linear-gradient(90deg, var(--teal-400), var(--emerald-400));
    transform: translateX(50%);
    transition: width var(--t-base) var(--ease-out);
  }

  .navbar__nav a:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.08);
  }

  .navbar__nav a:hover::after {
    width: 55%;
  }

  .navbar__nav a[aria-current="page"] {
    color: var(--teal-200);
    background: rgba(45, 212, 191, 0.12);
    font-weight: 600;
  }

  .navbar__nav a[aria-current="page"]::after {
    width: 55%;
  }

  /* --- Actions --- */
  .navbar__actions {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex-shrink: 0;
  }

  .navbar__cta {
    padding: 0.6rem 1.25rem;
    font-size: var(--fs-md);
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 10px 26px -10px rgba(13, 148, 136, 0.85), var(--highlight-dark);
  }

  .navbar__cta:hover {
    box-shadow: 0 16px 34px -10px rgba(13, 148, 136, 0.95), var(--highlight-dark);
  }

  /* المدخل الموحّد للشراكة داخل شريط التنقل (بدل تكرار زر + رابط). */
  .navbar__nav .navbar__nav-cta {
    border: 1px solid rgba(45, 212, 191, 0.5);
    border-radius: var(--r-full);
    background: rgba(45, 212, 191, 0.12);
    color: var(--teal-100, #ccfbf1);
    font-weight: 700;
  }

  .navbar__nav .navbar__nav-cta:hover {
    background: rgba(45, 212, 191, 0.24);
    color: #ffffff;
  }

  .navbar__nav .navbar__nav-cta::after {
    display: none;
  }

  /* --- قائمة الملف الشخصي (تظهر بعد تسجيل الدخول) --- */
  .navbar__session {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    min-width: 0;
    max-width: 100%;
  }

  .navbar__actions {
    min-width: 0;
    flex-shrink: 1;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .navbar__profile {
    min-width: 0;
    max-width: 260px;
  }

  .navbar__profile-meta {
    min-width: 0;
    overflow: hidden;
  }

  .navbar__profile-name,
  .navbar__profile-role {
    display: block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .navbar__session[hidden] {
    display: none;
  }

  /* --------------------------------------------------------------------------
     حالة المصادقة في الهيدر: [hidden] يتغلّب دائمًا على أي display آخر
     (زر الدخول، رابط الدخول، بطاقة المستخدم) حتى تتبدّل الحالة فورًا
     عند الدخول/الخروج بلا إعادة تحميل الصفحة.
     ------------------------------------------------------------------------ */
  .navbar__login[hidden],
  .navbar__actions [data-auth-login][hidden],
  .site-header__actions [data-auth-login][hidden],
  .navbar__actions [data-auth-session][hidden],
  .site-header__actions [data-auth-session][hidden],
  .erp-header [data-auth-session][hidden],
  .erp-header [data-auth-login][hidden],
  .partner-header [data-auth-session][hidden],
  .partner-header [data-auth-login][hidden] {
    display: none !important;
  }

  /* بطاقة المستخدم داخل هيدر ERP/الشريك — نفس مظهر شريط التنقل الرئيسي. */
  .erp-header .navbar__session,
  .partner-header .navbar__session,
  .site-header__actions .navbar__session {
    margin-inline-start: var(--sp-2);
  }

  .erp-header .navbar__profile,
  .partner-header .navbar__profile {
    border-color: rgba(148, 163, 184, 0.35);
  }

  /* زر الفتح */
  .navbar__profile {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-3) var(--sp-1) var(--sp-1);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: var(--r-full);
    background: rgba(255, 255, 255, 0.08);
    color: inherit;
    font-family: inherit;
    cursor: pointer;
    transition: background-color var(--t-base) var(--ease),
                border-color var(--t-base) var(--ease);
  }

  .navbar__profile:hover,
  .navbar__profile.is-open {
    background: rgba(45, 212, 191, 0.16);
    border-color: rgba(45, 212, 191, 0.5);
  }

  .navbar__profile:focus-visible {
    outline: 2px solid var(--teal-400);
    outline-offset: 2px;
  }

  .navbar__profile-avatar {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: var(--r-full);
    background: linear-gradient(135deg, var(--teal-600), var(--teal-700));
    color: #FFFFFF;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 900;
  }

  .navbar__profile-avatar--lg {
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
  }

  .navbar__profile-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    text-align: start;
  }

  .navbar__profile-name {
    color: #FFFFFF;
    font-size: var(--fs-sm);
    font-weight: 700;
    white-space: nowrap;
  }

  .navbar__profile-role {
    color: var(--teal-200);
    font-size: var(--fs-2xs);
    font-weight: 600;
    white-space: nowrap;
  }

  .navbar__profile-caret {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    color: var(--slate-400);
    transition: transform var(--t-base) var(--ease);
  }

  .navbar__profile.is-open .navbar__profile-caret {
    transform: rotate(180deg);
  }

  /* القائمة المنسدلة */
  .navbar__profile-menu {
    position: absolute;
    top: calc(100% + var(--sp-2));
    inset-inline-end: 0;
    z-index: 120;
    min-width: 230px;
    padding: var(--sp-2);
    background: var(--slate-900);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: var(--r-lg);
    box-shadow: 0 20px 44px -12px rgba(0, 0, 0, 0.55);
  }

  .navbar__profile-menu[hidden] {
    display: none;
  }

  .navbar__profile-head {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    margin-bottom: var(--sp-2);
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  }

  .navbar__profile-head > span:last-child {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
  }

  .navbar__profile-link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    width: 100%;
    padding: var(--sp-3);
    border: 0;
    border-radius: var(--r-md);
    background: transparent;
    color: var(--slate-200);
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: 600;
    text-align: start;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--t-fast) var(--ease),
                color var(--t-fast) var(--ease);
  }

  .navbar__profile-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
  }

  .navbar__profile-link:focus-visible {
    outline: 2px solid var(--teal-400);
    outline-offset: -2px;
  }

  .navbar__profile-link--danger {
    color: #FCA5A5;
  }

  .navbar__profile-link--danger:hover {
    background: rgba(248, 113, 113, 0.14);
    color: #FECACA;
  }

  .navbar__profile-link-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    font-size: 15px;
  }

  .navbar__profile-link-icon svg {
    width: 16px;
    height: 16px;
  }

  /* ==========================================================================
   * LEGAL PAGE — صفحة الشروط والسياسات
   * ========================================================================== */
  .legal-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-canvas);
  }

  .legal-main {
    flex: 1 1 auto;
    padding-block: var(--sp-12) var(--sp-16);
  }

  .legal-container {
    max-width: 820px;
  }

  .legal-head {
    margin-bottom: var(--sp-8);
  }

  .legal-title {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 900;
    letter-spacing: -0.025em;
    margin-bottom: var(--sp-3);
  }

  .legal-lead {
    color: var(--text-muted);
    font-size: var(--fs-lg);
    line-height: var(--lh-relaxed);
  }

  .legal-toc {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    margin-bottom: var(--sp-8);
    padding: var(--sp-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg);
  }

  .legal-toc__link {
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--r-full);
    background: var(--slate-50);
    color: var(--teal-700);
    font-size: var(--fs-sm);
    font-weight: 700;
    text-decoration: none;
    transition: background-color var(--t-fast) var(--ease),
                color var(--t-fast) var(--ease);
  }

  .legal-toc__link:hover {
    background: var(--teal-50);
    color: var(--teal-900);
  }

  .legal-toc__link:focus-visible {
    outline: 2px solid var(--teal-500);
    outline-offset: 2px;
  }

  .legal-section {
    margin-bottom: var(--sp-10);
    scroll-margin-top: calc(var(--header-h) + var(--sp-4));
  }

  .legal-section__title {
    font-size: var(--fs-2xl);
    font-weight: 900;
    margin-bottom: var(--sp-4);
    padding-bottom: var(--sp-3);
    border-bottom: 1px solid var(--border-subtle);
  }

  .legal-section p {
    color: var(--text-body);
    font-size: var(--fs-md);
    line-height: var(--lh-relaxed);
    margin-bottom: var(--sp-4);
  }

  .legal-section ul {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    padding-inline-start: var(--sp-6);
  }

  .legal-section li {
    color: var(--text-muted);
    font-size: var(--fs-md);
    line-height: var(--lh-relaxed);
  }

  .legal-section code {
    padding: 2px var(--sp-2);
    border-radius: var(--r-xs);
    background: var(--slate-100);
    color: var(--teal-800);
    font-family: var(--font-mono);
    font-size: 0.9em;
    direction: ltr;
    unicode-bidi: embed;
  }

  /* --- Language switcher: segmented control (dark) --- */
  .lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: var(--r-full);
    box-shadow: var(--highlight-dark);
  }

  .lang-switcher__label {
    padding-inline: var(--sp-3) var(--sp-2);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--slate-400);
  }

  .lang-switcher__btn {
    padding: 0.32rem 0.8rem;
    border-radius: var(--r-full);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--slate-300);
    transition: background-color var(--t-fast) var(--ease),
                color var(--t-fast) var(--ease),
                box-shadow var(--t-fast) var(--ease);
  }

  .lang-switcher__btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
  }

  .lang-switcher__btn.is-active {
    background: linear-gradient(135deg, var(--teal-700), var(--teal-800));
    color: #FFFFFF;
    box-shadow: var(--shadow-brand-sm);
  }

  /* Ghost buttons inside the dark header retain their glass treatment. */
  .site-header .btn--ghost {
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: var(--highlight-dark);
  }

  .site-header .btn--ghost:active {
    transform: translateY(0);
  }

  /* ==========================================================================
     6b. COMPONENTS — Auth Modal (login / register)
     --------------------------------------------------------------------------
     The dialog markup lives at the end of <body> and ships hidden. JS only has
     to remove the [hidden] attribute and toggle .is-active between views.
     ========================================================================== */
  .navbar__login {
    padding: 0.6rem 1rem;
    font-size: var(--fs-md);
    font-weight: 600;
    white-space: nowrap;
  }

  .navbar__login-icon {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
  }


  /* --- Mobile toggle --- */
  .navbar__toggle {
    display: none;
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: var(--r-md);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: var(--highlight-dark);
    transition: background-color var(--t-base) var(--ease),
                border-color var(--t-base) var(--ease);
  }

  .navbar__toggle:hover {
    background: rgba(45, 212, 191, 0.16);
    border-color: rgba(45, 212, 191, 0.45);
  }

  .navbar__toggle span,
  .navbar__toggle span::before,
  .navbar__toggle span::after {
    position: absolute;
    inset-inline-start: 50%;
    width: 18px;
    height: 2px;
    border-radius: var(--r-full);
    background: var(--slate-200);
    transform: translateX(50%);
    transition: transform var(--t-base) var(--ease),
                opacity var(--t-fast) var(--ease);
  }

  .navbar__toggle span {
    top: 50%;
    margin-top: -1px;
  }

  .navbar__toggle span::before,
  .navbar__toggle span::after {
    content: "";
    inset-inline-start: 0;
    transform: none;
  }

  .navbar__toggle span::before { top: -6px; }
  .navbar__toggle span::after  { top: 6px; }

  .navbar__toggle[aria-expanded="true"] span {
    background: transparent;
  }

  .navbar__toggle[aria-expanded="true"] span::before {
    top: 0;
    transform: rotate(45deg);
  }

  .navbar__toggle[aria-expanded="true"] span::after {
    top: 0;
    transform: rotate(-45deg);
  }
}

/* ==========================================================================
   7. COMPONENTS — Hero
   ========================================================================== */
@layer components {
  .hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding-block: var(--sp-20) var(--sp-24);
    background:
      radial-gradient(60rem 40rem at 85% -8%, rgba(20, 184, 166, 0.16) 0%, transparent 62%),
      radial-gradient(50rem 34rem at 8% 4%, rgba(16, 185, 129, 0.13) 0%, transparent 58%),
      var(--bg-canvas);
  }

  /* Fine grid mesh for a "data platform" texture */
  .hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image:
      linear-gradient(to right, rgba(15, 118, 110, 0.05) 1px, transparent 1px),
      linear-gradient(to bottom, rgba(15, 118, 110, 0.05) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 0%, #000 0%, transparent 78%);
    mask-image: radial-gradient(ellipse 75% 65% at 50% 0%, #000 0%, transparent 78%);
    pointer-events: none;
  }

  .hero__inner {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: var(--sp-16);
    align-items: start;
  }

  .hero__content {
    min-width: 0;
  }

  /* --- Eyebrow pill with live-dot --- */
  .hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4) var(--sp-2) var(--sp-3);
    margin-bottom: var(--sp-6);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-full);
    box-shadow: var(--shadow-sm);
    color: var(--teal-800);
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: -0.01em;
  }

  .hero__eyebrow::before {
    content: "";
    width: 7px;
    height: 7px;
    flex-shrink: 0;
    border-radius: var(--r-full);
    background: var(--emerald-500);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
    animation: pulse-dot 2.4s var(--ease) infinite;
  }

  @keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
    50%      { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.05); }
  }

  /* --- Headline --- */
  .hero__title {
    font-size: clamp(2.15rem, 5.2vw, 3.5rem);
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -0.035em;
    margin-bottom: var(--sp-5);
  }

  .hero__title-accent {
    background: linear-gradient(120deg, var(--teal-600) 0%, var(--emerald-500) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  .hero__subtitle {
    font-size: clamp(1rem, 1.5vw, 1.125rem);
    line-height: var(--lh-relaxed);
    color: var(--text-muted);
    max-width: 54ch;
    margin-bottom: var(--sp-10);
  }

  /* ======================================================================
     8. COMPONENTS — Search Console (premium fintech feel)
     ====================================================================== */
  .search-box {
    position: relative;
    max-width: 640px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-2xl);
    box-shadow: 0 12px 32px -6px rgba(0, 0, 0, 0.06), 0 2px 8px -2px rgba(15, 23, 42, 0.05), var(--highlight-soft);
    overflow: hidden;
    transition: box-shadow var(--t-slow) var(--ease);
  }

  .search-box::before {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--teal-500), var(--emerald-400), var(--teal-600));
    opacity: 0.9;
  }

  .search-box:focus-within {
    box-shadow: 0 24px 56px -18px rgba(15, 118, 110, 0.28), 0 0 0 4px rgba(20, 184, 166, 0.14);
  }

  /* --- Tab strip: segmented, premium --- */
  .search-tabs {
    position: relative;
    display: flex;
    gap: var(--sp-1);
    padding: var(--sp-2);
    background: var(--slate-50);
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .search-tabs::-webkit-scrollbar {
    display: none;
  }

  .search-tab {
    position: relative;
    flex: 1 1 auto;
    padding: var(--sp-3) var(--sp-5);
    border-radius: var(--r-lg);
    color: var(--text-muted);
    font-size: var(--fs-md);
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
    transition: color var(--t-base) var(--ease),
                background-color var(--t-base) var(--ease),
                box-shadow var(--t-base) var(--ease);
  }

  .search-tab:hover {
    color: var(--teal-700);
    background: rgba(255, 255, 255, 0.7);
  }

  .search-tab.is-active {
    background: var(--bg-surface);
    color: var(--teal-800);
    font-weight: 700;
    box-shadow: var(--shadow-sm), var(--shadow-inset);
  }

  .search-tab.is-active::after {
    content: "";
    position: absolute;
    bottom: 0;
    inset-inline: 28%;
    height: 2.5px;
    border-radius: var(--r-full);
    background: linear-gradient(90deg, var(--teal-500), var(--emerald-500));
  }

  /* --- Panels --- */
  .search-panels {
    padding: var(--sp-7);
  }

  .search-panel {
    animation: panel-reveal var(--t-slow) var(--ease-out);
  }

  .search-panel[hidden] {
    display: none;
  }

  @keyframes panel-reveal {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* ==========================================================================
   9. COMPONENTS — Search Form
   ========================================================================== */
@layer components {
  .search-form {
    display: flex;
    align-items: flex-end;
    gap: var(--sp-3);
  }

  .search-form__field {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
  }

  .search-form__label {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: -0.01em;
  }

  .search-form__input {
    width: 100%;
    height: 54px;
    padding-inline: var(--sp-5) var(--sp-4);
    background: var(--slate-50);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--r-md);
    color: var(--text-strong);
    font-size: var(--fs-lg);
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: border-color var(--t-base) var(--ease),
                box-shadow var(--t-base) var(--ease),
                background-color var(--t-base) var(--ease);
  }

  .search-form__input::placeholder {
    color: var(--text-subtle);
    font-weight: 400;
  }

  .search-form__input:hover {
    border-color: var(--teal-300);
    background: var(--bg-surface);
  }

  .search-form__input:focus {
    outline: none;
    background: var(--bg-surface);
    border-color: var(--teal-500);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.16);
  }

  .search-form__input:focus-visible {
    outline: none;
  }

  .search-form__submit {
    flex: 0 0 auto;
    height: 54px;
    padding-inline: var(--sp-8);
    font-weight: 600;
  }

  /* Icon appended to the CTA */
  .search-form__submit::after {
    content: "";
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    transition: transform var(--t-base) var(--ease-spring);
  }

  .search-form__submit:hover::after {
    transform: scale(1.12);
  }

  /* ==========================================================================
     9b. COMPONENTS — Egyptian License Plate Input
     --------------------------------------------------------------------------
     Grouped side-by-side fields that mirror the authentic Egyptian plate:
     numbers on the RIGHT (start) and letters on the LEFT (end) under RTL.
     ========================================================================== */
  .search-form--plate {
    align-items: flex-start;
  }

  /* Vertically centres the CTA against the plate body */
  .search-form--plate .search-form__submit {
    align-self: center;
  }

  .plate-input {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    margin: 0;
    padding: 0;
    border: 0;
  }

  /* The plate itself */
  .plate-input__frame {
    overflow: hidden;
    background: var(--bg-surface);
    border: 2px solid var(--slate-300);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm), var(--highlight-soft);
    transition: border-color var(--t-base) var(--ease),
                box-shadow var(--t-base) var(--ease);
  }

  .plate-input__frame:focus-within {
    border-color: var(--teal-500);
    box-shadow: var(--shadow-md), 0 0 0 4px rgba(20, 184, 166, 0.18);
  }

  /* Dark header band, inspired by the official Egyptian plate */
  .plate-input__band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-1) var(--sp-3);
    background: linear-gradient(90deg, #0B3B4A 0%, #0F766E 55%, #134E4A 100%);
    color: rgba(255, 255, 255, 0.88);
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: 0.04em;
  }

  .plate-input__band-name {
    font-family: var(--font-display);
  }

  .plate-input__band-tag {
    direction: ltr;
    font-family: var(--font-mono);
    font-size: 0.625rem;
    letter-spacing: 0.18em;
    opacity: 0.8;
  }

  /* Side-by-side body: numbers (first in DOM) render on the RIGHT under RTL */
  .plate-input__body {
    display: flex;
    align-items: stretch;
    min-height: 68px;
  }

  .plate-input__part {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: var(--sp-2) var(--sp-3);
    transition: background-color var(--t-base) var(--ease);
  }

  .plate-input__part:focus-within {
    background: var(--teal-50);
  }

  /* Numbers side: the primary identifier — a touch more presence */
  .plate-input__part--numbers {
    background: linear-gradient(180deg, rgba(15, 118, 110, 0.05) 0%, transparent 100%);
  }

  /* Letters side: emerald tint to visually separate the two fields */
  .plate-input__part--letters {
    background: linear-gradient(180deg, rgba(5, 150, 105, 0.04) 0%, transparent 100%);
  }

  .plate-input__divider {
    width: 2px;
    align-self: stretch;
    background: var(--slate-200);
  }

  .plate-input__label {
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text-subtle);
  }

  /* Borderless, centered, bold — reads like printed plate characters */
  .plate-input__field {
    width: 100%;
    min-width: 0;
    padding: 0;
    background: transparent;
    border: 0;
    text-align: center;
    color: var(--slate-900);
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    line-height: 1.3;
  }

  .plate-input__field::placeholder {
    color: var(--slate-300);
    font-weight: 700;
    letter-spacing: 0.08em;
  }

  /* --------------------------------------------------------------------------
     Egyptian plate lettering
     --------------------------------------------------------------------------
     The Arabic characters of a real plate each sit in their own wide cell.
     Generous tracking reproduces that and stops the letters from clustering
     together when the user types them without spaces.

     `text-indent` reuses the exact same value on purpose: the trailing
     letter-space after the last glyph would otherwise push the visible
     characters off-centre by half of the tracking. Matching the indent to
     the tracking cancels that offset, so the plate stays optically centred
     in both RTL and LTR.
     -------------------------------------------------------------------------- */
  .plate-input__part--letters .plate-input__field {
    letter-spacing: var(--plate-letter-spacing);
    word-spacing: 0;
    text-align: center;
    text-indent: var(--plate-letter-spacing);
  }

  .plate-input__part--letters .plate-input__field::placeholder {
    letter-spacing: var(--plate-letter-spacing);
    text-indent: var(--plate-letter-spacing);
  }

  .plate-input__field:focus {
    outline: none;
  }

  .plate-input__field:focus-visible {
    outline: 2px solid var(--teal-500);
    outline-offset: 3px;
    border-radius: var(--r-xs);
  }

  .plate-input__field:-webkit-autofill {
    -webkit-text-fill-color: var(--slate-900);
    -webkit-box-shadow: 0 0 0 40rem var(--bg-surface) inset;
  }

  .plate-input__hint {
    font-size: var(--fs-xs);
    line-height: 1.5;
    color: var(--text-subtle);
  }

  /* ==========================================================================
     10. COMPONENTS — Hero Features & Summary Card
     ========================================================================== */
  .hero__features {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--sp-4);
    margin-top: var(--sp-10);
  }

  .hero__feature {
    padding: var(--sp-5);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    transition: transform var(--t-base) var(--ease),
                box-shadow var(--t-base) var(--ease),
                border-color var(--t-base) var(--ease);
  }

  .hero__feature:hover {
    transform: translateY(-4px);
    border-color: var(--teal-200);
    box-shadow: var(--shadow-lg);
  }

  .hero__feature h2 {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--teal-800);
    margin-bottom: var(--sp-2);
  }

  .hero__feature p {
    font-size: var(--fs-md);
    color: var(--text-muted);
    line-height: var(--lh-normal);
  }

  /* --- Side summary card --- */
  .hero__aside {
    position: sticky;
    top: calc(var(--header-h) + var(--sp-8));
  }

  .summary-card {
    position: relative;
    padding: var(--sp-8);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-2xl);
    box-shadow: 0 12px 32px -6px rgba(0, 0, 0, 0.06), var(--highlight-soft);
    overflow: hidden;
  }

  .summary-card::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--teal-500), var(--emerald-500));
  }

  .summary-card__title {
    font-size: var(--fs-xl);
    font-weight: 800;
    margin-bottom: var(--sp-5);
  }

  .summary-card__list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
  }

  .summary-card__list li {
    position: relative;
    padding-inline-start: var(--sp-6);
    font-size: var(--fs-base);
    font-weight: 500;
    color: var(--text-body);
  }

  .summary-card__list li::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0.5em;
    width: 8px;
    height: 8px;
    border-radius: var(--r-full);
    background: var(--emerald-500);
    box-shadow: 0 0 0 3px var(--emerald-50);
  }

  .summary-card__note {
    padding-top: var(--sp-4);
    border-top: 1px dashed var(--border-medium);
    font-size: var(--fs-sm);
    color: var(--text-subtle);
  }
}

/* ==========================================================================
   11. COMPONENTS — Sections
   ========================================================================== */
@layer components {
  .section {
    padding-block: var(--sp-24);
  }

  .section--verified { background: var(--bg-surface); }
  .section--centers  { background: var(--bg-muted); }
  .section--about,
  .section--contact { background: var(--bg-surface); }

  .section__header {
    max-width: 60ch;
    margin-bottom: var(--sp-12);
  }

  .section--centers .section__header,
  .section--contact .section__header {
    margin-inline: auto;
    text-align: center;
  }

  .section__title {
    display: inline-block;
    position: relative;
    font-size: clamp(1.75rem, 3.4vw, 2.5rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    margin-bottom: var(--sp-4);
  }

  .section__title::after {
    content: "";
    display: block;
    width: 56px;
    height: 4px;
    margin-top: var(--sp-4);
    border-radius: var(--r-full);
    background: linear-gradient(90deg, var(--teal-500), var(--emerald-500));
  }

  .section--centers .section__title::after,
  .section--contact .section__title::after {
    margin-inline: auto;
  }

  .section__subtitle {
    font-size: var(--fs-xl);
    line-height: var(--lh-normal);
    color: var(--text-muted);
    max-width: 58ch;
  }

  .section--centers .section__subtitle,
  .section--contact .section__subtitle {
    margin-inline: auto;
  }

  .section__text {
    font-size: var(--fs-xl);
    line-height: var(--lh-relaxed);
    color: var(--text-muted);
    max-width: 70ch;
  }

  .section__note {
    margin-top: var(--sp-10);
    padding: var(--sp-5);
    background: var(--bg-muted);
    border: 1px dashed var(--border-medium);
    border-radius: var(--r-lg);
    color: var(--text-subtle);
    font-size: var(--fs-md);
    text-align: center;
  }

  .section--centers .section__note {
    background: var(--bg-surface);
  }
}

/* ==========================================================================
   12. COMPONENTS — Cards
   ========================================================================== */
@layer components {
  .cars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--sp-6);
  }

  .car-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-xl);
    overflow: hidden;
    box-shadow: 0 12px 32px -6px rgba(0, 0, 0, 0.06), var(--highlight-soft);
    transition: transform var(--t-base) var(--ease),
                box-shadow var(--t-base) var(--ease),
                border-color var(--t-base) var(--ease);
  }

  .car-card:hover {
    transform: translateY(-6px);
    border-color: var(--teal-200);
    box-shadow: 0 24px 48px -12px rgba(15, 118, 110, 0.20);
  }

  .car-card:focus-within {
    border-color: var(--teal-300);
    box-shadow: var(--shadow-lg), 0 0 0 4px rgba(20, 184, 166, 0.12);
  }

  .car-card__media {
    position: relative;
    aspect-ratio: 16 / 10;
    background:
      radial-gradient(120% 90% at 20% 10%, var(--teal-50) 0%, transparent 60%),
      linear-gradient(140deg, var(--slate-100) 0%, var(--slate-200) 100%);
    border-bottom: 1px solid var(--border-subtle);
  }

  /* Verified badge — emerald = trust / confirmed */
  .car-card__badge {
    position: absolute;
    top: var(--sp-3);
    inset-inline-start: var(--sp-3);
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-3);
    background: var(--bg-surface);
    border: 1px solid var(--emerald-200);
    border-radius: var(--r-full);
    box-shadow: var(--shadow-sm);
    color: var(--emerald-700);
    font-size: var(--fs-2xs);
    font-weight: 700;
  }

  .car-card__badge::before {
    content: "";
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    background-color: var(--emerald-500);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
  }

  .verified-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--sp-3);
    align-items: end;
    margin-bottom: var(--sp-8);
    padding: var(--sp-5);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-sm);
  }

  .verified-filters__field {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
  }

  .verified-filters__field label {
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 700;
  }

  .verified-filters__input {
    width: 100%;
    height: 42px;
    padding-inline: var(--sp-3);
    background: var(--slate-50);
    border: 1.5px solid var(--border-medium);
    border-radius: var(--r-md);
    color: var(--text-strong);
  }

  .verified-filters__input:focus {
    outline: none;
    border-color: var(--teal-500);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.14);
  }

  .report-preview {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: var(--sp-5);
    background: rgba(15, 23, 42, 0.72);
  }

  .report-preview[hidden] { display: none; }

  .report-preview__dialog {
    display: flex;
    flex-direction: column;
    width: min(960px, 100%);
    height: min(900px, 94vh);
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
  }

  /* Spacious, responsive modal for license-plate search results */
  .search-results-modal__dialog {
    width: min(1080px, 100%);
    height: min(900px, 94vh);
  }

  .search-results-modal__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: var(--sp-6);
    background: var(--slate-50);
  }

  .search-results-modal__body .search-results__list {
    gap: var(--sp-4);
  }

  .search-results-modal__body .search-results__item {
    padding: var(--sp-5);
    border-radius: var(--r-lg);
  }

  .search-results-modal__body .search-results__title {
    font-size: var(--fs-xl);
  }

  .search-results-modal__body .search-results__meta,
  .search-results-modal__body .search-results__specs {
    font-size: var(--fs-md);
    line-height: 1.9;
  }

  @media (max-width: 680px) {
    .search-results-modal__dialog {
      width: 100%;
      height: 100dvh;
      border-radius: 0;
    }
    .search-results-modal__body {
      padding: var(--sp-4);
    }
  }

  .report-preview__dialog--ad {
    height: auto;
    max-height: 92vh;
  }

  .report-preview__head,
  .report-preview__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-4);
  }

  .report-preview__head { border-bottom: 1px solid var(--border-subtle); }
  .report-preview__foot { border-top: 1px solid var(--border-subtle); }

  .report-preview__frame {
    flex: 1 1 auto;
    width: 100%;
    min-height: 320px;
    border: 0;
    background: var(--slate-100);
  }

  .report-details {
    flex: 0 1 48%;
    overflow: auto;
    padding: var(--sp-5);
    background: var(--bg-surface);
  }

  .report-details__summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
  .report-details__item { padding: var(--sp-3); background: var(--slate-50); border-radius: var(--r-md); }
  .report-details__label { display: block; color: var(--text-subtle); font-size: var(--fs-xs); }
  .report-details__value { display: block; margin-top: var(--sp-1); color: var(--text-strong); font-weight: 700; }
  .report-details__heading { margin: var(--sp-4) 0 var(--sp-2); color: var(--text-strong); font-size: var(--fs-sm); }
  .report-details__notes { margin-top: var(--sp-4); padding: var(--sp-3); border-right: 3px solid var(--teal-500); background: var(--teal-50); border-radius: var(--r-md); }
  .report-details__photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--sp-3); }
  .report-details__photo { margin: 0; overflow: hidden; border: 1px solid var(--border-subtle); border-radius: var(--r-md); background: var(--bg-surface); }
  .report-details__photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--slate-100); }
  .report-details__photo figcaption { padding: var(--sp-2); color: var(--text-body); font-size: var(--fs-xs); }
  .report-details__parts { width: 100%; border-collapse: collapse; }
  .report-details__parts th, .report-details__parts td { padding: var(--sp-2); border-bottom: 1px solid var(--border-subtle); text-align: right; }
  .report-details__status--passed { color: var(--emerald-700); }
  .report-details__status--attention { color: #92400E; }
  .report-details__status--failed { color: #991B1B; }
  .search-results__actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-3); }
  .search-results__report-details { margin-top: var(--sp-4); padding: var(--sp-4); border: 1px solid var(--border-subtle); border-radius: var(--r-lg); }
  .report-details__validity { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-4); }
  .report-details__validity-notice { flex: 1 1 320px; margin: 0; padding: var(--sp-3); border-radius: var(--r-md); background: #FEF3C7; color: #92400E; font-size: var(--fs-sm); }
  .report-validity { display: inline-flex; align-items: center; width: fit-content; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: 800; white-space: nowrap; }
  .report-validity--active { background: var(--emerald-50); color: var(--emerald-700); }
  .report-validity--expired { background: #FEE2E2; color: #991B1B; }
  .report-validity--unknown { background: var(--slate-100); color: var(--text-muted); }

  .homepage-report-ad__slot {
    margin: var(--sp-5);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg);
  }

  .homepage-report-ad__slot .ad-slot__content {
    flex-direction: column;
    gap: var(--sp-2);
    color: var(--text-muted);
  }

  .car-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: var(--sp-3);
    padding: var(--sp-5);
  }

  .car-card__title {
    font-size: var(--fs-xl);
    font-weight: 800;
    color: var(--text-strong);
    transition: color var(--t-base) var(--ease);
  }

  .car-card:hover .car-card__title {
    color: var(--teal-800);
  }

  .car-card__meta {
    font-size: var(--fs-sm);
    color: var(--text-subtle);
  }

  .car-card__specs {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    margin-top: auto;
    padding-top: var(--sp-4);
    border-top: 1px solid var(--slate-100);
  }

  .car-card__specs li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    font-size: var(--fs-md);
  }

  .car-card__specs li span:first-child {
    color: var(--text-subtle);
    font-weight: 500;
  }

  .car-card__specs li span:last-child {
    color: var(--text-strong);
    font-weight: 600;
  }

  /* --- Text link with directional arrow --- */
  .card__link {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    align-self: flex-start;
    color: var(--teal-700);
    font-size: var(--fs-md);
    font-weight: 600;
    transition: color var(--t-base) var(--ease),
                gap var(--t-base) var(--ease);
  }

  .card__link::after {
    content: "←";
    transition: transform var(--t-base) var(--ease-out);
  }

  html[dir="ltr"] .card__link::after {
    content: "→";
  }

  .card__link:hover {
    color: var(--teal-900);
    gap: var(--sp-3);
  }

  .card__link:hover::after {
    transform: translateX(-4px);
  }

  html[dir="ltr"] .card__link:hover::after {
    transform: translateX(4px);
  }
}

/* ==========================================================================
   13. COMPONENTS — Centers & Contact
   ========================================================================== */
@layer components {
  .centers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    justify-content: center;
    gap: var(--sp-6);
  }

  .center-card {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    padding: var(--sp-6);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-xl);
    box-shadow: 0 12px 32px -6px rgba(0, 0, 0, 0.06), var(--highlight-soft);
    transition: transform var(--t-base) var(--ease),
                box-shadow var(--t-base) var(--ease),
                border-color var(--t-base) var(--ease);
  }

  .center-card:hover {
    transform: translateY(-6px);
    border-color: var(--teal-200);
    box-shadow: 0 26px 52px -14px rgba(15, 118, 110, 0.24);
  }

  /* --- Card head: title + verified badge --- */
  .center-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-3);
  }

  .center-card__headings {
    min-width: 0;
  }

  .center-card__verified {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    flex-shrink: 0;
    padding: var(--sp-1) var(--sp-3);
    background: var(--emerald-50);
    border: 1px solid var(--emerald-200);
    border-radius: var(--r-full);
    color: var(--emerald-700);
    font-size: var(--fs-2xs);
    font-weight: 700;
    white-space: nowrap;
  }

  .center-card__verified svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
  }

  .center-card__title {
    font-size: var(--fs-xl);
    font-weight: 800;
    color: var(--teal-800);
  }

  .center-card__address {
    font-size: var(--fs-md);
    color: var(--text-muted);
    line-height: var(--lh-normal);
  }

  /* --- Meta rows: rating + location --- */
  .center-card__meta {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    padding-block: var(--sp-3);
    border-block: 1px solid var(--slate-100);
  }

  .center-card__rating,
  .center-card__location {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-md);
  }

  .center-card__stars {
    color: #F59E0B;
    font-size: var(--fs-md);
    letter-spacing: 0.12em;
    line-height: 1;
  }

  .center-card__score {
    color: var(--text-strong);
    font-weight: 800;
  }

  .center-card__reviews {
    color: var(--text-subtle);
    font-size: var(--fs-sm);
  }

  .center-card__location {
    color: var(--text-muted);
  }

  .center-card__location svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--teal-600);
  }

  /* --- Discount badge --- */
  .center-card__discount {
    align-self: flex-start;
    padding: var(--sp-2) var(--sp-3);
    background: linear-gradient(135deg, var(--emerald-500), var(--emerald-700));
    border-radius: var(--r-sm);
    color: #FFFFFF;
    font-size: var(--fs-sm);
    font-weight: 700;
    box-shadow: var(--shadow-brand-sm);
  }

  .center-card__hours {
    align-self: flex-start;
    padding: var(--sp-2) var(--sp-3);
    background: var(--teal-50);
    border-radius: var(--r-sm);
    color: var(--teal-700);
    font-size: var(--fs-sm);
    font-weight: 600;
  }

  .center-card__phone {
    direction: ltr;
    text-align: start;
    color: var(--text-strong);
    font-size: var(--fs-md);
    font-weight: 600;
  }

  /* --- Actions row --- */
  .center-card__actions {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-top: auto;
    padding-top: var(--sp-4);
    border-top: 1px solid var(--slate-100);
  }

  .center-card__book {
    flex: 1 1 auto;
    padding: 0.7rem 1.2rem;
    font-size: var(--fs-md);
  }

  .center-card__details {
    flex: 0 0 auto;
    color: var(--teal-700);
    font-size: var(--fs-md);
    font-weight: 600;
    white-space: nowrap;
    transition: color var(--t-base) var(--ease);
  }

  .center-card__details:hover {
    color: var(--teal-900);
  }

  .contact-info ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--sp-10);
  }

  .contact-info li {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    font-size: var(--fs-lg);
  }

  .contact-info li span:first-child {
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--text-subtle);
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .contact-info li strong {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--text-strong);
  }

  .contact-info li small {
    font-size: var(--fs-sm);
    color: var(--text-subtle);
  }

  .contact-info a {
    color: var(--teal-700);
    font-weight: 600;
    transition: color var(--t-base) var(--ease);
  }

  .contact-info a:hover {
    color: var(--teal-900);
  }

  /* ==========================================================================
     14. COMPONENTS — Ad Slots (Google Ads)
     Native-feeling, un-intrusive containers for ad units.
     NOTE: no <ins>/ad markup exists in index.html yet — these classes are
     the ready-made contract for when the ad units are inserted.
     ========================================================================== */
  .ad-slot {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    width: 100%;
    min-height: 90px;
    padding: var(--sp-6);
    background: var(--slate-50);
    border: 1px dashed var(--border-medium);
    border-radius: var(--r-lg);
    /* Strict containment: prevents ad creative from bleeding, stacking
       above page chrome (UI redressing) or causing layout shift (CLS) */
    overflow: hidden;
    isolation: isolate;
    contain: layout paint;
    transition: border-color var(--t-base) var(--ease),
                background-color var(--t-base) var(--ease);
  }

  .ad-slot:hover {
    border-color: var(--teal-300);
    background: var(--teal-50);
  }

  /* Faint "Advertisement" disclosure */
  .ad-slot__label {
    font-size: var(--fs-2xs);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-subtle);
  }

  .ad-slot__content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 60px;
    overflow: hidden;
  }

  /* Google AdSense unit sizing (no inline styles) */
  .adsbygoogle {
    display: block;
    width: 100%;
  }

  /* Reserved-space helper: prevents layout shift when the ad loads late */
  .ad-slot--reserved {
    min-height: 280px;
  }

  .ad-slot--leaderboard {
    min-height: 110px;
  }

  .ad-slot--rectangle {
    min-height: 280px;
  }

  .ad-slot--fluid {
    min-height: var(--sp-32);
  }

  /* --- Horizontal banner unit (970x90 / 320x100 style) --- */
  .ad-slot--banner {
    min-height: 100px;
    padding-block: var(--sp-5);
  }

  /* --- Tall sidebar unit (300x600 half-page) --- */
  .ad-slot--sidebar {
    min-height: 600px;
    padding: var(--sp-5);
  }

  /* Alias requested in the spec — same treatment as .ad-slot--banner */
  .banner-ad {
    min-height: 100px;
    padding-block: var(--sp-5);
  }

  /* Ad unit living inside the inspection-results view.
     Kept visually subordinate so it never competes with the report itself. */
  .ad-slot--in-results {
    min-height: 120px;
    background: var(--bg-surface);
    border-style: solid;
    border-color: var(--border-subtle);
  }

  .ad-slot--in-results:hover {
    background: var(--slate-50);
  }

  /* --- Two-column layout: report + ad sidebar --- */
  .search-results__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
    gap: var(--sp-6);
  }

  .search-results__sidebar {
    position: sticky;
    top: calc(var(--header-h) + var(--sp-4));
  }

  @media (max-width: 900px) {
    .search-results__layout {
      grid-template-columns: minmax(0, 1fr);
    }

    .search-results__sidebar {
      position: static;
    }

    .ad-slot--sidebar {
      min-height: 280px;
    }
  }

  /* Slots sitting on a white section need a slightly different surface */
  .section--verified .ad-slot,
  .section--about .ad-slot,
  .section--contact .ad-slot {
    background: var(--slate-50);
  }

  /* Horizontal ad row (two side-by-side units) */
  .ad-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--sp-5);
    margin-block: var(--sp-10);
  }

  /* Wrapper that keeps ads clear of content */
  .ad-container {
    display: block;
    width: 100%;
    margin-block: var(--sp-8);
    overflow: hidden;
    isolation: isolate;
    contain: layout paint;
  }

  .ad-container--sticky {
    position: sticky;
    top: calc(var(--header-h) + var(--sp-4));
  }

  /* Attribute hook for ad units injected by the ad script */
  [data-ad-slot] {
    display: block;
    width: 100%;
  }
}

/* ==========================================================================
   15. COMPONENTS — Footer & Legal Disclaimer
   ========================================================================== */
@layer components {
  .site-footer {
    margin-top: auto;
    padding-block: var(--sp-16) var(--sp-8);
    background: var(--slate-900);
    color: var(--slate-400);
  }

  .site-footer a {
    color: var(--slate-400);
    transition: color var(--t-base) var(--ease);
  }

  .site-footer a:hover {
    color: var(--teal-300);
  }

  /* --- Legal disclaimer: prominent, calm, high-contrast --- */
  .legal-disclaimer {
    position: relative;
    margin-bottom: var(--sp-14);
    padding: var(--sp-7) var(--sp-8);
    background:
      linear-gradient(135deg, rgba(15, 118, 110, 0.30) 0%, rgba(5, 150, 105, 0.18) 100%);
    border: 1px solid rgba(45, 212, 191, 0.28);
    border-radius: var(--r-xl);
  }

  .legal-disclaimer::before {
    content: "";
    position: absolute;
    inset-block: var(--sp-4);
    inset-inline-start: 0;
    width: 3px;
    border-radius: var(--r-full);
    background: linear-gradient(180deg, var(--teal-400), var(--emerald-400));
  }

  .legal-disclaimer__title {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
    color: var(--teal-300);
    font-size: var(--fs-lg);
    font-weight: 800;
    letter-spacing: -0.01em;
  }

  .legal-disclaimer__title::before {
    content: "⚠";
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    background: rgba(45, 212, 191, 0.16);
    border-radius: var(--r-sm);
    font-size: 0.95rem;
    line-height: 1;
  }

  .legal-disclaimer__text {
    color: var(--slate-300);
    font-size: var(--fs-md);
    line-height: var(--lh-relaxed);
  }

  .legal-disclaimer__text strong {
    color: var(--text-inverse);
    font-weight: 700;
  }

  /* --- Footer columns --- */
  .footer__columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--sp-10);
    padding-bottom: var(--sp-12);
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  }

  .footer__col-title {
    margin-bottom: var(--sp-5);
    color: var(--text-inverse);
    font-size: var(--fs-md);
    font-weight: 700;
    letter-spacing: 0.01em;
  }

  .footer__col ul {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
  }

  .footer__col li {
    color: var(--slate-500);
    font-size: var(--fs-md);
  }

  .footer__col a {
    display: inline-block;
    transition: color var(--t-base) var(--ease),
                transform var(--t-base) var(--ease);
  }

  .footer__col a:hover {
    transform: translateX(-3px);
  }

  html[dir="ltr"] .footer__col a:hover {
    transform: translateX(3px);
  }

  .footer__col--brand {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
  }

  .footer__brand-name {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    background: linear-gradient(120deg, var(--teal-300), var(--emerald-400));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  .footer__brand-tagline {
    color: var(--slate-500);
    font-size: var(--fs-sm);
  }

  .lang-switcher--footer {
    align-self: flex-start;
    margin-top: var(--sp-2);
    background: rgba(148, 163, 184, 0.10);
    border-color: rgba(148, 163, 184, 0.20);
  }

  .lang-switcher--footer .lang-switcher__label {
    color: var(--slate-500);
  }

  .lang-switcher--footer .lang-switcher__btn {
    color: var(--slate-400);
  }

  .lang-switcher--footer .lang-switcher__btn:hover {
    background: rgba(148, 163, 184, 0.16);
    color: var(--teal-300);
  }

  .lang-switcher--footer .lang-switcher__btn.is-active {
    background: var(--teal-700);
    color: var(--text-inverse);
    box-shadow: none;
  }

  /* --- Footer bottom bar --- */
  .footer__bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    padding-top: var(--sp-8);
  }

  .footer__copy {
    color: var(--slate-500);
    font-size: var(--fs-sm);
  }

  .footer__disclaimer-mini {
    padding: var(--sp-2) var(--sp-4);
    background: rgba(15, 118, 110, 0.28);
    border: 1px solid rgba(45, 212, 191, 0.22);
    border-radius: var(--r-full);
    color: var(--teal-300);
    font-size: var(--fs-xs);
    font-weight: 600;
  }
}

/* ==========================================================================
   16. RESPONSIVE
   ========================================================================== */
@layer components {
  /* ==========================================================================
     15b. COMPONENTS — UI ENHANCEMENTS
     --------------------------------------------------------------------------
     Clear & copy actions, recent searches, helper hints, toasts and the
     search loading state. Every element is injected at runtime by js/main.js,
     so the markup stays clean and CSP-safe.
     ========================================================================== */
  .has-input-actions {
    position: relative;
  }

  /* --- Clear / copy buttons inside the search inputs --- */
  .input-actions {
    position: absolute;
    top: -3px;
    inset-inline-end: 0;
    display: flex;
    align-items: center;
    gap: 2px;
  }

  .plate-input__part.has-input-actions .input-actions {
    top: 0;
    inset-inline-end: 4px;
  }

  .input-action {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: var(--r-full);
    background: var(--slate-100);
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.85);
    transition: opacity var(--t-fast) var(--ease),
                transform var(--t-fast) var(--ease-spring),
                background-color var(--t-fast) var(--ease),
                color var(--t-fast) var(--ease),
                visibility var(--t-fast) var(--ease);
  }

  /* visibility:hidden also removes the button from the tab order */
  .input-action.is-visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
  }

  .input-action:hover {
    background: var(--slate-200);
    color: var(--slate-900);
  }

  .input-action:focus-visible {
    outline: 2px solid var(--teal-600);
    outline-offset: 2px;
  }

  .input-action svg {
    width: 14px;
    height: 14px;
  }

  .input-action--copy:hover {
    background: var(--teal-50);
    color: var(--teal-700);
  }

  .input-action--clear:hover {
    background: #FEE2E2;
    color: #B91C1C;
  }

  /* --- Recent searches --- */
  .recent-searches {
    margin-top: var(--sp-5);
    padding-top: var(--sp-4);
    border-top: 1px dashed var(--border-medium);
  }

  .recent-searches[hidden] {
    display: none;
  }

  .recent-searches__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    margin-bottom: var(--sp-3);
  }

  .recent-searches__title {
    color: var(--text-subtle);
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .recent-searches__clear {
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 600;
    transition: color var(--t-fast) var(--ease);
  }

  .recent-searches__clear:hover {
    color: #B91C1C;
  }

  .recent-searches__list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
  }

  .recent-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    background: var(--slate-50);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-full);
    color: var(--text-body);
    font-size: var(--fs-sm);
    font-weight: 600;
    transition: all var(--t-fast) var(--ease);
  }

  .recent-chip:hover {
    background: var(--teal-50);
    border-color: var(--teal-200);
    color: var(--teal-800);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
  }

  .recent-chip:focus-visible {
    outline: 2px solid var(--teal-600);
    outline-offset: 2px;
  }

  .recent-chip__type {
    padding-inline-start: var(--sp-2);
    border-inline-start: 1px solid var(--border-subtle);
    color: var(--text-subtle);
    font-size: var(--fs-2xs);
    font-weight: 700;
  }

  /* --- Helper hint (VIN / engine guidance) --- */
  .helper-hint {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-4);
    background: var(--teal-50);
    border-bottom: 1px solid var(--teal-100);
  }

  .helper-hint[hidden] {
    display: none;
  }

  .helper-hint__icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    border-radius: var(--r-full);
    background: var(--teal-600);
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
  }

  .helper-hint__text {
    color: var(--teal-900);
    font-size: var(--fs-sm);
    line-height: 1.6;
  }

  /* Small "?" badge rendered next to the VIN / engine tabs */
  .helper-tip {
    display: inline-grid;
    place-items: center;
    width: 17px;
    height: 17px;
    margin-inline-start: 4px;
    vertical-align: middle;
    border-radius: var(--r-full);
    background: var(--teal-50);
    border: 1px solid var(--teal-200);
    color: var(--teal-700);
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    cursor: help;
  }

  .search-tab:has(.helper-tip) {
    padding-inline-end: var(--sp-5);
  }

  /* --- Toasts --- */
  .toast-region {
    position: fixed;
    bottom: var(--sp-6);
    inset-inline-end: var(--sp-6);
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    width: min(360px, calc(100vw - 2rem));
    pointer-events: none;
  }

  .toast {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-inline-start: 4px solid var(--teal-500);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xl);
    pointer-events: auto;
    animation: toast-in var(--t-slow) var(--ease-out);
  }

  .toast--success {
    border-inline-start-color: var(--emerald-500);
  }

  .toast--error {
    border-inline-start-color: #DC2626;
  }

  .toast--info {
    border-inline-start-color: var(--teal-500);
  }

  @keyframes toast-in {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }

  .toast__icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: var(--r-full);
    background: var(--slate-100);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
  }

  .toast--success .toast__icon {
    background: var(--emerald-50);
    color: var(--emerald-700);
  }

  .toast--error .toast__icon {
    background: #FEE2E2;
    color: #B91C1C;
  }

  .toast--info .toast__icon {
    background: var(--teal-50);
    color: var(--teal-700);
  }

  .toast__message {
    flex: 1 1 auto;
    color: var(--text-strong);
    font-size: var(--fs-md);
    font-weight: 600;
    line-height: 1.5;
  }

  .toast__close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: var(--r-full);
    color: var(--text-subtle);
    font-size: 18px;
    line-height: 1;
    transition: background-color var(--t-fast) var(--ease),
                color var(--t-fast) var(--ease);
  }

  .toast__close:hover {
    background: var(--slate-100);
    color: var(--slate-900);
  }

  .toast__close:focus-visible {
    outline: 2px solid var(--teal-600);
    outline-offset: 2px;
  }

  /* --- Search loading skeleton --- */
  .search-loading {
    margin-top: var(--sp-5);
    padding: var(--sp-5);
    background: var(--slate-50);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg);
  }

  .search-loading[hidden] {
    display: none;
  }

  .search-loading__label {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-4);
    color: var(--text-muted);
    font-size: var(--fs-sm);
    font-weight: 600;
  }

  .search-loading__bar {
    height: 12px;
    border-radius: var(--r-full);
    background: linear-gradient(90deg, var(--slate-100) 25%, var(--slate-200) 37%, var(--slate-100) 63%);
    background-size: 400% 100%;
    animation: skeleton-sweep 1.4s var(--ease) infinite;
  }

  .search-loading__bar + .search-loading__bar {
    margin-top: var(--sp-3);
  }

  .search-loading__bar--short {
    width: 55%;
  }

  @keyframes skeleton-sweep {
    from { background-position: 100% 50%; }
    to   { background-position: 0 50%; }
  }

  .spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    vertical-align: -2px;
    border: 2px solid var(--teal-100);
    border-top-color: var(--teal-600);
    border-radius: var(--r-full);
    animation: spinner-spin 0.7s linear infinite;
  }

  @keyframes spinner-spin {
    to { transform: rotate(360deg); }
  }

  .btn.is-busy {
    pointer-events: none;
    opacity: 0.75;
  }

  /* --- Search results panel (rendered by js/main.js) --- */
  .search-results {
    margin-top: var(--sp-5);
    padding: var(--sp-5);
    background: var(--slate-50);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg);
  }

  .search-results[hidden] {
    display: none;
  }

  .search-results__report {
    min-width: 0;
  }

  .search-results__list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
  }

  .search-results__item {
    padding: var(--sp-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
    transition: border-color var(--t-base) var(--ease),
                transform var(--t-base) var(--ease);
  }

  .search-results__item:hover {
    border-color: var(--teal-200);
    transform: translateY(-2px);
  }

  .search-results__title {
    color: var(--text-strong);
    font-size: var(--fs-lg);
    font-weight: 800;
    margin-bottom: var(--sp-1);
  }

  .search-results__plate {
    color: var(--teal-700);
    font-family: var(--font-display);
    font-size: var(--fs-md);
    font-weight: 900;
    letter-spacing: 0.08em;
    margin-bottom: var(--sp-1);
  }

  .search-results__meta {
    color: var(--text-muted);
    font-size: var(--fs-sm);
  }

  .search-results__empty {
    color: var(--text-muted);
    font-size: var(--fs-md);
    text-align: center;
  }

  /* --- Prominent anti-fraud result --- */
  .search-results__item--fraud {
    border-color: #FCA5A5;
    background: #FFF7F7;
    box-shadow: inset 4px 0 0 #EF4444;
  }

  .search-results__item--fraud:hover {
    border-color: #F87171;
  }

  .search-results__fraud-alert {
    margin-top: var(--sp-3);
    padding: var(--sp-4);
    color: #991B1B;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: var(--r-md);
  }

  .search-results__fraud-alert strong {
    display: block;
    margin-bottom: var(--sp-1);
    font-family: var(--font-display);
    font-size: var(--fs-md);
    font-weight: 900;
  }

  .search-results__fraud-alert p {
    color: #7F1D1D;
    font-size: var(--fs-sm);
    line-height: 1.65;
  }

  /* --- Large desktop --- */
  @media (min-width: 1280px) {
    :root {
      --container: var(--container-wide);
    }

    .hero {
      padding-block: var(--sp-24) var(--sp-32);
    }
  }

  /* Keep the full desktop navbar within the container on medium-width screens.
     ملاحظة i18n: مبدّل اللغة يجب أن يبقى ظاهرًا دائمًا — نخفي التسمية فقط
     لتوفير المساحة، ويظهر المبدّل العائم تلقائيًا على الشاشات الصغيرة. */
  @media (max-width: 1500px) {
    .home-page .navbar__cta--partner,
    .home-page .lang-switcher__label {
      display: none;
    }
  }


  /* --- Tablet: collapse the hero into one column --- */
  @media (max-width: 1080px) {
    .hero__inner {
      grid-template-columns: minmax(0, 1fr);
      gap: var(--sp-12);
    }

    .hero__aside {
      position: static;
    }

    .hero__subtitle {
      margin-bottom: var(--sp-8);
    }

    .navbar__nav a {
      padding-inline: var(--sp-3);
      font-size: var(--fs-base);
    }

    .lang-switcher__label {
      display: none;
    }
  }

  /* --- Mobile --- */
  @media (max-width: 880px) {
    :root {
      --header-h: 66px;
      --gutter: var(--sp-5);
      /* Tighter tracking on narrow screens so the plate never overflows */
      --plate-letter-spacing: 0.3rem;
    }

    .navbar__inner {
      gap: var(--sp-3);
    }

    .navbar__toggle {
      display: block;
      order: 3;
      margin-inline-start: auto;
    }

    /* Collapsible drawer — JS toggles .is-open */
    .navbar__nav {
      position: absolute;
      top: 100%;
      inset-inline: 0;
      flex-direction: column;
      align-items: stretch;
      gap: var(--sp-1);
      margin: 0;
      padding: var(--sp-4);
      max-height: 0;
      overflow: hidden;
      opacity: 0;
      visibility: hidden;
      background: var(--bg-surface);
      border-bottom: 1px solid var(--border-subtle);
      box-shadow: var(--shadow-lg);
      transition: max-height var(--t-slow) var(--ease),
                  opacity var(--t-base) var(--ease),
                  visibility var(--t-base) var(--ease);
    }

    .navbar__nav.is-open {
      max-height: 72vh;
      overflow-y: auto;
      opacity: 1;
      visibility: visible;
    }

    .navbar__nav a {
      padding: var(--sp-3) var(--sp-4);
      border-radius: var(--r-md);
      font-size: var(--fs-lg);
      /* The drawer is a light surface, so links revert to dark ink */
      color: var(--text-muted);
    }

    .navbar__nav a:hover {
      color: var(--teal-800);
      background: var(--teal-50);
    }

    .navbar__nav a[aria-current="page"] {
      color: var(--teal-800);
      background: var(--teal-50);
    }

    .navbar__nav a::after {
      display: none;
    }

    .navbar__actions {
      order: 2;
      gap: var(--sp-2);
    }

    .navbar__cta {
      display: none;
    }

    /* Auth trigger stays compact in the mobile bar */
    .navbar__login {
      padding: 0.55rem 0.85rem;
      font-size: var(--fs-sm);
    }

    .lang-switcher {
      padding: 2px;
    }

    .lang-switcher__btn {
      padding: 0.3rem 0.6rem;
      font-size: var(--fs-xs);
    }

    /* --- Hero --- */
    .hero {
      padding-block: var(--sp-12) var(--sp-16);
    }

    .hero__eyebrow {
      margin-bottom: var(--sp-4);
    }

    .hero__subtitle {
      margin-bottom: var(--sp-6);
    }

    /* Stacked search form */
    .search-form {
      flex-direction: column;
      align-items: stretch;
      gap: var(--sp-4);
    }

    .search-form__submit {
      width: 100%;
    }

    /* Plate keeps its side-by-side layout on mobile */
    .search-form--plate .search-form__submit {
      align-self: stretch;
    }

    .plate-input__body {
      min-height: 60px;
    }

    .plate-input__field {
      font-size: 1.25rem;
    }

    .plate-input__part {
      padding: var(--sp-2);
    }

    /* Tabs scroll horizontally rather than squeezing */
    .search-tab {
      flex: 0 0 auto;
      padding-inline: var(--sp-4);
      font-size: var(--fs-base);
    }

    .search-panels {
      padding: var(--sp-5) var(--sp-4);
    }

    .hero__features {
      grid-template-columns: minmax(0, 1fr);
      gap: var(--sp-3);
      margin-top: var(--sp-8);
    }

    .summary-card {
      padding: var(--sp-6) var(--sp-5);
    }
  }
}

/* ==========================================================================
   17. RESPONSIVE (continued) + ACCESSIBILITY & MOTION
   ========================================================================== */
@layer components {
  /* --- Sections & footer on mobile --- */
  @media (max-width: 880px) {
    .section {
      padding-block: var(--sp-16);
    }

    .section__header {
      margin-bottom: var(--sp-8);
    }

    .cars-grid,
    .centers-grid {
      grid-template-columns: minmax(0, 1fr);
      gap: var(--sp-5);
    }

    /* Center card actions stack gracefully on narrow screens */
    .center-card__actions {
      flex-wrap: wrap;
    }

    .center-card__book {
      flex: 1 1 100%;
    }

    /* --- Toasts sit full-width on small screens --- */
    .toast-region {
      inset-inline: var(--sp-4);
      bottom: var(--sp-4);
      width: auto;
    }

    .ad-row {
      grid-template-columns: minmax(0, 1fr);
    }

    .site-footer {
      padding-block: var(--sp-12) var(--sp-6);
    }

    .legal-disclaimer {
      padding: var(--sp-5);
      margin-bottom: var(--sp-10);
    }

    .footer__columns {
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
      gap: var(--sp-8);
      padding-bottom: var(--sp-8);
    }

    .footer__bottom {
      flex-direction: column;
      align-items: flex-start;
      text-align: start;
    }
  }

  @media (max-width: 620px) {
    .navbar__actions { gap: var(--sp-2); }

    /* مبدّل اللغة يختفي لتقليل الازدحام، أما زر/رابط الدخول فيبقى متاحًا
       (ضروري لتسجيل الدخول من الهاتف) وبمقاس مضغوط. */
    .navbar__actions .lang-switcher { display: none; }
    .navbar__actions .navbar__login,
    .site-header__actions [data-auth-login] {
      padding: 0.5rem 0.7rem;
      font-size: var(--fs-xs);
    }

    .navbar__profile-meta { display: none; }
    .navbar__profile { padding-inline: var(--sp-2); }
    .navbar__profile-menu { inset-inline-start: 0; inset-inline-end: auto; }

    .search-results__layout { grid-template-columns: minmax(0, 1fr); }
    .search-results__sidebar { position: static; }
    .search-results__report-details { padding: var(--sp-3); }
    .search-results__report-details .report-details__summary { grid-template-columns: minmax(0, 1fr); }
    .search-results__actions .card__link { flex: 1 1 140px; text-align: center; }
  }

  /* --- Small phones --- */
  @media (max-width: 430px) {
    :root {
      --gutter: var(--sp-4);
      --plate-letter-spacing: 0.25rem;
    }

    .brand__name {
      font-size: 1.25rem;
    }

    .brand__logo {
      width: 36px;
      height: 36px;
      font-size: 1.15rem;
    }

    .search-box {
      border-radius: var(--r-xl);
    }

    .search-panels {
      padding: var(--sp-4) var(--sp-3);
    }

    .hero__title {
      font-size: 1.9rem;
    }

    .section__title {
      font-size: 1.6rem;
    }

    .contact-info ul {
      flex-direction: column;
      align-items: center;
      gap: var(--sp-6);
    }
  }

  /* Respect reduced-motion preferences */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }

    .car-card:hover,
    .center-card:hover,
    .hero__feature:hover,
    .btn--primary:hover,
    .btn--secondary:hover,
    .brand:hover .brand__logo {
      transform: none;
    }
  }

  /* Windows High Contrast / forced-colors */
  @media (forced-colors: active) {
    .btn,
    .search-tab,
    .car-card,
    .center-card,
    .hero__feature,
    .legal-disclaimer,
    .ad-slot,
    .search-form__input {
      border: 1px solid CanvasText;
    }

    .search-tab.is-active,
    .lang-switcher__btn.is-active,
    .car-card__badge {
      outline: 2px solid Highlight;
    }

    .hero__title-accent,
    .brand__name,
    .footer__brand-name {
      -webkit-text-fill-color: CanvasText;
      color: CanvasText;
    }
  }

  /* Print — clean, ink-friendly */
  @media print {
    .site-header,
    .hero__aside,
    .search-box,
    .navbar__toggle,
    .footer__bottom,
    .ad-slot,
    .ad-container,
    .ad-row,
    .toast-region,
    .helper-hint,
    .input-actions,
    .recent-searches,
    .search-loading {
      display: none !important;
    }

    body {
      background: #fff;
      color: #000;
    }

    .section {
      padding-block: var(--sp-4);
      break-inside: avoid;
    }

    .car-card,
    .center-card {
      box-shadow: none;
      border: 1px solid #999;
    }
  }
}












/* --- Phase 10: search result specs row + prominent report button --- */
.search-results__specs {
  font-weight: 600;
  color: var(--text-strong);
}

.card__link--primary {
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--teal-600, #0d9488);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.card__link--primary:hover {
  background: var(--teal-700, #0f766e);
}

@media (max-width: 640px) {
  .search-results__layout {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* ============================================================================
   بوابة الإعلان قبل عرض التقرير (Report Ad Gate) — نافذة موحّدة واحدة
   ========================================================================== */

.report-gate[hidden],
.report-gate__report[hidden] {
  display: none !important;
}

.report-gate {
  display: grid;
  gap: var(--sp-4);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}

.report-gate__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.report-gate__hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.report-gate__media {
  display: flex;
  justify-content: center;
}

.report-gate__banner {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  text-align: center;
}

.report-gate__banner-image {
  display: block;
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: var(--r-md);
  background: #fff;
}

.report-gate__banner-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-gate__banner-title {
  font-size: var(--fs-lg);
  color: var(--slate-900, #0f172a);
}

.report-gate__banner-subtitle {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.report-gate__banner-link {
  align-self: center;
}

.report-gate__google {
  display: grid;
  gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-4);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--r-lg);
  background: #f8fafc;
  text-align: center;
}

.report-gate__google-unit {
  display: block;
  min-height: 120px;
}

.report-gate__google-fallback {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.report-gate__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.report-gate__countdown {
  display: inline-flex;
  align-items: baseline;
  gap: var(--sp-2);
}

.report-gate__timer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 var(--sp-2);
  border-radius: var(--r-full);
  background: var(--emerald-50, #ecfdf5);
  color: var(--emerald-700, #047857);
  font-size: var(--fs-lg);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.report-gate__timer-label {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.report-gate__report {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}

.report-gate__others-title {
  margin: var(--sp-3) 0 var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.report-gate__others {
  display: grid;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.report-gate__others li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
}

.report-gate__others-meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

#search-results-modal-frame {
  width: 100%;
  min-height: 60vh;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  background: #fff;
}

@media (max-width: 640px) {
  #search-results-modal-frame {
    min-height: 45vh;
  }
}
/* ============================================================================
   إصلاح التمرير داخل نافذة تقرير البحث (#search-results-modal)
   --------------------------------------------------------------------------
   السبب الجذري: `.report-preview__dialog` حاوية flex عمودية بارتفاع ثابت
   و`overflow: hidden`. أبناؤها القابلون للتمرير كانوا بلا `min-height: 0`،
   فيمنعهم السلوك الافتراضي `min-height: auto` في flexbox من الانكماش، فتتجاوز
   أطوال التقارير (تفاصيل + صور عيوب + ملاحظات + PDF) ارتفاع النافذة وتُقصّ
   بلا أي شريط تمرير.

   الحل: تقييد ارتفاع المحتوى بـ 85vh مع `min-height: 0` و
   `overflow-y: auto !important`، وتحييد مناطق التمرير المتداخلة داخل التقرير
   حتى يكون التمرير واحدًا وسلسًا. كل القواعد مقيّدة بـ #search-results-modal
   كي لا تتأثر نوافذ `.report-preview` الأخرى (مثل مراجعة إعلانات الإدارة).
   ========================================================================== */

/* 0) الحاوية الخلفية: لا تقصّ النافذة داخل الشاشة (مساحة أمان للهوامش) */
#search-results-modal {
  padding: clamp(8px, 3vh, 24px);
}

#search-results-modal .search-results-modal__dialog {
  height: min(900px, 94vh);
  min-height: 0;
  max-height: calc(100vh - 2 * clamp(8px, 3vh, 24px));
  max-height: calc(100dvh - 2 * clamp(8px, 3vh, 24px));
}

/* 1) حالة التقرير: التفاصيل + صور العيوب + الملاحظات + معاينة PDF */
#search-results-modal #report-gate-report {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 85vh;
  overflow-y: auto !important;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* 2) حالة قائمة النتائج / لا نتائج */
#search-results-modal .search-results-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 85vh;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* 3) حالة بوابة الإعلان (بانر طويل أو وحدة Google Ads) */
#search-results-modal #report-gate-ad {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 85vh;
  overflow-y: auto !important;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

/* 4) تحييد التمرير المتداخل داخل التقرير: تمرير واحد للصفحة كاملة */
#search-results-modal #report-gate-report .report-details {
  flex: none;
  height: auto;
  max-height: none;
  overflow: visible;
}

/* 5) إطار PDF: ارتفاع مرن (بلا احتجاز) داخل الحاوية القابلة للتمرير */
#search-results-modal #search-results-modal-frame {
  display: block;
  width: 100%;
  min-height: 60vh;
  height: auto;
}

/* 6) شريط تمرير واضح ورقيق (Chromium / Firefox) */
#search-results-modal #report-gate-report,
#search-results-modal .search-results-modal__body,
#search-results-modal #report-gate-ad {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

#search-results-modal #report-gate-report::-webkit-scrollbar,
#search-results-modal .search-results-modal__body::-webkit-scrollbar,
#search-results-modal #report-gate-ad::-webkit-scrollbar {
  width: 10px;
}

#search-results-modal #report-gate-report::-webkit-scrollbar-thumb,
#search-results-modal .search-results-modal__body::-webkit-scrollbar-thumb,
#search-results-modal #report-gate-ad::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

#search-results-modal #report-gate-report::-webkit-scrollbar-track,
#search-results-modal .search-results-modal__body::-webkit-scrollbar-track,
#search-results-modal #report-gate-ad::-webkit-scrollbar-track {
  background: transparent;
}

/* 7) على الهواتف: النافذة بكامل الشاشة والتمرير داخل المحتوى */
@media (max-width: 680px) {
  /* بلا هوامش خلفية حتى لا تتجاوز النافذة حدود الشاشة وتُقصّ التذييل */
  #search-results-modal {
    padding: 0;
  }
  #search-results-modal .search-results-modal__dialog {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  #search-results-modal #search-results-modal-frame {
    min-height: 45vh;
  }
}

/* ============================================================================
   Phase 3 — بلاغات السيارات (User Reports) على الصفحة الرئيسية
   ========================================================================== */
.user-reports { margin-top: var(--sp-5); display: grid; gap: var(--sp-3); }
.user-reports__list { display: grid; gap: var(--sp-4); margin: 0; padding: 0; list-style: none; }
.user-report { display: grid; gap: var(--sp-3); padding: var(--sp-5); border: 1px solid #FCA5A5; border-right-width: 5px; border-radius: var(--r-lg, 14px); background: #FFF7F7; }
.user-report__head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-3); }
.user-report__badge { padding: 2px 10px; border-radius: 999px; background: #B91C1C; color: #FFFFFF; font-weight: 800; font-size: var(--fs-xs); }
.user-report__date { color: #92400E; font-size: var(--fs-xs); font-weight: 700; }
.user-report__title { margin: 0; font-size: var(--fs-lg, 1.05rem); color: var(--text-strong); }
.user-report__ids { margin: 0; color: var(--text-body); font-size: var(--fs-sm); }
.user-report__summary { margin: 0; color: var(--text-body); }
.user-report__notes { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); }
.user-report__media { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.user-report__media-img { width: 96px; height: 72px; object-fit: cover; border-radius: var(--r-md, 10px); border: 1px solid var(--border-subtle, #e2e8f0); }
.user-report__media-link { display: inline-flex; align-items: center; gap: var(--sp-1); color: #B91C1C; font-size: var(--fs-sm); text-decoration: underline; }
.user-report__owner-reply { display: grid; gap: var(--sp-2); padding: var(--sp-4); border-radius: var(--r-md, 10px); border: 1px solid #A7F3D0; background: #ECFDF5; }
.user-report__owner-reply-label { color: #065F46; }
.user-report__owner-reply-text { margin: 0; color: var(--text-body); }
.user-report__owner-reply-meta { color: var(--text-muted); font-size: var(--fs-xs); }
.user-report__disclaimer { margin: 0; padding: var(--sp-3); border-radius: var(--r-md, 10px); background: #FFFBEB; border: 1px dashed #FCD34D; color: #92400E; font-size: var(--fs-xs); }

/* ---------------------------------------------------------------------------
 * مبدّل اللغة (Language Switcher) — عربي / EN
 * ------------------------------------------------------------------------ */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2, 8px);
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle, #e2e8f0);
  background: var(--surface-muted, rgba(148, 163, 184, 0.12));
  white-space: nowrap;
}
.lang-switch__label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.lang-switch__btn {
  border: 0;
  background: transparent;
  color: var(--text-body, #334155);
  font: inherit;
  font-size: var(--fs-sm, 0.85rem);
  line-height: 1;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.lang-switch__btn:hover { background: var(--surface-hover, rgba(148, 163, 184, 0.18)); }
.lang-switch__btn.is-active,
.lang-switch__btn[aria-pressed="true"] {
  background: var(--brand-primary, #0F3D3E);
  color: #ffffff;
}
/* على الهيدر الداكن تكون الحالة غير النشطة فاتحة لتبقى مقروءة. */
.site-header .lang-switch__btn,
.auth-page__header .lang-switch__btn { color: var(--slate-200); }
.site-header .lang-switch__btn:hover,
.auth-page__header .lang-switch__btn:hover { color: #FFFFFF; }
.site-header .lang-switch__btn.is-active,
.auth-page__header .lang-switch__btn.is-active { color: #FFFFFF; }
.lang-switch--floating { position: fixed; top: 12px; inset-inline-end: 12px; z-index: 60; }

/* ---------------------------------------------------------------------------
 * مؤشر قوة كلمة المرور + أدوات كلمة المرور (إظهار/إخفاء، تطابق)
 * ------------------------------------------------------------------------ */
.pw-field { position: relative; display: block; }
.pw-field__input { padding-inline-end: 44px; }
.pw-toggle {
  position: absolute;
  inset-inline-end: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: var(--text-muted, #64748b);
  line-height: 0;
}
.pw-toggle:hover { background: var(--surface-hover, rgba(148, 163, 184, 0.18)); }
.pw-toggle:focus-visible { outline: 2px solid var(--brand-primary, #0F3D3E); outline-offset: 2px; }
.pw-strength { display: grid; gap: 6px; margin-top: var(--sp-2, 8px); }
.pw-strength__bar { display: flex; gap: 4px; }
.pw-strength__seg {
  height: 5px;
  flex: 1;
  border-radius: 999px;
  background: var(--border-subtle, #e2e8f0);
  transition: background-color 0.2s ease;
}
.pw-strength__seg.is-on-0 { background: #B91C1C; }
.pw-strength__seg.is-on-1 { background: #DC2626; }
.pw-strength__seg.is-on-2 { background: #D97706; }
.pw-strength__seg.is-on-3 { background: #15803D; }
.pw-strength__seg.is-on-4 { background: #047857; }
.pw-strength__text { margin: 0; font-size: var(--fs-xs, 0.75rem); color: var(--text-muted, #64748b); }
.pw-match { margin: 0; font-size: var(--fs-xs, 0.75rem); }
.pw-match.is-ok { color: #15803D; }
.pw-match.is-bad { color: #B91C1C; }
.pw-hint { margin: 0; font-size: var(--fs-xs, 0.75rem); color: var(--text-muted, #64748b); }

/* شريط مبدّل اللغة في الهيدر يجب ألا يزيد عن عرض الشاشة */
.site-header__actions .lang-switch,
.auth-page__header-inner .lang-switch { margin-inline-start: auto; }

/* ---------------------------------------------------------------------------
 * لوحة استعادة كلمة المرور (تدرّج: قناة → تحقق → كلمة مرور جديدة)
 * ------------------------------------------------------------------------ */
.recover { display: grid; gap: var(--sp-3, 12px); margin-top: var(--sp-3, 12px); padding-top: var(--sp-3, 12px); border-top: 1px solid var(--border-subtle, #e2e8f0); }
.recover__intro { margin: 0; }
.recover__channels { display: flex; gap: var(--sp-2, 8px); }
.recover__channel {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--r-md, 10px);
  border: 1px solid var(--border-subtle, #e2e8f0);
  background: transparent;
  color: var(--text-body, #334155);
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-sm, 0.85rem);
}
.recover__channel.is-active,
.recover__channel[aria-pressed="true"] {
  border-color: var(--brand-primary, #0F3D3E);
  background: var(--brand-primary, #0F3D3E);
  color: #ffffff;
}
.recover__step { display: grid; gap: var(--sp-2, 8px); }
.recover__link { display: grid; gap: var(--sp-1, 4px); padding: var(--sp-3, 12px); border-radius: var(--r-md, 10px); background: #F1F5F9; }
.recover__link-title { margin: 0; font-size: var(--fs-md, 1rem); }
.recover__status.is-error { color: #B91C1C; }
.recover__status.is-ok { color: #15803D; }
.recover__dev { color: #92400E; }

/* بطاقة الأمان وكلمة المرور */
.security-card__meta { display: flex; flex-wrap: wrap; gap: var(--sp-3, 12px); align-items: center; }
.security-card__note { margin: 0; padding: var(--sp-3, 12px); border-radius: var(--r-md, 10px); background: #FFFBEB; border: 1px dashed #FCD34D; color: #92400E; font-size: var(--fs-sm, 0.85rem); }
.security-card__field { display: grid; gap: 6px; margin-bottom: var(--sp-3, 12px); }
.security-card__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2, 8px); margin-top: var(--sp-3, 12px); }
.security-card__actions .btn { flex: 0 1 auto; }
.security-card__feedback { min-height: 1.5em; margin: var(--sp-2, 8px) 0 0; }
.security-card__feedback.is-error { color: #B91C1C; }
.security-card__copy[hidden] { display: none; }
.password-copy-fallback { position: fixed; inset-inline-start: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

@media (max-width: 560px) {
  .security-card__actions { align-items: stretch; flex-direction: column; }
  .security-card__actions .btn { width: 100%; }
}


