/* ==========================================================================
       WEN DESIGN SYSTEM v3.0 — UNIFIED TOKENS & ARCHITECTURE
       ========================================================================== */
    :root {
      --bg-canvas: #070d17;
      --bg-surface: #0e1726;
      --bg-elevated: #162235;
      --bg-glass: rgba(14, 23, 38, 0.88);
      --border-subtle: #1e2f48;
      --border-focus: #10b981;
      --text-primary: #f8fafc;
      --text-secondary: #cbd5e1;
      --text-muted: #94a3b8;
      --accent-emerald: #10b981;
      --accent-emerald-hover: #059669;
      --accent-amber: #f59e0b;
      --accent-sky: #0ea5e9;
      --accent-rose: #f43f5e;

      /* Legacy compatibility aliases */
      --background: var(--bg-canvas);
      --card: var(--bg-surface);
      --content: var(--bg-elevated);
      --border: var(--border-subtle);
      --foreground: var(--text-primary);
      --muted-foreground: var(--text-muted);

      --sat: env(safe-area-inset-top, 0px);
      --sab: env(safe-area-inset-bottom, 0px);
    }

    * {
      box-sizing: border-box;
    }

    html {
      font-family: "Cairo", "IBM Plex Sans Arabic", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      line-height: 1.65;
      background-color: var(--bg-canvas);
      color: var(--text-primary);
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      text-rendering: optimizeLegibility;
      scroll-behavior: smooth;
    }

    h1, h2, h3, h4, .font-heading {
      font-family: "Cairo", "IBM Plex Sans Arabic", sans-serif;
      line-height: 1.35;
      letter-spacing: -0.01em;
    }

    /* Minimum 48x48px Touch Ergonomics (WCAG 2.5.5) */
    .touch-target-48 {
      min-width: 48px;
      min-height: 48px;
    }

    .safe-bottom {
      padding-bottom: calc(0.5rem + var(--sab));
    }

    /* Hide Scrollbars Cleanly */
    .no-scrollbar::-webkit-scrollbar {
      display: none;
    }
    .no-scrollbar {
      -ms-overflow-style: none;
      scrollbar-width: none;
    }

    /* Card & Surface Aesthetics */
    .wen-surface-card {
      background-color: var(--bg-surface);
      border: 1px solid var(--border-subtle);
      border-radius: 1.25rem;
      box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.35);
      transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.22s ease, box-shadow 0.22s ease;
    }

    .deal-card {
      content-visibility: auto;
      contain-intrinsic-size: 380px;
      background-color: var(--bg-surface);
      border: 1px solid var(--border-subtle);
      border-radius: 1.25rem;
      overflow: hidden;
      transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.24s ease, box-shadow 0.24s ease;
    }
    .deal-card:hover {
      transform: translateY(-4px);
      border-color: rgba(16, 185, 129, 0.45);
      box-shadow: 0 18px 36px -10px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(16, 185, 129, 0.15);
    }
    .deal-card:has(.reserved-badge) {
      border-color: rgba(16, 185, 129, 0.75);
    }

    /* Unified Sticky Header Architecture */
    .wen-app-header {
      position: sticky;
      top: 0;
      z-index: 50;
      background-color: var(--bg-glass);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-bottom: 1px solid var(--border-subtle);
    }

    /* Unified Search & Location Pill */
    .wen-search-bar {
      display: flex;
      align-items: center;
      background-color: var(--bg-elevated);
      border: 1px solid var(--border-subtle);
      border-radius: 9999px;
      padding: 0.25rem;
      transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }
    .wen-search-bar:focus-within {
      border-color: var(--accent-emerald);
      box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
    }

    /* Category Pills */
    .wen-cat-pill {
      display: inline-flex;
      align-items: center;
      gap: 0.45rem;
      white-space: nowrap;
      min-height: 44px;
      padding: 0.5rem 1rem;
      border-radius: 0.875rem;
      font-size: 0.85rem;
      font-weight: 700;
      color: var(--text-muted);
      background-color: transparent;
      border: 1px solid transparent;
      cursor: pointer;
      transition: all 0.18s ease;
    }
    .wen-cat-pill:hover {
      color: var(--text-primary);
      background-color: var(--bg-elevated);
    }
    .wen-cat-pill.is-active {
      color: #ffffff;
      background-color: var(--accent-emerald);
      box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
    }

    /* Sub-category & Quick Filter Chips */
    .wen-filter-chip {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      white-space: nowrap;
      min-height: 38px;
      padding: 0.35rem 0.85rem;
      border-radius: 9999px;
      font-size: 0.78rem;
      font-weight: 600;
      color: var(--text-secondary);
      background-color: var(--bg-elevated);
      border: 1px solid var(--border-subtle);
      cursor: pointer;
      transition: all 0.16s ease;
    }
    .wen-filter-chip:hover {
      border-color: var(--accent-emerald);
      color: var(--text-primary);
    }
    .wen-filter-chip.is-active {
      background-color: rgba(16, 185, 129, 0.16);
      color: #34d399;
      border-color: var(--accent-emerald);
      font-weight: 700;
    }

    /* Slide-Over AI Advisor Drawer */
    .wen-drawer-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(3, 7, 18, 0.75);
      backdrop-filter: blur(6px);
      z-index: 90;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.22s ease;
    }
    .wen-drawer-backdrop.is-open {
      opacity: 1;
      pointer-events: auto;
    }

    #desktopAiSidebar {
      position: fixed;
      top: 0;
      bottom: 0;
      width: min(440px, 92vw);
      max-height: 100dvh;
      overflow-y: auto;
      background: var(--bg-surface);
      border-inline-end: 1px solid var(--border-subtle);
      color: var(--text-primary);
      z-index: 100;
      padding: 1.5rem;
      box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
      transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
      display: none;
    }
    html[dir="rtl"] #desktopAiSidebar {
      left: 0;
      right: auto;
      transform: translateX(-105%);
    }
    html[dir="rtl"] #desktopAiSidebar.is-open {
      transform: translateX(0);
      display: block;
    }
    html[dir="ltr"] #desktopAiSidebar {
      right: 0;
      left: auto;
      transform: translateX(105%);
    }
    html[dir="ltr"] #desktopAiSidebar.is-open {
      transform: translateX(0);
      display: block;
    }

    /* Native Dialog Modals */
    dialog {
      background-color: var(--bg-surface);
      color: var(--text-primary);
      border: 1px solid var(--border-subtle);
      border-radius: 1.5rem;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75);
    }
    dialog::backdrop {
      background: rgba(3, 7, 18, 0.78);
      backdrop-filter: blur(8px);
    }
    @media (max-width: 640px) {
      #voucherQrModal, #priceHistoryModal, #customerAccountSettingsModal, #offerPresentationModal {
        margin-bottom: 0 !important;
        margin-top: auto !important;
        width: 100vw !important;
        max-width: 100vw !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        border-top-left-radius: 1.5rem !important;
        border-top-right-radius: 1.5rem !important;
        max-height: 92vh;
        overflow-y: auto;
      }
    }

    #offerPresentationModal {
      padding: 0;
      width: min(800px, 95vw);
      max-height: 90vh;
      overflow-y: auto;
    }

    .wen-offer-hero {
      position: relative;
      width: 100%;
      aspect-ratio: 16 / 9;
      background: #070d17;
      overflow: hidden;
    }
    .wen-offer-hero img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
    .wen-offer-content {
      padding: 1.5rem;
      display: flex;
      flex-direction: column;
      gap: 1.25rem;
    }

    .wen-modal-sticky-bar {
      position: sticky;
      bottom: 0;
      background: var(--bg-surface);
      border-top: 1px solid var(--border-subtle);
      padding: 0.875rem 1.5rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
      box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
      z-index: 30;
    }

    .wen-wa-share-btn {
      background: #10b981;
      color: #ffffff;
      border-radius: 0.875rem;
      font-weight: 700;
      transition: background 0.15s ease;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.4rem;
    }
    .wen-wa-share-btn:hover {
      background: #059669;
    }

    /* Technical Voucher Metadata Accordion */
    .wen-voucher-tech-details {
      margin-top: 0.65rem;
      padding: 0.65rem 0.85rem;
      background: var(--bg-elevated);
      border: 1px solid var(--border-subtle);
      border-radius: 0.875rem;
      font-size: 0.78rem;
      color: var(--text-muted);
    }
    .wen-voucher-tech-details summary {
      cursor: pointer;
      font-weight: 700;
      user-select: none;
      color: var(--text-primary);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .wen-voucher-tech-details summary:hover {
      color: var(--accent-emerald);
    }

    ::view-transition-old(root),
    ::view-transition-new(root) {
      animation-duration: 180ms;
    }
