/* ==========================================================================
   목재 견적 계산기
   따뜻한 우드톤 디자인 시스템
   ========================================================================== */

:root {
    --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
        'Apple SD Gothic Neo', 'Noto Sans KR', 'Segoe UI', sans-serif;
    --mono: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    --maxw: 1000px;

    --bg: #f4f1ec;
    --surface: #ffffff;
    --surface-2: #faf8f5;
    --surface-3: #f0ebe4;
    --line: #e8e2d9;
    --line-strong: #d8d0c4;

    --ink: #1c1917;
    --ink-2: #57534e;
    --ink-3: #8a837c;
    --ink-4: #b5ada3;

    --accent: #a8642f;
    --accent-strong: #8b4f22;
    --accent-soft: #f6ebdf;
    --accent-ring: rgba(168, 100, 47, 0.22);

    --danger: #c93b2f;
    --danger-soft: #fbeae8;

    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.05);
    --shadow-md: 0 1px 2px rgba(28, 25, 23, 0.04), 0 12px 32px -16px rgba(28, 25, 23, 0.2);
    --shadow-lg: 0 24px 64px -24px rgba(28, 25, 23, 0.4);

    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* legacy aliases (script.js 인라인 스타일 호환) */
    --primary-color: var(--ink);
    --accent-color: var(--accent);
    --text-main: var(--ink);
    --text-sub: var(--ink-3);
    --border-color: var(--line);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img {
    max-width: 100%;
}

button,
input,
select,
textarea {
    font-family: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

input[type='number'] {
    -moz-appearance: textfield;
}

input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ==========================================================================
   App shell
   ========================================================================== */

.wizard-app {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ---------- Header ---------- */
.wd-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(244, 241, 236, 0.86);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border-bottom: 1px solid var(--line);
}

.wd-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 14px 24px 10px;
}

.wd-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wd-brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 16px;
    background:
        repeating-linear-gradient(100deg, rgba(255, 255, 255, 0.09) 0 2px, transparent 2px 7px),
        linear-gradient(135deg, #c98d57 0%, #a8642f 55%, #8b4f22 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 4px 12px -4px rgba(139, 79, 34, 0.5);
}

.wd-brand-text p {
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-3);
    line-height: 1.2;
}

.wd-brand-text strong {
    display: block;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.wd-cart {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px 0 12px;
    border-radius: var(--r-pill);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-2);
    transition: 0.18s var(--ease);
}

.wd-cart i {
    font-size: 14px;
    color: var(--ink-3);
}

.wd-cart:hover {
    border-color: var(--ink-4);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

.wd-cart-badge {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--r-pill);
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ---------- Stepper ---------- */
.wizard-steps {
    list-style: none;
    display: flex;
    align-items: center;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 6px 24px 16px;
}

.wizard-steps li {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    color: var(--ink-3);
    cursor: pointer;
    user-select: none;
}

.wizard-steps li:not(:last-child) {
    flex: 1 1 auto;
}

.wizard-steps li:not(:last-child)::after {
    content: '';
    flex: 1;
    height: 2px;
    min-width: 16px;
    margin: 0 14px;
    border-radius: 2px;
    background: var(--line-strong);
    pointer-events: none;
    transition: background 0.3s var(--ease);
}

.wizard-steps li.is-done:not(:last-child)::after {
    background: var(--accent);
}

.wizard-num {
    position: relative;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1.5px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink-3);
    display: grid;
    place-items: center;
    font-size: 12.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    transition: 0.25s var(--ease);
}

.wizard-steps li:hover .wizard-num {
    border-color: var(--ink-4);
}

.wizard-steps li.is-current .wizard-num {
    border-color: var(--accent);
    color: var(--accent-strong);
    box-shadow: 0 0 0 4px var(--accent-ring);
}

.wizard-steps li.is-done .wizard-num {
    background: var(--accent);
    border-color: var(--accent);
    color: transparent;
}

.wizard-steps li.is-done .wizard-num::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    top: 7px;
    left: 11px;
}

.wizard-label {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.2s;
}

.wizard-steps li.is-current .wizard-label {
    color: var(--ink);
    font-weight: 600;
}

.wizard-steps li.is-done .wizard-label {
    color: var(--ink-2);
}

/* ---------- Main ---------- */
.wizard-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
}

