.homepage-calculator--grades {
    max-width: 620px;
    margin: 0 auto;
}

/* Поля */

.grades-grid,
.grades-thresholds {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.grades-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grades-thresholds {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grades-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.grades-field label {
    font-size: 14px;
    font-weight: 600;
    color: #555;
}

.grades-field .form-control {
    transition: all 0.2s ease-in-out;
}

.grades-field .form-control:focus {
    border-color: #5f6af5;
    box-shadow: 0 0 0 3px rgba(95, 106, 245, 0.12);
}

/* Подсказки */

.grades-hint {
    font-size: 13px;
    color: #777;
}

.grades-textarea {
    min-height: 110px;
    resize: vertical;
}

/* Кнопки */

.grades-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.grades-actions--between {
    justify-content: space-between;
}

.calculator-submit,
.calculator-reset {
    min-height: 42px;
    padding: 0 18px;
    border-radius: 5px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.calculator-submit {
    border: 1px solid #2bbb93;
    background-color: #2bbb93;
    color: #fff;
}

.calculator-submit:hover {
    border-color: #25a984;
    background-color: #25a984;
    color: #fff;
}

.calculator-submit:focus,
.calculator-reset:focus {
    outline: none;
    box-shadow: none;
}

.calculator-reset {
    border: 1px solid rgba(95, 106, 245, 0.15);
    background-color: rgba(95, 106, 245, 0.08);
    color: #5f6af5;
}

.calculator-reset:hover {
    border-color: #5f6af5;
    background-color: #5f6af5;
    color: #fff;
}

/* Результат */

.grades-result {
    margin-top: 18px;
    padding: 16px;
    border-radius: 5px;
    border: 1px solid #eee;
    background-color: #fff;
    color: #555;
    font-size: 15px;
    line-height: 1.6;
}

.grades-result strong {
    color: #484d68;
}

.grades-result.is-success {
    border-color: rgba(43, 187, 147, 0.25);
    background-color: rgba(43, 187, 147, 0.08);
    color: #21896e;
}

.grades-result.is-success strong {
    color: #21896e;
}

.grades-result.is-warning {
    border-color: rgba(255, 193, 7, 0.3);
    background-color: rgba(255, 193, 7, 0.1);
    color: #8a6d1d;
}

.grades-result.is-warning strong {
    color: #8a6d1d;
}

.grades-result.is-error {
    border-color: rgba(255, 79, 127, 0.25);
    background-color: rgba(255, 79, 127, 0.08);
    color: #d93666;
}

.grades-result.is-error strong {
    color: #d93666;
}

/* Для будущего калькулятора взвешенной оценки */

.grades-weighted-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.grades-weighted-row {
    display: grid;
    grid-template-columns: 1fr 1fr 44px;
    gap: 12px;
    align-items: end;
}

.grades-row-remove {
    width: 44px;
    height: 42px;
    border: 1px solid #ff4f7f;
    border-radius: 5px;
    background-color: #ff4f7f;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.grades-row-remove:hover {
    background-color: #fff;
    color: #ff4f7f;
    border-color: #ff4f7f;
}

.grades-row-remove:focus {
    outline: none;
    box-shadow: none;
}

/* Адаптив */

@media (max-width: 767px) {
    .homepage-calculator--grades {
        max-width: 100%;
    }

    .grades-grid,
    .grades-thresholds,
    .grades-weighted-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .calculator-submit,
    .calculator-reset {
        width: 100%;
    }

    .grades-actions--between {
        justify-content: flex-start;
    }

    .grades-row-remove {
        width: 100%;
    }
}

@media (max-width: 420px) {
    .grades-grid,
    .grades-thresholds {
        gap: 10px;
    }

    .calculator-submit,
    .calculator-reset {
        min-height: 40px;
        font-size: 13px;
        padding: 0 14px;
    }

    .grades-result {
        font-size: 14px;
        padding: 14px;
    }
}

.grades-entry {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

.grades-quick-buttons {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.grades-quick-button {
    min-height: 48px;
    border: 1px solid rgba(95, 106, 245, 0.15);
    border-radius: 5px;
    background-color: rgba(95, 106, 245, 0.08);
    color: #5f6af5;
    font-family: inherit;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.grades-quick-button:hover {
    background-color: #5f6af5;
    border-color: #5f6af5;
    color: #fff;
}

.grades-quick-button:focus {
    outline: none;
    box-shadow: none;
}

.grades-selected {
    margin-top: 18px;
    padding: 14px;
    border: 1px solid #eee;
    border-radius: 5px;
    background-color: #fff;
}

.grades-selected-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
    color: #555;
    font-size: 14px;
    font-weight: 600;
}

.grades-clear-list {
    border: 0;
    background: transparent;
    color: #ff4f7f;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.grades-clear-list:hover {
    color: #d93666;
}

.grades-clear-list:focus {
    outline: none;
    box-shadow: none;
}

.grades-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 34px;
}

.grades-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 10px 0 12px;
    border: 1px solid rgba(43, 187, 147, 0.25);
    border-radius: 5px;
    background-color: rgba(43, 187, 147, 0.08);
    color: #21896e;
    font-size: 14px;
    font-weight: 700;
}

.grades-tag-remove {
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 50%;
    background-color: rgba(255, 79, 127, 0.12);
    color: #ff4f7f;
    font-size: 16px;
    line-height: 18px;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease-in-out;
}

.grades-tag-remove:hover {
    background-color: #ff4f7f;
    color: #fff;
}

.grades-tag-remove:focus {
    outline: none;
    box-shadow: none;
}

.grades-empty {
    color: #777;
    font-size: 14px;
}

@media (max-width: 767px) {
    .grades-entry {
        grid-template-columns: 1fr;
    }

    .grades-quick-buttons {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
    }

    .grades-selected-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 420px) {
    .grades-quick-button {
        min-height: 44px;
        font-size: 16px;
    }

    .grades-tag {
        min-height: 32px;
        font-size: 13px;
    }
}

.weighted-grade-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.weighted-grade-row {
    display: grid;
    grid-template-columns: 1.4fr 0.7fr 0.7fr 44px;
    gap: 12px;
    align-items: end;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 5px;
    background-color: #fff;
}

.weighted-grade-hint {
    margin-top: 12px;
}

.weighted-grade-main-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

@media (max-width: 767px) {
    .weighted-grade-row {
        grid-template-columns: 1fr;
    }

    .weighted-grade-main-actions {
        width: 100%;
    }

    .weighted-grade-main-actions .calculator-submit,
    .weighted-grade-main-actions .calculator-reset {
        width: 100%;
    }
}

.needed-grade-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.needed-grade-button {
    min-height: 46px;
    border: 1px solid rgba(95, 106, 245, 0.15);
    border-radius: 5px;
    background-color: rgba(95, 106, 245, 0.08);
    color: #5f6af5;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.needed-grade-button:hover {
    background-color: #5f6af5;
    border-color: #5f6af5;
    color: #fff;
}

.needed-grade-button.is-active {
    background-color: #5f6af5;
    border-color: #5f6af5;
    color: #fff;
}

.needed-grade-button:focus {
    outline: none;
    box-shadow: none;
}

.needed-grade-scale {
    margin-top: 18px;
    padding: 14px;
    border: 1px solid #eee;
    border-radius: 5px;
    background-color: #fff;
}

.needed-grade-scale-title {
    margin-bottom: 12px;
    color: #555;
    font-size: 14px;
    font-weight: 700;
}

@media (max-width: 420px) {
    .needed-grade-buttons {
        gap: 8px;
    }

    .needed-grade-button {
        min-height: 42px;
        font-size: 14px;
    }
}