:root {
    --bg: #f0f4f8;
    --card: #ffffff;
    --text: #1a2332;
    --muted: #5c6b7a;
    --accent: #0038a8;
    --accent-hover: #002d86;
    --green: #1b7f4a;
    --green-bg: #e6f5ec;
    --red: #ce1126;
    --border: #e2e8f0;
    --shadow: 0 4px 24px rgba(26, 35, 50, 0.08);
    --radius: 16px;
    --surface-subtle: #f8fafc;
    --surface-input: #fafbfc;
    --surface-hover: #e8eef8;
    --surface-active: #f1f5f9;
    --prose: #334155;
    --deduction: #b42318;
    --banner-bg: #fff8e6;
    --banner-border: #f0d78c;
    --banner-text: #5c4a1a;
    --banner-strong: #3d320f;
    --share-border: #c5d4f0;
    --share-copied-bg: #f0fdf4;
    --share-copied-border: #86efac;
    --deduction-bg: #fef2f2;
    --deduction-border: #fecaca;
    --deduction-hover: #fee2e2;
    --header-shadow: 0 1px 8px rgba(26, 35, 50, 0.06);
    --focus-ring: rgba(0, 56, 168, 0.12);
    --success-muted: #2d6a4a;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f1419;
    --card: #1a2332;
    --text: #e8eef4;
    --muted: #94a3b8;
    --accent: #4d8fff;
    --accent-hover: #6ba3ff;
    --green: #34d399;
    --green-bg: #1a2e28;
    --red: #f87171;
    --border: #2d3a4d;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --surface-subtle: #232f42;
    --surface-input: #1e293b;
    --surface-hover: #2a3a52;
    --surface-active: #2d3a4d;
    --prose: #cbd5e1;
    --deduction: #fca5a5;
    --banner-bg: #2d2818;
    --banner-border: #5c4a1a;
    --banner-text: #e8d5a3;
    --banner-strong: #f5e6b8;
    --share-border: #3d5080;
    --share-copied-bg: #1a2e22;
    --share-copied-border: #34d399;
    --deduction-bg: #2a1f1f;
    --deduction-border: #7f1d1d;
    --deduction-hover: #3d2525;
    --header-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
    --focus-ring: rgba(77, 143, 255, 0.2);
    --success-muted: #6ee7b7;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "DM Sans", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

.page {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
}

.hero {
    text-align: center;
    margin-bottom: 1.75rem;
}

.hero-badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--surface-hover);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 0.75rem;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent) 0%, #1a4fc4 50%, var(--red) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-sub {
    margin-top: 0.5rem;
    color: var(--muted);
    font-size: 1.05rem;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.input-card {
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.field-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.input-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.salary-input-wrap {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 0 1rem;
    background: var(--surface-input);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.salary-input-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus-ring);
    background: var(--card);
}

.currency {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--muted);
    margin-right: 0.35rem;
}

.salary-input-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1.35rem;
    font-weight: 600;
    padding: 0.85rem 0;
    outline: none;
    font-family: inherit;
    color: var(--text);
    width: 100%;
    min-width: 0;
    -moz-appearance: textfield;
}

.salary-input-wrap input::-webkit-outer-spin-button,
.salary-input-wrap input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.calculator-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.35rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.calculator-tab {
    flex: 1;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--muted);
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    text-align: center;
    line-height: 1.3;
}

.calculator-tab:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.calculator-tab.active {
    color: var(--accent);
    background: var(--surface-hover);
}

@media (max-width: 600px) {
    .calculator-tab {
        font-size: 0.75rem;
        padding: 0.65rem 0.4rem;
    }
}

.thirteenth-intro,
.budget-intro {
    margin-top: 0;
    margin-bottom: 1.25rem;
}

.budget-fields-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.budget-top-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.budget-income-field {
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0;
}

.budget-sync-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.budget-sync-col[hidden] {
    display: none !important;
}

.budget-income-field .months-slider-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
}

