*, *::before, *::after { box-sizing: border-box; }
body { background: #f0f4f8; font-family: 'Segoe UI', Arial, sans-serif; margin: 0; padding: 0; color:#222; }

.page-wrap { max-width: 820px; margin: 0 auto; padding: 0 16px 60px; }

/* Sticky header w/ steps */
.top-header { background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.06); position: sticky; top: 0; z-index: 500; padding-bottom: 4px; }
.logo-bar { text-align: center; padding: 22px 0 4px; }
.logo-bar img { height: 46px; }

.page-title { text-align: center; color: #1a5fa8; font-size: 24px; font-weight: 700; margin: 0 0 4px; }
.page-subtitle { text-align: center; color: #666; font-size: 13px; margin: 0 0 14px; }

/* Progress bar */
.progress-track { max-width: 820px; margin: 0 auto; padding: 0 16px 18px; }
.progress-bar-bg { height: 6px; background: #e3ecf7; border-radius: 4px; overflow: hidden; margin-bottom: 22px; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg,#1a5fa8,#2f7fd0); border-radius: 4px; transition: width .35s ease; width: 25%; }

.steps-bar { display: flex; align-items: flex-start; justify-content: center; gap: 0; }
.step-item { display: flex; flex-direction: column; align-items: center; flex: 1; max-width: 200px; position: relative; cursor: default; }
.step-item.clickable { cursor: pointer; }
.step-item:not(:last-child)::after {
    content: ''; position: absolute; top: 18px; left: calc(50% + 18px);
    right: calc(-50% + 18px); height: 2px; background: #c8d8ea; z-index: 0;
}
.step-item.completed:not(:last-child)::after { background: #1a5fa8; }
.step-circle { width: 36px; height: 36px; border-radius: 50%; background: #c8d8ea; color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700;
    z-index: 1; transition: background .2s, box-shadow .2s; }
.step-item.active .step-circle { background: #1a5fa8; box-shadow: 0 2px 8px rgba(26,95,168,.35); }
.step-item.completed .step-circle { background: #43a047; }
.step-label { font-size: 12px; color: #888; margin-top: 6px; text-align: center; font-weight: 600; }
.step-item.active .step-label, .step-item.completed .step-label { color: #333; }

/* Cards */
.card { background: #fff; border-radius: 12px; box-shadow: 0 2px 16px rgba(0,0,0,.07); padding: 28px 32px; margin: 24px 0; }
.section-title { font-size: 12px; font-weight: 700; color: #1a5fa8; text-transform: uppercase; letter-spacing: .6px;
    margin: 26px 0 16px; padding-bottom: 8px; border-bottom: 1px dashed #e2eaf5; }
.section-title:first-child { margin-top: 0; }
.section-hint { font-size: 12px; color: #888; margin: -10px 0 16px; }

/* Grid */
.row { display: flex; flex-wrap: wrap; gap: 16px; margin: 0 -8px; }
.col-6 { flex: 1 1 calc(50% - 16px); min-width: 220px; }
.col-4 { flex: 1 1 calc(33.333% - 16px); min-width: 180px; }
.col-12 { flex: 1 1 100%; }

/* Form fields */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #333; margin-bottom: 6px; }
.form-group label .req { color: #e53935; margin-left: 2px; }
.form-control { width: 100%; padding: 10px 12px; font-size: 14px; border: 1px solid #cfd8e3; border-radius: 6px;
    background: #fff; transition: border-color .15s, box-shadow .15s; font-family: inherit; }
.form-control:focus { outline: none; border-color: #1a5fa8; box-shadow: 0 0 0 3px rgba(26,95,168,.12); }
.form-control.error { border-color: #e53935; }
textarea.form-control { resize: vertical; min-height: 80px; }
.field-error { display: none; font-size: 12px; color: #e53935; margin-top: 5px; }
.form-group.has-error .field-error { display: block; }

/* Toggle pills */
.toggle-group { display: inline-flex; border: 1px solid #cfd8e3; border-radius: 6px; overflow: hidden; }
.toggle-btn { padding: 9px 22px; font-size: 13px; font-weight: 600; color: #555; background: #fff; border: none;
    cursor: pointer; transition: background .15s, color .15s; }
.toggle-btn:not(:last-child) { border-right: 1px solid #cfd8e3; }
.toggle-btn.active { background: #1a5fa8; color: #fff; }

/* Product rows (repeatable, step 1) */
.product-row { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.product-row .form-group { flex: 1; margin-bottom: 0; }
.product-row .qty-group { flex: 0 0 90px; }
/* Pin search/qty inputs to the same explicit height as .remove-btn (below) —
   padding + line-height alone made them a couple px shorter, so the trash
   icon's box looked taller than the fields next to it. */
.product-row .form-control { height: 40px; }

/* Smaller value text so long product names still fit alongside the leading
   SKU. Text stays left-aligned (see text-align below) so the SKU is always
   the visible part, with the caret/scroll pinned to the start in
   script.js's selection handler rather than scrolled to the end. */
.product-search { font-size: 12px; text-align: left; }

/* Product search autocomplete (step 1) */
.search-wrap { position: relative; }
.ac-dropdown { position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; background: #fff;
    border: 1px solid #cfd8e3; border-radius: 6px; z-index: 50; max-height: 260px; overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0,0,0,.1); display: none; }
.ac-dropdown.open { display: block; }
.ac-item { padding: 9px 12px; font-size: 13px; color: #333; cursor: pointer; }
.ac-item:hover, .ac-item.hl { background: #eef5ff; color: #1a5fa8; }
.ac-item:not(:last-child) { border-bottom: 1px solid #f0f0f0; }
.ac-item .ac-sku { color: #888; font-size: 11px; margin-right: 6px; }
.ac-loading { padding: 9px 12px; color: #888; font-size: 13px; }

/* Ship-to address autocomplete (step 3) */
.addr-suggest-wrap { position: relative; }
.addr-suggest-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 50;
    background: #fff; border: 1px solid #cfd8e3; border-radius: 6px; margin-top: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,.1); max-height: 220px; overflow-y: auto; }
.addr-suggest-list:empty { display: none; border: none; box-shadow: none; margin-top: 0; }
.addr-suggest-item { padding: 9px 12px; font-size: 13px; color: #333; cursor: pointer; }
.addr-suggest-item:hover { background: #eef5ff; color: #1a5fa8; }
.addr-suggest-item:not(:last-child) { border-bottom: 1px solid #f0f0f0; }

.product-row .remove-btn { flex: 0 0 auto; width: 40px; height: 40px; margin-top: 0; border: 1px solid #e53935;
    border-radius: 6px; background: #fff; color: #e53935; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: color .15s, border-color .15s; }
.product-row .remove-btn svg { width: 16px; height: 16px; }
/* Icon/border are already red at rest; darken slightly on hover so there's
   still a visible hover state instead of a no-op. */
.product-row .remove-btn:hover { color: #c62828; border-color: #c62828; }
/* Row 1 can't be removed, but it still reserves the same 40px + gap column
   as every other row so the search/qty fields line up no matter how many
   product rows are on screen. */
.product-row .remove-btn.is-placeholder { visibility: hidden; }

.btn-add { display: inline-flex; align-items: center; gap: 6px; background: #eef5ff; color: #1a5fa8; border: 1px dashed #a0bcd8;
    padding: 9px 16px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-add:hover { background: #e0edff; }
.btn-add.full-width { width: 100%; justify-content: center; }

.check-row { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.checkbox-field { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #333; cursor: pointer; }
.checkbox-field input { width: 16px; height: 16px; margin: 0; }

/* Review */
.review-block { margin-bottom: 18px; }
.review-block h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: #1a5fa8; margin: 0 0 8px;
    display: flex; align-items: center; justify-content: space-between; }
.review-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 20px; font-size: 13px;
    background: #f7fbff; border: 1px solid #e3ecf7; border-radius: 8px; padding: 14px 16px; }
.review-grid .rk { color: #888; display: block; font-size: 11px; margin-bottom: 2px; }
.review-grid .rv { color: #222; font-weight: 600; word-break: break-word; }
.review-products { border: 1px solid #e3ecf7; border-radius: 8px; overflow: hidden; }
.review-products .rp-row { display: flex; justify-content: space-between; padding: 10px 14px; font-size: 13px;
    background: #f7fbff; border-bottom: 1px solid #e3ecf7; }
.review-products .rp-row:last-child { border-bottom: none; }
.review-empty { font-size: 13px; color: #aaa; font-style: italic; }
.edit-link { font-size: 12px; color: #1a5fa8; cursor: pointer; font-weight: 600; background: none; border: none; }

.consent-box { margin-top: 18px; padding: 14px 16px; border: 1px solid #cfd8e3; border-radius: 8px;
    display: flex; align-items: center; gap: 10px; background: #f7fbff; }
.consent-box input { width: 18px; height: 18px; margin: 0; }
.consent-box label { font-size: 13px; color: #555; cursor: pointer; }
.consent-box.has-error { border-color: #e53935; }
.consent-box + .field-error { margin-top: 6px; }

.note-box { background: #fffbea; border-left: 4px solid #f0b429; border-radius: 6px;
    padding: 12px 16px; font-size: 13px; color: #555; margin-top: 18px; }
.note-icon { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px;
    border-radius: 50%; background: #f0b429; color: #fff; font-size: 11px; font-weight: 700; margin-right: 4px; }

.call-hint { text-align: center; font-size: 13px; color: #888; margin: 18px 0 0; }
.call-hint strong { color: #555; }

/* Nav buttons */
.stage-nav { display: flex; justify-content: space-between; margin-top: 8px; }
.btn-back { padding: 12px 24px; background: #fff; color: #1a5fa8; border: 1px solid #1a5fa8;
    border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer; transition: background .2s; }
.btn-back:hover { background: #eef5ff; }
.btn-back:disabled { opacity: .35; cursor: not-allowed; }
.btn-next, .btn-submit { padding: 12px 28px; background: #1a5fa8; color: #fff; border: none;
    border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer; transition: background .2s; }
.btn-next:hover, .btn-submit:hover { background: #144d8a; }

/* Stage visibility */
.stage { display: none; }
.stage.active { display: block; }

/* Success card (front-end only, no backend wired yet) */
.success-card { text-align: center; padding: 50px 20px; }
.success-card .success-icon { font-size: 52px; color: #43a047; }
.success-card h2 { color: #1a5fa8; font-size: 20px; margin: 14px 0 8px; }
.success-card p { color: #666; font-size: 14px; margin: 0; }

/* Modal (spinner / success) */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9000;
    align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal-box { background: #fff; border-radius: 14px; padding: 36px 40px; max-width: 420px; width: 90%;
    text-align: center; box-shadow: 0 8px 40px rgba(0,0,0,.18); }
.modal-box.success-box { border-top: 5px solid #43a047; }
.spinner-steps { list-style: none; padding: 0; margin: 24px 0 0; text-align: left; }
.spinner-steps li { display: flex; align-items: center; gap: 14px; padding: 10px 0;
    border-bottom: 1px solid #f0f0f0; font-size: 14px; color: #aaa; }
.spinner-steps li:last-child { border-bottom: none; }
.spinner-steps li.active { color: #1a5fa8; font-weight: 600; }
.spinner-steps li.done { color: #43a047; }
.spinner-steps li .s-icon { width: 26px; height: 26px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; background: #eee; }
.spinner-steps li.active .s-icon { background: #1a5fa8; color:#fff; }
.spinner-steps li.done .s-icon { background: #43a047; color:#fff; }
.modal-title { font-size: 20px; font-weight: 700; margin: 0 0 6px; }
.modal-sub { font-size: 13px; color: #777; margin: 0; }
.modal-btn { margin-top: 24px; padding: 10px 28px; border: none; border-radius: 6px; cursor: pointer;
    font-size: 14px; font-weight: 600; background:#43a047; color:#fff; }
.modal-btn:hover { background:#2e7d32; }
.modal-box .success-icon { font-size: 52px; color: #43a047; }

@media (max-width: 640px) {
    .col-6, .col-4 { flex: 1 1 100%; }
    .review-grid { grid-template-columns: 1fr; }
    .step-label { display: none; }
    .product-row { flex-wrap: wrap; }
    .product-row .qty-group { flex: 1 1 100%; }
    .product-row .remove-btn { margin-top: 0; }
    .stage-nav { flex-direction: column-reverse; gap: 10px; }
    .stage-nav .btn-back, .stage-nav .btn-next, .stage-nav .btn-submit { width: 100%; }
}
