/* ─── Theme: fresh green, warm accent. Mobile first. ─────────────────────── */
:root {
    --fv-green: #2e7d32;
    --fv-green-dark: #1b5e20;
    --fv-green-soft: #e8f5e9;
    --fv-accent: #f57c00;
    --fv-surface: #f6f8f5;
    --fv-border: #e3e8e1;
    --fv-text: #1f2d1f;
    --fv-tabbar-h: 62px;

    --bs-primary: var(--fv-green);
    --bs-primary-rgb: 46, 125, 50;
    --bs-link-color: var(--fv-green);
    --bs-link-color-rgb: 46, 125, 50;
    --bs-link-hover-color: var(--fv-green-dark);
    --bs-link-hover-color-rgb: 27, 94, 32;
    --bs-body-color: var(--fv-text);
    --bs-body-bg: var(--fv-surface);
    --bs-border-color: var(--fv-border);
    --bs-border-radius: .6rem;
    --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body { -webkit-font-smoothing: antialiased; }
h1, .h1 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); font-weight: 700; }
h2, .h2 { font-size: clamp(1.25rem, 1.1rem + .6vw, 1.5rem); font-weight: 650; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.btn:hover, .nav-link:hover, .dropdown-item:hover, .card a:hover, .list-group-item:hover { text-decoration: none; }
.icon { flex-shrink: 0; vertical-align: -.15em; }
.skip-link { position: absolute; left: 1rem; top: .5rem; z-index: 2000; background: #fff; padding: .5rem 1rem; border-radius: .5rem; }

.btn-primary { --bs-btn-bg: var(--fv-green); --bs-btn-border-color: var(--fv-green); --bs-btn-hover-bg: var(--fv-green-dark); --bs-btn-hover-border-color: var(--fv-green-dark); --bs-btn-active-bg: var(--fv-green-dark); --bs-btn-disabled-bg: var(--fv-green); --bs-btn-disabled-border-color: var(--fv-green); }
.btn-outline-primary { --bs-btn-color: var(--fv-green); --bs-btn-border-color: var(--fv-green); --bs-btn-hover-bg: var(--fv-green); --bs-btn-hover-border-color: var(--fv-green); --bs-btn-active-bg: var(--fv-green-dark); }
.text-primary { color: var(--fv-green) !important; }
.bg-primary-soft { background: var(--fv-green-soft); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--fv-green); }
.pagination { --bs-pagination-active-bg: var(--fv-green); --bs-pagination-active-border-color: var(--fv-green); --bs-pagination-color: var(--fv-green); }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: #81c784; box-shadow: 0 0 0 .2rem rgba(46,125,50,.2); }
.form-check-input:checked { background-color: var(--fv-green); border-color: var(--fv-green); }
.card { --bs-card-border-color: var(--fv-border); }
.table { --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .6rem .65rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #5b6b5b; font-weight: 600; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.status-badge { font-weight: 600; font-size: .72rem; letter-spacing: .02em; }
.text-bg-info { background-color: #e1f0fa !important; color: #0b5c86 !important; }
.text-bg-warning { background-color: #fff3d6 !important; color: #8a5300 !important; }
.text-bg-success { background-color: #e3f4e4 !important; color: #1b5e20 !important; }
.text-bg-danger { background-color: #fde7e7 !important; color: #b3261e !important; }

/* ─── Shop header / footer / mobile tab bar ─────────────────────────────── */
.shop-header .navbar { min-height: 60px; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--fv-green); color: #fff; }
.brand-text { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-search { max-width: 560px; }
.basket-button { border-radius: 999px; padding-inline: 1rem; }
.test-mode-banner { background: #fff3cd; color: #664d03; border-bottom: 1px solid #ffe69c; }
.shop-main { min-height: 60vh; }
.shop-footer { background: #fff; }

.mobile-tabbar {
    position: fixed; inset: auto 0 0 0; z-index: 1030; height: calc(var(--fv-tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr);
    background: #fff; border-top: 1px solid var(--fv-border); box-shadow: 0 -2px 10px rgba(0,0,0,.04);
}
.mobile-tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #607060; font-size: .7rem; font-weight: 600; }
.mobile-tabbar a.active { color: var(--fv-green); }
.mobile-tabbar .tab-badge { position: absolute; top: 6px; left: calc(50% + 6px); background: var(--fv-accent); color: #fff; border-radius: 999px; font-size: .65rem; padding: 0 .4em; min-width: 1.4em; text-align: center; }
@media (max-width: 991.98px) { body { padding-bottom: calc(var(--fv-tabbar-h) + env(safe-area-inset-bottom)); } }

/* ─── Product cards & grid ──────────────────────────────────────────────── */
.product-grid { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; } }
@media (min-width: 1200px) { .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.product-card { background: #fff; border: 1px solid var(--fv-border); border-radius: .9rem; overflow: hidden; display: flex; flex-direction: column; height: 100%; transition: box-shadow .15s, transform .15s; }
.product-card:hover { box-shadow: 0 6px 18px rgba(30,60,30,.08); }
.product-card .media { aspect-ratio: 1 / 1; background: var(--fv-green-soft); display: block; }
.product-card .media img, .product-card .media .img-placeholder { width: 100%; height: 100%; object-fit: cover; }
.product-card .body { padding: .7rem .8rem .8rem; display: flex; flex-direction: column; gap: .35rem; flex-grow: 1; }
.product-card .name { font-weight: 650; color: var(--fv-text); line-height: 1.25; font-size: .95rem; }
.product-card .price { font-weight: 700; font-size: 1.05rem; }
.img-placeholder { display: grid; place-items: center; color: #9cc59f; background: var(--fv-green-soft); width: 100%; aspect-ratio: 1 / 1; }
.qty-input { max-width: 5.5rem; text-align: center; }
.unit-select { font-size: .85rem; }
.category-tile { background: #fff; border: 1px solid var(--fv-border); border-radius: .9rem; padding: 1rem; display: flex; align-items: center; gap: .75rem; color: var(--fv-text); height: 100%; }
.category-tile:hover { border-color: #a5d6a7; }
.category-tile .tile-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--fv-green-soft); color: var(--fv-green); display: grid; place-items: center; flex-shrink: 0; overflow: hidden; }
.category-tile .tile-icon img { width: 100%; height: 100%; object-fit: cover; }
.hero { background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 60%, #fff8e1 100%); border-radius: 1.2rem; }
.unit-option { border: 1px solid var(--fv-border); border-radius: .7rem; padding: .7rem .9rem; cursor: pointer; background: #fff; }
.unit-option:has(input:checked) { border-color: var(--fv-green); background: var(--fv-green-soft); box-shadow: 0 0 0 1px var(--fv-green); }
.sticky-summary { position: sticky; top: 84px; }

/* ─── Customer account ──────────────────────────────────────────────────── */
.account-nav .nav-link { color: #3d4d3d; font-weight: 500; }
.stat-card { background: #fff; border: 1px solid var(--fv-border); border-radius: .9rem; padding: 1rem; height: 100%; }
.stat-card .label { font-size: .78rem; color: #5b6b5b; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat-card .value { font-size: 1.45rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat-card .hint { font-size: .8rem; color: #6c7a6c; }
.ledger-credit { color: var(--fv-green-dark); }

/* Tables turn into stacked cards on small screens: add .table-stack and data-label on cells. */
@media (max-width: 767.98px) {
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { background: #fff; border: 1px solid var(--fv-border); border-radius: .7rem; margin-bottom: .6rem; padding: .35rem .2rem; }
    .table-stack td { border: 0 !important; display: flex; justify-content: space-between; gap: 1rem; padding: .3rem .7rem !important; text-align: right; }
    .table-stack td::before { content: attr(data-label); font-weight: 600; color: #5b6b5b; text-align: left; }
    .table-stack td.num { text-align: right; }
}

/* ─── Admin ─────────────────────────────────────────────────────────────── */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 250px; flex-shrink: 0; background: #17301a; color: #cfe3d0; position: sticky; top: 0; height: 100vh; }
.admin-brand { color: #fff; font-weight: 700; padding: 1rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.admin-brand:hover { color: #fff; }
.admin-nav-heading { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #8fb592; padding: .9rem 1.1rem .3rem; font-weight: 700; }
.admin-nav .nav-link { color: #cfe3d0; padding: .38rem 1.1rem; font-size: .9rem; border-left: 3px solid transparent; }
.admin-nav .nav-link:hover { color: #fff; background: rgba(255,255,255,.05); }
.admin-nav .nav-link.active { color: #fff; background: rgba(129,199,132,.16); border-left-color: #81c784; }
.admin-offcanvas { background: #17301a; color: #cfe3d0; width: 280px !important; }
.admin-content { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar { height: 56px; background: #fff; border-bottom: 1px solid var(--fv-border); position: sticky; top: 0; z-index: 1020; }
.admin-main { max-width: 1500px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; font-size: 1.5rem; }
.filter-bar { background: #fff; border: 1px solid var(--fv-border); border-radius: .8rem; padding: .75rem; margin-bottom: 1rem; }
.panel { background: #fff; border: 1px solid var(--fv-border); border-radius: .9rem; }
.panel-head { padding: .8rem 1rem; border-bottom: 1px solid var(--fv-border); display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.panel-head h2 { font-size: 1rem; margin: 0; font-weight: 650; }
.panel-body { padding: 1rem; }
.table-responsive { border-radius: .9rem; }
.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.dl-grid dt { font-weight: 500; color: #5b6b5b; }
.dl-grid dd { margin: 0; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg text { font-size: 11px; fill: #6b7a6b; }
.busy { opacity: .6; pointer-events: none; }

@media print {
    .admin-sidebar, .admin-topbar, .mobile-tabbar, .shop-header, .shop-footer, .no-print, .btn, .test-mode-banner { display: none !important; }
    body { background: #fff; padding: 0; }
    .admin-main { padding: 0 !important; }
    .panel, .card { border: 0; }
}

/* Blazor */
#blazor-error-ui { background: #fff3cd; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 2000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.valid.modified:not([type=checkbox]) { outline: none; }
.invalid { border-color: #dc3545 !important; }
.validation-message { color: #dc3545; font-size: .85rem; margin-top: .25rem; }
.blazor-error-boundary { background: #fde7e7; padding: 1rem; color: #b3261e; border-radius: .5rem; }
.blazor-error-boundary::after { content: "An error has occurred."; }

/* ── Shop pages ── */
.min-w-0 { min-width: 0; }
.prose-text { white-space: pre-line; }
.hero-mark { display: grid; place-items: center; width: 180px; height: 180px; border-radius: 50%; background: #fff; color: var(--fv-green); box-shadow: 0 10px 30px rgba(46,125,50,.12); }
.tile-icon-lg { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 16px; background: var(--fv-green-soft); color: var(--fv-green); flex-shrink: 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { display: inline-flex; align-items: center; min-height: 40px; padding: .35rem .95rem; border-radius: 999px; background: #fff; border: 1px solid var(--fv-border); color: var(--fv-text); font-weight: 600; font-size: .9rem; }
.chip:hover { border-color: #a5d6a7; background: var(--fv-green-soft); text-decoration: none; }
.qty-stepper { flex-wrap: nowrap; }
.qty-stepper .btn { min-width: 2.5rem; display: grid; place-items: center; }
.qty-stepper .qty-input { max-width: none; min-width: 3.5rem; }
.product-card .qty-stepper .btn { min-width: 2.25rem; }
.gallery-main { background: #fff; border: 1px solid var(--fv-border); border-radius: 1rem; overflow: hidden; aspect-ratio: 1 / 1; }
.gallery-main img, .gallery-main .img-placeholder { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: .5rem; margin: .6rem 0 0; overflow-x: auto; padding-bottom: .25rem; }
.gallery-thumbs a { display: block; width: 72px; height: 72px; border-radius: .6rem; overflow: hidden; border: 2px solid transparent; background: var(--fv-green-soft); }
.gallery-thumbs a.active { border-color: var(--fv-green); }
.gallery-thumbs img, .gallery-thumbs .img-placeholder { width: 100%; height: 100%; object-fit: cover; }
.basket-thumb { display: block; width: 72px; height: 72px; border-radius: .6rem; overflow: hidden; background: var(--fv-green-soft); }
.basket-thumb img, .basket-thumb .img-placeholder { width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 576px) { .basket-thumb { width: 88px; height: 88px; } }
.basket-line.has-problem { border-color: #f1aeb5; background: #fffafa; }
.summary-list { margin: 0; }
.summary-list > div { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; }
.summary-list dt { font-weight: 500; }
.summary-list dd { margin: 0; }
.summary-list .summary-total { border-top: 1px solid var(--fv-border); margin-top: .3rem; padding-top: .6rem; font-size: 1.15rem; font-weight: 750; }
.summary-list .summary-total dt { font-weight: 750; }
.checkout-lines li + li { border-top: 1px dashed var(--fv-border); }
.checkout-result { max-width: 640px; }
.result-icon { display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: #eef1ee; color: #5b6b5b; }
.result-icon.success { background: var(--fv-green-soft); color: var(--fv-green); }
.result-icon.warning { background: #fff3d6; color: #8a5300; }
.result-icon.danger { background: #fde7e7; color: #b3261e; }
@media (max-width: 991.98px) { .sticky-summary { position: static; } }

/* ── Selling-unit chips (product cards) ── */
.unit-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: .4rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.unit-chip { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
    padding: .45rem .35rem; border: 1.5px solid var(--fv-border); border-radius: .6rem; background: #fff; cursor: pointer; line-height: 1.15; min-height: 52px; }
.unit-chip input { position: absolute; opacity: 0; pointer-events: none; }
.unit-chip .chip-label { font-size: .78rem; font-weight: 600; color: #3d4d3d; }
.unit-chip .chip-price { font-size: .9rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.unit-chip:hover { border-color: #a5d6a7; }
.unit-chip:has(input:checked) { border-color: var(--fv-green); background: var(--fv-green-soft); box-shadow: 0 0 0 1px var(--fv-green); }
.unit-chip:has(input:checked) .chip-label { color: var(--fv-green-dark); }
.unit-chip:has(input:focus-visible) { outline: 3px solid rgba(46,125,50,.35); outline-offset: 2px; }
.unit-chips:disabled .unit-chip { opacity: .55; cursor: not-allowed; }
.unit-chip .chip-deal { margin-top: .15rem; font-size: .68rem; font-weight: 700; color: #8a5300; background: #fff3d6; border-radius: 999px; padding: 0 .4rem; }
.unit-option.address-outside, .unit-option.address-outside:has(input:checked) { background: #fdf3f3; border-color: #f1c4c4; box-shadow: none; cursor: not-allowed; }
.unit-option.address-outside .fw-semibold { color: #6c757d; }
