/* ==========================================================================
   Sooich — Shared components
   Buttons, inputs, chips, cards, header, bottom-nav, sheets, toasts, badges
   ========================================================================== */

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: 50px;
  padding-inline: var(--s-5);
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  font-weight: 700;
  transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast), background var(--dur-fast);
  user-select: none;
  white-space: nowrap;
}

.btn:active:not(:disabled) { transform: scale(0.975); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--grad-gold);
  color: var(--on-gold);
  box-shadow: 0 6px 20px rgba(245, 166, 35, 0.22);
}

.btn-outline {
  border: 1.5px solid var(--gold-1);
  color: var(--gold-2);
  background: transparent;
}

.btn-outline:active:not(:disabled) { background: var(--gold-softer); }

.btn-ghost {
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.btn-quiet {
  color: var(--text-muted);
  background: transparent;
  font-weight: 500;
}

.btn-danger-quiet {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(225, 76, 76, 0.25);
}

.btn-sm {
  height: 36px;
  font-size: var(--fs-sm);
  padding-inline: var(--s-3);
  border-radius: var(--r-sm);
}

.btn-link {
  color: var(--gold-2);
  font-weight: 700;
  background: none;
  padding: 0;
  height: auto;
}

/* Icon-only tap target */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  color: var(--text-2);
  flex: none;
  transition: background var(--dur-fast);
}

.icon-btn:active { background: var(--surface-3); }
.icon-btn.is-active { color: var(--gold-2); }

.icon-btn-solid {
  background: var(--solid-control-bg);
  backdrop-filter: blur(8px);
  color: #fff;
}

/* --------------------------------------------------------------------------
   Header / app bar
   -------------------------------------------------------------------------- */

.appbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  height: var(--header-h);
  padding-inline: var(--s-2);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.appbar-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  flex: 1;
  min-width: 0;
}

.appbar-actions,
.appbar-page-actions {
  display: inline-flex;
  align-items: center;
  flex: none;
}

.appbar-actions { gap: 2px; }

.quick-action { position: relative; }

/* Theme switch carries a شب/روز label, so it grows into a pill instead of
   staying a 40px square. `width: auto` overrides the .icon-btn square. */
.theme-toggle {
  width: auto;
  gap: 5px;
  padding-inline: 10px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-2);
}

.theme-toggle .tt-label { line-height: 1; }

.quick-badge {
  position: absolute;
  top: 2px;
  inset-inline-start: 1px;
  min-width: 16px;
  height: 16px;
  padding-inline: 4px;
  display: grid;
  place-items: center;
  border-radius: var(--r-full);
  background: var(--danger);
  color: #fff;
  border: 2px solid var(--bg);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.appbar-transparent {
  background: transparent;
  border-bottom: none;
}

/* --------------------------------------------------------------------------
   Inputs
   -------------------------------------------------------------------------- */

.field {
  display: block;
  margin-bottom: var(--s-4);
}

.field-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: var(--s-2);
}

