:root {
    --color-primary: #1b6e4f;
    --color-primary-dark: #12503a;
    --color-primary-light: #e8f5ef;
    --color-accent: #e67e22;
    --color-accent-dark: #cc6a12;
    --color-text: #1a1a1a;
    --color-muted: #6b7280;
    --color-border: #e2e5e9;
    --color-bg: #f5f6f8;
    --color-error: #b3261e;
    --color-success: #1b6e4f;
    font-size: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, "Noto Sans Sinhala", "Noto Sans Tamil", Arial, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1670px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.site-header {
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.navbar {
    max-width: 1670px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    gap: 0.75rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.brand-mark {
    width: 52px;
    height: 52px;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-name {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.brand-tld {
    color: var(--color-primary);
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    margin: 0 auto;
    background: var(--color-text);
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 860px) {
    .nav-toggle { display: flex; }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.9rem;
        padding-top: 0.9rem;
        margin-top: 0.75rem;
        border-top: 1px solid var(--color-border);
    }

    .nav-links.open { display: flex; }

    .nav-links .locale-switch { display: flex; gap: 0.5rem; }
    .nav-links .locale-switch a { margin-left: 0; }
}

.nav-links a, .link-button {
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-links a:hover, .link-button:hover { color: var(--color-primary); }

.navbar-user {
    font-size: 0.85rem;
    color: var(--color-muted);
    background: var(--color-primary-light);
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 45vw;
    margin-right: auto;
}

.navbar-user strong { color: var(--color-text); }

.inline-form { display: inline; }

.locale-switch a {
    margin-left: 0.25rem;
    font-size: 0.78rem;
    color: var(--color-muted);
    font-weight: 600;
}

.locale-switch a.active { color: var(--color-primary); }

.site-footer {
    text-align: center;
    color: var(--color-muted);
    font-size: 0.85rem;
    padding: 2.5rem 1rem;
    margin-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-error { background: #fdeceb; color: var(--color-error); border: 1px solid #f3c8c4; }
.alert-success { background: #e8f5ef; color: var(--color-success); border: 1px solid #bfe3d2; }

.card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

/* Sectioned forms — used by every profile edit page and registration form,
   not just Admin > Edit User where this pattern started. Each logical
   group (Personal info, Identity, Business details, Location, etc.) gets
   its own bordered container instead of one long stacked column, laid out
   in a grid so the available width is actually used instead of wasted as
   empty margin either side of a narrow single-column form. */
.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
    align-items: start;
    margin-top: 1rem;
}

.form-section {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1.25rem;
}

.form-section h4 {
    margin: 0 0 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 1rem;
}

.form-section-wide { grid-column: 1 / -1; }

.form-section-actions {
    grid-column: 1 / -1;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

@media (max-width: 560px) {
    .section-grid { grid-template-columns: 1fr; }
    .form-section-actions { justify-content: stretch; }
    .form-section-actions .btn { width: 100%; }
}

/* Order lists (customer "My Orders", SE "Orders") — a plain vertical stack
   of full-width cards reads confusingly once each card carries a status
   badge, item list, payment reference and action buttons, so lay them out
   as a responsive grid instead. */
.orders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    align-items: start;
}

.orders-grid .card { margin-bottom: 0; }

@media (max-width: 700px) {
    .orders-grid { grid-template-columns: 1fr; }
}

/* --- Hero banner (homepage) --- */
.hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: #fff;
    border-radius: 14px;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.hero h1 {
    font-size: 2.2rem;
    margin: 0 0 0.6rem;
    color: #fff;
    letter-spacing: -0.02em;
}

.hero p {
    font-size: 1.05rem;
    color: #dcf0e6;
    max-width: 560px;
    margin: 0 auto 1.5rem;
}

.hero .btn { margin-top: 0; }
.hero .btn-outline {
    background: transparent;
    border: 1.5px solid #fff;
    color: #fff;
    margin-left: 0.5rem;
}
.hero .btn-outline:hover { background: rgba(255, 255, 255, 0.12); }

.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 2rem 0 1rem;
}

.section-heading h2 {
    margin: 0;
    font-size: 1.3rem;
}

/* --- Grids & product cards --- */
.grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.7rem;
}

.product-card {
    position: relative;
    padding: 0;
    overflow: hidden;
    border-radius: 4px;
    border-color: #eaecef;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
    box-shadow: none;
}

.product-card:hover {
    box-shadow: 0 2px 10px rgba(16, 24, 40, 0.12);
    border-color: #d5dae1;
}

/* Square, flush-to-edge image — AliExpress-style dense card grid. */
.product-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #eee;
    display: block;
}

.product-card-body {
    padding: 0.5rem 0.55rem 0.6rem;
}

.product-card h3 {
    margin: 0.1rem 0 0.3rem;
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.3em;
}

.product-card .price {
    color: var(--color-accent);
    font-weight: 700;
    font-size: 1.05rem;
    margin-top: 0.2rem;
}

.product-card .price .hint { font-size: 0.7rem; font-weight: 400; }
.product-card-body > p.hint { color: var(--color-muted); font-size: 0.72rem; }

/* SE's own "My Products" grid — required 1.91:1 upload ratio (wide,
   lightweight thumbnail) instead of the customer catalog's square crop.
   The no-image placeholder keeps the same ratio so a missing photo never
   leaves a gap or misaligns the grid. */
.se-products-grid .product-card img,
.se-products-grid .product-card-noimg {
    aspect-ratio: 1.91 / 1;
}

.se-products-grid .product-card-noimg {
    width: 100%;
    background: #f0f1f3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.6rem;
}

.product-card-actions .btn { margin-top: 0; }

@media (max-width: 1280px) {
    .grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
    .grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 560px) {
    .grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
}

.item-type-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    padding: 0.15rem 0.55rem;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.item-type-retail { background: #2563eb; }
.item-type-wholesale { background: #7c3aed; }
.item-type-service { background: var(--color-accent); }

/* Small thumbnail with a magnify affordance — hovering shows a larger
   floating preview (see .zoom-preview below). Kept deliberately small in
   normal flow to save page weight; nothing extra loads until hovered.
   Fills whatever container it's placed in (a product card, a fixed-width
   wrapper on the product detail page, etc) rather than capping itself —
   the product detail page pins an explicit width inline. */
.zoomable-thumb {
    position: relative;
    display: inline-block;
    cursor: zoom-in;
    width: 100%;
}

.zoomable-thumb img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
    background: #eee;
    display: block;
}

.plain-thumb {
    position: relative;
    display: inline-block;
    width: 100%;
}

.plain-thumb img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
    background: #eee;
    display: block;
}

/* Semi-transparent brand watermark on customer-facing product photos only
   (catalog cards + product detail page) — category card images are plain
   <img> tags outside these wrapper classes, so they're unaffected. */
.zoomable-thumb::after,
.plain-thumb::after {
    content: "";
    position: absolute;
    right: 4%;
    bottom: 4%;
    width: 22%;
    aspect-ratio: 1 / 1;
    background-image: url("../img/logo-icon.svg");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.65;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.9)) drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
    pointer-events: none;
}

/* Inside a product card, thumbs go square and flush (see .product-card img). */
.product-card .zoomable-thumb img,
.product-card .plain-thumb img { aspect-ratio: 1 / 1; }

/* Inside a product card the card itself clips to its rounded corners
   (overflow: hidden) and the image sits flush — no separate radius needed
   on the image, and no width cap since it should fill the card. */
.product-card .zoomable-thumb,
.product-card .plain-thumb { width: auto; }

.product-card .zoomable-thumb img,
.product-card .plain-thumb img { border-radius: 0; }

/* Circular hover-magnifier — follows the cursor near the thumbnail,
   showing a zoomed-in crop of the photo's real full-resolution pixels at
   whatever point the customer is pointing at (see lightbox.js). */
.zoom-lens {
    display: none;
    position: fixed;
    z-index: 1000;
    width: 300px;
    height: 300px;
    max-width: 80vw;
    max-height: 80vw;
    border-radius: 50%;
    border: 4px solid #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    background-color: #eee;
    background-repeat: no-repeat;
    pointer-events: none;
}

.zoom-lens.open { display: block; }

@media (max-width: 560px) {
    .zoom-lens { width: 220px; height: 220px; }
}

/* Click-to-view popup for uploaded documents (payment slips, etc.) — a
   single shared overlay per page, reused for whichever image was clicked
   via #image-modal-img.src, so it works from any number of order cards
   without needing one modal instance per card. */
.image-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.image-modal-overlay.open { display: flex; }

.image-modal-overlay img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.image-modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    background: none;
    border: none;
}

/* Per-order chat popup — same shared-overlay pattern as .image-modal-overlay,
   swapping the image for a message thread + reply box. */
.chat-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.chat-modal-overlay.open { display: flex; }

.chat-modal {
    background: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: 1.75rem;
}

.chat-modal-header h3 { font-size: 1rem; }

.chat-modal-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    background: var(--color-bg);
    min-height: 220px;
}

