.spmd-apc-outer,
.spmd-apc-outer * {
    box-sizing: border-box;
}

.spmd-apc-outer {
    width: 100%;
    margin: 0 auto;
    padding: 14px 14px 30px;
    color: #1f2933;
    font-family: inherit;
}

.spmd-apc-calculator {
    width: 100%;
    max-width: 610px;
    margin: 0 auto;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #dce5e2;
    border-radius: 18px;
    box-shadow: 0 14px 34px rgba(31, 41, 51, .08);
}

.spmd-apc-front-head {
    padding: 28px 26px 20px;
    color: #ffffff;
    text-align: center;
    background: #173f3a;
}

.spmd-apc-front-head span {
    display: block;
    margin: 0 0 7px;
    color: #e1b66f;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.spmd-apc-front-head h2 {
    margin: 0;
    color: #ffffff;
    font-size: clamp(23px, 2.6vw, 26px);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -.02em;
}

.spmd-apc-front-head p {
    max-width: 420px;
    margin: 5px auto 0;
    color: #d7e4e1;
    font-size: 14px;
    line-height: 1.55;
}

.spmd-apc-front-grid[hidden],
.spmd-apc-front-actions[hidden],
.spmd-apc-front-field[hidden],
.spmd-apc-included-copy[hidden],
.spmd-apc-result [hidden] {
    display: none !important;
}

.spmd-apc-front-field {
    min-width: 0;
    text-align: center;
}

.spmd-apc-journal-field {
    padding: 6px 28px 13px;
    background: #ffffff;
}

.spmd-apc-front-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 0 28px 2px;
    background: #ffffff;
}

.spmd-apc-front-grid > .spmd-apc-front-field {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 7px 0 8px;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.spmd-apc-front-field > label {
    display: block;
    margin: 0 0 5px;
    color: #344054;
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
}

.spmd-apc-journal-field label {
    color: #245c54;
}

.spmd-apc-journal-field label span {
    color: #b42318;
}

.spmd-apc-front-field select,
.spmd-apc-front-field input[type="number"] {
    width: 100%;
    min-height: 42px;
    margin: 0;
    padding: 7px 10px;
    color: #344054;
    font: inherit;
    font-size: 15.5px;
    line-height: 1.3;
    text-align: center;
    background: #fff;
    border: 1px solid #ccd8d5;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(25, 35, 50, .05);
    transition: border-color .16s ease, box-shadow .16s ease;
}

.spmd-apc-front-field select {
    display: block;
    max-width: 280px;
    margin-right: auto;
    margin-left: auto;
    text-align-last: center;
}

.spmd-apc-journal-field select {
    max-width: 460px;
    min-height: 42px;
    padding-right: 36px;
    color: #27364b;
    font-size: 15px;
}

.spmd-apc-front-field select:hover:not(:disabled),
.spmd-apc-front-field input[type="number"]:hover:not(:disabled) {
    border-color: #c08a3e;
}

.spmd-apc-front-field select:focus,
.spmd-apc-front-field input[type="number"]:focus {
    outline: none;
    border-color: #245c54;
    box-shadow: 0 0 0 3px rgba(36, 92, 84, .12);
}

.spmd-apc-front-field select:disabled,
.spmd-apc-front-field input:disabled {
    color: #7a8699;
    background: #f2f4f5;
    border-color: #e0e5e3;
    cursor: not-allowed;
    opacity: 1;
}

.spmd-apc-stepper {
    display: grid;
    grid-template-columns: 42px minmax(130px, 250px) 42px;
    gap: 10px;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 370px;
    margin: 0 auto;
}

.spmd-apc-stepper input[type="number"] {
    min-width: 0;
    text-align: center;
    appearance: textfield;
    -moz-appearance: textfield;
}

.spmd-apc-stepper input::-webkit-outer-spin-button,
.spmd-apc-stepper input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.spmd-apc-stepper button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin: 0;
    padding: 0;
    color: #fff;
    font-size: 19px;
    font-weight: 600;
    line-height: 1;
    background: #245c54;
    border: 1px solid #245c54;
    border-radius: 9px;
    box-shadow: 0 3px 7px rgba(0, 0, 0, .16);
    cursor: pointer;
    transition: background-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.spmd-apc-stepper button:hover:not(:disabled) {
    background: #173f3a;
    border-color: #173f3a;
    box-shadow: 0 5px 11px rgba(23, 63, 58, .22);
    transform: translateY(-1px);
}

.spmd-apc-stepper button:focus-visible,
.spmd-apc-front-actions button:focus-visible,
.spmd-apc-reset:focus-visible {
    outline: 3px solid rgba(192, 138, 62, .28);
    outline-offset: 2px;
}

.spmd-apc-stepper button:disabled {
    color: #9aa1aa;
    background: #e6e8eb;
    border-color: #e6e8eb;
    box-shadow: none;
    cursor: not-allowed;
}

.spmd-apc-hint {
    max-width: 460px;
    min-height: 0;
    margin: 5px auto 0;
    color: #667085;
    font-size: 13px;
    line-height: 1.45;
    text-align: center;
}

.spmd-apc-included-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 0 auto 7px;
    padding: 5px 9px;
    color: #146c3b;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.35;
    background: #edf9f1;
    border: 1px solid #bfe5cb;
    border-radius: 999px;
}

.spmd-apc-included-copy span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    color: #fff;
    font-size: 10px;
    background: #1d8a4c;
    border-radius: 50%;
}