.req {
  color: var(--danger);
  margin-inline-start: 2px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.input-wrap:focus-within {
  border-color: var(--gold-1);
  box-shadow: 0 0 0 3px var(--gold-softer);
}

.input-wrap.is-invalid {
  border-color: var(--danger);
}

.input-wrap .lead,
.input-wrap .trail {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 50px;
  color: var(--text-faint);
  flex: none;
}

.input-wrap .trail {
  cursor: pointer;
}

.input {
  flex: 1;
  min-width: 0;
  height: 50px;
  padding-inline: var(--s-4);
  background: transparent;
  font-size: var(--fs-md);
  color: var(--text);
}

.input-wrap .lead + .input { padding-inline-start: 0; }

/* Browsers force `direction: ltr` on tel/email/url/number inputs, so for those
   the rule above strips the padding from the *far* edge instead of the icon
   edge — digits end up flush against the border. Restore it by side. Only in
   RTL: in an LTR locale the input and its wrapper agree and the rule is right. */
:root[dir="rtl"] .input-wrap .lead + .input[type="tel"],
:root[dir="rtl"] .input-wrap .lead + .input[type="email"],
:root[dir="rtl"] .input-wrap .lead + .input[type="url"],
:root[dir="rtl"] .input-wrap .lead + .input[type="number"] {
  padding-left: var(--s-4);
  padding-right: var(--s-3);
}

.input-wrap .input:focus,
.input-wrap .input:focus-visible {
  outline: none;
  outline-offset: 0;
}

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

.input[type="number"] {
  -moz-appearance: textfield;
}
.input[type="number"]::-webkit-outer-spin-button,
.input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

textarea.input {
  height: auto;
  min-height: 110px;
  padding-block: var(--s-3);
  resize: vertical;
  line-height: var(--lh);
}

select.input {
  cursor: pointer;
  appearance: none;
  padding-inline-end: 40px;
}

select.input option {
  background: var(--surface-2);
  color: var(--text);
}

.select-wrap::after {
  content: "";
  position: absolute;
  inset-inline-start: auto;
  inset-inline-end: var(--s-4);
  top: 50%;
  width: 8px;
  height: 8px;
  border-inline-start: 2px solid var(--text-faint);
  border-bottom: 2px solid var(--text-faint);
  transform: translateY(-70%) rotate(-45deg);
  pointer-events: none;
}

/* Input-shaped button that opens a picker sheet (schema select fields). */
.picker-btn {
  text-align: start;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding-inline-end: 44px;
}

.picker-btn.is-empty {
  color: var(--text-faint);
}

.picker-btn:disabled {
  cursor: not-allowed;
  color: var(--text-faint);
  opacity: 0.7;
}

.input-wrap.is-disabled {
  opacity: 0.6;
  background: var(--surface-2);
}

/* Colour dot used in colour chips and the specs table. */
.swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  flex: none;
  display: inline-block;
  vertical-align: -2px;
  margin-inline-end: 6px;
}

.field-hint {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  margin-top: var(--s-2);
}

.field-error {
  font-size: var(--fs-xs);
  color: var(--danger);
  margin-top: var(--s-2);
}

.suffix-unit {
  padding-inline-end: var(--s-4);
  color: var(--text-faint);
  font-size: var(--fs-sm);
  flex: none;
}

/* Checkbox */
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  cursor: pointer;
  padding-block: var(--s-2);
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 1.9;
}

.checkbox input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkbox .box {
  width: 21px;
  height: 21px;
  border-radius: var(--r-xs);
  border: 1.5px solid var(--border-strong);
  flex: none;
  margin-top: 5px;
  display: grid;
  place-items: center;
  transition: all var(--dur-fast);
}

.checkbox .box svg {
  opacity: 0;
  transform: scale(0.6);
  transition: all var(--dur-fast) var(--ease-out);
  color: var(--on-gold);
}

.checkbox input:checked + .box {
  background: var(--grad-gold);
  border-color: transparent;
}

.checkbox input:checked + .box svg {
  opacity: 1;
  transform: none;
}

/* Toggle switch */
.switch {
  position: relative;
  width: 46px;
  height: 27px;
  padding: 0;
  border-radius: var(--r-full);
  background: var(--surface-3);
  border: 1px solid var(--border);
  flex: none;
  overflow: hidden;
  transition: background var(--dur), border-color var(--dur), box-shadow var(--dur);
  cursor: pointer;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--text-muted);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: transform var(--dur) var(--ease-out), background var(--dur), box-shadow var(--dur);
}

.switch[aria-checked="true"] {
  background: var(--grad-gold);
  border-color: transparent;
  box-shadow: 0 0 0 3px var(--gold-softer);
}

.switch[aria-checked="true"]::after {
  background: #fff;
  transform: translateX(19px);
  box-shadow: 0 1px 5px rgba(80, 50, 0, 0.24);
}

.switch:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   Chips
   -------------------------------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  height: 38px;
  padding-inline: var(--s-4);
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--dur-fast);
  flex: none;
}

.chip:active { transform: scale(0.96); }

.chip.is-selected {
  background: var(--gold-soft);
  border-color: var(--gold-1);
  color: var(--gold-2);
}

.chip-sm {
  height: 28px;
  font-size: var(--fs-xs);
  padding-inline: var(--s-3);
  font-weight: 500;
}

.chip-static {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: transparent;
}

.chip-row {
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  padding-inline: var(--s-4);
  padding-block: var(--s-2);
  scrollbar-width: none;
}

