/* ═══════════════════════════════════════════════════════
   Order History — Clean Dashboard Redesign
   ═══════════════════════════════════════════════════════ */

:root {
  color-scheme: light;
}

/* ── Page Shell ────────────────────────────────────── */

.order-history-page {
  --oh-bottom-nav-h: 62px;
  margin: 0;
  min-height: 100vh;
  background: #f4f5f7;
  color: #1a1a1a;
  font-family: var(--ui-font-body, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
  padding: clamp(14px, 3vw, 32px) clamp(16px, 4vw, 40px);
  padding-top: calc(clamp(14px, 3vw, 32px) + var(--ui-safe-top, env(safe-area-inset-top, 0px)));
  padding-left: calc(clamp(16px, 4vw, 40px) + var(--ui-safe-left, env(safe-area-inset-left, 0px)));
  padding-right: calc(clamp(16px, 4vw, 40px) + var(--ui-safe-right, env(safe-area-inset-right, 0px)));
  padding-bottom: calc(var(--oh-bottom-nav-h) + 24px + var(--ui-cookie-banner-height, 0px) + env(safe-area-inset-bottom, 0px));
}

.order-history-page .whatsapp-fab {
  --whatsapp-offset: calc(var(--oh-bottom-nav-h) + 8px + var(--ui-cookie-banner-height, 0px) + env(safe-area-inset-bottom, 0px));
}

/* ── Header ────────────────────────────────────────── */

.oh-header {
  width: min(var(--ui-content-max, 960px), 100%);
  margin: 0 auto clamp(10px, 2vw, 20px);
  position: relative;
  z-index: 60;
}

.oh-header__inner {
  display: flex;
  align-items: center;
  position: relative;
  padding: clamp(10px, 1.5vw, 14px) clamp(12px, 2vw, 20px);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.oh-header__brand {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #111;
  min-width: 0;
}

.oh-header__logo {
  display: block;
  width: auto;
  height: 44px;
  max-width: min(140px, 30vw);
  object-fit: contain;
  flex-shrink: 0;
}

.oh-header__name {
  font-size: clamp(0.92rem, 2vw, 1.1rem);
  font-weight: 700;
  line-height: 1.3;
  max-width: min(320px, 44vw);
  overflow-wrap: anywhere;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.oh-header__spacer {
  width: 1px;
}

/* header lang-menu overrides */
.oh-header .rt-lang-menu {
  position: relative;
  z-index: 70;
}

.oh-header .rt-lang-menu__toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #374151;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.oh-header .rt-lang-menu__toggle:hover,
.oh-header .rt-lang-menu__toggle:focus-visible {
  border-color: #9ca3af;
  outline: none;
}

.oh-header .rt-lang-menu__toggle img {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
}

.oh-header .rt-lang-menu__chevron {
  font-size: 0.7rem;
  opacity: 0.6;
}

.oh-header .rt-lang-menu__dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: auto;
  min-width: 180px;
  max-height: min(300px, 60vh);
  overflow: auto;
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 5px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.oh-header .rt-lang-menu[data-open="true"] .rt-lang-menu__dropdown {
  display: flex;
}

.oh-header .rt-lang-menu__item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  width: 100%;
  border: 0;
  padding: 7px 9px;
  border-radius: 8px;
  background: transparent;
  color: #374151;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}

.oh-header .rt-lang-menu__item[data-lang="ar"] {
  font-family: "Cairo", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.oh-header .rt-lang-menu__item img {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  object-fit: cover;
}

.oh-header .rt-lang-menu__item:hover,
.oh-header .rt-lang-menu__item:focus-visible {
  background: #f3f4f6;
  outline: none;
}

.oh-header .rt-lang-menu__item[aria-current="true"] {
  background: #eef2ff;
  color: #4338ca;
}

/* RTL header */
:is(html[lang="ar"], html[dir="rtl"], html.rt-lang-ar, html.rt-lang-rtl) .oh-header__brand,
body.cairo-font.order-history-page .oh-header__brand {
  flex-direction: row-reverse;
}

:is(html[lang="ar"], html[dir="rtl"], html.rt-lang-ar, html.rt-lang-rtl) .oh-header .rt-lang-menu__dropdown,
body.cairo-font.order-history-page .oh-header .rt-lang-menu__dropdown {
  left: auto;
  right: 0;
}

:is(html[lang="ar"], html[dir="rtl"], html.rt-lang-ar, html.rt-lang-rtl) .oh-header .rt-lang-menu__item,
body.cairo-font.order-history-page .oh-header .rt-lang-menu__item {
  text-align: right;
}

/* ── Bottom Navigation ─────────────────────────────── */

.oh-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  height: var(--oh-bottom-nav-h);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #fff;
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.05);
}

.oh-bottom-nav__item {
  flex: 1;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: #9ca3af;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 6px 4px;
  position: relative;
  transition: color 0.15s ease;
}

.oh-bottom-nav__item span {
  white-space: nowrap;
}

.oh-bottom-nav__item i,
.oh-bottom-nav__item .oh-bottom-nav__menu-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.oh-bottom-nav__menu-icon {
  width: 20px;
  height: 22px;
  display: block;
  flex-shrink: 0;
}

.oh-bottom-nav__item:hover {
  color: #374151;
}

.oh-bottom-nav__item--active {
  color: var(--ui-primary, #e67e22);
  font-weight: 600;
}

.oh-bottom-nav__item--active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--ui-primary, #e67e22);
}

/* ── Shell ─────────────────────────────────────────── */

.order-history-shell {
  width: min(var(--ui-content-max, 960px), 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.5vw, 24px);
}

/* ── Toolbar (Title + Actions) ─────────────────────── */

.order-history-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.order-history-toolbar__title-group {
  min-width: 0;
}

.order-history-toolbar__heading {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #111;
}

.order-history-toolbar__subtitle {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 0.9rem;
  line-height: 1.45;
}

.order-history-toolbar__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Stats Bar ─────────────────────────────────────── */

.order-history-stats-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 4px 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  flex-wrap: wrap;
}

.order-history-stats-bar__sep {
  width: 1px;
  height: 28px;
  background: #e5e7eb;
  flex-shrink: 0;
}

.order-history-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  flex: 1 1 0;
  min-width: 0;
  transition: background 0.15s ease;
  border-radius: 10px;
}

