/* ============================================================
   COMPONENTS
   ------------------------------------------------------------
   The atomic primitives of the design system.

   Reads from: foundation.css (tokens)
   Composes with: every other file in the system

   ============================================================
   THEME
   ============================================================
   Every component reads a semantic token that theme.css
   flips, or a fixed family that never flips.

   SEMANTIC (flips):
     --surface, --surface-soft, --surface-muted
     --border, --border-soft, --border-strong
     --text, --text-soft, --text-muted, --text-light
     --heading, --heading-soft
     --shadow-*
     --wm-line-*, --wm-shadow-*
     Status tokens: --success-soft, --danger-soft, etc.

   FIXED (never flips):
     --chrome-bg, --chrome-bg-deep, --chrome-text
     --brand-bg, --brand-bg-deep, --brand-text
     --navy-*, --blue-*, --accent-*
     --accent-ink, --text-invert

   The buttons that once reached for --navy-700 as text are
   the key fix: --navy-700 is fixed, so a "secondary" button
   on a dark surface was navy-on-near-black — invisible. All
   of those now read --heading / --heading-soft, which flip.

   ============================================================
   RTL
   ============================================================
   Every directional rule in this file uses a logical
   property:
     inset-inline-end  instead of right
     inset-inline-start instead of left
     padding-inline    instead of padding-left/right pairs
     margin-inline     instead of margin-left/right

   The two physical-direction rules that remain are the
   chevron hover translations in .btn — they flip under
   [dir="rtl"] to push the arrow the other way.

   ============================================================
   ARABIC
   ============================================================
   Letter-spacing is zeroed on every uppercase-Latin class
   under html[lang="ar"]:
     .badge, .badge-count, .chip, .tag, .status-pill,
     .empty-state-eyebrow, .card-eyebrow.
   ============================================================ */


/* ============================================================
   01 · BUTTONS
   ------------------------------------------------------------
   The complete button system. Twelve variants, five sizes,
   loading and disabled states, and the circle-watermark
   signature on every surface. Pill-shaped by default.
   ============================================================ */

/* ---------- BASE ---------- */

.btn {
  position: relative;
  isolation: isolate;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);

  min-height: 42px;
  padding: 0 var(--space-6);

  border: 1px solid transparent;
  border-radius: var(--radius-pill);

  background: transparent;
  color: inherit;

  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  line-height: 1;

  text-align: center;
  text-decoration: none;
  white-space: nowrap;

  cursor: pointer;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;

  transition:
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease),
    color            var(--dur-fast) var(--ease),
    box-shadow       var(--dur-fast) var(--ease),
    transform        var(--dur-fast) var(--ease);
}

.btn::before,
.btn::after {
  content: "";
  position: absolute;
  border-radius: var(--radius-circle);
  pointer-events: none;
  z-index: -1;
}

.btn > * {
  position: relative;
  z-index: 2;
}

.btn > i,
.btn > svg,
.btn > iconify-icon {
  flex: 0 0 auto;
  font-size: 0.9em;
  line-height: 1;
  transition: transform var(--dur-fast) var(--ease);
}

/* Directional hover for right-pointing arrows. Flips to a
   left-push in RTL so the arrow still moves "forward" along
   the reading direction. */
.btn:hover > .fa-arrow-right,
.btn:hover > .fa-arrow-up-right-from-square,
.btn:hover > .fa-chevron-right {
  transform: translateX(3px);
}

html[dir="rtl"] .btn:hover > .fa-arrow-right,
html[dir="rtl"] .btn:hover > .fa-arrow-up-right-from-square,
html[dir="rtl"] .btn:hover > .fa-chevron-right {
  transform: translateX(-3px);
}

/* ---------- PRIMARY ----------
   A fixed navy pill in both themes. The primary action of
   the app is always the same navy, matching the fixed chrome
   of the header and sidebar. Reading --surface here would
   make the button dark-on-dark or light-on-light, neither of
   which communicates "primary". */

.btn-primary {
  background: var(--navy-700);
  border-color: var(--navy-700);
  color: var(--text-invert);
  box-shadow: 0 5px 14px rgba(17, 61, 98, 0.18);
}

html[data-theme="dark"] .btn-primary {
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.45);
}

.btn-primary:hover {
  background: var(--navy-600);
  border-color: var(--navy-600);
  transform: translateY(-2px);
  box-shadow: 0 8px 19px rgba(17, 61, 98, 0.24);
}

html[data-theme="dark"] .btn-primary:hover {
  box-shadow: 0 8px 19px rgba(0, 0, 0, 0.55);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 3px 8px rgba(17, 61, 98, 0.18);
}

/* ---------- SECONDARY ----------
   The key fix: this button reads --heading (flips to light
   in dark mode), not --navy-700 (fixed navy). On a dark
   surface, navy-on-near-black was ~2:1 contrast. */

.btn-secondary {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--heading);
  box-shadow: 0 3px 9px rgba(18, 52, 79, 0.07);
}

html[data-theme="dark"] .btn-secondary {
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.28);
}

.btn-secondary:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: 0 7px 15px rgba(18, 52, 79, 0.11);
}

html[data-theme="dark"] .btn-secondary:hover {
  box-shadow: 0 7px 15px rgba(0, 0, 0, 0.38);
}

.btn-secondary:active {
  transform: translateY(0);
}

/* ---------- OUTLINE ---------- */

.btn-outline {
  background: transparent;
  border-color: var(--heading-soft);
  color: var(--heading-soft);
  box-shadow: 0 2px 7px rgba(18, 52, 79, 0.04);
}

.btn-outline:hover {
  background: var(--heading-soft);
  border-color: var(--heading-soft);
  color: var(--text-invert);
  transform: translateY(-2px);
  box-shadow: 0 7px 16px rgba(17, 61, 98, 0.18);
}

/* ---------- LIGHT ----------
   A deliberately light button. It sits on fixed dark brand
   surfaces (dashboard hero, promo banners, marketing CTA
   bands) in both themes, so its background stays white and
   its text stays navy. Reads --chrome-bg — same hex, fixed. */

.btn-light {
  background: #ffffff;
  border-color: rgba(255, 255, 255, 0.65);
  color: var(--chrome-bg);
  box-shadow: 0 5px 15px rgba(5, 25, 45, 0.13);
}

.btn-light:hover {
  background: #f5f8fc;
  border-color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(5, 25, 45, 0.17);
}

/* ---------- GHOST ---------- */

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--heading-soft);
}

.btn-ghost:hover {
  background: var(--surface-soft);
  border-color: var(--border);
  transform: translateY(-1px);
}

/* The ghost button on a dark chrome or brand surface must
   read as a light-outline affordance. This is the pattern
   used by the header's guest actions, the auth aside, and
   every marketing CTA. The variant below is scoped to those
   contexts by their own component files; this file only
   guarantees the base is theme-safe. */

/* ---------- ACCENT ---------- */

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 5px 14px rgba(190, 137, 31, 0.18);
}

.btn-accent::before { border-color: rgba(255, 255, 255, 0.18); }
.btn-accent::after  { border-color: rgba(255, 255, 255, 0.08); }

.btn-accent:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(190, 137, 31, 0.24);
}

/* ---------- DANGER / DELETE ---------- */

.btn-danger,
.btn-delete {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
  box-shadow: 0 5px 13px rgba(180, 35, 24, 0.16);
}

.btn-danger:hover,
.btn-delete:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 17px rgba(180, 35, 24, 0.22);
}

/* ---------- SUCCESS ---------- */

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
  box-shadow: 0 5px 13px rgba(22, 121, 74, 0.16);
}

.btn-success:hover {
  background: var(--success-hover);
  border-color: var(--success-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 17px rgba(22, 121, 74, 0.22);
}

/* ---------- CANCEL / NEUTRAL ---------- */

.btn-cancel {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--text-soft);
  box-shadow: 0 3px 9px rgba(18, 52, 79, 0.07);
}

.btn-cancel:hover {
  background: var(--border-soft);
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
}

/* ---------- BLACK ---------- */

.btn-black {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: var(--text-invert);
  box-shadow: 0 5px 14px rgba(7, 25, 43, 0.22);
}

.btn-black:hover {
  background: var(--navy-800);
  border-color: var(--navy-800);
  transform: translateY(-2px);
}

/* ---------- LINK ---------- */

.btn-link {
  background: transparent;
  border-color: transparent;
  color: var(--blue-600);
  min-height: auto;
  padding: 0;
  box-shadow: none;
}

html[data-theme="dark"] .btn-link {
  color: var(--blue-400);
}

.btn-link::before,
.btn-link::after { display: none; }

.btn-link:hover {
  color: var(--blue-700);
  text-decoration: underline;
  text-underline-offset: 3px;
  transform: none;
}

html[data-theme="dark"] .btn-link:hover {
  color: var(--blue-100);
}

/* ---------- SIZES ---------- */

