.db-container {
    --db-red: #cd1c22;
    --db-red-dark: #a81519;
    --db-ink: #1a1a1a;
    --db-muted: #6b7280;
    --db-line: #e5e7eb;
    --db-bg-soft: #f6f7f8;
    --db-radius: 14px;
    --db-shadow: 0 1px 2px rgba(16,24,40,.06);
    --db-shadow-lg: 0 16px 32px rgba(16,24,40,.14);
    max-width: 960px;
    margin: 0 auto;
    padding: 16px 0 56px;
    font-family: inherit;
    color: var(--db-ink);
}

.db-header { margin-bottom: 28px; }
.db-title { margin: 0 0 14px; font-size: 1.9rem; font-weight: 800; letter-spacing: -.005em; line-height: 1.15; text-transform: uppercase; }

.db-progress-bar {
    height: 8px;
    background: #eef0f2;
    border-radius: 999px;
    overflow: hidden;
}
.db-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--db-red), #e8453b);
    border-radius: 999px;
    transition: width .35s cubic-bezier(.4, 0, .2, 1);
}

/* Honour the hidden attribute on JS-toggled elements (upload preview, lock
   overlay, lead messages); class rules like display:inline-block would otherwise
   override it and show empty/broken content. */
.db-container [hidden] { display: none !important; }

.db-step { display: none; }
.db-step.active { display: block; animation: dbFade .25s ease; }
@keyframes dbFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.db-step h4 { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 1.4rem; font-weight: 800; letter-spacing: -.01em; margin: 0 0 22px; color: var(--db-ink); }
.db-step-num {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    background: var(--db-red); color: #fff;
    border-radius: 50%;
    font-size: 1rem; font-weight: 800;
    box-shadow: 0 2px 6px rgba(205,28,34,.3);
}
.db-subhead { margin: 28px 0 12px; font-size: 1.05rem; font-weight: 700; }
.db-optional { font-weight: 400; color: var(--db-muted); font-size: .85rem; }

/* Card grids (range / style) */
.db-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}
.db-card {
    text-align: left;
    background: #fff;
    border: 1px solid var(--db-line);
    border-radius: var(--db-radius);
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--db-shadow);
}
.db-card:hover { transform: translateY(-4px); border-color: #d1d5db; box-shadow: var(--db-shadow-lg); }
.db-card.selected { border-color: var(--db-red); border-width: 2px; box-shadow: 0 0 0 3px rgba(205,28,34,.18), var(--db-shadow-lg); }
.db-card-media {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #fff;
    border-bottom: 1px solid var(--db-line);
    overflow: hidden;
    padding: 10px;
    box-sizing: border-box;
}
.db-card-media img {
    width: 100%;
    height: 100%;
    /* Product shots sit on white and vary in aspect ratio; contain shows the
       whole door (no cropped tops/open leaves) rather than zoom-cropping it. */
    object-fit: contain;
    display: block;
    transition: transform .35s ease;
}
.db-card:hover .db-card-media img { transform: scale(1.04); }
.db-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px 20px 20px;
}
.db-card-title { font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; }
.db-card-desc { font-size: .875rem; color: var(--db-muted); line-height: 1.55; }