.order-history-stat:hover {
  background: #f9fafb;
}

.order-history-stat__icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.order-history-stat__icon--orders {
  background: #fff3e6;
  color: #d97706;
}

.order-history-stat__icon--activity {
  background: #eef0ff;
  color: #6366f1;
}

.order-history-stat__icon--service {
  background: #ecfdf5;
  color: #059669;
}

.order-history-stat__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.order-history-stat__value {
  font-size: 1.05rem;
  font-weight: 700;
  color: #111;
  line-height: 1.2;
  word-break: break-word;
}

.order-history-stat__label {
  font-size: 0.78rem;
  color: #9ca3af;
  line-height: 1.3;
}

/* keep old stat classes referenced by JS */
.order-history-stat__content { min-width: 0; }
.order-history-stat__hint { color: #9ca3af; font-size: 0.78rem; }

/* ── Consent ───────────────────────────────────────── */

.order-history-page .distance-pricing-consent__label {
  min-height: 44px;
}

.order-history-page .distance-pricing-consent__label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 3px;
  accent-color: var(--ui-primary, #e67e22);
}

/* ── Empty State ───────────────────────────────────── */

.order-history-empty__card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: clamp(32px, 4vw, 48px) clamp(24px, 3vw, 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.order-history-empty__icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.order-history-empty__icon svg {
  width: 30px;
  height: 30px;
  color: #ea580c;
}

.order-history-empty__text h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
  font-weight: 600;
  color: #111;
}

.order-history-empty__text p {
  margin: 0;
  color: #6b7280;
  font-size: 0.9rem;
  line-height: 1.55;
  max-width: 360px;
}

.order-history-empty__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 22px;
  border-radius: 10px;
  background: #111;
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  transition: background 0.15s ease;
}

