/* ============================================================================
   MMEST Market — light theme design system
   Warm cream palette, deep green primary, coral accent. No dark backgrounds.
   ============================================================================ */

:root {
    /* Surfaces */
    --bg:           #fcfaf6;
    --surface:      #ffffff;
    --surface-2:    #f6f1e7;
    --surface-3:    #fdf6ea;

    /* Ink */
    --ink:          #1a1f2e;
    --ink-2:        #4a5263;
    --ink-3:        #7a8294;

    /* Brand */
    --brand:        #0a6e4f;   /* deep evergreen */
    --brand-2:      #08583f;   /* hover */
    --brand-soft:   #e6f3ed;   /* tinted surface */
    --accent:       #e2682b;   /* warm coral */
    --accent-2:     #c25618;
    --accent-soft:  #fde4d2;

    /* Lines / shadows */
    --border:       #e8e2d4;
    --border-soft:  #f1ecdf;
    --ring:         0 0 0 3px rgba(10, 110, 79, .18);
    --shadow-1:     0 1px 2px rgba(20, 30, 50, .05);
    --shadow-2:     0 4px 14px rgba(20, 30, 50, .08);
    --shadow-3:     0 12px 30px rgba(20, 30, 50, .12);

    /* Radius */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 16px;
    --r-xl: 24px;

    /* Type */
    --font-sans: "Inter", "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* ============================================================================
   Preview mode banner — non-dismissible, appears above the header.
   ============================================================================ */
.preview-banner {
    background: #fff4d6;
    color: #6b4300;
    border-bottom: 2px solid #d97706;
    padding: .65rem 1.25rem;
    font-size: .92rem;
    text-align: center;
    line-height: 1.4;
}
.preview-banner strong { color: #6b4300; margin-right: .5rem; }
.preview-banner span { color: #6b4300; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    letter-spacing: -0.015em;
    line-height: 1.2;
    margin: 0 0 .75rem;
    color: var(--ink);
    font-weight: 700;
}
h1 { font-size: 2.5rem; letter-spacing: -0.025em; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1rem; color: var(--ink-2); }
a { color: var(--brand); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--brand-2); }

.container { max-width: 1240px; margin: 0 auto; padding: 0 1.25rem; }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }

/* ============================================================================
   Header
   ============================================================================ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border-soft);
}
.header-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: .8rem 1.25rem;
}
.brand {
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--brand);
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    white-space: nowrap;
}
.brand:hover { color: var(--brand); }
.search {
    flex: 1;
    position: relative;
    display: block;
    max-width: 620px; /* also beats the global form { max-width: 480px } grid */
    min-width: 0;
}
.search input {
    width: 100%;
    padding: .62rem 3.1rem .62rem 1.15rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.search input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--brand);
    box-shadow: var(--ring);
}
.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: var(--ink-3);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.search-btn svg { width: 18px; height: 18px; }
.search-btn:hover { background: var(--brand-soft); color: var(--brand); }
.topnav {
    display: flex;
    gap: 1.15rem;
    align-items: center;
    font-weight: 500;
    flex-wrap: wrap;
    margin-left: auto;
}
.topnav a, .topnav .linklike {
    color: var(--ink-2);
    background: none;
    border: 0;
    cursor: pointer;
    font: inherit;
    padding: .35rem 0;
    position: relative;
}
.topnav a:hover, .topnav .linklike:hover { color: var(--brand); }
.topnav a.cart-link {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    color: var(--ink-2);
    padding: 0 !important;
    border-radius: 999px;
    transition: background .15s ease, color .15s ease;
}
.topnav a.cart-link:hover { background: var(--brand-soft); color: var(--brand); }
.cart-link svg { width: 19px; height: 19px; }
.cart-count {
    position: absolute;
    top: -3px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    border: 2px solid var(--surface);
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    line-height: 1;
}
.user-greeting {
    color: var(--ink);
    font-weight: 600;
    padding: 0 .25rem;
}
.topnav a.register-link {
    color: var(--ink) !important;
    font-weight: 600;
}
.topnav a.register-link:hover { color: var(--brand) !important; }
.topnav a.signin-link {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    border: 1.5px solid var(--brand);
    color: var(--brand) !important;
    padding: .34rem 1rem !important;
    border-radius: 999px;
    font-weight: 600;
    transition: background .15s ease;
}
.signin-link svg { width: 15px; height: 15px; }
.topnav a.signin-link:hover { background: var(--brand-soft); color: var(--brand-2) !important; }
@media (max-width: 900px) {
    .header-row { flex-wrap: wrap; row-gap: .5rem; }
    .brand { order: 1; }
    .topnav { order: 2; }
    .search { order: 3; flex-basis: 100%; max-width: none; }
}

