* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: #f2f3f5;
    color: #222;
}

.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 12px;
}

/* Шапка */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.header h1 {
    margin: 0;
    font-size: 22px;
}

.settings-button {
    border: none;
    background: white;
    border-radius: 10px;
    font-size: 22px;
    width: 44px;
    height: 44px;
    cursor: pointer;
}

/* Карточки */

.card,
.result-card {
    background: white;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.card h2 {
    margin: 0 0 16px;
    font-size: 18px;
}

/* Результат */

.result-card {
    text-align: center;
    border: 3px solid #2e9d4d;

    position: sticky;
    top: 8px;
    z-index: 100;

    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}

.result-status {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
}

.result-title {
    font-size: 13px;
    color: #666;
    font-weight: 600;
}

.result-price {
    font-size: 42px;
    font-weight: 800;
    margin: 4px 0 16px;
}

.result-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.result-details div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.result-details span {
    font-size: 13px;
    color: #777;
}

.result-details strong {
    font-size: 17px;
}

/* Поля */

.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
    font-weight: 600;
}

input,
textarea {
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 13px;
    font-size: 17px;
    background: white;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #555;
}

textarea {
    resize: vertical;
}

/* Поле с валютой */

.input-with-unit {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-with-unit input {
    flex: 1;
}

.input-with-unit span {
    font-size: 17px;
    font-weight: 600;
}

/* Кнопки выбора */

.button-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.choice-button {
    min-height: 46px;
    border: 1px solid #ccc;
    border-radius: 10px;
    background: white;
    padding: 8px;
    font-size: 15px;
    cursor: pointer;
}

.choice-button:hover {
    background: #f5f5f5;
}

.choice-button.active {
    border: 2px solid #222;
    background: #e9e9e9;
    font-weight: 700;
}

/* Добавить расход */

.add-expense-button {
    width: 100%;
    min-height: 46px;
    border: 1px dashed #999;
    border-radius: 10px;
    background: white;
    font-size: 15px;
    cursor: pointer;
}

/* Итог расходов */

.total-expenses {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #ddd;
}

.total-expenses span {
    color: #666;
}

.total-expenses strong {
    font-size: 18px;
}

/* Мобильный экран */

@media (max-width: 400px) {

    .container {
        padding: 8px;
    }

    .card,
    .result-card {
        padding: 14px;
    }

    .result-price {
        font-size: 36px;
    }

    .choice-button {
        font-size: 14px;
    }
}
/* Дополнительные расходы */

.expense-row {
    display: grid;
    grid-template-columns: 1fr 100px 42px;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.expense-row input {
    width: 100%;
}

.remove-expense-button {
    width: 42px;
    height: 46px;
    border: 1px solid #ccc;
    border-radius: 10px;
    background: white;
    font-size: 18px;
    cursor: pointer;
}

.remove-expense-button:hover {
    background: #f5f5f5;
}

@media (max-width: 400px) {

    .expense-row {
        grid-template-columns: 1fr 85px 42px;
    }

}
/* ==========================================
   ЦВЕТА РЕЗУЛЬТАТА
   ========================================== */

.result-green {
    border-color: #2e9d4d;
}

.result-yellow {
    border-color: #e0a800;
}

.result-red {
    border-color: #d93025;
}
/* ==========================================
   ОКНО НАСТРОЕК
   ========================================== */

.settings-overlay {
    display: none;

    position: fixed;
    inset: 0;

    background: rgba(0, 0, 0, 0.45);

    z-index: 1000;

    padding: 12px;

    align-items: center;
    justify-content: center;
}


.settings-overlay.open {
    display: flex;
}


.settings-modal {
    width: 100%;
    max-width: 500px;

    max-height: 90vh;
    overflow-y: auto;

    background: white;

    border-radius: 16px;

    padding: 20px;

    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.25);
}


.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 20px;
}


.settings-header h2 {
    margin: 0;

    font-size: 20px;
}


.settings-close {
    width: 42px;
    height: 42px;

    border: none;
    border-radius: 10px;

    background: #f2f2f2;

    font-size: 28px;
    line-height: 1;

    cursor: pointer;
}


.save-settings-button {
    width: 100%;

    min-height: 50px;

    border: none;
    border-radius: 10px;

    background: #222;
    color: white;

    font-size: 17px;
    font-weight: 600;

    cursor: pointer;

    margin-top: 5px;
}


.save-settings-button:hover {
    background: #444;
}