* { box-sizing: border-box; }
:root {
    --line: #dbe3ef; --text: #162033; --muted: #64748b;
    --accent: #2563eb; --accent-dark: #1d4ed8;
    --success: #157347; --error: #b42318;
    --shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}
body {
    margin: 0; font-family: Inter, Arial, Helvetica, sans-serif;
    background: linear-gradient(180deg, #f8fbff 0%, #eef3f9 100%);
    color: var(--text);
}
body.modal-open { overflow: hidden; }
.page-shell { display: grid; grid-template-columns: 390px 1fr; min-height: 100vh; }
.sidebar { background: #f9fbfe; border-right: 1px solid var(--line); padding: 24px; overflow-y: auto; }
.content { padding: 24px; }
.brand-box, .panel {
    background: #fff; border: 1px solid var(--line); border-radius: 20px;
    box-shadow: var(--shadow); margin-bottom: 20px;
}
.brand-box { padding: 24px; }
.panel-header {
    padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex;
    align-items: center; justify-content: space-between; gap: 12px;
}
.panel-header-space { align-items: flex-start; }
.panel-header h2, .topbar h2, .brand-box h1 { margin: 0; }
.panel-body { padding: 20px; }
.eyebrow {
    text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px;
    color: var(--accent); font-weight: 700; margin-bottom: 8px;
}
.panel-actions, .product-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 10px; }
.inline-form input { flex: 1; }
label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
input[type="text"], select {
    width: 100%; border: 1px solid var(--line); border-radius: 12px;
    padding: 12px 14px; font-size: 14px; background: #fff;
}
.btn {
    border: 0; border-radius: 12px; padding: 12px 14px; font-weight: 700;
    font-size: 14px; cursor: pointer; transition: all 0.18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-light { background: #eff4fb; color: var(--text); }
.btn-small { padding: 10px 12px; font-size: 13px; }
.btn-full { width: 100%; margin-top: 16px; }
.hint { margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.filter-container { display: flex; flex-direction: column; gap: 12px; max-height: 40vh; overflow: auto; padding-right: 4px; }
.filter-group {
    border: 1px solid var(--line); border-radius: 16px; overflow: visible; background: #fbfdff;
}
.filter-group-toggle {
    width: 100%; border: 0; padding: 14px 16px; background: transparent; font-weight: 700;
    display: flex; justify-content: space-between; align-items: center; cursor: pointer; color: var(--text);
}
.filter-group-values {
    display: none; padding: 0 14px 14px; border-top: 1px solid var(--line); max-height: 260px; overflow: auto;
}
.filter-option {
    display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; align-items: start;
    padding: 10px 0; border-bottom: 1px dashed #e7edf6; font-weight: 500;
}
.filter-option:last-child { border-bottom: 0; }
.filter-count { color: var(--muted); font-size: 13px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.pagination-box {
    display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,0.85);
    border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; box-shadow: var(--shadow);
}
.status-box {
    padding: 14px 16px; border-radius: 16px; background: #eef4ff; border: 1px solid #d7e5ff;
    margin-bottom: 18px; font-weight: 600;
}
.status-box.success { background: #ecfdf3; border-color: #ccebd8; color: var(--success); }
.status-box.error { background: #fff1f3; border-color: #f8d2d8; color: var(--error); }
.status-box.muted { background: #f8fafc; border-color: #e2e8f0; color: var(--muted); }
.results-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.meta-pill {
    padding: 8px 12px; border-radius: 999px; background: white; border: 1px solid var(--line);
    box-shadow: var(--shadow); font-size: 14px;
}
.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.product-card {
    background: white; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow);
}
.product-image-wrap {
    aspect-ratio: 4 / 3;
    background: #f7f9fc;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--line);
    padding: 12px;
}
.product-image {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}
.image-placeholder { color: var(--muted); font-weight: 600; }
.image-placeholder.small { font-size: 12px; }
.product-body { padding: 18px; }
.product-brand {
    color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.08em; margin-bottom: 8px;
}
.product-body h3 { margin: 0 0 12px; font-size: 18px; line-height: 1.35; }
.product-meta { display: grid; gap: 6px; color: #334155; font-size: 14px; }
.raw-panel { margin-top: 22px; }
pre {
    margin: 0; white-space: pre-wrap; word-break: break-word; background: #0f172a; color: #cbd5e1;
    padding: 18px; border-radius: 16px; max-height: 420px; overflow: auto; font-size: 12px; line-height: 1.55;
}
.empty-state {
    background: white; border: 1px dashed var(--line); border-radius: 18px; padding: 28px;
    color: var(--muted); text-align: center;
}
.empty-state.small { padding: 18px; font-size: 14px; }
.empty-inline {
    color: var(--muted);
    font-size: 13px;
}
code { background: #eff6ff; color: #1d4ed8; padding: 2px 6px; border-radius: 6px; }

.catalog-list { display: grid; gap: 12px; margin-top: 16px; }
.catalog-item {
    display: grid;
    grid-template-columns: 56px 1fr 28px;
    gap: 12px;
    align-items: start;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfdff;
}
.catalog-item-thumb {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}
.catalog-item-thumb img {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}
.catalog-item-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.catalog-item-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.catalog-item-description { font-size: 12px; color: #334155; line-height: 1.45; margin-bottom: 6px; }
.catalog-inline-block {
    font-size: 12px;
    color: #334155;
    margin-top: 4px;
}
.catalog-remove, .modal-close {
    border: 0; background: #fee2e2; color: #991b1b; width: 28px; height: 28px; border-radius: 999px;
    font-size: 18px; line-height: 1; cursor: pointer;
}

.swatch-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.swatch-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.swatch-item.compact {
    gap: 0;
}
.swatch-circle {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    display: inline-block;
    border: 1px solid #94a3b8;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
}
.swatch-label {
    font-size: 13px;
    color: #334155;
    line-height: 1.2;
}

.size-badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.size-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eff4fb;
    color: #1e3a8a;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid #dbe3ef;
}

.modal { position: fixed; inset: 0; z-index: 1000; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(2px); }
.modal-card {
    position: relative; width: min(1120px, calc(100vw - 40px)); max-height: calc(100vh - 40px); overflow: auto;
    margin: 20px auto; background: white; border-radius: 24px; box-shadow: 0 24px 80px rgba(15, 23, 42, 0.25);
    padding: 28px; z-index: 2;
}
.modal-close { position: sticky; top: 0; margin-left: auto; display: block; }
.detail-header { display: flex; justify-content: space-between; gap: 16px; align-items: start; margin-bottom: 22px; }
.detail-header h2 { margin: 0 0 8px; }
.detail-subline, .detail-description { color: #334155; line-height: 1.6; }
.detail-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 12px;
}
.detail-gallery-image {
    width: 100%;
    height: 220px;
    object-fit: contain;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    display: block;
}
.detail-section { margin-bottom: 26px; }
.detail-section h3 { margin: 0 0 12px; }
.attribute-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.attribute-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: #fbfdff; }
.attribute-title {
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 800; color: var(--accent); margin-bottom: 6px;
}
.attribute-value { color: #334155; line-height: 1.5; }

@media (max-width: 1100px) {
    .page-shell { grid-template-columns: 1fr; }
    .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
    .topbar, .detail-header, .product-actions { flex-direction: column; align-items: stretch; }
}

.catalog-brand-logo {max-height:22px;}

.product-actions {
  margin-top: 1rem;
}