/* =========================================================================
   ProduceHub — Farm Produce Markets
   Theme: fresh "produce green" (light) + deep forest (dark)
   ========================================================================= */

/* ---------- Tokens ---------- */
:root {
    --primary: #2e7d32;
    --primary-2: #43a047;
    --primary-soft: rgba(46, 125, 50, 0.12);
    --amber: #f9a825;
    --amber-soft: rgba(249, 168, 37, 0.16);
    --teal: #00897b;

    --bg: #f6f8f4;
    --bg-soft: #eef2eb;
    --surface: #ffffff;
    --surface-2: #fbfcfa;
    --line: #e2e8de;
    --line-strong: #cbd6c6;

    --text: #16241a;
    --muted: #5c6f60;
    --danger: #d32f2f;
    --danger-soft: rgba(211, 47, 47, 0.12);

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --radius-xl: 28px;

    --shadow-sm: 0 1px 2px rgba(20, 40, 24, 0.06);
    --shadow: 0 8px 24px rgba(20, 40, 24, 0.08);
    --shadow-lg: 0 18px 48px rgba(20, 40, 24, 0.14);

    --font-display: "Oswald", "Noto Sans TC", system-ui, sans-serif;
}

html[data-bs-theme="dark"] {
    --bg: #0e1510;
    --bg-soft: #16211a;
    --surface: #17241b;
    --surface-2: #1c2b21;
    --line: #243529;
    --line-strong: #33503c;
    --text: #e8f3ea;
    --muted: #93a89a;
    --primary: #66bb6a;
    --primary-2: #81c784;
    --primary-soft: rgba(102, 187, 106, 0.16);
    --danger: #ef5350;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.5);
}

/* ---------- Base ---------- */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.app {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 18px 80px;
    min-width: 0;
    overflow-x: clip;
    background: var(--bg);
}

.market-page {
    min-height: 100vh;
    background: var(--bg);
}

.shell {
    min-width: 0;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input,
select,
textarea {
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text);
}

::placeholder {
    color: var(--muted);
    opacity: 0.7;
}

h1,
h2,
h3,
.display {
    font-family: var(--font-display);
    letter-spacing: 0.2px;
    margin: 0;
}

a {
    color: var(--primary);
}

/* ---------- Topbar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    margin-bottom: 22px;
}

.topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    min-width: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    font-size: 22px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--teal));
    color: #fff;
    box-shadow: var(--shadow-sm);
    flex: 0 0 auto;
}

.brand-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
}

.brand-tag {
    font-size: 0.72rem;
    color: var(--muted);
    display: block;
    margin-top: 2px;
}

.viewswitch {
    display: flex;
    gap: 6px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    padding: 5px;
    border-radius: 999px;
    overflow-x: auto;
    scrollbar-width: none;
    min-width: 0;
    flex: 0 1 auto;
    max-width: 100%;
}

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

.viewswitch button {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    flex: 0 0 auto;
    transition: background-color 0.2s, color 0.2s;
}

.viewswitch button.is-active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ---------- Panels ---------- */
.panel {
    min-width: 0;
    animation: fadeUp 0.35s ease both;
}

.panel.hidden {
    display: none;
}

.panel>* {
    min-width: 0;
}

.card-grid>*,
.product-grid>* {
    min-width: 0;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 11px 20px;
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.2s ease, background-color 0.2s, border-color 0.2s, color 0.2s;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    box-shadow: 0 6px 18px var(--primary-soft);
}

.btn-primary:hover {
    filter: brightness(1.05);
    box-shadow: 0 8px 22px var(--primary-soft);
}

.btn-hero {
    background: linear-gradient(135deg, var(--primary), var(--teal));
    color: #fff;
    border-radius: 14px;
    padding: 13px 24px;
    font-size: 1rem;
    box-shadow: 0 10px 26px rgba(46, 125, 50, 0.35);
}

.btn-hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(46, 125, 50, 0.4);
}

.btn-hero-ghost {
    background: color-mix(in srgb, var(--surface) 70%, transparent);
    color: var(--text);
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    padding: 13px 24px;
    font-size: 1rem;
}

.btn-hero-ghost:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-ghost {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--line-strong);
}

.btn-ghost:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid transparent;
}

.btn-danger:hover {
    border-color: var(--danger);
}

.btn-sm {
    padding: 7px 12px;
    font-size: 0.82rem;
    border-radius: 10px;
}

.link-btn {
    background: none;
    border: 0;
    color: var(--primary);
    font-weight: 700;
    padding: 0;
    text-decoration: underline;
}

/* ---------- Hero ---------- */
.hero {
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: 22px;
    position: relative;
}