.order-history-empty__cta:hover {
  background: #333;
}

/* ── Order Grid ────────────────────────────────────── */

.order-history-grid {
  display: grid;
  gap: clamp(12px, 2vw, 16px);
}

/* ── Order Card ────────────────────────────────────── */

@keyframes card-enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.order-history-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  padding: clamp(16px, 2.2vw, 24px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: grid;
  grid-template-areas:
    "header"
    "details"
    "total"
    "footer";
  gap: 14px;
  animation: card-enter 0.3s ease both;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.order-history-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
  border-color: #d1d5db;
}

.order-history-card:nth-child(1) { animation-delay: 0s; }
.order-history-card:nth-child(2) { animation-delay: 0.04s; }
.order-history-card:nth-child(3) { animation-delay: 0.08s; }
.order-history-card:nth-child(4) { animation-delay: 0.12s; }
.order-history-card:nth-child(5) { animation-delay: 0.16s; }
.order-history-card:nth-child(n+6) { animation-delay: 0.2s; }

.order-history-card--cancelled {
  border-color: #fca5a5;
  background: #fefce8;
}

.order-history-card--active {
  outline: 2px solid var(--ui-primary, #e67e22);
  outline-offset: 1px;
}

.order-history-card--delivery.order-history-card--active {
  border-color: #22c55e;
  outline-color: #22c55e;
}

/* ── Card Header ───────────────────────────────────── */

.order-history-card__header {
  grid-area: header;
  order: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 12px;
}

.order-history-card__summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.order-history__eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin: 0;
  font-weight: 600;
  font-size: 0.72rem;
}

.order-history__eyebrow--cancelled {
  color: #dc2626;
}

.order-history-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #111;
}

.order-history__subhead {
  margin: 0 0 8px;
  color: #6b7280;
}

/* ── Card Meta Grid ────────────────────────────────── */

.order-history-card__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  margin: 2px 0 0;
  padding: 10px;
  border-radius: 10px;
  background: #f9fafb;
  border: 1px solid #f0f0f0;
}

.order-history-card__meta-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 9px;
}

.order-history-card__meta-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #fff7ed;
  color: #d97706;
}

.order-history-card__meta-icon--accent {
  background: #ecfdf5;
  color: #059669;
}

.order-history-card__meta-copy {
  min-width: 0;
}

.order-history-card__meta-label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9ca3af;
}

.order-history-card__meta-value {
  margin: 1px 0 0;
  color: #111;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
  font-size: 0.9rem;
}

/* ── Card Badges ───────────────────────────────────── */

.order-history-card__badges {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  justify-self: end;
  align-self: start;
  margin-left: auto;
}

.order-history-badge {
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  padding: 5px 12px;
  background: #f9fafb;
  color: #374151;
  font-size: 0.82rem;
  font-weight: 500;
}