/* ============================================================================
   Hero
   ============================================================================ */
.hero {
    position: relative;
    overflow: hidden;
    padding: 5rem 1.25rem 4rem;
    margin: 1.25rem 0 3rem;
    background:
        radial-gradient(ellipse at top right, var(--accent-soft) 0%, transparent 55%),
        radial-gradient(ellipse at bottom left, var(--brand-soft) 0%, transparent 60%),
        var(--surface-3);
    border-radius: var(--r-xl);
    text-align: center;
}
.hero::before, .hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(50px);
    opacity: .35;
    pointer-events: none;
}
.hero::before {
    background: var(--brand);
    width: 320px; height: 320px;
    top: -100px; left: -80px;
}
.hero::after {
    background: var(--accent);
    width: 280px; height: 280px;
    bottom: -120px; right: -60px;
}
.hero-eyebrow {
    display: inline-block;
    background: rgba(255, 255, 255, .8);
    color: var(--brand);
    padding: .35rem .85rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border-soft);
}
.hero h1 {
    font-size: clamp(2rem, 4.5vw, 3.25rem);
    margin: 0 auto 1rem;
    max-width: 800px;
    position: relative;
    z-index: 1;
}
.hero p {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 2rem;
    color: var(--ink-2);
    position: relative;
    z-index: 1;
}
.hero-actions {
    display: inline-flex;
    gap: .75rem;
    flex-wrap: wrap;
    justify-content: center;
    position: relative;
    z-index: 1;
}

/* ============================================================================
   Buttons
   ============================================================================ */
button, .cta, .btn {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    padding: .7rem 1.4rem;
    background: var(--brand);
    color: #fff;
    border: 0;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
    text-decoration: none;
    display: inline-block;
}
button:hover, .cta:hover, .btn:hover {
    background: var(--brand-2);
    box-shadow: var(--shadow-2);
}
.cta {
    padding: .85rem 1.6rem;
    box-shadow: var(--shadow-2);
}
.btn-secondary {
    background: var(--surface);
    color: var(--ink) !important;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
}
.btn-secondary:hover { background: var(--surface-2); color: var(--ink) !important; }
button:focus-visible, .cta:focus-visible, .btn:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

/* ============================================================================
   Sections
   ============================================================================ */
.section { padding: 3rem 0; }
.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.section-heading h2 { margin: 0; }
.section-link {
    font-weight: 600;
    font-size: .95rem;
}

/* ============================================================================
   Categories
   ============================================================================ */
.categories .grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}
.cat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    padding: 1.5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
    color: var(--ink);
    font-weight: 600;
    text-align: center;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    min-height: 130px;
}
.cat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-2);
    border-color: var(--brand-soft);
    color: var(--brand);
}
.cat-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-soft);
    color: var(--brand);
    border-radius: 12px;
    overflow: hidden;
}
.cat-icon > svg,
.cat-icon svg {
    width: 24px !important;
    height: 24px !important;
    display: block;
    flex-shrink: 0;
}