.hero-discover {
    background:
        radial-gradient(1200px 480px at 85% -10%, rgba(249, 168, 37, 0.25), transparent 60%),
        linear-gradient(135deg, #1b5e20, #2e7d32 45%, #00897b);
    color: #fff;
}

.hero-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 44px 40px;
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    gap: 28px;
    align-items: center;
    position: relative;
    z-index: 1;
    min-width: 0;
}

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

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 18px;
}

.kicker-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: 0 0 0 4px rgba(249, 168, 37, 0.25);
}

.hero h1 {
    font-size: clamp(1.9rem, 4.4vw, 3rem);
    line-height: 1.12;
    max-width: 640px;
    overflow: hidden;
}

.hero h1 em {
    font-style: normal;
    color: var(--amber);
}

.hero p {
    font-size: 1rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    margin: 16px 0 0;
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.hero-trust {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 20px;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.85);
}

.trust-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.trust-check {
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: inline-grid;
    place-items: center;
    font-size: 10px;
    font-weight: 900;
    color: #fff;
}

.marquee-track {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    max-width: 100%;
}

.marquee-item {
    display: inline-block;
    padding-right: 0.5em;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.hero-art {
    position: relative;
    height: 220px;
}

.art-sun {
    position: absolute;
    top: -10px;
    right: 24px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffe082, var(--amber));
    box-shadow: 0 0 60px rgba(249, 168, 37, 0.5);
    animation: sunPulse 6s ease-in-out infinite;
}

