/* Tartousi integration only. Load after Bootstrap RTL and reference style.css.
   All selectors are scoped so unrelated Flask/admin pages keep their styles. */

body.ts-store {
  --primary-color: #3754a3;
  --primary-dark: #02123f;
  --primary-rgb: 55, 84, 163;
  --c-brand-alt: #3754a3;
  --c-balance-alt: #02123f;
  --c-category-alt: #02123f;
  --c-product-alt: #02123f;
  --c-price-alt: #02123f;
  --c-body-bg: #ffffff;
  --cat-cols-mobile: 3;
  --cat-cols-desktop: 4;
  --cat-img-ratio: 1 / 1;
  --ts-sidebar-width: 280px;
  --ts-header-height: 64px;
  --ts-bottom-height: 76px;
  margin: 0;
  padding: 0;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  direction: rtl;
  flex-direction: column;
  background: var(--c-body-bg);
  color: var(--c-text-main);
  font-family: Tajawal, system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif !important;
}

body.ts-store *,
body.ts-store *::before,
body.ts-store *::after {
  box-sizing: border-box;
}

/* Keep the reference fixed-right desktop sidebar and fixed header in sync. */
body.ts-store #sidebar {
  position: fixed;
  inset: 0 0 0 auto;
  display: block;
  width: var(--ts-sidebar-width);
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  z-index: 1050;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--c-body-bg);
  text-align: right !important;
  transform: none;
  visibility: visible;
  transition: transform .3s ease, visibility .3s ease;
}

body.ts-store #mainContent {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  width: calc(100% - var(--ts-sidebar-width));
  min-height: calc(100vh - var(--ts-header-height));
  min-height: calc(100dvh - var(--ts-header-height));
  margin-top: var(--ts-header-height);
  margin-right: var(--ts-sidebar-width);
  margin-left: 0;
  transition: margin-right .3s ease, width .3s ease;
}

body.ts-store header.bg-dark1 {
  position: fixed;
  top: 0;
  right: var(--ts-sidebar-width);
  left: 0;
  width: auto;
  height: var(--ts-header-height);
  min-height: var(--ts-header-height);
  margin: 0;
  z-index: 1030;
  background-color: var(--c-brand-alt);
  color: #fff;
  border-radius: 0;
  box-shadow: none;
  transition: right .3s ease;
}

body.ts-store header.bg-dark1 .header-row {
  width: 100%;
  min-width: 0;
  gap: 8px;
}

body.ts-store header.bg-dark1 .header-item {
  min-width: 0;
}

body.ts-store header.bg-dark1 .logo-link {
  min-width: 0;
  height: var(--ts-header-height);
  text-decoration: none;
  color: inherit;
}

body.ts-store header.bg-dark1 .logo-img {
  width: auto;
  height: auto;
  max-height: 48px;
  max-width: min(180px, 42vw);
  object-fit: contain;
}

body.ts-store .ts-brand-wordmark {
  display: inline-block;
  min-width: 0;
  color: var(--c-category-alt);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  text-decoration: none;
}

body.ts-store header.bg-dark1 .ts-brand-wordmark {
  color: #fff;
}

body.ts-store header.bg-dark1 .menu-btn,
body.ts-store header.bg-dark1 .account-btn {
  flex: 0 0 auto;
  color: #fff;
  text-decoration: none;
}

body.ts-store #mainContentArea.container {
  flex: 1 0 auto;
  min-width: 0;
  max-width: 1140px;
  width: 100%;
  margin-inline: auto;
  padding-inline: 16px;
  padding-bottom: 20px;
}

body.ts-store.sidebar-hidden #sidebar {
  display: none;
}

body.ts-store.sidebar-hidden #mainContent {
  margin-right: 0 !important;
  width: 100% !important;
}

body.ts-store.sidebar-hidden header.bg-dark1 {
  right: 0;
}