/* Alternate color rotation for visual rhythm */
.cat-card:nth-child(4n+2) .cat-icon { background: var(--accent-soft); color: var(--accent-2); }
.cat-card:nth-child(4n+3) .cat-icon { background: #fff5cc; color: #8a6800; }
.cat-card:nth-child(4n+4) .cat-icon { background: #e9eafc; color: #4b51b8; }

/* ============================================================================
   Product grid + cards
   ============================================================================ */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}
.product-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
    color: var(--ink);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-3);
    color: var(--ink);
}
.product-thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background:
        linear-gradient(135deg, var(--surface-2), var(--surface-3));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-3);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
}
.product-body { padding: 1rem 1.1rem 1.15rem; display: flex; flex-direction: column; gap: .35rem; }
.product-name {
    font-weight: 600;
    font-size: .98rem;
    color: var(--ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-price {
    color: var(--brand);
    font-weight: 800;
    font-size: 1.1rem;
    margin-top: .25rem;
}

/* ============================================================================
   Product details
   ============================================================================ */
.product-details {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 3rem;
    padding: 2.5rem 0;
}
.gallery img { max-width: 100%; border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.placeholder-image {
    aspect-ratio: 1;
    background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
    border: 1px solid var(--border-soft);
    padding: 4rem;
    text-align: center;
    color: var(--ink-3);
    border-radius: var(--r-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}
.info .price {
    font-size: 2.25rem;
    color: var(--brand);
    font-weight: 800;
    margin: .5rem 0;
}
.info .seller { color: var(--ink-3); font-size: .95rem; }
.info .rating { color: var(--accent-2); font-weight: 600; }
.info .stock { color: var(--brand); font-weight: 600; margin: .5rem 0; }
.description { color: var(--ink-2); line-height: 1.7; }

/* ============================================================================
   Forms
   ============================================================================ */
form { display: grid; gap: .85rem; max-width: 480px; }
label {
    display: grid;
    gap: .35rem;
    font-weight: 500;
    color: var(--ink);
    font-size: .92rem;
}
input, select, textarea {
    padding: .6rem .85rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font: inherit;
    background: var(--surface);
    color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--ring);
}
fieldset {
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    padding: 1rem 1.25rem 1.25rem;
    margin: .5rem 0;
}
legend { font-weight: 600; padding: 0 .5rem; }
.inline { display: inline-flex; gap: .35rem; align-items: center; }

/* ============================================================================
   Tables
   ============================================================================ */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1rem 0;
    background: var(--surface);
    border-radius: var(--r-md);
    overflow: hidden;
    border: 1px solid var(--border-soft);
}
th, td { padding: .85rem 1rem; border-bottom: 1px solid var(--border-soft); text-align: left; }
th { background: var(--surface-2); font-weight: 600; color: var(--ink); font-size: .9rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-3); }

/* ============================================================================
   Sidebar / Catalog
   ============================================================================ */
.catalog-page {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    padding: 2rem 0;
}
.sidebar h3 {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--ink-3);
    margin-bottom: .5rem;
}
.cat-list { list-style: none; padding: 0; margin: 0; }
.cat-list li { padding: .4rem 0; }
.cat-list a { color: var(--ink-2); }
.cat-list a:hover { color: var(--brand); }

/* ============================================================================
   Footer
   ============================================================================ */
.footer {
    background: var(--surface-2);
    border-top: 1px solid var(--border-soft);
    margin-top: 5rem;
    padding: 3rem 0 2rem;
    color: var(--ink-2);
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2.5rem;
    padding-bottom: 2rem;
}
.footer h4 {
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--ink);
    margin-bottom: .85rem;
}
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { padding: .25rem 0; }
.footer a { color: var(--ink-2); }
.footer a:hover { color: var(--brand); }
.footer-brand { color: var(--ink); font-weight: 700; font-family: var(--font-display); font-size: 1.1rem; }
.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 1.25rem;
    display: flex;
    justify-content: space-between;
    font-size: .9rem;
    color: var(--ink-3);
    flex-wrap: wrap;
    gap: .5rem;
}