.order-history-badge--delivery {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.order-history-badge--pickup {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

/* ── Card Total ────────────────────────────────────── */

.order-history-card__total {
  grid-area: total;
  order: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: #f9fafb;
  color: #111;
  border: 1px solid #e5e7eb;
}

.order-history-card__total--below {
  margin-top: 2px;
  align-self: stretch;
}

.order-history-card__total-label {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: 600;
}

.order-history-card__total-value {
  font-weight: 700;
  font-size: 1.08rem;
  color: #111;
}

.order-history-card__total [data-role="tax-label"] {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.75rem;
  font-weight: 400;
  color: #9ca3af;
}

.order-history-card__total-mobile {
  display: none;
  margin: 4px 0 0;
  color: #111;
  font-weight: 700;
  gap: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 14px;
}

/* ── Totals Breakdown (Invoice-style) ──────────────── */

.order-history-breakdown {
  margin: 12px 0 4px;
  padding: 12px 14px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.order-history-breakdown__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.order-history-breakdown__label {
  font-size: 0.82rem;
  color: #374151;
  font-weight: 500;
}

.order-history-breakdown__value {
  font-size: 0.82rem;
  color: #374151;
  font-weight: 600;
  text-align: right;
}

.order-history-breakdown__row--discount .order-history-breakdown__label,
.order-history-breakdown__row--discount .order-history-breakdown__value {
  color: #16a34a;
}

.order-history-breakdown__row--subtle .order-history-breakdown__label,
.order-history-breakdown__row--subtle .order-history-breakdown__value {
  font-size: 0.78rem;
  color: #6b7280;
  font-weight: 400;
}

.order-history-breakdown__row--grand {
  padding: 8px 10px;
  margin: 4px -10px -4px;
  background: #fff7ed;
  border-radius: 8px;
}

.order-history-breakdown__row--grand .order-history-breakdown__label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #111;
}

.order-history-breakdown__row--grand .order-history-breakdown__value {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.order-history-breakdown__separator {
  height: 1px;
  background: #e5e7eb;
  margin: 6px 0;
}

:is(html[lang="ar"], html[dir="rtl"], html.rt-lang-ar, html.rt-lang-rtl) .order-history-breakdown__value {
  text-align: left;
}

/* ── Card Details (Expandable) ─────────────────────── */

.order-history-details {
  grid-area: details;
  order: 1;
  border-radius: 0;
  border: none;
  border-top: 1px solid #f0f0f0;
  background: transparent;
  padding: 0;
}

.order-history-details[open] .order-history-details__summary i {
  transform: rotate(180deg);
}

.order-history-details__summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 10px 0;
  font-weight: 600;
  font-size: 0.85rem;
  color: #6b7280;
  cursor: pointer;
  user-select: none;
  min-height: 40px;
}

.order-history-details__summary:hover {
  color: #374151;
}

.order-history-details summary::-webkit-details-marker {
  display: none;
}

.order-history-details__summary i {
  transition: transform 0.2s ease;
  color: #d1d5db;
  font-size: 0.8rem;
}

/* ── Order Items ───────────────────────────────────── */

.order-history-items {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  gap: 6px;
}

.order-history-item {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #eee;
  padding: 12px;
  display: grid;
  gap: 6px;
}

/* LTR / RTL direction overrides */
.order-history-item--force-ltr {
  direction: ltr;
  text-align: left;
}

.order-history-item--force-ltr .order-history-item__head,
.order-history-item--force-ltr .order-history-item__name,
.order-history-item--force-ltr .order-history-item__meta,
.order-history-item--force-ltr .order-history-item__ingredients,
.order-history-item--force-ltr .order-history-item__extras,
.order-history-item--force-ltr .order-history-item__exclusions,
.order-history-item--force-ltr .order-history-item__allergens,
.order-history-item--force-ltr .order-history-item__pricing-details {
  direction: ltr;
  text-align: left;
  unicode-bidi: plaintext;
}

.order-history-item--force-ltr .order-history-badge-row {
  justify-content: flex-start;
}

.order-history-item--force-ltr .order-history-badge-row [data-role="tax-label"] {
  margin-left: 0;
  margin-right: 10px;
}

.order-history-item--force-rtl {
  direction: rtl;
  text-align: right;
}

.order-history-item--force-rtl .order-history-item__head,
.order-history-item--force-rtl .order-history-item__name,
.order-history-item--force-rtl .order-history-item__meta,
.order-history-item--force-rtl .order-history-item__ingredients,
.order-history-item--force-rtl .order-history-item__extras,
.order-history-item--force-rtl .order-history-item__exclusions,
.order-history-item--force-rtl .order-history-item__allergens,
.order-history-item--force-rtl .order-history-item__pricing-details {
  direction: rtl;
  text-align: right;
  unicode-bidi: plaintext;
}

.order-history-item--force-rtl .order-history-badge-row {
  justify-content: flex-start;
}

.order-history-item--force-rtl .order-history-badge-row [data-role="tax-label"] {
  margin-left: 0;
  margin-right: 10px;
}

.order-history-item__head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.order-history-item__info {
  flex: 1;
}

.order-history-item__thumb {
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #eee;
  background: #f9fafb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
  transition: transform 0.15s ease;
}

.order-history-item__thumb:hover {
  transform: scale(1.04);
}

.order-history-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.order-history-item__thumb--placeholder {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 8px;
  border-color: transparent;
  background: #f3f4f6;
  cursor: default;
}

.order-history-item__thumb--placeholder:hover {
  transform: none;
}

.order-history-item__thumb--placeholder img {
  width: 28px;
  height: 28px;
  max-width: 70%;
  max-height: 70%;
  object-fit: contain;
  opacity: 0.35;
  padding: 2px;
}

.order-history-badge-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed #f0f0f0;
}

.order-history-badge-row .order-history-badge {
  background: transparent;
  border: none;
  padding: 0;
  font-weight: 700;
  font-size: 0.9rem;
  color: #111;
}

.order-history-badge-row [data-role="tax-label"] {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.75rem;
  color: #9ca3af;
}

.order-history-item__name {
  margin: 0;
  font-weight: 600;
  color: #111;
  font-size: 0.92rem;
}

.order-history-item__meta {
  color: #6b7280;
  font-size: 0.82rem;
  margin: 0;
}

.order-history-item__ingredients,
.order-history-item__extras,
.order-history-item__exclusions,
.order-history-item__allergens {
  margin: 2px 0 0;
  color: #6b7280;
  font-size: 0.82rem;
  line-height: 1.45;
}

.order-history-item__ingredients strong,
.order-history-item__extras strong,
.order-history-item__exclusions strong,
.order-history-item__allergens strong {
  color: #4b5563;
  font-weight: 600;
}

.order-history-item__pricing-details {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 4px 0 2px;
  padding: 4px 8px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #f0f0f0;
}

.order-history-item__pricing-row {
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.5;
}

/* ── Card Footer ───────────────────────────────────── */

.order-history-card__footer {
  grid-area: footer;
  order: 3;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  border-top: 1px solid #f0f0f0;
  padding-top: 12px;
}

.order-history-card__footer > span {
  color: #9ca3af;
  font-size: 0.78rem;
}

.order-history-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.order-history-card__action {
  border-radius: 8px;
  border: 1px solid #fca5a5;
  background: #fef2f2;
  padding: 8px 16px;
  font-size: 0.85rem;
  color: #dc2626;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.order-history-card__action:hover {
  background: #fee2e2;
  border-color: #f87171;
}

.order-history-card__action:active {
  background: #fecaca;
}

.order-history-card__action:focus-visible {
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

.order-history-card__actions-note {
  font-size: 0.78rem;
  color: #9ca3af;
  margin: 0;
  line-height: 1.4;
}

.order-history-card__actions-note--cancelled {
  color: #dc2626;
  font-weight: 600;
  padding: 6px 10px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  font-size: 0.82rem;
}

.order-history-card__actions--disabled {
  opacity: 0.8;
}

/* ── Lightbox ──────────────────────────────────────── */

.order-history-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 10000;
  --order-history-lightbox-pad: 16px;
  padding: var(--order-history-lightbox-pad);
  padding-top: calc(var(--order-history-lightbox-pad) + var(--ui-safe-top, env(safe-area-inset-top, 0px)));
  padding-right: calc(var(--order-history-lightbox-pad) + var(--ui-safe-right, env(safe-area-inset-right, 0px)));
  padding-bottom: calc(var(--order-history-lightbox-pad) + var(--ui-safe-bottom, env(safe-area-inset-bottom, 0px)) + var(--ui-cookie-banner-height, 0px));
  padding-left: calc(var(--order-history-lightbox-pad) + var(--ui-safe-left, env(safe-area-inset-left, 0px)));
}

.order-history-lightbox__inner {
  position: relative;
  max-width: min(90vw, 680px);
  max-height: min(
    calc(90dvh - var(--ui-safe-top, env(safe-area-inset-top, 0px)) - var(--ui-safe-bottom, env(safe-area-inset-bottom, 0px)) - var(--ui-cookie-banner-height, 0px)),
    780px
  );
  background: #111;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

.order-history-lightbox__inner img {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  display: block;
  background: #111;
}

.order-history-lightbox__close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 999px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
  font-size: 1.1rem;
}

:is(html[lang="ar"], html[dir="rtl"], html.rt-lang-ar, html.rt-lang-rtl) .order-history-lightbox__close,
body.cairo-font.order-history-page .order-history-lightbox__close {
  left: 8px;
  right: auto;
}

/* ── Cancel Modal ──────────────────────────────────── */

.order-history-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 12000;
  --order-history-modal-pad: clamp(12px, 4vw, 18px);
  padding: var(--order-history-modal-pad);
  padding-top: calc(var(--order-history-modal-pad) + var(--ui-safe-top, env(safe-area-inset-top, 0px)));
  padding-right: calc(var(--order-history-modal-pad) + var(--ui-safe-right, env(safe-area-inset-right, 0px)));
  padding-bottom: calc(var(--order-history-modal-pad) + var(--ui-safe-bottom, env(safe-area-inset-bottom, 0px)) + var(--ui-cookie-banner-height, 0px));
  padding-left: calc(var(--order-history-modal-pad) + var(--ui-safe-left, env(safe-area-inset-left, 0px)));
}