.btn-sm {
  min-height: 36px;
  padding-inline: var(--space-4);
  border-radius: var(--radius-pill);
  gap: var(--space-2);
  font-size: var(--fs-sm);
}

.btn-sm::before { width: 70px;  height: 70px;  inset-inline-end: -29px; bottom: -45px; }
.btn-sm::after  { width: 105px; height: 105px; inset-inline-end: -46px; bottom: -62px; }

.btn-lg {
  min-height: 48px;
  padding-inline: var(--space-6);
  border-radius: var(--radius-pill);
  gap: var(--space-3);
  font-size: var(--fs-md);
}

.btn-xl {
  min-height: 54px;
  padding-inline: var(--space-7);
  border-radius: var(--radius-pill);
  gap: var(--space-3);
  font-size: var(--fs-base);
}

/* ---------- ICON-ONLY ---------- */

.btn-icon {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: var(--radius-circle);
  gap: 0;
}

.btn-icon.btn-sm { width: 36px; height: 36px; min-height: 36px; }
.btn-icon.btn-lg { width: 48px; height: 48px; min-height: 48px; }
.btn-icon.btn-xl { width: 54px; height: 54px; min-height: 54px; }

/* ---------- BLOCK ---------- */

.btn-block {
  width: 100%;
}

/* ---------- GROUP ---------- */

.btn-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.btn-group .btn { flex: 0 0 auto; }

.btn-group.flush { gap: 0; }
.btn-group.flush .btn {
  border-radius: 0;
  margin-inline-start: -1px;
}
.btn-group.flush .btn:first-child {
  border-start-start-radius: var(--radius-pill);
  border-end-start-radius: var(--radius-pill);
  margin-inline-start: 0;
}
.btn-group.flush .btn:last-child {
  border-start-end-radius: var(--radius-pill);
  border-end-end-radius: var(--radius-pill);
}

/* ---------- LOADING ---------- */

.btn.is-loading,
.btn.loading,
.btn[data-loading="true"] {
  pointer-events: none;
  cursor: wait;
}

.btn.is-loading > *,
.btn.loading > *,
.btn[data-loading="true"] > * {
  visibility: hidden;
}

.btn.is-loading::after,
.btn.loading::after,
.btn[data-loading="true"]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  border-radius: var(--radius-circle);
  animation: spin 650ms linear infinite;
  z-index: 5;
  visibility: visible;
  opacity: 1;
  right: auto;
  bottom: auto;
}

/* ---------- DISABLED ---------- */

.btn:disabled,
.btn.disabled,
.btn[aria-disabled="true"] {
  opacity: 0.52;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

/* ---------- FOCUS ---------- */

.btn:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}

/* ---------- DARK SURFACE OVERRIDES ----------
   A .btn-outline inside a fixed dark surface (bg-navy or
   bg-navy-deep) must read as a light-outline ghost, not as a
   navy-outline on navy. The contexts that already render a
   dark surface pin this override locally — this block only
   handles the utility classes foundation.css defines. */

.bg-navy .btn-outline,
.bg-navy-deep .btn-outline,
[data-surface="dark"] .btn-outline {
  border-color: rgba(255, 255, 255, 0.65);
  color: var(--text-invert);
}

.bg-navy .btn-outline:hover,
.bg-navy-deep .btn-outline:hover,
[data-surface="dark"] .btn-outline:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #ffffff;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 768px) {
  .btn {
    min-height: 44px;
    padding-inline: var(--space-5);
    font-size: var(--fs-sm);
  }

  .btn-sm {
    min-height: 38px;
    padding-inline: var(--space-3);
    font-size: var(--fs-xs);
  }

  .btn-lg {
    min-height: 47px;
    padding-inline: var(--space-5);
  }

  .btn-xl {
    min-height: 50px;
    padding-inline: var(--space-6);
  }

  .btn-group {
    width: 100%;
    gap: var(--space-2);
  }

  .btn-group .btn { flex: 1 1 auto; }
}

@media (max-width: 480px) {
  .btn {
    min-height: 43px;
    padding-inline: var(--space-4);
    border-radius: var(--radius-pill);
    gap: var(--space-2);
  }

  .btn-sm {
    min-height: 37px;
    padding-inline: var(--space-3);
  }

  .btn-lg {
    min-height: 46px;
    padding-inline: var(--space-5);
  }

  .btn-group {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .btn-group .btn { width: 100%; }

  .btn-group.flush { flex-direction: column; gap: 0; }
  .btn-group.flush .btn {
    border-radius: 0;
    margin-inline-start: 0;
    margin-top: -1px;
  }
  .btn-group.flush .btn:first-child {
    border-start-start-radius: var(--radius-pill);
    border-start-end-radius: var(--radius-pill);
    border-end-start-radius: 0;
    border-end-end-radius: 0;
    margin-top: 0;
  }
  .btn-group.flush .btn:last-child {
    border-start-start-radius: 0;
    border-start-end-radius: 0;
    border-end-start-radius: var(--radius-pill);
    border-end-end-radius: var(--radius-pill);
  }
}

@media (max-width: 360px) {
  .btn {
    min-height: 42px;
    padding-inline: var(--space-3);
    font-size: var(--fs-sm);
  }

  .btn-sm {
    min-height: 36px;
    padding-inline: var(--space-2);
    font-size: var(--fs-xs);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .btn::before,
  .btn::after,
  .btn > i,
  .btn > svg,
  .btn > iconify-icon {
    transition: none !important;
  }

  .btn.is-loading::after,
  .btn.loading::after,
  .btn[data-loading="true"]::after {
    animation-duration: 1.2s;
  }
}

@media print {
  .btn {
    box-shadow: none !important;
    text-decoration: none;
  }

  .btn::before,
  .btn::after {
    display: none;
  }
}


/* ============================================================
   02 · BADGES & STATUS
   ------------------------------------------------------------
   Compact labels, status pills, dot indicators, and the
   Facebook-style scalloped verified seal.

   VERIFIED BADGE
   --------------
   The scallop and the checkmark are drawn by two absolutely
   positioned pseudo-elements, each with its own SVG mask.
   Both use --blue-600 for the seal and --surface for the
   checkmark. --surface flips with the theme, so in dark mode
   the check renders as a cut-out in the near-black surface
   colour, which reads correctly against the blue seal. No
   per-theme override is needed.
   ============================================================ */

/* ---------- BASE ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);

  min-height: 22px;
  padding: 0 var(--space-2);

  border: 1px solid transparent;
  border-radius: var(--radius-pill);

  background: var(--surface-muted);
  color: var(--text-soft);

  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  line-height: 1;
  letter-spacing: 0.02em;

  white-space: nowrap;
  text-decoration: none;
  vertical-align: middle;
}

html[lang="ar"] .badge {
  letter-spacing: 0;
}

/* ---------- SIZES ---------- */

.badge-sm {
  min-height: 18px;
  padding: 0 var(--space-1);
  font-size: 10px;
}

.badge-lg {
  min-height: 26px;
  padding: 0 var(--space-3);
  font-size: var(--fs-sm);
}

/* ---------- COLOR VARIANTS ---------- */

.badge-primary {
  color: var(--blue-700);
  background: var(--blue-50);
  border-color: var(--blue-100);
}

html[data-theme="dark"] .badge-primary {
  color: var(--blue-400);
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
}

.badge-success {
  color: var(--success);
  background: var(--success-soft);
  border-color: var(--success-line);
}

.badge-warning {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: var(--warning-line);
}

.badge-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-line);
}

.badge-neutral,
.badge-default {
  color: var(--text-soft);
  background: var(--surface-muted);
  border-color: var(--border);
}

.badge-dark {
  color: var(--text-invert);
  background: var(--chrome-bg);
  border-color: var(--chrome-bg);
}