.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.chip-count {
  min-width: 18px;
  height: 18px;
  padding-inline: 5px;
  border-radius: var(--r-full);
  background: var(--gold-1);
  color: var(--on-gold);
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* --------------------------------------------------------------------------
   Cards / list rows
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.list-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: var(--s-4);
  background: transparent;
  transition: background var(--dur-fast);
  text-align: start;
}

.list-row:active { background: var(--surface-2); }

.list-row .row-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  color: var(--gold-2);
  flex: none;
}

.list-row .row-body { flex: 1; min-width: 0; }
.list-row .row-title { font-size: var(--fs-md); font-weight: 600; }
.list-row .row-sub { font-size: var(--fs-xs); color: var(--text-faint); }
.list-row .row-chevron { color: var(--text-faint); flex: none; }

.list-group {
  background: var(--surface);
  border-block: 1px solid var(--border);
}

.list-group .list-row + .list-row {
  border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   Listing card
   -------------------------------------------------------------------------- */

/* Positioning context for the save button, which sits outside the card link
   so the two controls stay siblings rather than nested interactives. */
.listing-card-wrap {
  position: relative;
  display: block;
}

.listing-card {
  display: block;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  text-align: start;
  transition: border-color var(--dur-fast), transform var(--dur-fast);
}

.listing-card:active { transform: scale(0.99); }

.listing-card.is-featured {
  border-color: rgba(245, 166, 35, 0.4);
  box-shadow: 0 0 24px rgba(245, 166, 35, 0.07) inset;
}

/* Sized so at least three cards clear the first screen — the artwork is the
   biggest lever, the body paddings and type sizes take the rest. */
.listing-card .lc-media {
  position: relative;
  aspect-ratio: 2 / 1;
  overflow: hidden;
}

.listing-card .lc-body {
  padding: 6px var(--s-3);
}

.listing-card .lc-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 2px;
}

.listing-card .lc-price {
  font-size: var(--fs-md);
  font-weight: 800;
  color: var(--gold-2);
  margin-bottom: var(--s-1);
}

.listing-card .lc-meta {
  display: flex;
  gap: var(--s-1);
  margin-bottom: var(--s-1);
  flex-wrap: wrap;
}

/* Scoped, not a `.chip-sm` change — those chips are shared with the filter
   sheet and the post-ad form, where 28px is the right touch target. */
.listing-card .lc-meta .chip {
  height: 24px;
  padding-inline: var(--s-2);
}

.listing-card .lc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--text-faint);
  padding-top: var(--s-1);
  border-top: 1px solid var(--border);
}

/* Compact horizontal variant (used in "my listings", similar rail is separate) */
.listing-row {
  display: flex;
  gap: var(--s-3);
  width: 100%;
  padding: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-align: start;
}

.listing-row .lr-media {
  width: 104px;
  height: 78px;
  border-radius: var(--r-sm);
  overflow: hidden;
  flex: none;
  position: relative;
}