.wizard-top {
    padding: 32px 24px 20px;
}

.wizard-eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
}

.wizard-top h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.wizard-top p:not(.wizard-eyebrow) {
    margin-top: 6px;
    color: var(--ink-3);
    font-size: 15px;
}

.wizard-stage {
    flex: 1;
    padding: 0 24px 24px;
    min-height: 0;
    width: 100%;
}

.wizard-panel {
    display: none;
    min-height: 320px;
}

.wizard-panel.is-on {
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: wizard-in 0.4s var(--ease);
}

@keyframes wizard-in {
    from {
        opacity: 0;
        transform: translateX(var(--wizard-slide, 24px));
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ---------- Bottom bar ---------- */
.wizard-bar {
    position: sticky;
    bottom: 0;
    z-index: 30;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 14px 24px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    background: rgba(244, 241, 236, 0.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(216, 208, 196, 0.5);
}

.wizard-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 136px;
    height: 50px;
    padding: 0 22px;
    border-radius: var(--r-md);
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 600;
    transition: 0.18s var(--ease);
}

.wizard-btn::before,
.wizard-btn::after {
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 12px;
}

.wizard-btn.ghost {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line-strong);
}

.wizard-btn.ghost::before {
    content: '\f060';
    color: var(--ink-3);
}

.wizard-btn.ghost:hover:not(:disabled) {
    border-color: var(--ink-4);
    box-shadow: var(--shadow-sm);
}

.wizard-btn.ghost:disabled {
    opacity: 0.35;
    cursor: default;
}

.wizard-btn.primary {
    margin-left: auto;
    background: var(--ink);
    color: #fff;
    box-shadow: 0 6px 16px -8px rgba(28, 25, 23, 0.5);
}

.wizard-btn.primary::after {
    content: '\f061';
    transition: transform 0.2s var(--ease);
}

.wizard-btn.primary:hover {
    background: #2c2724;
}

.wizard-btn.primary:hover::after {
    transform: translateX(3px);
}

.wizard-btn:active {
    transform: scale(0.98);
}

/* ==========================================================================
   Step 1 · 목재 종류
   ========================================================================== */

/* 목재 이미지는 1000px 안팎의 안내문 포함 이미지라 타일을 크게 잡는다 (데스크톱 3열) */
.modal-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    align-items: start;
}

.mat-item {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s;
}

.mat-item:hover {
    transform: translateY(-3px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-md);
}

/* 이미지 비율(약 1000×1000, 300×300)을 그대로 살려 잘리지 않게 표시 */
.mat-item img {
    display: block;
    width: 100%;
    height: auto;
    background: #fff;
}

.mat-item p {
    padding: 12px 14px;
    font-size: 14.5px;
    font-weight: 600;
    text-align: center;
    color: var(--ink);
    border-top: 1px solid var(--line);
    background: var(--surface);
    transition: color 0.2s;
}

.mat-item.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent), var(--shadow-md);
}

.mat-item.active p {
    color: var(--accent-strong);
    background: var(--accent-soft);
    border-top-color: transparent;
}

.mat-item.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    display: grid;
    place-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    animation: pop-in 0.25s var(--spring);
}

@keyframes pop-in {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: none;
        opacity: 1;
    }
}

/* Quick select (현재 hidden · 스타일만 유지) */
.quick-select-container {
    position: relative;
}

.quick-select-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-pill);
    background: var(--surface);
    font-size: 13px;
    font-weight: 600;
}

.quick-select-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: 0.2s var(--ease);
    z-index: 10;
}

.quick-select-container.open .quick-select-dropdown {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.quick-select-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--line);
}

.quick-select-item:last-child {
    border-bottom: 0;
}

.quick-select-item:hover,
.quick-select-item.active {
    background: var(--surface-2);
}

.quick-select-item img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

.quick-select-item-info {
    flex: 1;
}

.quick-select-item-name {
    font-size: 14px;
    font-weight: 600;
}

.quick-select-item-desc {
    font-size: 11.5px;
    color: var(--ink-3);
    margin-top: 2px;
}

/* ==========================================================================
   Step 2 · 두께·크기
   ========================================================================== */

.size-sheet {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.material-selection-row {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px;
    background: var(--surface-2);
    border-right: 1px solid var(--line);
}

.mat-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--surface-3);
    cursor: zoom-in;
    transition: transform 0.2s var(--ease), box-shadow 0.2s;
}