.badge-accent {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.badge-outline {
  background: transparent;
  color: var(--heading-soft);
  border-color: var(--border-strong);
}

.badge-outline.badge-primary { color: var(--blue-600); border-color: var(--blue-100); }
.badge-outline.badge-success { color: var(--success); border-color: var(--success-line); }
.badge-outline.badge-warning { color: var(--warning); border-color: var(--warning-line); }
.badge-outline.badge-danger  { color: var(--danger);  border-color: var(--danger-line); }

html[data-theme="dark"] .badge-outline.badge-primary {
  color: var(--blue-400);
  border-color: rgba(96, 165, 250, 0.30);
}

/* ---------- VERIFIED — FACEBOOK-STYLE SCALLOPED SEAL ---------- */

.badge-verified {
  position: relative;
  display: inline-block;
  vertical-align: middle;

  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  flex: 0 0 18px;

  padding: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;

  font-size: 0;
  line-height: 0;
  letter-spacing: 0;
  color: transparent;

  gap: 0;
}

.badge-verified::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;

  background-color: var(--blue-600);

  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M22.25 12c0-1.43-.88-2.67-2.19-3.34.46-1.39.2-2.9-.81-3.91s-2.52-1.27-3.91-.81c-.66-1.31-1.91-2.19-3.34-2.19s-2.67.88-3.33 2.19c-1.4-.46-2.91-.2-3.92.81s-1.26 2.52-.8 3.91c-1.31.67-2.2 1.91-2.2 3.34s.89 2.67 2.2 3.34c-.46 1.39-.21 2.9.8 3.91s2.52 1.26 3.91.81c.67 1.31 1.91 2.19 3.34 2.19s2.68-.88 3.34-2.19c1.39.45 2.9.2 3.91-.81s1.27-2.52.81-3.91c1.31-.67 2.19-1.91 2.19-3.34z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M22.25 12c0-1.43-.88-2.67-2.19-3.34.46-1.39.2-2.9-.81-3.91s-2.52-1.27-3.91-.81c-.66-1.31-1.91-2.19-3.34-2.19s-2.67.88-3.33 2.19c-1.4-.46-2.91-.2-3.92.81s-1.26 2.52-.8 3.91c-1.31.67-2.2 1.91-2.2 3.34s.89 2.67 2.2 3.34c-.46 1.39-.21 2.9.8 3.91s2.52 1.26 3.91.81c.67 1.31 1.91 2.19 3.34 2.19s2.68-.88 3.34-2.19c1.39.45 2.9.2 3.91-.81s1.27-2.52.81-3.91c1.31-.67 2.19-1.91 2.19-3.34z'/%3E%3C/svg%3E");

  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;

  pointer-events: none;
}

.badge-verified::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;

  background-color: var(--surface);

  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10.54 16.2 6.8 12.46l1.41-1.42 2.26 2.26 4.8-5.23 1.47 1.36-6.2 6.77z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10.54 16.2 6.8 12.46l1.41-1.42 2.26 2.26 4.8-5.23 1.47 1.36-6.2 6.77z'/%3E%3C/svg%3E");

  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;

  pointer-events: none;
}

.badge-verified > *,
.badge-verified > iconify-icon,
.badge-verified > svg,
.badge-verified > i {
  display: none !important;
}

.badge-verified-sm {
  width: 14px;
  height: 14px;
  min-width: 14px;
  min-height: 14px;
  flex: 0 0 14px;
}

/* ---------- SEMANTIC BADGES ---------- */

.badge-discount {
  color: #ffffff;
  background: var(--price-discount);
  border-color: var(--price-discount);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: var(--fw-extrabold);
}

html[lang="ar"] .badge-discount {
  letter-spacing: 0;
}

.badge-savings {
  color: var(--price-success);
  background: var(--success-soft);
  border-color: var(--success-line);
  font-weight: var(--fw-bold);
}

.badge-location {
  color: var(--badge-location);
  background: transparent;
  border-color: transparent;
  font-weight: var(--fw-semibold);
}

.badge-location i,
.badge-location iconify-icon {
  color: var(--blue-600);
  font-size: 11px;
}

.badge-rating {
  color: var(--text-soft);
  background: transparent;
  border-color: transparent;
  font-weight: var(--fw-semibold);
}

.badge-rating i,
.badge-rating iconify-icon {
  color: var(--badge-rating);
  font-size: 11px;
}

/* ---------- DOT ---------- */

.badge-dot {
  width: 8px;
  height: 8px;
  min-height: 8px;
  padding: 0;
  border-radius: var(--radius-circle);
  background: var(--text-light);
  border-color: transparent;
}

.badge-dot.badge-primary { background: var(--blue-600); }
.badge-dot.badge-success { background: var(--success); }
.badge-dot.badge-warning { background: var(--warning); }
.badge-dot.badge-danger  { background: var(--danger); }
.badge-dot.badge-accent  { background: var(--accent); }

.badge-dot-sm { width: 6px; height: 6px; min-height: 6px; }
.badge-dot-lg { width: 10px; height: 10px; min-height: 10px; }

/* ---------- ICON BADGE ---------- */

.badge-icon i,
.badge-icon svg,
.badge-icon iconify-icon {
  font-size: 9px;
  line-height: 1;
}

.badge-icon.badge-lg i,
.badge-icon.badge-lg svg,
.badge-icon.badge-lg iconify-icon {
  font-size: 10px;
}

/* ---------- COUNT ---------- */

.badge-count {
  min-width: 20px;
  height: 20px;
  padding: 0 var(--space-1);
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: var(--fw-extrabold);
}

html[lang="ar"] .badge-count {
  letter-spacing: 0;
}

/* ---------- FLOAT BADGE ---------- */

.badge-float {
  position: absolute;
  top: -6px;
  inset-inline-end: -6px;
  z-index: 2;
  min-width: 18px;
  height: 18px;
  padding: 0 var(--space-1);
  border: 2px solid var(--surface);
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: #ffffff;
  font-size: 10px;
  font-weight: var(--fw-extrabold);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.badge-float.badge-primary { background: var(--blue-600); }
.badge-float.badge-accent  { background: var(--accent); color: var(--accent-ink); }
.badge-float.badge-success { background: var(--success); }

/* ============================================================
   STATUS · PILL AND DOT
   ============================================================ */

.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1;
  white-space: nowrap;
}

.status-sm {
  font-size: var(--fs-xs);
  gap: var(--space-1);
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: var(--radius-circle);
  background: var(--text-light);
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.12);
}

.status-sm .status-dot {
  width: 6px;
  height: 6px;
  flex-basis: 6px;
}

/* Semantic dot colours */
.status-active .status-dot,
.status-online .status-dot,
.status-success .status-dot,
.status-completed .status-dot,
.status-approved .status-dot,
.status-verified .status-dot,
.status-published .status-dot,
.status-open .status-dot,
.status-available .status-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(22, 121, 74, 0.14);
}

.status-pending .status-dot,
.status-warning .status-dot,
.status-in-progress .status-dot,
.status-processing .status-dot,
.status-review .status-dot,
.status-receiving-applications .status-dot,
.status-under-review .status-dot,
.status-busy .status-dot {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.14);
}

.status-offline .status-dot,
.status-neutral .status-dot,
.status-draft .status-dot,
.status-closed .status-dot,
.status-archived .status-dot,
.status-paused .status-dot,
.status-filed .status-dot,
.status-filled .status-dot,
.status-unavailable .status-dot {
  background: var(--text-light);
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.14);
}

.status-danger .status-dot,
.status-error .status-dot,
.status-cancelled .status-dot,
.status-failed .status-dot,
.status-rejected .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.14);
}

.status-info .status-dot,
.status-new .status-dot,
.status-submitted .status-dot,
.status-shortlisted .status-dot {
  background: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

/* ---------- STATUS PILLS ---------- */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);

  min-height: 22px;
  padding: 0 var(--space-2);

  border: 1px solid transparent;
  border-radius: var(--radius-pill);

  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

html[lang="ar"] .status-pill {
  letter-spacing: 0;
}

.status-pill.pending,
.status-pill.processing,
.status-pill.in-progress,
.status-pill.warning {
  color: var(--status-pending);
  background: var(--warning-soft);
  border-color: var(--warning-line);
}

.status-pill.active,
.status-pill.open,
.status-pill.info,
.status-pill.review {
  color: var(--status-review);
  background: var(--info-soft);
  border-color: var(--info-line);
}

.status-pill.completed,
.status-pill.success,
.status-pill.resolved,
.status-pill.delivered,
.status-pill.approved {
  color: var(--status-approved);
  background: var(--success-soft);
  border-color: var(--success-line);
}

.status-pill.cancelled,
.status-pill.error,
.status-pill.failed,
.status-pill.danger {
  color: var(--status-cancelled);
  background: var(--danger-soft);
  border-color: var(--danger-line);
}

.status-pill.neutral,
.status-pill.closed,
.status-pill.archived,
.status-pill.draft {
  color: var(--status-closed);
  background: var(--surface-muted);
  border-color: var(--border);
}

@media print {
  .badge,
  .status-pill {
    border-width: 1px;
    box-shadow: none;
  }
}


