/* ==========================================================================
   ProduceHub — a produce-market network built like the social apps people
   already live in: a sticky app bar with search, a rail of "stories" per
   produce category, a vertical feed of market posts, an Instagram-style
   produce grid, a profile page per market/trader, a studio for managers,
   and a bottom tab bar on phones.

   Theming: tokens are declared once below and flipped by
   html[data-bs-theme="dark"] (the platform sets it from preferred_theme).
   ========================================================================== */

/* --- Tokens -------------------------------------------------------------- */
:root {
    color-scheme: light;

    --bg: #f6f7f3;
    --bg-grain:
        radial-gradient(120% 80% at 8% -12%, rgba(22, 163, 74, .12), transparent 60%),
        radial-gradient(90% 70% at 100% 0%, rgba(245, 158, 11, .10), transparent 55%);
    --surface: #ffffff;
    --surface-2: #eff2ec;
    --surface-3: #e5eae1;
    --ink: #0c1310;
    --text: #232b26;
    --muted: #6b756e;
    --muted-2: #97a19a;
    --line: #e2e7df;
    --line-strong: #cdd5cb;

    --brand: #16a34a;
    --brand-strong: #15803d;
    --brand-soft: #e9f9ef;
    --brand-ink: #0b5c2c;
    --accent: #f59e0b;
    --accent-soft: #fef4d6;
    --accent-ink: #7c4a03;
    --like: #ef4444;
    --like-soft: #fee2e2;
    --sky: #0284c7;
    --sky-soft: #e0f2fe;
    --ok: #15803d;
    --ok-soft: #dcfce7;
    --warn: #b45309;
    --warn-soft: #fef3c7;
    --danger: #dc2626;
    --danger-soft: #fee2e2;

    --ring-gradient: conic-gradient(from 200deg, #f59e0b, #22c55e, #0ea5e9, #f59e0b);
    --hero-gradient: linear-gradient(135deg, #34d399 0%, #16a34a 48%, #065f46 100%);
    --media-gradient: linear-gradient(160deg, #bbf7d0 0%, #4ade80 44%, #15803d 100%);

    --shadow-xs: 0 1px 2px rgba(12, 19, 16, .05);
    --shadow-sm: 0 2px 10px rgba(12, 19, 16, .06);
    --shadow: 0 18px 48px rgba(12, 19, 16, .14);
    --shadow-lg: 0 40px 90px rgba(12, 19, 16, .28);

    --r-xs: 8px;
    --r-sm: 12px;
    --r: 16px;
    --r-lg: 22px;
    --r-xl: 30px;
    --r-full: 999px;

    --appbar-h: 56px;
    --tabbar-h: 62px;
    --feed-w: 660px;
    --rail-w: 236px;
    --aside-w: 320px;
    --rail-gutter: 0px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
        "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
    --ease: cubic-bezier(.22, .61, .36, 1);
}

html[data-bs-theme="dark"] {
    color-scheme: dark;

    --bg: #070a08;
    --bg-grain:
        radial-gradient(120% 80% at 8% -12%, rgba(34, 197, 94, .18), transparent 60%),
        radial-gradient(90% 70% at 100% 0%, rgba(245, 158, 11, .12), transparent 55%);
    --surface: #101613;
    --surface-2: #17201b;
    --surface-3: #1f2a23;
    --ink: #f2f8f4;
    --text: #dfe9e2;
    --muted: #93a09a;
    --muted-2: #6e7c75;
    --line: #212c26;
    --line-strong: #33413a;

    --brand: #4ade80;
    --brand-strong: #22c55e;
    --brand-soft: #0e2a1b;
    --brand-ink: #bbf7d0;
    --accent: #fbbf24;
    --accent-soft: #2b2312;
    --accent-ink: #fde68a;
    --like: #fb7185;
    --like-soft: #3a1418;
    --sky: #38bdf8;
    --sky-soft: #0b2531;
    --ok: #4ade80;
    --ok-soft: #0e2a1b;
    --warn: #fbbf24;
    --warn-soft: #2b2312;
    --danger: #f87171;
    --danger-soft: #3a1416;

    --hero-gradient: linear-gradient(135deg, #065f46 0%, #0f766e 52%, #064e3b 100%);
    --media-gradient: linear-gradient(160deg, #14532d 0%, #166534 45%, #052e16 100%);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, .45);
    --shadow: 0 18px 48px rgba(0, 0, 0, .55);
    --shadow-lg: 0 40px 90px rgba(0, 0, 0, .7);
}

/* --- Base ---------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body,
body.mk-page,
body.profile-page {
    margin: 0;
    min-height: 100dvh;
    background: var(--bg);
    background-image: var(--bg-grain);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    color: var(--ink);
    font-weight: 800;
    letter-spacing: -.025em;
    line-height: 1.18;
}

p {
    margin: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    color: inherit;
    border: 0;
    background: none;
    cursor: pointer;
}

input,
select,
textarea {
    font: inherit;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

.hidden {
    display: none !important;
}

.sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* Icon sizing must beat the platform's `svg:not([full])` rule (0,1,1). */
svg.ic {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    z-index: 200;
    padding: 10px 16px;
    border-radius: var(--r-full);
    background: var(--ink);
    color: var(--bg);
    font-weight: 700;
}

.skip-link:focus {
    left: 12px;
}

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* --- App bar ------------------------------------------------------------- */
.appbar {
    position: sticky;
    top: 0;
    z-index: 70;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
    border-bottom: 1px solid var(--line);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
    .appbar {
        background: var(--bg);
    }
}

.appbar-in {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1290px;
    margin: 0 auto;
    padding: 8px 14px;
    min-height: var(--appbar-h);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
    min-width: 0;
    color: var(--ink);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: var(--hero-gradient);
    color: #fff;
    box-shadow: 0 6px 16px rgba(22, 163, 74, .34);
}

.brand-mark .ic {
    width: 21px;
    height: 21px;
    stroke-width: 1.9;
}

.brand-text {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -.035em;
    white-space: nowrap;
}

.brand-tag {
    display: none;
    font-size: .74rem;
    color: var(--muted);
    white-space: nowrap;
}

.searchbox {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 520px;
    height: 40px;
    padding: 0 6px 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-full);
    background: var(--surface-2);
    transition: background .18s var(--ease), border-color .18s var(--ease);
}

.searchbox:focus-within {
    background: var(--surface);
    border-color: var(--line-strong);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}

svg.searchbox-ic {
    width: 19px;
    height: 19px;
    color: var(--muted);
}

.searchbox-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    border: 0;
    background: none;
    font-size: .92rem;
    color: var(--ink);
}

.searchbox-input::placeholder {
    color: var(--muted-2);
}

.searchbox-input:focus {
    outline: none;
}

.searchbox-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.searchbox-filter {
    position: relative;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--muted);
    transition: background .16s, color .16s;
}

.searchbox-filter:hover {
    background: var(--surface-3);
    color: var(--ink);
}

.searchbox-filter .ic {
    width: 19px;
    height: 19px;
}

.filter-dot {
    position: absolute;
    top: -1px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--r-full);
    background: var(--brand-strong);
    color: #fff;
    font-size: .62rem;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--bg);
}

.appbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--ink);
    transition: background .16s var(--ease), transform .16s var(--ease);
}

.icon-btn:hover {
    background: var(--surface-2);
}

.icon-btn:active {
    transform: scale(.94);
}

.icon-btn .ic {
    width: 21px;
    height: 21px;
}

.theme-toggle .use-light {
    display: none;
}

html[data-bs-theme="dark"] .theme-toggle .use-dark {
    display: none;
}

html[data-bs-theme="dark"] .theme-toggle .use-light {
    display: block;
}

.avatar-btn {
    display: grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    padding: 0 6px;
    margin-left: 4px;
    border-radius: var(--r-full);
    background: var(--hero-gradient);
    color: #fff;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .02em;
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--line-strong);
    transition: transform .16s var(--ease);
}

.avatar-btn:active {
    transform: scale(.94);
}

/* --- Layout -------------------------------------------------------------- */
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    max-width: 1290px;
    margin: 0 auto;
    padding: 0 0 calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}

.main {
    min-width: 0;
    width: 100%;
    max-width: var(--feed-w);
    margin: 0 auto;
    padding: 0 0 28px;
}

.rail,
.aside {
    display: none;
}

/* --- Stories ------------------------------------------------------------- */
.stories {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 12px 12px 10px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.stories::-webkit-scrollbar {
    display: none;
}

.story {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 72px;
    padding: 0;
    text-align: center;
    animation: fade-up .3s var(--ease) both;
}

.story-ring {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    padding: 3px;
    border-radius: 50%;
    background: var(--ring-gradient);
    transition: transform .18s var(--ease);
}

.story:hover .story-ring {
    transform: scale(1.06);
}

.story.is-active .story-ring {
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand);
}

.story-avatar {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line);
    font-size: 1.55rem;
    line-height: 1;
}

.story-label {
    max-width: 72px;
    overflow: hidden;
    color: var(--text);
    font-size: .69rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.story.is-skeleton .story-ring {
    background: var(--surface-3);
    animation: pulse 1.4s ease-in-out infinite;
}

.story.is-skeleton .story-label {
    width: 44px;
    height: 8px;
    border-radius: var(--r-full);
    background: var(--surface-3);
    color: transparent;
}

/* --- Hero / pinned post -------------------------------------------------- */
.hero-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    margin: 4px 12px 14px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background:
        radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 58%),
        var(--surface);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.hero-copy {
    min-width: 0;
}

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: var(--r-full);
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.kicker .ic {
    width: 14px;
    height: 14px;
}

.hero-copy h1 {
    margin: 11px 0 8px;
    font-size: clamp(1.5rem, 5.4vw, 2.05rem);
    letter-spacing: -.04em;
}

.hero-copy h1 em {
    font-style: normal;
    background: linear-gradient(100deg, var(--brand-strong), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-copy>p {
    color: var(--muted);
    font-size: .92rem;
    line-height: 1.6;
}

.hero-copy>p strong {
    color: var(--ink);
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.hero-trust {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 15px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 600;
}

.hero-trust>span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.hero-trust .ic {
    width: 15px;
    height: 15px;
    color: var(--brand-strong);
    stroke-width: 2.6;
}

.hero-trust strong {
    color: var(--ink);
}

.hero-art {
    display: none;
    position: relative;
    min-height: 190px;
    place-items: center;
}

.hero-plate {
    display: grid;
    place-items: center;
    width: 168px;
    height: 168px;
    border-radius: 50%;
    background: var(--media-gradient);
    box-shadow: inset 0 0 0 8px color-mix(in srgb, #fff 22%, transparent), var(--shadow-sm);
    font-size: 4rem;
    line-height: 1;
}

.hero-float {
    position: absolute;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    font-size: 1.3rem;
    animation: float 5s ease-in-out infinite;
}

.hero-float.a {
    top: 4%;
    left: 6%;
    animation-delay: -.4s;
}

.hero-float.b {
    top: 16%;
    right: 2%;
    animation-delay: -1.3s;
}

.hero-float.c {
    bottom: 10%;
    left: 0;
    animation-delay: -2.1s;
}

.hero-float.d {
    bottom: 2%;
    right: 12%;
    animation-delay: -3s;
}

/* --- Place banner -------------------------------------------------------- */
.place-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 12px 14px;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line));
    border-radius: var(--r);
    background: var(--brand-soft);
    color: var(--brand-ink);
    animation: fade-up .3s var(--ease) both;
}

.place-banner[hidden] {
    display: none;
}

.place-banner-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.place-banner-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: color-mix(in srgb, var(--brand) 20%, transparent);
}

.place-banner-icon .ic {
    width: 18px;
    height: 18px;
}

.place-banner-text {
    font-size: .86rem;
    font-weight: 600;
    line-height: 1.45;
}

.place-banner-stats,
.place-banner-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.place-banner-note {
    display: inline-block;
    color: var(--accent-ink);
    font-weight: 700;
}

.place-banner-actions {
    display: flex;
    gap: 6px;
}

.place-banner .btn-ghost {
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    border-color: color-mix(in srgb, var(--brand) 30%, var(--line));
    color: var(--brand-ink);
}