body.ts-store #overlay.ts-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1045;
  background: rgba(2, 18, 63, .45);
  cursor: pointer;
  touch-action: none;
}

body.ts-store .ts-sidebar-close,
body.ts-store .ts-order-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--c-text-muted);
  font: inherit;
  font-size: 20px;
  cursor: pointer;
}

body.ts-store .ts-sidebar-close {
  margin-inline-start: auto;
}

body.ts-store .ts-sidebar-close:hover,
body.ts-store .ts-order-close:hover {
  background: var(--c-surface-alt);
  color: var(--c-category-alt);
}

body.ts-store .ts-sidebar-account {
  min-width: 0;
  margin-block: 12px;
  padding: 16px 14px;
  border: 1px solid var(--c-border);
  border-radius: 20px;
  background: var(--c-surface-soft);
  text-align: right;
  overflow-wrap: anywhere;
}

body.ts-store .ts-sidebar-account .btn {
  border-radius: 999px;
}

body.ts-store .ts-balance {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-block: 12px;
  padding: 12px;
  border-radius: 14px;
  background: var(--c-surface-alt);
  color: var(--c-balance-alt);
  font-weight: 700;
  overflow-wrap: anywhere;
}

body.ts-store .ts-currency {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background-color: var(--c-surface);
  color: var(--c-balance-alt);
  font: inherit;
}

body.ts-store #sidebar .ts-nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--c-category-alt);
  text-align: right;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

body.ts-store #sidebar .ts-nav-link i,
body.ts-store #sidebar .ts-nav-link .sb-ico {
  flex: 0 0 30px;
  text-align: center;
}

body.ts-store #sidebar .ts-nav-link:hover,
body.ts-store #sidebar .ts-nav-link.active,
body.ts-store #sidebar .ts-nav-link[aria-current="page"] {
  background: var(--c-surface-alt);
}

body.ts-store .ts-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: var(--c-surface-alt);
  color: var(--c-category-alt);
  font: inherit;
  cursor: pointer;
}

body.ts-store .ts-theme-toggle[aria-pressed="true"] {
  background: var(--c-category-alt);
  color: #fff;
}

body.ts-store .ts-theme-toggle i {
  color: inherit;
}

/* Existing RTL slider translates in the positive X direction: keep a one-slide
   wide, RTL flex track. Do not require Flickity or invent a 16:9 crop. */
body.ts-store #sliderContainer.hero-slider {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: auto;
  margin: 0 0 16px;
  border: 0;
  border-radius: 15px;
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  box-shadow: none;
}

body.ts-store #sliderContainer.hero-slider .slider-wrapper {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  direction: rtl;
  align-items: flex-start;
  width: 100%;
  height: auto;
  transition: transform .5s ease-in-out;
}

body.ts-store #sliderContainer.hero-slider .slider-slide {
  position: relative;
  display: block;
  flex: 0 0 100%;
  min-width: 100%;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: auto;
}

body.ts-store #sliderContainer.hero-slider .slider-slide > a {
  display: block;
}

body.ts-store #sliderContainer.hero-slider .slider-slide img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 380px;
  aspect-ratio: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

/* Categories retain the source square image + centered caption treatment. */
body.ts-store .ts-grid {
  display: grid;
  grid-template-columns: repeat(var(--cat-cols-mobile), minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 0;
}

body.ts-store .ts-grid > .ts-category {
  width: auto;
  min-width: 0;
  max-width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: center;
  text-decoration: none;
  color: var(--c-category-alt);
  overflow: visible;
}

body.ts-store .ts-grid .ts-category.card,
body.ts-store .ts-grid .ts-category > .card {
  display: block;
  height: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent !important;
  box-shadow: none !important;
  text-decoration: none;
  color: inherit;
  overflow: visible;
}

body.ts-store .ts-grid .ts-category .card-img-top {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--cat-img-ratio);
  object-fit: cover;
  border-radius: 8px 8px 0 0;
}

