@layer base {
    *, *::before, *::after {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }
    .clearfix::before {
        content: '';
        display: table;
    }
    .clearfix::after {
        display: block;
        clear: both;
        content: '';
    }
    /* ── DIALOG ── */
    dialog {
        border: none;
        & .modal {
            position: fixed;
            top: 70px;
            color: var(--ink);
            right: 2rem;
            left: auto;
        }
        &::backdrop {
            background-color: var(--backdrop);
            backdrop-filter: blur(4px);
        }
    }

    /* ── MODAL OVERLAY ── */
    .modal {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 14px;
        padding: 1.75rem;
        width: 100%;
        max-width: 320px;
        position: relative;
        animation: modal-in 0.18s ease;
        & .modal-close {
            position: absolute;
            top: 0.75rem;
            right: 0.875rem;
            background: none;
            border: none;
            color: var(--ink);
            font-size: 1.25rem;
            cursor: pointer;
            line-height: 1;
            padding: 0.25rem;
            transition: color 0.2s;
            &:hover {
                color: var(--ink-mid);
            }
        }
        & .modal-title {
            font-family: var(--font-sans-accent);
            font-size: 1rem;
            font-weight: 500;
            margin-bottom: 1.25rem;
        }
        & .field {
            display: flex;
            flex-direction: column;
            gap: 0.4rem;
            margin-bottom: 0.875rem;
            & label {
                font-size: 0.75rem;
                letter-spacing: 0.04em;
            }
            & input {
                background: var(--bg);
                border: 1px solid var(--border);
                border-radius: 7px;
                padding: 0.55rem 0.75rem;
                font-size: 0.9375rem;
                font-family: inherit;
                outline: none;
                transition: border-color 0.2s;
                width: 100%;
                &::placeholder {
                    color: var(--ink-soft);
                }
                &:focus {
                    border-color: var(--accent);
                }
            }
        }
        & .modal-remember {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 1.25rem;
            font-size: 0.8125rem;
            color: var(--ink-mid);
            cursor: pointer;
            user-select: none;
            & input[type=checkbox] {
                width: 15px;
                height: 15px;
                accent-color: var(--accent);
                cursor: pointer;
                flex-shrink: 0;
            }
        }
        & .modal-actions {
            display: flex;
            flex-direction: column;
            gap: 0.625rem;
            & .btn-submit {
                width: 100%;
                background: var(--accent);
                color: #fff;
                border: none;
                border-radius: 7px;
                padding: 0.65rem;
                font-size: 0.9375rem;
                font-family: inherit;
                font-weight: 500;
                cursor: pointer;
                transition: background 0.2s;
                &:hover {
                    background: var(--accent-dark);
                }
            }
        }
        & .modal-forgot {
            text-align: center;
            font-size: 0.8rem;
            color: var(--ink-mid);
            text-decoration: none;
            transition: color 0.2s;
            &:hover {
                color: var(--ink-soft);
            }
        }
    }

}
@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }
    to   {
        opacity: 1;
        transform: translateY(0);
    }
}
