/* =========================================================
   DibsCart Application Styles
   ========================================================= */

/* ---------------------------------------------------------
   Theme aliases
   The real values are injected from app.php as CSS variables.
   These aliases keep the rest of the stylesheet readable.
   --------------------------------------------------------- */
:root {
    --ink: var(--text, #242638);
    --muted-color: var(--muted, #6e7183);
    --paper: var(--surface, #ffffff);
    --wash: var(--background, #f7f5fb);
    --brand: var(--primary, #9d3b7a);
    --brand2: var(--primary-alt, #db8dbd);
    --line: var(--border, #e7e2ea);
}

/* ---------------------------------------------------------
   Reset / base
   --------------------------------------------------------- */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--wash);
    color: var(--ink);
    font-family: Inter, Arial, sans-serif;
    line-height: 1.5;
}

img {
    max-width: 100%;
}

a {
    color: inherit;
}

.wrap {
    width: min(1160px, calc(100% - 32px));
    margin-inline: auto;
}

/* ---------------------------------------------------------
   Header / navigation
   --------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface, #ffffff);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    display: flex;
    min-height: 74px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
}

.brand small {
    display: block;
    color: var(--muted-color);
    font-size: 0.75rem;
}

.mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    color: var(--surface, #ffffff);
    font-size: 1.3rem;
    font-weight: 800;
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 48px;
    flex: 0 0 auto;
}

.brand-logo img {
    display: block;
    max-width: 100%;
    max-height: 48px;
    width: auto;
    height: auto;
    object-fit: contain;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

nav a {
    color: var(--ink);
    font-weight: 650;
    text-decoration: none;
}

/* ---------------------------------------------------------
   Page typography / layout
   --------------------------------------------------------- */
main {
    padding: 36px 0 60px;
}

h1 {
    margin: 0 0 28px;
    font-size: clamp(2rem, 5vw, 3.2rem);
}

h2 {
    margin: 0.25rem 0 1rem;
}

.muted {
    color: var(--muted-color);
}

.footer {
    padding-top: 30px;
    color: var(--muted-color);
    font-size: 0.85rem;
}

/* ---------------------------------------------------------
   Forms / buttons
   --------------------------------------------------------- */
input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--field-border, #d6d0da);
    border-radius: 10px;
    background: var(--surface, #ffffff);
    color: var(--ink);
    font: inherit;
}

textarea {
    resize: vertical;
}

label {
    display: grid;
    gap: 7px;
    margin-bottom: 16px;
    font-weight: 650;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border: 0;
    border-radius: 10px;
    background: var(--brand);
    color: var(--surface, #ffffff);
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}

button:disabled,
.button[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
}

.secondary {
    background: var(--secondary, #45485c);
}

.danger-button {
    background: var(--danger-text, #8d2323);
}

.small-button {
    padding: 7px 10px;
    font-size: 0.8rem;
}

/* ---------------------------------------------------------
   Shared layout helpers
   --------------------------------------------------------- */
.filters,
.toolbar,
.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
}

.filters input,
.toolbar input {
    min-width: 260px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.inline {
    display: flex;
    gap: 8px;
}

.inline select {
    min-width: 120px;
}

.panel {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface, #ffffff);
    box-shadow: 0 10px 30px rgba(35, 25, 45, 0.05);
}

.narrow {
    max-width: 600px;
}

.empty {
    padding: 50px;
    color: var(--muted-color);
    text-align: center;
}

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

.product-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface, #ffffff);
    box-shadow: 0 8px 24px rgba(35, 25, 45, 0.05);
}

.product-image {
    display: grid;
    aspect-ratio: 4 / 3;
    place-items: center;
    background: linear-gradient(
        135deg,
        var(--primary-soft-alt, #f0dce9),
        var(--primary-soft, #f7edf3)
    );
}

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

.product-image span {
    color: var(--brand);
    font-size: 4rem;
    font-weight: 800;
}

.product-body {
    padding: 18px;
}

.eyebrow {
    color: var(--brand);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.product-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 18px 0;
}

/* ---------------------------------------------------------
   Dashboard stats
   --------------------------------------------------------- */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.stats div {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface, #ffffff);
}

.stats strong {
    display: block;
    font-size: 2rem;
}

.stats span {
    color: var(--muted-color);
}

/* ---------------------------------------------------------
   Tables
   --------------------------------------------------------- */
.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface, #ffffff);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--surface-alt, #faf8fb);
}


/* Product editor */

.product-edit-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.product-edit-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) 1fr;
    gap: 24px;
    align-items: start;
    margin-bottom: 22px;
}

.product-edit-image {
    min-width: 0;
}

.product-image-preview {
    width: 100%;
    aspect-ratio: 1 / 1;
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface, #fff);
}

.product-image-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-image-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: var(--muted-color);
}

.product-category-fieldset {
    width: 100%;
    margin: 0 0 18px;
    padding: 14px 16px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.category-checkbox-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 8px 16px;
    max-height: 230px;
    overflow-y: auto;
    padding: 6px 8px 6px 2px;
    margin-bottom: 8px;
}

.category-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 5px 0;
}

.category-checkbox input {
    width: auto;
    flex: 0 0 auto;
    margin: 0;
}

.category-checkbox span {
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .product-edit-layout {
        grid-template-columns: 200px 1fr;
    }
    .category-checkbox-list {
        grid-template-columns: repeat(3, minmax(140px, 1fr));
    }
}

@media (max-width: 760px) {
    .product-edit-layout {
        grid-template-columns: 1fr;
    }
    .product-edit-image {
        max-width: 280px;
    }
    .category-checkbox-list {
        grid-template-columns: repeat(2, minmax(130px, 1fr));
    }
}

@media (max-width: 480px) {
    .category-checkbox-list {
        grid-template-columns: 1fr;
    }
}

/* ---------------------------------------------------------
   Notices
   --------------------------------------------------------- */
.notice {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 10px;
}

.success {
    background: var(--success-bg, #e8f7ee);
    color: var(--success-text, #17623a);
}

.error {
    background: var(--danger-bg, #fdeaea);
    color: var(--danger-text, #8d2323);
}

/* ---------------------------------------------------------
   Base responsive rules
   --------------------------------------------------------- */
@media (max-width: 760px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 0;
    }

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

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

    .filters > * {
        width: 100%;
    }

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

@media (max-width: 480px) {
    .product-grid,
    .stats {
        grid-template-columns: 1fr;
    }
}

/* Inventory search and pagination */
.inventory-search {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.search-field-wrap {
    position: relative;
    min-width: min(420px, 100%);
}

.search-suggestions {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    overflow: hidden;
    background: var(--surface,#fff);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 14px 35px rgba(35, 25, 45, .14);
}

.search-suggestion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 14px;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
}

.search-suggestion:last-child {
    border-bottom: 0;
}

.search-suggestion:hover,
.search-suggestion:focus {
    background: var(--surface-alt, #faf4f8);
}

.search-suggestion span,
.search-suggestion-empty,
.inventory-result-summary {
    color: var(--muted-color);
}

.search-suggestion-empty {
    padding: 14px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pagination-pages a,
.current-page {
    display: inline-flex;
    min-width: 40px;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface,#fff);
    color: var(--ink);
    text-decoration: none;
}

.current-page {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--surface,#fff);
    font-weight: 750;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 760px) {
    .inventory-search,
    .search-field-wrap {
        width: 100%;
    }
}


/* Inventory product thumbnails */
.inventory-image-heading,
.inventory-image-cell {
    width: 84px;
}

.inventory-image-cell {
    padding-top: 9px;
    padding-bottom: 9px;
}

.inventory-thumb {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-soft-alt,#f0dce9), var(--primary-soft,#f7edf3));
    color: var(--brand);
    text-decoration: none;
}

.inventory-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.inventory-thumb span {
    font-size: 1.5rem;
    font-weight: 800;
}

.inventory-product-name {
    font-weight: 650;
}

.inventory-product-name a {
    color: var(--ink);
    text-decoration: none;
}

.inventory-product-name a:hover,
.inventory-product-name a:focus {
    color: var(--brand);
    text-decoration: underline;
}

@media (max-width: 760px) {
    .inventory-thumb {
        width: 52px;
        height: 52px;
    }

    .inventory-image-heading,
    .inventory-image-cell {
        width: 72px;
    }
}

/* Public storefront */
.shop-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr);
    gap: 28px;
    align-items: stretch;
    margin: -4px 0 28px;
    padding: clamp(24px, 4vw, 38px);
    border: 1px solid var(--line);
    border-radius: 24px;
    background: linear-gradient(135deg, var(--surface,#fff) 0%, var(--surface,#fff) 55%, #f6e8f1 100%);
    box-shadow: 0 14px 40px rgba(35,25,45,.06);
}

.shop-hero h2 {
    max-width: 760px;
    margin: .35rem 0 .7rem;
    font-size: clamp(1.65rem, 3vw, 2.55rem);
    line-height: 1.12;
}

.shop-kicker {
    margin: 0;
    color: var(--brand);
    font-size: .76rem;
    font-weight: 850;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.shop-intro {
    max-width: 720px;
    margin: 0;
    color: var(--muted-color);
    font-size: 1.02rem;
}

.shop-hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.shop-hero-stats div {
    display: flex;
    min-height: 128px;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
    border: 1px solid rgba(157,59,122,.13);
    border-radius: 18px;
    background: rgba(255,255,255,.8);
}

.shop-hero-stats strong {
    display: block;
    color: var(--brand);
    font-size: 2rem;
    line-height: 1;
}

.shop-hero-stats span {
    margin-top: 8px;
    color: var(--muted-color);
    font-size: .82rem;
}

.shop-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface,#fff);
}

.shop-search-field {
    flex: 1 1 320px;
}

.shop-category-field {
    flex: 0 1 230px;
}

.shop-results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 0 0 20px;
    color: var(--muted-color);
    font-size: .9rem;
}

.shop-results-bar p {
    margin: 0;
    color: var(--ink);
    font-weight: 700;
}

.shop-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}

.shop-product-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.shop-product-card:hover {
    transform: translateY(-2px);
    border-color: var(--field-border, #d8c7d3);
    box-shadow: 0 14px 34px rgba(35,25,45,.09);
}

.shop-product-image {
    aspect-ratio: 1 / 1;
    color: var(--brand);
    text-decoration: none;
}

.shop-product-image img {
    object-fit: cover;
}

.shop-product-name {
    min-height: 2.6em;
    margin: .3rem 0 .7rem;
    font-size: 1.03rem;
    line-height: 1.3;
}

.shop-product-name a {
    color: var(--ink);
    text-decoration: none;
}

.shop-product-name a:hover,
.shop-product-name a:focus {
    color: var(--brand);
}

.shop-product-meta {
    gap: 10px;
    margin: 0 0 14px;
}

.shop-product-meta strong {
    font-size: 1.08rem;
}

.availability-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--primary-soft, #f5edf3);
    color: var(--primary, #7b315f);
    font-size: .78rem;
    font-weight: 750;
    white-space: nowrap;
}

.shop-claim-button {
    width: 100%;
    margin-top: auto;
}

.shop-empty {
    padding: 64px 22px;
    border: 1px dashed var(--field-border, #d7ced7);
    border-radius: 20px;
    background: var(--surface,#fff);
}

.shop-empty h2 {
    margin-bottom: .35rem;
}

.shop-empty p {
    margin: 0 auto 18px;
    max-width: 560px;
}

/* Public claim page */
.claim-layout {
    display: grid;
    grid-template-columns: minmax(300px, .8fr) minmax(0, 1.2fr);
    gap: 26px;
    align-items: start;
}

.claim-product-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface,#fff);
    box-shadow: 0 10px 30px rgba(35,25,45,.05);
}

.claim-product-image {
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: linear-gradient(135deg,var(--primary-soft-alt,#f0dce9),var(--primary-soft,#f7edf3));
}

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

.claim-product-image span {
    color: var(--brand);
    font-size: 5rem;
    font-weight: 850;
}

.claim-product-summary {
    padding: 22px;
}

.claim-product-summary h2 {
    margin: .35rem 0 .7rem;
    font-size: 1.55rem;
}

.claim-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.claim-price-row strong {
    font-size: 1.35rem;
}

.claim-back-link {
    display: inline-block;
    margin-top: 8px;
    color: var(--brand);
    font-weight: 700;
    text-decoration: none;
}

.claim-back-link:hover,
.claim-back-link:focus {
    text-decoration: underline;
}

.claim-form-panel {
    border-radius: 22px;
}

.claim-form-panel > h2 {
    margin: .35rem 0 .5rem;
    font-size: 1.65rem;
}

.claim-form {
    margin-top: 22px;
}

.optional-label {
    color: var(--muted-color);
    font-size: .75rem;
    font-weight: 500;
}

.claim-submit-button {
    width: 100%;
    margin-top: 4px;
}

@media (max-width: 820px) {
    .shop-hero,
    .claim-layout {
        grid-template-columns: 1fr;
    }

    .shop-hero-stats {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .shop-hero {
        padding: 22px;
    }

    .shop-hero-stats {
        grid-template-columns: 1fr;
    }

    .shop-hero-stats div {
        min-height: auto;
    }

    .shop-filters > *,
    .shop-search-field,
    .shop-category-field {
        width: 100%;
        flex-basis: 100%;
    }

    .shop-results-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .shop-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .shop-product-card .product-body {
        padding: 13px;
    }

    .shop-product-name {
        font-size: .92rem;
    }

    .shop-product-meta {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 390px) {
    .shop-product-grid {
        grid-template-columns: 1fr;
    }
}

/* Session-based multi-item claiming */
.returning-shopper-note {
    display: grid;
    gap: 3px;
    margin: 16px 0 4px;
    padding: 14px 16px;
    border: 1px solid var(--border, #ead6e3);
    border-radius: 14px;
    background: var(--primary-soft, #f7edf3);
}

.returning-shopper-note strong {
    color: var(--ink);
}

.returning-shopper-note span {
    color: var(--muted-color);
    font-size: .9rem;
}

.my-claims-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
    border-radius: 20px;
}

.my-claims-hero h2 {
    margin: .25rem 0 .35rem;
}

.my-claims-hero p {
    margin-bottom: 0;
}

.my-claims-list {
    display: grid;
    gap: 12px;
}

.my-claim-card {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface,#fff);
}

.my-claim-image {
    width: 84px;
    height: 84px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(135deg,var(--primary-soft-alt,#f0dce9),var(--primary-soft,#f7edf3));
}

.my-claim-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.my-claim-image span {
    color: var(--brand);
    font-size: 2rem;
    font-weight: 850;
}

.my-claim-copy h2 {
    margin: 0 0 4px;
    font-size: 1.08rem;
}

.my-claim-copy p {
    margin: 0 0 8px;
    color: var(--muted-color);
}

.claim-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--surface-alt, #f4f1f4);
    color: var(--muted-color);
    font-size: .76rem;
    font-weight: 750;
}

.claim-status-reserved,
.claim-status-paid {
    background: var(--warning-bg, #fff4d9);
    color: var(--warning-text,#79550a);
}

.claim-status-sold {
    background: var(--success-bg, #e6f6ec);
    color: var(--success-text, #21683a);
}

.claim-status-cancelled {
    background: var(--danger-bg, #f6e8e8);
    color: var(--danger-text, #8a3535);
}

.my-claim-total {
    display: grid;
    gap: 2px;
    text-align: right;
}

.my-claim-total span {
    color: var(--muted-color);
    font-size: .78rem;
}

.my-claim-total strong {
    font-size: 1.05rem;
}

.my-claims-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
}

.my-claims-actions p {
    margin: 0;
}

@media (max-width: 600px) {
    .my-claims-hero,
    .my-claims-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .my-claim-card {
        grid-template-columns: 70px minmax(0, 1fr);
    }

    .my-claim-image {
        width: 70px;
        height: 70px;
    }

    .my-claim-total {
        grid-column: 2;
        text-align: left;
    }
}

/* ---------------------------------------------------------
   Reusable installation controls
   --------------------------------------------------------- */
.inventory-category-filter {
    min-width: 180px;
}

.bulk-category-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    padding: 14px;
    border: 1px solid var(--border, #e7e2ea);
    border-radius: 14px;
    background: var(--surface, #ffffff);
}

.bulk-category-toolbar select {
    width: auto;
    min-width: 190px;
}

.inventory-select-heading {
    width: 42px;
}

.category-manager-intro {
    margin-bottom: 20px;
}

.category-manager-grid {
    display: grid;
    grid-template-columns: minmax(260px, 0.65fr) minmax(420px, 1.35fr);
    gap: 20px;
}

.category-list {
    display: grid;
    gap: 10px;
}

.category-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border, #e7e2ea);
}

.category-row:last-child {
    border-bottom: 0;
}

.category-rename-form {
    display: grid;
    flex: 1;
    grid-template-columns: minmax(180px, 1fr) auto auto;
    align-items: center;
    gap: 8px;
}

.category-usage {
    white-space: nowrap;
}

.claim-workflow-panel {
    margin-bottom: 20px;
}

.claims-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.claim-filter-nav,
.claims-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.claim-filter-nav a {
    padding: 9px 12px;
    border: 1px solid var(--border, #e7e2ea);
    border-radius: 9px;
    background: var(--surface, #ffffff);
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
}

.claim-filter-nav a.active {
    border-color: var(--primary, #9d3b7a);
    background: var(--primary, #9d3b7a);
    color: var(--surface, #ffffff);
}

.claims-actions form,
.archive-inline {
    margin: 0;
}

.archive-inline {
    margin-top: 7px;
}

.returning-shopper-note {
    background: var(--primary-soft, #f7edf3);
    border: 1px solid var(--border, #e7e2ea);
}

@media (max-width: 760px) {
    .category-manager-grid {
        grid-template-columns: 1fr;
    }

    .category-rename-form {
        grid-template-columns: 1fr;
    }

    .bulk-category-toolbar > * {
        width: 100%;
    }

    .bulk-category-toolbar select {
        width: 100%;
    }

    .claims-toolbar {
        align-items: stretch;
    }

    .claim-filter-nav,
    .claims-actions {
        width: 100%;
    }
}

/* ---------------------------------------------------------
   Demo mode banners
   --------------------------------------------------------- */
.demo-banner {
    margin: 20px 0 6px;
    padding: 12px 16px;
    border: 1px solid var(--border, #e7e2ea);
    border-radius: 12px;
    font-weight: 800;
    text-align: center;
}

.demo-banner-public {
    background: var(--warning-bg, #fff4d9);
    color: var(--warning-text, #79550a);
}

.demo-banner-admin {
    background: var(--primary-soft, #f7edf3);
    color: var(--primary, #9d3b7a);
}

/* ---------------------------------------------------------
   Settings
   --------------------------------------------------------- */

.logo-settings {
    display: grid;
    grid-template-columns: minmax(140px, 220px) 1fr;
    gap: 24px;
    align-items: end;
    margin: 14px 0 24px;
}

.logo-preview-wrap,
.logo-upload-field {
    min-width: 0;
}

.settings-label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
}

.logo-preview {
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border: 1px solid var(--field-border);
    border-radius: 12px;
    background: var(--surface-alt);
}

.logo-preview img {
    display: block;
    max-width: 100%;
    max-height: 72px;
    object-fit: contain;
}

.remove-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: .9rem;
    font-weight: 600;
}

.remove-logo input {
    width: auto;
}

.settings-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.settings-head p {
    margin-top: 0;
}

.settings-demo-note {
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--primary-soft, #f7edf3);
    color: var(--primary, #9d3b7a);
    font-weight: 700;
}

.settings-form {
    display: grid;
    gap: 18px;
}

.settings-section h2 {
    margin-top: 0;
    margin-bottom: 6px;
}

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

.settings-stack {
    display: grid;
    gap: 14px;
    margin-top: 14px;
}

.settings-field {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

.settings-field input,
.settings-field textarea,
.settings-field select {
    width: 100%;
    font-weight: 400;
}

/* Branding color controls */
.color-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(280px, 1fr));
    gap: 24px 32px;
}

.color-field {
    display: grid;
    min-width: 0;
    gap: 8px;
    margin-bottom: 0;
    font-weight: 700;
}

.color-control {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
}

.color-picker {
    flex: 0 0 58px;
    width: 58px;
    min-width: 58px;
    height: 44px;
    padding: 3px;
    border: 1px solid var(--field-border, #d6d0da);
    border-radius: 8px;
    background: var(--surface, #ffffff);
    cursor: pointer;
}

.color-hex {
    flex: 0 0 130px;
    width: 130px !important;
    min-width: 130px !important;
    max-width: 130px;
    height: 44px;
    padding: 10px 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.settings-actions {
    position: sticky;
    bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border, #e7e2ea);
    border-radius: 14px;
    background: color-mix(in srgb, var(--background, #f7f5fb) 88%, transparent);
    backdrop-filter: blur(10px);
}

@media (max-width: 1000px) {
    .color-grid {
        grid-template-columns: repeat(2, minmax(280px, 1fr));
    }
}

@media (max-width: 680px) {
    .settings-head {
        display: block;
    }

    .settings-grid,
    .color-grid {
        grid-template-columns: 1fr;
    }

    .settings-head .button {
        margin-top: 8px;
    }
}


/* ---------------------------------------------------------
   Footer / DibsCart attribution
   --------------------------------------------------------- */
.footer {
    padding-top: 30px;
    padding-bottom: 30px;
    color: var(--muted-color);
    font-size: 0.85rem;
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}


.dibscart-powered {
    white-space: nowrap;
}

.dibscart-powered a {
    color: var(--brand);
    font-weight: 800;
    text-decoration: none;
}

.dibscart-powered a:hover,
.dibscart-powered a:focus {
    text-decoration: underline;
}

@media (max-width: 600px) {
    .footer-inner {
        align-items: flex-end;
        flex-direction: column;
        text-align: right;
    }
}

@media (max-width: 700px) {
    .logo-settings { grid-template-columns: 1fr; align-items: stretch; }
    .brand-logo { width: 46px; }
}

/* Core version marker */
.dibscart-version {
    font-size: .78rem;
    color: var(--muted-color, #6e7183);
    opacity: .8;
    white-space: nowrap;
}

/* Storefront pagination */
.shop-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin: 32px 0 8px;
}

.shop-pagination .pagination-pages {
    justify-content: center;
}

.pagination-button,
.pagination-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface, #fff);
    color: var(--ink);
    text-decoration: none;
    font-weight: 650;
}

.pagination-page {
    min-width: 40px;
    padding-left: 10px;
    padding-right: 10px;
}

.pagination-button:hover,
.pagination-button:focus,
.pagination-page:hover,
.pagination-page:focus {
    border-color: var(--brand);
    color: var(--brand);
}

.pagination-page.current {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--surface, #fff);
}

.pagination-button.disabled {
    opacity: .45;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 0 4px;
    color: var(--muted-color);
}

@media (max-width: 600px) {
    .shop-pagination {
        gap: 10px;
    }

    .shop-pagination .pagination-pages {
        order: 3;
        width: 100%;
    }

    .pagination-button {
        flex: 1;
        max-width: 160px;
    }
}


/* ---------------------------------------------------------
   Ask Dibs
   --------------------------------------------------------- */
.ask-dibs-shell {
    display: grid;
    gap: 28px;
}

.ask-dibs-guide {
    display: grid;
    grid-template-columns: minmax(320px, 42%) minmax(0, 1fr);
    gap: 28px;
    align-items: center;
    padding: 24px;
    overflow: hidden;
}

.ask-dibs-guide-image {
    width: 100%;
    max-width: 520px;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 14px;
    background: var(--surface-alt, #faf8fb);
}

.ask-dibs-guide-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 43% 27%;
}

.ask-dibs-guide-copy {
    padding: 4px 8px 4px 0;
}

.ask-dibs-guide-copy .eyebrow {
    margin-bottom: 6px;
}

.ask-dibs-guide-copy h2 {
    margin: 0 0 14px;
}

.ask-dibs-guide-copy > p:not(.eyebrow) {
    margin: 0;
    max-width: 680px;
}

.ask-dibs-guide-note {
    margin-top: 20px;
    padding: 0;
    background: transparent;
}

.ask-dibs-guide-note strong,
.ask-dibs-guide-note span {
    display: inline;
}

.ask-dibs-guide-note strong {
    color: var(--text, #171522);
    margin-right: 4px;
}

.ask-dibs-guide-note span {
    color: var(--text, #171522);
    font-size: 1rem;
}

.ask-dibs-chat {
    display: grid;
    grid-template-rows: auto minmax(230px, auto) auto auto;
    min-height: 0;
    padding: 24px;
}

.ask-dibs-chat-header {
    display: block;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.ask-dibs-chat-header h2 {
    margin: 0 0 6px;
}

.ask-dibs-chat-header p {
    margin: 0 0 14px;
}

.ask-dibs-new-conversation {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.ask-dibs-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 150px;
    max-height: 430px;
    overflow-y: auto;
    padding: 18px 4px 18px 0;
    scroll-behavior: smooth;
}

.ask-dibs-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 88%;
}

.ask-dibs-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ask-dibs-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--brand);
    color: var(--surface, #fff);
    font-size: .76rem;
    font-weight: 850;
}

.ask-dibs-message.user .ask-dibs-avatar {
    background: var(--secondary, #45485c);
}

.ask-dibs-bubble {
    min-width: 0;
    padding: 8px 0;
    border: 0;
    background: transparent;
}

.ask-dibs-message.user .ask-dibs-bubble {
    padding: 12px 14px;
    border-radius: 16px 6px 16px 16px;
    background: var(--brand);
    color: var(--surface, #fff);
}

.ask-dibs-bubble strong {
    display: block;
    margin-bottom: 5px;
    font-size: .86rem;
}

.ask-dibs-bubble p {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ask-dibs-request-id {
    display: block;
    margin-top: 8px;
    color: var(--muted-color);
    font-size: .7rem;
}

.ask-dibs-message.user .ask-dibs-request-id {
    color: rgba(255,255,255,.75);
}

.ask-dibs-form {
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.ask-dibs-form textarea {
    min-height: 100px;
}

.ask-dibs-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 10px;
}

.ask-dibs-tip {
    font-size: .8rem;
}

.ask-dibs-status {
    min-height: 1.4em;
    padding-top: 8px;
    font-size: .82rem;
}

.ask-dibs-dots {
    display: flex;
    gap: 5px;
    padding: 8px 2px 3px;
}

.ask-dibs-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted-color);
    animation: ask-dibs-pulse 1.1s infinite ease-in-out;
}

.ask-dibs-dots span:nth-child(2) {
    animation-delay: .15s;
}

.ask-dibs-dots span:nth-child(3) {
    animation-delay: .3s;
}

@keyframes ask-dibs-pulse {
    0%, 60%, 100% { opacity: .35; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

@media (max-width: 900px) {
    .ask-dibs-guide {
        grid-template-columns: 1fr;
    }

    .ask-dibs-guide-image {
        max-width: none;
    }

    .ask-dibs-guide-copy {
        padding: 0;
    }
}

@media (max-width: 620px) {
    .ask-dibs-shell {
        gap: 20px;
    }

    .ask-dibs-guide,
    .ask-dibs-chat {
        padding: 18px;
    }

    .ask-dibs-guide {
        gap: 18px;
    }

    .ask-dibs-guide-image {
        aspect-ratio: 16 / 9;
    }

    .ask-dibs-form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .ask-dibs-message {
        max-width: 96%;
    }

    .ask-dibs-tip {
        order: 2;
    }
}


/* DibsCart 1.3 sharing */

.shop-card-actions {
    display: flex;
    flex-direction: column;
    gap: .7rem;
    padding-top: .25rem;
}

.shop-card-actions .button,
.shop-card-actions button {
    width: 100%;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.shop-claim-button {
    width: 100%;
    margin-top: 0;
}

.share-button {
    width: 100%;
    cursor: pointer;
}

.product-share-actions {
    display: flex;
    gap: .65rem;
    align-items: stretch;
    flex-wrap: wrap;
}

.product-detail-layout {
    margin-top: 1rem;
}

/* Primary button visibility safeguard */
button:not(.secondary):not(.danger-button),
.button:not(.secondary):not(.danger-button) {
    background-color: var(--primary, #6f42c1) !important;
    color: #ffffff !important;
}

button:not(.secondary):not(.danger-button):hover,
.button:not(.secondary):not(.danger-button):hover {
    background-color: var(--primary-alt, #9a78d4) !important;
    color: #ffffff !important;
}

/* =========================================================
   DibsCart Admin Sidebar
   ========================================================= */

.admin-body {
    background: var(--page-bg, #f7f6f8);
}

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--surface, #ffffff);
    border-right: 1px solid var(--line);
    z-index: 30;
}

.admin-sidebar-brand {
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

.admin-sidebar-brand .brand {
    min-width: 0;
}

.admin-sidebar-brand .brand strong,
.admin-sidebar-brand .brand small {
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
    overflow-y: auto;
    padding: 14px 12px 20px;
}

.admin-nav-section {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-bottom: 14px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.admin-nav-section:last-child {
    border-bottom: 0;
}

.admin-nav-label {
    padding: 5px 10px 7px;
    color: var(--muted-color);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.admin-nav a {
    display: block;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--ink);
    font-weight: 650;
    text-decoration: none;
    transition:
        background .15s ease,
        color .15s ease;
}

.admin-nav a:hover {
    background: color-mix(
        in srgb,
        var(--brand) 10%,
        transparent
    );
}

.admin-nav a.active {
    background: var(--brand);
    color: var(--surface, #ffffff);
}

.admin-sidebar-footer {
    display: grid;
    gap: 4px;
    padding: 12px;
    border-top: 1px solid var(--line);
}

.admin-sidebar-footer a {
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--ink);
    font-weight: 650;
    text-decoration: none;
}

.admin-sidebar-footer a:hover {
    background: color-mix(
        in srgb,
        var(--brand) 10%,
        transparent
    );
}

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

.admin-mobilebar {
    display: none;
}

.admin-main {
    padding: 34px 0 50px;
}

.admin-content {
    width: min(1180px, calc(100% - 40px));
    margin-inline: auto;
}

.admin-content > h1 {
    margin-bottom: 28px;
}

.admin-footer {
    display:flex;
    justify-content:flex-end;
    align-items:center;
    width:100%;
    padding-top:34px;
    color:var(--muted-color);
    font-size:.85rem;
    text-align:right;
}
.admin-footer .dibscart-powered{
    margin-left:auto;
}

.admin-sidebar-overlay {
    display: none;
}

.admin-menu-button {
    width: auto;
}


/* Tablet / phone admin navigation */

@media (max-width: 820px) {

    .admin-shell {
        display: block;
    }

    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: min(290px, 86vw);
        height: 100vh;
        transform: translateX(-105%);
        transition: transform .2s ease;
        box-shadow: 12px 0 36px rgba(0,0,0,.14);
    }

    .admin-menu-open .admin-sidebar {
        transform: translateX(0);
    }

    .admin-sidebar-overlay {
        position: fixed;
        inset: 0;
        display: block;
        background: rgba(20, 28, 31, .45);
        opacity: 0;
        visibility: hidden;
        transition:
            opacity .2s ease,
            visibility .2s ease;
        z-index: 20;
    }

    .admin-menu-open .admin-sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    .admin-mobilebar {
        position: sticky;
        top: 0;
        z-index: 15;
        min-height: 62px;
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 10px 18px;
        background: var(--surface, #ffffff);
        border-bottom: 1px solid var(--line);
    }

    .admin-menu-button {
        padding: 9px 12px;
    }

    .admin-main {
        padding-top: 24px;
    }

    .admin-content {
        width: min(100% - 28px, 1180px);
    }

    body.admin-menu-open {
        overflow: hidden;
    }
}


/* DibsCart 1.5.0 — Lists */
.list-create-form{display:flex;gap:12px;align-items:end;flex-wrap:wrap}
.list-create-form label{min-width:280px;flex:1;margin-bottom:0}
.list-order-input{width:80px}
.list-actions{display:flex;gap:8px;flex-wrap:wrap}
.catalog-destination-panel{
    padding:18px 20px;
}
.catalog-destination-panel form{
    display:grid;
    grid-template-columns:minmax(260px, 1fr) auto;
    gap:12px;
    align-items:end;
    max-width:720px;
}
.catalog-destination-panel label{
    min-width:0;
    margin:0;
}
.catalog-destination-panel select{
    width:100%;
    min-height:46px;
}
.catalog-destination-panel button{
    min-height:46px;
    margin:0;
    white-space:nowrap;
}
@media (max-width:680px){
    .catalog-destination-panel form{
        grid-template-columns:1fr;
    }
    .catalog-destination-panel button{
        width:100%;
    }
}
.product-list-field{border:1px solid var(--border);border-radius:12px;padding:12px;margin:0}
.product-list-field legend{font-weight:700;padding:0 6px}
.checkbox-label{display:inline-flex!important;align-items:center;gap:6px;margin-right:16px}
.checkbox-label input{width:auto!important}

/* DibsCart 1.5.1 — Lists test polish */
.lists-table th,.lists-table td{vertical-align:middle}
.lists-table td{padding-top:12px;padding-bottom:12px}
.lists-table input[type="text"]{width:100%;min-width:220px}
.lists-table .lists-count{font-weight:600}
.lists-table .lists-active{text-align:center}
.lists-table .list-actions{display:flex;align-items:center;gap:8px;white-space:nowrap}
.lists-table .list-actions button{margin:0}
