:root {
  --bg: #f5efe3;
  --surface: #fffdf8;
  --ink: #2b2019;
  --muted: #75665a;
  --line: #e7dcc9;
  --brand: #8c3b1f;
  --brand-dark: #6b2b14;
  --brand-soft: #f5e4da;
  --accent: #d9a441;
  --tile: #1d6b67;
  --tile-soft: #e2efed;
  --sand: #f0e8da;
  --danger: #b3362b;
  --danger-soft: #fbeae8;
  --warn-soft: #fbf0d6;
  --radius: 12px;
  --display: "Reem Kufi", "IBM Plex Sans Arabic", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font: 700 1.6rem/1.3 var(--display); margin: .5rem 0; color: var(--brand-dark); }
h2 { font-size: 1.15rem; margin: .25rem 0 .75rem; }
h3 { font-size: 1.05rem; margin: 0; }
section { margin-bottom: 1.5rem; }
small { font-size: .84rem; }
.muted { color: var(--muted); }
.wrap { width: 100%; max-width: 1040px; margin-inline: auto; padding-inline: 16px; }
.main { padding-block: 1.75rem 1.25rem; min-height: 70vh; }
.narrow { max-width: 440px; margin-inline: auto; }

/* Header */
.topbar { color: #fff; position: sticky; top: 0; z-index: 10; }
.topbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding-block: .6rem; }
.logo { display: inline-flex; align-items: center; gap: .45rem; color: #fff; font: 700 1.5rem/1 var(--display); }
.logo svg { width: 26px; height: 30px; flex: none; }
.logo:hover { text-decoration: none; }
.topsearch { order: 3; flex: 1 1 100%; min-width: 0; display: flex; }
.topsearch input { flex: 1; min-width: 0; border: 0; border-radius: 0 8px 8px 0; padding: .55rem .75rem; font: inherit; color: var(--ink); }
.topsearch input::placeholder { color: var(--muted); }
.topsearch button { border: 0; border-radius: 8px 0 0 8px; background: var(--accent); color: var(--ink); font: inherit; font-weight: 600; padding-inline: 1rem; cursor: pointer; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .85rem; margin-inline-start: auto; }
.nav a, .linklike { color: inherit; font-size: .92rem; }
.topbar .linklike { color: #fff; }
.count { background: var(--accent); color: var(--ink); border-radius: 999px; padding: 0 .45rem; font-size: .78rem; font-weight: 700; }
@media (min-width: 760px) {
  .topsearch { order: 0; flex: 1 1 320px; }
  .nav { margin-inline-start: 0; }
}

/* Controls */
.btn {
  display: inline-block; border: 1px solid var(--brand); background: var(--brand); color: #fff;
  border-radius: 8px; padding: .45rem .9rem; font: inherit; font-weight: 600; cursor: pointer; text-align: center;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.wide { width: 100%; }
.linklike { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--brand); }
.linklike.danger { color: var(--danger); font-size: .88rem; }
.inline { display: inline; }
input, select, textarea {
  font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: .45rem .6rem; max-width: 100%;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Cards and lists */
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: .85rem; color: inherit; }
a.card:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgb(107 43 20 / .08); text-decoration: none; }
.grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid .card { margin: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 1rem; }
.chip { display: inline-block; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: .2rem .8rem; font: inherit; font-size: .9rem; cursor: pointer; }
.chip:hover { border-color: var(--brand); text-decoration: none; }
.chip.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); font-weight: 600; }
.tile { flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; font-size: 1.1rem; }
.thumb { flex: none; width: 40px; height: 40px; border-radius: 10px; object-fit: contain; background: #fff; }
.store-card { display: flex; align-items: center; gap: .75rem; }
.store-card strong, .store-card small { display: block; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }

/* Search */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: .5rem; align-items: end; margin: .5rem 0 1rem; }
.filters label { display: grid; gap: .15rem; font-size: .85rem; color: var(--muted); }
.filters select { width: 100%; color: var(--ink); }
.store-hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.store-hero p { margin: .25rem 0; }
.store-search { display: flex; gap: .5rem; margin-block: .75rem; }
.store-search input { flex: 1; min-width: 0; }
.product-head { display: flex; gap: .75rem; align-items: flex-start; }
.product-head h1 { margin: 0; }
.product-head h3 a { color: inherit; }
.brand { display: block; color: var(--brand); font-weight: 600; font-size: .9rem; }
.offers { list-style: none; margin: .35rem 0 0; padding: 0; }
.offer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35rem 1rem; padding-block: .35rem; border-top: 1px solid var(--line); }
.offer-store { font-weight: 600; }
.price strong { font-size: 1.05rem; }
.add-form { display: flex; gap: .35rem; align-items: center; }
.add-form input[type=number] { width: 4.8rem; text-align: center; }
.offer-info { min-width: 0; }
@media (max-width: 559px) {
  .offer-info { flex: 1 0 100%; }
  .offer .add-form { flex: 1; }
  .offer .add-form .btn { flex: 1; }
}