.mat-thumb:hover {
    transform: scale(1.01);
    box-shadow: var(--shadow-md);
}

.mat-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mat-eyebrow {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-3);
}

.zoom-trigger {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    cursor: zoom-in;
    transition: color 0.2s;
}

.zoom-trigger:hover {
    color: var(--accent-strong);
}

.small-select-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--r-pill);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
    transition: 0.18s var(--ease);
}

.small-select-btn i {
    font-size: 11px;
    color: var(--ink-3);
}

.small-select-btn:hover {
    border-color: var(--ink-4);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

.size-form {
    padding: 26px 28px 24px;
    min-width: 0;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.input-field.full {
    grid-column: 1 / -1;
}

.input-field label {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 8px;
}

.limit-hint {
    margin-left: auto;
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-4);
    font-variant-numeric: tabular-nums;
}

.input-wrap,
.select-box {
    position: relative;
}

.input-wrap .unit {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-3);
    pointer-events: none;
}

.select-box::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--ink-3);
    pointer-events: none;
}

.select-box select,
.input-field input,
.quote-form input,
.quote-form select,
.quote-form textarea {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: var(--surface);
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.input-wrap input {
    padding-right: 44px;
}

.select-box select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 40px;
}

.select-box select:hover,
.input-field input:hover,
.quote-form input:hover,
.quote-form select:hover,
.quote-form textarea:hover {
    border-color: var(--ink-4);
}

.select-box select:focus,
.input-field input:focus,
.quote-form input:focus,
.quote-form select:focus,
.quote-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-ring);
}

/* 크기 미리보기 */
.size-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 180px;
    margin-top: 20px;
    padding: 24px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-md);
    background:
        linear-gradient(rgba(216, 208, 196, 0.45) 1px, transparent 1px),
        linear-gradient(90deg, rgba(216, 208, 196, 0.45) 1px, transparent 1px),
        var(--surface-2);
    background-size: 16px 16px, 16px 16px, auto;
}

.size-preview-board {
    position: relative;
    width: var(--pw, 120px);
    height: var(--ph, 120px);
    border-radius: 3px;
    background:
        repeating-linear-gradient(97deg, rgba(120, 80, 40, 0.06) 0 1px, transparent 1px 9px),
        linear-gradient(135deg, #ecd9bf 0%, #dcc3a1 100%);
    border: 1px solid rgba(139, 79, 34, 0.35);
    box-shadow: 0 8px 18px -10px rgba(139, 79, 34, 0.45);
    transition: width 0.25s var(--ease), height 0.25s var(--ease);
}

.size-preview-board .dim {
    position: absolute;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-2);
    white-space: nowrap;
    background: var(--surface);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--line);
}

.size-preview-board .dim::after {
    content: ' mm';
    color: var(--ink-4);
    font-weight: 500;
}

.size-preview-board .dim-w {
    top: -26px;
    left: 50%;
    transform: translateX(-50%);
}

.size-preview-board .dim-h {
    top: 50%;
    right: -10px;
    transform: translate(100%, -50%);
}

.size-help {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    font-size: 12.5px;
    color: var(--ink-3);
}

.size-help i {
    color: var(--ink-4);
}

/* ==========================================================================
   Step 3 · 가공
   ========================================================================== */

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

.shape-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 124px;
    padding: 18px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    cursor: pointer;
    text-align: center;
    transition: 0.2s var(--ease);
}

.shape-option:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-md);
}

.shape-option img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    transition: transform 0.25s var(--spring);
}

.shape-option:hover img {
    transform: scale(1.06);
}

.shape-option span {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-2);
}

.shape-option.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.shape-option.active span {
    color: var(--accent-strong);
}

.active-check {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    display: grid;
    place-items: center;
    opacity: 0;
    transform: scale(0.6);
    transition: 0.2s var(--spring);
}

.shape-option.active .active-check,
.quick-select-item.active .active-check {
    opacity: 1;
    transform: none;
}

.quick-select-item .active-check {
    position: static;
}

.processing-details-area {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.empty-processing-msg {
    padding: 32px 20px;
    text-align: center;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-md);
    color: var(--ink-3);
    font-size: 14px;
}

