/**
 * RL UI — Saudi identity
 * Flag green primary + sand surfaces + soft gold accent only.
 * Fonts: Cormorant Garamond (display) + DM Sans (UI)
 */

html.rl-theme-modern {
  /* Follow the Admin → Design & Appearance font choices via the layout's
     :root variables; fall back to the modern pairing if unset. */
  --rl-font: var(--font-family, "DM Sans", "Inter", system-ui, -apple-system, sans-serif);
  --rl-display: var(--font-heading, "Cormorant Garamond", "Times New Roman", Georgia, serif);
  --rl-action-height: 3rem;
  --rl-touch-size: 2.75rem;
  --rl-control-radius: 0.625rem;
  --rl-action-icon: 1.125rem;
  --rl-action-gap: 0.5rem;
  --rl-action-font-size: 0.9375rem;

  /*
   * Brand colors from :root (Admin → Design).
   * Defaults: Saudi flag green #006C35 / deep green #004D25.
   * Soft gold is decorative only (borders, chips) — not the main brand.
   */
  --saudi-gold: #c4a35a;
  --saudi-gold-soft: rgba(196, 163, 90, 0.14);
  --on-brand: #ffffff;
  --royal-gold: var(--primary);
  --royal-gold-bright: color-mix(in srgb, var(--primary) 78%, #ffffff);
  --royal-gold-deep: var(--secondary);
  --royal-accent-soft: color-mix(in srgb, var(--primary) 14%, transparent);
}

/* —— Day (light) — warm sand / desert stone —— */
html.rl-theme-modern:not(.dark) {
  --royal-page: #f6f3ec;
  --royal-card: #fffefb;
  --royal-ink: #1a211c;
  --royal-muted: #4f5a52;
  --royal-border: rgba(26, 33, 28, 0.09);
  --royal-gold-soft: color-mix(in srgb, var(--primary) 8%, transparent);
  --royal-shadow: 0 1px 2px rgba(26, 33, 28, 0.04), 0 12px 32px -16px rgba(0, 77, 37, 0.12);
  --bg-primary: var(--royal-page);
  --bg-secondary: var(--royal-card);
  --bg-card: var(--royal-card);
  --bg-nav: rgba(246, 243, 236, 0.9);
  --text-primary: var(--royal-ink);
  --text-secondary: var(--royal-muted);
  --text-muted: #6b756e;
  --border-color: var(--royal-border);
  --border-light: rgba(26, 33, 28, 0.05);
  --input-bg: #faf8f4;
  --input-border: rgba(26, 33, 28, 0.12);
  --glass-bg: rgba(255, 254, 251, 0.92);
  --glass-border: rgba(26, 33, 28, 0.08);
  --shadow-color: rgba(26, 33, 28, 0.07);
  color-scheme: light;
}

/* —— Night (dark) — deep charcoal with green undertone —— */
html.rl-theme-modern.dark {
  --royal-page: #0f1411;
  --royal-card: #1a211c;
  --royal-ink: #e8efe9;
  --royal-muted: #a3b0a7;
  --royal-border: rgba(255, 255, 255, 0.08);
  --royal-gold-soft: color-mix(in srgb, var(--primary) 12%, transparent);
  --royal-gold-bright: color-mix(in srgb, var(--primary) 70%, #e8efe9);
  --royal-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 16px 40px -18px rgba(0, 0, 0, 0.55);
  --bg-primary: var(--royal-page);
  --bg-secondary: var(--royal-card);
  --bg-card: var(--royal-card);
  --bg-nav: rgba(15, 20, 17, 0.94);
  --text-primary: var(--royal-ink);
  --text-secondary: var(--royal-muted);
  --text-muted: #88948c;
  --border-color: var(--royal-border);
  --border-light: rgba(255, 255, 255, 0.05);
  --input-bg: #141a16;
  --input-border: rgba(255, 255, 255, 0.1);
  --glass-bg: rgba(26, 33, 28, 0.94);
  --glass-border: rgba(255, 255, 255, 0.08);
  --shadow-color: rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

html.rl-theme-modern body {
  font-family: var(--rl-font) !important;
  /* Soft Saudi green wash at top — calm, not neon */
  background:
    radial-gradient(ellipse 90% 42% at 50% -18%, var(--royal-gold-soft), transparent 58%),
    radial-gradient(ellipse 50% 30% at 100% 0%, var(--saudi-gold-soft), transparent 55%),
    var(--bg-primary) !important;
  color: var(--text-primary) !important;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html.rl-theme-modern h1,
html.rl-theme-modern h2,
html.rl-theme-modern h3,
html.rl-theme-modern .logo-text,
html.rl-theme-modern .page-header h1,
html.rl-theme-modern .tracking-head h1,
html.rl-theme-modern .rl-card__title {
  font-family: var(--rl-display) !important;
  letter-spacing: -0.02em;
  font-weight: 600;
}

/* —— Nav (safe-area aware for PWA / notch) —— */
html.rl-theme-modern .nav,
html.rl-theme-modern .rl-nav {
  background: var(--bg-nav) !important;
  border-bottom: 1px solid var(--border-color) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: none !important;
  /* Keep header content below status bar when installed as app */
  padding-top: env(safe-area-inset-top, 0px) !important;
  padding-left: env(safe-area-inset-left, 0px) !important;
  padding-right: env(safe-area-inset-right, 0px) !important;
  top: 0 !important;
  z-index: 200 !important;
}

html.rl-theme-modern .rl-nav__inner,
html.rl-theme-modern .nav-inner {
  max-width: 880px !important;
  margin: 0 auto;
  height: 3.85rem !important;
  min-height: 3.5rem !important;
  padding: 0 1.25rem !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-sizing: border-box;
}

/* Home page shell: fill remaining viewport under sticky nav (avoids nav + 100vh scroll) */
html.rl-theme-modern body:has(.rl-home) {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

html.rl-theme-modern body:has(.rl-home) > .rl-nav {
  flex-shrink: 0;
}

html.rl-theme-modern body:has(.rl-home) > .rl-footer {
  flex-shrink: 0;
}

/* Landing main content sits below sticky header; fill remaining column space */
html.rl-theme-modern .rl-home {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
  /* Clip off-canvas drawer without breaking the sticky header (scroll container would) */
  overflow-x: clip;
}

html.rl-theme-modern .rl-main {
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
  padding-bottom: max(1.5rem, calc(env(safe-area-inset-bottom, 0px) + 1rem));
}

/* Fixed UI chrome */
html.rl-theme-modern .theme-toggle-fab {
  top: calc(env(safe-area-inset-top, 0px) + 0.75rem) !important;
  right: calc(env(safe-area-inset-right, 0px) + 0.75rem) !important;
}

html.rl-theme-modern .mobile-menu {
  padding-top: env(safe-area-inset-top, 0px) !important;
  padding-right: env(safe-area-inset-right, 0px) !important;
  padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
}

@media all and (display-mode: standalone),
       all and (display-mode: fullscreen) {
  html.rl-theme-modern body {
    /* Avoid bounce revealing gaps under the status bar */
    overscroll-behavior-y: none;
  }
}

html.rl-theme-modern .logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}

html.rl-theme-modern .logo-icon {
  width: 2.15rem !important;
  height: 2.15rem !important;
  border-radius: 0.5rem !important;
  background: linear-gradient(160deg, var(--royal-gold-bright), var(--royal-gold-deep)) !important;
  color: var(--on-brand) !important;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 28%, transparent) !important;
  font-size: 0.95rem !important;
  font-family: var(--rl-display) !important;
}

html.rl-theme-modern .logo-icon .logo-mark {
  width: 1.15rem !important;
  height: 1.15rem !important;
  display: block;
}

html.rl-theme-modern .logo-text {
  font-size: 1.15rem !important;
  font-weight: 600 !important;
  color: var(--text-primary) !important;
}

/* Flag only (no KSA label) */
html.rl-theme-modern .rl-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem;
  border-radius: 0.45rem;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  line-height: 0;
}

html.rl-theme-modern .rl-flag img {
  width: 26px;
  height: 17px;
  object-fit: cover;
  border-radius: 2px;
  display: block;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

html.rl-theme-modern .rl-nav__actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

html.rl-theme-modern .theme-toggle,
html.rl-theme-modern .mobile-menu-btn,
html.rl-theme-modern .mobile-menu-close {
  min-width: 2.75rem !important;
  min-height: 2.75rem !important;
}

/* Buttons */
html.rl-theme-modern .btn,
html.rl-theme-modern .theme-toggle,
html.rl-theme-modern .pwa-install-btn,
html.rl-theme-modern .mobile-menu-btn {
  border-radius: 0.55rem !important;
  font-weight: 600 !important;
  font-size: 0.85rem !important;
  box-shadow: none !important;
  color: var(--text-secondary);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease !important;
}

html.rl-theme-modern .btn:hover,
html.rl-theme-modern .theme-toggle:hover {
  transform: none !important;
}

html.rl-theme-modern .btn-primary,
html.rl-theme-modern a.btn-primary,
html.rl-theme-modern .rl-btn--primary {
  background: linear-gradient(180deg, var(--royal-gold-bright), var(--royal-gold-deep)) !important;
  color: var(--on-brand) !important;
  border: 1px solid color-mix(in srgb, var(--secondary) 70%, #000) !important;
  font-weight: 650 !important;
}

html.rl-theme-modern .btn-primary:hover,
html.rl-theme-modern a.btn-primary:hover,
html.rl-theme-modern .rl-btn--primary:hover {
  filter: brightness(1.03);
}

html.rl-theme-modern .btn-secondary,
html.rl-theme-modern .theme-toggle,
html.rl-theme-modern .pwa-install-btn,
html.rl-theme-modern .rl-btn--secondary {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
}

html.rl-theme-modern .btn-secondary:hover,
html.rl-theme-modern .theme-toggle:hover,
html.rl-theme-modern .rl-btn--secondary:hover {
  background: color-mix(in srgb, var(--bg-primary) 70%, var(--bg-secondary)) !important;
  color: var(--text-primary) !important;
  border-color: color-mix(in srgb, var(--primary) 28%, var(--border-color)) !important;
}

html.rl-theme-modern.dark .btn-secondary:hover,
html.rl-theme-modern.dark .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--text-primary) !important;
}

/* Theme toggle icons — ensure visibility */
html.rl-theme-modern .theme-toggle {
  width: 2.4rem;
  height: 2.4rem;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

html.rl-theme-modern .theme-toggle svg,
html.rl-theme-modern .theme-toggle i {
  width: 1.1rem !important;
  height: 1.1rem !important;
  stroke: currentColor !important;
  color: inherit !important;
}

html.rl-theme-modern:not(.dark) .theme-toggle .moon-icon { display: block !important; }
html.rl-theme-modern:not(.dark) .theme-toggle .sun-icon { display: none !important; }
html.rl-theme-modern.dark .theme-toggle .moon-icon { display: none !important; }
html.rl-theme-modern.dark .theme-toggle .sun-icon { display: block !important; }

/* —— Forms (wizard, track, login) —— */
html.rl-theme-modern .form-group {
  margin-bottom: 1.15rem;
}

html.rl-theme-modern .form-label {
  display: block;
  font-size: 0.9375rem !important;
  font-weight: 600 !important;
  color: var(--text-primary) !important;
  margin-bottom: 0.45rem !important;
  letter-spacing: -0.01em;
}

html.rl-theme-modern .form-input,
html.rl-theme-modern .form-select,
html.rl-theme-modern .form-textarea,
html.rl-theme-modern input[type="text"],
html.rl-theme-modern input[type="email"],
html.rl-theme-modern input[type="password"],
html.rl-theme-modern input[type="date"],
html.rl-theme-modern input[type="month"],
html.rl-theme-modern input[type="number"],
html.rl-theme-modern input[type="tel"],
html.rl-theme-modern select,
html.rl-theme-modern textarea {
  width: 100%;
  border-radius: 0.6rem !important;
  border: 1px solid var(--border-color) !important;
  background: var(--input-bg) !important;
  color: var(--text-primary) !important;
  box-shadow: none !important;
  font-family: var(--rl-font) !important;
  font-size: 0.95rem !important;
  padding: 0.8rem 0.95rem !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease !important;
}

html.rl-theme-modern .form-input:focus,
html.rl-theme-modern .form-select:focus,
html.rl-theme-modern .form-textarea:focus,
html.rl-theme-modern input:focus,
html.rl-theme-modern select:focus,
html.rl-theme-modern textarea:focus {
  outline: none !important;
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border-color)) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent) !important;
  background: var(--bg-secondary) !important;
}

