:root {
    color-scheme: light;
    --navy: #0d2a55;
    --navy-2: #12376d;
    --ink: #101828;
    --muted: #667085;
    --soft: #f6f8fb;
    --paper: #f7f9fc;
    --surface: #ffffff;
    --line: #dbe3ee;
    --line-strong: #c8d3e1;
    --accent: #1d4f9a;
    --success: #12805c;
    --warn: #a75a18;
    --shadow: 0 18px 45px rgba(16, 24, 40, 0.08);
    --shadow-soft: 0 8px 22px rgba(16, 24, 40, 0.06);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, Arial, Helvetica, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(29, 79, 154, 0.08), transparent 34%),
        linear-gradient(180deg, #ffffff 0, var(--paper) 320px);
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: 260px minmax(320px, 1fr) auto;
    align-items: center;
    gap: 24px;
    min-height: 86px;
    padding: 14px 34px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--navy);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 2px solid var(--navy);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 900;
}

.brand strong {
    display: block;
    font-size: 19px;
    letter-spacing: 0;
    text-transform: uppercase;
}

.brand small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.topnav {
    display: flex;
    justify-content: center;
    gap: clamp(24px, 4vw, 64px);
}

.topnav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 54px;
    color: #596477;
    font-size: 15px;
    font-weight: 750;
    text-decoration: none;
}

.topnav a.is-current {
    color: var(--navy);
}

.topnav a.is-current::after {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    border-radius: 999px;
    background: var(--navy);
    content: "";
}

.top-actions {
    display: flex;
    justify-content: end;
    gap: 12px;
}

.top-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    border: 0;
    background: transparent;
    color: #344054;
    font-weight: 700;
}

.top-action span {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    color: var(--navy);
    font-size: 10px;
    font-weight: 900;
}

.cart-action b {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #fff;
    background: var(--navy);
    font-size: 12px;
}

.quote-shell {
    display: grid;
    grid-template-columns: 286px minmax(0, 1fr) 340px;
    gap: 24px;
    width: min(1600px, 100%);
    margin: 0 auto;
    padding: 22px;
}

.left-panel,
.summary-panel {
    position: sticky;
    top: 108px;
    align-self: start;
}

.left-panel {
    display: grid;
    gap: 14px;
}

.panel-block,
.summary-card,
.editor-card,
.inventory-card,
.benefits-bar {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.panel-block {
    padding: 18px;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    color: var(--navy);
    font-size: 14px;
    font-weight: 900;
    text-transform: uppercase;
}

.panel-title span,
.step span {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: #fff;
    background: var(--navy);
    font-size: 13px;
    font-weight: 900;
}

.steps-panel ol {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.step {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    color: #596477;
    font-size: 13px;
    font-weight: 800;
}

.step:not(.is-active) span {
    color: var(--navy);
    background: #eaf0f8;
}

.upload-panel,
.measure-grid,
.filters-panel {
    display: grid;
    gap: 14px;
}

.upload-box {
    display: grid;
    place-items: center;
    gap: 7px;
    min-height: 138px;
    padding: 18px;
    border: 1px dashed #b9c7da;
    border-radius: 8px;
    background: linear-gradient(180deg, #fbfdff, #f4f7fb);
    color: var(--navy);
    text-align: center;
}

.upload-box input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.upload-box span {
    margin: 0;
    font-weight: 900;
}

.upload-box small,
.quality-box span,
.catalog-hero p,
.editor-copy p,
.benefits-bar span {
    color: var(--muted);
    line-height: 1.5;
}

.toggle-row {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 28px;
    color: #475467;
    font-size: 13px;
    font-weight: 750;
}

.toggle-row input {
    width: 17px;
    min-height: 17px;
}

.quality-box {
    display: grid;
    gap: 6px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcff;
}

.quality-box.is-good {
    border-color: rgba(18, 128, 92, 0.25);
    background: #eef9f4;
}

.quality-box.is-warning {
    border-color: rgba(167, 90, 24, 0.25);
    background: #fff5ea;
}

label span {
    display: block;
    margin-bottom: 7px;
    color: #475467;
    font-size: 13px;
    font-weight: 800;
}

input,
select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--ink);
    background: #fff;
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(29, 79, 154, 0.10);
}

.color-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.color-row button {
    width: 23px;
    height: 23px;
    border: 1px solid rgba(16, 24, 40, 0.10);
    border-radius: 50%;
    background: var(--swatch);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.45);
}

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

