.salcalc-page {
    text-align: right;
}

.salcalc-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 992px) {
    .salcalc-layout {
        grid-template-columns: 1fr;
    }

    .salcalc-results {
        order: 2;
    }
}

.salcalc-form-card {
    background: var(--kbi-surface);
    border: 1px solid var(--kbi-border);
    border-radius: var(--kbi-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--kbi-shadow-sm);
}

.salcalc-section {
    margin-bottom: 1.5rem;
}

.salcalc-section:last-child {
    margin-bottom: 0;
}

.salcalc-section__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--kbi-ink);
    margin-bottom: 1rem;
}

.salcalc-section__num {
    width: 1.625rem;
    height: 1.625rem;
    border-radius: 6px;
    background: var(--kbi-indigo);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.salcalc-field {
    margin-bottom: 1rem;
}

.salcalc-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--kbi-ink-2);
    margin-bottom: 0.35rem;
}

.salcalc-optional {
    color: #9ca3af;
    font-weight: 400;
    font-size: 11px;
}

.salcalc-section__title .salcalc-optional {
    font-weight: 400;
}

.salcalc-field__hint {
    font-size: 12px;
    color: var(--kbi-ink-3);
    margin-top: 0.25rem;
}

.salcalc-input-wrap {
    display: flex;
    flex-direction: row-reverse;
    align-items: stretch;
    direction: ltr;
    border: 1px solid var(--kbi-border);
    border-radius: var(--kbi-radius-sm);
    overflow: hidden;
    background: #fff;
}

.salcalc-input-wrap:focus-within {
    border-color: var(--kbi-indigo);
    box-shadow: 0 0 0 3px var(--kbi-indigo-50);
}

.salcalc-input-wrap input {
    flex: 1;
    border: 0;
    padding: 0.65rem 0.85rem;
    font-size: 1rem;
    text-align: right;
    direction: ltr;
    min-width: 0;
    font-weight: 400;
}

.salcalc-input-wrap input:focus {
    outline: none;
}

.salcalc-input-suffix {
    display: flex;
    align-items: center;
    padding: 0 0.85rem;
    background: #fff;
    color: var(--kbi-ink-3);
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
    position: relative;
}

.salcalc-input-suffix::before {
    content: '';
    position: absolute;
    top: 0.5rem;
    bottom: 0.5rem;
    right: 0;
    width: 1px;
    background: var(--kbi-border);
}

.salcalc-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) {
    .salcalc-row {
        grid-template-columns: 1fr;
    }
}

.salcalc-actions {
    display: flex;
    flex-direction: row;
    direction: ltr;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--kbi-border);
}

.salcalc-btn-calc {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 18px 33px;
    background: var(--kbi-indigo);
    color: #fff;
    border: 0;
    border-radius: var(--kbi-radius-sm);
    font-weight: 400;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 14px -4px oklch(0.48 0.20 282 / 0.5);
}

.salcalc-btn-calc:hover:not(:disabled) {
    background: var(--kbi-indigo-2);
}

.salcalc-btn-calc:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.salcalc-btn-calc,
.salcalc-btn-reset {
    font-weight: 400 !important;
}

.salcalc-btn-reset {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-inline-start: auto;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid var(--kbi-border-2);
    border-radius: var(--kbi-radius-sm);
    color: var(--kbi-ink-2);
    font-size: 0.9rem;
    font-weight: 400;
    font-family: inherit;
    cursor: pointer;
}

.salcalc-btn-reset:hover {
    background: #f8f9fb;
}

.salcalc-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 5.5rem;
}

.salcalc-summary-card {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #7c3aed 100%);
    border-radius: var(--kbi-radius-lg);
    padding: 1.5rem;
    color: #fff;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
}

.salcalc-summary-card.is-empty {
    background: var(--kbi-surface);
    color: var(--kbi-ink-3);
    border: 1px dashed var(--kbi-border);
    box-shadow: none;
}

.salcalc-summary-card__label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.salcalc-summary-card__amount {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.salcalc-summary-card__period {
    font-size: 0.95rem;
    font-weight: 400;
    opacity: 0.85;
}

.salcalc-diff-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.salcalc-diff-badge--up {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.salcalc-diff-badge--down {
    background: rgba(254, 226, 226, 0.25);
    color: #fecaca;
}

.salcalc-diff-badge--neutral {
    background: rgba(255, 255, 255, 0.15);
}

.salcalc-summary-card__annual {
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    font-size: 0.85rem;
    opacity: 0.9;
}

.salcalc-breakdown-card {
    background: var(--kbi-surface);
    border: 1px solid var(--kbi-border);
    border-radius: var(--kbi-radius-lg);
    padding: 1.25rem;
}

.salcalc-breakdown-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.salcalc-breakdown-card__title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

.salcalc-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--kbi-border);
    font-size: 0.9rem;
}

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

.salcalc-breakdown-row__label {
    color: var(--kbi-ink-2);
}

.salcalc-breakdown-row__label small {
    display: block;
    color: var(--kbi-ink-3);
    font-size: 0.75rem;
    margin-top: 0.15rem;
}

.salcalc-breakdown-row__value {
    font-weight: 600;
    color: var(--kbi-ink);
    white-space: nowrap;
}

.salcalc-breakdown-row--deduction .salcalc-breakdown-row__value {
    color: #dc2626;
}

.salcalc-breakdown-row--total {
    padding-top: 0.75rem;
    margin-top: 0.25rem;
    border-top: 2px solid var(--kbi-border);
    font-weight: 700;
}

.salcalc-disclaimer {
    display: flex;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--kbi-radius-sm);
    font-size: 0.8rem;
    color: #92400e;
    line-height: 1.6;
}

.salcalc-disclaimer svg {
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.salcalc-disclaimer p {
    margin: 0;
}

.salcalc-notices {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.salcalc-disclaimer--privacy {
    background: #f8fafc;
    border-color: var(--kbi-border);
    color: var(--kbi-ink-2);
}

.salcalc-hidden {
    display: none !important;
}

/* v2 layout fixes */
.salcalc-page.kbi-inner-card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.salcalc-layout {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);
    gap: 1.75rem;
    width: 100%;
}

.salcalc-form-card,
.salcalc-results,
.salcalc-field,
.salcalc-row > .salcalc-field {
    min-width: 0;
}

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

.salcalc-input--invalid {
    border-color: #f87171 !important;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2) !important;
}

.salcalc-btn-hint {
    font-size: 0.85rem;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--kbi-radius-sm);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
}

@media (max-width: 992px) {
    .salcalc-layout {
        grid-template-columns: 1fr;
    }

    .salcalc-results {
        position: static;
    }
}