.chat-message {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.6rem;
    max-width: 85%;
}

.chat-message-mine {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    margin-left: auto;
}

.chat-message-meta {
    font-size: 0.72rem;
    color: var(--color-muted);
    margin-bottom: 0.2rem;
}

.chat-message-body {
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-modal-form {
    display: flex;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--color-border);
}

.chat-modal-form textarea {
    flex: 1;
    resize: none;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-family: inherit;
}

.chat-modal-form button {
    align-self: flex-end;
}

.chat-trigger { cursor: pointer; }

form.stacked label {
    display: block;
    font-weight: 600;
    margin: 0.75rem 0 0.25rem;
    font-size: 0.9rem;
}

form.stacked input[type=text],
form.stacked input[type=email],
form.stacked input[type=password],
form.stacked input[type=number],
form.stacked input[type=date],
form.stacked input[type=file],
form.stacked select,
form.stacked textarea {
    width: 100%;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: 7px;
    font-size: 1rem;
    background: #fff;
    transition: border-color 0.15s ease;
}

form.stacked input:focus,
form.stacked select:focus,
form.stacked textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* Custom chevron replaces the plain browser-native select arrow. */
form.stacked select,
select.select-nice {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 7.5 10 12.5 15 7.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 15px;
    padding-right: 2.3rem;
    cursor: pointer;
}