html.rl-theme-modern .form-input::placeholder,
html.rl-theme-modern .form-textarea::placeholder,
html.rl-theme-modern input::placeholder,
html.rl-theme-modern textarea::placeholder {
  color: var(--text-muted) !important;
  opacity: 0.85;
}

html.rl-theme-modern .form-input.error,
html.rl-theme-modern .form-select.error,
html.rl-theme-modern .form-textarea.error,
html.rl-theme-modern input.error,
html.rl-theme-modern select.error {
  border-color: #c45c5c !important;
}

html.rl-theme-modern .field-error {
  color: #c45c5c !important;
  font-size: 0.8rem;
}

html.rl-theme-modern .optional-badge {
  color: var(--text-muted) !important;
  background: var(--royal-gold-soft) !important;
}

html.rl-theme-modern .wizard-container,
html.rl-theme-modern .tracking-card,
html.rl-theme-modern .login-card,
html.rl-theme-modern .glass {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--royal-shadow) !important;
  backdrop-filter: none !important;
  border-radius: 1rem !important;
  color: var(--text-primary) !important;
}

html.rl-theme-modern .request-page,
html.rl-theme-modern .tracking-page,
html.rl-theme-modern .login-page {
  background: transparent !important;
}

html.rl-theme-modern .ambient-bg,
html.rl-theme-modern .particles {
  display: none !important;
}

