/* Merchant Portal > Settings refresh. All selectors are scoped to avoid changing
   Manage Merchants, Payments, Invoicing, or any other Settings page. */

#merchant-settings-tab {
    width: 100%;
    max-width: none;
}

.merchant-portal-settings-v2 {
    --mp-green: #008062;
    --mp-green-hover: #006b52;
    --mp-text: var(--sd-neutral-950, #0a0a0a);
    --mp-text-secondary: var(--sd-neutral-700, #404040);
    --mp-text-muted: var(--sd-neutral-500, #737373);
    --mp-border: var(--sd-neutral-320, #e8e8e4);
    --mp-border-light: var(--sd-neutral-250, #f0f0ec);
    --mp-surface: var(--sd-neutral-100, #ffffff);
    --mp-surface-subtle: var(--sd-neutral-200, #f8f8f5);
    --mp-surface-muted: #f4f4f8;
    --mp-modal-background: var(--sd-autodispatch-overlay-bg, #f8f8f5);
    --mp-danger: #d92d20;
    --mp-chip-invert-bg: var(--sd-autodispatch-asm-rule-dest-chip-bg, #1a1a1a);
    --mp-chip-invert-text: var(--sd-autodispatch-icon-color, #f8f8f5);
    --mp-input-border: var(--sd-neutral-320);
    width: 100%;
    color: var(--mp-text);
}

#merchant-portal-settings-modal-root,
.mp-merchant-settings-modal {
    --mp-green: #008062;
    --mp-green-hover: #006b52;
    --mp-text: var(--sd-neutral-950, #0a0a0a);
    --mp-text-secondary: var(--sd-neutral-700, #404040);
    --mp-text-muted: var(--sd-neutral-500, #737373);
    --mp-border: var(--sd-neutral-320, #e8e8e4);
    --mp-border-light: var(--sd-neutral-250, #f0f0ec);
    --mp-surface: var(--sd-neutral-100, #ffffff);
    --mp-surface-subtle: var(--sd-neutral-200, #f8f8f5);
    --mp-surface-muted: #f4f4f8;
    --mp-modal-background: var(--sd-autodispatch-overlay-bg, #f8f8f5);
    --mp-danger: #d92d20;
    --mp-chip-invert-bg: var(--sd-autodispatch-asm-rule-dest-chip-bg, #1a1a1a);
    --mp-chip-invert-text: var(--sd-autodispatch-icon-color, #f8f8f5);
    --mp-input-border: var(--sd-neutral-320);
}

/* Individual merchant settings modal */
.mp-merchant-settings-modal .modal-dialog {
    width: min(640px, calc(100vw - 32px));
    min-width: 0;
    margin: 48px auto;
}

.mp-merchant-settings-modal .modal-content {
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    /* custom_fonts_colors.css sets `.modal-content { background: ... !important }`, so this
       needs !important too — without it the modal chrome never gets its recessed tone and
       sits flat against the cards inside it. */
    background: var(--mp-modal-background) !important;
    box-shadow: 0 24px 64px rgba(16, 24, 40, 0.2);
}

.mp-merchant-settings-modal .modal-header {
    min-height: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 24px;
    border-bottom: 1px solid var(--mp-border);
}

.mp-merchant-settings-modal .modal-header h2 {
    margin: 0;
    color: var(--mp-text);
    font-size: 20px;
    font-weight: 600;
    line-height: 28px;
    letter-spacing: -0.02em;
}

.mp-merchant-settings-modal .modal-header p {
    margin: 4px 0 0;
    color: var(--mp-text-secondary);
    font-size: 14px;
    font-weight: 300;
    line-height: 20px;
}

.mp-merchant-settings-modal .mp-modal-close {
    position: static;
    flex: 0 0 36px;
}

.mp-merchant-settings-modal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 24px 24px;
}

.mp-merchant-setting-card,
.mp-merchant-pricing-card {
    overflow: hidden;
    border: 1px solid var(--mp-border);
    border-radius: 12px;
    background: var(--mp-surface);
}

.mp-merchant-toggle-row {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 16px;
    border-bottom: 1px solid var(--mp-border);
}

.mp-merchant-toggle-row:last-child {
    border-bottom: 0;
}

.mp-merchant-toggle-copy {
    min-width: 0;
}

.mp-merchant-toggle-copy strong,
.mp-merchant-toggle-copy span {
    display: block;
}

.mp-merchant-toggle-copy strong {
    color: var(--mp-text);
    font-size: 15px;
    font-weight: 600;
    line-height: 21px;
}

.mp-merchant-toggle-copy span {
    margin-top: 2px;
    color: var(--mp-text-muted);
    font-size: 14px;
    line-height: 20px;
}

.mp-merchant-pricing-card {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 16px;
    transition: opacity 150ms ease, background 150ms ease;
}

.mp-merchant-pricing-card.is-disabled {
    background: var(--mp-surface-subtle);
    opacity: 0.58;
}

.mp-merchant-pricing-card.is-disabled .mp-btn {
    cursor: not-allowed;
}

.mp-merchant-pricing-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--mp-surface-subtle);
    color: var(--mp-text-secondary);
}

.mp-merchant-pricing-icon .material-symbols-rounded {
    font-size: 21px;
    font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 22;
}

.mp-merchant-pricing-copy strong,
.mp-merchant-pricing-copy span {
    display: block;
}

.mp-merchant-pricing-copy strong {
    color: var(--mp-text);
    font-size: 15px;
    font-weight: 600;
    line-height: 21px;
}

.mp-merchant-pricing-copy span {
    margin-top: 2px;
    color: var(--mp-text-muted);
    font-size: 13px;
    line-height: 19px;
}

.mp-merchant-pricing-card .mp-btn .material-symbols-rounded {
    font-size: 18px;
}

.mp-merchant-settings-modal .modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--mp-border);
    background: var(--mp-surface);
}

.mp-merchant-settings-modal .modal-footer::before,
.mp-merchant-settings-modal .modal-footer::after {
    display: none;
}

.mp-merchant-submit-result {
    padding: 32px 24px 24px;
    color: var(--mp-text);
    text-align: center;
}

.mp-merchant-submit-result .submit-result {
    margin-bottom: 20px;
}

.mp-wizard--merchant-pricing .mp-wizard-actions {
    grid-template-columns: auto 1fr auto;
}

@media (max-width: 640px) {
    .mp-merchant-settings-modal .modal-dialog {
        width: calc(100vw - 24px);
        margin: 20px auto;
    }

    .mp-merchant-settings-modal .modal-header,
    .mp-merchant-settings-modal .modal-body,
    .mp-merchant-settings-modal .modal-footer {
        padding-right: 18px;
        padding-left: 18px;
    }

    .mp-merchant-pricing-card {
        grid-template-columns: 40px minmax(0, 1fr);
    }

    .mp-merchant-pricing-card .mp-btn {
        grid-column: 1 / -1;
        width: 100%;
    }
}

.merchant-portal-settings-card {
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--mp-border);
    border-radius: 16px;
    background: var(--mp-surface);
}

.merchant-portal-settings-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--mp-border);
}

.merchant-portal-settings-card-header h2 {
    margin: 0;
    color: var(--mp-text);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.merchant-portal-settings-card-header p {
    margin: 3px 0 0;
    color: var(--mp-text-secondary);
    font-size: 14px;
    font-weight: 300;
    line-height: 1.45;
}

.merchant-portal-settings-edit,
.mp-btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 16px;
    border: 1px solid var(--mp-border);
    border-radius: 8px;
    background: var(--mp-surface);
    color: var(--mp-text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease, opacity 150ms ease;
}

.merchant-portal-settings-edit:hover,
.mp-btn--secondary:hover {
    border-color: var(--sd-neutral-400, #c8c8c0);
    background: var(--mp-surface-subtle);
}

.merchant-portal-settings-edit:focus-visible,
.merchant-portal-settings-row:focus-visible,
.mp-btn:focus-visible,
.mp-switch:focus-visible,
.mp-modal-close:focus-visible {
    outline: 2px solid var(--sd-primary-100-2, #01ad85);
    outline-offset: 2px;
}

.merchant-portal-settings-edit .material-symbols-rounded {
    font-size: 17px;
    font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 18;
}

.mp-btn--primary {
    border-color: var(--mp-green);
    background: var(--mp-green);
    color: #ffffff;
}

.mp-btn--primary:hover {
    border-color: var(--mp-green-hover);
    background: var(--mp-green-hover);
}

.merchant-portal-settings-row {
    width: 100%;
    min-height: 80px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 19px 24px;
    border: 0;
    border-bottom: 1px solid var(--mp-border);
    background: transparent;
    color: inherit;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 150ms ease;
}

.merchant-portal-settings-row:last-child {
    border-bottom: 0;
}

.merchant-portal-settings-row:hover {
    background: var(--mp-surface-subtle);
}

.merchant-portal-settings-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--mp-surface-subtle);
    color: var(--sd-neutral-600, #525252);
}

.merchant-portal-settings-icon .material-symbols-rounded {
    font-size: 23px;
    font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 24;
}

.merchant-portal-settings-row-copy {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.merchant-portal-settings-row-copy strong {
    color: var(--mp-text);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.merchant-portal-settings-row-copy small {
    overflow: hidden;
    color: var(--mp-text-secondary);
    font-size: 14px;
    font-weight: 300;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.merchant-portal-settings-value {
    max-width: 320px;
    overflow: hidden;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--mp-surface-muted);
    color: var(--mp-text-secondary);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.merchant-portal-settings-value.is-positive {
    background: #ebfef6;
    color: #03624c;
}

.merchant-portal-settings-chevron {
    flex: 0 0 auto;
    color: var(--mp-text-muted);
    font-size: 20px;
    font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 20;
}

.merchant-portal-settings-legacy {
    display: none !important;
}

/* The existing delivery-zone editor is launched from the full-screen wizard. */
body.merchant-portal-settings-modal-open #delivery-zone-modal {
    z-index: 2000 !important;
}

body.merchant-portal-settings-modal-open .modal-backdrop {
    z-index: 1990 !important;
}

body.merchant-portal-settings-modal-open #delivery-zone-modal .delivery-z-sub {
    width: 100%;
    padding-right: 24px;
    padding-left: 24px;
    text-align: center;
}

/* Wizard */
.mp-wizard {
    position: fixed;
    inset: 0;
    z-index: 1060;
}

.mp-modal-close {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--mp-surface-subtle);
    color: var(--mp-text-secondary);
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}

.mp-modal-close:hover,
.mp-rule-editor-header .mp-modal-close:hover,
.mp-merchant-settings-modal .mp-modal-close:hover {
    background: var(--mp-border-light);
    color: var(--mp-text);
}

.mp-wizard {
    display: flex;
    flex-direction: column;
    background: var(--mp-modal-background);
}

.mp-wizard-header {
    min-height: 92px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 32px 16px;
    background: var(--mp-modal-background);
}

.mp-wizard-header h2 {
    margin: 0;
    color: var(--mp-text);
    font-size: 21px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.02em;
}

.mp-wizard-header p {
    margin: 3px 0 0;
    color: var(--mp-text-secondary);
    font-size: 15px;
    line-height: 1.45;
}

.mp-wizard-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 32px 44px;
}

.mp-wizard-content {
    width: min(640px, 100%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 0 auto;
}

.mp-wizard-content [data-mp-wizard-content] {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mp-config-card {
    overflow: visible;
    border: 1px solid var(--mp-border);
    border-radius: 16px;
    background: var(--mp-surface);
}

.mp-config-card-header {
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--mp-border-light);
}

.mp-config-card-header strong,
.mp-config-card-header span {
    display: block;
}

.mp-config-card-header strong {
    color: var(--mp-text);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.45;
}

.mp-config-card-header span {
    margin-top: 3px;
    color: var(--mp-text-muted);
    font-size: 15px;
    line-height: 1.45;
}

.mp-config-card-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 12px 20px 20px;
}

.mp-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.mp-toggle-row-copy strong,
.mp-toggle-row-copy span {
    display: block;
}

.mp-toggle-row-copy strong {
    color: var(--mp-text);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}

.mp-toggle-row-copy span {
    margin-top: 2px;
    color: var(--mp-text-muted);
    font-size: 14px;
    line-height: 1.4;
}

.mp-toggle-status {
    color: var(--mp-text);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
}

.mp-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex: 0 0 44px;
    padding: 2px;
    border: 0;
    border-radius: 999px;
    background: #eaecf0;
    cursor: pointer;
    transition: background 180ms ease;
}

.mp-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.18);
    transition: transform 180ms ease;
}

.mp-switch[aria-checked="true"] {
    background: var(--mp-green);
}

.mp-switch[aria-checked="true"]::after {
    transform: translateX(20px);
}

.mp-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mp-field > label {
    color: var(--mp-text);
    font-size: 15px;
    font-weight: 500;
    line-height: 20px;
}

.mp-field-control {
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
    padding: 0 14px;
    border: 1px solid var(--mp-input-border);
    border-radius: 10px;
    outline: 0;
    background: var(--mp-surface);
    color: var(--mp-text);
    font-family: inherit;
    font-size: 15px;
}

.mp-field-control:focus {
    border: 1.5px solid var(--sd-signup-btn-bg);
    outline: none;
    box-shadow: none;
}

select.mp-field-control {
    padding-right: 42px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5.75 7.5L10 11.75L14.25 7.5' stroke='%23667085' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 20px 20px;
}

select.mp-field-control:focus,
select.mp-field-control:focus-visible,
select.mp-field-control:active {
    border: 1.5px solid var(--sd-signup-btn-bg) !important;
    outline: none !important;
    box-shadow: none !important;
}

input[data-mp-rule-name]:focus,
input[data-mp-rule-name]:focus-visible,
input[data-mp-rule-name]:active {
    border-color: var(--mp-border) !important;
    outline: none !important;
    box-shadow: none !important;
}

.mp-field-control[aria-invalid="true"] {
    border-color: var(--mp-danger);
}

.mp-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 44px;
    box-sizing: border-box;
    gap: 4px;
    padding: 0 16px;
    border: 1px solid var(--mp-input-border);
    border-radius: 10px;
    background: var(--mp-surface);
}

.mp-input-wrap:focus-within {
    border: 1.5px solid var(--sd-signup-btn-bg);
    outline: none;
    box-shadow: none;
}

.mp-input-wrap .mp-field-control {
    width: auto;
    min-width: 0;
    height: 100%;
    min-height: 0;
    flex: 1;
    padding: 0;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
    font-size: 15px;
    font-weight: 300;
    -moz-appearance: textfield;
}

.mp-input-wrap .mp-field-control:focus,
.mp-input-wrap .mp-field-control:focus-visible,
.mp-input-wrap .mp-field-control:active {
    border: 0;
    outline: 0;
    box-shadow: none;
}

.mp-input-wrap input[type="number"]::-webkit-inner-spin-button,
.mp-input-wrap input[type="number"]::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.mp-input-prefix,
.mp-input-suffix {
    flex: 0 0 auto;
    color: var(--mp-text-muted);
    font-size: 15px;
    pointer-events: none;
}

.mp-field.has-error .mp-input-wrap {
    border-color: var(--mp-danger);
}

.mp-field-help {
    font-size: 13px;
    line-height: 18px;
}

.mp-field-help { color: var(--mp-text-muted); }

.mp-pricing-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.mp-pricing-rules-header {
    padding: 22px 20px 12px;
    border-bottom: 0;
}

.mp-pricing-rules-header strong {
    font-size: 18px;
    line-height: 26px;
}

.mp-rule-add-condition {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    height: 40px;
    padding: 0 13px;
    border: 1px solid var(--mp-border);
    border-radius: 8px;
    background: var(--mp-surface);
    color: var(--mp-text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.mp-rule-add-condition:hover {
    border-color: var(--sd-neutral-400, #c8c8c0);
    background: var(--mp-surface-subtle);
}

.mp-pricing-rules-body {
    gap: 16px;
    padding: 10px 20px 20px;
}

.mp-pricing-rule-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mp-pricing-rule-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--sd-autodispatch-overlay-bg);
    cursor: grab;
    transition: opacity 150ms ease;
}

.mp-pricing-rule-card:active {
    cursor: grabbing;
}

.mp-pricing-rule-card.is-dragging {
    opacity: 0.4;
}

.mp-pricing-rule-header,
.mp-pricing-rule-header-left {
    display: flex;
    align-items: center;
}

.mp-pricing-rule-header {
    justify-content: space-between;
    gap: 16px;
}

.mp-pricing-rule-header-left {
    min-width: 0;
    gap: 12px;
}

.mp-pricing-rule-drag-handle {
    width: 18px;
    height: 32px;
    flex: 0 0 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sd-dp-text-label);
    cursor: grab;
}

.mp-pricing-rule-priority {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--sd-autodispatch-asm-rule-chip-bg, #e9e9e7);
    color: var(--sd-dp-text-label);
    font-size: 14px;
    font-weight: 600;
}

.mp-pricing-rule-name {
    overflow: hidden;
    color: var(--mp-text);
    font-size: 16px;
    font-weight: 600;
    line-height: 22px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mp-pricing-rule-conditions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.mp-rule-condition-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
}

.mp-rule-condition-chip {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    max-width: 100%;
    padding: 5px 9px;
    overflow: hidden;
    border: 0;
    border-radius: 8px;
    background: var(--sd-autodispatch-asm-rule-chip-bg, #e9e9e7);
    color: var(--sd-autodispatch-subtext-color);
    font-size: 14px;
    font-weight: 300;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mp-rule-condition-chip--dark {
    background: var(--mp-chip-invert-bg);
    color: var(--mp-chip-invert-text);
}

.mp-rule-condition-chip--outcome {
    max-width: 360px;
}

.mp-rule-join-badge {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    margin: 0 0 0 4px;
    color: var(--sd-neutral-500);
    font-size: 14px;
    font-weight: 700;
    line-height: 20px;
}

.mp-pricing-rule-arrow {
    flex: 0 0 auto;
    margin: 0 4px;
    color: var(--mp-text-secondary);
    font-size: 21px;
    font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20;
}

.mp-pricing-rule-actions {
    position: relative;
    flex: 0 0 auto;
}

.mp-pricing-rule-actions > button,
.mp-rule-remove-condition {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--mp-text-muted);
    cursor: pointer;
}

.mp-pricing-rule-actions > button:hover,
.mp-rule-remove-condition:hover {
    background: var(--mp-border-light);
    color: var(--mp-text);
}

.mp-pricing-rule-actions > button .material-symbols-rounded,
.mp-rule-remove-condition .material-symbols-rounded {
    font-size: 22px;
    font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 22;
}

.mp-pricing-rule-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 20;
    min-width: 160px;
    display: none;
    overflow: hidden;
    border: 1px solid var(--mp-border);
    border-radius: 10px;
    background: var(--mp-surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.mp-pricing-rule-menu.is-open {
    display: block;
}

.mp-pricing-rule-menu button {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--mp-text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 300;
    text-align: left;
    cursor: pointer;
}

.mp-pricing-rule-menu button:hover {
    background: var(--mp-surface-subtle);
}

.mp-pricing-rule-menu button.is-danger {
    color: #dc2626;
}

.mp-pricing-rule-menu button.is-danger:hover {
    background: #fef2f2;
}

.mp-pricing-rule-menu button .material-symbols-rounded {
    font-size: 18px;
    font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 18;
}

.mp-pricing-rules-empty {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    border: 1px dashed var(--mp-border);
    border-radius: 12px;
    color: var(--mp-text-muted);
    text-align: center;
}

.mp-pricing-rules-empty > .material-symbols-rounded {
    margin-bottom: 8px;
    font-size: 28px;
    font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 28;
}

.mp-pricing-rules-empty strong {
    color: var(--mp-text);
    font-size: 14px;
    font-weight: 600;
}

.mp-pricing-rules-empty > span:last-child {
    max-width: 340px;
    margin-top: 3px;
    font-size: 13px;
    line-height: 19px;
}

.mp-rule-editor-overlay {
    position: fixed;
    inset: 0;
    z-index: 1070;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 32px;
    background: rgba(0, 0, 0, 0.35);
}

/* The rule editor and the discard confirm are real dialogs floating over the wizard, so they
   use the app's standard modal surface — the same --modal-background that #delivery-zone-modal
   gets from custom_fonts_colors.css. Not --mp-modal-background: that is the recessed wizard
   chrome (#0c0c0c in dark), which left these the same tone as the thing behind them. */
.mp-rule-editor {
    width: min(600px, 90vw);
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 20px;
    background: var(--modal-background);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08);
}

.mp-rule-editor-header {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 32px 32px 0;
    background: var(--modal-background);
}

.mp-rule-name-editor {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mp-rule-name-display {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.mp-rule-name-text {
    overflow: hidden;
    color: var(--sd-autodispatch-title-color);
    font-size: 24px;
    font-weight: 600;
    line-height: 34px;
    letter-spacing: -0.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mp-rule-name-edit {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--mp-text-muted);
    cursor: pointer;
}

.mp-rule-name-editor input {
    width: min(480px, 100%);
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--sd-autodispatch-title-color);
    font-family: inherit;
    font-size: 24px;
    font-weight: 600;
    line-height: 34px;
    letter-spacing: -0.02em;
}

.mp-rule-name-editor input::placeholder {
    color: var(--sd-order-sub-status);
    opacity: 1;
}

.mp-rule-name-editor .material-symbols-rounded {
    flex: 0 0 auto;
    color: var(--mp-text-muted);
    font-size: 20px;
    font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 20;
}

.mp-rule-editor-header .mp-modal-close {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 99px;
    background: var(--common-background);
    color: var(--sd-autodispatch-subtext-color);
}

.mp-rule-editor-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    padding: 24px 32px;
    background: var(--modal-background);
}

.mp-rule-editor-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    border: 1px solid var(--sd-autodispatch-card-border);
    border-radius: 10px;
    background: var(--common-background);
}

.mp-rule-editor-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0;
}

.mp-rule-editor-section-heading strong,
.mp-rule-editor-section-heading span {
    display: block;
}

.mp-rule-editor-section-heading strong {
    color: var(--sd-autodispatch-row-title-color);
    font-size: 16px;
    font-weight: 600;
    line-height: 22px;
}

.mp-rule-editor-section-heading span {
    margin-top: 1px;
    color: var(--sd-autodispatch-subtext-color);
    font-size: 15px;
    font-weight: 300;
    line-height: 22px;
}

.mp-rule-condition-list {
    display: flex;
    flex-direction: column;
}

.mp-rule-condition-editor {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    gap: 12px;
}

.mp-rule-dropdown {
    position: relative;
    width: 100%;
}

.mp-rule-dropdown-trigger {
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    border: 1px solid var(--mp-input-border);
    border-radius: 10px;
    outline: none;
    background: var(--popup-bg);
    color: var(--sd-autodispatch-row-title-color);
    font-family: inherit;
    font-size: 15px;
    font-weight: 300;
    line-height: 21px;
    text-align: left;
    cursor: pointer;
}

.mp-rule-dropdown-trigger > span {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mp-rule-dropdown-trigger > svg {
    flex: 0 0 auto;
    color: var(--sd-neutral-500);
    transition: transform 120ms ease;
}

.mp-rule-dropdown-trigger:hover {
    border-color: var(--sd-neutral-400);
}

.mp-rule-dropdown.is-open .mp-rule-dropdown-trigger {
    border: 1.5px solid var(--sd-signup-btn-bg);
    box-shadow: none;
}

.mp-rule-dropdown-trigger:focus-visible {
    border: 1.5px solid var(--sd-signup-btn-bg);
    outline: none;
    box-shadow: none;
}

.mp-rule-dropdown.is-open .mp-rule-dropdown-trigger > svg {
    transform: rotate(180deg);
}

.mp-rule-dropdown-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    overflow: hidden;
    border: 1px solid var(--sd-autodispatch-card-border);
    border-radius: 10px;
    background: var(--common-background);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.mp-rule-dropdown.is-up .mp-rule-dropdown-menu {
    top: auto;
    bottom: calc(100% + 4px);
}

.mp-settings-dropdown-menu {
    max-height: 240px;
    overflow-x: hidden;
    overflow-y: auto;
}

.mp-rule-dropdown-option {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 0;
    border-radius: 0;
    background: var(--common-background);
    color: var(--sd-autodispatch-row-title-color);
    font-family: inherit;
    font-size: 15px;
    font-weight: 300;
    line-height: 21px;
    text-align: left;
    cursor: pointer;
}

.mp-rule-dropdown-option:hover {
    background: var(--sd-autodispatch-hover-bg);
}

.mp-rule-dropdown-option.is-selected {
    background: var(--sd-green-25);
    color: var(--sd-dark-green);
    font-weight: 600;
}

.mp-rule-dropdown-option[aria-disabled="true"] {
    opacity: 0.5;
    cursor: default;
}

.mp-rule-dropdown-option > span:first-child {
    min-width: 0;
    flex: 1;
}

.mp-rule-dropdown-option .material-symbols-rounded {
    width: 18px;
    flex: 0 0 18px;
    color: var(--sd-dark-green);
    font-size: 18px;
    font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 18;
}

.mp-field.has-error .mp-rule-dropdown-trigger {
    border: 1px solid var(--mp-danger) !important;
}

.mp-pricing-rules-section.has-error {
    border-color: var(--mp-danger);
}

.mp-rule-condition-editor .mp-field-control,
.mp-rule-condition-editor .mp-rule-static-operator,
.mp-rule-pricing-grid .mp-field-control {
    min-height: 40px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 300;
}

.mp-rule-editor .mp-input-wrap {
    height: 40px;
    border-color: var(--mp-input-border);
    border-radius: 10px;
    background: var(--popup-bg);
}

.mp-rule-editor .mp-input-wrap:focus-within {
    border: 1.5px solid var(--sd-signup-btn-bg);
    box-shadow: none;
}

.mp-rule-editor .mp-field-control {
    color: var(--sd-autodispatch-row-title-color);
    background: transparent;
}

.mp-rule-condition-editor > .mp-rule-remove-condition:last-child {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 28px;
    height: 28px;
    opacity: 0;
    background: var(--common-background);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    transition: opacity 120ms ease;
}

.mp-rule-condition-editor:hover > .mp-rule-remove-condition:last-child,
.mp-rule-condition-editor:focus-within > .mp-rule-remove-condition:last-child {
    opacity: 1;
}

.mp-rule-static-operator {
    height: 40px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    padding: 0 14px;
    border: 1px solid var(--mp-input-border);
    border-radius: 10px;
    background: var(--popup-bg);
    color: var(--sd-autodispatch-row-title-color);
    font-size: 15px;
}

.mp-rule-subtotal-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mp-rule-subtotal-value > .mp-input-wrap {
    min-width: 0;
    flex: 1;
}

.mp-rule-subtotal-value > span {
    color: var(--sd-autodispatch-subtext-color);
    font-size: 13px;
}

.mp-rule-join-control {
    align-self: stretch;
    width: 100%;
    display: inline-flex;
    margin: 12px 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--sd-autodispatch-card-border);
    border-radius: 9px;
    background: var(--common-background);
}

.mp-rule-join-control button {
    min-width: 0;
    height: 40px;
    flex: 1;
    padding: 0 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--sd-autodispatch-subtext-color);
    font-family: inherit;
    font-size: 15px;
    font-weight: 300;
    cursor: pointer;
}

.mp-rule-join-control button.is-active {
    background: var(--mp-chip-invert-bg);
    color: var(--mp-chip-invert-text);
    box-shadow: none;
}

.mp-rule-pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.mp-rule-pricing-grid .mp-field > label {
    color: var(--sd-autodispatch-row-title-color);
    font-size: 15px;
    font-weight: 500;
}

.mp-rule-editor .mp-input-suffix {
    color: var(--sd-neutral-500);
}

.mp-rule-editor-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 24px;
    border-top: 1px solid var(--sd-autodispatch-card-border);
    background: var(--modal-background);
}

.mp-rule-editor-cancel,
.mp-rule-editor-save {
    height: 40px;
    min-height: 40px;
    padding: 8px 16px;
    border: 0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
}

.mp-rule-editor-cancel {
    background: var(--common-background);
    color: var(--sd-autodispatch-cancel-button);
    cursor: pointer;
}

.mp-rule-editor-cancel:hover {
    background: var(--sd-neutral-200);
    color: var(--sd-autodispatch-row-title-color);
}

.mp-rule-editor-save {
    background: var(--sd-autodispatch-icon-color);
    color: var(--sd-autodispatch-cancel-button);
    cursor: default;
}

.mp-rule-editor-save.is-ready {
    background: var(--sd-signup-btn-bg);
    color: #ffffff;
    cursor: pointer;
}

.mp-rule-editor-save.is-ready:hover {
    opacity: 0.9;
}

.mp-hours-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.mp-hours-separator {
    color: var(--mp-text-muted);
    font-size: 15px;
}

.mp-business-hours-fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.mp-zone-button {
    width: 100%;
    height: 44px;
}

.mp-custom-hours {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 2px;
}

.mp-custom-hour-row {
    display: grid;
    grid-template-columns: 92px 1fr 22px 1fr;
    align-items: center;
    gap: 8px;
}

.mp-custom-hour-row > span {
    color: var(--mp-text-secondary);
    font-size: 14px;
}

.mp-pricing-preview {
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--mp-surface-subtle);
    color: var(--mp-text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.mp-wizard-footer {
    flex: 0 0 auto;
    border-top: 1px solid var(--mp-border);
    background: var(--mp-surface);
}

.mp-progress-track {
    height: 3px;
    background: var(--mp-border);
}

.mp-progress-value {
    height: 100%;
    background: var(--mp-green);
    transition: width 250ms ease;
}

.mp-wizard-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    padding: 16px 32px;
}

.mp-wizard-actions > :nth-child(2) {
    justify-self: center;
    color: var(--mp-text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.mp-wizard-actions > :last-child {
    justify-self: end;
}

.mp-wizard-actions .mp-wizard-back {
    width: auto;
    height: 44px;
    min-height: 44px;
    justify-self: start;
    gap: 8px;
    padding: 10px 20px 10px 14px;
    border-radius: 8px;
    color: var(--mp-text);
    font-size: 15px;
    font-weight: 500;
}

.mp-wizard-back-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    display: block;
    color: var(--mp-text-muted);
}

.mp-confirm {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(10, 10, 10, 0.48);
}

.mp-confirm-card {
    width: min(440px, 100%);
    padding: 26px;
    border-radius: 16px;
    background: var(--modal-background);
    box-shadow: 0 20px 60px rgba(16, 24, 40, 0.22);
}

.mp-confirm-card h3 {
    margin: 0 0 7px;
    color: var(--mp-text);
    font-size: 19px;
    font-weight: 600;
}

.mp-confirm-card p {
    margin: 0 0 22px;
    color: var(--mp-text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.mp-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@media (max-width: 900px) {
    .merchant-portal-settings-row-copy small { display: none; }
    .merchant-portal-settings-value { max-width: 210px; }
}

@media (max-width: 640px) {
    .merchant-portal-settings-card-header,
    .merchant-portal-settings-row { padding-left: 16px; padding-right: 16px; }
    .merchant-portal-settings-card-header { align-items: flex-start; flex-direction: column; }
    .merchant-portal-settings-edit { width: 100%; }
    .merchant-portal-settings-value { max-width: 118px; }
    .mp-wizard-header, .mp-wizard-body { padding-left: 18px; padding-right: 18px; }
    .mp-wizard-actions { grid-template-columns: auto 1fr auto; padding: 14px 18px; }
    .mp-pricing-grid { grid-template-columns: 1fr; }
    .mp-custom-hour-row { grid-template-columns: 72px 1fr; }
    .mp-custom-hour-row .mp-custom-to-label { display: none; }
    .mp-pricing-rule-card { padding: 16px; }
    .mp-pricing-rule-name { font-size: 15px; }
    .mp-rule-condition-chip--outcome { max-width: 100%; }
    .mp-rule-editor-overlay { padding: 0; }
    .mp-rule-editor { width: 100%; max-height: 100vh; height: 100%; border-radius: 0; }
    .mp-rule-editor-header, .mp-rule-editor-content, .mp-rule-editor-footer { padding-left: 18px; padding-right: 18px; }
    .mp-rule-condition-editor, .mp-rule-pricing-grid { grid-template-columns: 1fr; }
    .mp-rule-condition-editor > .mp-rule-remove-condition:last-child { justify-self: end; margin-bottom: 0; }
}

[data-theme="dark"] .merchant-portal-settings-v2,
[data-theme="dark"] #merchant-portal-settings-modal-root,
[data-theme="dark"] .mp-merchant-settings-modal {
    --mp-text: var(--sd-neutral-950, #f5f5f5);
    --mp-text-secondary: var(--sd-neutral-700, #d1d1d1);
    --mp-text-muted: var(--sd-neutral-500, #a3a3a3);
    --mp-border: var(--sd-neutral-320, #343434);
    --mp-border-light: var(--sd-neutral-250, #2c2c2c);
    --mp-surface: var(--sd-neutral-100, #191919);
    --mp-surface-subtle: var(--sd-neutral-200, #222222);
    --mp-surface-muted: rgba(255, 255, 255, 0.08);
    /* #d92d20 only clears ~3:1 on the dark surfaces. */
    --mp-danger: #f97066;
}

[data-theme="dark"] .merchant-portal-settings-value.is-positive {
    background: rgba(0, 128, 98, 0.2);
    color: #75e0c3;
}

/* :not() is load-bearing. Bare `[data-theme="dark"] .mp-switch` ties on specificity with
   `.mp-switch[aria-checked="true"]` (both 0-2-0) and wins on source order, so it repainted
   the ON track grey and the toggle never looked green in dark mode. */
[data-theme="dark"] .mp-switch:not([aria-checked="true"]) { background: #404040; }
[data-theme="dark"] .mp-pricing-rule-menu button.is-danger {
    color: #f97066;
}

[data-theme="dark"] .mp-pricing-rule-menu button.is-danger:hover {
    background: rgba(249, 112, 102, 0.14);
}

@media (prefers-reduced-motion: reduce) {
    .merchant-portal-settings-v2 *,
    .merchant-portal-settings-v2 *::before,
    .merchant-portal-settings-v2 *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