body.ts-store .ts-grid .ts-category .card-body {
  padding: 10px 5px 5px;
  margin: 0;
  background: transparent !important;
  text-align: center;
}

body.ts-store .ts-grid .ts-category .name,
body.ts-store .ts-grid .ts-category .card-title {
  display: block;
  min-width: 0;
  height: auto;
  max-height: none;
  margin: 0;
  color: var(--c-category-alt);
  background: transparent !important;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  text-shadow: none;
  -webkit-line-clamp: unset;
}

/* Empty image containers and local fallback classes need no remote asset. */
body.ts-store .ts-grid .ts-category .card-img-top:empty,
body.ts-store .ts-grid .ts-category .img-placeholder,
body.ts-store .ts-grid .ts-category .ts-fallback,
body.ts-store .ts-grid .ts-category .fallback-img-base {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: auto;
  aspect-ratio: var(--cat-img-ratio);
  border-radius: 8px 8px 0 0;
  background: var(--c-surface-alt);
  color: var(--c-category-alt);
  font-size: 24px;
}

body.ts-store .ts-grid .ts-category .fallback-img-base::before {
  background-image: none;
  background-color: var(--c-surface-alt);
  filter: none;
  transform: none;
}

body.ts-store .ts-grid .ts-category .fallback-img-base span {
  color: var(--c-category-alt);
  text-shadow: none;
}

/* Product rows: deliberately one column at every viewport. Reorder existing
   direct children instead of requiring changes to product rendering logic. */
body.ts-store .prod-grid.product-list-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

body.ts-store .prod-card.product-list-item {
  display: flex !important;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  width: 100%;
  min-width: 0;
  min-height: 60px;
  height: auto;
  padding: 6px 14px;
  border: 0;
  border-radius: 50px !important;
  background: #efefef !important;
  box-shadow: none;
  color: var(--c-product-alt) !important;
  text-align: right;
  overflow: visible;
  transform: none;
  transition: box-shadow .18s ease, background-color .18s ease;
}

body.ts-store .prod-card.product-list-item .prod-image-box,
body.ts-store .prod-card.product-list-item > .img-placeholder {
  order: 1;
  flex: 0 0 48px;
  width: 48px !important;
  min-width: 48px;
  height: 48px !important;
  min-height: 0;
  aspect-ratio: 1 / 1;
  margin: 0 !important;
  padding: 0;
  border-radius: 999px !important;
  background: var(--c-surface);
  color: var(--c-product-alt);
  overflow: hidden;
}

body.ts-store .prod-card.product-list-item .prod-image-box img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  object-fit: cover !important;
  border-radius: inherit;
}

body.ts-store .prod-card.product-list-item .name,
body.ts-store .prod-card.product-list-item .product-list-title {
  order: 2;
  flex: 1 1 0%;
  min-width: 0;
  height: auto;
  max-height: none;
  margin: 0;
  color: var(--c-product-alt);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  text-decoration: none;
  -webkit-line-clamp: unset;
}

body.ts-store .prod-card.product-list-item .name:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.ts-store .prod-card.product-list-item .price,
body.ts-store .prod-card.product-list-item .product-list-price {
  order: 3;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 38%;
  margin: 0;
  color: var(--c-price-alt);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  unicode-bidi: plaintext;
}