.empty-icon-wrapper {
    width: 44px;
    height: 44px;
    margin: 0 auto 12px;
    border-radius: 12px;
    background: var(--surface-3);
    color: var(--ink-3);
    display: grid;
    place-items: center;
    font-size: 18px;
}

.empty-processing-msg h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 4px;
}

.empty-processing-msg p {
    font-size: 13px;
    color: var(--ink-3);
    line-height: 1.55;
}

.process-detail-card {
    padding: 20px 22px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    animation: fade-up 0.3s var(--ease);
}

.process-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.process-detail-header img {
    width: 40px;
    height: 40px;
    padding: 7px;
    object-fit: contain;
    border-radius: 10px;
    background: var(--surface-3);
}

.process-detail-header h4 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.diameter-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 6px 12px;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.diameter-badge i {
    font-size: 9px;
    color: var(--accent);
}

.detail-input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

.detail-input-grid .input-field.full {
    grid-column: 1 / -1;
}

.detail-input-grid .input-field label {
    font-size: 12.5px;
}

.detail-input-grid input {
    height: 44px;
    font-size: 15px;
}

.process-info-text {
    margin-top: 12px;
    font-size: 12.5px;
    color: var(--ink-3);
    line-height: 1.65;
}

/* 경첩 카드 */
.hinge-grid-unified {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.hinge-card {
    padding: 12px 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    transition: 0.2s var(--ease);
}

.hinge-card.active {
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.hinge-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.hinge-num {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-3);
}

.hinge-card.active .hinge-num {
    color: var(--accent-strong);
}

.hinge-toggle {
    position: relative;
    width: 40px;
    height: 22px;
    cursor: pointer;
    flex-shrink: 0;
}

.hinge-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--line-strong);
    border-radius: var(--r-pill);
    transition: 0.25s var(--ease);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: 0.25s var(--spring);
}

.hinge-toggle input:checked + .toggle-slider {
    background: var(--accent);
}

.hinge-toggle input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

.hinge-toggle input:focus-visible + .toggle-slider {
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.hinge-card .detail-input-grid {
    grid-template-columns: 1fr;
    gap: 6px;
}

.hinge-card .input-field label {
    font-size: 12px;
    margin-bottom: 6px;
}

.hinge-card .input-field input {
    height: 40px;
    font-size: 14px;
}

.hinge-card .input-field input:disabled {
    background: var(--surface-3);
    border-color: var(--line);
    color: var(--ink-4);
    cursor: not-allowed;
}

.info-box-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
    font-size: 12.5px;
    color: var(--ink-3);
}

.info-box-compact::before {
    content: '\f05a';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--ink-4);
}

/* ==========================================================================
   Step 4 · 확인
   ========================================================================== */

.confirm-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start;
}

.visual-blueprint-area {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.grid-bg {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--line) 1px, transparent 1px),
        linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.7;
    -webkit-mask-image: radial-gradient(ellipse at center, #000 45%, transparent 100%);
    mask-image: radial-gradient(ellipse at center, #000 45%, transparent 100%);
}

#blueprint-svg {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.confirm-side {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: sticky;
    top: 132px;
}

.summary-card {
    padding: 18px 22px 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
}

.summary-card h3 {
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--ink-3);
    margin-bottom: 6px;
}

.summary-list > div {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 11px 0;
    border-top: 1px solid var(--line);
    font-size: 14px;
}

.summary-list > div:first-child {
    border-top: 0;
}

.summary-list dt {
    flex-shrink: 0;
    color: var(--ink-3);
}

.summary-list dd {
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
    word-break: keep-all;
}

.summary-list dd.muted {
    color: var(--ink-4);
    font-weight: 500;
}

.cart-action-area-compact {
    padding: 20px 22px 18px;
    background: var(--ink);
    color: #fff;
    border-radius: var(--r-lg);
    box-shadow: 0 20px 40px -20px rgba(28, 25, 23, 0.6);
}

.price-display-compact {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 16px;
}

.price-display-compact .label {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
}

.price-display-compact .price-val {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.price-display-compact .price-val small {
    margin-left: 2px;
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
}

.cart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 50px;
    border: 0;
    border-radius: var(--r-md);
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    transition: 0.18s var(--ease);
}

.cart-btn i {
    font-size: 12px;
}

.cart-btn:hover {
    background: #b9743d;
}