/* --- Feed bar (segmented control + result strip) ------------------------- */
.feedbar {
    position: sticky;
    top: var(--appbar-h);
    z-index: 40;
    padding: 8px 12px 10px;
    background: linear-gradient(var(--bg) 72%, transparent);
}

.segmented {
    display: flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: var(--r-full);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.seg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1 1 0;
    min-height: 36px;
    padding: 6px 12px;
    border-radius: var(--r-full);
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
    transition: background .16s var(--ease), color .16s;
}

.seg-btn .ic {
    width: 17px;
    height: 17px;
}

.seg-btn.is-active {
    background: var(--ink);
    color: var(--bg);
}

.results-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: .78rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border: 1px solid var(--line);
    border-radius: var(--r-full);
    background: var(--surface);
    color: var(--muted);
    font-size: .76rem;
    font-weight: 600;
}

.pill strong {
    color: var(--ink);
}

.pill-btn {
    color: var(--brand-strong);
    border-color: color-mix(in srgb, var(--brand) 30%, var(--line));
    background: var(--brand-soft);
}

.filters-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-full);
    background: var(--surface);
    color: var(--ink);
    font-size: .76rem;
    font-weight: 700;
}

.filters-toggle .ic {
    width: 16px;
    height: 16px;
}

.filters-count {
    min-width: 17px;
    padding: 0 4px;
    border-radius: var(--r-full);
    background: var(--brand-strong);
    color: #fff;
    font-size: .64rem;
    font-weight: 800;
    line-height: 17px;
    text-align: center;
}

/* --- Filter sheet -------------------------------------------------------- */
.search-card {
    display: none;
}

.search-card.is-open {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: fixed;
    inset: 0;
    z-index: 130;
    padding: 0;
    overflow-y: auto;
    background: rgba(6, 10, 8, .5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 16px 20px;
    border: 1px solid var(--line);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    animation: sheet-up .28s var(--ease);
}

.search-card.is-open .filters {
    position: relative;
    max-height: 88dvh;
    overflow-y: auto;
}

.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    grid-column: 1 / -1;
    padding-bottom: 4px;
}

.sheet-head strong {
    display: block;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 800;
}

.sheet-sub {
    color: var(--muted);
    font-size: .76rem;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    grid-column: 1 / -1;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.field label,
.field>span.label {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.field-wide {
    grid-column: 1 / -1;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--ink);
    font-size: .88rem;
    transition: border-color .16s, background .16s, box-shadow .16s;
}

.field textarea {
    min-height: 84px;
    resize: vertical;
    line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--brand);
    background: var(--surface);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}

.field input::placeholder,
.field textarea::placeholder {
    color: var(--muted-2);
}

.check-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.check-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: .84rem;
    font-weight: 600;
    cursor: pointer;
}

.check-label input {
    width: 18px;
    height: 18px;
    min-height: 0;
    accent-color: var(--brand-strong);
}

.sheet-foot {
    display: flex;
    gap: 8px;
    grid-column: 1 / -1;
    padding-top: 4px;
}

.sheet-foot .btn {
    flex: 1 1 auto;
}

/* --- Feed list ----------------------------------------------------------- */
.feed-list {
    padding: 2px 12px 18px;
    scroll-margin-top: calc(var(--appbar-h) + 96px);
}

.market-feed {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* --- Post card (market) -------------------------------------------------- */
.post {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    animation: fade-up .34s var(--ease) both;
}

.post-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 10px;
}

.avatar-ring {
    flex: 0 0 auto;
    padding: 2px;
    border-radius: 50%;
    background: var(--ring-gradient);
}

.avatar {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--surface-3);
    box-shadow: 0 0 0 2px var(--surface);
    font-size: 1.3rem;
    line-height: 1;
}

.post-by {
    flex: 1 1 auto;
    min-width: 0;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--ink);
    font-size: .9rem;
    font-weight: 800;
    line-height: 1.25;
}

.post-author span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.verified {
    display: inline-grid;
    place-items: center;
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--sky);
    color: #fff;
    font-size: .58rem;
    font-weight: 800;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 1px;
    color: var(--muted);
    font-size: .74rem;
    font-weight: 500;
    min-width: 0;
}

.post-meta>span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-more {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 50%;
    color: var(--muted);
    transition: background .16s, color .16s;
}

.post-more:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.post-more .ic {
    width: 20px;
    height: 20px;
}

/* Media collage — emoji produce tiles over a tonal gradient */
.post-media {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    aspect-ratio: 16 / 10;
    background: var(--media-gradient);
    overflow: hidden;
}