/* Colour swatches */
.db-swatch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 14px;
}
.db-swatch {
    background: #fff;
    border: 1px solid var(--db-line);
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: var(--db-shadow);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.db-swatch:hover { transform: translateY(-2px); border-color: #d1d5db; box-shadow: var(--db-shadow-lg); }
.db-swatch.selected { border-color: var(--db-red); box-shadow: 0 0 0 3px rgba(205,28,34,.16); }
.db-swatch-chip {
    width: 100%;
    height: 52px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,.08);
}
.db-swatch-name { font-size: .8rem; text-align: center; color: var(--db-muted); font-weight: 500; }
.db-swatch.selected .db-swatch-name { color: var(--db-ink); }

/* Finish pills */
.db-pill-row { display: flex; flex-wrap: wrap; gap: 10px; }
.db-pill {
    border: 1px solid var(--db-line);
    background: #fff;
    border-radius: 999px;
    padding: 9px 20px;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 500;
    transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.db-pill:hover { border-color: var(--db-red); color: var(--db-red); }
.db-pill.selected { border-color: var(--db-red); background: var(--db-red); color: #fff; }

/* Options checkboxes */
.db-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.db-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--db-line);
    border-radius: 12px;
    padding: 15px 16px;
    cursor: pointer;
    font-weight: 500;
    box-shadow: var(--db-shadow);
    transition: border-color .15s ease, background .15s ease;
}
.db-checkbox:hover { border-color: #d1d5db; }
.db-checkbox:has(input:checked) { border-color: var(--db-red); background: rgba(205,28,34,.04); }
.db-checkbox input { width: 18px; height: 18px; accent-color: var(--db-red); }

/* Upload */
.db-guidance {
    background: #f5f7fa;
    border-left: 4px solid #cd1c22;
    padding: 12px 16px;
    border-radius: 0 6px 6px 0;
    font-size: .9rem;
    line-height: 1.5;
    margin-bottom: 18px;
}
.db-guidance-warning { background: #fff4f4; border-left-color: #d8000c; color: #a30000; font-weight: 500; }

/* Visually hidden (not display:none) so mobile browsers still open the picker
   when the input's native .click() fires. */
.db-file-input {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); border: 0;
}
.db-upload-area {
    border: 2px dashed #cfcfcf;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    position: relative;
}
.db-upload-area:hover, .db-upload-area.dragover { border-color: #cd1c22; background: #fafafa; }
.db-upload-text { font-weight: 600; margin: 0 0 6px; }
.db-upload-hint { font-size: .8rem; color: #888; margin: 0; }

.db-preview-container { position: relative; display: inline-block; }
.db-preview-image { max-width: 100%; max-height: 360px; border-radius: 8px; }
.db-remove-image {
    position: absolute;
    top: 8px; right: 8px;
    width: 32px; height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

/* Buttons */
.db-step-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; align-items: center; }
/* Back sits far left, Next far right; a lone Next stays right-aligned. */
.db-step-actions .db-back { margin-right: auto; }
/* Header row: step title on the left, the Back/Next pair on the far right,
   on the same line. Buttons stay grouped (no auto-margin split) and are a
   touch smaller than the bottom bar so they sit neatly beside the title. */
.db-step-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 14px; }
/* Live selection breadcrumb under the step header. */
.db-selection {
    margin: 0 0 20px;
    font-size: .8rem;
    line-height: 1.5;
    color: var(--db-muted);
    font-weight: 500;
}
.db-step-head h4 { margin: 0; }
.db-step-actions-top { margin: 0; }
.db-step-actions-top .db-back { margin-right: 0; }
.db-step-actions-top .db-btn { padding: 9px 20px; font-size: .85rem; }
.db-btn {
    border: 2px solid transparent;
    box-sizing: border-box;
    border-radius: 10px;
    padding: 14px 30px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
}
/* Clean solid brand-red button: no border, no icon. Subtle darken on hover. */
.db-btn-primary {
    /* !important: the Download control is an <a>, so the theme's link colour
       would otherwise win over this white. */
    background: var(--db-red); color: #fff !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.db-btn-primary:hover { background: #c01920; }
.db-btn-primary:disabled,
.db-btn-primary:disabled:hover {
    background: #e5e7eb; color: #9aa0a6;
    cursor: not-allowed; box-shadow: none; transform: none;
}
.db-btn-secondary { background: #f1f2f4; color: #333; }
.db-btn-secondary:hover { background: #e5e7eb; }
/* Reset link: quieter than Back so it doesn't compete with the main nav. */
.db-btn-ghost { background: transparent; color: var(--db-muted); }
.db-btn-ghost:hover { background: #f1f2f4; color: #333; }

/* Processing */
.db-processing-content { text-align: center; padding: 50px 20px; }
.db-spinner {
    width: 48px; height: 48px;
    margin: 0 auto 20px;
    border: 4px solid #eee;
    border-top-color: #cd1c22;
    border-radius: 50%;
    animation: dbSpin 1s linear infinite;
}
@keyframes dbSpin { to { transform: rotate(360deg); } }
.db-processing-text { font-weight: 600; margin: 0 0 6px; }
.db-processing-hint { font-size: .85rem; color: #888; }

/* Result */
.db-summary { font-weight: 600; margin-bottom: 18px; color: #444; }

/* Before/after drag-to-compare slider: one large image, a divider you drag
   (or click/tap) to reveal the "after" render over the "before" photo. */
.db-compare {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #eee;
    user-select: none;
    touch-action: none; /* let the widget own the horizontal drag gesture */
    cursor: ew-resize;
    line-height: 0;
}
.db-compare-img { display: block; width: 100%; height: auto; }
/* "After" sits exactly over "before" and shows to the RIGHT of the divider,
   so the labels read correctly: original photo left, new door right. */
.db-compare-after {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    clip-path: inset(0 0 0 50%);
}
.db-compare-handle {
    position: absolute;
    top: 0; bottom: 0;
    left: 50%;
    width: 2px;
    margin-left: -1px;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,.15);
    cursor: ew-resize;
}
.db-compare-handle:focus-visible { outline: 3px solid var(--db-red); outline-offset: 2px; }
.db-compare-grip {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 42px; height: 42px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 6px rgba(0,0,0,.35);
}
/* Two chevrons on the grip pointing left/right. */
.db-compare-grip::before,
.db-compare-grip::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 7px; height: 7px;
    border: 2px solid #333;
    border-width: 2px 2px 0 0;
}
.db-compare-grip::before { left: 11px; transform: translateY(-50%) rotate(-135deg); }
.db-compare-grip::after  { right: 11px; transform: translateY(-50%) rotate(45deg); }
.db-compare-label {
    position: absolute;
    top: 12px;
    padding: 4px 10px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: #fff;
    background: rgba(0,0,0,.55);
    border-radius: 4px;
    line-height: 1.2;
    pointer-events: none;
}
.db-compare-label-before { left: 12px; }
.db-compare-label-after { right: 12px; }

/* Gated result: blur the render and hide the download until details given */
.db-gated #db-processed-result { filter: blur(18px); }
.db-gated #db-download { display: none; }
.db-lock-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
    background: rgba(255,255,255,.35);
    z-index: 3;
}
/* Overlay appears ONLY when gating is actually enabled (.db-gated). */
.db-gated .db-lock-overlay { display: flex; }
.db-lock-overlay span {
    background: rgba(0,0,0,.7);
    color: #fff;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: .9rem;
}

/* Lead capture */
.db-lead {
    margin-top: 28px;
    padding: 24px;
    border: 2px solid #e2e2e2;
    border-radius: 12px;
    background: #fafafa;
}
.db-lead-title { margin: 0 0 6px; font-size: 1.1rem; }
.db-lead-intro { margin: 0 0 18px; font-size: .9rem; color: #555; line-height: 1.5; }
.db-lead-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}
.db-field { display: flex; flex-direction: column; gap: 6px; }
.db-field span { font-size: .85rem; font-weight: 600; }
.db-field input {
    border: 2px solid #d8d8d8;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: .95rem;
    font-family: inherit;
}
.db-field input:focus { outline: none; border-color: #cd1c22; }
.db-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.db-lead-error { color: #a30000; font-weight: 500; font-size: .9rem; margin: 0 0 12px; }
.db-lead-consent { font-size: .75rem; color: #888; margin: 12px 0 0; line-height: 1.4; }
.db-lead-success {
    background: #eaf6ec;
    border: 1px solid #b8dcc0;
    border-radius: 8px;
    padding: 16px 18px;
    color: #1d6b2c;
    font-weight: 500;
}

@media (max-width: 600px) {
    .db-lead-fields { grid-template-columns: 1fr; }
}

.db-option-note{display:block;font-size:11px;color:#9aa0a6;font-weight:400;margin-top:2px;}
/* An option locked out by a mutually-exclusive choice (wicket vs side door). */
.db-checkbox-disabled { opacity: .45; cursor: not-allowed; }
.db-checkbox-disabled input { cursor: not-allowed; }