form.stacked select:hover,
select.select-nice:hover {
    border-color: var(--color-primary);
}

form.stacked select:disabled,
select.select-nice:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

form.stacked .hint {
    color: var(--color-muted);
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

/* Denser variant for forms that don't need the default generous spacing
   (e.g. the SE product form) — same fields, tighter rhythm, no wasted
   vertical/horizontal space. */
form.stacked.compact-form label {
    margin: 0.5rem 0 0.2rem;
}

form.stacked.compact-form input[type=text],
form.stacked.compact-form input[type=email],
form.stacked.compact-form input[type=number],
form.stacked.compact-form input[type=date],
form.stacked.compact-form input[type=file],
form.stacked.compact-form select,
form.stacked.compact-form textarea {
    padding: 0.45rem 0.6rem;
}

form.stacked.compact-form .hint {
    font-size: 0.78rem;
    margin-top: 0.1rem;
}

form.stacked.compact-form .field-row,
form.stacked.compact-form .field-row-3 {
    gap: 0.6rem;
}

.image-slot-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    width: 30%;
    min-width: 130px;
    max-width: 220px;
}

.image-slot-preview img {
    width: 100%;
    aspect-ratio: 1.91 / 1;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: #eee;
}

.image-slot-preview label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--color-error);
    margin: 0;
}

.image-slot-preview .variant-field,
.subcategory-usage-item .variant-field {
    width: 100%;
    font-size: 0.78rem;
    padding: 0.3rem 0.4rem;
    box-sizing: border-box;
}

.subcategory-usage-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

@media (max-width: 700px) {
    .subcategory-usage-grid {
        grid-template-columns: 1fr;
    }
}

.subcategory-usage-item img {
    width: 100%;
    aspect-ratio: 1.91 / 1;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: #eee;
}

.subcategory-usage-item .hint {
    margin: 0.1rem 0 0;
}

.subcategory-usage-item .variant-field {
    margin-top: 0.3rem;
}

.crop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.crop-modal {
    background: #fff;
    border-radius: 8px;
    padding: 1.25rem;
    max-width: 480px;
    width: 100%;
}

.crop-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 1.91 / 1;
    overflow: hidden;
    background: #222;
    border-radius: 6px;
    touch-action: none;
    cursor: grab;
}

.crop-viewport.dragging { cursor: grabbing; }