.listing-row .lr-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Generated vehicle thumbnail (no stock photos — brand-consistent artwork) */
.thumb {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.thumb-art {
  width: 100%;
  height: 100%;
  display: block;
}

.thumb-label {
  position: absolute;
  inset-inline-start: var(--s-3);
  bottom: var(--s-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.82);
  letter-spacing: 0.02em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

/* Badges over media */
.badge-featured {
  position: absolute;
  top: var(--s-2);
  inset-inline-start: var(--s-2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding-inline: var(--s-2);
  border-radius: var(--r-full);
  background: var(--grad-gold);
  color: var(--on-gold);
  font-size: var(--fs-xs);
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.badge-save {
  position: absolute;
  top: var(--s-2);
  inset-inline-end: var(--s-2);
  width: 34px;
  height: 34px;
  border-radius: var(--r-full);
  background: rgba(13, 13, 15, 0.55);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  color: #fff;
  transition: transform var(--dur-fast);
}

.badge-save:active { transform: scale(0.88); }
.badge-save.is-saved { color: var(--gold-2); }

.badge-count {
  position: absolute;
  bottom: var(--s-2);
  inset-inline-end: var(--s-2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding-inline: var(--s-2);
  border-radius: var(--r-full);
  background: rgba(13, 13, 15, 0.6);
  backdrop-filter: blur(6px);
  font-size: var(--fs-xs);
  color: #fff;
}

/* Status pill (my-listings) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding-inline: var(--s-2);
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-active  { color: var(--success); background: var(--success-soft); }
.status-pending { color: var(--warn);    background: var(--warn-soft); }
.status-expired { color: var(--text-muted); background: var(--surface-3); }
.status-sold    { color: var(--info);    background: rgba(91, 157, 255, 0.12); }

/* --------------------------------------------------------------------------
   Feed grid
   -------------------------------------------------------------------------- */

/* Two columns is the default, phones included — the shell is capped at 430px,
   so a single column makes each card fill the screen and pushes the second ad
   below the fold. The old `min-width: 560px` query keyed off the *viewport*,
   which meant the desktop preview got two columns while real phones got one.
   Only genuinely narrow screens fall back to a single column. */
.feed {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
}

@media (max-width: 339px) {
  .feed { grid-template-columns: 1fr; }
}

.empty-state {
  padding: var(--s-8) var(--s-5);
  text-align: center;
  color: var(--text-muted);
}

.empty-state .es-icon {
  width: 76px;
  height: 76px;
  margin: 0 auto var(--s-4);
  border-radius: var(--r-full);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  color: var(--text-faint);
}

.empty-state .es-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--s-2);
}

/* --------------------------------------------------------------------------
   Bottom navigation
   -------------------------------------------------------------------------- */

.bottom-nav {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  z-index: var(--z-nav);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: var(--nav-h);
  color: var(--text-faint);
  font-size: var(--fs-xs);
  font-weight: 600;
  transition: color var(--dur-fast);
  position: relative;
}

.nav-item.is-active { color: var(--gold-2); }

.nav-item.is-active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 26px;
  height: 2.5px;
  border-radius: var(--r-full);
  background: var(--grad-gold);
}

/* Elevated centre "post ad" action */
.nav-item-fab .fab {
  width: 46px;
  height: 46px;
  margin-top: -18px;
  border-radius: var(--r-full);
  background: var(--grad-gold);
  color: var(--on-gold);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 20px rgba(245, 166, 35, 0.35);
  border: 3px solid var(--bg-elev);
  transition: transform var(--dur-fast) var(--ease);
}

.nav-item-fab:active .fab { transform: scale(0.9); }
.nav-item-fab { color: var(--text-2); }
.nav-item-fab.is-active { color: var(--gold-2); }
.nav-item-fab.is-active::before { display: none; }

/* Played on the Explore glyph when its tab is double-clicked, alongside the
   scroll back to the top of the feed. */
.nav-item svg.nav-pop {
  animation: nav-pop 460ms var(--ease-out);
}

@keyframes nav-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.45); }
  65%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .nav-item svg.nav-pop { animation: none; }
}

.nav-badge {
  position: absolute;
  top: 6px;
  inset-inline-start: calc(50% - 22px);
  min-width: 17px;
  height: 17px;
  padding-inline: 4px;
  border-radius: var(--r-full);
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg-elev);
}

/* --------------------------------------------------------------------------
   Unread badge motion — shared by .quick-badge (bell) and .nav-badge (chats)

   Three layers, in order of how often the user sees them:

   1. `badge-ping` — two rings breathing out of the badge on a slow loop, the
      second trailing the first like a radar sweep. The keyframes finish early
      and hold invisible, so most of each cycle is the *pause* between pings:
      the badge stays noticeable from the corner of the eye without nagging.
      The cycle is 10s and the percentages are scaled to keep the *gesture*
      itself at its original speed (~1.5s ring, ~0.6s beat) — lengthening the
      cycle buys a longer pause, not slower motion.
   2. `badge-beat` — a single heartbeat tick on the badge itself, timed to the
      moment the ring launches so the two read as one gesture.
   3. `badge-pop` — a springy entrance with overshoot, applied via `.is-bumped`
      only when the count actually goes UP. Routine re-renders stay still;
      a new message is the one thing that earns a fresh pop.
   -------------------------------------------------------------------------- */

.quick-badge,
.nav-badge {
  animation: badge-beat 10s var(--ease-out) infinite;
}