/* Wizard steps */
html.rl-theme-modern .step-circle {
  border-color: var(--border-color) !important;
  background: var(--bg-primary) !important;
  color: var(--text-muted) !important;
}

html.rl-theme-modern .step-circle.active,
html.rl-theme-modern .step-circle.completed {
  background: linear-gradient(180deg, var(--royal-gold-bright), var(--royal-gold-deep)) !important;
  border-color: var(--royal-gold-deep) !important;
  color: var(--on-brand) !important;
  box-shadow: none !important;
}

html.rl-theme-modern .step-connector {
  background: var(--border-color) !important;
}

html.rl-theme-modern .step-connector.completed,
html.rl-theme-modern .step-connector.completed::after {
  background: var(--royal-gold) !important;
}

html.rl-theme-modern .step-label {
  color: var(--text-muted) !important;
}

html.rl-theme-modern .step-item.active .step-label {
  color: var(--text-primary) !important;
}

/* Wizard / form action buttons (override hardcoded indigo) */
html.rl-theme-modern .btn-next,
html.rl-theme-modern .btn-submit,
html.rl-theme-modern button.btn-next,
html.rl-theme-modern button.btn-submit {
  background: linear-gradient(180deg, var(--royal-gold-bright), var(--royal-gold-deep)) !important;
  color: var(--on-brand) !important;
  border: 1px solid var(--royal-gold-deep) !important;
  border-radius: 0.6rem !important;
  font-weight: 650 !important;
  box-shadow: none !important;
}