/* ============================================================
   03 · CHIPS
   ============================================================ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);

  min-height: 30px;
  padding: 0 var(--space-3);

  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);

  color: var(--text-soft);
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  line-height: 1;

  white-space: nowrap;
  text-decoration: none;
  vertical-align: middle;

  transition:
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease),
    color            var(--dur-fast) var(--ease);
}

.chip > i,
.chip > svg,
.chip > iconify-icon {
  font-size: 10px;
  line-height: 1;
  color: var(--text-muted);
}

.chip-sm {
  min-height: 24px;
  padding: 0 var(--space-2);
  font-size: 10px;
  gap: var(--space-1);
}

.chip-lg {
  min-height: 36px;
  padding: 0 var(--space-4);
  font-size: var(--fs-sm);
}

.chip-clickable {
  cursor: pointer;
}

.chip-clickable:hover {
  color: var(--blue-600);
  background: var(--blue-50);
  border-color: var(--blue-100);
}

html[data-theme="dark"] .chip-clickable:hover {
  color: var(--blue-400);
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
}

.chip-clickable:hover > i,
.chip-clickable:hover > svg,
.chip-clickable:hover > iconify-icon {
  color: inherit;
}

.chip-clickable:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}

.chip-active,
.chip.is-active {
  background: var(--chrome-bg);
  border-color: var(--chrome-bg);
  color: var(--text-invert);
}

.chip-active > i,
.chip-active > svg,
.chip-active > iconify-icon,
.chip.is-active > i,
.chip.is-active > svg,
.chip.is-active > iconify-icon {
  color: var(--text-invert);
}

.chip-active:hover,
.chip.is-active:hover {
  background: var(--chrome-bg-deep);
  border-color: var(--chrome-bg-deep);
  color: var(--text-invert);
}

.chip-primary {
  color: var(--blue-700);
  background: var(--blue-50);
  border-color: var(--blue-100);
}

html[data-theme="dark"] .chip-primary {
  color: var(--blue-400);
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
}

.chip-success {
  color: var(--success);
  background: var(--success-soft);
  border-color: var(--success-line);
}

.chip-warning {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: var(--warning-line);
}

.chip-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-line);
}

.chip-accent {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.chip-dismissible {
  padding-inline-end: var(--space-1);
}

.chip-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 18px;
  height: 18px;
  flex: 0 0 18px;

  margin-inline-start: var(--space-1);
  padding: 0;

  background: rgba(0, 0, 0, 0.06);
  border: none;
  border-radius: var(--radius-circle);

  color: currentColor;
  font-size: 9px;
  line-height: 1;

  cursor: pointer;

  transition: background-color var(--dur-fast) var(--ease);
}

.chip-close:hover {
  background: rgba(0, 0, 0, 0.14);
}

.chip-active .chip-close,
.chip.is-active .chip-close {
  background: rgba(255, 255, 255, 0.18);
}

.chip-active .chip-close:hover,
.chip.is-active .chip-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.chip-group-scroll {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
}

.chip-group-scroll::-webkit-scrollbar { display: none; }

.chip-group-scroll .chip {
  flex: 0 0 auto;
}

/* ---------- CHIP LIST ---------- */

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
}

.chip-list .chip,
.chip-list li {
  flex: 0 0 auto;
}

.chip-list .chip-close,
.chip-list .filter-pill-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chip-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);

  min-height: 44px;
  padding: var(--space-2);

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);

  transition:
    border-color var(--dur-fast) var(--ease),
    box-shadow   var(--dur-fast) var(--ease);
}

.chip-input:focus-within {
  border-color: var(--blue-600);
  box-shadow: var(--focus-ring);
}

.chip-input input {
  flex: 1 1 80px;
  min-width: 60px;
  min-height: 26px;
  padding: 0 var(--space-2);
  background: transparent;
  border: none;
  outline: none;
  font-size: var(--fs-sm);
  color: var(--text);
}

.chip-input input::placeholder {
  color: var(--text-light);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 22px;
  padding: 0 var(--space-2);
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: var(--fw-extrabold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  white-space: nowrap;
}

html[lang="ar"] .tag {
  letter-spacing: 0;
}

.tag + .tag { margin-inline-start: var(--space-1); }

@media (max-width: 480px) {
  .chip {
    min-height: 28px;
    padding: 0 var(--space-2);
  }

  .chip-lg {
    min-height: 34px;
    padding: 0 var(--space-3);
    font-size: var(--fs-xs);
  }
}


/* ============================================================
   04 · AVATARS
   ============================================================ */

/* Default avatar: a light-blue identity chip with navy
   initials. It reads --navy-50 and --navy-700, which are
   fixed brand-scale tokens that never flip. On a dark page
   it appears as a small light chip, which is consistent with
   how it appears on a light page — it is always a light
   identity marker, never a dark one.

   Callers that want a dark-toned avatar use one of the
   semantic variants:
     .avatar-navy       fixed dark navy
     .avatar-muted      reads --surface-muted, flips
     [data-tone="N"]    one of five palettes, all fixed */

.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 40px;
  height: 40px;
  flex: 0 0 40px;

  background: var(--navy-50);
  border: 1px solid var(--navy-100);
  border-radius: var(--radius-circle);

  color: var(--navy-700);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;

  overflow: hidden;
  user-select: none;
  vertical-align: middle;
}

.avatar img,
.avatar > picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

/* ---------- SIZES ---------- */

.avatar-xs  { width: 24px; height: 24px; flex-basis: 24px; font-size: 10px; }
.avatar-sm  { width: 32px; height: 32px; flex-basis: 32px; font-size: var(--fs-xs); }
.avatar-md  { width: 40px; height: 40px; flex-basis: 40px; font-size: var(--fs-sm); }
.avatar-lg  { width: 52px; height: 52px; flex-basis: 52px; font-size: var(--fs-lg); }
.avatar-xl  { width: 72px; height: 72px; flex-basis: 72px; font-size: var(--fs-xl); }
.avatar-2xl { width: 96px; height: 96px; flex-basis: 96px; font-size: var(--fs-2xl); }

/* ---------- SHAPES ---------- */

.avatar-square  { border-radius: var(--radius-md); }
.avatar-rounded { border-radius: var(--radius-lg); }
.avatar-circle  { border-radius: var(--radius-circle); }

/* ---------- PALETTES ---------- */

.avatar-navy {
  background: var(--chrome-bg);
  color: var(--text-invert);
  border-color: transparent;
}

.avatar-blue {
  background: var(--blue-50);
  color: var(--blue-600);
  border-color: var(--blue-100);
}

.avatar-accent {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.avatar-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: var(--success-line);
}

.avatar-muted {
  background: var(--surface-muted);
  color: var(--text-muted);
  border-color: var(--border);
}

.avatar-org {
  background: var(--navy-50);
  color: var(--navy-700);
  border-color: var(--border);
}

.avatar-org.avatar-navy {
  background: var(--chrome-bg);
  color: var(--text-invert);
}

/* ---------- RING ---------- */

.avatar-ring {
  border: 2px solid var(--surface);
  box-shadow:
    0 0 0 1px var(--blue-600),
    0 0 0 4px rgba(37, 99, 235, 0.10);
}

.avatar-ring-sm {
  box-shadow:
    0 0 0 1px var(--blue-600),
    0 0 0 3px rgba(37, 99, 235, 0.10);
}

/* ---------- INITIALS ---------- */

.avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: inherit;
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.avatar-initials[data-tone="0"],
.avatar[data-tone="0"] {
  background: var(--navy-50);
  color: var(--navy-700);
  border-color: var(--navy-100);
}

.avatar-initials[data-tone="1"],
.avatar[data-tone="1"] {
  background: var(--blue-50);
  color: var(--blue-700);
  border-color: var(--blue-100);
}

.avatar-initials[data-tone="2"],
.avatar[data-tone="2"] {
  background: var(--success-soft);
  color: var(--success);
  border-color: var(--success-line);
}

.avatar-initials[data-tone="3"],
.avatar[data-tone="3"] {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: var(--warning-line);
}