.spmd-apc-front-actions {
    display: flex;
    justify-content: center;
    padding: 7px 24px 6px;
    background: #ffffff;
}

.spmd-apc-front-actions button,
.spmd-apc-reset {
    min-width: 110px;
    min-height: 40px;
    margin: 0;
    padding: 7px 18px;
    color: #fff;
    font: inherit;
    font-size: 14.5px;
    font-weight: 700;
    background: #245c54;
    border: 1px solid #245c54;
    border-radius: 999px;
    box-shadow: 0 7px 14px rgba(36, 92, 84, .18);
    cursor: pointer;
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.spmd-apc-front-actions button:hover:not(:disabled),
.spmd-apc-reset:hover {
    color: #fff;
    background: #173f3a;
    border-color: #173f3a;
    box-shadow: 0 8px 17px rgba(23, 63, 58, .24);
}

.spmd-apc-front-actions button:disabled {
    color: #8a929f;
    background: #e4e7eb;
    border-color: #e4e7eb;
    box-shadow: none;
    cursor: not-allowed;
}

.spmd-apc-result {
    padding: 6px 28px 26px;
    background: #ffffff;
    border: 0;
}

.spmd-apc-result.is-empty {
    padding-top: 14px;
    padding-bottom: 24px;
}

.spmd-apc-result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 430px;
    margin: 0 auto;
    color: #667085;
    text-align: center;
}

.spmd-apc-placeholder-icon {
    display: none;
}

.spmd-apc-result-placeholder strong {
    color: #344054;
    font-size: 14px;
    line-height: 1.45;
}

.spmd-apc-result-placeholder small {
    max-width: 390px;
    margin-top: 4px;
    color: #7a8699;
    font-size: 13px;
    line-height: 1.5;
}

.spmd-apc-breakdown {
    max-width: 420px;
    margin: 0 auto 10px;
    padding: 3px 12px;
    background: #fff;
    border: 1px solid #e1e7e5;
    border-radius: 8px;
}

.spmd-apc-breakdown-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 7px 0;
    color: #667085;
    font-size: 13.5px;
    border-bottom: 1px dashed #dde4e2;
}

.spmd-apc-breakdown-row:last-child {
    border-bottom: 0;
}

.spmd-apc-breakdown-row strong {
    color: #344054;
    white-space: nowrap;
}

.spmd-apc-breakdown-row.is-included strong {
    color: #107c41;
}

.spmd-apc-total {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    max-width: 460px;
    margin: 0 auto;
    padding: 5px 0;
    color: #173f3a;
    font-size: 20px;
    font-weight: 800;
    text-align: center;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.spmd-apc-total span::after {
    content: ":";
}

.spmd-apc-total strong {
    color: #173f3a;
    font-size: 21px;
    white-space: nowrap;
}

.spmd-apc-reset-wrap {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

.spmd-apc-empty {
    max-width: 590px;
    margin: 32px auto;
    padding: 16px 18px;
    color: #6b4b00;
    text-align: center;
    background: #fff8e5;
    border: 1px solid #f0d48a;
    border-radius: 12px;
}

@media (prefers-reduced-motion: no-preference) {
    .spmd-apc-outer.is-ready .spmd-apc-front-grid,
    .spmd-apc-outer.is-ready .spmd-apc-front-actions {
        animation: spmd-apc-reveal .2s ease-out both;
    }

    @keyframes spmd-apc-reveal {
        from {
            opacity: 0;
            transform: translateY(-4px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

@media (max-width: 640px) {
    .spmd-apc-outer {
        padding: 10px 8px 18px;
    }

    .spmd-apc-calculator {
        border-radius: 16px;
        box-shadow: 0 7px 20px rgba(22, 34, 50, .09);
    }

    .spmd-apc-front-head {
        padding: 24px 16px 10px;
    }

    .spmd-apc-front-head p {
        font-size: 13.5px;
    }

    .spmd-apc-journal-field {
        padding: 6px 16px 12px;
    }

    .spmd-apc-front-grid {
        padding: 0 16px 2px;
    }

    .spmd-apc-front-grid > .spmd-apc-front-field {
        padding: 6px 0 8px;
    }

    .spmd-apc-stepper {
        grid-template-columns: 40px minmax(100px, 1fr) 40px;
        gap: 7px;
        max-width: 340px;
    }

    .spmd-apc-stepper button {
        width: 40px;
        height: 40px;
        font-size: 19px;
        border-radius: 8px;
    }

    .spmd-apc-front-field select,
    .spmd-apc-front-field input[type="number"] {
        min-height: 42px;
        font-size: 15px;
    }

    .spmd-apc-front-actions {
        padding: 7px 16px 6px;
    }

    .spmd-apc-result,
    .spmd-apc-result.is-empty {
        padding: 9px 16px 22px;
    }

    .spmd-apc-total,
    .spmd-apc-total strong {
        font-size: 19px;
    }
}

@media (max-width: 360px) {
    .spmd-apc-front-head h2 {
        font-size: 21px;
    }

    .spmd-apc-front-field > label {
        font-size: 14px;
    }

    .spmd-apc-stepper {
        grid-template-columns: 36px minmax(82px, 1fr) 36px;
        gap: 6px;
    }

    .spmd-apc-stepper button {
        width: 36px;
        height: 36px;
    }

    .spmd-apc-breakdown-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }
}