.cart-btn:active {
    transform: scale(0.98);
}

.cart-note {
    margin-top: 10px;
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   Step 5 · 주문서
   ========================================================================== */

.order-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 20px;
}

.order-sheet-head {
    flex: 1 0 100%;
    display: flex;
    align-items: center;
    gap: 10px;
}

.order-sheet-head h3 {
    font-size: 15px;
    font-weight: 700;
}

.order-count-badge {
    display: inline-grid;
    place-items: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: var(--r-pill);
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.order-count-badge.pulse {
    animation: badgePulse 0.4s var(--spring);
}

@keyframes badgePulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

#order-list-body {
    flex: 1 1 440px;
    min-width: 0;
}

.order-empty-msg {
    padding: 56px 20px;
    text-align: center;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-lg);
    color: var(--ink-3);
}

.order-empty-msg .empty-icon-wrapper {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    font-size: 22px;
    margin-bottom: 14px;
}

.order-empty-msg h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 4px;
}

.order-empty-msg p {
    font-size: 13px;
    color: var(--ink-3);
}

.order-item-card {
    padding: 16px 18px;
    margin-bottom: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
    animation: fade-up 0.3s var(--ease);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.order-item-card:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow-md);
}

.order-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.order-item-num {
    padding: 3px 9px;
    border-radius: var(--r-pill);
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.order-item-delete {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-4);
    font-size: 13px;
    display: grid;
    place-items: center;
    transition: 0.18s;
}

@media (hover: hover) {
    .order-item-delete:hover {
        background: var(--danger-soft);
        color: var(--danger);
    }
}

.order-item-material {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.order-item-size {
    margin-top: 2px;
    font-size: 13px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}

.order-item-processes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.order-process-tag {
    padding: 4px 9px;
    border-radius: 6px;
    background: var(--surface-3);
    color: var(--ink-2);
    font-size: 11.5px;
    font-weight: 600;
}

.order-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.order-item-qty {
    display: inline-flex;
    align-items: center;
    padding: 2px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-pill);
    background: var(--surface);
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ink-2);
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    display: grid;
    place-items: center;
    transition: 0.15s;
}

.qty-btn:hover {
    background: var(--surface-3);
    color: var(--ink);
}

.qty-value {
    min-width: 28px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.order-item-price {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.order-item-price small {
    margin-left: 1px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-3);
}

.order-footer {
    flex: 0 0 320px;
    position: sticky;
    top: 132px;
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
}

.order-total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
}

.order-total-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-3);
}

.order-total-price {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.order-footer-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.order-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: var(--r-md);
    background: var(--ink);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    transition: 0.18s var(--ease);
}

.order-submit-btn i {
    font-size: 13px;
}

.order-submit-btn:hover {
    background: #2c2724;
}

.order-submit-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.order-clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 42px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    background: transparent;
    color: var(--ink-3);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: 0.18s;
}

@media (hover: hover) {
    .order-clear-btn:hover {
        background: var(--danger-soft);
        border-color: #f1c5c0;
        color: var(--danger);
    }
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(28, 25, 23, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
}

.modal-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1050px;
    max-height: 90vh;
    max-height: 90dvh;
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modal-in 0.28s var(--ease);
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
}

.modal-header h2 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.modal-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: var(--surface-3);
    color: var(--ink-2);
    font-size: 15px;
    display: grid;
    place-items: center;
    transition: 0.15s;
}

.modal-close:hover {
    background: var(--line);
    color: var(--ink);
}

.modal-body-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--surface-2);
}

/* 주문서 작성 */
.quote-modal-box {
    max-width: 480px;
}

.quote-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 22px 22px;
    overflow-y: auto;
}

.quote-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.quote-sum-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-3);
}

.quote-sum-line strong {
    font-size: 18px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.quote-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
}

.quote-form input,
.quote-form select {
    height: 46px;
    font-size: 15px;
    font-weight: 500;
}

.quote-form input::placeholder,
.quote-form textarea::placeholder {
    color: var(--ink-4);
    font-weight: 400;
}

.quote-form textarea {
    height: auto;
    min-height: 88px;
    padding: 12px 14px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    resize: vertical;
}

.quote-form .order-submit-btn {
    margin-top: 6px;
}