.post-media.tone-0 {
    background: linear-gradient(150deg, #d9f99d, #4ade80 48%, #166534);
}

.post-media.tone-1 {
    background: linear-gradient(150deg, #fde68a, #fbbf24 48%, #b45309);
}

.post-media.tone-2 {
    background: linear-gradient(150deg, #fecdd3, #fb7185 48%, #9f1239);
}

.post-media.tone-3 {
    background: linear-gradient(150deg, #99f6e4, #2dd4bf 48%, #115e59);
}

.post-media.tone-4 {
    background: linear-gradient(150deg, #c7d2fe, #818cf8 48%, #3730a3);
}

.post-media.tone-5 {
    background: linear-gradient(150deg, #fef08a, #eab308 48%, #713f12);
}

html[data-bs-theme="dark"] .post-media.tone-0 {
    background: linear-gradient(150deg, #1a2e05, #166534 52%, #052e16);
}

html[data-bs-theme="dark"] .post-media.tone-1 {
    background: linear-gradient(150deg, #2b1c04, #92400e 52%, #3a1d05);
}

html[data-bs-theme="dark"] .post-media.tone-2 {
    background: linear-gradient(150deg, #2e0d14, #9f1239 52%, #350810);
}

html[data-bs-theme="dark"] .post-media.tone-3 {
    background: linear-gradient(150deg, #04211f, #0f766e 52%, #042f2e);
}

html[data-bs-theme="dark"] .post-media.tone-4 {
    background: linear-gradient(150deg, #131340, #4338ca 52%, #1e1b4b);
}

html[data-bs-theme="dark"] .post-media.tone-5 {
    background: linear-gradient(150deg, #2b2405, #854d0e 52%, #33260a);
}

.media-cell {
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .14);
    font-size: clamp(2rem, 6.5vw, 3.1rem);
    line-height: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .22);
}

.media-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: var(--r-full);
    background: rgba(9, 16, 12, .62);
    color: #fff;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.media-count {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 5px 10px;
    border-radius: var(--r-full);
    background: rgba(9, 16, 12, .62);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

/* Post actions */
.post-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 8px 2px;
}

.act {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 7px 10px;
    border-radius: var(--r-full);
    color: var(--text);
    font-size: .78rem;
    font-weight: 700;
    transition: background .15s, color .15s, transform .15s var(--ease);
}

.act:hover {
    background: var(--surface-2);
}

.act:active {
    transform: scale(.95);
}

.act .ic {
    width: 20px;
    height: 20px;
}

.act-like.is-on {
    color: var(--like);
}

.act-like.is-on .ic {
    fill: currentColor;
    stroke: currentColor;
}

.act-save.is-on {
    color: var(--brand-strong);
}

.act-save.is-on .ic {
    fill: currentColor;
}

.act-spacer {
    flex: 1 1 auto;
}

/* Post body */
.post-body {
    padding: 2px 14px 12px;
}

.post-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: .78rem;
}

.post-stats strong {
    color: var(--ink);
    font-weight: 800;
}

.post-caption {
    color: var(--text);
    font-size: .88rem;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--r-full);
    background: var(--surface-2);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 600;
}

.tag-brand {
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.tag-accent {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.post-cta {
    display: flex;
    gap: 8px;
    margin-top: 11px;
}

.post-cta .btn {
    flex: 1 1 auto;
}

/* --- Produce grid (Instagram-style tiles) -------------------------------- */
.produce-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.tile {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    animation: fade-up .3s var(--ease) both;
}

.tile-media {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 1 / 1;
    background: var(--media-gradient);
    font-size: 3rem;
    line-height: 1;
}

.tile-media.tone-0 {
    background: linear-gradient(150deg, #d9f99d, #4ade80 48%, #166534);
}

.tile-media.tone-1 {
    background: linear-gradient(150deg, #fde68a, #fbbf24 48%, #b45309);
}

.tile-media.tone-2 {
    background: linear-gradient(150deg, #fecdd3, #fb7185 48%, #9f1239);
}

.tile-media.tone-3 {
    background: linear-gradient(150deg, #99f6e4, #2dd4bf 48%, #115e59);
}

.tile-media.tone-4 {
    background: linear-gradient(150deg, #c7d2fe, #818cf8 48%, #3730a3);
}

.tile-media.tone-5 {
    background: linear-gradient(150deg, #fef08a, #eab308 48%, #713f12);
}

.tile-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tile-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 8px;
    border-radius: var(--r-full);
    background: rgba(9, 16, 12, .62);
    color: #fff;
    font-size: .63rem;
    font-weight: 800;
    letter-spacing: .03em;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.tile-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1 1 auto;
    padding: 9px 10px 10px;
}

.tile-cat {
    color: var(--brand-strong);
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.tile-name {
    color: var(--ink);
    font-size: .86rem;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tile-price {
    color: var(--ink);
    font-size: .9rem;
    font-weight: 800;
}

.tile-price small {
    color: var(--muted);
    font-size: .7rem;
    font-weight: 600;
}

.tile-qty {
    color: var(--muted);
    font-size: .7rem;
}

.tile-trader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: auto;
    padding-top: 7px;
}

.trader-chip {
    min-width: 0;
    flex: 1 1 auto;
}

.trader-chip-name {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--ink);
    font-size: .75rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trader-chip-name a {
    color: inherit;
    text-decoration: none;
}

.trader-chip-meta {
    color: var(--muted);
    font-size: .68rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.verified-dot {
    display: inline-grid;
    place-items: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--sky);
    color: #fff;
    font-size: .55rem;
    font-weight: 800;
}

.call-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: var(--r-full);
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-size: .68rem;
    font-weight: 800;
}

.call-btn .ic {
    width: 13px;
    height: 13px;
}

.tile-actions {
    display: flex;
    gap: 6px;
    padding: 2px 10px 10px;
}

.tile-actions .btn {
    flex: 1 1 auto;
}

/* --- Feed end ------------------------------------------------------------ */
.feed-end {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 26px 16px 10px;
    text-align: center;
}

.feed-end-art {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: var(--brand-soft);
    font-size: 1.7rem;
}

.feed-end strong {
    color: var(--ink);
    font-size: 1rem;
}

.feed-end p {
    color: var(--muted);
    font-size: .82rem;
}

.feed-end-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}

/* --- Buttons ------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--r-full);
    font-size: .86rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    transition: background .16s var(--ease), color .16s, border-color .16s,
        transform .16s var(--ease), opacity .16s;
}

.btn:active {
    transform: scale(.975);
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

.btn .ic {
    width: 17px;
    height: 17px;
}

.btn-primary {
    background: var(--brand-strong);
    color: #fff;
    box-shadow: 0 8px 20px rgba(22, 163, 74, .26);
}

.btn-primary:hover {
    background: var(--brand);
}

html[data-bs-theme="dark"] .btn-primary {
    background: var(--brand);
    color: #04210f;
    box-shadow: 0 8px 20px rgba(74, 222, 128, .18);
}

html[data-bs-theme="dark"] .btn-primary:hover {
    background: var(--brand-strong);
    color: #02150a;
}

.btn-ghost,
.btn-plain {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
}

.btn-ghost:hover,
.btn-plain:hover {
    background: var(--surface-2);
    border-color: var(--line-strong);
}

.btn-soft {
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.btn-soft:hover {
    background: color-mix(in srgb, var(--brand) 20%, var(--surface));
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.btn-danger:hover {
    background: color-mix(in srgb, var(--danger) 20%, var(--surface));
}

.btn-link {
    min-height: 0;
    padding: 0;
    color: var(--brand-strong);
    font-weight: 700;
}

.btn-sm {
    min-height: 36px;
    padding: 7px 13px;
    font-size: .78rem;
}

.btn-sm .ic {
    width: 15px;
    height: 15px;
}

.btn-block {
    width: 100%;
}

.link-btn {
    padding: 0;
    color: var(--brand-strong);
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* --- Chips & badges ------------------------------------------------------ */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--r-full);
    background: var(--surface-2);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
}

.chip-ok {
    background: var(--ok-soft);
    color: var(--ok);
}

.chip-trial {
    background: var(--warn-soft);
    color: var(--warn);
}

.chip-bad {
    background: var(--danger-soft);
    color: var(--danger);
}

.chip-muted {
    background: var(--surface-2);
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: var(--r-full);
    background: var(--surface-2);
    color: var(--muted);
    font-size: .68rem;
    font-weight: 700;
    white-space: nowrap;
    text-transform: capitalize;
}

.badge-active {
    background: var(--ok-soft);
    color: var(--ok);
}

.badge-trial {
    background: var(--warn-soft);
    color: var(--warn);
}

.badge-expired {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-pending {
    background: var(--surface-2);
    color: var(--muted);
}

.badge-status {
    background: var(--sky-soft);
    color: var(--sky);
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: var(--r-full);
    font-size: .7rem;
    font-weight: 800;
    text-transform: capitalize;
}

.status-chip.is-active {
    background: var(--ok-soft);
    color: var(--ok);
}

.status-chip.is-pending {
    background: var(--warn-soft);
    color: var(--warn);
}

.status-chip.is-expired {
    background: var(--danger-soft);
    color: var(--danger);
}

/* --- Empty / skeleton ---------------------------------------------------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 34px 20px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-lg);
    background: var(--surface);
    color: var(--muted);
    font-size: .86rem;
    text-align: center;
}

.empty-icon {
    font-size: 2rem;
    line-height: 1;
}

.empty-hint {
    color: var(--muted-2);
    font-size: .8rem;
}

.empty-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}

.skeleton {
    position: relative;
    min-height: 240px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    overflow: hidden;
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--surface-3) 80%, transparent) 50%, transparent 80%);
    transform: translateX(-100%);
    animation: shimmer 1.5s infinite;
}

.skeleton.product-card {
    min-height: 220px;
    border-radius: var(--r);
}

/* --- Studio (admin console) ---------------------------------------------- */
.studio-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 14px 12px;
}

.studio-title {
    min-width: 0;
}

.studio-title h1 {
    margin: 10px 0 6px;
    font-size: clamp(1.45rem, 5vw, 1.9rem);
}

.studio-title h1 em {
    font-style: normal;
    color: var(--brand-strong);
}

.studio-title>p {
    color: var(--muted);
    font-size: .86rem;
}

.studio-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.venue-pick {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 4px 10px 4px 6px;
    border: 1px solid var(--line);
    border-radius: var(--r-full);
    background: var(--surface);
    max-width: 100%;
}

.venue-pick-avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--brand-soft);
    font-size: .95rem;
}

.venue-pick select {
    min-height: 32px;
    max-width: 210px;
    border: 0;
    background: none;
    color: var(--ink);
    font-size: .82rem;
    font-weight: 700;
}

.venue-pick select:focus {
    outline: none;
}

.sub-banner {
    margin: 0 12px 12px;
}

.sub-banner-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line));
    border-radius: var(--r);
    background: var(--brand-soft);
}

.sub-banner-copy {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--brand-ink);
    font-size: .82rem;
}

.manager-kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 0 12px 12px;
}

.kpi-card,
.kpi {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    min-width: 0;
}

.kpi-label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-value {
    color: var(--ink);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -.03em;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 0 12px 18px;
}

.workspace-rail {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.workspace-rail::-webkit-scrollbar {
    display: none;
}

.workspace-rail button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    min-height: 38px;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-full);
    background: var(--surface);
    color: var(--muted);
    font-size: .8rem;
    font-weight: 700;
    white-space: nowrap;
}

.workspace-rail button.is-active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
}

.workspace-rail .ic {
    width: 16px;
    height: 16px;
}

.workspace-main {
    min-width: 0;
}

.tab-content {
    display: none;
}

.tab-content.is-active {
    display: block;
    animation: fade-up .25s var(--ease) both;
}

.console-tab {
    display: block;
}

.box {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.box+.box {
    margin-top: 12px;
}

.box-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.box-head h3 {
    font-size: .98rem;
    font-weight: 800;
}

.box-hint {
    color: var(--muted);
    font-size: .74rem;
}

.box-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tight-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.console-message {
    padding: 12px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-sm);
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.5;
}

/* --- Data tables --------------------------------------------------------- */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--r);
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: .8rem;
}

