/* ==========================================================================
   Dharah design system — shared across all Dharah frontends.
   Brand: deep green #0A6E4F · amber #F5A524 · ink #101828.
   Mobile-first, tuned for Nigerian networks (lightweight, system fonts).
   ========================================================================== */

:root {
  --green: #0A6E4F;
  --green-dark: #075139;
  --green-tint: #E7F3EE;
  --amber: #F5A524;
  --amber-dark: #C77F0D;
  --amber-tint: #FDF3DF;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --line: #EAECF0;
  --bg: #FFFFFF;
  --bg-soft: #F8FAF9;
  --danger: #B42318;
  --danger-tint: #FEEFEF;
  --ok: #067647;
  --ok-tint: #E6F4EF;
  --info: #175CD3;
  --info-tint: #EFF4FF;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18);
  --maxw: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
[hidden] { display: none !important; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.mt1 { margin-top: .5rem; } .mt2 { margin-top: 1rem; } .mt3 { margin-top: 1.5rem; }
.mb2 { margin-bottom: 1rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.stack > * + * { margin-top: .75rem; }

/* ---------- Header ---------- */
.dh-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.dh-header__top { background: var(--green); color: #fff; font-size: .78rem; text-align: center; padding: 6px 12px; }
.dh-header__main { display: flex; align-items: center; gap: 12px; padding: 10px 16px; max-width: var(--maxw); margin: 0 auto; flex-wrap: wrap; }
@media (max-width: 760px) { .dh-search { order: 3; flex-basis: 100%; max-width: none; } }
.dh-logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.25rem; color: var(--ink); letter-spacing: -.02em; }
.dh-logo:hover { text-decoration: none; }
.dh-logo svg { width: 32px; height: 32px; }
.dh-logo span em { color: var(--green); font-style: normal; }
.dh-search { flex: 1; display: flex; max-width: 560px; }
.dh-search input {
  flex: 1; border: 1.5px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px;
  padding: 9px 12px; min-width: 0; background: var(--bg-soft);
}
.dh-search input:focus { outline: 2px solid var(--green); outline-offset: -1px; background: #fff; }
.dh-search button {
  border: 0; background: var(--amber); color: var(--ink); font-weight: 700;
  border-radius: 0 8px 8px 0; padding: 0 14px;
}
.dh-nav { display: flex; gap: 4px; align-items: center; }
.dh-nav a, .dh-nav button.linklike {
  color: var(--ink-2); padding: 8px; border-radius: 8px; position: relative;
  display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .9rem;
  background: none; border: 0; text-decoration: none;
}
.dh-nav a:hover, .dh-nav button.linklike:hover { background: var(--green-tint); text-decoration: none; }
.dh-nav .count {
  background: var(--amber); color: var(--ink); font-size: .68rem; font-weight: 800;
  min-width: 17px; height: 17px; border-radius: 9px; display: inline-flex;
  align-items: center; justify-content: center; padding: 0 4px;
}
.dh-cats { border-top: 1px solid var(--line); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dh-cats ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 6px 16px; max-width: none; }
.dh-cats a {
  white-space: nowrap; font-size: .82rem; font-weight: 600; color: var(--ink-2);
  padding: 5px 10px; border-radius: 999px; background: var(--bg-soft);
}
.dh-cats a:hover, .dh-cats a[aria-current="page"] { background: var(--green); color: #fff; text-decoration: none; }

/* ---------- Footer ---------- */
.dh-footer { background: var(--ink); color: #D0D5DD; margin-top: 3rem; padding: 2rem 0 1.5rem; font-size: .88rem; }
.dh-footer a { color: #F2F4F7; }
.dh-footer__grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.dh-footer h4 { color: #fff; margin-bottom: .75rem; }
.dh-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.dh-footer__bottom { border-top: 1px solid #344054; margin-top: 1.5rem; padding-top: 1rem; font-size: .78rem; color: #98A2B3; display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius); border: 1.5px solid transparent; font-weight: 700;
  padding: 10px 18px; font-size: .95rem; text-decoration: none; line-height: 1.2;
  transition: background .15s, box-shadow .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--green); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--green-dark); text-decoration: none; }
.btn--amber { background: var(--amber); color: var(--ink); }
.btn--amber:hover:not(:disabled) { background: #E6991A; text-decoration: none; }
.btn--ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover:not(:disabled) { border-color: var(--green); color: var(--green); text-decoration: none; }
.btn--danger { background: var(--danger-tint); color: var(--danger); border-color: #F4B0A9; }
.btn--sm { padding: 6px 12px; font-size: .82rem; border-radius: 8px; }
.btn--lg { padding: 14px 24px; font-size: 1.05rem; }
.btn--block { width: 100%; }

/* ---------- Forms ---------- */
.field { display: grid; gap: .3rem; margin-bottom: 1rem; }
.field label { font-weight: 600; font-size: .88rem; }
.field input, .field select, .field textarea {
  border: 1.5px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--green); outline-offset: -1px; border-color: var(--green);
}
.field .hint { font-size: .78rem; color: var(--muted); }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: 1fr 1fr; }
.form-grid .field--full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.error-box { background: var(--danger-tint); color: var(--danger); border: 1px solid #F4B0A9; border-radius: 8px; padding: 10px 14px; margin-bottom: 1rem; font-size: .9rem; }
.ok-box { background: var(--ok-tint); color: var(--ok); border: 1px solid #A6E9CE; border-radius: 8px; padding: 10px 14px; margin-bottom: 1rem; font-size: .9rem; }

/* ---------- Cards & grids ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 1rem; }
.card--flat { box-shadow: none; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.grid--wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.section { margin: 1.75rem 0; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.section__head h2 { margin: 0; }

/* ---------- Product cards ---------- */
.pcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; position: relative; transition: box-shadow .15s; }
.pcard:hover { box-shadow: var(--shadow-lg); text-decoration: none; }
.pcard__img { aspect-ratio: 1; background: var(--bg-soft); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pcard__img img { width: 100%; height: 100%; object-fit: cover; }
.pcard__img svg { width: 42%; opacity: .5; }
.pcard__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pcard__name { font-size: .88rem; font-weight: 600; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.pcard__price { font-weight: 800; color: var(--ink); font-size: 1rem; }
.pcard__price s { color: var(--muted); font-weight: 500; font-size: .8rem; margin-left: 6px; }
.pcard__store { font-size: .76rem; color: var(--muted); }
.pcard__badge { position: absolute; top: 10px; left: 10px; z-index: 2; }
.stars { color: var(--amber); letter-spacing: 1px; font-size: .85rem; white-space: nowrap; }
.stars .off { color: #E4E7EC; }

/* ---------- Badges & pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.badge--sponsored { background: var(--amber-tint); color: var(--amber-dark); border: 1px solid #F3D9A4; }
.badge--sale { background: var(--danger-tint); color: var(--danger); }
.badge--new { background: var(--green-tint); color: var(--green); }
.badge--out { background: #F2F4F7; color: var(--muted); }
.badge--ok { background: var(--ok-tint); color: var(--ok); }
.badge--info { background: var(--info-tint); color: var(--info); }
.badge--muted { background: #F2F4F7; color: var(--ink-2); }
.badge--danger { background: var(--danger-tint); color: var(--danger); }
.status { display: inline-flex; align-items: center; font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }

/* status colours for the order lifecycle */
.st-PENDING_PAYMENT, .st-PENDING, .st-INITIATED { background: var(--amber-tint); color: var(--amber-dark); }
.st-PAID, .st-CONFIRMED { background: var(--info-tint); color: var(--info); }
.st-VENDOR_PROCESSING, .st-READY_FOR_PICKUP, .st-PICKED_UP, .st-WAREHOUSE_RECEIVED, .st-QUALITY_CONTROL, .st-DISPATCHED, .st-IN_TRANSIT, .st-DESTINATION_HUB, .st-OUT_FOR_DELIVERY { background: #F4F3FF; color: #5925DC; }
.st-DELIVERED, .st-RETURN_WINDOW, .st-COMPLETED, .st-SUCCESSFUL, .st-PASSED { background: var(--ok-tint); color: var(--ok); }
.st-CANCELLED, .st-FAILED, .st-REJECTED, .st-QC_FAILED { background: var(--danger-tint); color: var(--danger); }
.st-RETURNED, .st-REFUNDED, .st-MANUAL, .st-PROCESSING { background: #F8F9FA; color: var(--ink-2); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.dh { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.dh th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.dh td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.dh tr:last-child td { border-bottom: 0; }

/* ---------- Utility blocks ---------- */
.hero { background: linear-gradient(135deg, var(--green) 0%, #0D8A63 60%, #12A173 100%); color: #fff; border-radius: var(--radius-lg); padding: 2rem 1.25rem; position: relative; overflow: hidden; }
.hero h1 { font-size: 1.6rem; margin-bottom: .4rem; }
.hero p { opacity: .92; max-width: 46ch; }
.hero .btn { margin-top: .5rem; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty svg { width: 64px; height: 64px; margin: 0 auto .75rem; opacity: .45; }
.toast-zone { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--ink); color: #fff; border-radius: 10px; padding: 12px 16px; font-size: .9rem; box-shadow: var(--shadow-lg); animation: toast-in .18s ease-out; }
.toast--ok { background: var(--ok); } .toast--err { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.pager { display: flex; gap: 6px; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.pager a, .pager span { min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; font-weight: 700; font-size: .88rem; background: #fff; }
.pager .cur { background: var(--green); border-color: var(--green); color: #fff; }

.filters { display: grid; gap: 1rem; }
.filters fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 0; }
.filters legend { font-weight: 700; font-size: .82rem; padding: 0 6px; }
.filters .opts { display: grid; gap: 6px; max-height: 220px; overflow-y: auto; }
.filters label.check { display: flex; gap: 8px; align-items: center; font-size: .88rem; }

/* ---------- Product page ---------- */
.pdp { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .pdp { grid-template-columns: minmax(0,5fr) minmax(0,4fr); } }
.gallery__main { aspect-ratio: 1; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gallery__main img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumbs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.gallery__thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.gallery__thumbs img.on { border-color: var(--green); }
.qty { display: inline-flex; border: 1.5px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty button { width: 40px; border: 0; background: var(--bg-soft); font-size: 1.1rem; font-weight: 800; }
.qty input { width: 56px; text-align: center; border: 0; }
.tiers { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tiers th, .tiers td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }

/* ---------- Cart / checkout ---------- */
.cart-line { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-line img, .cart-line .noimg { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; background: var(--bg-soft); display: flex; align-items: center; justify-content: center; }
.cart-line__name { font-weight: 600; }
.totals { display: grid; gap: 6px; }
.totals .row { display: flex; justify-content: space-between; font-size: .92rem; }
.totals .row.grand { font-weight: 800; font-size: 1.15rem; border-top: 2px solid var(--ink); padding-top: 8px; margin-top: 4px; }
.checkout-wrap { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .checkout-wrap { grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); } }
.payopt { display: flex; gap: 12px; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer; align-items: flex-start; }
.payopt input { margin-top: 4px; }
.payopt.on { border-color: var(--green); background: var(--green-tint); }
.payopt strong { display: block; }
.payopt .small { color: var(--muted); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1.1rem 26px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 10.5px; top: 20px; bottom: 2px; width: 1.5px; background: var(--line); }
.timeline li.done::before { background: var(--green); }
.timeline li.now::before { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-tint); }
.timeline .t { font-weight: 700; font-size: .9rem; }
.timeline .when { font-size: .76rem; color: var(--muted); }

/* ---------- Auth pages ---------- */
.auth { max-width: 430px; margin: 2rem auto; padding: 0 16px; }
.auth .card { padding: 1.5rem; }
.auth h1 { text-align: center; }

/* ---------- Misc ---------- */
.alert-banner { background: var(--info-tint); border: 1px solid #B2DDFF; color: var(--info); border-radius: var(--radius); padding: 10px 14px; font-size: .88rem; margin-bottom: 1rem; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px 14px; z-index: 200; border-radius: 0 0 8px 0; }
.skip:focus { left: 0; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