.pill {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    background: #fff;
    color: #475467;
    font-size: 13px;
    font-weight: 800;
}

.pill.is-selected {
    color: #fff;
    background: var(--navy);
    border-color: var(--navy);
}

.workspace {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.catalog-hero {
    display: grid;
    gap: 8px;
    padding: 18px 2px 4px;
}

.eyebrow {
    margin: 0;
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    color: var(--ink);
    font-size: clamp(28px, 4vw, 36px);
    line-height: 1.1;
}

h2 {
    margin-bottom: 0;
    color: var(--ink);
    font-size: 22px;
}

.editor-card {
    display: grid;
    grid-template-columns: minmax(180px, 0.35fr) minmax(0, 1fr);
    gap: 20px;
    padding: 20px;
    align-items: center;
}

.live-preview {
    display: grid;
    gap: 12px;
}

.frame-stage {
    display: grid;
    place-items: center;
    min-height: 360px;
    padding: var(--frame-size);
    border-radius: 8px;
    background: var(--frame-pattern);
    background-size: 112px 100%;
    box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.14), 0 24px 36px rgba(16, 24, 40, 0.12);
}

.mat-stage {
    display: grid;
    place-items: center;
    width: 100%;
    max-width: 560px;
    aspect-ratio: 4 / 3;
    padding: var(--mat-size, 0px);
    background: var(--mat-color, transparent);
    box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.08);
}

.art-window {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    min-height: 180px;
    overflow: hidden;
    color: #667085;
    font-weight: 900;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.72), rgba(255,255,255,0.42)),
        linear-gradient(145deg, #dbe6f3, #f0dcc4 50%, #c9d8e6);
}

.art-window img {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: translate(calc(-50% + var(--image-x, 0px)), calc(-50% + var(--image-y, 0px))) scale(var(--image-zoom, 1));
    transform-origin: center;
    user-select: none;
    pointer-events: none;
}

.is-no-image .art-window img {
    display: none;
}

.editor-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.editor-actions button,
.compare-button,
.select-button {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--navy);
    background: #fff;
    font-weight: 850;
}

.editor-actions button:hover,
.compare-button:hover,
.select-button:hover {
    border-color: var(--navy);
    box-shadow: 0 0 0 4px rgba(13, 42, 85, 0.08);
}

.inventory-card {
    display: grid;
    gap: 16px;
    padding: 20px;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.inventory-metric {
    display: grid;
    gap: 5px;
    min-height: 104px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
}

.inventory-metric span,
.inventory-metric small {
    color: var(--muted);
}

.inventory-metric strong {
    color: var(--navy);
    font-size: 24px;
}

.stock-alert {
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 850;
}

.stock-alert.is-ok {
    color: #0a6d4a;
    background: #eaf8f2;
}

.stock-alert.is-low {
    color: var(--warn);
    background: #fff1e4;
}

.catalog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 4px;
}

.moulding-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.moulding-card {
    position: relative;
    overflow: hidden;
    display: grid;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.moulding-card:hover,
.moulding-card.is-selected {
    border-color: rgba(13, 42, 85, 0.55);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.moulding-card.is-selected::after {
    position: absolute;
    inset: 0;
    border: 2px solid var(--navy);
    border-radius: 8px;
    pointer-events: none;
    content: "";
}

.favorite-button {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--navy);
    background: rgba(255, 255, 255, 0.94);
    font-size: 18px;
    font-weight: 500;
}

.frame-preview {
    display: grid;
    place-items: center;
    min-height: 225px;
    padding: var(--frame-size);
    background: var(--frame-pattern);
    background-size: 96px 100%;
}

.preview-art {
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 128px;
    color: transparent;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.70), rgba(255,255,255,0.32)),
        linear-gradient(145deg, #dde8f2, #ebd6ba 48%, #c5d4df);
    border: 10px solid #f8f5ef;
    box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.08);
}

.moulding-info {
    display: grid;
    gap: 10px;
    padding: 14px;
}

.moulding-title-row {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
}

.moulding-title-row h3 {
    margin: 0;
    color: var(--navy);
    font-size: 16px;
    line-height: 1.25;
}

.tag {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 5px 9px;
    color: var(--navy);
    background: #edf3fb;
    font-size: 11px;
    font-weight: 900;
}

.moulding-info p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 13px;
}

.moulding-info dl,
.summary-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.moulding-info dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    color: #475467;
    font-size: 13px;
}