/* ============================================================================
   Dashboard, tenant, auth
   ============================================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}
.stat {
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-1);
}
.stat-label { color: var(--ink-3); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--brand); font-family: var(--font-display); }
.tenant-nav {
    display: flex;
    gap: .5rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}
.tenant-nav a {
    padding: .55rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    text-decoration: none;
    color: var(--ink);
    font-weight: 500;
    font-size: .95rem;
}
.tenant-nav a:hover { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-soft); }
.card {
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-1);
}
.validation { color: #b00020; font-size: .9rem; }
.role-badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    margin-right: .35rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.role-admin    { background: var(--accent-soft); color: var(--accent-2); }
.role-tenant   { background: var(--brand-soft);  color: var(--brand); }
.role-customer { background: #e9eafc;            color: #4b51b8; }
.status-pill {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.status-pending   { background: #fdf6ec;           color: #8a6800; }
.status-paid      { background: var(--brand-soft); color: var(--brand); }
.status-fulfilled { background: #e9eafc;           color: #4b51b8; }
.status-cancelled { background: #fdeceb;           color: #b23b3b; }
.status-refunded  { background: var(--surface-2);  color: var(--ink-2); }
.addr-card {
    display: block;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    margin-bottom: .5rem;
    background: var(--surface);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.addr-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.social-login { display: flex; flex-direction: column; gap: .6rem; margin: 1.25rem 0; }
.btn-google, .btn-facebook {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .8rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    text-decoration: none;
    color: var(--ink);
    background: var(--surface);
    font-weight: 600;
    transition: background .15s ease, border-color .15s ease;
}
.btn-google:hover, .btn-facebook:hover { background: var(--surface-2); border-color: var(--brand); color: var(--ink); }
.auth-card {
    max-width: 440px;
    margin: 4rem auto;
    padding: 2.5rem;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-2);
}
.auth-card h1 { margin-top: 0; font-size: 1.65rem; }

/* ============================================================================
   Misc
   ============================================================================ */
.empty {
    color: var(--ink-3);
    font-style: italic;
    padding: 2rem 0;
}
.sentinel {
    grid-column: 1 / -1;
    padding: 1.5rem;
    text-align: center;
    color: var(--ink-3);
}
.cart.cart { /* cart table specifically — overrides hover */ }
.cart-actions { margin-top: 1.5rem; }

/* Value props / how it works */
.value-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}
.value-card {
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
    text-align: left;
}
.value-card .cat-icon { margin-bottom: 1rem; }
.value-card h3 { font-size: 1.05rem; margin-bottom: .5rem; }
.value-card p { margin: 0; font-size: .95rem; }

/* ============================================================================
   Checkout
   ============================================================================ */