body.ts-store .prod-card.product-list-item .price > span {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

body.ts-store .prod-card.product-list-item .fav-btn {
  position: static;
  order: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  color: var(--c-text-muted);
  cursor: pointer;
}

body.ts-store .prod-card.product-list-item .fav-btn svg {
  display: block;
  width: 22px;
  height: 22px;
}

body.ts-store .prod-card.product-list-item .fav-btn.active svg {
  fill: #dc3545;
  stroke: #dc3545;
}

body.ts-store .prod-card.product-list-item .unavailable-badge {
  position: static;
  order: 5;
  flex: 0 0 auto;
  max-width: 100%;
  margin-inline-start: auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: #64748b;
  color: #fff;
  font-size: 11px;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
  transform: none;
}

body.ts-store .prod-card.product-list-item.unavailable {
  cursor: default;
  filter: none;
}

body.ts-store .prod-card.product-list-item.unavailable .name,
body.ts-store .prod-card.product-list-item.unavailable .price {
  opacity: .8;
}

@media (hover: hover) and (pointer: fine) {
  body.ts-store .prod-card.product-list-item:hover {
    transform: none;
    box-shadow: var(--shadow-soft);
  }
}

/* Custom order overlay uses the reference surface, description accent, and
   rounded form-control language, but does not depend on Bootstrap modal JS. */
body.ts-store .order-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1100;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 16px;
  border: 0;
  border-radius: 0;
  background: rgba(2, 6, 23, .55);
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

body.ts-store .order-modal.active {
  display: flex;
}

body.ts-store .order-content {
  position: relative;
  flex: 0 1 500px;
  width: 100%;
  min-width: 0;
  max-width: 500px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 20px;
  border: 1px solid var(--c-border);
  border-radius: 18px;
  background: var(--c-surface);
  color: var(--c-text-main);
  box-shadow: var(--shadow-lg);
  direction: rtl;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  animation: none;
}

body.ts-store .order-content .ts-order-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--c-border);
}

body.ts-store #modalProdName {
  flex: 1 1 auto;
  min-width: 0;
  margin: 4px 0 0;
  color: var(--c-product-alt);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  text-align: right;
  white-space: normal;
  overflow-wrap: anywhere;
}

body.ts-store #modalProdDesc {
  max-height: 150px;
  padding: 10px 12px;
  margin-bottom: 14px !important;
  border-inline-start: 4px solid var(--c-brand-alt);
  border-radius: 10px;
  background: var(--c-surface-soft);
  color: var(--c-text-muted) !important;
  font-size: 13px;
  line-height: 1.8;
  text-align: right !important;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--c-brand-alt) var(--c-surface-alt);
}

body.ts-store #modalProdDesc:empty {
  display: none;
}

body.ts-store #modalProdDesc img {
  max-width: 100%;
  height: auto;
}

body.ts-store #modalProdPrice {
  padding: 10px 16px;
  margin-bottom: 20px;
  border-radius: 999px;
  background: var(--c-price-alt);
  color: #fff !important;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
}

body.ts-store #modalProdPrice del,
body.ts-store #modalProdPrice s {
  color: #fff !important;
  opacity: .7;
}

body.ts-store .order-content form .form-group {
  min-width: 0;
  margin-bottom: 16px;
}

body.ts-store .order-content form .form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--c-text-muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

body.ts-store .order-content form .form-group input:not([type="hidden"]),
body.ts-store .order-content form .form-group select,
body.ts-store .order-content form .form-group textarea {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background-color: var(--c-surface);
  color: var(--c-text-main);
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  text-align: right;
  transition: border-color .15s ease, box-shadow .15s ease;
}

body.ts-store .order-content form .form-group select {
  padding-left: 36px;
}

body.ts-store .order-content form .form-group textarea {
  border-radius: 14px;
  resize: vertical;
}

body.ts-store .order-content form .form-group input[type="checkbox"],
body.ts-store .order-content form .form-group input[type="radio"] {
  display: inline-block;
  width: auto;
  min-height: 0;
  padding: 0;
  accent-color: var(--c-brand-alt);
}

body.ts-store .order-content form .form-group input:focus,
body.ts-store .order-content form .form-group select:focus,
body.ts-store .order-content form .form-group textarea:focus {
  border-color: var(--c-brand-alt);
  box-shadow: 0 0 0 3px rgba(55, 84, 163, .18);
}

body.ts-store .order-content .qty-desc {
  margin-top: 6px;
  color: var(--c-text-muted);
  font-size: 12px;
  line-height: 1.6;
}