.budget-income-field .months-slider {
    height: 26px;
}

.budget-income-field .months-slider::-webkit-slider-thumb {
    width: 26px;
    height: 26px;
    margin-top: -10px;
}

.budget-income-field .months-slider::-moz-range-thumb {
    width: 26px;
    height: 26px;
}

.budget-share-row {
    margin-top: 0.5rem;
}

.budget-mode-field {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.budget-mode-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.budget-mode-tab {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.65rem 0.5rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.budget-mode-tab input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.budget-mode-tab:has(input:checked) {
    color: var(--accent);
    background: var(--card);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.budget-mode-tab:hover {
    border-color: var(--accent);
}

.budget-actions-row {
    display: flex;
    justify-content: flex-end;
}

.reset-btn {
    padding: 0.85rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--muted);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.reset-btn:hover {
    color: var(--text);
    background: var(--surface-hover);
    border-color: var(--muted);
}

.reset-btn:active {
    transform: scale(0.98);
}

.budget-sync-btn {
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--accent);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.budget-sync-btn:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
}

.budget-sync-amount {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--green);
    text-align: right;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .budget-top-row {
        flex-direction: column;
        align-items: stretch;
    }

    .budget-sync-col {
        align-items: flex-start;
    }

    .budget-sync-amount {
        text-align: left;
        white-space: normal;
    }
}

.budget-lifestyle-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.55;
    margin: 0.5rem 0 0;
}

.budget-summary-note {
    margin-top: 0.65rem;
    margin-bottom: 1rem;
    text-align: left;
}

.budget-breakdown-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 1rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.budget-pct {
    font-weight: 500;
    font-size: 0.82rem;
    color: var(--muted);
}

.breakdown .budget-breakdown-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
}

.budget-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.budget-row-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    text-align: left;
}

.budget-row-amount {
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    white-space: nowrap;
    text-align: right;
}

.budget-pct-slider-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.15rem 0;
}

.budget-pct-step {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1;
    font-family: inherit;
    color: var(--accent);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.budget-pct-step:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: var(--accent);
}

.budget-pct-step:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.budget-pct-slider {
    flex: 1;
    min-width: 0;
    width: auto;
}

.budget-pct-display {
    flex-shrink: 0;
    width: 3.25rem;
    font-size: 0.82rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    text-align: right;
}

.budget-pct-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.budget-pct-warning {
    position: relative;
    display: none;
    align-items: center;
    flex-shrink: 0;
}

.budget-pct-warning.is-visible {
    display: inline-flex;
}

.budget-pct-warning-icon {
    font-size: 0.95rem;
    line-height: 1;
    color: var(--red);
    cursor: help;
}

.budget-pct-warning-tip {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.45rem);
    width: max-content;
    max-width: 16rem;
    padding: 0.45rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 5;
}

.budget-pct-warning:hover .budget-pct-warning-tip,
.budget-pct-warning:focus-visible .budget-pct-warning-tip {
    opacity: 1;
}

.calc-info-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-left: 0.35rem;
    cursor: help;
    outline: none;
}

.calc-info-tip-icon {
    font-size: 0.95rem;
    line-height: 1;
    color: var(--muted);
    transition: color 0.15s;
}

.calc-info-tip:hover .calc-info-tip-icon,
.calc-info-tip:focus-visible .calc-info-tip-icon,
.calc-info-tip.is-open .calc-info-tip-icon {
    color: var(--accent);
}

.calc-info-tip-text {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.45rem);
    transform: translateX(-50%);
    width: max-content;
    max-width: 18rem;
    padding: 0.5rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.45;
    text-align: left;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 10;
}

.calc-info-tip:hover .calc-info-tip-text,
.calc-info-tip:focus-visible .calc-info-tip-text,
.calc-info-tip.is-open .calc-info-tip-text {
    opacity: 1;
}

.net-pay-banner .calc-info-tip-text,
.compare-diff-banner .calc-info-tip-text {
    left: auto;
    right: 0;
    transform: none;
}