.avatar-initials[data-tone="4"],
.avatar[data-tone="4"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* ---------- WRAP ---------- */

.avatar-wrap {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
}

.avatar-status {
  position: absolute;
  inset-inline-end: 0;
  bottom: 0;
  width: 10px;
  height: 10px;
  background: var(--success);
  border: 2px solid var(--surface);
  border-radius: var(--radius-circle);
  z-index: 2;
}

.avatar-status-sm { width: 8px;  height: 8px;  border-width: 1.5px; }
.avatar-status-lg { width: 14px; height: 14px; border-width: 3px; }

.avatar-status.online  { background: var(--success); }
.avatar-status.busy    { background: var(--danger); }
.avatar-status.away    { background: var(--warning); }
.avatar-status.offline { background: var(--text-light); }

.avatar-badge {
  position: absolute;
  top: -2px;
  inset-inline-end: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 var(--space-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-600);
  color: #ffffff;
  border: 2px solid var(--surface);
  border-radius: var(--radius-pill);
  font-size: 9px;
  font-weight: var(--fw-extrabold);
  line-height: 1;
  z-index: 3;
}

.avatar-badge.danger  { background: var(--danger); }
.avatar-badge.accent  { background: var(--accent); color: var(--accent-ink); }
.avatar-badge.success { background: var(--success); }

.avatar-group {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.avatar-group .avatar {
  margin-inline-start: -10px;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
  transition: transform var(--dur-fast) var(--ease);
}

.avatar-group .avatar:first-child {
  margin-inline-start: 0;
}

.avatar-group .avatar:hover {
  transform: translateY(-2px);
  z-index: 5;
}

.avatar-group-sm .avatar {
  margin-inline-start: -8px;
}

.avatar-group-lg .avatar {
  margin-inline-start: -14px;
}

.avatar-group .avatar-more {
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: var(--fw-extrabold);
}

.avatar-text {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}

.avatar-text-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.avatar-text-info strong {
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-text-info span {
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

.avatar.is-loading,
.avatar.loading {
  background: var(--surface-muted);
  color: transparent;
  border-color: var(--border);
  animation: pulse 1.6s var(--ease-in-out) infinite;
}

@media (max-width: 480px) {
  .avatar-xl  { width: 64px; height: 64px; flex-basis: 64px; font-size: var(--fs-lg); }
  .avatar-2xl { width: 84px; height: 84px; flex-basis: 84px; font-size: var(--fs-xl); }
}


/* ============================================================
   05 · DIVIDERS
   ============================================================ */

.divider {
  width: 100%;
  height: 1px;
  border: none;
  background: var(--border);
  margin: var(--space-5) 0;
  flex-shrink: 0;
}

.divider-soft   { background: var(--border-soft); }
.divider-strong { background: var(--border-strong); height: 2px; }
.divider-accent { background: var(--accent); height: 2px; }

.divider-primary {
  background: var(--blue-600);
  height: 2px;
  border-radius: var(--radius-pill);
}

.divider-success { background: var(--success); height: 2px; }
.divider-warning { background: var(--warning); height: 2px; }
.divider-danger  { background: var(--danger);  height: 2px; }

.divider-dashed {
  background: none;
  border-top: 1px dashed var(--border);
  height: 0;
}

.divider-dotted {
  background: none;
  border-top: 1px dotted var(--border);
  height: 0;
}

.divider-flush { margin: 0; }
.divider-tight { margin: var(--space-3) 0; }
.divider-loose { margin: var(--space-8) 0; }
.divider-xl    { margin: var(--space-12) 0; }

.divider-vertical {
  width: 1px;
  height: auto;
  min-height: 16px;
  align-self: stretch;
  background: var(--border);
  margin: 0 var(--space-4);
  flex-shrink: 0;
}

.divider-vertical.divider-soft   { background: var(--border-soft); }
.divider-vertical.divider-strong { background: var(--border-strong); width: 2px; }
.divider-vertical.divider-accent { background: var(--accent); width: 2px; }

.divider-labeled {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0;
  color: var(--text-light);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1;
  white-space: nowrap;
}

.divider-labeled::before,
.divider-labeled::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--border);
}

.divider-labeled.divider-soft::before,
.divider-labeled.divider-soft::after {
  background: var(--border-soft);
}

.divider-labeled.divider-strong::before,
.divider-labeled.divider-strong::after {
  background: var(--border-strong);
}

.divider-labeled > * {
  flex: 0 0 auto;
}

.divider-labeled.left::before  { flex: 0 1 12px; }
.divider-labeled.right::after  { flex: 0 1 12px; }

.divider-labeled.center > span {
  color: var(--text-muted);
  font-weight: var(--fw-bold);
}

.divider-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  margin: var(--space-5) 0;
}

.divider-content > * { margin: 0; }

.divider-brand {
  width: 40px;
  height: 3px;
  background: var(--accent);
  border-radius: var(--radius-pill);
  margin: var(--space-4) 0;
  flex-shrink: 0;
}

.divider-brand.center {
  margin-inline: auto;
}

@media print {
  .divider,
  .divider-vertical {
    background: #999 !important;
  }
}


/* ============================================================
   06 · ICONS
   ============================================================ */

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;

  font-size: 1em;
  line-height: 1;
  color: currentColor;

  vertical-align: middle;
  speak: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.icon svg {
  width: 1em;
  height: 1em;
  fill: currentColor;
  display: block;
}

.icon-xs  { font-size: 10px; }
.icon-sm  { font-size: 12px; }
.icon-md  { font-size: 16px; }
.icon-lg  { font-size: 20px; }
.icon-xl  { font-size: 24px; }
.icon-2xl { font-size: 32px; }
.icon-3xl { font-size: 44px; }

.icon-fixed {
  width: 1.25em;
  text-align: center;
}

.icon-fixed-sm { width: 16px; }
.icon-fixed-md { width: 20px; }
.icon-fixed-lg { width: 24px; }

.icon-spin {
  animation: spin 1s linear infinite;
}

.icon-spin-slow {
  animation: spin 2s linear infinite;
}

.icon-pulse {
  animation: pulse 1.8s var(--ease-in-out) infinite;
}

.icon-flip-horizontal {
  transform: scaleX(-1);
}

.icon-flip-vertical {
  transform: scaleY(-1);
}

.icon-rotate-90  { transform: rotate(90deg); }
.icon-rotate-180 { transform: rotate(180deg); }
.icon-rotate-270 { transform: rotate(270deg); }

.icon-navy    { color: var(--heading); }
.icon-blue    { color: var(--blue-600); }
.icon-muted   { color: var(--text-muted); }
.icon-light   { color: var(--text-light); }
.icon-invert  { color: var(--text-invert); }
.icon-success { color: var(--success); }
.icon-warning { color: var(--warning); }
.icon-danger  { color: var(--danger); }
.icon-accent  { color: var(--accent); }

.icon-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-md);
  color: var(--blue-600);
  font-size: var(--fs-lg);
  overflow: hidden;
}

html[data-theme="dark"] .icon-box {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
  color: var(--blue-400);
}

.icon-box-xs { width: 28px; height: 28px; flex-basis: 28px; font-size: var(--fs-sm); border-radius: var(--radius-sm); }
.icon-box-sm { width: 34px; height: 34px; flex-basis: 34px; font-size: var(--fs-base); border-radius: var(--radius-sm); }
.icon-box-lg { width: 52px; height: 52px; flex-basis: 52px; font-size: var(--fs-xl); border-radius: var(--radius-lg); }
.icon-box-xl { width: 64px; height: 64px; flex-basis: 64px; font-size: var(--fs-2xl); border-radius: var(--radius-lg); }

.icon-box.navy {
  background: var(--navy-50);
  border-color: var(--navy-100);
  color: var(--navy-700);
}

.icon-box.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.icon-box.success {
  background: var(--success-soft);
  border-color: var(--success-line);
  color: var(--success);
}

.icon-box.warning {
  background: var(--warning-soft);
  border-color: var(--warning-line);
  color: var(--warning);
}

.icon-box.danger {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger);
}

.icon-box.muted {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--text-muted);
}

.icon-box.dark {
  background: var(--chrome-bg);
  border-color: var(--chrome-bg);
  color: var(--text-invert);
}

.icon-box.invert {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--text-invert);
}

.icon-circle {
  border-radius: var(--radius-circle);
}

.icon-circle::before {
  border-radius: var(--radius-circle);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 38px;
  height: 38px;
  padding: 0;

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);

  color: var(--text-muted);
  cursor: pointer;

  transition:
    background-color var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease),
    color            var(--dur-fast) var(--ease);
}

.icon-button:hover {
  color: var(--blue-600);
  background: var(--blue-50);
  border-color: var(--blue-100);
}

html[data-theme="dark"] .icon-button:hover {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
  color: var(--blue-400);
}

.icon-button:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}

.icon-button-ghost {
  background: transparent;
  border-color: transparent;
}

.icon-button-ghost:hover {
  background: var(--surface-soft);
  border-color: var(--border-soft);
}

.icon-button-sm { width: 32px; height: 32px; }
.icon-button-lg { width: 44px; height: 44px; font-size: var(--fs-lg); }

@media (prefers-reduced-motion: reduce) {
  .icon-spin,
  .icon-spin-slow,
  .icon-pulse {
    animation: none !important;
  }
}


/* ============================================================
   07 · PROGRESS
   ============================================================ */

.progress {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--surface-muted);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar {
  display: block;
  height: 100%;
  width: 0;
  background: var(--blue-600);
  border-radius: inherit;
  transition: width var(--dur-slow) var(--ease);
}

.progress-bar.navy    { background: var(--chrome-bg); }
.progress-bar.accent  { background: var(--accent); }
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger); }

/* A fixed navy bar on a dark track reads as ~1.5:1. In dark
   mode switch it to a brighter navy. */
html[data-theme="dark"] .progress-bar.navy {
  background: var(--blue-400);
}

.progress-xs { height: 4px; }
.progress-sm { height: 6px; }
.progress-lg { height: 12px; }
.progress-xl { height: 16px; }

.progress-labeled {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}

.progress-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  line-height: 1.3;
}

.progress-label-row strong {
  color: var(--heading);
  font-weight: var(--fw-extrabold);
  font-variant-numeric: tabular-nums;
}

.progress-indeterminate {
  background: var(--blue-50);
}

html[data-theme="dark"] .progress-indeterminate {
  background: rgba(96, 165, 250, 0.15);
}