body.ts-store .order-content .ts-total {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 999px;
  background: var(--c-surface-alt);
  color: var(--c-text-muted) !important;
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

body.ts-store .order-content #totalPrice {
  min-width: 0;
  color: var(--c-price-alt) !important;
  font-size: 16px;
  font-weight: 700;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
}

body.ts-store .order-content .order-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

body.ts-store .order-content .order-btns .btn-confirm,
body.ts-store .order-content .order-btns .btn-cancel {
  flex: 1 1 120px;
  min-width: 0;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  white-space: normal;
  cursor: pointer;
  transition: opacity .15s ease;
}

body.ts-store .order-content .order-btns .btn-confirm {
  background: var(--c-brand-alt);
  color: #fff;
}

body.ts-store .order-content .order-btns .btn-cancel {
  border-color: var(--c-border);
  background: var(--c-surface-alt);
  color: var(--c-text-muted);
}

body.ts-store .order-content .order-btns button:hover {
  opacity: .92;
}

body.ts-store .order-content .order-btns button:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

/* Five reference icon-and-label destinations; accept either direct items or
   the reference .mbottom-list wrapper. Desktop keeps the reference nav hidden. */
body.ts-store .mbottom-nav {
  display: none;
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 1040;
  border-top: 1px solid rgba(0, 0, 0, .08);
  border-radius: 0;
  background: var(--c-body-bg);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, .06);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
}

body.ts-store .mbottom-nav .mbottom-list {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  justify-items: stretch;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.ts-store .mbottom-nav .mb-item {
  display: grid;
  align-items: center;
  justify-items: stretch;
  min-width: 0;
  margin: 0;
  color: #2b2f33;
  text-decoration: none;
}

body.ts-store .mbottom-nav .mb-link,
body.ts-store .mbottom-nav a.mb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 52px;
  padding: 4px 2px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
}

body.ts-store .mbottom-nav .mb-link i,
body.ts-store .mbottom-nav a.mb-item i {
  font-size: 22px;
  line-height: 1;
}

body.ts-store .mbottom-nav .mb-label {
  display: block;
  max-width: 100%;
  color: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

body.ts-store .mbottom-nav .mb-item.is-active,
body.ts-store .mbottom-nav .mb-item.active,
body.ts-store .mbottom-nav .mb-link[aria-current="page"] {
  color: var(--c-brand-alt);
}

body.ts-store .ts-footer {
  margin-top: auto;
  padding: 24px 16px;
  color: var(--c-text-muted);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
  overflow-wrap: anywhere;
}

body.ts-store .ts-footer .footer-flex {
  flex-wrap: wrap;
}

body.ts-store .ts-footer a {
  color: var(--c-product-alt);
  text-decoration: none;
}

body.ts-store .ts-footer a:hover {
  text-decoration: underline;
}

/* Restore keyboard focus suppressed by several source icon-button rules. */
body.ts-store :is(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--c-brand-alt) !important;
  outline-offset: 3px !important;
}

body.ts-store header.bg-dark1 :is(a, button, [tabindex]):focus-visible,
body.ts-store .order-btns .btn-confirm:focus-visible {
  outline-color: #fff !important;
  box-shadow: 0 0 0 5px var(--c-brand-alt) !important;
}