thead th {
    padding: 9px 11px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--muted);
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

tbody td {
    padding: 9px 11px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover td {
    background: var(--surface-2);
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-end;
}

/* --- Market picker ------------------------------------------------------- */
.focus-pick {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.focus-label {
    color: var(--muted);
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.market-picker {
    position: relative;
    min-width: 0;
}

.market-picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 5px 12px 5px 6px;
    border: 1px solid var(--line);
    border-radius: var(--r-full);
    background: var(--surface);
    text-align: left;
}

.market-picker-trigger:hover {
    border-color: var(--line-strong);
}

.market-picker-value {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.market-picker-avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--brand-soft);
    font-size: 1rem;
}

.market-picker-avatar.is-scope {
    background: var(--surface-2);
}

.market-picker-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.market-picker-text strong {
    color: var(--ink);
    font-size: .84rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-picker-text small {
    color: var(--muted);
    font-size: .7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-picker-chevron {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    margin-right: 4px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg) translateY(-2px);
    transition: transform .18s var(--ease);
}

.market-picker.is-open .market-picker-chevron {
    transform: rotate(-135deg) translateY(-2px);
}

.market-picker-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 90;
    display: flex;
    flex-direction: column;
    min-width: 260px;
    max-height: 320px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow-y: auto;
}

.market-picker-menu[hidden] {
    display: none;
}

.market-picker-search {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 8px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.market-picker-search input {
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-full);
    background: var(--surface-2);
    color: var(--ink);
    font-size: .82rem;
}

.market-picker-search input:focus {
    outline: none;
    border-color: var(--brand);
}

.market-picker-list {
    margin: 0;
    padding: 6px;
    list-style: none;
}

.market-picker-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 9px;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background .14s;
}

