.niw-custom-order-form {
    --niw-order-border: rgba(31, 35, 40, 0.16);
    --niw-order-muted: #646970;
    --niw-order-surface: #ffffff;
    --niw-order-soft: #f6f7f7;
    --niw-order-dark: #1d2327;
    --niw-order-accent: #6f3fa0;
    --niw-order-error: #b32d2e;
    --niw-order-success: #116329;

    max-width: 1180px;
    margin: 0 auto;
    color: var(--niw-order-dark);
}

.niw-custom-order-form *,
.niw-custom-order-form *::before,
.niw-custom-order-form *::after {
    box-sizing: border-box;
}

.niw-custom-order-header {
    margin-bottom: 24px;
}

.niw-custom-order-header h2 {
    margin: 4px 0 10px;
}

.niw-custom-order-eyebrow,
.niw-custom-order-step-label {
    margin: 0;
    color: var(--niw-order-accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.niw-custom-order-notice {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-left: 4px solid #2271b1;
    background: #f0f6fc;
}

.niw-custom-order-notice.is-success {
    border-left-color: var(--niw-order-success);
    background: #edfaef;
}

.niw-custom-order-notice.is-error {
    border-left-color: var(--niw-order-error);
    background: #fcf0f1;
}

.niw-custom-order-progress {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 22px;
    padding: 0;
    list-style: none;
}

.niw-custom-order-progress-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    padding: 8px 12px;
    border: 1px solid var(--niw-order-border);
    border-radius: 9px;
    background: var(--niw-order-surface);
    color: var(--niw-order-dark);
    font-weight: 700;
    cursor: pointer;
}

.niw-custom-order-progress-button span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--niw-order-soft);
}

.niw-custom-order-progress-button.is-active {
    border-color: var(--niw-order-dark);
    background: var(--niw-order-dark);
    color: #ffffff;
}

.niw-custom-order-progress-button.is-active span {
    background: #ffffff;
    color: var(--niw-order-dark);
}

.niw-custom-order-progress-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.niw-custom-order-loading,
.niw-custom-order-empty,
.niw-custom-order-upload-progress {
    padding: 18px;
    border: 1px dashed var(--niw-order-border);
    border-radius: 9px;
    background: var(--niw-order-soft);
    color: var(--niw-order-muted);
    text-align: center;
}

.niw-custom-order-step {
    padding: clamp(18px, 3vw, 30px);
    border: 1px solid var(--niw-order-border);
    border-radius: 12px;
    background: var(--niw-order-surface);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.niw-custom-order-step-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.niw-custom-order-step-heading h3 {
    margin: 4px 0 6px;
}

.niw-custom-order-step-heading p:last-child {
    margin-bottom: 0;
}

.niw-custom-order-count {
    flex: 0 0 auto;
    margin: 0;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--niw-order-soft);
    font-size: 0.82rem;
    font-weight: 700;
}

.niw-custom-order-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(340px, 1.1fr);
    gap: 24px;
    align-items: start;
}

.niw-custom-order-items-panel {
    min-width: 0;
}

.niw-custom-order-items-list {
    display: grid;
    gap: 12px;
}

.niw-custom-order-item-card {
    padding: 16px;
    border: 1px solid var(--niw-order-border);
    border-radius: 10px;
    background: var(--niw-order-surface);
}

.niw-custom-order-item-card-heading,
.niw-custom-order-item-card-heading > div:first-child,
.niw-custom-order-item-actions,
.niw-custom-order-editor-actions,
.niw-custom-order-step-actions {
    display: flex;
    align-items: center;
}

.niw-custom-order-item-card-heading {
    justify-content: space-between;
    gap: 12px;
}

.niw-custom-order-item-card-heading > div:first-child {
    min-width: 0;
    gap: 9px;
}

.niw-custom-order-item-card h4 {
    overflow-wrap: anywhere;
    margin: 0;
}

.niw-custom-order-item-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--niw-order-dark);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 800;
}

.niw-custom-order-item-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
}

.niw-custom-order-item-details {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 5px 12px;
    margin: 14px 0 0;
    font-size: 0.9rem;
}

.niw-custom-order-item-details dt {
    color: var(--niw-order-muted);
    font-weight: 700;
}

.niw-custom-order-item-details dd {
    margin: 0;
}

.niw-custom-order-item-notes,
.niw-custom-order-review-notes {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 7px;
    background: var(--niw-order-soft);
    white-space: pre-wrap;
}