@media (min-width: 768px) {
  body.ts-store .ts-grid {
    grid-template-columns: repeat(var(--cat-cols-desktop), minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  body.ts-store {
    --ts-header-height: 56px;
    padding-bottom: calc(var(--ts-bottom-height) + env(safe-area-inset-bottom, 0px));
  }

  body.ts-store #mainContent,
  body.ts-store.sidebar-hidden #mainContent {
    width: 100% !important;
    margin-right: 0 !important;
    min-height: calc(100vh - var(--ts-header-height) - var(--ts-bottom-height) - env(safe-area-inset-bottom, 0px));
    min-height: calc(100dvh - var(--ts-header-height) - var(--ts-bottom-height) - env(safe-area-inset-bottom, 0px));
  }

  body.ts-store header.bg-dark1 {
    right: 0 !important;
  }

  body.ts-store header.bg-dark1 .logo-img {
    max-height: 44px;
  }

  body.ts-store #sidebar,
  body.ts-store.sidebar-hidden #sidebar {
    display: block;
    width: var(--ts-sidebar-width);
    max-width: calc(100vw - 32px);
    transform: translateX(100%);
    visibility: hidden;
    pointer-events: none;
  }

  body.ts-store.sidebar-visible {
    overflow: hidden;
  }

  body.ts-store.sidebar-visible #sidebar {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  body.ts-store.sidebar-visible #overlay.ts-overlay {
    display: block;
  }

  body.ts-store #mainContentArea.container {
    padding-inline: 12px;
  }

  body.ts-store .ts-grid {
    gap: 12px 10px;
  }

  body.ts-store .prod-card.product-list-item {
    gap: 8px;
    padding-inline: 10px;
  }

  body.ts-store .mbottom-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
  }

  body.ts-store .order-content {
    padding: 18px 16px;
  }
}

/* The reference sidebar media rule includes 768px; explicitly resolve that
   boundary in favor of the desktop layout used by its category/nav rules. */
@media (min-width: 768px) and (max-width: 768px) {
  body.ts-store #mainContent {
    margin-right: var(--ts-sidebar-width) !important;
  }

  body.ts-store.sidebar-hidden #mainContent {
    margin-right: 0 !important;
  }

  body.ts-store header.bg-dark1 {
    right: var(--ts-sidebar-width) !important;
  }

  body.ts-store.sidebar-hidden header.bg-dark1 {
    right: 0 !important;
  }
}

/* Builder helper classes, including states also used by existing scripts. */
body.ts-store [hidden],
body.ts-store .prod-card.product-list-item[hidden],
body.ts-store .ts-grid .ts-category .card-img-top[hidden],
body.ts-store .ts-grid .ts-category .img-placeholder[hidden],
body.ts-store .ts-grid .ts-category .ts-fallback[hidden],
body.ts-store .ts-grid .ts-category .fallback-img-base[hidden] {
  display: none !important;
}

body.ts-store.ts-order-open {
  overflow: hidden;
}

body.ts-store.ts-no-bottom-nav {
  --ts-bottom-height: 0px;
  padding-bottom: 0 !important;
}

body.ts-store .ts-page-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-block: 8px 20px;
  color: var(--c-category-alt);
}

body.ts-store .ts-page-heading h1,
body.ts-store .ts-page-heading h2 {
  min-width: 0;
  margin: 0;
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

body.ts-store .ts-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: var(--c-surface-alt);
  color: var(--c-brand-alt);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
}

body.ts-store .ts-search-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin-block: 12px;
  padding: 12px 14px;
  border: 1px solid var(--c-border);
  border-radius: 14px;
  background: var(--c-surface-soft);
  color: var(--c-product-alt);
  font-size: 14px;
  line-height: 1.6;
  text-decoration: none;
  overflow-wrap: anywhere;
}

body.ts-store .ts-search-result a {
  color: var(--c-product-alt);
  text-decoration: none;
}

body.ts-store .ts-search-result img {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  object-fit: cover;
}

