:root {
  --brand: #a8255f;
  --brand-dark: #7c1745;
  --brand-soft: #fbe9f1;
  --gold: #c9a24b;
  --ink: #2a1a22;
  --muted: #7d6b74;
  --bg: #fdf8f6;
  --surface: #ffffff;
  --line: #efe2e7;
  --ok: #1f8a5b;
  --warn: #c27c0e;
  --danger: #c0392b;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(80, 20, 50, .07);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Cairo, system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg); line-height: 1.6; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1 { font-size: 1.6rem; margin: 0 0 16px; line-height: 1.3; }
h2 { font-size: 1.35rem; margin: 0 0 14px; }
h3 { font-size: 1.1rem; margin: 0 0 12px; }
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-top: 4px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
label { display: block; margin-bottom: 12px; font-weight: 600; font-size: .92rem; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
code { background: var(--brand-soft); padding: 1px 6px; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 560px; }
.center { text-align: center; }
.pad-xl { padding-top: 60px; padding-bottom: 60px; }
.section { padding-top: 28px; padding-bottom: 28px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.danger { color: var(--danger) !important; }
.big { font-size: 4rem; color: var(--brand); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--brand); color: #fff; border: 0; border-radius: 999px; padding: 10px 22px; font-weight: 700; cursor: pointer; text-decoration: none !important; transition: background .15s; }
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-lg { padding: 13px 30px; font-size: 1.05rem; }
.btn-sm { padding: 6px 14px; font-size: .88rem; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 4px 0; }
.btn-icon { background: var(--brand); color: #fff; border: 0; border-radius: 10px; padding: 7px 10px; cursor: pointer; font-size: .85rem; white-space: nowrap; }
.btn-icon:hover { background: var(--brand-dark); }
.pill { background: var(--gold); color: #fff !important; padding: 3px 12px; border-radius: 999px; font-size: .85rem; }
.pill-sm { background: var(--brand-soft); color: var(--brand); font-style: normal; font-size: .75rem; padding: 1px 8px; border-radius: 999px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 12px 0; }
.row-actions.center { justify-content: center; }
.row-actions form { margin: 0; }

/* Header */
.announce { background: var(--ink); color: #fff; text-align: center; font-size: .85rem; padding: 6px 16px; }
.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-row { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 12px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.4rem; color: var(--brand); letter-spacing: .5px; text-decoration: none !important; }
.logo img { width: 38px; height: 38px; }
.logo-light { color: #fff; }
.search { flex: 1; display: flex; max-width: 520px; position: relative; }
.search input { margin: 0; border-radius: 999px; padding-inline-end: 44px; background: var(--bg); }
.search button { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; font-size: 1rem; }
.header-actions { display: flex; align-items: center; gap: 16px; margin-inline-start: auto; white-space: nowrap; }
.header-actions a { color: var(--ink); font-weight: 600; }
.lang { border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; }
.cart-link { position: relative; font-size: 1.3rem; }
.badge { background: var(--brand); color: #fff; border-radius: 999px; font-size: .7rem; min-width: 18px; height: 18px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.cart-link .badge { position: absolute; top: -6px; inset-inline-end: -10px; }
.badge.pop { animation: pop .4s; }
@keyframes pop { 50% { transform: scale(1.5); } }
.main-nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.main-nav a { color: var(--ink); padding: 4px 12px; border-radius: 999px; white-space: nowrap; font-size: .92rem; }
.main-nav a.active, .main-nav a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.menu-btn { display: none; background: none; border: 0; font-size: 1.5rem; cursor: pointer; }

.flash { padding: 12px 16px; border-radius: 10px; margin: 14px 0; font-weight: 600; }
.flash-success { background: #e5f6ee; color: var(--ok); }
.flash-error { background: #fdecea; color: var(--danger); }

/* Hero */
.hero { background: linear-gradient(135deg, var(--brand-soft), #fff4e6); padding: 40px 0; }
.hero-inner { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: center; }
.hero h1 { font-size: 2.3rem; font-weight: 800; }
.eyebrow { color: var(--brand); font-weight: 700; margin: 0 0 8px; }
.lead { font-size: 1.1rem; color: var(--muted); margin-bottom: 24px; }
.hero-collage { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hero-collage img { aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); background: #fff; }
.hero-collage img:nth-child(odd) { transform: translateY(14px); }
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding-top: 24px; }
.features div { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; font-weight: 700; font-size: .95rem; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cat-tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 10px; text-align: center; color: var(--ink); display: flex; flex-direction: column; gap: 2px; transition: transform .15s, box-shadow .15s; }
.cat-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.cat-icon { font-size: 2rem; }
.cat-tile small { color: var(--muted); }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-head h2, .section-head h3 { margin: 0; }

/* Product grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.card { background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card-img { position: relative; aspect-ratio: 1; background: #faf3f6; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.tag { position: absolute; top: 10px; inset-inline-start: 10px; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; color: #fff; }
.tag.static { position: static; }
.tag-sale { background: var(--danger); }
.tag-out { background: var(--muted); inset-inline-start: auto; inset-inline-end: 10px; }
.card-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { color: var(--ink); font-weight: 600; font-size: .95rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.card-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; margin-top: auto; }
.price strong { color: var(--brand); font-size: 1.15rem; font-weight: 800; }
.price small { font-size: .75rem; }
.price s { color: var(--muted); font-size: .85rem; margin-inline-start: 6px; }
.price .unit { display: block; color: var(--muted); font-size: .78rem; }
.price-lg strong { font-size: 2rem; }
.price-lg .unit { font-size: .95rem; }

.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.list-head h1 { margin: 0; }
.sort-form select { width: auto; margin: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.chip { background: #fff; border: 1px solid var(--line); color: var(--ink); padding: 5px 14px; border-radius: 999px; font-size: .9rem; }
.chip small { color: var(--muted); }
.chip.active, .chip:hover { background: var(--brand); color: #fff; border-color: var(--brand); text-decoration: none; }
.chip.active small, .chip:hover small { color: #fde; }
.empty { text-align: center; padding: 40px 0; color: var(--muted); font-size: 1.1rem; }
.pagination { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 28px 0 8px; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.pagination a.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Product page */
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 16px; }
.product { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }
.gallery-main { background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); aspect-ratio: 1; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.thumbs button { padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; width: 70px; height: 70px; cursor: pointer; background: #fff; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.product-info h1 { font-size: 1.7rem; }
.buy-box { display: flex; gap: 12px; margin: 20px 0; flex-wrap: wrap; }
.qty-input { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: #fff; overflow: hidden; }
.qty-input button { background: none; border: 0; width: 38px; height: 42px; font-size: 1.2rem; cursor: pointer; color: var(--brand); }
.qty-input input { width: 52px !important; text-align: center; border: 0 !important; margin: 0 !important; padding: 8px 0 !important; -moz-appearance: textfield; }
.qty-input input::-webkit-inner-spin-button { -webkit-appearance: none; }
.desc { white-space: pre-line; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.perks { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 20px; color: var(--muted); }
.out { color: var(--danger); font-weight: 700; font-size: 1.2rem; }

/* Cart & checkout */
.cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.cart-items, .panel, .summary { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.cart-row { display: grid; grid-template-columns: 72px 1fr auto auto auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-row img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }
.cart-name a { color: var(--ink); font-weight: 600; }
.cart-name small { display: block; color: var(--muted); }
.cart-row .line { white-space: nowrap; }
.cart-actions { display: flex; justify-content: space-between; margin-top: 14px; }
.summary { position: sticky; top: 130px; }
.summary > div { display: flex; justify-content: space-between; padding: 6px 0; }
.sum-total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px !important; font-size: 1.15rem; }
.sum-total b { color: var(--brand); }
.summary .btn { margin-top: 12px; }
.mini-row { display: grid !important; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; font-size: .9rem; }
.mini-row img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.radio-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-weight: 400; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.radio-card input { margin-top: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .span2 { grid-column: span 2; }
.success-icon { width: 80px; height: 80px; margin: 0 auto 16px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 2.6rem; display: flex; align-items: center; justify-content: center; }

/* Auth & account */
.auth { max-width: 460px; padding-top: 36px; padding-bottom: 48px; }
.auth h1 { text-align: center; }
.account { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.account-nav { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 130px; }
.account-nav a, .account-nav button { padding: 9px 12px; border-radius: 10px; color: var(--ink); text-align: start; width: 100%; font-weight: 600; }
.account-nav a.active, .account-nav a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.two-col.wide-first { grid-template-columns: 1.6fr 1fr; }
.addr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.addr.is-default { border-color: var(--brand); }
.tracker { display: flex; list-style: none; padding: 0; margin: 0 0 18px; counter-reset: s; }
.tracker li { flex: 1; text-align: center; font-size: .82rem; color: var(--muted); position: relative; padding-top: 34px; }
.tracker li::before { counter-increment: s; content: counter(s); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 28px; height: 28px; border-radius: 50%; background: var(--line); color: var(--muted); display: flex; align-items: center; justify-content: center; font-weight: 700; z-index: 1; }
.tracker li::after { content: ''; position: absolute; top: 13px; inset-inline-start: 50%; width: 100%; height: 3px; background: var(--line); }
.tracker li:last-child::after { display: none; }
.tracker li.done { color: var(--ink); font-weight: 700; }
.tracker li.done::before { background: var(--brand); color: #fff; content: '✓'; }
.tracker li.done::after { background: var(--brand); }
.log { list-style: none; padding: 0; margin: 0; }
.log li { padding: 4px 0; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: .82rem; white-space: nowrap; }
.table tfoot td { font-weight: 600; }
.thumb-cell img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.clickable { cursor: pointer; }
.clickable:hover { background: #fdf5f8; }
.row-muted { opacity: .55; }
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.status-pending { background: #fff3d6; color: var(--warn); }
.status-confirmed { background: #e3efff; color: #2860b8; }
.status-processing { background: #efe6ff; color: #6a3fc0; }
.status-shipped { background: #e0f5f7; color: #137a86; }
.status-delivered { background: #e5f6ee; color: var(--ok); }
.status-cancelled { background: #f2f2f2; color: #888; }

/* Footer */
.site-footer { background: var(--ink); color: #e9dbe2; margin-top: 40px; padding-top: 36px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 24px; }
.site-footer h4 { color: #fff; margin: 0 0 10px; }
.site-footer a { color: #e9dbe2; display: block; padding: 2px 0; }
.site-footer .logo { color: #fff; }
.copyright { border-top: 1px solid #4a3540; margin-top: 24px; padding-top: 14px; padding-bottom: 14px; font-size: .85rem; color: #b9a4ae; }
.wa-float { position: fixed; bottom: 20px; inset-inline-end: 20px; width: 56px; height: 56px; border-radius: 50%; background: #25d366; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,.25); z-index: 30; }

/* ---- Admin ---- */
body.admin { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.admin-side { background: var(--ink); color: #fff; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-side nav { display: flex; flex-direction: column; gap: 2px; margin-top: 20px; }
.admin-side nav a, .admin-side nav button { color: #e9dbe2; padding: 9px 12px; border-radius: 10px; display: flex; justify-content: space-between; align-items: center; text-align: start; width: 100%; }
.admin-side nav a.active, .admin-side nav a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.admin-side hr { border-color: #4a3540; }
.admin-main { padding: 0 24px 40px; min-width: 0; }
.admin-top { display: flex; align-items: center; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.admin-top h1 { margin: 0; flex: 1; font-size: 1.4rem; }
.bell { position: relative; font-size: 1.4rem; text-decoration: none !important; }
.bell .badge { position: absolute; top: -4px; right: -10px; background: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: var(--ink); display: flex; flex-direction: column; }
.stat b { font-size: 1.7rem; color: var(--brand); }
.stat small, .stat span { color: var(--muted); }
.stat-hot { background: var(--brand); border-color: var(--brand); }
.stat-hot b, .stat-hot small { color: #fff; }
a.stat:hover { text-decoration: none; box-shadow: var(--shadow); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar i { display: block; width: 100%; background: linear-gradient(var(--brand), #e06a9e); border-radius: 6px 6px 0 0; min-height: 2px; }
.bar small { font-size: .7rem; color: var(--muted); }
.plain { padding-inline-start: 18px; margin: 0 0 12px; }
.plain li { padding: 3px 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; margin: 0; }
.toolbar label { margin: 0; font-weight: 400; display: flex; align-items: center; gap: 6px; }
.input-sm { width: 110px !important; margin: 0 !important; padding: 6px 8px !important; }
.input-xs { width: 70px !important; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input { width: auto; margin: 0; flex: 1; min-width: 120px; }
details.panel summary { cursor: pointer; }
details.panel[open] summary { margin-bottom: 12px; }
.img-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-bottom: 12px; }
.img-admin img { aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.img-admin label { margin: 4px 0 0; }
.notif-list { list-style: none; padding: 0; margin: 0; }
.notif-list li { display: flex; gap: 10px; align-items: center; padding: 10px; border-bottom: 1px solid var(--line); }
.notif-list li a { flex: 1; color: var(--ink); }
.notif-list li.unread { background: var(--brand-soft); font-weight: 700; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--ink); color: #fff; padding: 14px 18px; border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 50; max-width: 360px; }
.toast a { color: #fff; }

@media (max-width: 900px) {
  .hero-inner, .product, .cart-layout, .two-col, .two-col.wide-first, .account { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.8rem; }
  .features { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .summary, .account-nav { position: static; }
  .account-nav { flex-direction: row; overflow-x: auto; }
  .account-nav a, .account-nav button { width: auto; white-space: nowrap; }
  body.admin { grid-template-columns: 1fr; }
  .admin-side { position: fixed; inset-inline-start: 0; top: 0; width: 240px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  [dir=rtl] .admin-side { transform: translateX(100%); }
  body.nav-open .admin-side { transform: none; }
  .admin-main { padding: 0 16px 32px; }
  .menu-btn { display: block; }
}
@media (max-width: 640px) {
  .header-row { flex-wrap: wrap; gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .site-header .menu-btn { display: none; }
  .hide-sm { display: none; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card-foot { flex-direction: column; align-items: stretch; }
  .btn-icon { width: 100%; }
  .hero-collage { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: auto; }
  .cart-row { grid-template-columns: 60px 1fr auto; }
  .cart-row img { width: 60px; height: 60px; }
  .cart-row .qty-input { grid-column: 2; }
  .footer-grid { grid-template-columns: 1fr; }
  .tracker li { font-size: .7rem; }
}
@media print { .site-header, .site-footer, .admin-side, .wa-float { display: none; } }
