/* =====================================================================
   Relify Market design system — shared by store, vendor portal, admin
   Black / white, light-grey selection, subtle yellow accents. Inter.
   ===================================================================== */
:root {
  --ink: #0A0A0A;
  --soft: #3A3A3A;
  --muted: #6B6B6B;
  --faint: #9A9A9A;
  --line: #E7E7E5;
  --well: #F4F4F2;
  --hover: #FAFAF9;
  --paper: #FFFFFF;
  --yellow: #F2C94C;          /* stars, rating/progress bars, small dots only */
  --red: #C62828;
  --red-bg: #FDECEC;
  --green: #1E8E3E;
  --green-bg: #E7F5EC;
  --amber: #B26A00;
  --amber-bg: #FFF4E0;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --max: none;
  --sh-1: 0 0 0 1px rgba(10,10,10,.05), 0 1px 2px rgba(10,10,10,.04);
  --sh-2: 0 0 0 1px rgba(10,10,10,.04), 0 8px 24px rgba(10,10,10,.08);
  --ease: cubic-bezier(.2,.7,.2,1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; }
a:hover { color: var(--soft); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout ---------- */
.container { max-width: var(--max); margin: 0 auto; padding: 0 32px; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.gap-20 { gap: 20px; } .gap-24 { gap: 24px; } .gap-32 { gap: 32px; } .gap-40 { gap: 40px; } .gap-56 { gap: 56px; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.right { text-align: right; }

.h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.6px; line-height: 1.15; }
.h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }
.h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.label-caps { font-size: 13px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; }

/* ---------- buttons ---------- */
.btn {
  height: 38px; padding: 0 16px; border-radius: 19px; border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease, transform .12s ease;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; opacity: .45; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #262626; color: #fff; }
.btn-outline { background: #fff; border-color: var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--well); }
.btn-quiet { background: #fff; border-color: var(--line); color: var(--ink); font-weight: 500; }
.btn-quiet:hover { background: var(--hover); }
.btn-ghost { background: transparent; color: var(--ink); font-weight: 500; }
.btn-ghost:hover { background: var(--well); }
.btn-danger { background: #fff; border-color: var(--line); color: var(--red); font-weight: 500; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 16px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 38px; height: 38px; border: 0; border-radius: 8px; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; color: var(--ink);
}
.icon-btn:hover { background: var(--well); }
.link { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; cursor: pointer; font-size: inherit; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; }
.spinner.dark { border-color: var(--line); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field-label { font-size: 12px; font-weight: 500; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #fff; font-size: 13px; outline: none; transition: border-color .15s ease;
}
.textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--muted); }
.input.invalid, .select.invalid { border-color: var(--red); }
.field-error { font-size: 12px; color: var(--red); }
.select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230A0A0A' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.checkbox { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); cursor: pointer; }

/* switch: black track, white knob */
.switch { position: relative; display: inline-block; width: 40px; height: 24px; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; border-radius: 12px; background: var(--line); transition: background .15s ease; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s ease; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.switch input:checked ~ .track { background: var(--ink); }
.switch input:checked ~ .knob { left: 19px; }
.switch input:focus-visible ~ .track { outline: 2px solid var(--ink); outline-offset: 2px; }

/* search box */
.searchbox { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 20px; background: var(--well); transition: background .2s ease, border-color .2s ease, box-shadow .2s ease; }
.searchbox:focus-within { border-color: var(--line); background: #fff; box-shadow: 0 4px 16px rgba(10,10,10,.06); }
.searchbox input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 14px; outline: none; }
.searchbox input::-webkit-search-cancel-button, .searchbox input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search-clear { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: #E6E6E3; color: #7A7A78; display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; transition: background .15s ease, color .15s ease; }
.search-clear:hover { background: #DADAD7; color: var(--ink); }

/* ---------- small pieces ---------- */
.pill { height: 22px; padding: 0 8px; border-radius: 11px; background: var(--well); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tag { height: 24px; padding: 0 8px; border-radius: 6px; background: var(--well); font-size: 11.5px; display: inline-flex; align-items: center; gap: 6px; }
.chip { height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line); background: #fff; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none; }
.chip:hover { background: var(--hover); }
.chip.on { border-color: var(--ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--ink); }
.dot.yellow { background: var(--yellow); }
.dot.red { background: var(--red); }
.dot.green { background: var(--green); }
/* tick / cross / warning status text */
.stat { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; }
.stat svg { flex: none; }
.stat.ok { color: var(--green); }
.stat.bad { color: var(--red); }
.stat.warn { color: var(--amber); }
.dot.grey { background: var(--faint); }
.badge-count { position: absolute; top: 1px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--yellow); color: var(--ink); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.badge-dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); border: 2px solid #fff; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex: none; border: 0; cursor: pointer; }
.logo-tile { width: 36px; height: 36px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex: none; overflow: hidden; }
.logo-tile img { width: 100%; height: 100%; object-fit: cover; }
.logo-tile.sm { width: 24px; height: 24px; border-radius: 6px; font-size: 10px; }
.progress { height: 8px; border-radius: 4px; background: var(--well); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 4px; background: var(--yellow); }
.stars { display: inline-flex; gap: 2px; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- surfaces ---------- */
.card { border: 0; border-radius: var(--r); background: #fff; box-shadow: var(--sh-1); }
.card-pad { padding: 16px 18px; }
.panel-grey { background: var(--well); border-radius: var(--r-lg); }
.well { background: var(--well); border-radius: var(--r); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.well img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.well img.stock { object-fit: cover; mix-blend-mode: normal; }
.well img, .pic img, .ad img, .hero-slide img { animation: img-in .5s var(--ease) both; }
@keyframes img-in { from { opacity: 0; } }
.notice { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 14px; border-radius: var(--r-sm); background: var(--well); font-size: 13px; }

/* ---------- product card ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 22px 14px; }
.pcard { display: flex; flex-direction: column; gap: 6px; min-width: 0; height: 100%; }
.pcard .btn, .pcard .stepper { height: 34px; margin-top: 4px; flex: none; }
/* keep every card's note + button pinned to the bottom so a row lines up */
.pcard .note { margin-top: auto; padding-top: 2px; }
.pcard > .price + .btn { margin-top: auto; }
.pcard .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .price-row { align-items: baseline; min-width: 0; }
.pcard .price-row .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pcard .price { flex: none; }
.pcard .stepper button { height: 32px; }
.pcard .btn-quiet { font-size: 12px; }
.pcard .well { aspect-ratio: 1 / 1; border-radius: 10px; margin-bottom: 4px; }
.pcard .well { transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.pcard:hover .well { transform: translateY(-2px); box-shadow: var(--sh-2); }
.pcard .save { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pcard .save svg, #save svg { transition: transform .2s var(--ease); }
.pcard .save[aria-pressed="true"] svg, #save[aria-pressed="true"] svg { animation: heart-pop .35s var(--ease); }
@keyframes heart-pop { 40% { transform: scale(1.3); } }
.pcard .flag { position: absolute; top: 8px; left: 8px; height: 22px; padding: 0 7px; border-radius: 6px; background: #fff; font-size: 10.5px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.pcard .name { font-size: 13.5px; font-weight: 500; line-height: 1.35; min-height: calc(1.35em * 2); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .price { font-size: 16px; font-weight: 600; letter-spacing: -.3px; }
.pcard .note { font-size: 11.5px; display: flex; align-items: center; gap: 6px; min-height: 16px; }

/* quantity stepper */
.stepper { height: 38px; border: 1px solid var(--line); border-radius: 19px; display: inline-flex; align-items: center; background: #fff; }
.stepper button { width: 34px; height: 36px; border: 0; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: inherit; }
.stepper input { width: 44px; height: 36px; border: 0; text-align: center; font-size: 14px; font-weight: 600; background: transparent; outline: none; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper.dark { background: var(--ink); color: #fff; border-color: var(--ink); width: 100%; justify-content: space-between; }
.stepper.dark input { color: #fff; }

/* tabs */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { height: 42px; padding: 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; font-size: 14px; font-weight: 600; color: var(--faint); cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs.sm .tab { font-size: 14px; height: 44px; }
.tabs.sm { gap: 24px; }

/* segmented filter pills (light-grey selection) */
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 10px; background: var(--well); flex-wrap: wrap; }
.seg button, .seg a { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; font-size: 13px; font-weight: 500; color: var(--soft); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.seg [aria-pressed="true"], .seg [aria-current="page"] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }

/* table */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid #F1F1EF; vertical-align: middle; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--hover); }
.table th.right, .table td.right { text-align: right; }
.table-box { overflow-x: auto; }

/* menus / dropdowns */
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 240px; background: #fff; border: 0; border-radius: var(--r); padding: 6px; z-index: 50; box-shadow: 0 0 0 1px rgba(10,10,10,.05), 0 16px 40px rgba(10,10,10,.12); animation: menu-in .16s var(--ease); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }
.menu.left { left: 0; right: auto; }
.menu a, .menu button.item { width: 100%; min-height: 36px; padding: 7px 10px; border: 0; border-radius: 8px; background: transparent; display: flex; align-items: center; gap: 10px; font-size: 13px; text-align: left; text-decoration: none; cursor: pointer; color: var(--ink); }
.menu a:hover, .menu button.item:hover, .menu .item.on { background: var(--well); }
.menu .sep { height: 1px; background: var(--line); margin: 6px 0; }
.menu .head { padding: 8px 10px; font-size: 12px; color: var(--muted); }

/* toast */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; min-height: 40px; padding: 9px 14px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 13px; display: flex; align-items: center; gap: 12px; animation: toast-in .2s ease; max-width: min(560px, 92vw); }
.toast.error { background: #fff; color: var(--red); border: 1px solid var(--line); }
.toast a { color: #fff; font-weight: 600; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(10,10,10,.32); z-index: 150; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s ease; }
.modal { width: min(440px, 100%); background: #fff; border-radius: var(--r-lg); padding: 20px; display: flex; flex-direction: column; gap: 16px; animation: rise .2s ease; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* skeleton + empty */
.sk { background: linear-gradient(90deg, var(--well) 25%, #ECECEA 37%, var(--well) 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.empty { padding: 40px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--muted); }
.empty .h3 { color: var(--ink); }

/* timeline */
.timeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.timeline .step { display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--faint); }
.timeline .bar { height: 4px; border-radius: 2px; background: var(--line); }
.timeline .step.done { color: var(--ink); }
.timeline .step.done .bar { background: var(--ink); }
.timeline .step.now .bar { background: var(--yellow); }
.timeline .step.now { color: var(--ink); font-weight: 600; }

@media (max-width: 820px) {
  .container { padding: 0 14px; }
  .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 10px; }
  .h1 { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