.checkout-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 2rem;
    align-items: start;
}
.checkout-summary {
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
    position: sticky;
    top: 5.5rem;
}
.checkout-summary h2 { margin-top: 0; font-size: 1.15rem; }
.summary-lines { list-style: none; margin: 0 0 1rem; padding: 0; }
.summary-lines li, .summary-total {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .4rem 0;
    font-size: .95rem;
}
.summary-total { border-top: 1px solid var(--border-soft); padding-top: .75rem; }
.summary-note { font-size: .85rem; color: var(--ink-3); margin-bottom: 0; }
.coupon-row { display: flex; gap: .6rem; margin-bottom: .5rem; }
.coupon-row input { flex: 1; }
.coupon-ok  { color: var(--brand); font-size: .95rem; }
.coupon-bad { color: #b23b3b; font-size: .95rem; }
button.ghost {
    padding: .6rem 1rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
    font-weight: 600;
}
button.ghost:hover { border-color: var(--brand); color: var(--brand); }
.alert { padding: .9rem 1.1rem; border-radius: var(--r-md); margin-bottom: 1.25rem; }
.alert-error { background: #fdeceb; color: #b23b3b; border: 1px solid #f3c6c3; }
.alert-ok { background: var(--brand-soft); color: var(--brand); border: 1px solid var(--brand); }
.muted { color: var(--ink-3); font-size: .9em; }
.return-request-form, .return-review-form {
    display: flex;
    gap: .4rem;
    align-items: center;
    flex-wrap: wrap;
}
.return-request-form input[type="number"] { width: 4.5rem; }
.return-request-form input[type="text"], .return-review-form input[type="text"] { min-width: 10rem; }
.order-result { padding: 1.5rem; border-radius: var(--r-lg); margin-bottom: 1.5rem; }
.order-paid    { background: var(--brand-soft); border: 1px solid var(--brand); }
.order-pending { background: #fdf6ec; border: 1px solid #e8c98a; }
.order-fulfilled { background: #e9eafc; border: 1px solid #c3c7f0; }
.order-cancelled { background: #fdeceb; border: 1px solid #f3c6c3; }
.order-refunded  { background: var(--surface-2); border: 1px solid var(--border); }
.order-summary-table { max-width: 420px; margin-bottom: 1.5rem; }
.img-upload-form { display: flex; align-items: center; gap: .5rem; }
.img-preview { object-fit: cover; border-radius: 4px; border: 1px solid var(--border-soft); }
.product-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ============================================================================
   Admin: Visitors
   ============================================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.kpi {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
    padding: 1.15rem 1.35rem;
    box-shadow: var(--shadow-1, 0 1px 2px rgba(15, 40, 30, .04));
}
.kpi-label {
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.kpi-value {
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 800;
    color: var(--brand);
    line-height: 1.15;
    margin-top: .25rem;
}
.kpi-sub { font-size: .82rem; color: var(--ink-3); margin-top: .15rem; }
.country-bars { list-style: none; margin: .65rem 0 0; padding: 0; display: grid; gap: .45rem; }
.country-bars li { display: grid; grid-template-columns: 8.5rem 1fr 2.5rem; align-items: center; gap: .6rem; font-size: .85rem; }
.country-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.country-track { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.country-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2, #0c8560)); border-radius: 999px; }
.country-count { text-align: right; font-weight: 600; color: var(--ink-2); }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: .85rem;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    max-width: none;
}
.filter-field { display: flex; flex-direction: column; gap: .3rem; }
.filter-field label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.filter-field input, .filter-field select {
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    min-width: 9.5rem;
}
.filter-field input:focus, .filter-field select:focus {
    outline: none;
    border-color: var(--brand);
    background: var(--surface);
    box-shadow: var(--ring);
}
.ghost-link { align-self: end; padding: .55rem .4rem; color: var(--ink-3); font-weight: 600; }
.ghost-link:hover { color: var(--brand); }

.table-form { display: block; max-width: none; }
.table-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
    overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; margin: 0; }
.data-table thead th {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-3);
    background: var(--surface-2);
    padding: .7rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
}
.data-table tbody td {
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: top;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--brand-soft); }
.col-check { width: 2.25rem; }
.col-time { white-space: nowrap; }
.cell-strong { display: block; font-weight: 600; color: var(--ink); font-size: .92rem; }
.cell-sub { display: block; font-size: .8rem; color: var(--ink-3); margin-top: .1rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; letter-spacing: 0; }
.path-chip {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .8rem;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    padding: .2rem .45rem;
    color: var(--ink-2);
    word-break: break-all;
}
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: .8rem 1rem;
    background: var(--surface-2);
    border-top: 1px solid var(--border-soft);
}
.table-footer-left { display: flex; align-items: center; gap: .85rem; flex-wrap: wrap; }
.btn-danger-outline {
    padding: .5rem 1rem;
    background: none;
    border: 1px solid #d89a95;
    color: #b23b3b;
    border-radius: var(--r-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.btn-danger-outline:hover { background: #fdeceb; border-color: #b23b3b; }
.pager { display: flex; align-items: center; gap: .6rem; }
.pager-btn {
    padding: .45rem .9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}
.pager-btn:hover { border-color: var(--brand); color: var(--brand); }
.pager-info { font-size: .85rem; color: var(--ink-3); }

@media (max-width: 900px) {
    .kpi-grid { grid-template-columns: 1fr; }
}

/* ============================================================================
   Tenant: Products
   ============================================================================ */
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }

.add-product-card { padding: 1.5rem 1.5rem 1.6rem; }
.add-product-heading h2 { font-size: 1.15rem; margin-bottom: .2rem; }
.add-product-heading p { margin-bottom: 1.15rem; }
.product-form {
    max-width: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .9rem 1.1rem;
    align-items: start;
}
.product-form label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.product-form input, .product-form select, .product-form textarea {
    background: var(--surface-2);
    font-size: .95rem;
}
.product-form input:focus, .product-form select:focus, .product-form textarea:focus {
    background: var(--surface);
}
.product-form textarea { resize: vertical; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; margin-top: .25rem; }

.product-cell { display: flex; align-items: center; gap: .8rem; }
.product-cell-text { min-width: 0; }
.product-thumb-sm {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: var(--r-sm);
    border: 1px solid var(--border-soft);
    object-fit: cover;
    background: var(--surface-2);
}
.product-thumb-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
    color: var(--ink-3);
    font-weight: 700;
    font-size: 1.1rem;
}
.stock-cell { white-space: nowrap; }
.stock-cell .cell-strong { display: inline; }
.stock-pill {
    display: inline-block;
    margin-left: .5rem;
    padding: .12rem .5rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    vertical-align: middle;
}
.stock-low { background: #fdf6ec; color: #8a6800; }
.stock-out { background: #fdeceb; color: #b23b3b; }
.status-active { background: var(--brand-soft); color: var(--brand); }
.status-hidden { background: var(--surface-2);  color: var(--ink-2); }

.col-actions { text-align: right; width: 1%; white-space: nowrap; }
.row-actions { display: flex; gap: .5rem; justify-content: flex-end; align-items: center; }
.row-action-form, .img-upload-form { display: inline-flex; margin: 0; max-width: none; gap: 0; }
.row-btn {
    display: inline-block;
    padding: .4rem .8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink-2);
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.row-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--surface); box-shadow: none; }
.row-btn-danger:hover { border-color: #b23b3b; color: #b23b3b; background: #fdeceb; }

.empty-state { padding: 2.5rem 1.5rem; text-align: center; }
.empty-state-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: .35rem;
}
.empty-state p { margin: 0; }

@media (max-width: 900px) {
    .kpi-grid-3 { grid-template-columns: 1fr; }
    .product-form { grid-template-columns: 1fr; }
    .span-2, .span-3 { grid-column: auto; }
    .row-actions { flex-direction: column; align-items: stretch; }
}

/* ============================================================================
   Support tickets (detail layout, conversation thread, chips)
   ============================================================================ */
.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.25rem;
    align-items: start;
}
.meta-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .35rem .75rem;
    margin: 0;
}
.meta-list dt {
    color: var(--ink-3);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
    align-self: center;
}
.meta-list dd { margin: 0; overflow-wrap: anywhere; }
.thread { display: flex; flex-direction: column; gap: .75rem; }
.msg {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: .8rem 1rem;
    box-shadow: var(--shadow-1);
}
.msg-admin {
    background: var(--surface-3);
    border-left: 3px solid var(--brand);
}
.msg-note {
    background: var(--surface-2);
    border: 1px dashed var(--accent);
}
.msg-head { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.msg-author { font-weight: 600; }
.msg-kind {
    text-transform: uppercase;
    font-size: .68rem;
    letter-spacing: .04em;
    font-weight: 600;
    padding: .1rem .5rem;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--ink-2);
}
.msg-admin .msg-kind { background: var(--brand-soft); color: var(--brand-2); }
.msg-note .msg-kind { background: var(--accent-soft); color: var(--accent-2); }
.msg-time { margin-left: auto; color: var(--ink-3); font-size: .8rem; }
.msg-body { margin: .4rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.thread-composer { display: block; max-width: none; margin-top: 1.1rem; }
.thread-composer textarea {
    width: 100%;
    min-height: 7rem;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: .6rem .75rem;
    font: inherit;
}
.thread-composer-actions {
    display: flex;
    gap: .5rem;
    justify-content: flex-end;
    margin-top: .5rem;
    flex-wrap: wrap;
    border: 0;
    padding: 0;
}
.thread-composer-actions[disabled] { opacity: .6; }
.category-chip {
    display: inline-block;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .12rem .6rem;
    font-size: .78rem;
    white-space: nowrap;
}
@media (max-width: 820px) {
    .detail-grid { grid-template-columns: 1fr; }
}

/* ============================================================================
   Toasts (global htmx error / warning surface, see _Layout.cshtml)
   ============================================================================ */
#toast-region {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: grid;
    gap: .5rem;
    justify-items: center;
    pointer-events: none;
    width: min(92vw, 640px);
}
.toast {
    background: var(--ink);
    color: #fff;
    padding: .7rem 1.15rem;
    border-radius: var(--r-md);
    font-size: .9rem;
    line-height: 1.4;
    box-shadow: var(--shadow-3);
    max-width: 100%;
}
.toast-error { background: #fdeceb; color: #b23b3b; border: 1px solid #f3c6c3; }

/* ============================================================================
   Admin: Dashboard (home)
   ============================================================================ */
.admin-subtitle { margin: -.35rem 0 1.4rem; color: var(--ink-3); }

.admin-hero {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    background: linear-gradient(120deg, var(--brand-soft), var(--surface-3) 70%);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-xl);
    padding: 1.5rem 1.85rem;
    box-shadow: var(--shadow-1);
    margin-bottom: 1.1rem;
}
.admin-hero-kpi { min-width: 0; }
.admin-hero-kpi + .admin-hero-kpi {
    border-left: 1px solid rgba(10, 110, 79, .16);
    padding-left: 1.5rem;
}
.admin-hero-label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--brand-2);
    opacity: .75;
}
.admin-hero-value {
    font-family: var(--font-display);
    font-size: 2.15rem;
    font-weight: 800;
    color: var(--brand);
    line-height: 1.15;
    margin-top: .2rem;
    letter-spacing: -.02em;
    overflow-wrap: anywhere;
}
.admin-hero-sub { font-size: .82rem; color: var(--ink-3); margin-top: .15rem; }