html.rl-theme-modern .btn-next:hover,
html.rl-theme-modern .btn-submit:hover {
  filter: brightness(1.05);
  background: linear-gradient(180deg, var(--royal-gold-bright), var(--royal-gold)) !important;
}

html.rl-theme-modern .btn-back,
html.rl-theme-modern .back-link {
  color: var(--text-muted) !important;
  border-color: var(--border-color) !important;
}

html.rl-theme-modern .btn-back:hover,
html.rl-theme-modern .back-link:hover {
  color: var(--royal-gold-deep) !important;
  border-color: var(--royal-gold) !important;
}

html.rl-theme-modern.dark .btn-back:hover,
html.rl-theme-modern.dark .back-link:hover {
  color: var(--royal-gold-bright) !important;
}

html.rl-theme-modern .login-icon {
  animation: none !important;
  background: linear-gradient(145deg, var(--royal-gold-bright), var(--royal-gold-deep)) !important;
  box-shadow: none !important;
  color: var(--on-brand) !important;
}

html.rl-theme-modern .tracking-head h1,
html.rl-theme-modern .page-header h1 {
  color: var(--text-primary) !important;
}

html.rl-theme-modern .tracking-label {
  border-color: var(--border-color) !important;
  background: var(--royal-gold-soft) !important;
  color: var(--royal-gold-deep) !important;
}

html.rl-theme-modern.dark .tracking-label {
  color: var(--royal-gold-bright) !important;
}

/* Select chevron on dark/light */
html.rl-theme-modern select.form-select,
html.rl-theme-modern select {
  appearance: auto;
  color-scheme: inherit;
}

/* —— intl-tel-input: never paint countries as an open list —— */
html.rl-theme-modern .iti__hide,
html.rl-theme-modern .iti .iti__hide,
html.rl-theme-modern .iti__dropdown-content.iti__hide {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  pointer-events: none !important;
}

html.rl-theme-modern .iti {
  width: 100%;
  display: block;
}

html.rl-theme-modern .iti__tel-input {
  width: 100% !important;
}

html.rl-theme-modern .iti--inline-dropdown .iti__dropdown-content:not(.iti__hide) {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
  z-index: 10060 !important;
}

html.rl-theme-modern .iti__country-list {
  background: var(--bg-secondary) !important;
  list-style: none !important;
}

html.rl-theme-modern .iti__country-name,
html.rl-theme-modern .iti__selected-country {
  color: var(--text-primary) !important;
}

html.rl-theme-modern .iti__dial-code,
html.rl-theme-modern .iti__selected-dial-code {
  color: var(--text-muted) !important;
}