.quote-error {
    padding: 10px 12px;
    border-radius: var(--r-sm);
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 13px;
    font-weight: 500;
}

.quote-done {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 30px 22px 22px;
    text-align: center;
}

.quote-done-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 6px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 22px;
    display: grid;
    place-items: center;
    animation: pop-in 0.35s var(--spring);
}

.quote-done h3 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.quote-done p {
    font-size: 14px;
    color: var(--ink-2);
    line-height: 1.6;
}

.quote-done-amount {
    margin: 4px 0 10px;
    font-size: 30px !important;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--ink) !important;
    font-variant-numeric: tabular-nums;
}

.quote-done .order-submit-btn,
.quote-done .order-clear-btn {
    width: 100%;
}

/* 이미지 팝업 */
.image-popup-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(20, 17, 15, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 2000;
}

.image-popup-content {
    position: relative;
    max-width: min(90vw, 720px);
    text-align: center;
    animation: modal-in 0.28s var(--ease);
}

#popup-image {
    display: block;
    max-width: 100%;
    max-height: 78vh;
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
}

.image-popup-title {
    margin-top: 14px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    font-weight: 600;
}

.image-popup-close {
    position: absolute;
    top: -48px;
    right: 0;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 18px;
    display: grid;
    place-items: center;
    transition: background 0.15s;
}

.image-popup-close:hover {
    background: rgba(255, 255, 255, 0.24);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
    .wd-header-row {
        padding: 12px 16px 8px;
    }

    .wd-brand-mark {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 14px;
    }

    .wd-brand-text strong {
        font-size: 16px;
    }

    .wizard-steps {
        padding: 4px 16px 14px;
    }

    .wizard-steps li:not(:last-child)::after {
        margin: 0 8px;
        min-width: 10px;
    }

    .wizard-label {
        display: none;
    }

    .wizard-steps li.is-current .wizard-label {
        display: inline;
    }

    .wizard-num {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .wizard-steps li.is-done .wizard-num::after {
        top: 6px;
        left: 10px;
    }

    .wizard-top {
        padding: 24px 16px 16px;
    }

    .wizard-top h1 {
        font-size: 24px;
    }

    .wizard-top p:not(.wizard-eyebrow) {
        font-size: 14px;
    }

    .wizard-stage {
        padding: 0 16px 16px;
    }

    .wizard-bar {
        padding-left: 16px;
        padding-right: 16px;
        border-top: 1px solid var(--line);
    }

    .confirm-layout {
        grid-template-columns: 1fr;
    }

    .confirm-side {
        position: static;
    }

    .order-footer {
        position: static;
        flex: 1 1 100%;
    }
}

@media (max-width: 720px) {
    .wd-cart-text {
        display: none;
    }

    .wd-cart {
        padding: 0 12px;
        gap: 6px;
    }

    .modal-grid-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .mat-item p {
        padding: 10px 10px;
        font-size: 13.5px;
    }

    .size-sheet {
        grid-template-columns: 1fr;
    }

    .material-selection-row {
        display: grid;
        grid-template-columns: 64px minmax(0, 1fr) auto;
        align-items: center;
        gap: 14px;
        padding: 16px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .mat-thumb {
        width: 64px;
        border-radius: 10px;
    }

    .zoom-trigger {
        font-size: 16px;
    }

    .small-select-btn {
        align-self: center;
    }

    .size-form {
        padding: 20px 16px;
    }

    .input-grid {
        gap: 12px;
    }

    .size-preview {
        height: 150px;
    }

    .options-grid-3col {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .shape-option {
        min-height: 110px;
    }

    .process-detail-card {
        padding: 16px;
    }

    .process-detail-header {
        flex-wrap: wrap;
    }

    .diameter-badge {
        margin-left: 0;
        flex-basis: 100%;
        justify-content: center;
    }

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

    .wizard-btn {
        min-width: 0;
        flex: 1 1 0;
    }

    .wizard-btn.ghost {
        flex: 0 0 auto;
        padding: 0 18px;
    }

    .quote-grid {
        grid-template-columns: 1fr;
    }

    .quote-form {
        padding: 18px 16px 20px;
    }
}

/* 폰에서는 이미지 안내문이 읽히도록 1열 */
@media (max-width: 560px) {
    .modal-grid-container {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .mat-item p {
        padding: 12px 14px;
        font-size: 14.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
