:root {
    --bg: #f4f1ea;
    --fg: #1c1917;
    --muted: #57534e;
    --card: #fffcf7;
    --line: #d6d3d1;
    --ok: #166534;
    --bad: #9f1239;
    --accent: #1c1917;
}

.shop-directory { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.shop-card { display: flex; flex-direction: column; gap: .65rem; color: var(--fg); text-decoration: none; }
.shop-card:hover, .shop-card:focus-visible { border-color: var(--accent); box-shadow: 0 2px 10px #0001; }
.shop-card span { color: var(--muted); }
.shop-import { margin-top: 2rem; max-width: 42rem; }
.shop-import input { max-width: 100%; }

* {
    box-sizing: border-box;
}

[hidden] { display: none !important; }
.shop-directory .card + .card { margin-top: 0; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: "Segoe UI", system-ui, sans-serif;
    line-height: 1.45;
}

.shell {
    max-width: 40rem;
    margin: 3rem auto;
    padding: 0 1.25rem;
}

h1 {
    margin: 0 0 0.35rem;
    font-size: 1.75rem;
    font-weight: 650;
}

.lede {
    margin: 0 0 1.5rem;
    color: var(--muted);
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1.25rem 1.35rem;
}

h2 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}

.status {
    margin: 0 0 0.75rem;
    font-weight: 600;
}

.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }
.status.pending { color: var(--muted); }

.payload {
    margin: 0;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 4px;
    overflow: auto;
    font-size: 0.85rem;
}

.screen[hidden] { display: none; }

.topbar {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--accent, var(--line));
    background: var(--card);
    flex-wrap: wrap;
}

.store-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.topbar strong { margin-right: auto; }

.shell.wide { max-width: 52rem; }

form { display: grid; gap: 0.45rem; }
form.row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

label { font-size: 0.9rem; color: var(--muted); }

input, select, button {
    font: inherit;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
}

button {
    background: var(--accent, var(--fg));
    color: #fff;
    border-color: var(--accent, var(--fg));
    cursor: pointer;
}

ul { padding-left: 1.1rem; }
.card + .card { margin-top: 1rem; }

textarea {
    font: inherit;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    width: 100%;
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.navlink {
    color: var(--fg);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 0.85rem;
}

.product-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
}

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

.product-card img {
    width: 100%;
    height: 8.5rem;
    object-fit: cover;
    border-radius: 6px;
    background: #eee;
}

.product-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0 1rem;
}

.product-gallery img {
    max-width: 100%;
    max-height: 18rem;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.thumb {
    height: 2.75rem;
    width: 2.75rem;
    object-fit: cover;
    vertical-align: middle;
    border-radius: 4px;
    border: 1px solid var(--line);
}

#productList li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#productList button {
    background: #fff;
    color: var(--fg);
    border-color: var(--line);
}

.grid-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
}

.grid-table th, .grid-table td {
    text-align: left;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--line);
}

.grid-table tbody tr {
    cursor: pointer;
}

.store-filters {
    padding: 0.75rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
}
.store-filters input[type="search"] { flex: 1 1 14rem; }
.store-filters select { max-width: 100%; min-width: 0; }
.store-filters .price-bound { width: 7rem; }
.store-filters label { display: inline-flex; align-items: center; gap: 0.3rem; }

.store-pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 1.25rem 0;
}
.store-pager .disabled { opacity: 0.4; }

.product-card .out-of-stock { font-size: 0.85em; }

#productCategories { min-width: 16rem; }