/* Tracking / login shells aligned with request wizard */
html.rl-theme-modern .tracking-shell,
html.rl-theme-modern .login-wrapper {
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

html.rl-theme-modern .tracking-card,
html.rl-theme-modern .login-wrapper .card,
html.rl-theme-modern .login-card {
  border-radius: 1rem !important;
}

html.rl-theme-modern .alert-box {
  border-radius: 0.75rem !important;
}

/* Login page consistency */
html.rl-theme-modern .login-card {
  border-radius: 1rem !important;
  box-shadow: var(--royal-shadow, 0 12px 40px -16px rgba(0, 0, 0, 0.2)) !important;
}

html.rl-theme-modern .login-card:hover {
  transform: none !important;
}

html.rl-theme-modern .login-btn {
  background: linear-gradient(180deg, var(--royal-gold-bright, #1a8a4a), var(--royal-gold, #006c35)) !important;
  color: var(--on-brand, #fff) !important;
  border-radius: 0.65rem !important;
  font-weight: 650 !important;
  box-shadow: none !important;
}

html.rl-theme-modern .login-header h1 {
  font-family: var(--rl-display, "Cormorant Garamond", Georgia, serif) !important;
  font-weight: 600 !important;
  letter-spacing: -0.02em;
}

html.rl-theme-modern .tracking-head h1 {
  font-family: var(--rl-display, "Cormorant Garamond", Georgia, serif) !important;
  font-weight: 600 !important;
  font-size: clamp(1.5rem, 3.5vw, 1.9rem) !important;
  letter-spacing: -0.025em !important;
}

html.rl-theme-modern .tracking-page {
  background: var(--bg-primary) !important;
}

html.rl-theme-modern .alert-box.success {
  color: var(--text-primary) !important;
}

html.rl-theme-modern.dark .alert-box.success {
  color: #6ee7b7 !important;
}

html.rl-theme-modern.dark .alert-box.error {
  color: #fca5a5 !important;
}

/* Icons use currentColor */
html.rl-theme-modern [data-lucide],
html.rl-theme-modern svg.lucide {
  stroke: currentColor;
  color: inherit;
}

/* —— Landing —— */
html.rl-theme-modern .rl-home {
  background:
    radial-gradient(ellipse 85% 40% at 50% -8%, var(--royal-gold-soft), transparent 62%),
    radial-gradient(ellipse 40% 28% at 0% 100%, var(--saudi-gold-soft), transparent 60%),
    var(--bg-primary);
}

html.rl-theme-modern .rl-home__mesh,
html.rl-theme-modern .rl-home__grid,
html.rl-theme-modern .rl-bento,
html.rl-theme-modern .rl-panel,
html.rl-theme-modern .scroll-to-top,
html.rl-theme-modern .rl-card__flag,
html.rl-theme-modern .rl-card__kicker {
  display: none !important;
}

html.rl-theme-modern .rl-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem 2.25rem;
  min-height: 0;
}

html.rl-theme-modern .rl-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 1.15rem;
  box-shadow: var(--royal-shadow);
  padding: 2rem 1.65rem 1.55rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

html.rl-theme-modern .rl-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--primary) 55%, transparent), transparent);
  opacity: 0.85;
}

html.rl-theme-modern .rl-card__title {
  font-size: clamp(1.55rem, 4vw, 1.95rem);
  line-height: 1.25;
  color: var(--text-primary);
  margin: 0 0 0.7rem;
}

html.rl-theme-modern .rl-card__title span {
  color: color-mix(in srgb, var(--secondary) 70%, var(--text-primary));
}

html.rl-theme-modern.dark .rl-card__title span {
  color: color-mix(in srgb, var(--primary) 55%, #e8e4dc);
}

html.rl-theme-modern .rl-card__desc {
  margin: 0 auto 1.45rem;
  max-width: 22rem;
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--text-secondary);
  font-family: var(--rl-font);
}

html.rl-theme-modern .rl-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1.3rem;
}

html.rl-theme-modern .rl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.78rem 1rem;
  border-radius: 0.65rem;
  font-weight: 650;
  font-size: 0.92rem;
  font-family: var(--rl-font);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