.chart-card .calc-info-tip {
    margin-left: 0.25rem;
}

.input-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 600px) {
    .input-fields-grid {
        grid-template-columns: 1fr;
    }
}

.months-slider-field {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.65rem;
    padding: 0.25rem 0;
}

.months-slider-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.months-slider-header .field-label {
    margin-bottom: 0;
}

.months-slider-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.months-slider-wrap {
    display: flex;
    align-items: center;
    padding: 0.4rem 0;
}

.months-slider {
    width: 100%;
    height: 22px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    outline: none;
    cursor: pointer;
}

.months-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    margin-top: -8px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--card);
    box-shadow: 0 1px 6px rgba(26, 35, 50, 0.2);
    box-sizing: border-box;
    cursor: pointer;
    transition: transform 0.1s;
}

.months-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--card);
    box-shadow: 0 1px 6px rgba(26, 35, 50, 0.2);
    box-sizing: border-box;
    cursor: pointer;
}

.months-slider:active::-webkit-slider-thumb {
    transform: scale(1.08);
}

.months-slider::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(
        to right,
        var(--accent) 0%,
        var(--accent) var(--slider-progress, 45%),
        var(--border) var(--slider-progress, 45%),
        var(--border) 100%
    );
}

.months-slider::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: var(--border);
}

.months-slider::-moz-range-progress {
    height: 6px;
    border-radius: 999px;
    background: var(--accent);
}

.months-slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.thirteenth-results {
    padding: 1.5rem;
}

.thirteenth-salary-cta {
    margin-top: 1rem;
    font-size: 0.9rem;
    text-align: center;
    line-height: 1.5;
}

.thirteenth-salary-link {
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    font-variant-numeric: tabular-nums;
}

.thirteenth-salary-link:hover {
    text-decoration: underline;
}

.thirteenth-salary-cta-hint {
    color: var(--muted);
    font-size: 0.85rem;
}

.formula-box {
    margin-top: 1.25rem;
    padding: 1rem 1.15rem;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.formula-line {
    font-size: 0.9rem;
    color: var(--prose);
    font-variant-numeric: tabular-nums;
    margin-top: 0.35rem;
}

.calc-btn {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.calc-btn:hover {
    background: var(--accent-hover);
}

.calc-btn:active {
    transform: scale(0.98);
}

.calc-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.error {
    margin-top: 0.75rem;
    color: var(--red);
    font-size: 0.9rem;
    font-weight: 500;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 768px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

.summary-card,
.chart-card,
.yearly-card {
    padding: 1.5rem;
}

.yearly-card {
    grid-column: 1 / -1;
}

.net-pay-banner {
    background: var(--green-bg);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.net-pay-value {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    color: var(--green);
    margin: 0.25rem 0 0;
    text-align: center;
}

.net-pay-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.85rem;
}

.share-btn[hidden] {
    display: none !important;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--accent);
    background: var(--card);
    border: 1px solid var(--share-border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.share-btn:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
}

.share-btn.copied {
    color: var(--green);
    border-color: var(--share-copied-border);
    background: var(--share-copied-bg);
}

.share-icon {
    font-size: 0.95rem;
}

.share-feedback {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--success-muted);
    margin-top: 0.5rem;
}

.take-home-pct {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--success-muted);
    margin-top: 0.15rem;
}

.yearly-banner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
}

.yearly-item {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
}

.yearly-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--green);
    margin-top: 0.25rem;
    font-variant-numeric: tabular-nums;
}

.yearly-value.tax {
    color: var(--red);
}

@media (max-width: 480px) {
    .yearly-banner {
        grid-template-columns: 1fr;
    }
}

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

.breakdown .row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border);
}

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

.breakdown dt {
    font-size: 0.9rem;
    color: var(--muted);
}

