* { box-sizing: border-box; }

:root {
    color-scheme: light;
}

html {
    color-scheme: light;
    background-color: #f4f6f8;
}

body { font-family: system-ui, -apple-system, sans-serif; margin: 0; background: #f4f6f8; color: #1a1a1a; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }

.topbar { background: #1e3a5f; color: #fff; padding: 0.75rem 0; }

.topbar a { color: #fff; margin-right: 1rem; text-decoration: none; }

.topbar .container { display: flex; justify-content: space-between; align-items: center; }

h1, h2 { margin-top: 0; }

.card { background: #fff; border: 1px solid #dde3ea; border-radius: 8px; padding: 1.25rem; margin-bottom: 1rem; }

label { display: block; margin-bottom: 0.75rem; }

input, button, select, textarea { font: inherit; padding: 0.5rem 0.75rem; border: 1px solid #ccd4dc; border-radius: 6px; color-scheme: light; }

input, select, textarea { background-color: #fff; color: #1a1a1a; }

input { width: 100%; max-width: 480px; }

button, .button { background: #1e3a5f; color: #fff; border: none; cursor: pointer; text-decoration: none; display: inline-block; padding: 0.5rem 1rem; border-radius: 6px; }

table { width: 100%; border-collapse: collapse; background: #fff; }

th, td { border: 1px solid #dde3ea; padding: 0.5rem 0.75rem; text-align: left; vertical-align: top; }

.alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; }

.alert-success { background: #e6f4ea; color: #1e4620; }

.alert-error { background: #fce8e6; color: #5f2120; }

.stats { display: flex; gap: 1rem; margin-bottom: 1.5rem; }

.stat { background: #fff; border: 1px solid #dde3ea; border-radius: 8px; padding: 1rem 1.5rem; }

.stat span { display: block; font-size: 2rem; font-weight: 700; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }

.actions form { display: inline-block; margin-right: 0.5rem; }

code { background: #eef2f6; padding: 0.15rem 0.35rem; border-radius: 4px; word-break: break-all; }

.muted { color: #5f6368; font-size: 0.95rem; }

.section-header { margin-bottom: 1rem; }

.section-header h2 { margin-bottom: 0.35rem; }

.section-header p { margin: 0; }

.api-keys-card { grid-column: 1 / -1; }

.api-key-create { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; margin-bottom: 1.25rem; padding-bottom: 1.25rem; border-bottom: 1px solid #eef2f6; }

.api-key-create .inline-label { margin: 0; flex: 1 1 220px; }

.api-key-create .inline-label span { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 0.35rem; color: #444; }

.api-key-create input { max-width: none; }

.api-key-reveal-top { display: flex; flex-direction: column; gap: 0.5rem; }

.api-key-value { display: block; font-size: 0.95rem; padding: 0.65rem 0.85rem; background: #fff; border: 1px dashed #9aa5b1; border-radius: 6px; margin-top: 0.25rem; }

.api-key-empty { text-align: center; padding: 2rem 1rem; background: #f8fafc; border: 1px dashed #ccd4dc; border-radius: 8px; }

.api-key-empty p { margin: 0.25rem 0; }

.api-key-table-wrap { overflow-x: auto; border: 1px solid #dde3ea; border-radius: 8px; }

.api-key-table { margin: 0; border: none; }

.api-key-table th { background: #f8fafc; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: #5f6368; border-top: none; }

.api-key-table th:first-child, .api-key-table td:first-child { border-left: none; }

.api-key-table th:last-child, .api-key-table td:last-child { border-right: none; }

.api-key-table tbody tr:last-child td { border-bottom: none; }

.api-key-table tbody tr:hover { background: #fafbfc; }

.api-key-name { font-weight: 600; }

.api-key-prefix code { background: #e8eef5; color: #1e3a5f; font-size: 0.9rem; }

.api-key-date { white-space: nowrap; color: #444; font-size: 0.925rem; }

.api-key-actions { text-align: right; white-space: nowrap; }

.api-key-actions form { margin: 0; }

.btn-danger { background: #b3261e; color: #fff; border: none; padding: 0.4rem 0.85rem; border-radius: 6px; cursor: pointer; font: inherit; }

.btn-danger:hover { background: #8c1d18; }

button:disabled { opacity: 0.55; cursor: not-allowed; }
.welcome-credentials { margin-bottom: 1rem; }
.welcome-payment-notice { border-left: 4px solid #1e3a5f; }
.credential-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.credential-table th { text-align: left; width: 180px; padding: 0.65rem 0.75rem; color: #5f6368; font-weight: 600; border-bottom: 1px solid #eef2f6; }
.credential-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid #eef2f6; }
.credential-table tr:last-child th, .credential-table tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 0.15rem 0.45rem; border-radius: 999px; font-size: 0.75rem; background: #eef2f6; color: #444; }

.badge-success { background: #e6f4ea; color: #137333; }

.badge-warning { background: #fef7e0; color: #b06000; }

.badge-error { background: #fce8e6; color: #b3261e; }

.link-riverr-form input[type="text"] { max-width: 140px; margin-right: 0.35rem; }

.button-muted { background: #eef2f6; color: #1e3a5f; }
.catalog-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid #dde3ea; background: #f8fafc; }
.catalog-excerpt { margin-top: 0.25rem; font-size: 0.9rem; }
.catalog-json { background: #f8fafc; border: 1px solid #dde3ea; border-radius: 8px; padding: 1rem; overflow-x: auto; font-size: 0.85rem; max-height: 480px; }

/* Catalog browse (grid + cards) */
body.catalog-shop { background: #f9f9f7; }
body.catalog-shop .topbar { background: #fff; color: #1a1a1a; border-bottom: 1px solid #ebebeb; }
body.catalog-shop .topbar a { color: #444; }
body.catalog-shop .topbar a:hover { color: #000; }
body.catalog-shop main.container.container-shop { max-width: 1140px; width: 100%; padding: 2rem 1.5rem 3rem; }
.catalog-page { width: 100%; }
.catalog-page-title { margin: 0 0 1.25rem; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; color: #111; }
.catalog-subnav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.catalog-tabs { display: flex; gap: 0.25rem; }
.catalog-tab { padding: 0.4rem 0.85rem; border-radius: 999px; text-decoration: none; font-size: 0.875rem; font-weight: 500; color: #666; background: transparent; }
.catalog-tab:hover { color: #111; background: rgba(0, 0, 0, 0.04); }
.catalog-tab.is-active { color: #111; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.catalog-subnav-meta { font-size: 0.8rem; color: #888; }
.catalog-subnav-meta a { color: #555; }
.catalog-search { margin-bottom: 1.25rem; }
.catalog-search-label { display: block; font-size: 0.8rem; font-weight: 600; color: #666; margin-bottom: 0.35rem; }
.catalog-search-row { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center; }
.catalog-search-row input[type="search"] { flex: 1 1 280px; min-width: 220px; margin: 0; }
.catalog-search-row select { flex: 0 0 auto; min-width: 150px; margin: 0; }
.catalog-filter-label { font-size: 0.8rem; font-weight: 600; color: #666; margin: 0; white-space: nowrap; }
.catalog-search-hint { margin: 0.5rem 0 0; font-size: 0.82rem; }
.catalog-page .catalog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; width: 100%; align-items: stretch; }
.catalog-page .catalog-card { position: relative; min-width: 0; height: 100%; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06); transition: box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease; display: flex; flex-direction: column; }
.catalog-page .catalog-card.is-disabled { opacity: 0.72; }
.catalog-page .catalog-card-enable { position: absolute; top: 0.85rem; left: 0.85rem; z-index: 2; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.55rem; border-radius: 999px; background: rgba(255,255,255,0.95); box-shadow: 0 1px 4px rgba(0,0,0,0.12); font-size: 0.75rem; font-weight: 600; color: #444; cursor: pointer; user-select: none; }
.catalog-page .catalog-card-enable input { width: auto; max-width: none; margin: 0; cursor: pointer; }
.catalog-page .catalog-card-refresh { position: absolute; top: 0.85rem; right: 0.85rem; z-index: 2; margin: 0; padding: 0.3rem 0.6rem; border: 0; border-radius: 999px; background: rgba(255,255,255,0.95); box-shadow: 0 1px 4px rgba(0,0,0,0.12); font-size: 0.75rem; font-weight: 600; color: #444; cursor: pointer; }
.catalog-page .catalog-card-refresh:disabled, .catalog-page .catalog-card-refresh.is-busy { cursor: wait; opacity: 0.7; }
.catalog-group-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.catalog-group-title-row h1 { margin: 0; flex: 1 1 12rem; }
.catalog-detail-enable { display: inline-flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; padding: 0.55rem 0.85rem; background: #fff; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); font-size: 0.875rem; font-weight: 600; color: #333; cursor: pointer; }
.catalog-detail-enable input { width: auto; max-width: none; margin: 0; cursor: pointer; }
.catalog-page .catalog-card:hover { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.09); transform: translateY(-2px); }
.catalog-page .catalog-card-link { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit; }
.catalog-page .catalog-card-image { position: relative; flex: 0 0 auto; margin: 0.75rem 0.75rem 0; aspect-ratio: 1; background: #efefef; border-radius: 10px; overflow: hidden; }
.catalog-page .catalog-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.catalog-page .catalog-card-placeholder { width: 100%; height: 100%; background: linear-gradient(145deg, #ececec, #e2e2e2); }
.catalog-page .catalog-card-variants { position: absolute; bottom: 0.5rem; right: 0.5rem; background: rgba(255, 255, 255, 0.92); border-radius: 6px; padding: 0.2rem 0.5rem; font-size: 0.68rem; font-weight: 600; color: #555; }
.catalog-page .catalog-card-body { padding: 0.85rem 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.3rem; flex: 1 1 auto; }
.catalog-page .catalog-card-title { margin: 0; font-size: 0.95rem; font-weight: 700; line-height: 1.35; color: #111; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.catalog-page .catalog-card-byline { margin: 0; font-size: 0.82rem; color: #888; line-height: 1.4; }
.catalog-page .catalog-card-price { margin: auto 0 0; padding-top: 0.35rem; font-size: 0.95rem; font-weight: 700; color: #111; }
.catalog-page .catalog-empty { grid-column: 1 / -1; text-align: center; padding: 3.5rem 1.5rem; background: #fff; border-radius: 14px; color: #888; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05); }
.catalog-pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 2.5rem; font-size: 0.875rem; }
.catalog-pagination a { color: #111; font-weight: 600; text-decoration: none; padding: 0.45rem 0.9rem; background: #fff; border-radius: 999px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.catalog-pagination a:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); }
.catalog-print-section { background: #fff; border-radius: 14px; padding: 1.25rem 1.5rem; margin-bottom: 1rem; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06); }
.catalog-print-section h2 { font-size: 1rem; margin-bottom: 0.75rem; }
.catalog-print-section table { border: none; }
.catalog-print-section th, .catalog-print-section td { border-color: #f0f0f0; }
.pdp-back { display: inline-block; color: #555; text-decoration: none; font-size: 0.9rem; font-weight: 500; margin-bottom: 1.25rem; }
.pdp-back:hover { color: #111; }
.pdp-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.pdp-gallery { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06); }
.pdp-main-image { aspect-ratio: 1; background: #efefef; margin: 0.75rem; border-radius: 10px; overflow: hidden; }
.pdp-main-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pdp-info { background: #fff; border-radius: 14px; padding: 1.5rem; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06); }
.pdp-info h1 { margin: 0 0 0.5rem; font-size: 1.35rem; font-weight: 700; }
.pdp-price { font-size: 1.25rem; font-weight: 700; color: #111; margin: 0 0 0.75rem; }
.pdp-meta { font-size: 0.85rem; color: #888; margin-bottom: 1rem; }
.pdp-variants { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin-top: 1rem; }
.pdp-variants th { text-align: left; padding: 0.5rem 0.65rem; background: #fafafa; border-bottom: 1px solid #f0f0f0; font-weight: 600; color: #666; }
.pdp-variants td { padding: 0.5rem 0.65rem; border-bottom: 1px solid #f0f0f0; }
@media (max-width: 900px) {
    .catalog-page .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
    .pdp-layout { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    body.catalog-shop main.container.container-shop { padding: 1.25rem 1rem 2rem; }
    .catalog-page .catalog-grid { grid-template-columns: 1fr; }
    .catalog-page-title { font-size: 1.45rem; }
}

.settings-field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.settings-country-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 0.35rem 0.75rem;
    margin-top: 0.5rem;
}

.settings-country-option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
}

.settings-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.storefront-logo-field {
    border: 1px solid #e6ebf0;
    border-radius: 8px;
    padding: 0.85rem 1rem 1rem;
    margin: 1rem 0;
}

.storefront-logo-field legend {
    padding: 0 0.35rem;
    font-weight: 600;
}

.storefront-logo-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0.5rem 0 0.75rem;
    padding: 0.75rem 1rem;
    background: #f7f9fb;
    border: 1px solid #e6ebf0;
    border-radius: 8px;
}

.storefront-logo-preview img {
    display: block;
    max-height: 64px;
    max-width: 220px;
    width: auto;
    height: auto;
    object-fit: contain;
}