.market-picker-option:hover,
.market-picker-option.is-active {
    background: var(--surface-2);
}

.market-picker-option.is-selected {
    background: var(--brand-soft);
}

.market-picker-option.is-scope {
    border-bottom: 1px solid var(--line);
    border-radius: var(--r-sm) var(--r-sm) 0 0;
    margin-bottom: 4px;
}

.option-avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--surface-3);
    font-size: .95rem;
}

.option-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.option-name {
    color: var(--ink);
    font-size: .82rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.option-sub {
    color: var(--muted);
    font-size: .7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.option-check {
    width: 8px;
    height: 14px;
    flex: 0 0 auto;
    margin-right: 4px;
    border-right: 2px solid var(--brand-strong);
    border-bottom: 2px solid var(--brand-strong);
    opacity: 0;
    transform: rotate(45deg);
}

.market-picker-option.is-selected .option-check {
    opacity: 1;
}

.market-picker-empty {
    padding: 14px;
    color: var(--muted);
    font-size: .8rem;
    text-align: center;
}

.console-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
    padding: 0 12px 12px;
}

.console-toolbar .focus-pick {
    flex: 1 1 220px;
}

/* --- Stall (trader dashboard) -------------------------------------------- */
.stall-head {
    position: relative;
    margin: 12px 12px 0;
    padding: 20px;
    border-radius: var(--r-lg);
    background: var(--hero-gradient);
    color: #fff;
    overflow: hidden;
}

.stall-head::after {
    content: "";
    position: absolute;
    right: -40px;
    top: -50px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
}

.stall-head .kicker {
    background: rgba(255, 255, 255, .18);
    color: #fff;
}

.stall-head h1 {
    margin: 11px 0 6px;
    color: #fff;
    font-size: clamp(1.4rem, 5vw, 1.9rem);
}

.stall-head>p {
    max-width: 46ch;
    color: rgba(255, 255, 255, .84);
    font-size: .88rem;
    line-height: 1.55;
}

.stall-id {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-top: 14px;
}

.stall-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: var(--r-full);
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font-size: .74rem;
    font-weight: 700;
}

.stall-head .btn-ghost,
.stall-head .btn-hero-ghost {
    background: rgba(255, 255, 255, .16);
    border-color: rgba(255, 255, 255, .32);
    color: #fff;
}

.stall-head .btn-ghost:hover {
    background: rgba(255, 255, 255, .26);
}

.stall-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
}

.stall-panel {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.stall-panel>h3 {
    margin-bottom: 10px;
    font-size: .96rem;
}

.stall-panel .product-grid {
    margin-top: 4px;
}

.live-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r);
    background: var(--surface-2);
}

.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: var(--r-full);
    background: var(--danger-soft);
    color: var(--danger);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 1.6s ease-in-out infinite;
}

/* --- Forms (modals, stall) ---------------------------------------------- */
.entry-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.entry-form .field-row {
    display: contents;
}

.entry-form .span-3 {
    grid-column: 1 / -1;
}

.entry-form>.field {
    grid-column: 1 / -1;
}

.entry-form .field-row .field {
    grid-column: auto;
}

.modal-alt {
    margin-top: 12px;
    color: var(--muted);
    font-size: .82rem;
    text-align: center;
}

/* --- Modals / sheets ----------------------------------------------------- */
.mk-modal {
    position: fixed;
    inset: 0;
    z-index: 140;
    display: none;
    align-items: flex-end;
    justify-content: center;
    background: rgba(6, 10, 8, .52);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.mk-modal.is-open {
    display: flex;
}

.mk-modal .modal-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 560px;
    max-height: 92dvh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: sheet-up .28s var(--ease);
}

.mk-modal .modal-card-wide {
    max-width: 720px;
}

.mk-modal .modal-head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 0 0 auto;
    padding: 16px 14px 12px;
    border-bottom: 1px solid var(--line);
}

.mk-modal .modal-grabber {
    position: absolute;
    top: 6px;
    left: 50%;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: var(--r-full);
    background: var(--line-strong);
}

.mk-modal .modal-head h3 {
    font-size: 1rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-body {
    padding: 14px;
    overflow-y: auto;
}

.lead-target {
    display: block;
    margin: 12px 14px;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-size: .76rem;
    font-weight: 600;
    line-height: 1.45;
}

.mk-modal form.entry-form {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 14px 16px;
    overflow-y: auto;
}

.mk-modal .modal-body form.entry-form {
    padding: 0;
}

/* --- Toast --------------------------------------------------------------- */
.toast-stack {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px);
    z-index: 160;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(420px, calc(100vw - 24px));
    transform: translateX(-50%);
    pointer-events: none;
}

.toast {
    display: none;
    padding: 11px 15px;
    border: 1px solid var(--line);
    border-radius: var(--r-full);
    background: var(--ink);
    color: var(--bg);
    box-shadow: var(--shadow);
    font-size: .82rem;
    font-weight: 600;
    text-align: center;
}

.toast.show {
    display: block;
    animation: toast-in .26s var(--ease) both;
}

.toast.ok {
    background: var(--ink);
    color: var(--bg);
}

.toast.err {
    background: var(--danger);
    color: #fff;
    border-color: transparent;
}

/* --- Aside --------------------------------------------------------------- */
.aside-card {
    margin-bottom: 14px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.aside-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.aside-card-head h2 {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .96rem;
    font-weight: 800;
}

.aside-card-head .ic {
    width: 17px;
    height: 17px;
    color: var(--brand-strong);
}

.trend-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.trend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px;
    border-radius: var(--r-sm);
    text-align: left;
    transition: background .15s;
}

.trend-item:hover {
    background: var(--surface-2);
}

.trend-rank {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-size: .68rem;
    font-weight: 800;
}

.trend-main {
    min-width: 0;
    flex: 1 1 auto;
}