.breakdown dd {
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.breakdown .deduction dd {
    color: var(--deduction);
}

.breakdown .total dt,
.breakdown .total dd {
    font-weight: 700;
    color: var(--text);
    font-size: 1.05rem;
}

.msc-note {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
}

.msc-note + .msc-note {
    margin-top: 0.4rem;
}

.chart-card h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 1rem;
}

.chart-wrap {
    position: relative;
    max-width: 288px;
    margin: 0 auto;
    aspect-ratio: 1;
}

.legend {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1rem;
    margin-top: 1.25rem;
}

.legend li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.legend-item {
    cursor: pointer;
    padding: 0.35rem 0.45rem;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}

.legend-item:hover,
.legend-item.legend-active {
    background: var(--surface-active);
    color: var(--text);
}

.legend .swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend .amount {
    margin-left: auto;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--muted);
}

.compare-intro {
    margin-bottom: 1rem;
}

.compare-input-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem 1.25rem;
    align-items: start;
}

.compare-vs {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: lowercase;
    color: var(--muted);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.compare-input-col {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 14px;
    align-items: stretch;
}

.compare-input-col > .salary-input-wrap {
    flex: none;
    width: 100%;
    min-width: 0;
}

.compare-col-heading {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: var(--text);
}

.compare-submit-row {
    margin-top: 1.25rem;
    justify-content: center;
}

.compare-extra-section--inline {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.compare-option-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.compare-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
}

.compare-flags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.compare-flag-btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: inherit;
    color: var(--muted);
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.compare-flag-btn:hover {
    border-color: var(--accent);
}

.compare-flag-btn.active {
    color: var(--accent);
    background: var(--card);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.compare-extra-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.compare-extra-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.compare-extra-header .field-label {
    margin-bottom: 0;
}

.compare-extra-hint {
    margin-top: 0.35rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.compare-add-btn {
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--accent);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.compare-add-btn:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
}

.compare-items-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.compare-item-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.compare-item-row .salary-input-wrap {
    flex: 1;
}

.compare-item-remove {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--muted);
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.compare-item-remove:hover {
    color: var(--red);
    border-color: var(--red);
}

.compare-salary-results {
    margin-top: 1.25rem;
    padding: 1.5rem;
    scroll-margin-top: 1rem;
}

.compare-results-layout {
    display: flex;
    flex-direction: column;
}

.compare-results-layout .salary-compare-grid {
    order: 1;
}

.compare-results-layout .compare-diff-banner {
    order: 2;
}

.salary-compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .compare-input-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .compare-vs {
        justify-self: center;
        margin: 0.75rem 0;
    }

    .compare-submit-row .calc-btn {
        width: 100%;
    }

    .compare-salary-results {
        padding: 1.25rem;
    }

    .compare-results-layout .compare-diff-banner {
        order: -1;
        margin-top: 0;
        margin-bottom: 1.25rem;
        padding-top: 0;
        padding-bottom: 1.25rem;
        border-top: none;
        border-bottom: 1px solid var(--border);
    }

    .compare-mobile-net-strip {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.65rem;
        margin-bottom: 1rem;
    }

    .compare-mobile-net-card {
        padding: 0.75rem 0.85rem;
        background: var(--surface-subtle);
        border: 1px solid var(--border);
        border-radius: 12px;
        text-align: center;
    }

    .compare-mobile-net-value {
        margin: 0.2rem 0 0;
        font-size: clamp(0.95rem, 4.5vw, 1.15rem);
        font-weight: 700;
        font-variant-numeric: tabular-nums;
        line-height: 1.25;
    }

    .compare-mobile-net-value .compare-row-pct-diff {
        display: block;
        margin-top: 0.15rem;
        font-size: 0.72rem;
    }

    .compare-mobile-view-tabs {
        display: flex;
        order: 0;
    }

    .compare-results-layout.compare-mobile-view-table .compare-mobile-table-panel {
        display: flex;
        flex-direction: column;
        order: 1;
        max-height: min(70vh, 34rem);
        border: 1px solid var(--border);
        border-radius: 12px;
    }

    .compare-results-layout.compare-mobile-view-table .compare-mobile-sticky-header {
        display: grid;
        flex-shrink: 0;
        border-radius: 11px 11px 0 0;
    }

    .compare-results-layout.compare-mobile-view-table .compare-mobile-table-wrap {
        display: flex;
        flex: 1;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
        border-radius: 0 0 11px 11px;
    }

    .compare-results-layout.compare-mobile-view-table .compare-mobile-table-scroll {
        overflow-y: auto;
    }

    .compare-results-layout.compare-mobile-view-table .salary-compare-grid {
        display: none;
    }

    .compare-results-layout.compare-mobile-view-details .compare-mobile-table-panel {
        display: none;
    }

    .compare-results-layout.compare-mobile-view-details .compare-mobile-table-wrap {
        display: none;
    }

    .compare-results-layout.compare-mobile-view-details .salary-compare-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1.25rem;
        order: 1;
    }

    .compare-results-layout.compare-mobile-view-details .salary-compare-col + .salary-compare-col {
        padding-top: 1.25rem;
        border-top: 1px solid var(--border);
    }

    .compare-results-layout.compare-mobile-view-details .breakdown .row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }

    .compare-results-layout.compare-mobile-view-details .breakdown dd {
        width: 100%;
    }
}