.order-history-modal__dialog {
  width: min(520px, 100%);
  max-width: min(520px, 100%);
  background: #fff;
  color: #1a1a1a;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.18);
  padding: 24px;
  position: relative;
  display: grid;
  gap: 12px;
  max-height: calc(90dvh - var(--ui-safe-top, env(safe-area-inset-top, 0px)) - var(--ui-safe-bottom, env(safe-area-inset-bottom, 0px)) - var(--ui-cookie-banner-height, 0px));
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.order-history-modal__close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: #374151;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  touch-action: manipulation;
  transition: background 0.15s ease;
}

.order-history-modal__close:hover {
  background: #e5e7eb;
}

:is(html[lang="ar"], html[dir="rtl"], html.rt-lang-ar, html.rt-lang-rtl) .order-history-modal__close,
body.cairo-font.order-history-page .order-history-modal__close {
  left: 12px;
  right: auto;
}

.order-history-modal__title {
  margin: 0 0 2px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #dc2626;
  font-size: 0.82rem;
}

.order-history-modal__message {
  margin: 0 0 8px;
  color: #374151;
  line-height: 1.55;
  font-size: 0.95rem;
}

.order-history-modal__label {
  font-size: 0.88rem;
  color: #6b7280;
  font-weight: 500;
}

.order-history-modal__textarea {
  width: 100%;
  min-height: 110px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111;
  padding: 12px;
  font-size: 0.95rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.order-history-modal__textarea:focus {
  border-color: var(--ui-primary, #e67e22);
  box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.12);
}

.order-history-modal__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 6px;
}

