/* Модалка входа и регистрации (задача №38). Компонентные классы am-*:
   внешний вид правится здесь, в одном месте. */

.am-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.am-overlay {
    position: absolute;
    inset: 0;
    background: rgba(20, 30, 20, 0.55);
}

.am-panel {
    position: relative;
    background: #fff;
    border-radius: 16px;
    width: 440px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 28px;
    box-sizing: border-box;
    font-family: inherit;
    color: #1c1c1c;
}

.am-close {
    position: absolute;
    top: 10px;
    right: 14px;
    border: 0;
    background: none;
    font-size: 28px;
    line-height: 1;
    color: #8a8a8a;
    cursor: pointer;
    padding: 4px;
}

.am-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid #eef2ea;
}

.am-tab {
    border: 0;
    background: none;
    padding: 8px 4px;
    font-size: 17px;
    font-weight: 600;
    color: #8a8a8a;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.am-tab.is-active {
    color: #1c1c1c;
    border-bottom-color: #399918;
}

.am-title {
    font-size: 19px;
    font-weight: 700;
    margin: 0 0 10px;
}

.am-text {
    font-size: 14px;
    line-height: 1.45;
    color: #444;
    margin: 0 0 16px;
}

.am-field {
    display: block;
    margin-bottom: 14px;
}

.am-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.am-hint {
    display: block;
    font-size: 12.5px;
    font-weight: 400;
    color: #6b6b6b;
    margin-top: 6px;
}

.am-hint.is-warn {
    color: #b03a2e;
}

.am-badge {
    display: inline-block;
    background: #eef7e6;
    color: #2f7a12;
    border-radius: 20px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}

.am-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d5dcd0;
    border-radius: 10px;
    padding: 11px 12px;
    font-size: 15px;
    background: #fff;
    color: #1c1c1c;
}

.am-input:focus {
    outline: none;
    border-color: #399918;
    box-shadow: 0 0 0 3px rgba(57, 153, 24, 0.15);
}

.am-input[disabled] {
    background: #f2f2f2;
    color: #8a8a8a;
}

.am-btn {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: #399918;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    padding: 13px;
    cursor: pointer;
    margin-top: 6px;
}

.am-btn:hover {
    background: #2f7a12;
}

.am-btn[disabled] {
    background: #b9cdb0;
    cursor: default;
}

.am-btn-ghost {
    background: none;
    color: #b03a2e;
    margin-top: 8px;
}

.am-btn-ghost:hover {
    background: #fdf0ee;
}

.am-error {
    background: #fdf0ee;
    border: 1px solid #f0c6c0;
    color: #8f2d23;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    margin-bottom: 14px;
}

.am-error-btn {
    display: block;
    margin-top: 8px;
    border: 0;
    background: none;
    color: #2f7a12;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.am-link {
    color: #399918;
    font-size: 13.5px;
    text-decoration: none;
}

.am-link:hover {
    text-decoration: underline;
}

.am-link-btn {
    border: 0;
    background: none;
    color: #399918;
    font-size: 13.5px;
    cursor: pointer;
    padding: 0;
}

.am-link-btn[disabled] {
    color: #a9a9a9;
    cursor: default;
}

.am-row-right {
    text-align: right;
    margin: -4px 0 12px;
}

.am-row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
}

.am-code-row {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-bottom: 16px;
}

.am-code-cell {
    width: 48px;
    height: 56px;
    border: 1px solid #d5dcd0;
    border-radius: 10px;
    text-align: center;
    font-family: inherit;
    font-size: 22px;
    font-weight: 700;
    line-height: 54px;
    padding: 0;
    box-sizing: border-box;
}

.am-code-cell:focus {
    outline: none;
    border-color: #399918;
    box-shadow: 0 0 0 3px rgba(57, 153, 24, 0.15);
}

.am-toggle {
    display: flex;
    background: #f2f5ef;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 14px;
}

.am-toggle-item {
    flex: 1;
    cursor: pointer;
}

.am-toggle-item input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.am-toggle-item span {
    display: block;
    text-align: center;
    padding: 9px 4px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #6b6b6b;
}

.am-toggle-item input:checked + span {
    background: #fff;
    color: #1c1c1c;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.am-check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 13px;
    line-height: 1.4;
    color: #444;
    margin-bottom: 12px;
    cursor: pointer;
}

.am-check input {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    accent-color: #399918;
    flex: none;
}

.am-check a {
    color: #399918;
}

@media (max-width: 560px) {
    .am-modal {
        align-items: stretch;
    }

    .am-panel {
        width: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        padding: 22px 18px;
    }

    .am-code-cell {
        width: 42px;
        height: 50px;
        font-size: 20px;
        line-height: 48px;
    }
}