.niw-custom-order-item-editor {
    position: sticky;
    top: 18px;
    padding: 20px;
    border: 1px solid var(--niw-order-border);
    border-radius: 10px;
    background: var(--niw-order-soft);
}

.admin-bar .niw-custom-order-item-editor {
    top: 50px;
}

.niw-custom-order-editor-heading {
    margin-bottom: 18px;
}

.niw-custom-order-editor-heading h4 {
    margin: 0 0 4px;
}

.niw-custom-order-editor-heading p {
    margin: 0;
    color: var(--niw-order-muted);
    font-size: 0.84rem;
}

.niw-custom-order-field,
.niw-custom-order-fieldset {
    margin: 0 0 18px;
}

.niw-custom-order-field label,
.niw-custom-order-fieldset legend {
    display: block;
    margin-bottom: 7px;
    font-weight: 700;
}

.niw-custom-order-form input[type="text"],
.niw-custom-order-form input[type="number"],
.niw-custom-order-form select,
.niw-custom-order-form textarea {
    width: 100%;
    max-width: none;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid rgba(31, 35, 40, 0.28);
    border-radius: 6px;
    background: #ffffff;
    color: inherit;
}

.niw-custom-order-form textarea {
    resize: vertical;
}

.niw-custom-order-form .description {
    margin: 6px 0 0;
    color: var(--niw-order-muted);
    font-size: 0.82rem;
}

.niw-custom-order-fieldset {
    min-width: 0;
    padding: 0;
    border: 0;
}

.niw-custom-order-option,
.niw-custom-order-profile-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 8px;
    padding: 11px;
    border: 1px solid var(--niw-order-border);
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
}

.niw-custom-order-option input,
.niw-custom-order-profile-option input {
    flex: 0 0 auto;
    margin-top: 3px;
}

.niw-custom-order-option span,
.niw-custom-order-profile-option span {
    display: grid;
    gap: 2px;
}

.niw-custom-order-option small,
.niw-custom-order-profile-option small {
    color: var(--niw-order-muted);
    font-weight: 400;
}

.niw-custom-order-inline-options {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.niw-custom-order-inline-options label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.niw-custom-order-slider-label {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.niw-custom-order-slider-label output {
    flex: 0 0 auto;
    min-width: 66px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--niw-order-dark);
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 800;
    text-align: center;
}

.niw-custom-order-range {
    display: block;
    width: 100%;
    margin: 4px 0 0;
    accent-color: var(--niw-order-accent);
    cursor: pointer;
}

.niw-custom-order-range:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.niw-custom-order-range-scale {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
    color: var(--niw-order-muted);
    font-size: 0.75rem;
}

.niw-custom-order-small-number {
    max-width: 110px !important;
}

.niw-custom-order-additional-size-sliders {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.niw-custom-order-additional-size-row {
    padding: 12px;
    border: 1px solid var(--niw-order-border);
    border-radius: 8px;
    background: #ffffff;
}

.niw-custom-order-profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.niw-custom-order-profile-option {
    margin: 0;
}

.niw-custom-order-custom-depth {
    margin-top: 12px;
}

.niw-custom-order-editor-actions {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
}

.niw-custom-order-editor-actions .description {
    max-width: 420px;
    margin: 8px 0 0;
}

.niw-custom-order-step-actions {
    justify-content: space-between;
    gap: 12px;
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--niw-order-border);
}

.niw-custom-order-dropzone {
    display: grid;
    place-items: center;
    gap: 4px;
    min-height: 190px;
    padding: 24px;
    border: 2px dashed rgba(111, 63, 160, 0.45);
    border-radius: 12px;
    background: #faf7fd;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.niw-custom-order-dropzone:hover,
.niw-custom-order-dropzone:focus,
.niw-custom-order-dropzone.is-dragging {
    border-color: var(--niw-order-accent);
    background: #f2eafb;
    outline: none;
}

.niw-custom-order-dropzone.is-full {
    opacity: 0.55;
}

.niw-custom-order-dropzone span,
.niw-custom-order-dropzone small {
    color: var(--niw-order-muted);
}

.niw-custom-order-upload-progress,
.niw-custom-order-images-empty {
    margin-top: 14px;
}

.niw-custom-order-image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.niw-custom-order-image-card {
    overflow: hidden;
    margin: 0;
    border: 1px solid var(--niw-order-border);
    border-radius: 9px;
    background: #ffffff;
}

.niw-custom-order-image-card > a {
    display: block;
    aspect-ratio: 4 / 3;
    background: var(--niw-order-soft);
}

.niw-custom-order-image-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.niw-custom-order-image-card figcaption {
    display: grid;
    gap: 8px;
    padding: 10px;
}

.niw-custom-order-image-card figcaption span {
    overflow-wrap: anywhere;
    font-size: 0.82rem;
}

.niw-custom-order-overall-notes {
    margin-top: 24px;
}

.niw-custom-order-review {
    display: grid;
    gap: 16px;
}

.niw-custom-order-review-section {
    overflow: hidden;
    border: 1px solid var(--niw-order-border);
    border-radius: 10px;
}

.niw-custom-order-review-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 15px;
    background: var(--niw-order-dark);
    color: #ffffff;
}

.niw-custom-order-review-heading h4 {
    margin: 0;
    color: inherit;
}

.niw-custom-order-review-heading span {
    font-size: 0.82rem;
    font-weight: 700;
}

.niw-custom-order-review-body {
    padding: 15px;
}

.niw-custom-order-review-body > :first-child {
    margin-top: 0;
}

.niw-custom-order-review-body > :last-child {
    margin-bottom: 0;
}

.niw-custom-order-review-card + .niw-custom-order-review-card {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--niw-order-border);
}

