/* SupaChat Marketplace — shared design tokens + primitives (shopper site + merchant portal) */
:root {
    --bg: #f6f5f9;
    --surface: #ffffff;
    --surface-2: #faf9fc;
    --ink: #17121f;
    --ink-2: #4a4458;
    --ink-3: #8a8497;
    --line: #ebe7f1;
    --line-2: #ddd7e6;

    --brand: #764ba2;
    --brand-600: #613b88;
    --brand-50: #f4eefa;
    --brand-100: #e8dcf5;
    --magenta: #db5ba5;
    --magenta-600: #b8378a;
    --magenta-50: #fdf0f7;
    --grad: linear-gradient(135deg, #db5ba5 0%, #9a4fb0 55%, #764ba2 100%);

    --green: #0f8a5f;
    --green-50: #e9f7f0;
    --amber: #b26b00;
    --amber-50: #fff5e0;
    --red: #c4323f;
    --red-50: #fdecee;

    --r-sm: 8px;
    --r: 14px;
    --r-lg: 20px;
    --shadow-1: 0 1px 2px rgba(23, 18, 31, .06), 0 1px 1px rgba(23, 18, 31, .04);
    --shadow-2: 0 6px 20px rgba(23, 18, 31, .08), 0 2px 6px rgba(23, 18, 31, .05);
    --shadow-3: 0 18px 50px rgba(23, 18, 31, .18);
    --focus: 0 0 0 3px rgba(118, 75, 162, .28);

    --font: 'Epilogue', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --header-h: 132px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
    font-weight: 600; font-size: 15px; white-space: nowrap;
    transition: background .15s, box-shadow .15s, transform .1s, color .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); }
.btn-hot { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(184, 55, 138, .28); }
.btn-hot:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-3); }
.btn-soft { background: var(--brand-50); color: var(--brand-600); }
.btn-soft:hover { background: var(--brand-100); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn-lg { height: 52px; padding: 0 26px; font-size: 16px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn {
    width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center;
    background: transparent; color: var(--ink); position: relative;
}
.icon-btn:hover { background: var(--brand-50); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- pills / chips / badges ---------- */
.pill-group {
    display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--line);
}
.pill-group button {
    border: 0; background: transparent; border-radius: 999px; padding: 7px 14px;
    font-size: 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.pill-group button.active { background: var(--ink); color: #fff; font-weight: 600; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
    border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
    font-size: 14px; font-weight: 500; white-space: nowrap; color: var(--ink);
}
button.chip:hover, a.chip:hover { border-color: var(--ink-3); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .x { opacity: .6; font-size: 16px; line-height: 1; }
.badge {
    display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
    border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .01em; white-space: nowrap;
}
.badge-off { background: var(--magenta); color: #fff; }
.badge-excl { background: var(--brand); color: #fff; }
.badge-spon { background: rgba(23, 18, 31, .72); color: #fff; font-weight: 600; }
.badge-soft { background: var(--brand-50); color: var(--brand-600); }
.badge-green { background: var(--green-50); color: var(--green); }
.badge-amber { background: var(--amber-50); color: var(--amber); }
.badge-red { background: var(--red-50); color: var(--red); }
.retailer {
    display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2);
    max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.retailer .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--ink-3)); flex: 0 0 auto; }

/* ---------- inputs ---------- */
.input, .select {
    height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-2);
    background: var(--surface); width: 100%; font-size: 15px;
}
.input:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.select {
    appearance: none; padding-right: 36px;
    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='%234a4458' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
}
.switch { position: relative; display: inline-block; vertical-align: middle; width: 42px; height: 24px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span {
    position: absolute; inset: 0; border-radius: 999px; background: var(--line-2); transition: background .2s; cursor: pointer;
}
.switch span::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; box-shadow: var(--shadow-1); transition: transform .2s;
}
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: var(--focus); }

/* ---------- misc ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.muted { color: var(--ink-3); }
.skeleton {
    background: linear-gradient(90deg, #efedf3 0%, #f7f6fa 40%, #efedf3 80%);
    background-size: 200% 100%; animation: sk 1.2s infinite linear; border-radius: 12px;
}
@keyframes sk { to { background-position: -200% 0; } }
.toast-stack { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; }
.toast {
    background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
    box-shadow: var(--shadow-3); display: flex; align-items: center; gap: 10px; animation: toast-in .25s ease;
}
.toast a { color: #f3c6e2; font-weight: 700; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
