* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    background: #ffffff;
    color: #222222;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

[hidden] {
    display: none !important;
}

button,
input,
select {
    font: inherit;
}

.tool-container {
    max-width: 760px;
    padding: 20px;
    margin: 0;
}

.tool-header {
    margin-bottom: 32px;
}

.tool-header h1 {
    margin: 0 0 6px;
    font-size: 30px;
}

.tool-header p {
    margin: 0;
    color: #555555;
}

.calculator-section,
.results-section,
.info-section {
    border-top: 2px solid #222222;
    padding-top: 26px;
}

.results-section,
.info-section {
    margin-top: 42px;
}

h2 {
    margin: 0 0 20px;
    font-size: 20px;
    line-height: 1.25;
}

.subheading {
    margin-top: 34px;
}

.project-inputs {
    margin-top: 20px;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 18px;
}

.field {
    min-width: 0;
}

.field label {
    display: block;
    margin-bottom: 7px;
    font-weight: 700;
    line-height: 1.35;
}

.field input,
.field select {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid #999999;
    border-radius: 5px;
    background: #ffffff;
    color: #222222;
}

.field input:focus,
.field select:focus {
    border-color: #222222;
    outline: 2px solid #222222;
    outline-offset: 1px;
}

.field-note,
.result-note {
    color: #555555;
    font-size: 0.93rem;
}

.field-note {
    margin: 12px 0 0;
}

.result-note {
    margin: 18px 0 0;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

button {
    min-height: 48px;
    padding: 10px 18px;
    border: 2px solid #222222;
    border-radius: 4px;
    background: #222222;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

button:hover {
    border-color: #444444;
    background: #444444;
}

button:focus-visible {
    outline: 3px solid #777777;
    outline-offset: 3px;
}

.clear-button {
    background: #ffffff;
    color: #222222;
}

.clear-button:hover {
    border-color: #222222;
    background: #eeeeee;
}

.error-message {
    min-height: 24px;
    margin-top: 14px;
    color: #a00000;
    font-weight: 700;
}

.results {
    border-top: 2px solid #222222;
    border-bottom: 2px solid #222222;
}

.result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    gap: 20px;
    padding: 10px 0;
    border-bottom: 1px solid #c7c7c7;
}

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

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

.total-row {
    font-size: 1.05rem;
}

.info-section h2 {
    margin-top: 32px;
}

.info-section h2:first-child {
    margin-top: 0;
}

.info-section p {
    margin: 0 0 18px;
}

.formula {
    margin: 20px 0 28px;
    padding: 15px 18px;
    border-left: 4px solid #222222;
    background: #f2f2f2;
    font-weight: 700;
}

@media (max-width: 620px) {
    .tool-container {
        padding: 14px;
    }

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

    .button-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .button-row button {
        width: 100%;
    }
}

@media (max-width: 440px) {
    .result-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .result-row strong {
        max-width: 100%;
        text-align: left;
    }
}