.order-history-modal__btn {
  border-radius: 9px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid #d1d5db;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  color: #374151;
  background: #f9fafb;
  text-decoration: none;
}

.order-history-modal__btn:hover {
  background: #f3f4f6;
}

.order-history-modal__btn:active {
  transform: scale(0.98);
}

.order-history-modal__btn--primary {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.order-history-modal__btn--primary:hover {
  background: #b91c1c;
}

.order-history-modal__btn--whatsapp {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}

.order-history-modal__btn--whatsapp:hover {
  background: #15803d;
}

.order-history-modal__btn--call {
  background: #0284c7;
  border-color: #0284c7;
  color: #fff;
}

.order-history-modal__btn--call:hover {
  background: #0369a1;
}

.order-history-modal__btn--ghost {
  background: transparent;
  border-color: #d1d5db;
}

.order-history-modal__btn--ghost:hover {
  background: #f3f4f6;
}

/* ── Route Section ─────────────────────────────────── */

.order-history-route {
  margin: 0 0 12px;
  border: 1px solid #e5e7eb;
  background: #fafbfc;
  border-radius: 10px;
  padding: 12px;
}

.order-history-route__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.order-history-route__title {
  font-weight: 600;
  color: #111;
  font-size: 0.9rem;
}

.order-history-route__status {
  color: #2563eb;
  font-weight: 600;
  font-size: 0.82rem;
  text-align: right;
  flex: 1 1 240px;
  min-width: 160px;
}

.order-history-route__map {
  width: 100%;
  height: var(--delivery-map-height, 220px);
  border-radius: 8px;
  overflow: hidden;
  background: #eef2f5;
  margin-bottom: 8px;
  position: relative;
}

.order-history-route__leaflet-host {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.order-history-route__preview {
  position: absolute;
  inset: 0;
  z-index: 400;
  pointer-events: none;
}

.order-history-route__loading {
  position: absolute;
  inset: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  font-weight: 600;
  font-size: 0.85rem;
  color: #6b7280;
  background: rgba(255, 255, 255, 0.92);
  pointer-events: none;
  animation: route-loading-pulse 1.1s ease-in-out infinite alternate;
}

@keyframes route-loading-pulse {
  from { opacity: 0.65; }
  to   { opacity: 1; }
}

.order-history-route__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.order-history-route__legend {
  color: #6b7280;
  font-size: 0.82rem;
  line-height: 1.4;
}

.order-history-route__link {
  color: var(--ui-primary, #e67e22);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
}

.order-history-route__link:hover {
  text-decoration: underline;
}

.order-history-route__leaflet-host.leaflet-container {
  position: relative;
  outline: none;
}

.order-history-route__contact {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
  z-index: 1000;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.order-history-route__contact.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.order-history-route__contact-label {
  font-weight: 600;
  font-size: 0.82rem;
}

.order-history-route__contact-link {
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  touch-action: manipulation;
  font-size: 0.88rem;
}

.order-history-route__contact-link::before {
  content: "\f095";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
}

.order-history-route__contact-note {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
}

/* ── Leaflet Basics ────────────────────────────────── */

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  left: 0;
  top: 0;
}

.leaflet-control-container { display: none; }
.leaflet-container img { max-width: none !important; }
.leaflet-pane { z-index: 400; }
.leaflet-tile { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-marker-pane { z-index: 600; }
.leaflet-popup-pane { z-index: 700; }
.leaflet-marker-icon,
.leaflet-marker-shadow { display: block; }

/* ═══════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════ */

/* ── Large screens (desktop) ───────────────────────── */
@media (min-width: 769px) {
  .oh-bottom-nav {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 12px;
    transform: translateX(-50%);
    width: auto;
    min-width: 380px;
    max-width: 480px;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: auto;
  }

  .oh-bottom-nav__item {
    flex: 1;
    max-width: none;
    padding: 10px 16px;
    border-radius: 12px;
    margin: 4px;
  }

  .oh-bottom-nav__item:hover {
    background: #f9fafb;
  }

  .oh-bottom-nav__item--active::before {
    display: none;
  }

  .oh-bottom-nav__item--active {
    background: #fff7ed;
  }
}

/* ── Mid-range tablets ─────────────────────────────── */
@media (min-width: 641px) and (max-width: 1200px) {
  .order-history-card__header {
    grid-template-columns: minmax(0, 1.2fr) auto;
    gap: 12px 16px;
    align-items: start;
  }

  .order-history-card__summary {
    gap: 10px;
  }

  .order-history-card__meta {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .order-history-card__badges {
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    flex-direction: row;
  }
}

/* ── Tablets & small screens ───────────────────────── */
@media (max-width: 720px) {
  .order-history-stats-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .order-history-stats-bar__sep {
    width: 100%;
    height: 1px;
  }

  .order-history-stat {
    flex: none;
    padding: 10px 14px;
  }
}

/* ── Mobile ────────────────────────────────────────── */
@media (max-width: 640px) {
  .oh-header__inner {
    padding: 8px 12px;
    border-radius: 14px;
    gap: 8px;
  }

  .oh-header__logo {
    height: 38px;
    max-width: min(110px, 28vw);
  }

  .oh-header__name {
    font-size: 0.88rem;
    max-width: 50vw;
  }

  .oh-header .rt-lang-menu__toggle {
    min-height: 34px;
    padding: 5px 8px;
    gap: 5px;
  }

  .oh-header .rt-lang-menu__toggle [data-rt-lang-current] {
    display: none;
  }

  .order-history-card__header {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .order-history-card__summary {
    gap: 8px;
  }

  .order-history-card__meta {
    grid-template-columns: 1fr;
    padding: 8px;
    margin-top: 2px;
  }

  .order-history-card__meta-item {
    gap: 8px;
    padding: 8px;
  }

  .order-history-card__meta-icon {
    width: 32px;
    height: 32px;
    border-radius: 7px;
  }

  .order-history-card__badges {
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 0;
    justify-self: end;
  }

  .order-history-details__summary {
    min-height: 44px;
  }

  .order-history-item {
    border: 1px solid #eee;
    padding: 10px;
  }

  .order-history-item__head {
    grid-template-columns: 1fr auto;
    align-items: flex-start;
    gap: 8px;
  }

  .order-history-item__thumb {
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    order: 2;
  }

  .order-history-item__thumb--placeholder {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
  }

  .order-history-card__footer {
    gap: 6px;
  }

  .order-history-card__action {
    min-height: 44px;
    padding: 10px 14px;
  }

  .order-history-badge-row {
    justify-content: flex-end;
  }

  .order-history-route__map {
    height: var(--delivery-map-height, 180px);
  }

  .order-history-route__foot {
    flex-direction: column;
    align-items: flex-start;
  }

  .order-history-route__status {
    font-size: 0.78rem;
    flex-basis: 100%;
    min-width: 0;
    text-align: left;
  }

  .order-history-route__contact {
    left: 8px;
    right: 8px;
    bottom: 8px;
  }

  .order-history-breakdown {
    padding: 10px 12px;
  }

  .order-history-breakdown__label,
  .order-history-breakdown__value {
    font-size: 0.78rem;
  }

  .order-history-breakdown__row--grand .order-history-breakdown__label {
    font-size: 0.82rem;
  }

  .order-history-breakdown__row--grand .order-history-breakdown__value {
    font-size: 0.92rem;
  }
}

/* ── Very small screens ────────────────────────────── */
@media (max-width: 520px) {
  .order-history-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .order-history-toolbar__actions {
    width: 100%;
  }

  .order-history-toolbar__actions .ui-cta-button {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  .oh-bottom-nav__item {
    font-size: 0.65rem;
    gap: 2px;
  }

  .oh-bottom-nav__item i,
  .oh-bottom-nav__item .oh-bottom-nav__menu-icon {
    font-size: 1.05rem;
  }
}

/* ── Very small height (landscape phone) ───────────── */
@media (max-height: 500px) {
  .oh-bottom-nav {
    height: 50px;
  }

  .oh-bottom-nav__item {
    font-size: 0;
    gap: 0;
  }

  .oh-bottom-nav__item i,
  .oh-bottom-nav__item .oh-bottom-nav__menu-icon {
    font-size: 1.2rem;
  }
}

/* ── Invoice section in order cards ─────────────────────────── */

.order-history-card__invoice-trigger {
  margin-top: 8px;
}

.order-history-card__action--invoice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 40px;
}

.order-history-card__action--invoice:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.order-history-card__action--invoice:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Invoice inline styles removed — invoices are now generated as PDF via invoicePdf.js */