.salary-compare-heading {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
}

.salary-compare-col .net-pay-banner {
    margin-bottom: 1rem;
}

.compare-diff-banner {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.compare-diff-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-top: 0.25rem;
}

.compare-diff-value.positive {
    color: var(--green);
}

.compare-diff-value.negative {
    color: var(--red);
}

@media (min-width: 769px) {
    .compare-mobile-net-strip,
    .compare-mobile-table-panel,
    .compare-mobile-table-wrap,
    .compare-mobile-view-tabs,
    .compare-mobile-sticky-header {
        display: none;
    }
}

.compare-mobile-table-panel {
    display: none;
}

.compare-mobile-view-tabs {
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.25rem;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.compare-mobile-view-tab {
    flex: 1;
    padding: 0.65rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 700;
    font-family: inherit;
    color: var(--muted);
    background: transparent;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.compare-mobile-view-tab:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.compare-mobile-view-tab.active {
    color: var(--accent);
    background: var(--card);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.compare-mobile-table-wrap {
    display: none;
}

.compare-mobile-sticky-header {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    background: var(--surface-subtle);
    border-bottom: 1px solid var(--border);
}

.compare-mobile-sticky-col {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    text-align: center;
    color: var(--muted);
    line-height: 1.3;
}

.compare-mobile-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
}

.compare-mobile-table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}

.compare-mobile-table td {
    padding: 0;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}

.compare-mobile-item-row > td {
    padding: 0.75rem 0;
}

.compare-mobile-item-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.45rem;
}

.compare-mobile-item-values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.compare-mobile-item-value {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.15rem;
    padding: 0.55rem 0.6rem;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: visible;
    text-align: center;
}

.compare-mobile-indicator-row .compare-mobile-item-value {
    padding: 0.15rem 0;
    background: transparent;
    border: none;
    border-radius: 0;
}

.compare-mobile-col-value {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    overflow: visible;
}

.compare-mobile-col-value .indicator-yes {
    color: var(--green);
}

.compare-mobile-col-value .indicator-no {
    color: var(--red);
}

.compare-mobile-col-value .shift-regular {
    color: var(--green);
}

.compare-mobile-col-value .shift-midshift {
    color: #9a6700;
}

.compare-mobile-col-value .shift-nightshift {
    color: var(--red);
}

[data-theme="dark"] .compare-mobile-col-value .shift-midshift {
    color: #f4c430;
}

.compare-mobile-col-value .compare-indicator-tip-wrap {
    position: relative;
    display: inline-block;
    cursor: help;
    text-decoration: underline dotted;
    text-underline-offset: 0.2em;
}