/* The rings. Absolutely positioned so they stay out of the badge's grid flow,
   and inset past the border so they launch flush with the badge's outer edge. */
.quick-badge::before,
.quick-badge::after,
.nav-badge::before,
.nav-badge::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: var(--danger);
  z-index: -1;
  pointer-events: none;
  animation: badge-ping 10s var(--ease-out) infinite;
}

/* Second ring trails the first — one gesture, more depth than a single ring. */
.quick-badge::after,
.nav-badge::after {
  animation-delay: 420ms;
}

/* Pop first, then hand off to the ambient beat once it has settled. Delaying
   the beat past the pop keeps the two off each other's `transform`. */
.quick-badge.is-bumped,
.nav-badge.is-bumped {
  animation:
    badge-pop 460ms var(--ease-out) both,
    badge-beat 10s 460ms var(--ease-out) infinite;
}

/* 15.4% of 10s ≈ the 1.54s expansion this had at its original 2.8s cycle. */
@keyframes badge-ping {
  0%     { transform: scale(1);   opacity: 0.5; }
  15.4%  { transform: scale(2.4); opacity: 0; }
  100%   { transform: scale(2.4); opacity: 0; }
}

/* Likewise 1.7/3.9/6.2% of 10s ≈ the original 168/392/616ms tick. */
@keyframes badge-beat {
  0%    { transform: scale(1); }
  1.7%  { transform: scale(1.16); }
  3.9%  { transform: scale(0.97); }
  6.2%  { transform: scale(1); }
  100%  { transform: scale(1); }
}

@keyframes badge-pop {
  0%   { transform: scale(0.2); opacity: 0; }
  45%  { transform: scale(1.35); opacity: 1; }
  70%  { transform: scale(0.92); }
  100% { transform: scale(1); }
}

/* Off switch — the OS-level preference and the in-app one in تنظیمات land on
   the same rules. The badge itself always stays; only its motion goes. */
@media (prefers-reduced-motion: reduce) {
  .quick-badge,
  .nav-badge,
  .quick-badge.is-bumped,
  .nav-badge.is-bumped,
  .quick-badge::before,
  .quick-badge::after,
  .nav-badge::before,
  .nav-badge::after {
    animation: none;
  }
  /* Without the ping the rings are just two red discs sitting on the badge. */
  .quick-badge::before,
  .quick-badge::after,
  .nav-badge::before,
  .nav-badge::after {
    display: none;
  }
}

:root[data-badge-motion="off"] .quick-badge,
:root[data-badge-motion="off"] .nav-badge,
:root[data-badge-motion="off"] .quick-badge.is-bumped,
:root[data-badge-motion="off"] .nav-badge.is-bumped,
:root[data-badge-motion="off"] .quick-badge::before,
:root[data-badge-motion="off"] .quick-badge::after,
:root[data-badge-motion="off"] .nav-badge::before,
:root[data-badge-motion="off"] .nav-badge::after {
  animation: none;
}

:root[data-badge-motion="off"] .quick-badge::before,
:root[data-badge-motion="off"] .quick-badge::after,
:root[data-badge-motion="off"] .nav-badge::before,
:root[data-badge-motion="off"] .nav-badge::after {
  display: none;
}

/* --------------------------------------------------------------------------
   Bottom sheet / dialog
   -------------------------------------------------------------------------- */

.sheet-host {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
  display: grid;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
  animation: fade-in var(--dur) var(--ease) both;
}

.sheet-backdrop.is-closing { animation: fade-out var(--dur-fast) var(--ease) both; }

@keyframes fade-in  { from { opacity: 0 } to { opacity: 1 } }
@keyframes fade-out { from { opacity: 1 } to { opacity: 0 } }

.sheet {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  margin-inline: auto;
  width: 100%;
  max-width: var(--shell-max);
  max-height: 88%;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-b);
  animation: sheet-up var(--dur-slow) var(--ease-out) both;
}

.sheet.is-closing { animation: sheet-down var(--dur) var(--ease) both; }

@keyframes sheet-up   { from { transform: translateY(100%) } to { transform: none } }
@keyframes sheet-down { from { transform: none } to { transform: translateY(100%) } }

