* {
    box-sizing: border-box;
}

:root {
    --bg: #f6f7f9;
    --card: #ffffff;
    --text: #17181c;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #e11d48;
    --primary-dark: #be123c;
    --soft: #fff1f2;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;
}

.tool-page {
    width: min(100% - 32px, 900px);
    margin: 0 auto;
    padding: 28px 0 60px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 32px;
}

.back-link:hover {
    color: var(--primary);
}

.tool-header {
    text-align: center;
    margin-bottom: 30px;
}

.tool-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    background: var(--soft);
    border-radius: 20px;
    font-size: 30px;
}

.tool-header h1 {
    margin: 0;
    font-size: clamp(30px, 6vw, 44px);
    letter-spacing: -1px;
}

.tool-header p {
    margin: 10px auto 0;
    max-width: 550px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.6;
}

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

.calculator-card > label,
.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #374151;
    font-size: 14px;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font: inherit;
    outline: none;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.10);
}

.input-money {
    position: relative;
    margin-top: 8px;
}

.input-money input {
    padding-right: 65px;
    font-size: 18px;
    font-weight: 600;
}

.input-money span {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.primary-button,
.secondary-button {
    min-height: 48px;
    border-radius: 12px;
    padding: 12px 18px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition:
        transform 0.15s ease,
        background 0.15s ease,
        box-shadow 0.15s ease;
}

.primary-button {
    width: 100%;
    margin-top: 22px;
    border: 0;
    background: var(--primary);
    color: white;
    box-shadow: 0 8px 18px rgba(225, 29, 72, 0.18);
}

.primary-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.secondary-button {
    border: 1px solid var(--border);
    background: white;
    color: var(--text);
}

.secondary-button:hover {
    background: #f9fafb;
}

.result-box {
    margin-top: 24px;
    padding: 22px;
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 16px;
}

.result-main {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.result-main span,
.result-main small {
    display: block;
    color: var(--muted);
}

.result-main span {
    font-size: 14px;
    font-weight: 600;
}

.result-main strong {
    display: block;
    margin: 7px 0 2px;
    color: var(--primary);
    font-size: clamp(32px, 8vw, 44px);
    letter-spacing: -1px;
}

.result-main small {
    font-size: 13px;
}

.result-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

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

.result-row span {
    color: var(--muted);
}

.result-row strong {
    text-align: right;
}

.info-box {
    margin-top: 18px;
    padding: 18px 20px;
    background: var(--soft);
    border: 1px solid #fecdd3;
    border-radius: 16px;
    color: #881337;
    font-size: 13px;
    line-height: 1.6;
}

.info-box strong {
    display: block;
    margin-bottom: 4px;
}

.info-box p {
    margin: 0;
}

/* Invoice */

.invoice-grid {
    display: grid;
    gap: 18px;
}

.items {
    margin-top: 2px;
}

.items h3 {
    margin: 0 0 12px;
    font-size: 17px;
}

.item-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 80px 120px 44px;
    gap: 8px;
    margin-bottom: 9px;
}

.item-row input {
    min-height: 44px;
}

.remove-item {
    min-height: 44px;
    border: 1px solid var(--border);
    background: #fff;
    color: #6b7280;
    border-radius: 10px;
    cursor: pointer;
    font-size: 20px;
}

.remove-item:hover {
    background: #fff1f2;
    color: var(--primary);
    border-color: #fecdd3;
}

.invoice-preview {
    margin-top: 24px;
    padding: 34px;
    background: white;
    color: #111827;
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.invoice-preview-header {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    padding-bottom: 22px;
    border-bottom: 2px solid #f1f1f1;
}

.invoice-preview h2 {
    margin: 0 0 6px;
    font-size: 24px;
}

.invoice-preview-header strong {
    font-size: 20px;
    letter-spacing: 1px;
}

.invoice-preview-header > div:last-child {
    text-align: right;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.7;
}

.invoice-table {
    width: 100%;
    margin-top: 24px;
    border-collapse: collapse;
    font-size: 14px;
}

.invoice-table th {
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.invoice-table th,
.invoice-table td {
    padding: 12px 6px;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
}

.invoice-table th:not(:first-child),
.invoice-table td:not(:first-child) {
    text-align: right;
}

.invoice-total {
    width: min(100%, 280px);
    margin: 24px 0 0 auto;
}

.invoice-total div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 7px 0;
    font-size: 14px;
}

.invoice-total .grand-total {
    margin-top: 8px;
    padding-top: 14px;
    border-top: 2px solid #111827;
    font-size: 19px;
    font-weight: 800;
}

/* Mobile */

@media (max-width: 650px) {
    .tool-page {
        width: min(100% - 20px, 900px);
        padding-top: 20px;
    }

    .calculator-card {
        padding: 18px;
        border-radius: 18px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .item-row {
        grid-template-columns: minmax(0, 1fr) 65px 90px 40px;
    }

    .invoice-preview {
        padding: 22px 16px;
        border-radius: 18px;
    }

    .invoice-preview-header {
        flex-direction: column;
    }

    .invoice-preview-header > div:last-child {
        text-align: left;
    }

    .invoice-table {
        font-size: 12px;
    }

    .invoice-table th,
    .invoice-table td {
        padding: 9px 3px;
    }

    .invoice-total {
        width: 100%;
    }
}

/* Printing */

@media print {
    body {
        background: white !important;
    }

    .tool-page > *:not(.invoice-preview) {
        display: none !important;
    }

    .invoice-preview {
        display: block !important;
        margin: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
    }
}

.swap-button {
    width: 100%;
    margin-top: 16px;
}

.swap-button:hover {
    border-color: #fecdd3;
    color: var(--primary);
}

@media (min-width: 651px) {
    .swap-button {
        width: auto;
        min-width: 180px;
    }
}


/* Salary SEO content */
.content-section {
    margin-top: 32px;
}

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

.content-card h2 {
    margin: 0 0 16px;
}

.content-card h3 {
    margin: 28px 0 10px;
}

.content-card p {
    color: var(--muted);
    line-height: 1.75;
    margin: 0 0 14px;
}

.content-card details {
    border-top: 1px solid var(--border);
    padding: 16px 0;
}

.content-card details:last-child {
    border-bottom: 1px solid var(--border);
}

.content-card summary {
    cursor: pointer;
    font-weight: 700;
}

.content-card details p {
    margin-top: 10px;
}

@media (max-width: 640px) {
    .content-card {
        padding: 20px;
    }
}