.art-crate {
    position: absolute;
    left: 50%;
    bottom: 46px;
    transform: translateX(-50%);
    width: 240px;
    height: 130px;
    background: linear-gradient(180deg, #a8743b, #8a5a28);
    border-radius: 16px 16px 8px 8px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: center;
    padding: 12px;
}

.art-crate::before {
    content: "";
    position: absolute;
    top: 34px;
    left: 10px;
    right: 10px;
    border-top: 2px dashed rgba(255, 255, 255, 0.35);
}

.art-veg {
    font-size: 30px;
    text-align: center;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
    animation: vegFloat 4s ease-in-out infinite;
}

.art-veg:nth-child(2) {
    animation-delay: 0.6s;
}

.art-veg:nth-child(3) {
    animation-delay: 1.2s;
}

.art-veg:nth-child(4) {
    animation-delay: 1.8s;
}

.art-ground {
    position: absolute;
    bottom: 0;
    left: -20px;
    right: -20px;
    height: 34px;
    background: linear-gradient(180deg, #2e7d32, #1b5e20);
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
    opacity: 0.7;
}

/* ---------- Console hero ---------- */
.console-hero {
    border-radius: var(--radius-xl);
    margin-bottom: 20px;
    background:
        radial-gradient(900px 320px at 90% -20%, rgba(0, 137, 123, 0.35), transparent 60%),
        linear-gradient(135deg, #17321c, #1b4d26 55%, #145c52);
    color: #fff;
    padding: 30px 34px;
}

.console-hero h1 {
    font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.console-hero p {
    color: rgba(255, 255, 255, 0.85);
    max-width: 620px;
    line-height: 1.6;
    margin-top: 10px;
}

.kpi-overall {
    display: flex;
    gap: 10px;
    margin-top: 22px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
}

.kpi-overall::-webkit-scrollbar {
    display: none;
}

.kpi-overall .kpi {
    flex: 0 0 auto;
    min-width: 118px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    scroll-snap-align: start;
    backdrop-filter: blur(6px);
}

.kpi-overall .kpi .kpi-label {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.75);
}

.kpi-overall .kpi .kpi-value {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
}

/* ---------- Search ---------- */
.search-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-head {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-icon {
    font-size: 1.1rem;
}

.search-head input[type="search"] {
    flex: 1;
    border: 1px solid var(--line-strong);
    background: var(--bg-soft);
    border-radius: 12px;
    padding: 12px 14px;
    outline: none;
}

.search-head input[type="search"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.filters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.filter {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
}

.filter select {
    border: 1px solid var(--line-strong);
    background: var(--bg-soft);
    border-radius: 12px;
    padding: 11px 12px;
    outline: none;
    width: 100%;
}

.filter select:focus {
    border-color: var(--primary);
}

.search-results {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px dashed var(--line-strong);
    padding-top: 12px;
    color: var(--muted);
    font-size: 0.86rem;
}

/* ---------- Listing sections ---------- */
.listing-section {
    margin-bottom: 34px;
    min-width: 0;
}

.section-head {
    margin-bottom: 16px;
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    min-width: 0;
}

.section-head h2 {
    font-size: 1.45rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-head h2 span {
    font-family: var(--font-display);
}

.section-sub {
    color: var(--muted);
    font-size: 0.85rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* ---------- Cards ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.market-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s;
    min-width: 0;
}

.market-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.market-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.market-avatar {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--teal));
    display: grid;
    place-items: center;
    font-size: 24px;
    color: #fff;
    flex: 0 0 auto;
}

.market-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.25;
}

.market-loc {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 3px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 9px;
    border-radius: 999px;
    white-space: nowrap;
}

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

.badge-trial {
    background: var(--amber-soft);
    color: #c77700;
}

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

.badge-pending {
    background: var(--primary-soft);
    color: var(--muted);
}

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

html[data-bs-theme="dark"] .badge-trial {
    color: var(--amber);
}

.market-desc {
    font-size: 0.86rem;
    color: var(--muted);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.market-stats {
    display: flex;
    gap: 14px;
    font-size: 0.8rem;
    color: var(--muted);
}

.market-stats span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.market-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin-top: auto;
}

.market-sub {
    font-size: 0.74rem;
    color: var(--muted);
}

.market-go {
    font-weight: 800;
    color: var(--primary);
    font-size: 0.85rem;
}

/* ---------- Product cards ---------- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.product-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.2s ease;
    min-width: 0;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.product-media {
    height: 132px;
    display: grid;
    place-items: center;
    font-size: 60px;
    background:
        radial-gradient(300px 120px at 80% -20%, var(--primary-soft), transparent 70%),
        linear-gradient(135deg, var(--bg-soft), var(--surface-2));
    border-bottom: 1px solid var(--line);
    position: relative;
}

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

.product-featured {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--amber);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 999px;
    text-transform: uppercase;
}

.product-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.product-name {
    font-weight: 800;
    font-size: 1rem;
    line-height: 1.3;
}

.product-cat {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    font-weight: 700;
}

.product-price {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
}

.product-price small {
    font-size: 0.72rem;
    color: var(--muted);
    font-family: "Montserrat", sans-serif;
    font-weight: 600;
}

.product-qty {
    font-size: 0.8rem;
    color: var(--muted);
}

.product-desc {
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-trader {
    margin-top: auto;
    border-top: 1px solid var(--line);
    padding-top: 11px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.trader-chip-name {
    font-size: 0.84rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 5px;
}

.trader-chip-meta {
    font-size: 0.72rem;
    color: var(--muted);
}

.call-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 7px 11px;
    font-size: 0.8rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.call-btn:hover {
    border-color: var(--primary);
}

.verified-dot {
    color: var(--teal);
    font-size: 0.72rem;
}

/* ---------- Console ---------- */
.console-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.focus-pick {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 220px;
}

.focus-label {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.focus-pick select {
    flex: 1;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    border-radius: 12px;
    padding: 11px 12px;
    outline: none;
    min-width: 0;
}

.focus-pick select:focus {
    border-color: var(--primary);
}

.console-rail {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    margin-bottom: 18px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 5px;
}

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

.console-rail button {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.console-rail button.is-active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.console-tab {
    animation: fadeUp 0.3s ease both;
    min-width: 0;
}

.console-tab.hidden {
    display: none;
}

.box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 18px;
    min-width: 0;
}

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

.box-head h3 {
    font-size: 1.15rem;
}

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

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

.console-message {
    color: var(--muted);
    font-size: 0.88rem;
    padding: 14px 0;
}

/* ---------- Tables ---------- */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    min-width: 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 640px;
}

.data-table th {
    text-align: left;
    padding: 11px 14px;
    background: var(--bg-soft);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: var(--surface-2);
}

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

/* ---------- Entry forms ---------- */
.entry-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.entry-form .field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.entry-form label {
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
}

.entry-form input,
.entry-form select,
.entry-form textarea {
    border: 1px solid var(--line-strong);
    background: var(--bg-soft);
    border-radius: 11px;
    padding: 11px 13px;
    outline: none;
    width: 100%;
}

.entry-form input:focus,
.entry-form select:focus,
.entry-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.entry-form textarea {
    resize: vertical;
}

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

.field-row .field {
    min-width: 0;
}

/* ---------- Checkbox ---------- */
.check-label {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 0.86rem !important;
    font-weight: 700 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    color: var(--text) !important;
    cursor: pointer;
}

.check-label input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    border: 1.5px solid var(--line-strong);
    border-radius: 6px;
    background-color: var(--bg-soft);
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
    padding: 0;
}

.check-label input[type="checkbox"]:hover {
    border-color: var(--primary);
}

.check-label input[type="checkbox"]:checked {
    background-color: var(--primary);
    border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-size: 12px;
    background-position: center;
    background-repeat: no-repeat;
}

.check-label input[type="checkbox"]:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ---------- Modals (scoped — never style bare .modal) ---------- */
.modal:not(.fade) {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(8, 18, 10, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.modal:not(.fade).is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal:not(.fade) .modal-card {
    width: min(560px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-lg);
    transform: translateY(12px);
    transition: transform 0.25s ease;
}

.modal:not(.fade).is-open .modal-card {
    transform: translateY(0);
}

.modal:not(.fade) .modal-card-wide {
    width: min(720px, 100%);
}

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

.modal-head h3 {
    font-size: 1.25rem;
}

.lead-target {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 4px 0 16px;
    line-height: 1.5;
}

.modal-alt {
    font-size: 0.86rem;
    color: var(--muted);
    margin-top: 16px;
}

/* ---------- Stall ---------- */
.stall-hero {
    border-radius: var(--radius-xl);
    padding: 30px 34px;
    margin-bottom: 20px;
    background:
        radial-gradient(800px 300px at 90% -20%, rgba(249, 168, 37, 0.28), transparent 60%),
        linear-gradient(135deg, #243b28, #1b5e20 55%, #00695c);
    color: #fff;
}

.stall-hero h1 {
    font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.stall-hero p {
    color: rgba(255, 255, 255, 0.85);
    max-width: 620px;
    line-height: 1.6;
    margin-top: 10px;
}

.stall-hero .stall-id {
    margin-top: 16px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.stall-chip {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 0.82rem;
    font-weight: 700;
}

.stall-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.stall-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px;
    min-width: 0;
}

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

.stall-panel h3 {
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stall-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.live-card {
    border: 1px dashed var(--line-strong);
    background: var(--bg-soft);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.live-pill {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--muted);
}

.live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--muted);
}

.live-card.is-soon .live-dot {
    background: var(--amber);
    box-shadow: 0 0 0 4px var(--amber-soft);
    animation: blink 1.6s infinite;
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translate(-50%, 20px);
    z-index: 300;
    max-width: min(460px, calc(100vw - 32px));
    padding: 13px 20px;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast.ok {
    background: var(--primary);
    color: #fff;
}

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

/* ---------- Empty state ---------- */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 46px 20px;
    color: var(--muted);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
}

.empty-state .empty-icon {
    font-size: 44px;
    display: block;
    margin-bottom: 10px;
}

/* ---------- Animations ---------- */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

@keyframes sunPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.06);
    }
}

@keyframes vegFloat {

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

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

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.35;
    }
}

@keyframes skeletonShimmer {
    0% {
        background-position: -400px 0;
    }

    100% {
        background-position: 400px 0;
    }
}

.skeleton {
    border-radius: var(--radius);
    background: linear-gradient(90deg, var(--bg-soft) 25%, var(--line) 37%, var(--bg-soft) 63%);
    background-size: 800px 100%;
    animation: skeletonShimmer 1.3s ease infinite;
    min-height: 120px;
}

/* ---------- A11y ---------- */
:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: var(--primary);
    color: #fff;
    padding: 10px 16px;
    border-radius: 0 0 10px 0;
    z-index: 400;
}