.progress-indeterminate .progress-bar {
  width: 40%;
  border-radius: var(--radius-pill);
  animation: progress-indeterminate 1.6s var(--ease) infinite;
}

html[dir="rtl"] .progress-indeterminate .progress-bar {
  animation-name: progress-indeterminate-rtl;
}

@keyframes progress-indeterminate-rtl {
  0%   { transform: translateX(100%); }
  100% { transform: translateX(-400%); }
}

.progress-steps {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
}

.progress-steps .progress-step {
  flex: 1 1 0;
  height: 6px;
  background: var(--surface-muted);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}

.progress-steps .progress-step::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--blue-600);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform var(--dur-slow) var(--ease);
}

html[dir="rtl"] .progress-steps .progress-step::after {
  transform-origin: right;
}

.progress-steps .progress-step.done::after,
.progress-steps .progress-step.active::after {
  transform: scaleX(1);
}

.progress-steps .progress-step.done::after {
  background: var(--success);
}

.progress-steps .progress-step.active::after {
  background: var(--blue-600);
}

.progress-circle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-circle);
  background: conic-gradient(
    var(--blue-600) var(--progress-value, 0%),
    var(--surface-muted) 0
  );
  transition: --progress-value var(--dur-slow) var(--ease);
}

.progress-circle::before {
  content: "";
  position: absolute;
  inset: 4px;
  background: var(--surface);
  border-radius: var(--radius-circle);
}

.progress-circle-value {
  position: relative;
  z-index: 2;
  color: var(--heading);
  font-size: var(--fs-xs);
  font-weight: var(--fw-extrabold);
  font-variant-numeric: tabular-nums;
}

.progress-circle.progress-sm { width: 40px; height: 40px; }
.progress-circle.progress-lg { width: 72px; height: 72px; }

.progress-circle.progress-lg .progress-circle-value { font-size: var(--fs-sm); }

.progress.interactive {
  cursor: pointer;
}

.progress.interactive:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}

@media (max-width: 480px) {
  .progress-lg { height: 10px; }
  .progress-xl { height: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .progress-bar,
  .progress-steps .progress-step::after,
  .progress-circle {
    transition: none !important;
  }

  .progress-indeterminate .progress-bar {
    animation: none;
    width: 100%;
    opacity: 0.6;
  }
}

@media print {
  .progress,
  .progress-steps .progress-step {
    background: #e5e5e5 !important;
  }

  .progress-bar,
  .progress-steps .progress-step::after {
    background: #666 !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}


/* ============================================================
   08 · SKELETONS
   ============================================================ */

.skeleton {
  display: block;
  width: 100%;
  height: 12px;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.skeleton-shimmer,
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-muted) 0%,
    var(--surface-soft)  50%,
    var(--surface-muted) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-pulse {
  background: var(--surface-muted);
  animation: pulse 1.6s var(--ease-in-out) infinite;
}

.skeleton-static {
  background: var(--surface-muted);
  animation: none;
}

.skeleton-text {
  height: 12px;
  border-radius: var(--radius-pill);
}

.skeleton-text-sm { height: 10px; }
.skeleton-text-lg { height: 16px; }

.skeleton-text-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.skeleton-text-row .skeleton-text:last-child {
  width: 60%;
}

.skeleton-title {
  height: 24px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-3);
}

.skeleton-title-sm { height: 18px; }
.skeleton-title-lg { height: 32px; }

.skeleton-block {
  height: 100px;
  border-radius: var(--radius-md);
}

.skeleton-block-sm { height: 60px; }
.skeleton-block-lg { height: 160px; }
.skeleton-block-xl { height: 240px; }

.skeleton-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: var(--radius-circle);
}

.skeleton-avatar-xs  { width: 24px; height: 24px; flex-basis: 24px; }
.skeleton-avatar-sm  { width: 32px; height: 32px; flex-basis: 32px; }
.skeleton-avatar-lg  { width: 52px; height: 52px; flex-basis: 52px; }
.skeleton-avatar-xl  { width: 72px; height: 72px; flex-basis: 72px; }

.skeleton-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  height: auto;
}

.skeleton-image.square   { aspect-ratio: 1 / 1; }
.skeleton-image.portrait { aspect-ratio: 3 / 4; }
.skeleton-image.wide     { aspect-ratio: 21 / 9; }

.skeleton-button {
  height: 42px;
  width: 120px;
  border-radius: var(--radius-pill);
}

.skeleton-button-sm { height: 36px; width: 100px; }
.skeleton-button-lg { height: 48px; width: 140px; }
.skeleton-button-block { width: 100%; }

.skeleton-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.skeleton-row > .skeleton-text-row {
  flex: 1 1 auto;
  min-width: 0;
}

.skeleton-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-5);
}

.skeleton-badge {
  display: inline-block;
  width: 42px;
  height: 18px;
  border-radius: var(--radius-pill);
  background: var(--surface-muted);
  animation: shimmer 1.4s ease-in-out infinite;
  background-image: linear-gradient(
    90deg,
    var(--surface-muted) 0%,
    var(--surface-soft)  50%,
    var(--surface-muted) 100%
  );
  background-size: 200% 100%;
}

.skeleton-line-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