body.ts-store .ts-search-result .name {
  flex: 1 1 0%;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

body.ts-store .ts-search-result .price {
  color: var(--c-price-alt);
  font-weight: 700;
  overflow-wrap: anywhere;
}

body.ts-store .ts-empty {
  padding: 40px 16px;
  color: var(--c-text-muted);
  text-align: center;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

body.ts-store .ts-empty > i {
  display: block;
  margin-bottom: 12px;
  color: var(--c-category-alt);
  font-size: 40px;
}

body.ts-store .ts-ticker {
  width: 100%;
  min-width: 0;
  margin-bottom: 16px;
  padding: 8px 12px;
  background: #f1f1f1;
  color: var(--c-category-alt);
  font-size: 14px;
  line-height: 32px;
  overflow: hidden;
}

body.ts-store .ts-ticker marquee {
  display: block;
  width: 100%;
  min-height: 32px;
}

body.ts-store .ts-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  background: var(--c-surface-alt);
  color: var(--c-category-alt);
  text-align: center;
  overflow-wrap: anywhere;
}

body.ts-store .ts-fallback span {
  max-width: 100%;
  color: inherit;
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
}

body.ts-store .order-content > .ts-order-close {
  position: absolute;
  inset-block-start: 14px;
  inset-inline-end: 12px;
}

body.ts-store .order-content > #modalProdName {
  padding-inline-end: 44px;
  margin-bottom: 16px;
}

@media (prefers-reduced-motion: reduce) {
  body.ts-store *,
  body.ts-store *::before,
  body.ts-store *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  body.ts-store .ts-category:hover,
  body.ts-store .ts-category .card:hover,
  body.ts-store .mb-item.is-active i,
  body.ts-store .mb-item:active i {
    transform: none !important;
  }
}

/* Final integration details for the exact DOM supplied by the Flask templates. */
body.ts-store .ts-sidebar-account > strong,
body.ts-store .ts-sidebar-account > small { display: block; }
body.ts-store .ts-avatar { width: 54px; height: 54px; object-fit: cover; border-radius: 50%; margin-bottom: 10px; }
body.ts-store .ts-vip { display: block; margin-top: 12px; font-size: 12px; color: var(--c-brand-alt); }
body.ts-store .ts-sidebar-footer { padding: 12px; color: var(--c-text-muted); font-size: 12px; text-align: center; }
body.ts-store .prod-card.product-list-item:not(.unavailable) { cursor: pointer; }
body.ts-store .prod-card.product-list-item.unavailable .prod-image-box { filter: grayscale(1); opacity: .6; }
body.ts-store .img-placeholder { display: flex; align-items: center; justify-content: center; }
body.ts-store header .balance-chip { font-size: 12px; gap: 5px; max-width: 145px; flex-wrap: wrap; }
body.ts-store .ticker-shell { height: 48px; }
body.ts-store .ts-ticker { display: inline-block; width: max-content; min-width: 100%; padding-block: 0; margin: 0; line-height: 48px; white-space: nowrap; overflow: visible; animation: tsTickerScroll 24s linear infinite; }
@keyframes tsTickerScroll { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
html[data-theme="dark"] body.ts-store {
 --c-body-bg: #0c0c0c;
 --c-surface: #181a1b;
 --c-surface-alt: #202426;
 --c-surface-soft: #181a1b;
 --c-border: #383d3f;
 --c-text-main: #e2e8f0;
 --c-text-muted: #94a3b8;
 --c-text-soft: #94a3b8;
 --c-text-gray: #e2e8f0;
 --c-category-alt: #e2e8f0;
 --c-product-alt: #e2e8f0;
 --c-price-alt: #e2e8f0;
 --c-balance-alt: #e2e8f0;
}
html[data-theme="dark"] body.ts-store .prod-card.product-list-item { background: #202426 !important; }
html[data-theme="dark"] body.ts-store #modalProdPrice { background: #02123f; }
html[data-theme="dark"] body.ts-store .ts-ticker { background: #101010; }
@media (prefers-reduced-motion: reduce) { body.ts-store .ts-ticker { animation: none; white-space: normal; line-height: 1.7; } body.ts-store .ticker-shell { height: auto; } }

/* Contact shortcuts stay below modal and off-canvas backdrops. */
body.ts-store .fab-wrapper { z-index: 1035 !important; }
body.ts-store.ts-order-open .fab-wrapper,
body.ts-store.sidebar-visible .fab-wrapper { visibility: hidden !important; pointer-events: none !important; }
