:root {
    color-scheme: light;
    --page: #fff;
    --text: #101010;
    --muted: #626262;
    --surface: #f5f5f4;
    --soft: #ededeb;
    --line: #dededb;
    --button: #101010;
    --button-text: #fff;
    --error: #982323;
    font-family: Inter, Geist, system-ui, sans-serif;
    color: var(--text);
    background: var(--page);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --page: #161616;
    --text: #f6f6f5;
    --muted: #b9b9b6;
    --surface: #222;
    --soft: #2a2a28;
    --line: #41413f;
    --button: #f6f6f5;
    --button-text: #161616;
    --error: #ffadad;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.2rem, 5vw, 4.4rem); line-height: 1.06; letter-spacing: -.045em; overflow-wrap: anywhere; }
h2 { font-size: 1.25rem; letter-spacing: -.02em; }
p { line-height: 1.55; }
small { display: block; margin-top: .25rem; }
.shell { width: min(1200px, calc(100% - 56px)); margin-inline: auto; }
.page { padding-block: 48px 72px; }
.site-header { border-bottom: 1px solid var(--line); }
.header-row, .footer-row { display: flex; align-items: center; gap: 22px; min-height: 70px; }
.header-row { display: grid; grid-template-columns: 1fr auto 1fr; }
.brand { display: inline-flex; align-items: center; gap: .45em; font-size: 1.05rem; font-weight: 750; white-space: nowrap; }
.brand span { font-size: 1.65em; line-height: 1; }
.header-actions { display: flex; justify-self: end; align-items: center; gap: 12px; }
.wallet-link { font-weight: 650; font-size: .88rem; text-align: right; }
.notification-link { position: relative; display: grid; place-items: center; min-width: 36px; min-height: 36px; }
.notification-count { position: absolute; top: 0; right: 0; border-radius: 999px; background: var(--button); color: var(--button-text); padding: 1px 4px; font-size: .64rem; }
.cart-link { justify-self: start; font-size: .93rem; }
.site-footer { border-top: 1px solid var(--line); }
.footer-row { min-height: 84px; color: var(--muted); font-size: .9rem; }
.footer-row .brand { color: var(--text); }
.footer-theme { margin-left: auto; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); font-weight: 700; list-style: none; cursor: pointer; }
.avatar::-webkit-details-marker { display: none; }
.profile-menu { position: relative; }
.dropdown { position: absolute; top: calc(100% + 9px); right: 0; z-index: 5; width: 215px; background: var(--page); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 10px 28px #0002; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 10px; border: 0; border-radius: 6px; color: var(--text); background: none; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface); }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 48px; border: 1px solid var(--button); border-radius: 10px; padding: 10px 18px; background: var(--button); color: var(--button-text); font-weight: 650; text-align: center; }
.button:hover { opacity: .84; }
.button:disabled { opacity: .45; cursor: default; }
.delivery-map {
    position: relative;
    z-index: 0;
    height: 280px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--soft);
}
.delivery-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin: 6px 0 10px; }
[data-address-results]:empty { display: none; }
[data-address-results] { max-height: 180px; overflow: auto; margin: 0 0 10px; }
[data-address-results] button { text-align: left; }
.button-outline { background: var(--page); color: var(--text); border-color: var(--line); }
.button-small { min-height: 40px; padding-inline: 12px; font-size: .88rem; }
.text-button { padding: 0; border: 0; background: none; color: inherit; }
.text-link, .back-link { text-decoration: underline; text-underline-offset: .19em; }
.back-link { display: inline-block; margin-bottom: 25px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.lead { margin-top: 16px; color: var(--muted); max-width: 60ch; }
.welcome { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-block: clamp(72px, 13vh, 150px) 75px; }
.welcome h1 { font-size: clamp(2.55rem, 5.7vw, 5rem); }
.welcome > p { margin-top: 24px; color: var(--muted); font-size: clamp(1.12rem, 2.3vw, 1.55rem); }
.welcome-actions { width: min(100%, 540px); margin-top: clamp(44px, 8vh, 86px); display: grid; gap: 14px; }
.welcome-actions .button { min-height: 64px; font-size: 1.2rem; }
.guest-link { justify-self: center; margin-top: 10px; color: var(--muted); }
.auth-layout { display: grid; place-items: start center; gap: 18px; }
.auth-panel, .narrow { width: min(100%, 540px); }
.auth-panel h1, .narrow h1, .page > h1 { margin-bottom: 28px; }
.auth-panel .notice { margin-bottom: 16px; }
.auth-links, .listing-actions { display: flex; flex-wrap: wrap; gap: 14px 20px; margin-top: 20px; }
.notice { border: 1px solid var(--line); border-radius: 10px; padding: 10px 15px; margin-bottom: 18px; background: var(--surface); }
.notice-error { color: var(--error); }
.stack-form { display: grid; gap: 14px; }
label, legend { font-size: .88rem; font-weight: 650; }
label { display: grid; gap: 6px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 6px; padding: 0; }
input, select, textarea { width: 100%; min-width: 0; min-height: 43px; border: 1px solid var(--line); border-radius: 8px; background: var(--page); color: var(--text); padding: 8px 10px; }
textarea { resize: vertical; }
.inline-form, .form-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.invite-form .inline-form, .section-gap .inline-form { grid-template-columns: minmax(0, 1fr) auto; }
.catalog-intro { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding-bottom: 34px; border-bottom: 1px solid var(--line); }
.catalog-intro p { color: var(--muted); margin-top: 14px; }
.catalog-searches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 24px; }
.catalog-search-box { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.catalog-search-box h2 { font-size: 1rem; }
.invite-form { width: min(100%, 290px); }
.invite-form label { margin-bottom: 6px; }
.catalog-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 34px; margin-top: 28px; align-items: start; }
.filter-panel, .panel { padding: 20px; border: 1px solid var(--line); border-radius: 14px; }
.filter-panel .text-link { font-size: .85rem; text-align: center; }
.panel { display: grid; gap: 14px; }
.panel .button { width: 100%; }
.panel a.text-link, .panel .text-button { justify-self: start; }
.results-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 15px; }
.catalog-heading { display: grid; gap: 8px; }
.catalog-tabs { display: flex; align-items: center; gap: 8px; }
.catalog-tabs a { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; color: var(--muted); font-size: .9rem; }
.catalog-tabs a:hover, .catalog-tabs a.active { border-color: var(--button); color: var(--text); }
.catalog-tabs a.active { background: var(--button); color: var(--button-text); }
.results-toolbar select { width: auto; max-width: 55%; }
.results-toolbar span { font-size: .82rem; }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.product-card { border: 1px solid var(--line); border-radius: 13px; }
.product-card:focus-within, .product-card:hover { border-color: var(--muted); }
.product-link { display: flex; flex-direction: column; height: 100%; border-radius: inherit; }
.product-art { display: grid; place-items: center; aspect-ratio: 1.8; margin: 6px; border-radius: 8px; background: var(--surface); color: var(--muted); }
.product-art span { font-size: clamp(2.5rem, 5vw, 4rem); line-height: 1; }
.product-body { padding: 10px 13px 14px; display: grid; align-content: start; gap: 7px; }
.product-body h3, .data-list { overflow-wrap: anywhere; }
.product-body p { color: var(--muted); font-size: .87rem; }
.product-meta, .product-prices { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 7px; align-items: baseline; }
.product-meta { color: var(--muted); font-size: .76rem; }
.product-prices { justify-content: start; margin-top: 4px; }
.product-prices strong { font-size: 1.2rem; }
.product-prices span { font-size: .86rem; color: var(--muted); text-decoration: line-through; }
.group-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.group-card { border: 1px solid var(--line); border-radius: 13px; background: var(--page); }
.group-card:hover, .group-card:focus-within { border-color: var(--muted); }
.group-card-link { display: grid; gap: 10px; height: 100%; padding: 16px; border-radius: inherit; }
.group-card-link h3 { font-size: 1.05rem; line-height: 1.2; }
.group-card-meta, .group-card-stats, .group-card-price { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.group-card-meta { color: var(--muted); font-size: .75rem; }
.group-card-meta span:last-child { text-align: right; }
.group-card-price strong { font-size: 1.2rem; }
.group-card-price span { color: var(--muted); font-size: .82rem; }
.group-card-link progress { margin: 2px 0 0; }
.group-card-stats { color: var(--muted); font-size: .78rem; }
.group-card-link p { margin-top: 2px; }
.empty { grid-column: 1 / -1; padding: 20px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); gap: clamp(22px, 5vw, 68px); align-items: start; }
.history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.eyebrow { color: var(--muted); margin-bottom: 10px; }
.group-description { margin-top: 24px; max-width: 62ch; }
.group-description h2 { margin-bottom: 8px; }
.group-join-cta { margin-top: 18px; }
.facts { margin-block: 24px; display: grid; gap: 10px; }
.facts > div { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 700; }
.status-pill { display: inline-block; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 3px 9px; font-size: .76rem; }
h1 + .status-pill { margin-top: 14px; }
.data-list { list-style: none; padding: 0; margin-block: 12px 0; }
.data-list li { padding: 12px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.data-list small { font-size: .76rem; }
.notification-list li { align-items: flex-start; flex-wrap: wrap; }
.notification-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.section-gap { margin-top: 32px; }
.section-gap h2 { margin-bottom: 8px; }
.section-gap .inline-form { margin-top: 8px; }
.align-right { text-align: right; }
progress { width: 100%; height: 14px; accent-color: var(--button); margin: 10px 0 6px; }
.tiers-fieldset { display: grid; gap: 10px; }
.tier-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) auto; gap: 6px; margin-bottom: 6px; }
.icon-button { width: 38px; border: 1px solid var(--line); background: var(--surface); color: inherit; border-radius: 8px; }
.chat-panel { margin-top: 32px; padding: 0; gap: 0; overflow: hidden; }
.chat-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; padding: 20px 20px 16px; }
.chat-heading h2 { margin-bottom: 4px; }
.chat-online { flex: none; padding: 4px 9px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .75rem; }
.chat-messages { min-height: 180px; max-height: 420px; overflow-y: auto; display: grid; align-content: start; gap: 10px; padding: 18px 20px; background: var(--surface); }
.chat-message { max-width: min(78%, 560px); padding: 10px 13px; border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; background: var(--page); }
.chat-message-own { justify-self: end; border-radius: 14px 4px 14px 14px; border-color: var(--button); background: var(--button); color: var(--button-text); }
.chat-message-meta { display: flex; align-items: baseline; gap: 9px; font-size: .72rem; }
.chat-message-meta time { opacity: .65; white-space: nowrap; }
.chat-message p { margin-top: 4px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; padding: 12px 20px 20px; }
.chat-form textarea { min-height: 43px; max-height: 120px; resize: vertical; }