.sheet-grip {
  width: 40px;
  height: 4px;
  border-radius: var(--r-full);
  background: var(--border-strong);
  margin: var(--s-3) auto var(--s-1);
  flex: none;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  flex: none;
}

.sheet-title {
  font-size: var(--fs-lg);
  font-weight: 700;
}

.sheet-body {
  overflow-y: auto;
  padding: 0 var(--s-4) var(--s-4);
  flex: 1;
  min-height: 0;
}

.sheet-foot {
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--s-3);
  flex: none;
}

/* Centred confirm dialog */
.dialog {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--s-5);
  pointer-events: none;
}

.dialog-box {
  pointer-events: auto;
  width: 100%;
  max-width: 340px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  text-align: center;
  animation: dialog-in var(--dur) var(--ease-out) both;
}

@keyframes dialog-in {
  from { opacity: 0; transform: scale(0.92) }
  to   { opacity: 1; transform: none }
}

.dialog-box .dlg-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto var(--s-3);
  border-radius: var(--r-full);
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--gold-2);
}

.dialog-box .dlg-actions {
  display: flex;
  gap: var(--s-3);
  margin-top: var(--s-5);
}

.dialog-box .dlg-actions .btn { flex: 1; }

/* Sheet option rows (city picker, sort, etc.) */
.opt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  width: 100%;
  padding: var(--s-3) var(--s-2);
  border-radius: var(--r-sm);
  text-align: start;
}

.opt-row + .opt-row { border-top: 1px solid var(--border); }
.opt-row:active { background: var(--surface); }
.opt-row.is-selected { color: var(--gold-2); font-weight: 700; }
.opt-row .opt-check { opacity: 0; color: var(--gold-2); flex: none; }
.opt-row.is-selected .opt-check { opacity: 1; }

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast-host {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
  inset-inline: 0;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  pointer-events: none;
  padding-inline: var(--s-4);
}

.toast {
  max-width: min(var(--shell-max), 100%);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  box-shadow: var(--sh-md);
  animation: toast-in var(--dur) var(--ease-out) both;
}

.toast.is-closing { animation: toast-out var(--dur) var(--ease) both; }
.toast-success { border-color: rgba(62, 207, 142, 0.4); }
.toast-success .t-ico { color: var(--success); }
.toast-error   { border-color: rgba(225, 76, 76, 0.4); }
.toast-error .t-ico { color: var(--danger); }
.toast-info .t-ico { color: var(--gold-2); }
.toast .t-ico { flex: none; display: flex; }

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

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */

.avatar {
  border-radius: var(--r-full);
  background: var(--surface-3);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--gold-2);
  flex: none;
  overflow: hidden;
}

.avatar-visual {
  isolation: isolate;
}

.avatar-svg,
.avatar-image {
  width: 100%;
  height: 100%;
  display: block;
}

.avatar-image { object-fit: cover; }

.brand-key {
  object-fit: contain;
  filter: drop-shadow(0 5px 14px rgba(245, 166, 35, 0.28));
}

.avatar-sm { width: 40px; height: 40px; font-size: var(--fs-sm); }
.avatar-md { width: 52px; height: 52px; font-size: var(--fs-lg); }
.avatar-lg { width: 66px; height: 66px; font-size: var(--fs-xl); }

.rail {
  display: flex;
  gap: var(--s-3);
  overflow-x: auto;
  padding-inline: var(--s-4);
  padding-bottom: var(--s-2);
  scrollbar-width: none;
}

.rail > * { flex: none; width: 190px; }

.sticky-cta {
  position: sticky;
  bottom: 0;
  z-index: var(--z-sticky);
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  padding-bottom: calc(var(--s-3) + var(--safe-b));
  background: var(--sticky-bg);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
}

.sticky-cta .btn { flex: 1; }

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-3) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  from { background-position: 100% 0 }
  to   { background-position: -100% 0 }
}

.tabs {
  display: flex;
  gap: var(--s-1);
  padding-inline: var(--s-4);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tab {
  position: relative;
  padding: var(--s-3) var(--s-3);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color var(--dur-fast);
}

.tab.is-active { color: var(--gold-2); }

.tab.is-active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  inset-inline: var(--s-2);
  height: 2.5px;
  border-radius: var(--r-full);
  background: var(--grad-gold);
}