.attention-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem;
    margin-bottom: 2rem;
}
.attention-title {
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-right: .3rem;
}
.attention-chip {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .38rem .95rem .38rem .45rem;
    font-size: .87rem;
    font-weight: 600;
    color: var(--ink-2);
    box-shadow: var(--shadow-1);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.attention-chip:hover {
    border-color: var(--accent);
    color: var(--accent-2);
    transform: translateY(-1px);
    box-shadow: var(--shadow-2);
}
.attention-count {
    min-width: 1.65rem;
    height: 1.65rem;
    padding: 0 .5rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent-2);
    font-weight: 800;
    font-size: .82rem;
}
.attention-clear {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: var(--brand-soft);
    border: 1px solid transparent;
    border-radius: 999px;
    padding: .42rem 1rem;
    font-size: .87rem;
    font-weight: 600;
    color: var(--brand-2);
}
.attention-clear svg { width: 15px; height: 15px; }

.admin-section { margin-bottom: 1.9rem; }
.admin-section-head {
    display: flex;
    align-items: center;
    gap: .9rem;
    margin-bottom: .85rem;
}
.admin-section-title {
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--ink-3);
    white-space: nowrap;
}
.admin-section-head::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
    gap: 1rem;
}
.tool-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
    padding: 1.15rem 1.25rem 1.2rem;
    box-shadow: var(--shadow-1);
    color: var(--ink);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.tool-card:hover {
    transform: translateY(-2px);
    border-color: var(--brand);
    box-shadow: var(--shadow-2);
    color: var(--ink);
}
.tool-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .15rem;
}
.tool-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    transition: background .16s ease, color .16s ease;
}
.tool-icon svg { width: 21px; height: 21px; }
.tool-card:hover .tool-icon { background: var(--brand); color: #fff; }
.tool-badge {
    border-radius: 999px;
    padding: .16rem .62rem;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
    background: var(--surface-2);
    color: var(--ink-2);
}
.tool-badge-attn { background: var(--accent-soft); color: var(--accent-2); }
.tool-badge-brand { background: var(--brand-soft); color: var(--brand-2); }
.tool-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.16rem;
    letter-spacing: -.01em;
    display: flex;
    align-items: center;
    gap: .45rem;
}
.tool-arrow {
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .16s ease, transform .16s ease;
    color: var(--brand);
    font-weight: 700;
}
.tool-card:hover .tool-arrow { opacity: 1; transform: translateX(0); }
.tool-desc { margin: 0; font-size: .875rem; line-height: 1.45; color: var(--ink-3); }

@media (max-width: 1020px) {
    .admin-hero { grid-template-columns: 1fr 1fr; row-gap: 1.15rem; }
    .admin-hero-kpi + .admin-hero-kpi { border-left: 0; padding-left: 0; }
}
@media (max-width: 560px) {
    .admin-hero { grid-template-columns: 1fr; }
}

/* ============================================================================
   Responsive
   ============================================================================ */
@media (max-width: 900px) {
    .product-details { grid-template-columns: 1fr; gap: 2rem; }
    .catalog-page { grid-template-columns: 1fr; }
    .checkout-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 1.75rem; }
    h1 { font-size: 2rem; }
}
@media (max-width: 640px) {
    .header-row { gap: .75rem; flex-wrap: wrap; }
    .search { width: 100%; max-width: none; }
    .topnav { gap: .85rem; font-size: .92rem; }
    .hero { padding: 3rem 1.25rem 2.5rem; }
    .footer-grid { grid-template-columns: 1fr; }
}