.skip-link:focus {
    left: 0;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .hero-inner {
        grid-template-columns: 1fr;
        padding: 32px 24px;
    }

    .hero-art {
        display: none;
    }

    .stall-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 640px) {
    .app {
        padding: 0 12px 70px;
    }

    .topbar-inner {
        padding: 10px 12px;
    }

    .brand-tag {
        display: none;
    }

    .viewswitch button {
        padding: 8px 12px;
    }

    .filters {
        grid-template-columns: 1fr;
    }

    .entry-form .field-row {
        grid-template-columns: 1fr;
    }

    .hero {
        border-radius: var(--radius-lg);
    }

    .hero-inner {
        padding: 26px 18px;
    }

    .hero-cta {
        flex-direction: column;
    }

    .hero-cta .btn {
        width: 100%;
    }

    .card-grid,
    .product-grid {
        grid-template-columns: 1fr;
    }

    .console-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .focus-pick {
        min-width: 0;
    }

    .modal:not(.fade) {
        align-items: flex-end;
        padding: 0;
    }

    .modal:not(.fade) .modal-card,
    .modal:not(.fade) .modal-card-wide {
        width: 100%;
        max-height: 90vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        transform: translateY(100%);
        padding-bottom: calc(22px + env(safe-area-inset-bottom));
    }

    .modal:not(.fade).is-open .modal-card {
        transform: translateY(0);
    }
}

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

    *,
    *::before,
    *::after {
        animation-duration: 0.001s !important;
        transition-duration: 0.001s !important;
    }
}