html.rl-theme-modern .rl-btn--primary {
  color: var(--on-brand);
  background: linear-gradient(180deg, var(--royal-gold-bright), var(--royal-gold-deep));
  border-color: color-mix(in srgb, var(--secondary) 70%, #000);
}

html.rl-theme-modern .rl-btn--primary:hover {
  filter: brightness(1.03);
}

html.rl-theme-modern .rl-btn--secondary {
  color: var(--text-primary);
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

html.rl-theme-modern .rl-btn--secondary:hover {
  background: color-mix(in srgb, var(--bg-primary) 55%, var(--bg-secondary));
  border-color: color-mix(in srgb, var(--primary) 25%, var(--border-color));
}

html.rl-theme-modern .rl-steps {
  list-style: none;
  margin: 0;
  padding: 0.85rem 0 0;
  border-top: 1px solid var(--border-color);
  text-align: left;
}

html.rl-theme-modern .rl-steps li {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.55rem 0.1rem;
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.45;
  font-family: var(--rl-font);
}

html.rl-theme-modern .rl-steps strong {
  color: var(--text-primary);
  font-weight: 650;
}

html.rl-theme-modern .rl-step-n {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--rl-font);
  color: var(--royal-gold-deep);
  background: var(--royal-gold-soft);
  border: 1px solid var(--border-color);
  margin-top: 1px;
}

html.rl-theme-modern.dark .rl-step-n {
  color: var(--royal-gold-bright);
}

/* Footer — flag only next to credit */
html.rl-theme-modern .rl-footer {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1.25rem 1.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-align: center;
  font-family: var(--rl-font);
}

/* Home: slightly tighter footer only (keeps card breathing room) */
html.rl-theme-modern body:has(.rl-home) > .rl-footer {
  padding-top: 0.25rem;
  padding-bottom: 0.85rem;
}

html.rl-theme-modern .rl-footer a {
  color: var(--royal-gold-deep);
  text-decoration: none;
  font-weight: 600;
}

html.rl-theme-modern.dark .rl-footer a {
  color: var(--royal-gold);
}

html.rl-theme-modern .rl-footer a:hover {
  color: var(--royal-gold-bright);
}

html.rl-theme-modern .rl-footer__credit {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

html.rl-theme-modern .rl-footer__credit img {
  width: 20px;
  height: 13px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

html.rl-theme-modern .developer-link .dev-name {
  background: none;
  color: inherit;
  -webkit-text-fill-color: unset;
  font-weight: 600;
  font-family: var(--rl-font);
}

/* Welcome modal */
html.rl-theme-modern .welcome-modal-overlay {
  background: rgba(10, 10, 11, 0.55) !important;
}

html.rl-theme-modern.dark .welcome-modal-overlay {
  background: rgba(0, 0, 0, 0.72) !important;
}

html.rl-theme-modern .welcome-card {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 1rem !important;
  box-shadow: var(--royal-shadow) !important;
  color: var(--text-primary) !important;
}

html.rl-theme-modern .welcome-kicker {
  color: var(--royal-gold-deep) !important;
  font-family: var(--rl-font) !important;
}

html.rl-theme-modern.dark .welcome-kicker {
  color: var(--royal-gold) !important;
}

html.rl-theme-modern .welcome-title {
  color: var(--text-primary) !important;
  font-family: var(--rl-display) !important;
}

html.rl-theme-modern .welcome-text {
  color: var(--text-secondary) !important;
  font-family: var(--rl-font) !important;
}

html.rl-theme-modern .welcome-note {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

html.rl-theme-modern .welcome-note i {
  color: var(--royal-gold) !important;
}

html.rl-theme-modern .welcome-btn {
  background: linear-gradient(180deg, var(--royal-gold-bright), var(--royal-gold-deep)) !important;
  color: var(--on-brand) !important;
  border-radius: 0.6rem !important;
  box-shadow: none !important;
  font-family: var(--rl-font) !important;
}

html.rl-theme-modern .welcome-icon-wrapper {
  background: var(--royal-gold-soft) !important;
  color: var(--royal-gold-deep) !important;
  border: 1px solid var(--border-color);
}

html.rl-theme-modern.dark .welcome-icon-wrapper {
  color: var(--royal-gold-bright) !important;
}

/* Mobile menu — Saudi green wash drawer */
html.rl-theme-modern .mobile-menu {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 8%, transparent) 0%, transparent 7rem),
    var(--bg-secondary) !important;
  border-left: 1px solid var(--border-color) !important;
  box-shadow: -20px 0 50px -18px rgba(0, 0, 0, 0.45) !important;
}

html.rl-theme-modern .mobile-menu-header {
  border-bottom-color: var(--border-color) !important;
}

html.rl-theme-modern .mobile-menu-kicker {
  color: var(--royal-gold-deep) !important;
  font-family: var(--rl-font) !important;
}

html.rl-theme-modern.dark .mobile-menu-kicker {
  color: var(--royal-gold) !important;
}

html.rl-theme-modern .mobile-menu-title {
  font-family: var(--rl-display) !important;
  font-weight: 600 !important;
}

html.rl-theme-modern .mobile-menu-close {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

html.rl-theme-modern .mobile-nav-label {
  color: var(--text-muted) !important;
  font-family: var(--rl-font) !important;
}

html.rl-theme-modern .mobile-nav-card {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-color) !important;
}

html.rl-theme-modern .mobile-nav-card:hover,
html.rl-theme-modern .mobile-nav-card:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border-color)) !important;
  box-shadow: 0 10px 28px -16px rgba(0, 0, 0, 0.35) !important;
}