.compare-mobile-col-value .compare-indicator-tip {
    left: 0;
    right: auto;
    bottom: auto;
    top: calc(100% + 0.45rem);
}

.compare-mobile-col-value.deduction {
    color: var(--deduction);
}

.compare-mobile-col-value.addition {
    color: var(--green);
}

.compare-mobile-col-value.is-zero {
    font-weight: 500;
}

.compare-mobile-net-row .compare-mobile-item-label,
.compare-mobile-total-row .compare-mobile-item-label {
    font-weight: 700;
    color: var(--text);
}

.compare-mobile-net-row .compare-mobile-col-value,
.compare-mobile-total-row .compare-mobile-col-value {
    font-size: 0.92rem;
}

.compare-mobile-item-value:has(.compare-mobile-col-value.compare-row-pct-highlight) {
    background: var(--green-bg);
    border-color: transparent;
}

.compare-mobile-section td {
    padding-top: 0.85rem;
    padding-bottom: 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
    background: transparent;
    border-bottom: none;
}

.compare-mobile-table .compare-row-pct-diff {
    display: block;
    margin-left: 0;
    margin-top: 0.15rem;
    font-size: 0.72rem;
}

.compare-row-pct-diff {
    display: inline-block;
    margin-left: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--green);
    white-space: nowrap;
}

.compare-row-pct-diff--negative {
    color: var(--red);
}

.compare-salary-results .breakdown .row.compare-row-pct-highlight {
    margin-inline: -0.5rem;
    padding: 0.65rem 0.5rem;
    background: var(--green-bg);
    border-radius: 10px;
    border-bottom-color: transparent;
}

.compare-salary-results .breakdown .row.compare-row-pct-highlight + .row {
    border-top: none;
}

.compare-salary-results .breakdown .row.compare-row-pct-highlight dt {
    font-weight: 700;
    color: var(--green);
    font-size: 1rem;
}

.compare-salary-results .breakdown .row.is-zero dd {
    font-weight: 500;
}

.compare-salary-results .breakdown .row.total.is-zero dt,
.compare-salary-results .breakdown .row.total.is-zero dd {
    font-weight: 500;
    font-size: 1rem;
}

.compare-salary-results .net-pay-value .compare-row-pct-diff {
    font-size: clamp(0.95rem, 2.5vw, 1.15rem);
    vertical-align: middle;
}

.breakdown .row.addition dt,
.breakdown .row.addition dd {
    color: var(--green);
}

.compare-indicators-label,
.compare-payroll-label {
    margin-top: 0.75rem;
    margin-bottom: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.compare-indicators-label:first-child {
    margin-top: 0;
}

.breakdown .row.indicator {
    overflow: visible;
}

.breakdown .row.indicator dd {
    font-weight: 600;
    color: var(--text);
    overflow: visible;
}

.breakdown .row.indicator dd.indicator-yes {
    color: var(--green);
}

.compare-indicator-tip-wrap {
    position: relative;
    display: inline-block;
    cursor: help;
    text-decoration: underline dotted;
    text-underline-offset: 0.2em;
}

.compare-indicator-tip {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.45rem);
    width: max-content;
    max-width: 14rem;
    padding: 0.45rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 10;
    white-space: normal;
    text-align: left;
    text-decoration: none;
}

.compare-indicator-tip-wrap:hover .compare-indicator-tip,
.compare-indicator-tip-wrap:focus-visible .compare-indicator-tip {
    opacity: 1;
}

.breakdown .row.indicator dd.indicator-no {
    color: var(--red);
}

.breakdown .row.indicator dd.shift-regular {
    color: var(--green);
}

.breakdown .row.indicator dd.shift-midshift {
    color: #9a6700;
}

.breakdown .row.indicator dd.shift-nightshift {
    color: var(--red);
}

[data-theme="dark"] .breakdown .row.indicator dd.shift-midshift {
    color: #f4c430;
}
