:root {
    color-scheme: light;
    --ink: #201d18;
    --muted: #746b5d;
    --line: #ded7cc;
    --paper: #fbfaf7;
    --panel: #ffffff;
    --accent: #9a6b28;
    --accent-strong: #6d4919;
    --sage: #526a5a;
    --rose: #8a5353;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: var(--paper);
}

a {
    color: inherit;
}

.site-header {
    border-bottom: 1px solid var(--line);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 5;
}

.account-bar {
    background: var(--ink);
    color: #fff;
    font-size: 14px;
}

.account-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
}

.account-bar a {
    color: #fff;
    font-weight: 700;
    margin-left: 14px;
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

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

.brandmark {
    text-decoration: none;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0;
}

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

.nav a,
.button,
button {
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    padding: 10px 14px;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
}

.nav a.active,
.button.primary,
button.primary {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

.hero {
    padding: 58px 0 32px;
}

.hero h1 {
    margin: 0 0 14px;
    font-size: clamp(38px, 6vw, 74px);
    line-height: 0.95;
}

.hero p {
    max-width: 640px;
    margin: 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.65;
}

.filters {
    display: grid;
    grid-template-columns: minmax(180px, 0.9fr) minmax(0, 2fr);
    gap: 18px;
    padding: 12px 0 28px;
}

.filter-group {
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.filter-title {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    text-decoration: none;
    background: #fff;
    font-size: 14px;
}

.chip.active {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    padding-bottom: 56px;
}

.product-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.product-card img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    background: #eee8dd;
}

.product-thumbs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    border-top: 1px solid var(--line);
    background: #fbfaf7;
}

.product-thumbs a {
    display: block;
}

.product-thumbs img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 5px;
    object-fit: cover;
}

.product-body {
    padding: 14px;
}

.eyebrow {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 6px;
}

.product-card h2 {
    font-size: 17px;
    margin: 0 0 10px;
}

.product-main-link {
    display: block;
    text-decoration: none;
}

.meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
}

.price {
    color: var(--ink);
    font-weight: 700;
}

.share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 12px;
    border: 1px solid #1f8f4d;
    border-radius: 7px;
    padding: 9px 12px;
    color: #fff;
    background: #1f8f4d;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
}

.admin-edit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 12px;
    border: 1px solid var(--accent);
    border-radius: 7px;
    padding: 9px 12px;
    color: #fff;
    background: var(--accent);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
}

.product-detail {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(280px, 0.7fr);
    gap: 32px;
    padding: 42px 0 64px;
}

.product-detail-main {
    width: 100%;
    max-height: 720px;
    object-fit: cover;
    background: #eee8dd;
}

.product-detail-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.product-detail-thumbs img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 5px;
}

.product-detail-body h1 {
    margin: 8px 0 14px;
    font-size: clamp(32px, 5vw, 58px);
    line-height: 1;
}

.product-detail-body p {
    color: var(--muted);
    font-size: 18px;
    line-height: 1.65;
}

.empty {
    border: 1px dashed var(--line);
    padding: 36px;
    color: var(--muted);
    background: #fff;
}

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

.sidebar {
    background: var(--ink);
    color: #fff;
    padding: 22px;
}

.sidebar a {
    display: block;
    color: #fff;
    text-decoration: none;
    padding: 10px 0;
}

.main {
    padding: 28px;
}

.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 18px;
}

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

label {
    display: grid;
    gap: 7px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 10px 12px;
    font: inherit;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.full {
    grid-column: 1 / -1;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

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

th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

.thumb {
    width: 64px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    background: #eee8dd;
}

.image-library {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.image-tile {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.image-tile img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    background: #eee8dd;
}

.image-tile div {
    display: grid;
    gap: 5px;
    padding: 10px;
    font-size: 13px;
}

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

.image-library.compact {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.selectable-tile {
    position: relative;
}

.selectable-tile input[type="checkbox"] {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 22px;
    height: 22px;
    accent-color: var(--accent);
    z-index: 1;
}

.selectable-tile:has(input:checked) {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}

.selectable-tile label {
    cursor: pointer;
}

.image-tile-action {
    padding: 0 10px 10px;
}

.image-tile-action button {
    width: 100%;
    border-color: var(--rose);
    color: var(--rose);
}

.mini-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 12px;
}

.mini-gallery img {
    width: 54px;
    height: 68px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid var(--line);
}

.photo-order-form {
    margin-top: 12px;
}

.mini-gallery.ordered {
    align-items: start;
}

.ordered-photo {
    width: 82px;
    display: grid;
    gap: 5px;
    font-size: 12px;
}

.ordered-photo img {
    width: 82px;
    height: 104px;
}

.ordered-photo input {
    padding: 6px;
}

.ordered-photo small {
    color: var(--accent-strong);
    font-weight: 700;
}

.ordered-photo button {
    padding: 6px;
    font-size: 12px;
}

.inline-status-form {
    display: grid;
    gap: 8px;
    min-width: 120px;
}

.product-media-form,
.photo-order-form {
    border-top: 1px solid var(--line);
    margin-top: 14px;
    padding-top: 14px;
}

.unassigned-picker summary {
    cursor: pointer;
    font-weight: 700;
}

.picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.picker-tile {
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 7px;
    cursor: pointer;
    background: #fff;
}

.picker-tile input {
    width: auto;
}

.picker-tile img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 5px;
    background: #eee8dd;
}

.picker-tile span {
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 12px;
}

.picker-tile:has(input:checked) {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}

.products-admin-table tbody tr {
    border-top: 2px solid var(--line);
}

.notice {
    border-left: 4px solid var(--sage);
    background: #eef4ef;
    padding: 12px 14px;
    margin-bottom: 18px;
}

.error {
    border-left-color: var(--rose);
    background: #f8eeee;
}

.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login .panel {
    width: min(420px, 100%);
}

@media (max-width: 860px) {
    .hero,
    .filters,
    .admin-layout,
    .product-detail {
        grid-template-columns: 1fr;
    }

    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sidebar {
        position: static;
    }

    .main {
        padding: 18px;
    }

    .products-table-wrap {
        overflow: visible;
    }

    .products-admin-table,
    .products-admin-table thead,
    .products-admin-table tbody,
    .products-admin-table tr,
    .products-admin-table th,
    .products-admin-table td {
        display: block;
        width: 100%;
    }

    .products-admin-table {
        border-collapse: separate;
        border-spacing: 0 14px;
        background: transparent;
    }

    .products-admin-table thead {
        display: none;
    }

    .products-admin-table tr {
        border: 3px solid var(--accent);
        border-radius: 8px;
        background: #fff;
        overflow: hidden;
        box-shadow: 0 2px 10px rgba(32, 29, 24, 0.08);
    }

    .products-admin-table td {
        border-bottom: 0;
        padding: 12px 14px;
    }

    .products-admin-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 6px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
    }

    .products-admin-table td[data-label="Edit"]::before {
        margin-bottom: 12px;
    }

    .product-edit-thumb {
        width: 100%;
        max-width: 220px;
        height: auto;
        aspect-ratio: 4 / 5;
    }

    .mini-gallery.ordered {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    }
}

@media (max-width: 560px) {
    .topbar,
    .form-grid {
        grid-template-columns: 1fr;
        display: grid;
    }

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