.crop-viewport img {
    position: absolute;
    top: 0;
    left: 0;
    max-width: none;
    transform-origin: 0 0;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

#crop-zoom { width: 100%; margin-top: 0.75rem; }

.crop-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

form.stacked .field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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

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

.geo-filter-bar label { margin-top: 0; font-size: 0.8rem; }
.geo-filter-bar { margin-bottom: 1.25rem; }

@media (max-width: 900px) {
    form.stacked .field-row-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
    form.stacked .field-row-4 { grid-template-columns: 1fr; }
    .geo-filter-bar .btn,
    .geo-filter-bar .btn-secondary {
        display: block;
        width: 100%;
        margin-top: 0.5rem;
        text-align: center;
    }
}

.btn {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 0.65rem 1.4rem;
    border-radius: 7px;
    font-size: 1rem;
    font-weight: 600;
    /* Buttons and links share this class everywhere, but a <button>'s
       browser-default line-height ("normal") doesn't match what an <a>
       inherits from body (1.5) — same padding/font-size still rendered a
       couple px shorter for every <button>. Pinning it here makes every
       .btn the same height as its siblings regardless of the tag. */
    line-height: 1.5;
    /* <button> and <a> default to slightly different baselines when they
       sit next to each other inline (e.g. Filter + Clear location) — this
       keeps them flush instead of one sitting 1-2px lower than the other. */
    vertical-align: middle;
    cursor: pointer;
    text-decoration: none;
    margin-top: 1rem;
    transition: background 0.15s ease, transform 0.1s ease;
}

.btn:hover { background: var(--color-primary-dark); }
.btn:active { transform: scale(0.98); }
.btn-accent { background: var(--color-accent); }
.btn-accent:hover { background: var(--color-accent-dark); }
.btn-secondary { background: #6c757d; }
.btn-danger { background: var(--color-error); }
.btn-small { padding: 0.35rem 0.75rem; font-size: 0.85rem; margin-top: 0; }

/* Facebook's own brand blue, so the Share button reads as "this goes to
   Facebook" at a glance rather than blending into the site's green palette. */
.btn-facebook {
    background: #1877f2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.btn-facebook:hover { background: #166fe5; }
.btn-facebook svg { flex-shrink: 0; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

table.data-table th, table.data-table td {
    text-align: left;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
}

table.data-table th {
    background: #fafbfc;
    font-weight: 600;
    color: var(--color-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-pending { background: #fff3cd; color: #8a6d1d; }
.badge-approved { background: #e8f5ef; color: var(--color-primary); }
.badge-rejected { background: #fdeceb; color: var(--color-error); }
.badge-info { background: #eef2ff; color: #3a4ba0; }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-muted);
}

.role-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.role-choice-card {
    display: block;
    text-decoration: none;
    color: var(--color-text);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.role-choice-card:hover { border-color: var(--color-primary); box-shadow: 0 6px 16px rgba(16, 24, 40, 0.08); }

/* On mobile, "Browse Categories" and "Filter by Location" are collapsed
   behind a tap-to-expand toggle by default so a first-time visitor sees
   product results without scrolling past both blocks first. Desktop keeps
   both always open (toggle button hidden, panel always visible). */
.mobile-collapsible-toggle {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--color-text);
    margin-bottom: 0.75rem;
    cursor: pointer;
}

.mobile-collapsible-toggle .chevron {
    color: var(--color-muted);
    transition: transform 0.15s ease;
}

.mobile-collapsible-toggle.open .chevron { transform: rotate(180deg); }

@media (max-width: 860px) {
    .mobile-collapsible-toggle { display: flex; }
    .mobile-collapsible-panel { display: none; }
    .mobile-collapsible-panel.open { display: block; }
}

/* --- Major-category cards (catalog browse) --- */
.catalog-category-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 220px));
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.catalog-category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

@media (max-width: 560px) {
    .catalog-category-cards { grid-template-columns: repeat(auto-fit, minmax(130px, 160px)); gap: 0.6rem; }
}

.catalog-category-card:hover { border-color: var(--color-primary); box-shadow: 0 6px 16px rgba(16, 24, 40, 0.08); }
.catalog-category-card.active { border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary); }

.catalog-category-card img,
.catalog-category-card-noimg {
    width: 100%;
    aspect-ratio: 1.91 / 1;
    object-fit: cover;
    background: #eee;
    display: block;
}

.catalog-category-card span {
    display: block;
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-weight: 600;
    text-align: center;
}

/* --- Dashboard nav cards (SE/Customer: Profile, Products, Orders, Cart...) --- */
.dashboard-nav-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.dashboard-nav-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid var(--color-border);
    border-top: 4px solid var(--color-primary);
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-nav-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(16, 24, 40, 0.1);
}

.dashboard-nav-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    border-radius: 12px;
    background: var(--color-primary-light);
    margin-bottom: 0.85rem;
}

.dashboard-nav-card h3 {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
}

.dashboard-nav-card .hint { margin: 0; }

.dashboard-nav-card-count {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    margin-left: 0.3rem;
    vertical-align: middle;
}

/* Accent modifiers — apply to whichever card should stand out from the
   default green (e.g. Products = orange, Orders/Cart = blue), reused
   across every role's dashboard rather than being role-specific. */
.dashboard-nav-card-orange { border-top-color: var(--color-accent); }
.dashboard-nav-card-orange .dashboard-nav-card-icon { background: #fdf1e6; }

.dashboard-nav-card-blue { border-top-color: #2f6fed; }
.dashboard-nav-card-blue .dashboard-nav-card-icon { background: #e8f0fe; }

.dashboard-order-stats {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--color-border);
}

.dashboard-order-stat {
    flex: 1;
    text-align: center;
    border-radius: 8px;
    padding: 0.5rem 0.25rem;
}

.dashboard-order-stat-count {
    display: block;
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.1;
}

.dashboard-order-stat-label {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
    margin-top: 0.15rem;
}

.dashboard-order-stat-new { background: #fff3cd; }
.dashboard-order-stat-new .dashboard-order-stat-count { color: #8a6d1d; }

.dashboard-order-stat-process { background: #e8f0fe; }
.dashboard-order-stat-process .dashboard-order-stat-count { color: #2f6fed; }

.dashboard-order-stat-completed { background: var(--color-primary-light); }
.dashboard-order-stat-completed .dashboard-order-stat-count { color: var(--color-primary); }

@media (max-width: 480px) {
    .dashboard-order-stats { flex-direction: column; }
}

/* --- Dashboard hero banner (GN/DS officer identity strip) --- */
.dashboard-hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border: none;
    border-radius: 14px;
    padding: 1.5rem 1.75rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dashboard-hero-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    font-size: 1.75rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.dashboard-hero-role { color: #dcf0e6; margin: 0; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.dashboard-hero h1 { margin: 0.15rem 0; color: #fff; }
.dashboard-hero-meta { margin: 0; color: #dcf0e6; }

/* --- Dashboard stat cards (GN/DS oversight numbers) --- */
.dashboard-stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dashboard-stat-card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.1rem 1rem;
    text-align: center;
}

.dashboard-stat-card-icon { font-size: 1.3rem; display: block; margin-bottom: 0.3rem; }
.dashboard-stat-card-count { display: block; font-size: 1.7rem; font-weight: 800; color: var(--color-primary); line-height: 1.1; }
.dashboard-stat-card-label { display: block; margin-top: 0.25rem; color: var(--color-muted); font-size: 0.82rem; }

.dashboard-stat-card-attention {
    border-color: #ffe69c;
    background: #fffdf5;
}
.dashboard-stat-card-attention .dashboard-stat-card-count { color: #8a6d1d; }

.dashboard-stat-card-danger .dashboard-stat-card-count { color: var(--color-error); }

/* --- SE storefront banner --- */
.storefront-banner {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: 14px;
    padding: 2rem;
    color: #fff;
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.storefront-banner img {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

.storefront-banner h1 { color: #fff; margin: 0 0 0.25rem; }
.storefront-banner p { color: #dcf0e6; margin: 0.15rem 0; }

/* --- Admin panel: left sidebar shell --- */
.admin-body {
    background: #f1f3f6;
}

.admin-shell {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

.admin-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: #10182a;
    color: #cfd6e4;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    flex-shrink: 0;
    object-fit: contain;
}

.admin-brand-name { font-weight: 700; color: #fff; font-size: 1rem; letter-spacing: -0.01em; }
.admin-brand-sub { font-size: 0.72rem; color: #8f9bb3; text-transform: uppercase; letter-spacing: 0.04em; }

.admin-nav {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    gap: 0.15rem;
    flex: 1;
}

.admin-nav a {
    display: block;
    padding: 0.6rem 0.85rem;
    border-radius: 7px;
    color: #cfd6e4;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
}

.admin-nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.admin-nav a.active { background: var(--color-primary); color: #fff; }

.admin-sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.admin-sidebar-footer a,
.admin-sidebar-footer .link-button {
    color: #8f9bb3;
    text-decoration: none;
    font-size: 0.82rem;
    text-align: left;
    background: none;
    border: none;
    padding: 0.35rem 0.85rem;
    cursor: pointer;
}

.admin-sidebar-footer a:hover,
.admin-sidebar-footer .link-button:hover { color: #fff; }

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

.admin-topbar {
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    padding: 1.1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-topbar h1 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: -0.01em;
}

.admin-topbar-user {
    font-size: 0.82rem;
    color: var(--color-muted);
    background: var(--color-primary-light);
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
}

.admin-content {
    padding: 1.75rem 2rem;
    max-width: 1200px;
    width: 100%;
}

@media (max-width: 900px) {
    .admin-shell { flex-direction: column; }
    .admin-sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
    .admin-nav { flex-direction: row; flex-wrap: wrap; }
    .admin-sidebar-footer { flex-direction: row; border-top: none; }
    .admin-content { padding: 1.25rem; }
    .admin-topbar { padding: 1rem 1.25rem; }
}

@media (max-width: 640px) {
    form.stacked .field-row { grid-template-columns: 1fr; }
    .hero { padding: 2rem 1.25rem; }
    .hero h1 { font-size: 1.6rem; }
}