/* Cart and checkout */
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; align-items: center; padding-block: .7rem; border-top: 1px solid var(--line); }
.cart-line strong, .cart-line small { display: block; }
.line-total { text-align: end; }
.group-total { display: flex; justify-content: space-between; gap: 1rem; padding-top: .7rem; border-top: 1px solid var(--line); }
.checkout-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; background: var(--surface); border: 1px solid var(--brand); border-radius: var(--radius); padding: .85rem 1rem; }
.two-col { display: grid; gap: .85rem; align-items: start; }
@media (min-width: 760px) { .two-col { grid-template-columns: 1.3fr 1fr; } }
.summary { list-style: none; margin: .5rem 0; padding: 0; }
.summary li { display: flex; justify-content: space-between; gap: 1rem; padding-block: .3rem; }
.summary li span:last-child { white-space: nowrap; font-weight: 600; }
.form .field { display: grid; gap: .2rem; margin-bottom: .8rem; }
.form label { font-weight: 500; }
.form input:not([type=checkbox]), .form select, .form textarea { width: 100%; }
.check { display: flex; gap: .5rem; align-items: center; }
.error-text { color: var(--danger); }
.has-error input, .has-error select { border-color: var(--danger); }

/* Status */
.status { display: inline-block; border-radius: 999px; padding: .05rem .65rem; font-size: .84rem; font-weight: 600; background: var(--brand-soft); color: var(--brand-dark); white-space: nowrap; }
.s-pending { background: var(--warn-soft); color: #74520c; }
.s-delivered { background: var(--tile); color: #fff; }
.s-rejected, .s-cancelled { background: var(--danger-soft); color: var(--danger); }
.order-row .chips { margin-bottom: 0; }
.timeline { display: flex; flex-wrap: wrap; gap: .3rem; list-style: none; padding: 0; margin: .5rem 0 1rem; font-size: .84rem; color: var(--muted); }
.timeline li { padding: .15rem .6rem; border-radius: 6px; background: var(--sand); }
.timeline .done { background: var(--brand-soft); color: var(--brand-dark); }
.timeline .current { background: var(--brand); color: #fff; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-block: .75rem; }
.action-form { display: flex; flex-wrap: wrap; gap: .35rem; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { padding-block: .4rem; border-top: 1px solid var(--line); }

/* Dashboards */
.stats { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1rem; }
.stat { margin: 0; }
.stat strong { display: block; font-size: 1.3rem; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: start; padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: .85rem; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tr.stalled { background: var(--warn-soft); }

.flash { border-radius: 8px; padding: .55rem .85rem; margin: 0 0 .85rem; background: var(--brand-soft); }
.flash.error { background: var(--danger-soft); color: var(--danger); }
.flash.warning { background: var(--warn-soft); }
.pagination { display: flex; align-items: center; justify-content: center; gap: .75rem; margin-top: 1rem; }

/* Compact, expandable product rows */
.results { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.results > .empty { margin: 0; }
.item { border-top: 1px solid var(--line); scroll-margin-top: 110px; }
.item:first-child { border-top: 0; }
.item-row { display: flex; align-items: center; gap: .6rem; padding: .35rem .75rem; min-height: 52px; cursor: pointer; list-style: none; }
.item-row::-webkit-details-marker { display: none; }
.item-row:hover { background: var(--brand-soft); }
.item-row .tile, .item-row .thumb { width: 36px; height: 36px; font-size: 1rem; }
.item-main { flex: 1; min-width: 0; line-height: 1.3; }
.item-name, .item-main small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.item-name { font-weight: 600; font-size: .96rem; }
.item-main small { font-size: .8rem; }
.item-price { flex: none; text-align: end; line-height: 1.25; font-size: .92rem; }
.item-price strong, .item-price small { display: block; }
.item-price small { font-size: .75rem; }
.chevron { flex: none; width: .55rem; height: .55rem; margin-inline: .15rem; border-inline-end: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.item[open] .chevron { transform: rotate(225deg); }
.item-body { padding: 0 .75rem .4rem; background: #fbf7ef; }
.item-link { display: inline-block; font-size: .84rem; padding-top: .3rem; }
.expand-controls { display: flex; gap: 1rem; justify-content: flex-end; margin-bottom: .35rem; font-size: .88rem; }
@media (prefers-reduced-motion: reduce) { .chevron { transition: none; } }

/* Logos and catalogs */
.logo-mini { width: 20px; height: 20px; object-fit: contain; vertical-align: middle; margin-inline-end: .3rem; border-radius: 4px; }
.logo-preview { display: block; max-width: 160px; max-height: 160px; object-fit: contain; margin-bottom: .75rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem; }
.store-title { display: flex; align-items: center; gap: .6rem; }
.store-title .thumb { width: 52px; height: 52px; }
.tags { display: flex !important; flex-wrap: wrap; gap: .25rem; margin-top: .2rem; }
.tag { background: var(--brand-soft); color: var(--brand-dark); border-radius: 6px; padding: 0 .4rem; font-size: .76rem; }
.catalog-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.catalog-card { margin: 0; text-align: center; font-weight: 600; font-size: 1.05rem; color: var(--brand-dark); }

/* File tools and period filter */
.file-tools { display: grid; gap: .75rem; }
.file-tools .btn { margin-block-end: .25rem; }
.upload-form { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.upload-form small { flex-basis: 100%; }
.upload-form input[type=file], .upload-form select { min-width: 0; max-width: 100%; }
.period input { width: 100%; }

/* Messaging */
.chat { max-height: 55vh; min-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; }
.bubble { align-self: flex-end; max-width: 85%; background: var(--sand); border-radius: 10px; padding: .4rem .7rem; overflow-wrap: anywhere; }
.bubble.mine { align-self: flex-start; background: var(--brand-soft); }
.bubble small { display: block; font-size: .76rem; }
.chat-form { display: flex; gap: .5rem; align-items: stretch; }
.chat-form textarea { flex: 1; min-width: 0; }
.thread-row.unread { border-color: var(--brand); border-inline-start-width: 4px; }

/* Endless list and cart toast */
.load-more { display: block; margin: .75rem auto 0; width: fit-content; }
.toast { position: fixed; inset-block-end: 1rem; inset-inline: 1rem; margin-inline: auto; width: fit-content; max-width: calc(100% - 2rem); background: var(--brand-dark); color: #fff; border-radius: 8px; padding: .55rem 1rem; z-index: 20; box-shadow: 0 4px 16px rgb(0 0 0 / .25); }
.toast.error { background: var(--danger); }

/* Demo account shortcuts on the login page */
.demo-accounts { margin-top: 1rem; }
.demo-account { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding-block: .5rem; border-top: 1px solid var(--line); }
.demo-account strong, .demo-account small { display: block; }

/* Role home pages and the trial role switcher */
.demo-bar { background: var(--warn-soft); border-bottom: 1px solid var(--line); font-size: .88rem; }
.demo-bar-row { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; padding-block: .35rem; }
.tiles { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tile-link { margin: 0; }
.tile-link strong, .tile-link small { display: block; }
.tile-link strong { color: var(--brand-dark); }
.tiles-spaced { margin-block: 1rem; }
.panel-heading { margin-top: 1.25rem; }
a.stat:hover { border-color: var(--brand); text-decoration: none; }
.stat-alert { border-color: var(--danger); }
.stat-alert strong { color: var(--danger); }

/* Store ratings */
.rating { display: inline-block; color: #8a6210; font-weight: 600; font-size: .88rem; white-space: nowrap; }
.stars { color: #c98e1a; letter-spacing: .05em; white-space: nowrap; }
.rate-box { border-top: 1px solid var(--line); margin-top: .75rem; padding-top: .75rem; }
.rate-box summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.rate-form { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .5rem; }
.rate-form input[type=text] { flex: 1 1 12rem; }
.star-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { font-size: 1.8rem; line-height: 1; padding: 0 .1rem; color: var(--line); cursor: pointer; }
.star-input input:checked ~ label, .star-input label:hover, .star-input label:hover ~ label { color: #c98e1a; }
.star-input input:focus-visible + label { outline: 2px solid var(--accent); }

/* Rejecting single items */
.rejected-item > span:first-child { text-decoration: line-through; color: var(--muted); }
.rejected-item > span:last-child { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.reject-note { display: inline-block; width: 100%; text-decoration: none; color: var(--danger); font-size: .85rem; }
.summary li.reject-row { display: block; padding-top: 0; }
.reject-row summary { font-size: .88rem; }
.reject-form { display: grid; gap: .5rem; background: var(--danger-soft); border-radius: 8px; padding: .75rem; margin-top: .35rem; }
.reject-form fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: .3rem; }
.reject-form legend { font-weight: 600; margin-bottom: .2rem; }

/* Large photo on the product details page */
.product-photo { display: block; width: 100%; max-width: 440px; height: auto; aspect-ratio: 1; object-fit: contain; margin: 0 auto 1rem; background: #fff; border-radius: var(--radius); }

/* Restaurant discounts */
.discount-line, .discount-line span { color: var(--brand); }
.discount-badge { background: var(--brand-soft); color: var(--brand-dark); border-radius: 8px; padding: .5rem .75rem; }
.discount-box { margin-top: .5rem; }
.discount-box summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.discount-form { display: flex; flex-wrap: wrap; gap: .5rem; margin-block: .5rem .25rem; }
.discount-form input { flex: 1 1 10rem; text-transform: uppercase; }
.discount-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding-block: .55rem; border-top: 1px solid var(--line); }
.discount-row:first-of-type { border-top: 0; }
.discount-row > div:first-child { flex: 1 1 14rem; }
.discount-pct { font-size: 1.1rem; color: var(--brand-dark); }
.inline-actions { display: flex; gap: .4rem; align-items: center; }
.promo-box { padding-block: .75rem; }
.promo-box .discount-form { margin: 0; }
.promo-applied { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; color: var(--brand-dark); }

/* Credit orders and store admin */
.credit-box { border-inline-start: 4px solid var(--warn, #d9a400); }
.credit-box.credit-approved { border-inline-start-color: var(--brand); }
.credit-box.credit-rejected { border-inline-start-color: var(--danger); }
.credit-form input[type=text] { width: 100%; margin-bottom: .5rem; }
.missing-tag { background: var(--warn-soft); color: var(--ink); }
tr.row-off td { opacity: .6; }
tr.row-off td:last-child { opacity: 1; }
.item-main .item-stores { color: var(--brand-dark); font-weight: 500; }

/* ================= Khan theme =================
   Baked brick, shanasheel woodwork, pointed arches, brass lanterns and turquoise tiles. */
:root { --arch-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><path d='M0 100V42Q0 14 50 0Q100 14 100 42V100Z'/></svg>"); --arch-strip: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='28' height='14'><path d='M0 0H28V14H27Q27 6 14 1.5Q1 6 1 14H0Z' fill='%234a2a17'/><path d='M1 14Q1 6 14 1.5Q27 6 27 14' fill='none' stroke='%23d9a441' stroke-width='1.3'/></svg>"); --brick-strip: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='24'><g fill='none' stroke='%232a0f05' stroke-opacity='.28' stroke-width='1.4'><path d='M0 .7H48M0 12.7H48M24 0V12.7M.7 12.7V24M47.3 12.7V24'/></g><path d='M2 2.5H22M26 14.5H46' stroke='%23fff' stroke-opacity='.06' stroke-width='1.4'/></svg>"); }
body { min-height: 100vh; display: flex; flex-direction: column; background-color: var(--bg); background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='72' height='72'><g fill='none' stroke='%238c3b1f' stroke-opacity='.075' stroke-width='1.2'><rect x='22' y='22' width='28' height='28'/><rect x='22' y='22' width='28' height='28' transform='rotate(45 36 36)'/><circle cx='36' cy='36' r='5'/></g></svg>"); }

/* Header: brick wall, a band of wooden lattice, then hanging arches */
.topbar { background: none; padding-bottom: 24px; }
.topbar::before {
  content: ""; position: absolute; inset: 0 0 24px; z-index: -1;
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='24'><g fill='none' stroke='%232a0f05' stroke-opacity='.28' stroke-width='1.4'><path d='M0 .7H48M0 12.7H48M24 0V12.7M.7 12.7V24M47.3 12.7V24'/></g><path d='M2 2.5H22M26 14.5H46' stroke='%23fff' stroke-opacity='.06' stroke-width='1.4'/></svg>") var(--brand);
}
.topbar::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 24px; pointer-events: none;
  border-top: 2px solid var(--accent);
  background:
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='28' height='14'><path d='M0 0H28V14H27Q27 6 14 1.5Q1 6 1 14H0Z' fill='%234a2a17'/><path d='M1 14Q1 6 14 1.5Q27 6 27 14' fill='none' stroke='%23d9a441' stroke-width='1.3'/></svg>") 0 100% / 28px 14px repeat-x,
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10'><path d='M0 0L10 10M10 0L0 10' stroke='%23d9a441' stroke-opacity='.6' stroke-width='1.3'/></svg>") 0 0 / 10px 10px repeat-x,
    linear-gradient(#4a2a17, #4a2a17) 0 0 / 100% 10px no-repeat;
}
.topbar-row { padding-block: .7rem .6rem; }
.logo { font-size: 1.75rem; text-shadow: 0 2px 0 rgb(0 0 0 / .25); }
.logo svg { width: 30px; height: 35px; }
.demo-bar { margin-top: -2px; }

/* Section titles carry a brass eight-pointed star */
h2 { font-family: var(--display); font-weight: 700; color: var(--brand-dark); font-size: 1.3rem; }
h2::before {
  content: ""; display: inline-block; width: .8em; height: .8em; margin-inline-end: .4em; vertical-align: -.05em;
  background: var(--accent); -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18'><rect x='3.5' y='3.5' width='11' height='11'/><rect x='3.5' y='3.5' width='11' height='11' transform='rotate(45 9 9)'/></svg>") center / contain no-repeat; mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18'><rect x='3.5' y='3.5' width='11' height='11'/><rect x='3.5' y='3.5' width='11' height='11' transform='rotate(45 9 9)'/></svg>") center / contain no-repeat;
}
.card h2::before, .stat h2::before { display: none; }

/* Home hero: the khan at dusk, a crescent and a few stars over the facade */
.hero {
  position: relative; overflow: hidden; color: #fff; border-radius: var(--radius);
  display: grid; gap: 1rem; align-items: end; padding: 1.75rem 1.25rem 0;
  background:
    radial-gradient(1.4px 1.4px at 30% 22%, #fff 99%, transparent) no-repeat,
    radial-gradient(1.2px 1.2px at 46% 12%, #fff 99%, transparent) no-repeat,
    radial-gradient(1.6px 1.6px at 62% 30%, #ffe9b8 99%, transparent) no-repeat,
    radial-gradient(1.2px 1.2px at 78% 10%, #fff 99%, transparent) no-repeat,
    radial-gradient(1.3px 1.3px at 90% 26%, #fff 99%, transparent) no-repeat,
    radial-gradient(1.1px 1.1px at 22% 40%, #fff 99%, transparent) no-repeat,
    radial-gradient(1.2px 1.2px at 8% 50%, #fff 99%, transparent) no-repeat,
    linear-gradient(180deg, #16223a 0%, #3a2546 42%, #8a3a1c 100%);
  border-bottom: 6px solid var(--accent);
  box-shadow: 0 10px 30px -18px rgb(42 16 7 / .7);
}
/* Crescent: the lit edge is the shadow of a transparent disc */
.hero::before {
  content: ""; position: absolute; top: 1.1rem; inset-inline-end: 1.5rem;
  width: 26px; height: 26px; border-radius: 50%; box-shadow: 7px -3px 0 0 #f7e2b0;
}
.hero-text { position: relative; padding-bottom: 1.5rem; }
.hero h1 { color: #fff; font-size: 1.95rem; margin-top: 0; text-shadow: 0 2px 12px rgb(0 0 0 / .35); }
.hero h1 span { color: var(--accent); }
.hero p { margin: 0 0 1rem; color: #f1e2cf; }
.hero .chip { background: rgb(255 255 255 / .08); border-color: rgb(217 164 65 / .6); color: #fff; backdrop-filter: blur(2px); }
.hero .chip:hover { background: var(--accent); color: var(--ink); }
.hero-art { position: relative; display: block; width: 100%; max-width: 360px; height: auto; margin-inline: auto; filter: drop-shadow(0 -6px 18px rgb(255 190 90 / .18)); }
@media (min-width: 760px) {
  .hero { grid-template-columns: 1fr 360px; padding: 2.25rem 2.25rem 0; }
  .hero h1 { font-size: 2.4rem; }
}

/* Catalogs are arched doorways into the khan */
.catalog-grid { grid-template-columns: repeat(3, minmax(0, 230px)); justify-content: center; gap: .75rem; }
@media (max-width: 759px) {
  .catalog-card { min-height: 135px !important; font-size: 1.1rem !important; padding-inline: .4rem !important; }
  .hero-art { max-width: 260px; }
}
@media (min-width: 760px) { .catalog-grid { gap: 1.25rem; } }
.catalog-card {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: .2rem;
  min-height: 200px; padding: 0 1rem 1.1rem; border: 0; border-radius: 0;
  color: #fff; font: 700 1.45rem/1.2 var(--display); text-align: center;
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><path d='M7 100V45Q7 21 50 8Q93 21 93 45V100' fill='none' stroke='%23d9a441' stroke-width='2.5' vector-effect='non-scaling-stroke'/></svg>") center / 100% 100% no-repeat, url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='24'><g fill='none' stroke='%232a0f05' stroke-opacity='.28' stroke-width='1.4'><path d='M0 .7H48M0 12.7H48M24 0V12.7M.7 12.7V24M47.3 12.7V24'/></g><path d='M2 2.5H22M26 14.5H46' stroke='%23fff' stroke-opacity='.06' stroke-width='1.4'/></svg>") var(--brand);
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><path d='M0 100V42Q0 14 50 0Q100 14 100 42V100Z'/></svg>") center / 100% 100% no-repeat; mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><path d='M0 100V42Q0 14 50 0Q100 14 100 42V100Z'/></svg>") center / 100% 100% no-repeat;
  transition: transform .15s, filter .15s;
}
a.catalog-card:hover { transform: translateY(-3px); filter: brightness(1.12); box-shadow: none; }

/* Store gates */
.store-card { border-top: 3px solid var(--accent); }
.tile {
  width: 42px; height: 48px; border-radius: 50% 50% 6px 6px / 62% 62% 6px 6px;
  background: var(--brand); color: var(--accent); font-family: var(--display); font-size: 1.3rem; padding-top: 6px;
}
.store-hero { position: relative; overflow: hidden; padding-top: 2.1rem; border-top: 0; background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='72' height='72'><g fill='none' stroke='%238c3b1f' stroke-opacity='.075' stroke-width='1.2'><rect x='22' y='22' width='28' height='28'/><rect x='22' y='22' width='28' height='28' transform='rotate(45 36 36)'/><circle cx='36' cy='36' r='5'/></g></svg>"); }
.store-hero::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 22px;
  background:
    var(--arch-strip) 0 100% / 28px 14px repeat-x,
    linear-gradient(var(--accent), var(--accent)) 0 6px / 100% 2px no-repeat,
    var(--brick-strip) 0 0 / 48px 6px repeat-x,
    linear-gradient(#4a2a17, #4a2a17) 0 0 / 100% 8px no-repeat;
}

/* Category chips look like glazed tiles */
.chip { border-color: #d7c7ad; }
.chip:hover { border-color: var(--tile); background: var(--tile-soft); color: var(--tile); }

/* Buttons and stats */
.btn { box-shadow: inset 0 -3px 0 rgb(0 0 0 / .18); }
.btn.ghost { box-shadow: none; }
.stat { border-top: 3px solid var(--tile); }

/* Footer: an arcade in brick */
.main { flex: 1 0 auto; }
.footer {
  position: relative; margin-top: 2.5rem; padding: 1.5rem 0 1.75rem; text-align: center;
  color: #f0e2cc; background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='24'><g fill='none' stroke='%23fff' stroke-opacity='.10' stroke-width='1.4'><path d='M0 .7H48M0 12.7H48M24 0V12.7M.7 12.7V24M47.3 12.7V24'/></g></svg>") var(--brand-dark); font-size: .9rem;
}
.footer::before {
  content: ""; position: absolute; inset-inline: 0; bottom: 100%; height: 16px;
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='28' height='16'><path d='M0 16H28V0H27Q27 8 14 12.5Q1 8 1 0H0Z' fill='%236b2b14'/></svg>") 0 100% / 28px 16px repeat-x;
}
.footer strong { display: block; color: var(--accent); font: 700 1.5rem/1.4 var(--display); }

.catalog-card .catalog-icon { width: 46px; height: 46px; color: var(--accent); margin-bottom: .35rem; filter: drop-shadow(0 2px 0 rgb(0 0 0 / .3)); }
.catalog-card small { font: 500 .8rem/1.3 "IBM Plex Sans Arabic", sans-serif; color: #f3dcb6; }
a.catalog-card:hover { text-decoration: none; }
@media (max-width: 759px) { .catalog-card .catalog-icon { width: 34px; height: 34px; } .catalog-card small { font-size: .72rem; } }

/* Breadcrumbs */
.crumbs { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-size: .88rem; color: var(--muted); margin-bottom: .75rem; }

/* Brass button */
.btn.brass { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.btn.brass:hover { background: #c8902c; }

/* Catalog page: you walk through the khan's gate */
.gate {
  position: relative; display: grid; justify-items: center; gap: 1.1rem; text-align: center;
  padding: 2rem 1rem 1.5rem; border-radius: var(--radius); overflow: hidden;
  background: var(--brick-strip) 0 0 / 48px 24px #5a2412;
  border-bottom: 6px solid var(--accent);
}
.gate-arch {
  width: min(100%, 320px); min-height: 230px; padding: 3.2rem 1rem 1.25rem;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  color: var(--brand-dark);
  background: radial-gradient(ellipse at 50% 85%, #fff4d6 0%, #f4cf84 45%, #c9853a 100%);
  -webkit-mask: var(--arch-mask) center / 100% 100% no-repeat; mask: var(--arch-mask) center / 100% 100% no-repeat;
}
.gate-arch .catalog-icon { width: 56px; height: 56px; color: var(--brand); }
.gate-arch h1 { margin: .2rem 0 0; font-size: 2.3rem; color: var(--brand-dark); }
.gate-arch p { margin: 0; font-weight: 600; color: #6b3a1a; }
.gate-search { display: flex; width: min(100%, 520px); }
.gate-search input { flex: 1; min-width: 0; border: 0; border-radius: 0 8px 8px 0; padding: .6rem .8rem; }
.gate-search .btn { border-radius: 8px 0 0 8px; }

/* Categories are the little shops (دكاكين) inside the khan */
.shops { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.shop {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: .15rem;
  min-height: 110px; padding: 2.3rem .85rem .75rem; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--ink);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.shop::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 22px;
  background:
    var(--arch-strip) 0 100% / 28px 14px repeat-x,
    linear-gradient(var(--accent), var(--accent)) 0 6px / 100% 2px no-repeat,
    linear-gradient(#4a2a17, #4a2a17) 0 0 / 100% 8px no-repeat;
}
.shop strong { font-size: 1rem; line-height: 1.35; }
.shop small { color: var(--tile); font-weight: 600; }
.shop:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 18px -10px rgb(107 43 20 / .45); }
.shop-empty { opacity: .6; }
.shop-empty small { color: var(--muted); }

/* AI search notice */
.ai-notice { display: flex; gap: .6rem; align-items: flex-start; border-inline-start: 4px solid var(--tile); background: var(--tile-soft); }
.ai-badge { flex: none; display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--tile); color: #fff; font-size: .85rem; }
.ai-notice a { margin-inline-start: .35rem; font-size: .88rem; }
#id_account_type { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
#id_account_type label { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
#id_account_type label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); font-weight: 600; }
[hidden] { display: none !important; }