.niw-custom-order-review-card h4,
.niw-custom-order-review-card p {
    margin: 0 0 6px;
}

.niw-custom-order-foundation-notice {
    margin-top: 20px;
    padding: 15px;
    border-left: 4px solid var(--niw-order-accent);
    background: #faf7fd;
}

.niw-custom-order-foundation-notice p {
    margin: 6px 0 0;
}

.niw-custom-order-form.is-busy {
    cursor: progress;
}

.niw-custom-order-form [hidden] {
    display: none !important;
}

@media screen and (max-width: 900px) {
    .niw-custom-order-layout {
        grid-template-columns: 1fr;
    }

    .niw-custom-order-item-editor {
        position: static;
    }
}

@media screen and (max-width: 782px) {
    .admin-bar .niw-custom-order-item-editor {
        top: 0;
    }
}

@media screen and (max-width: 640px) {
    .niw-custom-order-progress {
        grid-template-columns: 1fr;
    }

    .niw-custom-order-progress-button {
        justify-content: flex-start;
    }

    .niw-custom-order-step-heading,
    .niw-custom-order-item-card-heading,
    .niw-custom-order-step-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .niw-custom-order-count {
        align-self: flex-start;
    }

    .niw-custom-order-item-actions {
        justify-content: flex-start;
    }

    .niw-custom-order-profile-grid {
        grid-template-columns: 1fr;
    }

}

.niw-custom-order-live-price {
    display: grid;
    gap: 8px;
    margin: 4px 0 18px;
    padding: 14px;
    border: 1px solid var(--niw-order-border);
    border-left: 4px solid var(--niw-order-accent);
    border-radius: 8px;
    background: #faf7fd;
}

.niw-custom-order-live-price > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.niw-custom-order-live-price span {
    font-weight: 700;
}

.niw-custom-order-live-price strong {
    font-size: 1.25rem;
}

.niw-custom-order-live-price p,
.niw-custom-order-review-price {
    margin: 0;
}

.niw-custom-order-review-price {
    font-weight: 700;
}

.niw-custom-order-review-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 1.05rem;
}

.niw-custom-order-review-total strong {
    font-size: 1.35rem;
}

.niw-custom-order-review-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

@media screen and (max-width: 640px) {
    .niw-custom-order-live-price > div,
    .niw-custom-order-review-total {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .niw-custom-order-review-actions {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .niw-custom-order-review-actions .button {
        text-align: center;
    }
}

.niw-custom-order-group-manager {
    margin: 0 0 24px;
    padding: 18px;
    border: 1px solid var(--niw-order-border);
    border-radius: 10px;
    background: #ffffff;
}

.niw-custom-order-group-manager h3 {
    margin: 0 0 6px;
}

.niw-custom-order-group-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0;
}

.niw-custom-order-group-list .button.is-current {
    border-color: var(--niw-order-accent);
    box-shadow: 0 0 0 1px var(--niw-order-accent);
}
