:root {
    --ink: #302a30;
    --muted: #756b72;
    --paper: #fffdfb;
    --canvas: #f6f0ec;
    --rose: #a94f67;
    --rose-dark: #7f344b;
    --rose-soft: #f7e8ed;
    --sage: #687965;
    --sage-soft: #edf1ea;
    --gold: #b58a49;
    --line: #e3d9d3;
    --warning: #9a5b32;
    --warning-soft: #fbede1;
    --sold: #5d4a78;
    --sold-soft: #eee9f5;
    --shadow: 0 16px 44px rgba(61, 42, 50, .10);
    --radius: 20px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 15% 0%, rgba(169, 79, 103, .10), transparent 29rem),
        radial-gradient(circle at 100% 12%, rgba(104, 121, 101, .12), transparent 26rem),
        var(--canvas);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.shell { width: min(1480px, calc(100% - 32px)); margin-inline: auto; }
.site-header { padding: 34px 0 20px; }
.hero-grid {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 34px;
    align-items: center;
    padding: clamp(28px, 4vw, 52px);
    border: 1px solid rgba(255,255,255,.88);
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(255,255,255,.97), rgba(255,249,247,.91));
    box-shadow: var(--shadow);
}
.hero-grid::after { content: ""; position: absolute; width: 280px; height: 280px; right: -92px; top: -120px; border-radius: 50%; background: linear-gradient(145deg, rgba(169,79,103,.18), rgba(181,138,73,.10)); }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 10px; color: var(--rose-dark); font-size: .76rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 28px; height: 2px; background: var(--gold); }
h1, h2 { font-family: Georgia, "Times New Roman", serif; }
h1 { margin: 0; font-size: clamp(2.35rem, 5vw, 4.35rem); line-height: 1.02; letter-spacing: -.035em; }
.lede { max-width: 850px; margin: 16px 0 0; color: var(--muted); font-size: clamp(1rem, 1.35vw, 1.14rem); }
.metric-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(100px, 1fr)); gap: 10px; min-width: 350px; }
.metric { padding: 18px 14px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.9); text-align: center; }
.metric strong { display: block; color: var(--rose-dark); font-size: 1.8rem; line-height: 1; }
.metric span { display: block; margin-top: 6px; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.main-shell { padding-bottom: 70px; }
.notice { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; margin-bottom: 18px; padding: 17px 20px; border: 1px solid #e7d7c2; border-radius: 16px; background: #fff9ed; color: #5e4b31; }
.notice p { margin: 2px 0 0; }
.notice-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #f2dfbd; font-weight: 900; }
.filter-panel { position: sticky; z-index: 20; top: 0; margin-bottom: 24px; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,253,251,.96); box-shadow: 0 10px 30px rgba(61,42,50,.08); backdrop-filter: blur(14px); }
.filter-grid { display: grid; grid-template-columns: minmax(220px, 1.3fr) 150px 205px 205px 170px auto; gap: 10px; align-items: end; }
.filter-grid label { display: grid; gap: 5px; min-width: 0; }
.filter-grid label > span { color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.filter-grid input, .filter-grid select, .field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); outline: none; }
.filter-grid input, .filter-grid select { min-height: 46px; padding: 10px 12px; }
.filter-grid input:focus, .filter-grid select:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(169,79,103,.12); }
.filter-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 11px 2px 0; color: var(--muted); font-size: .85rem; }
.export-actions { display: flex; gap: 14px; }
.text-link, .drive-link { color: var(--rose-dark); font-weight: 800; text-decoration: none; }
.text-link:hover, .drive-link:hover { text-decoration: underline; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 16px; border: 1px solid transparent; border-radius: 12px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.button-primary { background: var(--rose); color: #fff; box-shadow: 0 8px 18px rgba(169,79,103,.22); }
.button-primary:hover { background: var(--rose-dark); }
.button-primary:disabled { opacity: .65; cursor: wait; }
.button-secondary { border-color: var(--line); background: #fff; color: var(--ink); }
.button-secondary:hover { background: #faf6f3; }
.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; align-items: start; }
.product-tile { align-self: start; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease; }
.product-tile:hover { transform: translateY(-4px); box-shadow: 0 22px 50px rgba(61,42,50,.15); }
.tile-link { display: flex; height: 100%; flex-direction: column; text-decoration: none; }
.tile-image-wrap { position: relative; overflow: hidden; background: #fff; }
.tile-image { display: block; width: 100%; height: auto; }
.image-placeholder { display: grid; place-items: center; min-height: 280px; color: var(--muted); background: #f4efec; }
.tile-badges { position: absolute; inset: 12px 12px auto; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; pointer-events: none; }
.badge { display: inline-flex; align-items: center; width: max-content; padding: 6px 9px; border-radius: 999px; font-size: .68rem; font-weight: 900; letter-spacing: .045em; text-transform: uppercase; }
.badge-complete { color: #4e654a; background: rgba(237,241,234,.95); }
.badge-incomplete { color: var(--warning); background: rgba(251,237,225,.96); }
.badge-sold { color: var(--sold); background: rgba(238,233,245,.96); }
.tile-body { display: flex; flex: 1; flex-direction: column; padding: 19px; }
.tile-type { color: var(--rose-dark); font-size: .72rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.tile-body h2 { margin: 5px 0 10px; font-size: 1.48rem; line-height: 1.12; }
.tile-description { display: -webkit-box; overflow: hidden; margin: 0 0 16px; color: var(--muted); font-size: .9rem; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.tile-meta { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin: auto 0 14px; }
.tile-meta div { min-width: 0; padding: 9px; border-radius: 10px; background: #f8f3f0; }
.tile-meta dt { color: var(--muted); font-size: .62rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.tile-meta dd { overflow: hidden; margin: 2px 0 0; font-size: .8rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.open-label { display: flex; justify-content: space-between; color: var(--rose-dark); font-size: .86rem; font-weight: 850; }
.empty-state { padding: 60px 20px; border: 1px dashed var(--line); border-radius: 18px; background: rgba(255,255,255,.7); color: var(--muted); text-align: center; }

.editor-page { min-height: 100vh; }
.editor-topbar { position: sticky; z-index: 30; top: 0; border-bottom: 1px solid var(--line); background: rgba(255,253,251,.94); backdrop-filter: blur(14px); }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 74px; }
.back-link { color: var(--rose-dark); font-weight: 850; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.save-status { color: var(--sage); font-size: .86rem; font-weight: 750; }
.save-status.is-dirty { color: var(--warning); }
.editor-shell { padding: 34px 0 70px; }
.editor-heading { display: flex; justify-content: space-between; align-items: end; gap: 22px; margin-bottom: 20px; }
.editor-heading h1 { max-width: 1050px; font-size: clamp(2rem, 4vw, 3.6rem); }
.source-file { margin: 10px 0 0; color: var(--muted); }
.source-file code { padding: 3px 7px; border-radius: 6px; background: #fff; }
.heading-badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.editor-card { overflow: hidden; display: grid; grid-template-columns: minmax(340px, 42%) minmax(0, 1fr); align-items: start; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); }
.editor-media { align-self: start; padding: 20px; border-right: 1px solid var(--line); background: linear-gradient(145deg, #f0e8e3, #f8f4f1); }
.detail-image-stage { overflow: hidden; border-radius: 17px; background: #fff; box-shadow: 0 8px 22px rgba(61,42,50,.08); }
.detail-image { display: none; width: 100%; height: auto; }
.detail-image.active { display: block; }
.detail-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.detail-thumb { flex: 0 0 68px; width: 68px; height: 68px; padding: 3px; border: 2px solid transparent; border-radius: 10px; background: #fff; }
.detail-thumb.active { border-color: var(--rose); }
.detail-thumb img { width: 100%; height: 100%; border-radius: 6px; object-fit: cover; }
.drive-link { display: inline-block; margin-top: 14px; font-size: .82rem; }
.editor-form { min-width: 0; padding: clamp(22px, 3vw, 42px); }
.form-section + .form-section { margin-top: 32px; }
.section-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; color: var(--muted); font-size: .72rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.section-heading::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section-heading small { order: 3; color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: 0; text-transform: none; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: .79rem; font-weight: 850; }
.field input, .field select { min-height: 48px; padding: 11px 13px; }
.field textarea { min-height: 132px; padding: 13px; line-height: 1.5; resize: vertical; }
.field-full { grid-column: 1 / -1; }
.inventory-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(230px, .72fr); gap: 18px; align-items: start; }
.inventory-controls { display: grid; gap: 16px; }
.sold-toggle-card { display: grid; gap: 16px; padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: #faf7f5; }
.toggle-copy { display: grid; gap: 4px; }
.toggle-copy small { color: var(--muted); font-size: .78rem; }
.switch { display: flex; align-items: center; gap: 10px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; width: 52px; height: 30px; border-radius: 999px; background: #cfc5ca; transition: background .2s; }
.switch-knob { position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .switch-track { background: var(--sold); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(22px); }
.switch input:focus-visible + .switch-track { outline: 3px solid rgba(169,79,103,.2); outline-offset: 2px; }
.switch-label { font-weight: 850; }
.toast { position: fixed; z-index: 100; right: 22px; bottom: 22px; max-width: min(420px, calc(100vw - 44px)); padding: 14px 18px; border-radius: 13px; background: var(--sage); color: #fff; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast[data-type="error"] { background: #9a3e3e; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1240px) {
    .filter-grid { grid-template-columns: 1.4fr repeat(2, 1fr); }
    .filter-grid .button { align-self: end; }
    .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
    .hero-grid { grid-template-columns: 1fr; }
    .metric-grid { min-width: 0; }
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .editor-card { grid-template-columns: 1fr; }
    .editor-media { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 700px) {
    .shell { width: min(100% - 20px, 1480px); }
    .site-header { padding-top: 12px; }
    .hero-grid { padding: 24px; border-radius: 20px; }
    .metric-grid { grid-template-columns: repeat(3, 1fr); }
    .filter-panel { position: static; }
    .filter-grid { grid-template-columns: 1fr; }
    .filter-footer { align-items: flex-start; flex-direction: column; }
    .product-grid { grid-template-columns: 1fr; }
    .topbar-inner, .editor-heading { align-items: flex-start; flex-direction: column; }
    .topbar-inner { padding: 12px 0; }
    .topbar-actions { width: 100%; justify-content: space-between; }
    .field-grid, .inventory-grid { grid-template-columns: 1fr; }
    .editor-form { padding: 22px 18px; }
}


/* v4 variant builder */
.variant-intro { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; padding: 16px 18px; border: 1px solid #e7d7c2; border-radius: 15px; background: #fff9ed; color: #5e4b31; }
.variant-intro strong { display: block; margin-bottom: 2px; }
.variant-intro p { margin: 0; font-size: .88rem; }
.variant-intro-icon { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; background: #f2dfbd; font-weight: 900; }
.variant-builder { display: grid; gap: 16px; }
.variant-card { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 8px 20px rgba(61,42,50,.055); }
.variant-card-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, var(--rose-soft), #fff); }
.variant-number { display: flex; align-items: center; gap: 10px; font-size: .74rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--rose-dark); }
.variant-number::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--rose); }
.icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); font-weight: 900; }
.icon-button:hover { border-color: #cfaab5; color: var(--rose-dark); background: #fff7f9; }
.variant-card-body { padding: 18px; }
.variant-name-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: end; margin-bottom: 10px; }
.helper { margin: 5px 0 14px; color: var(--muted); font-size: .74rem; }
.values-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 9px; }
.values-heading strong { font-size: .79rem; }
.value-list { display: grid; gap: 9px; }
.option-row { display: grid; grid-template-columns: 26px minmax(0,1fr) 34px; gap: 9px; align-items: center; }
.drag-handle { color: #b5a9ae; font-weight: 900; letter-spacing: -2px; text-align: center; user-select: none; }
.option-row input { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); outline: none; }
.option-row input:focus { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(169,79,103,.12); }
.small-button, .add-variant-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 11px; font-weight: 850; }
.small-button { min-height: 38px; padding: 8px 11px; border: 1px solid var(--line); background: #fff; color: var(--rose-dark); font-size: .78rem; }
.small-button:hover { background: var(--rose-soft); border-color: #d7b4be; }
.add-variant-button { width: 100%; min-height: 54px; margin-top: 16px; padding: 12px 16px; border: 2px dashed #d9c9cf; background: #fffafc; color: var(--rose-dark); }
.add-variant-button:hover { border-color: var(--rose); background: var(--rose-soft); }
.plus { font-size: 1.15rem; line-height: 1; }
.combination-summary { margin-top: 18px; padding: 18px; border: 1px solid #dbe2d7; border-radius: 16px; background: var(--sage-soft); }
.summary-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.summary-top h3 { margin: 0; font-size: 1.2rem; }
.summary-top p { margin: 5px 0 0; color: #536151; font-size: .84rem; }
.combo-count { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; background: #fff; color: var(--sage); font-size: .72rem; font-weight: 900; }
.combo-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.combo-chip { padding: 6px 9px; border: 1px solid #d4ded1; border-radius: 999px; background: #fff; color: #536151; font-size: .72rem; font-weight: 750; }
.no-variants-note { margin: 0; padding: 18px; border: 1px dashed var(--line); border-radius: 14px; background: #fff; color: var(--muted); }
@media (max-width: 700px) { .variant-name-row, .summary-top { grid-template-columns: 1fr; flex-direction: column; } .combo-count { align-self: flex-start; } }