@media (max-width: 960px) {
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .group-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .catalog-layout { grid-template-columns: 185px minmax(0, 1fr); gap: 17px; }
}
@media (max-width: 660px) {
    .shell { width: calc(100% - 32px); }
    .page { padding-block: 30px 48px; }
    .header-row { min-height: 62px; gap: 10px; }
    .catalog-intro { flex-direction: column; align-items: stretch; }
    .catalog-searches { grid-template-columns: 1fr; }
    .catalog-layout, .detail-grid, .history-grid { grid-template-columns: 1fr; }
    .catalog-layout { gap: 24px; }
    .filter-panel .stack-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-panel h2 { grid-column: 1 / -1; }
    .filter-panel .text-link { align-self: center; }
    .welcome-actions .button { min-height: 53px; font-size: 1.05rem; }
    .footer-row { gap: 12px; flex-wrap: wrap; padding-block: 18px; }
    .chat-message { max-width: 88%; }
    .chat-form { grid-template-columns: 1fr; }
    .chat-form .button { width: 100%; }
}
@media (max-width: 480px) {
    .header-row { grid-template-columns: auto 1fr; gap: 8px; padding-block: 8px; }
    .header-row > .brand { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
    .header-actions { gap: 6px; }
}
@media (max-width: 385px) {
    .product-grid, .group-card-grid { grid-template-columns: 1fr; }
    .footer-theme { margin-left: 0; }
}