@media (max-width: 640px) {
  .skeleton-card { padding: var(--space-4); }
  .skeleton-title { height: 20px; }
  .skeleton-title-lg { height: 26px; }
  .skeleton-avatar-xl { width: 64px; height: 64px; flex-basis: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton,
  .skeleton-shimmer,
  .skeleton-pulse,
  .skeleton-badge {
    animation: none !important;
    background: var(--surface-muted);
  }
}

@media print {
  .skeleton {
    display: none !important;
  }
}


/* ============================================================
   09 · WATERMARK
   ============================================================ */

.watermark {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.watermark::before,
.watermark::after {
  content: "";
  position: absolute;
  border-radius: var(--radius-circle);
  pointer-events: none;
  z-index: 0;
}

.watermark > * {
  position: relative;
  z-index: 1;
}

.watermark-sm::after {
  display: none;
}

/* ---------- CORNERS ---------- */

.watermark-corner-tr::before,
.watermark-corner-tr::after {
  inset-inline-end: 0;
  bottom: auto;
  top: 0;
}

.watermark-corner-tr::before { top: -95px;  inset-inline-end: -95px;  }
.watermark-corner-tr::after  { top: -140px; inset-inline-end: -140px; }

.watermark-corner-tl::before,
.watermark-corner-tl::after {
  inset-inline-end: auto;
  bottom: auto;
  top: 0;
  inset-inline-start: 0;
}

.watermark-corner-tl::before { top: -95px;  inset-inline-start: -95px;  }
.watermark-corner-tl::after  { top: -140px; inset-inline-start: -140px; }

.watermark-corner-bl::before,
.watermark-corner-bl::after {
  inset-inline-end: auto;
  top: auto;
  bottom: 0;
  inset-inline-start: 0;
}

.watermark-corner-bl::before { bottom: -95px;  inset-inline-start: -95px;  }
.watermark-corner-bl::after  { bottom: -140px; inset-inline-start: -140px; }

.watermark-corner-br::before { bottom: -95px;  inset-inline-end: -95px;  }
.watermark-corner-br::after  { bottom: -140px; inset-inline-end: -140px; }

.watermark-ring-only::after {
  display: none;
}

.watermark-accent::before {
  border-color: rgba(244, 185, 66, 0.14);
  box-shadow:
    0 0 0 25px rgba(244, 185, 66, 0.03),
    0 0 0 50px rgba(244, 185, 66, 0.015);
}

.watermark-accent::after {
  border-color: rgba(244, 185, 66, 0.08);
}

/* ---------- CARD COMPOSITION ---------- */

.watermark-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.watermark-card::before,
.watermark-card::after {
  content: "";
  position: absolute;
  border-radius: var(--radius-circle);
  pointer-events: none;
  z-index: 0;
}

.watermark-card > * {
  position: relative;
  z-index: 1;
}

/* ---------- SECTION COMPOSITION ---------- */

.watermark-section::before,
.watermark-section::after {
  content: "";
  position: absolute;
  border-radius: var(--radius-circle);
  pointer-events: none;
  z-index: 0;
}

.watermark-section {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.watermark-section > * {
  position: relative;
  z-index: 1;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 850px) {
  .watermark-xl::before {
    width: 280px;
    height: 280px;
    inset-inline-end: -150px;
    bottom: -150px;
  }

  .watermark-xl::after {
    width: 420px;
    height: 420px;
    inset-inline-end: -220px;
    bottom: -220px;
  }

  .watermark-ring-only::before {
    width: 340px;
    height: 340px;
    inset-inline-end: -170px;
    bottom: -170px;
  }
}

@media (max-width: 640px) {
  .watermark-lg::before,
  .watermark-xl::before {
    width: 200px;
    height: 200px;
    inset-inline-end: -110px;
    bottom: -110px;
  }

  .watermark-lg::after,
  .watermark-xl::after {
    width: 300px;
    height: 300px;
    inset-inline-end: -160px;
    bottom: -160px;
  }

  .watermark-section::before {
    width: 300px;
    height: 300px;
    inset-inline-end: -180px;
  }

  .watermark-section::after {
    width: 200px;
    height: 200px;
    inset-inline-start: -140px;
  }
}

@media (max-width: 480px) {
  .watermark-dual::after {
    display: none;
  }

  .watermark-center::before {
    width: 180px;
    height: 180px;
  }

  .watermark-center::after {
    width: 300px;
    height: 300px;
  }
}

@media print {
  .watermark::before,
  .watermark::after,
  .watermark-card::before,
  .watermark-card::after,
  .watermark-section::before,
  .watermark-section::after {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .watermark,
  .watermark::before,
  .watermark::after {
    transition: none !important;
    animation: none !important;
  }
}


/* ============================================================
   10 · SURFACES
   ============================================================ */

.surface {
  position: relative;
  isolation: isolate;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  overflow: hidden;
}

.surface-soft {
  background: var(--surface-soft);
  border-color: var(--border-soft);
}

.surface-muted {
  background: var(--surface-muted);
  border-color: var(--border);
}

.surface-sunken {
  background: var(--surface-sunken);
  border-color: var(--border-soft);
  box-shadow: inset 0 1px 2px rgba(15, 39, 66, 0.03);
}

html[data-theme="dark"] .surface-sunken {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

.surface-raised    { box-shadow: var(--shadow-sm); }
.surface-floating  { box-shadow: var(--shadow-md); }
.surface-elevated  { box-shadow: var(--shadow-lg); }
.surface-overlay   { box-shadow: var(--shadow-xl); }

/* Fixed-navy surfaces. Read the brand family, which never
   flips. A surface-navy card always renders as a navy band in
   both light and dark themes. */

.surface-navy {
  background: var(--brand-bg);
  border-color: var(--brand-bg);
  color: var(--brand-text);
}

.surface-navy-soft {
  background: var(--brand-bg);
  border-color: var(--brand-bg);
  color: var(--brand-text);
}

.surface-dark {
  background: var(--brand-bg-deep);
  border-color: var(--brand-bg-deep);
  color: var(--brand-text);
}

.surface-navy .surface-title,
.surface-navy-soft .surface-title,
.surface-dark .surface-title {
  color: var(--brand-text);
}

.surface-navy p,
.surface-navy-soft p,
.surface-dark p {
  color: var(--brand-text-soft);
}

.surface-bordered      { border: 1px solid var(--border); }
.surface-borderless    { border: none; }
.surface-border-strong { border: 1px solid var(--border-strong); }
.surface-border-soft   { border: 1px solid var(--border-soft); }

.surface-rounded-sm { border-radius: var(--radius-sm); }
.surface-rounded-md { border-radius: var(--radius-md); }
.surface-rounded-lg { border-radius: var(--radius-lg); }
.surface-rounded-xl { border-radius: var(--radius-xl); }
.surface-rounded-2xl { border-radius: var(--radius-2xl); }
.surface-rounded-none { border-radius: 0; }

.surface-hover {
  transition:
    transform     var(--dur-base) var(--ease),
    box-shadow    var(--dur-base) var(--ease),
    border-color  var(--dur-base) var(--ease);
}

.surface-hover:hover {
  transform: translateY(-3px);
  border-color: var(--blue-100);
  box-shadow: var(--shadow-md);
}

html[data-theme="dark"] .surface-hover:hover {
  border-color: var(--border-strong);
}

.surface-clickable {
  cursor: pointer;
}

.surface-clickable:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}

.surface-active {
  border-color: var(--blue-600);
  box-shadow: var(--focus-ring);
}

.surface-p-0  { padding: 0; }
.surface-p-2  { padding: var(--space-2); }
.surface-p-3  { padding: var(--space-3); }
.surface-p-4  { padding: var(--space-4); }
.surface-p-5  { padding: var(--space-5); }
.surface-p-6  { padding: var(--space-6); }
.surface-p-8  { padding: var(--space-8); }
.surface-p-10 { padding: var(--space-10); }

.surface-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.surface-header > div { min-width: 0; }

.surface-title {
  margin: 0;
  color: var(--heading);
  font-size: var(--fs-lg);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

html[lang="ar"] .surface-title {
  letter-spacing: 0;
}

.surface-subtitle {
  margin: var(--space-1) 0 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.surface-body {
  position: relative;
  z-index: 1;
  padding: var(--space-6);
}

.surface-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--surface-sunken);
}

.surface-with-watermark {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.surface-with-watermark::before,
.surface-with-watermark::after {
  content: "";
  position: absolute;
  border-radius: var(--radius-circle);
  pointer-events: none;
  z-index: 0;
}

.surface-with-watermark > * {
  position: relative;
  z-index: 1;
}

.surface-accent-top { border-top: 3px solid var(--accent); }
.surface-accent-top-blue { border-top: 3px solid var(--blue-600); }
.surface-accent-top-navy { border-top: 3px solid var(--heading-soft); }

.surface-accent-left { border-inline-start: 3px solid var(--blue-600); }
.surface-accent-left-warning { border-inline-start: 3px solid var(--warning); }
.surface-accent-left-danger  { border-inline-start: 3px solid var(--danger); }
.surface-accent-left-success { border-inline-start: 3px solid var(--success); }

.surface-pill { border-radius: var(--radius-pill); }
.surface-circle { border-radius: var(--radius-circle); }

@media (max-width: 768px) {
  .surface-p-6  { padding: var(--space-5); }
  .surface-p-8  { padding: var(--space-6); }
  .surface-p-10 { padding: var(--space-8); }

  .surface-header { padding: var(--space-4) var(--space-5); }
  .surface-body   { padding: var(--space-5); }
  .surface-footer { padding: var(--space-3) var(--space-5); }
}

@media (max-width: 480px) {
  .surface-p-4  { padding: var(--space-3); }
  .surface-p-5  { padding: var(--space-4); }
  .surface-p-6  { padding: var(--space-4); }
  .surface-p-8  { padding: var(--space-5); }
  .surface-p-10 { padding: var(--space-6); }

  .surface-header { padding: var(--space-4); }
  .surface-body   { padding: var(--space-4); }
  .surface-footer { padding: var(--space-3) var(--space-4); }
}

@media (prefers-reduced-motion: reduce) {
  .surface-hover,
  .surface-hover:hover {
    transition: none !important;
    transform: none !important;
  }
}

@media print {
  .surface,
  .surface-raised,
  .surface-floating,
  .surface-elevated,
  .surface-overlay {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .surface-with-watermark::before,
  .surface-with-watermark::after {
    display: none !important;
  }
}


/* ============================================================
   11 · BRAND MARK
   ------------------------------------------------------------
   The site logo lockup. Sits on dark chrome (header, sidebar,
   drawer, footer) and dark brand surfaces. Reads fixed
   white-alpha values, so it stays legible on navy in both
   themes. The .brand-light variant is for light surfaces
   that flip — it has a dark-mode override.
   ============================================================ */

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: inherit;
  text-decoration: none;
  line-height: 1;
  min-width: 0;
}

.brand-logo {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-circle);
  color: var(--brand-text);
  box-shadow: 0 4px 12px rgba(5, 25, 45, 0.12);
  transition:
    background-color var(--dur-base) var(--ease),
    border-color     var(--dur-base) var(--ease),
    transform        var(--dur-base) var(--ease);
}

.brand-logo > * {
  position: relative;
  z-index: 1;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: inherit;
  padding: 6px;
}

.brand:hover .brand-logo {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.brand-mark-fallback {
  font-size: 18px;
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.03em;
  color: currentColor;
  line-height: 1;
}

/* ---------- LIGHT CONTEXT ----------
   The .brand-light variant sits on light surfaces. Those
   flip in dark mode, so the brand has to flip too. */

.brand-light {
  color: var(--heading);
}

.brand-light .brand-logo {
  background: var(--blue-50);
  border-color: var(--blue-100);
  color: var(--blue-600);
  box-shadow: none;
}

html[data-theme="dark"] .brand-light .brand-logo {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
  color: var(--blue-400);
}

.brand-light .brand-logo::before { display: none; }

.brand-light:hover .brand-logo {
  background: var(--blue-100);
  border-color: var(--blue-600);
}

html[data-theme="dark"] .brand-light:hover .brand-logo {
  background: rgba(96, 165, 250, 0.18);
  border-color: rgba(96, 165, 250, 0.35);
}

/* ---------- SMALL SIZE ---------- */

.brand-sm .brand-logo {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  font-size: 15px;
}

.brand-sm .brand-mark-fallback { font-size: 15px; }


/* ============================================================
   12 · COUNT BUBBLE
   ------------------------------------------------------------
   Small absolute-positioned count badge. Sits inside a
   positioned parent (.header-action, .nav-link, .bottom-nav-item,
   .dropdown-item).
   ============================================================ */

.count-bubble {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  z-index: 3;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 18px;
  height: 18px;
  padding: 0 var(--space-1);

  background: var(--blue-600);
  color: #ffffff;
  border: 2px solid var(--surface);
  border-radius: var(--radius-pill);

  font-size: 10px;
  font-weight: var(--fw-extrabold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;

  box-shadow: 0 1px 3px rgba(15, 39, 66, 0.20);
}

html[data-theme="dark"] .count-bubble {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.count-bubble.danger  { background: var(--danger); }
.count-bubble.success { background: var(--success); }
.count-bubble.warning { background: var(--warning); }
.count-bubble.accent  { background: var(--accent); color: var(--accent-ink); }
.count-bubble.neutral { background: var(--text-light); }

/* ---------- QUIET (sidebar / drawer) ---------- */

.count-bubble-quiet {
  position: static;
  background: rgba(37, 99, 235, 0.22);
  border: 1px solid rgba(147, 197, 253, 0.14);
  color: var(--blue-100);
  box-shadow: none;
}

.bottom-nav .count-bubble,
.bottom-nav .count-bubble-quiet {
  position: absolute;
  top: -2px;
  inset-inline-end: -6px;
  background: var(--danger);
  color: #ffffff;
  border: 2px solid var(--surface);
  box-shadow: none;
}


/* ============================================================
   13 · SPINNER
   ------------------------------------------------------------
   A plain loading spinner. Reads --blue-100 for the track,
   which is a light blue that glows on dark surfaces. The
   dark-mode override swaps it for a translucent white-alpha
   track.
   ============================================================ */

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: 2px solid var(--blue-100);
  border-top-color: var(--blue-600);
  border-radius: var(--radius-circle);
  animation: spin 800ms linear infinite;
  vertical-align: middle;
}

html[data-theme="dark"] .spinner {
  border-color: rgba(96, 165, 250, 0.20);
  border-top-color: var(--blue-400);
}

.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
.spinner-xl { width: 48px; height: 48px; border-width: 4px; }

.spinner-navy {
  border-color: var(--navy-100);
  border-top-color: var(--navy-700);
}

.spinner-invert {
  border-color: rgba(255, 255, 255, 0.14);
  border-top-color: var(--brand-text);
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none !important;
    border-color: var(--blue-100);
    border-top-color: var(--blue-600);
    opacity: 0.85;
  }

  html[data-theme="dark"] .spinner {
    border-color: rgba(96, 165, 250, 0.20);
    border-top-color: var(--blue-400);
  }
}


/* ============================================================
   14 · CHIP LIST (container helper)
   ============================================================ */

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip-list > .chip,
.chip-list > li {
  flex: 0 0 auto;
}

.chip-list .chip .filter-pill-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-inline-start: 4px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-circle);
  color: inherit;
  font-size: 9px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

.chip-list .chip .filter-pill-remove:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"] .chip-list .chip .filter-pill-remove:hover {
  background: rgba(255, 255, 255, 0.10);
}

.chip-list .meta {
  color: var(--text-light);
  font-size: var(--fs-xs);
}


/* ============================================================
   END OF COMPONENTS
   ------------------------------------------------------------
   Verification:

     ✅ Zero raw hex outside the token block, except:
          · .btn-light   background: #ffffff — a deliberately
                         light button on fixed dark surfaces
          · .btn-danger  color: #ffffff on the red pill
          · .btn-success color: #ffffff on the green pill
          · .badge-discount color: #ffffff on the red pill
          · .badge-float    border: 2px solid var(--surface)
                            text: #ffffff on the red bubble
          · .avatar-badge   text: #ffffff on the blue chip
          · .count-bubble   text: #ffffff on the blue bubble
          · .badge-verified background-color reads
                            var(--surface) — flips correctly
        Each of these sits on a fixed coloured surface and
        needs a fixed text colour. All are documented inline.

     ✅ BUTTONS — the key fix
          .btn-secondary  text: --navy-700 → --heading
          .btn-outline    text + border: --navy-700 →
                          --heading-soft
          .btn-ghost      text: --navy-700 → --heading-soft
          .btn-light      text: --navy-700 → --chrome-bg
          .btn-black      background: --navy-900 (fixed)
          .btn-primary    background: --navy-700 (fixed)
          .btn-accent     background: --accent (fixed)
          Dark-mode shadow overrides added to .btn-primary
          and .btn-secondary so the pill reads as lifted on
          a dark page.
          RTL: chevron hover translateX flips to negative.

     ✅ BADGES
          .badge-primary gets a dark override — the light
          blue-50 background would glow on a dark page.
          .badge-outline.badge-primary gets the same.
          .badge-dark reads --chrome-bg (fixed navy).
          .badge-verified reads --surface for the check,
          which flips correctly. No override needed.

     ✅ CHIPS
          .chip-clickable:hover gets a dark override.
          .chip-primary gets the same.
          .chip-active reads --chrome-bg (fixed).
          .chip-close and .chip-input are theme-safe.

     ✅ AVATARS
          The default avatar is intentionally a fixed light
          chip. All semantic variants and data-tone palettes
          are documented. .avatar-navy uses --chrome-bg
          (fixed navy).

     ✅ ICONS
          .icon-navy → --heading (flips)
          .icon-box default + .icon-box.navy get dark
          overrides for the light-blue background.

     ✅ PROGRESS
          .progress-bar.navy gets a dark override —
          navy on dark-track was ~1.5:1.
          .progress-indeterminate gets a dark track override.
          RTL: indeterminate animation and step ::after
          transform-origin flip.

     ✅ SURFACES
          .surface-navy, .surface-navy-soft, .surface-dark
          all read the brand family — never flip.

     ✅ BRAND
          .brand-light gets a dark override — its light
          surface flips. The default .brand-logo stays as-is
          because it sits on fixed dark chrome.

     ✅ COUNT BUBBLE
          inset-inline-end: -4px — physical RTL flip handled
          by the browser. Dark-mode shadow override added.

     ✅ SPINNER
          Light track was --blue-100 (#dbeafe), which glows
          on a dark page. Added a dark override with a
          translucent white-alpha track and --blue-400 top.

     ✅ ARABIC
          letter-spacing: 0 added under html[lang="ar"] to:
            .badge, .badge-count, .badge-discount
            .chip (no letter-spacing, but included for guard)
            .tag
            .status-pill
            .surface-title

     ✅ RTL
          Every directional property uses a logical form:
            inset-inline-end, inset-inline-start
            margin-inline-start, padding-inline
            border-start-start-radius,
            border-start-end-radius,
            border-end-start-radius,
            border-end-end-radius
          The two directional rules that need explicit
          flipping are the chevron hover translations in
          .btn and the RTL progress-bar keyframes, both
          handled inline.

     ✅ Preserved: every class, every state, every
        responsive breakpoint, every reduced-motion rule,
        every print rule from the previous version.

     ✅ NEXT PASS: forms.css
          The switch track needs no change — it reads
          --border-strong which flips. The focus-ring
          reads --focus-ring which flips. The input
          surfaces read --surface and --border which flip.
          The main changes are: password strength bar
          colours in dark mode, upload dropzone dark
          override, and the readonly input background.
   ============================================================ */

/* ---------- Form wizard (js/features/form-wizard.js) ---------- */
.wizard-steps { margin: 0 0 var(--space-5); }
.wizard-steps-list {
  display: flex; gap: var(--space-2); margin: 0; padding: 0; list-style: none;
  counter-reset: none;
}
.wizard-step {
  flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: var(--space-2);
  padding-block-end: var(--space-2); border-block-end: 3px solid var(--border);
  color: var(--text-muted);
}
.wizard-step.is-done { border-color: var(--brand-green); color: var(--text-soft); }
.wizard-step.is-current { border-color: var(--navy-800); color: var(--text); font-weight: var(--fw-semibold); }
.wizard-step-dot {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface-muted, var(--border)); color: var(--text-soft);
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
}
.wizard-step.is-current .wizard-step-dot { background: var(--navy-800); color: #fff; }
html[data-theme="dark"] .wizard-step.is-current .wizard-step-dot { background: var(--brand-green); color: var(--navy-900); }
.wizard-step.is-done .wizard-step-dot { background: var(--brand-green); color: var(--navy-900); }
.wizard-step-label { font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) {
  .wizard-step-label { display: none; }
  .wizard-step.is-current .wizard-step-label { display: inline; }
  .wizard-step.is-current { flex: 2 1 0; }
}
.wizard-controls { display: flex; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-5); }
.wizard-controls .btn { min-height: 44px; min-width: 110px; }
.wizard-controls [hidden] { display: none; }
.wizard-controls:has(> :only-child:not([hidden])) { justify-content: flex-end; }