html.rl-theme-modern .mobile-nav-card.item-request .mobile-nav-icon {
  background: var(--royal-gold-soft) !important;
  color: var(--royal-gold-deep) !important;
  border-color: color-mix(in srgb, var(--primary) 22%, var(--border-color)) !important;
}

html.rl-theme-modern.dark .mobile-nav-card.item-request .mobile-nav-icon {
  color: var(--royal-gold-bright) !important;
}

html.rl-theme-modern .mobile-nav-title {
  font-family: var(--rl-font) !important;
}

html.rl-theme-modern .mobile-theme-card {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-color) !important;
}

html.rl-theme-modern .mobile-theme-icon {
  background: var(--royal-gold-soft) !important;
  color: var(--royal-gold-deep) !important;
}

html.rl-theme-modern.dark .mobile-theme-icon {
  color: var(--royal-gold-bright) !important;
}

html.rl-theme-modern .mobile-theme-switch {
  background: color-mix(in srgb, var(--primary) 25%, transparent) !important;
}

html.rl-theme-modern.dark .mobile-theme-switch {
  background: var(--royal-gold) !important;
}

html.rl-theme-modern .mobile-menu-btn {
  color: var(--text-primary) !important;
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

html.rl-theme-modern .mobile-menu-btn.is-open {
  color: var(--royal-gold-deep) !important;
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border-color)) !important;
  background: var(--royal-gold-soft) !important;
}

html.rl-theme-modern.dark .mobile-menu-btn.is-open {
  color: var(--royal-gold-bright) !important;
}

html.rl-theme-modern .mobile-menu-btn svg {
  stroke: currentColor;
}

html.rl-theme-modern .mobile-menu-overlay {
  background: rgba(10, 10, 11, 0.55) !important;
}

/* Global floating theme toggle (layouts.app) */
html.rl-theme-modern .theme-toggle-fab {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--royal-shadow) !important;
}
html.rl-theme-modern .theme-toggle-fab:hover {
  border-color: color-mix(in srgb, var(--primary) 50%, var(--border-color)) !important;
  color: var(--royal-gold-deep) !important;
}
html.rl-theme-modern.dark .theme-toggle-fab:hover {
  color: var(--royal-gold-bright) !important;
}

/* PWA update banner — theme-aware (replaces hardcoded colors) */
html.rl-theme-modern .pwa-update-banner {
  position: fixed;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10400;
  max-width: min(92vw, 26rem);
  width: calc(100% - 2rem);
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-radius: 0.9rem;
  box-sizing: border-box;
  font: 600 0.875rem/1.35 var(--rl-font, system-ui, sans-serif) !important;
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border: 1px solid color-mix(in srgb, var(--primary) 32%, var(--border-color)) !important;
  box-shadow: var(--royal-shadow) !important;
}

html.rl-theme-modern .pwa-update-banner__label {
  flex: 1;
}

html.rl-theme-modern .pwa-update-banner__btn {
  flex-shrink: 0;
  box-sizing: border-box !important;
  min-height: 2.5rem !important;
  border: 0;
  border-radius: var(--rl-control-radius, 0.625rem) !important;
  padding: 0.625rem 0.875rem !important;
  font-weight: 700;
  font-size: 0.875rem !important;
  font-family: var(--rl-font, system-ui, sans-serif);
  cursor: pointer;
  background: linear-gradient(180deg, var(--royal-gold-bright), var(--royal-gold-deep)) !important;
  color: var(--on-brand) !important;
}

/* Alerts on public pages */
html.rl-theme-modern .alert-box.success {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: rgba(16, 185, 129, 0.25) !important;
  color: var(--text-primary) !important;
}

html.rl-theme-modern .alert-box.error,
html.rl-theme-modern .alert-box.danger {
  background: rgba(196, 92, 92, 0.1) !important;
  border-color: rgba(196, 92, 92, 0.28) !important;
}

@media (max-width: 640px) {
  html.rl-theme-modern .rl-hide-sm {
    display: none !important;
  }

  /* Comfortable mobile card — not cramped */
  html.rl-theme-modern .rl-main {
    padding: 1.25rem 1rem 1.15rem;
  }

  html.rl-theme-modern .rl-card {
    padding: 1.65rem 1.25rem 1.35rem;
  }

  html.rl-theme-modern .wizard-container {
    padding: 1.35rem !important;
  }
}