.trend-title {
    display: block;
    color: var(--ink);
    font-size: .84rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trend-sub {
    display: block;
    color: var(--muted);
    font-size: .72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trend-emoji {
    font-size: 1.1rem;
}

.aside-cta {
    position: relative;
    border: 0;
    background: var(--hero-gradient);
    color: #fff;
    overflow: hidden;
}

.aside-cta-art {
    margin-bottom: 8px;
    font-size: 2.2rem;
    line-height: 1;
}

.aside-cta h3 {
    margin-bottom: 4px;
    color: #fff;
    font-size: 1rem;
}

.aside-cta p {
    margin-bottom: 12px;
    color: rgba(255, 255, 255, .84);
    font-size: .8rem;
    line-height: 1.5;
}

.aside-cta .btn-primary {
    background: #fff;
    color: #0b5c2c;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
}

.aside-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    padding: 2px 6px 0;
    color: var(--muted-2);
    font-size: .72rem;
}

.aside-foot a {
    color: var(--muted);
}

.dot-sep {
    opacity: .6;
}

/* --- Rail ---------------------------------------------------------------- */
.rail-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--r-full);
    color: var(--text);
    font-size: .98rem;
    font-weight: 500;
    text-align: left;
    transition: background .16s var(--ease);
}

.rail-item .ic {
    width: 25px;
    height: 25px;
    stroke-width: 1.7;
}

.rail-item:hover {
    background: var(--surface-2);
}

.rail-item.is-active {
    color: var(--ink);
    font-weight: 800;
}

.rail-item.is-active .ic {
    stroke-width: 2.2;
}

.rail-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 10px;
    padding: 12px 16px;
    border-radius: var(--r-full);
    background: var(--ink);
    color: var(--bg);
    font-weight: 800;
    transition: transform .16s var(--ease), opacity .16s;
}

.rail-cta:hover {
    opacity: .88;
}

.rail-cta:active {
    transform: scale(.98);
}

.rail-cta .ic {
    width: 19px;
    height: 19px;
}

.rail-foot {
    margin-top: auto;
    padding: 16px 14px 0;
}

.rail-signature {
    color: var(--muted-2);
    font-size: .76rem;
    line-height: 1.5;
}

/* --- Bottom tab bar ------------------------------------------------------ */
.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
    .tabbar {
        background: var(--surface);
    }
}

.tabbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1 1 0;
    color: var(--muted);
    font-size: .62rem;
    font-weight: 600;
    transition: color .15s;
}

.tabbar-item .ic {
    width: 23px;
    height: 23px;
}

.tabbar-item.is-active {
    color: var(--ink);
}

.tabbar-item.is-active .ic {
    stroke-width: 2.3;
}

/* --- Profile pages (market / trader) ------------------------------------ */
.pbar {
    position: sticky;
    top: 0;
    z-index: 70;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 84%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
}

.pbar-in {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    max-width: 960px;
    margin: 0 auto;
    padding: 8px 14px;
    min-height: var(--appbar-h);
}

.pbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pp-shell {
    max-width: 960px;
    margin: 0 auto;
    padding: 12px 12px 40px;
}

.pp-cover {
    position: relative;
    height: 120px;
    border-radius: var(--r-lg);
    background: var(--hero-gradient);
    overflow: hidden;
}

.pp-cover::after {
    content: "";
    position: absolute;
    right: -50px;
    top: -70px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
}

.pp-cover-emoji {
    position: absolute;
    right: 18px;
    bottom: 12px;
    font-size: 2.6rem;
    line-height: 1;
    opacity: .9;
}

.pp-head {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin: -34px 0 0;
    padding: 0 16px;
}

.pp-avatar {
    display: grid;
    place-items: center;
    width: 88px;
    height: 88px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--line-strong), var(--shadow-sm);
    font-size: 2.4rem;
    line-height: 1;
}

.pp-id {
    flex: 1 1 200px;
    min-width: 0;
    padding-bottom: 4px;
}

.pp-name {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    color: var(--ink);
    font-size: clamp(1.3rem, 4.4vw, 1.7rem);
    font-weight: 800;
    letter-spacing: -.03em;
}

.pp-handle {
    margin-top: 2px;
    color: var(--muted);
    font-size: .82rem;
}

.pp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    width: 100%;
    margin-top: 12px;
}

.pp-actions .btn {
    flex: 1 1 auto;
}

.pp-bio {
    margin: 14px 16px 0;
    color: var(--text);
    font-size: .9rem;
    line-height: 1.6;
}

.pp-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 16px 0;
}

.pp-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 14px 16px 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
}

.pp-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    text-align: center;
    min-width: 0;
}

.pp-stat-value {
    color: var(--ink);
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.pp-stat-value.is-text {
    font-size: .78rem;
    font-weight: 700;
}

.pp-stat-label {
    color: var(--muted);
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.pp-tabs {
    position: sticky;
    top: var(--appbar-h);
    z-index: 30;
    display: flex;
    gap: 2px;
    margin: 16px 0 0;
    padding: 6px 8px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.pp-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1 1 0;
    min-height: 40px;
    padding: 6px 10px;
    border-radius: var(--r-sm);
    color: var(--muted);
    font-size: .8rem;
    font-weight: 700;
}

.pp-tab .ic {
    width: 17px;
    height: 17px;
}

.pp-tab.is-active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-xs);
}

.pp-panel {
    display: none;
    padding: 14px 4px 0;
}

.pp-panel.is-active {
    display: block;
    animation: fade-up .25s var(--ease) both;
}

.pp-section {
    margin-bottom: 16px;
}

.pp-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 4px 10px;
}

.pp-section-head h2 {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 1rem;
}

.pp-section-head .ic {
    width: 18px;
    height: 18px;
    color: var(--brand-strong);
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.ann-post {
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
}

.ann-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-bottom: 6px;
}

.ann-head strong {
    color: var(--ink);
    font-size: .9rem;
}

.ann-post p {
    color: var(--text);
    font-size: .86rem;
    line-height: 1.6;
}

.ann-date {
    margin-top: 8px;
    color: var(--muted-2);
    font-size: .7rem;
}

.trader-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}

.trader-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    transition: border-color .16s, transform .16s var(--ease);
}

.trader-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-1px);
}

.trader-avatar {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--brand-soft);
    font-size: 1.25rem;
}

.trader-info {
    min-width: 0;
    flex: 1 1 auto;
}

.trader-name {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--ink);
    font-size: .86rem;
    font-weight: 700;
}