.moulding-info dl div,
.summary-list div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

dt {
    color: var(--muted);
}

dd {
    margin: 0;
    color: var(--ink);
    font-weight: 850;
    text-align: right;
}

.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 4px;
}

.product-footer strong {
    color: var(--navy);
    font-size: 18px;
}

.product-footer strong span {
    margin-left: 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.select-button {
    min-height: 36px;
    padding: 0 12px;
}

.benefits-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 18px;
}

.benefits-bar div {
    display: grid;
    gap: 4px;
    padding: 0 14px;
}

.benefits-bar div + div {
    border-left: 1px solid var(--line);
}

.summary-card {
    display: grid;
    gap: 18px;
    padding: 20px;
}

.summary-card h2 {
    font-size: 18px;
}

.summary-product {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
}

.selected-texture {
    min-height: 104px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--frame-pattern);
    background-size: 92px 100%;
    box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.08);
}

.summary-product strong,
.summary-product span {
    display: block;
}

.summary-product strong {
    color: var(--ink);
    line-height: 1.3;
}

.summary-product span {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.summary-list {
    padding: 8px 0 0;
}

.summary-list div {
    min-height: 27px;
    font-size: 14px;
}

.free-shipping {
    color: var(--success);
}

.total-row {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.total-row span {
    color: var(--ink);
    font-size: 18px;
    font-weight: 850;
}

.total-row strong {
    color: var(--ink);
    font-size: 30px;
    line-height: 1;
}

.tax-note {
    margin: -8px 0 0;
    color: var(--muted);
    font-size: 13px;
    text-align: right;
}

.pay-button,
.save-button,
.whatsapp-button {
    display: grid;
    place-items: center;
    min-height: 48px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-weight: 900;
    text-decoration: none;
}

.pay-button {
    color: #fff;
    background: linear-gradient(135deg, var(--navy), var(--navy-2));
    opacity: 0.62;
}

.save-button {
    color: var(--navy);
    background: #fff;
    border-color: var(--line-strong);
}

.whatsapp-button {
    color: #fff;
    background: var(--success);
}

.help-card {
    display: grid;
    gap: 3px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: #fff;
}

.help-card span {
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 1300px) {
    .quote-shell {
        grid-template-columns: 260px minmax(0, 1fr);
    }

    .summary-panel {
        position: static;
        grid-column: 1 / -1;
    }

    .summary-card {
        grid-template-columns: 1fr 1.5fr;
        align-items: start;
    }

    .summary-card .eyebrow,
    .summary-card h2,
    .summary-product,
    .total-row,
    .tax-note,
    .pay-button,
    .save-button,
    .whatsapp-button,
    .help-card {
        grid-column: 1;
    }

    .summary-list {
        grid-column: 2;
        grid-row: 1 / span 8;
    }
}

@media (max-width: 1040px) {
    .topbar {
        grid-template-columns: 1fr auto;
    }

    .topnav {
        display: none;
    }

    .quote-shell {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .left-panel,
    .summary-panel {
        position: static;
    }

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

    .steps-panel {
        grid-column: 1 / -1;
    }

    .steps-panel ol {
        grid-template-columns: repeat(5, minmax(128px, 1fr));
        overflow-x: auto;
        padding-bottom: 4px;
    }

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

@media (max-width: 760px) {
    .topbar {
        min-height: auto;
        padding: 12px 16px;
    }

    .brand strong {
        font-size: 15px;
    }

    .top-actions {
        gap: 4px;
    }

    .top-action {
        font-size: 0;
    }

    .top-action span,
    .cart-action b {
        font-size: 10px;
    }

    .left-panel,
    .inventory-grid,
    .moulding-grid,
    .benefits-bar,
    .summary-card {
        grid-template-columns: 1fr;
    }

    .summary-list,
    .summary-card .eyebrow,
    .summary-card h2,
    .summary-product,
    .total-row,
    .tax-note,
    .pay-button,
    .save-button,
    .whatsapp-button,
    .help-card {
        grid-column: auto;
        grid-row: auto;
    }

    .catalog-header {
        align-items: stretch;
        flex-direction: column;
    }

    .compare-button {
        width: 100%;
    }

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

    .frame-stage {
        min-height: 300px;
    }

    .benefits-bar div {
        padding: 0;
    }

    .benefits-bar div + div {
        padding-top: 12px;
        border-top: 1px solid var(--line);
        border-left: 0;
    }
}
