:root {
    --primary-color: #0b66ff;
    --primary-dark-color: #004dcc;
    --secondary-color: #6c757d;
    --negative-color: #ff0b0b;
    --text-color: #2c3e50;
    --background-color: #eef1f6;
    --card-background: #ffffff;
    --border-color: #dbe3ed;
    --shadow-color-light: rgba(26, 54, 98, 0.04);
    --shadow-color-medium: rgba(26, 54, 98, 0.08);
    --muted-text-color: #7f8c8d;
    --header-bg-color: #f5f8fa;
    --input-bg-color: #fcfdfe;

    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
}

body {
    margin: 0 auto;
    padding: 24px;
    background: var(--background-color);
    max-width: 1280px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--text-color);
}

#logo {
    margin: 0 auto 20px auto;
    display: flex;
    justify-content: center;
    height: 100px;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 28px;
    color: var(--text-color);
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 20px;
    color: var(--text-color);
    letter-spacing: -0.01em;
}

h3 {
    margin: 32px 0 16px 0;
}

.text-info {
    font-size: 0.75rem;
}

.card {
    background: var(--card-background);
    border-radius: 14px;
    padding: 28px;
    margin: 20px 0;
    box-shadow: 0 10px 30px var(--shadow-color-medium), 0 2px 8px var(--shadow-color-light);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px var(--shadow-color-medium), 0 4px 10px var(--shadow-color-light);
}

label {
    display: block;
    margin: 14px 0 8px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-color);
}

input[type="number"],
select,
input[type="month"],
input[type="text"],
input[type="date"] {
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-sizing: border-box;
    font-size: 1rem;
    color: var(--text-color);
    background-color: var(--input-bg-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

input[type="number"]:focus,
select:focus,
input[type="month"]:focus,
input[type="text"]:focus,
input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(11, 102, 255, 0.2);
    background-color: var(--card-background);
}

.grid, .grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.row {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin: 8px 0 0 0;
    padding: 0;
    justify-content: start;
    align-items: center;
}

.row label {
    margin: 0;
    padding: 0;
    font-size: 0.75rem;
}

.row.between, .row div {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 24px 0 0 0;
    justify-content: space-between;
}

button {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 16px 24px;
    border-radius: 10px;
    cursor: pointer;
    width: 100%;
    font-size: 1.05rem;
    font-weight: 600;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(11, 102, 255, 0.2);
}

button:hover {
    background: var(--primary-dark-color);
    box-shadow: 0 6px 20px rgba(11, 102, 255, 0.3);
    transform: translateY(-1px);
}

button:active {
    background: var(--primary-dark-color);
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(11, 102, 255, 0.2);
}

button.secondary {
    background: var(--secondary-color);
    box-shadow: 0 4px 10px rgba(108, 117, 125, 0.2);
}

button.secondary:hover {
    background: #5a6268;
    box-shadow: 0 6px 15px rgba(108, 117, 125, 0.3);
}

#csvBtn {
    background: #17a2b8;
}

#printBtn {
    background: #28a745;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 24px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 25px var(--shadow-color-medium), 0 1px 4px var(--shadow-color-light);
}

th,
td {
    border: none;
    padding: 14px 20px;
    text-align: center;
}

th {
    background: var(--header-bg-color);
    font-weight: 600;
    color: var(--text-color);
    position: sticky;
    top: 0;
    z-index: 1;
    font-size: 0.95rem;
}

th:first-child { border-top-left-radius: 14px; }
th:last-child { border-top-right-radius: 14px; }

tr:last-child td:first-child { border-bottom-left-radius: 14px; }
tr:last-child td:last-child { border-bottom-right-radius: 14px; }

td {
    background: var(--card-background);
    border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
    border-bottom: none;
}

tr:nth-child(even) td {
    background-color: #fcfdfe;
}

.muted {
    color: var(--muted-text-color);
    font-size: 0.88rem;
}

.small {
    font-size: 0.8rem;
}

.inline {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.output {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.2rem;
    letter-spacing: -0.01em;
}

.output.negative {
    color: var(--negative-color);
}

.export {
    margin-left: auto;
    align-self: flex-start;
}

.print-formatted-value {
    display: none;
}

@media (min-width: 600px) {
    body {
        padding: 40px;
    }

    h1 {
        font-size: 2rem;
    }

    .grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    button {
        width: auto;
    }

    .row.between, .row div {
        flex-direction: row;
    }

    .export {
        margin-left: auto;
    }

    .controls {
        justify-content: flex-end;
    }
}

@media (min-width: 900px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.flex-grow { flex-grow: 1; }

::placeholder {
    color: var(--muted-text-color);
    opacity: 0.8;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-dark-color);
    text-decoration: underline;
}

@media print {
    body {
        background-color: #fff;
        padding: 0;
        margin: 0;
        max-width: 100%;
        font-size: 12pt;
        color: #000;
    }

    button, .row.between
    {
        display: none;
    }

    #results {
        display: block;
    }

    #logo {
        margin: 0 auto;
        height: 50px;
    }

    h1, h2, h3, .muted, label, .output, .output.negative {
        color: #000;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    h1 {
        display: none;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1rem;
    }

    .card {
        border: none;
        box-shadow: none;
        padding: 0;
        border-radius: 0;
        page-break-inside: avoid;
        background-color: transparent;
    }

    label {
        font-weight: 600;
        margin: 0 0 5px 0;
    }

    input {
        padding: 0 !important;
        margin: 0 !important;
        display: block;
        border: none !important;
        background-color: transparent !important;
        -webkit-appearance: none !important;
        appearance: none !important;
    }

    .grid, .grid-2 {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
        margin: 0;
    }

    .output, .output.negative {
        font-size: 1rem;
        font-weight: 700;
    }

    .muted {
        font-size: 10pt;
    }

    table {
        border: 1px solid #ccc;
        box-shadow: none;
        margin-top: 20px;
        border-radius: 0;
        page-break-inside: avoid;
    }

    th, td {
        border: 1px solid #eee;
        padding: 10px 15px;
        font-size: 10pt;
        text-align: left;
    }

    th {
        background: #f0f0f0;
        color: #000;
        font-weight: 700;
        position: static;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    tr:last-child td {
        border-bottom: 1px solid #eee;
    }

    div {
        margin: 0;
        padding: 0;
    }

    #proposalArea {
        margin-top: 12px;
    }

    .print-none {
        display: none;
    }

    .print-formatted-value {
        display: flex;
    }
}