.trader-meta {
    color: var(--muted);
    font-size: .74rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trader-go {
    flex: 0 0 auto;
    color: var(--brand-strong);
    font-size: .74rem;
    font-weight: 800;
}

.side-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    margin-bottom: 10px;
}

.side-card-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: var(--ink);
    font-size: .88rem;
    font-weight: 800;
}

.side-card p {
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.55;
}

.side-card p+p {
    margin-top: 6px;
}

.side-card p a {
    color: var(--brand-strong);
    font-weight: 700;
}

.sub-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.profile-msg {
    display: none;
    margin-bottom: 10px;
    padding: 10px 14px;
    border-radius: var(--r);
    font-size: .82rem;
    font-weight: 600;
}

.profile-msg.show {
    display: block;
    animation: fade-up .24s var(--ease) both;
}

.profile-msg.ok {
    background: var(--ok-soft);
    color: var(--ok);
}

.profile-msg.err {
    background: var(--danger-soft);
    color: var(--danger);
}

.pp-foot {
    margin: 18px 4px 0;
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.6;
}

.pp-foot a {
    color: var(--brand-strong);
    font-weight: 700;
}

.profile-empty {
    display: grid;
    place-items: center;
    min-height: 70dvh;
    padding: 20px;
}

.profile-empty-card {
    max-width: 420px;
    padding: 28px 24px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.profile-empty-icon {
    display: block;
    margin-bottom: 10px;
    font-size: 2.6rem;
}

.profile-empty-card h1 {
    margin-bottom: 8px;
    font-size: 1.35rem;
}

.profile-empty-card p {
    margin-bottom: 16px;
    color: var(--muted);
    font-size: .88rem;
}

/* --- Adspace ------------------------------------------------------------- */
.adspace-slot {
    margin: 0 12px 14px;
    border-radius: var(--r);
    overflow: hidden;
}

.adspace-slot:empty {
    display: none;
}

/* --- Animations ---------------------------------------------------------- */
@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(9px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes sheet-up {
    from {
        transform: translateY(24px);
        opacity: .6;
    }

    to {
        transform: none;
        opacity: 1;
    }
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.97);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes shimmer {
    to {
        transform: translateX(100%);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .5;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-9px);
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* --- Responsive ---------------------------------------------------------- */
@media (min-width: 560px) {
    .produce-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .tile-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .manager-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .brand-tag {
        display: inline;
    }
}

@media (min-width: 720px) {
    .hero-card {
        grid-template-columns: minmax(0, 1.2fr) minmax(200px, .8fr);
        align-items: center;
        padding: 24px;
    }

    .hero-art {
        display: grid;
    }

    .mk-modal {
        align-items: center;
        padding: 24px;
    }

    .mk-modal .modal-card {
        border-radius: var(--r-xl);
        max-height: 88dvh;
    }

    .mk-modal .modal-grabber {
        display: none;
    }

    .search-card.is-open {
        align-items: center;
        padding: 24px;
    }

    .search-card.is-open .filters {
        max-height: 82dvh;
        border-radius: var(--r-xl);
    }

    .stall-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stall-grid .stall-panel.wide {
        grid-column: 1 / -1;
    }

    .toast-stack {
        bottom: 24px;
    }

    .pp-actions {
        width: auto;
        margin-top: 0;
    }

    .pp-head {
        align-items: flex-end;
    }

    .pp-cover {
        height: 160px;
    }

    .pp-avatar {
        width: 104px;
        height: 104px;
        font-size: 2.8rem;
    }

    .trader-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    :root {
        --appbar-h: 60px;
        /* The platform's floating app menu hugs the left edge at mid-height;
           the rail starts after it so navigation is never underneath. */
        --rail-gutter: 64px;
    }

    .layout {
        grid-template-columns: calc(var(--rail-w) + var(--rail-gutter)) minmax(0, var(--feed-w));
        gap: 24px;
        align-items: start;
        justify-content: center;
        max-width: 1354px;
        padding: 10px 18px 48px;
    }

    .rail {
        position: sticky;
        top: calc(var(--appbar-h) + 10px);
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-height: calc(100dvh - var(--appbar-h) - 30px);
        padding: 8px 8px 8px var(--rail-gutter);
    }

    .appbar-in {
        padding: 10px 18px;
    }

    .main {
        padding-bottom: 40px;
    }

    .tabbar {
        display: none;
    }

    .layout {
        padding-bottom: 48px;
    }

    .feedbar {
        top: var(--appbar-h);
    }

    .search-card.is-open .filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .search-card.is-open .filters-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .manager-kpis {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .workspace {
        grid-template-columns: 168px minmax(0, 1fr);
        align-items: start;
    }

    .workspace-rail {
        position: sticky;
        top: calc(var(--appbar-h) + 12px);
        flex-direction: column;
        gap: 3px;
        overflow: visible;
        padding: 0;
    }

    .workspace-rail button {
        width: 100%;
        justify-content: flex-start;
        border-color: transparent;
        background: none;
        border-radius: var(--r-full);
    }

    .workspace-rail button:hover {
        background: var(--surface-2);
    }

    .workspace-rail button.is-active {
        background: var(--surface);
        border-color: var(--line);
        color: var(--ink);
        box-shadow: var(--shadow-xs);
    }
}

@media (min-width: 1180px) {
    .layout {
        grid-template-columns: calc(var(--rail-w) + var(--rail-gutter)) minmax(0, var(--feed-w)) var(--aside-w);
        max-width: 1440px;
    }

    .aside {
        position: sticky;
        top: calc(var(--appbar-h) + 14px);
        display: block;
        padding: 4px 0;
    }
}

@media (max-width: 520px) {

    /* Instagram-style: the wordmark gives way so search keeps its width. */
    .brand-text {
        display: none;
    }

    .brand-mark {
        width: 34px;
        height: 34px;
    }
}

@media (max-width: 899px) {
    .hide-sm {
        display: none;
    }
}

@media (max-width: 420px) {
    .hero-card {
        padding: 16px;
    }

    .produce-grid {
        gap: 8px;
    }

    .brand-text {
        font-size: 1.08rem;
    }

    .tabbar-item {
        font-size: .58rem;
    }
}