/* —— Component rhythm ——
 * 48px actions and fields, 44px icon/header controls, and 18px icons.
 * Keep this final so page-level legacy rules cannot reintroduce size drift.
 */
html.rl-theme-modern body,
html.rl-theme-modern button,
html.rl-theme-modern input,
html.rl-theme-modern select,
html.rl-theme-modern textarea {
  font-family: var(--rl-font) !important;
}

html.rl-theme-modern .form-input:not(textarea),
html.rl-theme-modern .form-select,
html.rl-theme-modern input[type="text"],
html.rl-theme-modern input[type="email"],
html.rl-theme-modern input[type="password"],
html.rl-theme-modern input[type="date"],
html.rl-theme-modern input[type="month"],
html.rl-theme-modern input[type="number"],
html.rl-theme-modern input[type="tel"],
html.rl-theme-modern select {
  box-sizing: border-box !important;
  height: var(--rl-action-height) !important;
  min-height: var(--rl-action-height) !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-radius: var(--rl-control-radius) !important;
  line-height: 1.25 !important;
}

html.rl-theme-modern .rl-btn,
html.rl-theme-modern .btn-nav,
html.rl-theme-modern .track-btn,
html.rl-theme-modern .primary-action,
html.rl-theme-modern .secondary-action,
html.rl-theme-modern .link-btn,
html.rl-theme-modern .login-btn {
  box-sizing: border-box !important;
  min-height: var(--rl-action-height) !important;
  padding: 0.75rem 1rem !important;
  border-radius: var(--rl-control-radius) !important;
  gap: var(--rl-action-gap) !important;
  font-family: var(--rl-font) !important;
  font-size: var(--rl-action-font-size) !important;
  font-weight: 650 !important;
  line-height: 1.25 !important;
}

html.rl-theme-modern button.btn-nav,
html.rl-theme-modern a.btn-nav {
  border-radius: var(--rl-control-radius) !important;
}

html.rl-theme-modern .input-wrapper:has(.input-icon) .form-input {
  padding-left: 3rem !important;
}

html.rl-theme-modern .input-wrapper:has(.password-toggle) .form-input {
  padding-right: 3.5rem !important;
}

html.rl-theme-modern .rl-btn svg,
html.rl-theme-modern .btn-nav svg,
html.rl-theme-modern .track-btn svg,
html.rl-theme-modern .primary-action svg,
html.rl-theme-modern .secondary-action svg,
html.rl-theme-modern .link-btn svg,
html.rl-theme-modern .login-btn svg {
  width: var(--rl-action-icon) !important;
  height: var(--rl-action-icon) !important;
  flex: 0 0 var(--rl-action-icon);
}

html.rl-theme-modern .rl-nav__actions .btn {
  box-sizing: border-box;
  min-height: var(--rl-touch-size);
  padding: 0.625rem 0.875rem !important;
  border-radius: var(--rl-control-radius) !important;
  font-family: var(--rl-font) !important;
  font-size: 0.875rem !important;
  line-height: 1.2;
}

html.rl-theme-modern .theme-toggle,
html.rl-theme-modern .mobile-menu-btn,
html.rl-theme-modern .mobile-menu-close,
html.rl-theme-modern .password-toggle,
html.rl-theme-modern .copy-btn {
  box-sizing: border-box !important;
  width: var(--rl-touch-size) !important;
  height: var(--rl-touch-size) !important;
  min-width: var(--rl-touch-size) !important;
  min-height: var(--rl-touch-size) !important;
  padding: 0 !important;
  border-radius: var(--rl-control-radius) !important;
  display: inline-grid !important;
  place-items: center;
}

html.rl-theme-modern .theme-toggle svg,
html.rl-theme-modern .mobile-menu-btn svg,
html.rl-theme-modern .mobile-menu-close svg,
html.rl-theme-modern .password-toggle svg,
html.rl-theme-modern .copy-btn svg {
  width: var(--rl-action-icon) !important;
  height: var(--rl-action-icon) !important;
}

@media (max-width: 640px) {
  html.rl-theme-modern body:has(> .app-tabbar) .pwa-update-banner,
  html.rl-theme-modern body:has(> .app-tabbar) #rlInstallSheet {
    bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px)) !important;
  }

  html.rl-theme-modern #rlInstallSheet button {
    box-sizing: border-box !important;
    width: var(--rl-touch-size) !important;
    height: var(--rl-touch-size) !important;
    min-width: var(--rl-touch-size) !important;
    min-height: var(--rl-touch-size) !important;
    padding: 0 !important;
  }
}
