
*, *:before, *:after {
    box-sizing: border-box;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

* {
    margin: 0;
    padding: 0;
    overflow-wrap: break-word;
    outline: none;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Roboto', sans-serif;
    overflow-y: auto;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    font-size: 14px;
    line-height: 20px;
    color: #333;
    background: #f7f7f7;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.05);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.1);
}

[hidden] {
    display: none !important;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

strong {
    font-weight: 500;
}

svg {
    fill: currentColor;
}

.icon {
    height: 1em;
    user-select: none;
}

.visually-hidden {
    position: absolute;
    width: 0;
    height: 0;
    border: none;
    overflow: hidden;
}

:root {
    --primary-color: #479cac;
    --darken-color: #3a8593;
}

.box {
    border-radius: 14px;
    border: solid 1px #ccc;
    background: white;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.014), 0 2px 5px rgba(0, 0, 0, 0.02), 0 4px 10px rgba(0, 0, 0, 0.025), 0 7px 18px rgba(0, 0, 0, 0.03), 0 13px 33px rgba(0, 0, 0, 0.036), 0 30px 80px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;

    .body {
        padding: 24px 24px;
        overflow-y: auto;
        flex-grow: 1;
        flex-shrink: 0;

        h1 {
            margin-bottom: 16px;
            font-size: 20px;
            line-height: 26px;
        }
    }

    .footer {
        background: #f5f5f5;
        border-top: solid 1px #ddd;
        padding: 18px;
        flex-grow: 0;
        flex-shrink: 0;
    }

    &[popover] {
        display: none;
    }

    &[popover]:open {
        display: flex;
    }

    &[popover]:popover-open {
        display: flex;
    }
}

.button {
    background: var(--primary-color);
    text-decoration: none !important;
    color: white;
    display: block;
    width: 100%;
    border-radius: 6px;
    padding: 10px 24px;
    font-size: 16px;
    font-weight: 500;
    line-height: 24px;
    text-align: center;
    border: solid 1px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background-color 0.2s ease;
    user-select: none;

    &:hover, &:focus {
        background: var(--darken-color);
        color: white;
    }
}

hr {
    border: none;
    height: 1px;
    background: #eee;
    margin: 24px -24px;
}

h1 {
    font-weight: 500;
    font-size: 22px;
    line-height: 30px;
    margin-bottom: 10px;
}

h2 {
    font-weight: 500;
    font-size: 18px;
    line-height: 24px;
    margin-bottom: 10px;
}

section {
    scroll-margin-top: 30px;
}

p, ul {
    margin: 10px 0;
    font-size: 14px;
    line-height: 26px;

    &.error {
        color: #f00;
        font-weight: 500;
        font-size: 16px;
    }

    li {
        margin: 0 0 0 20px;
        padding-left: 5px;
    }

    li:has(.icon) {
        display: block;
        padding: 0;
        margin: 0 0 5px;

        .icon {
            font-size: 24px;
            margin-right: 6px;
            color: #666;
            vertical-align: top;
            line-height: inherit;
        }
    }
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;

    &:hover, &:focus {
        color: var(--darken-color);
    }
}

.auth {
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;

    form {
        min-width: 300px;
        max-width: 400px;
        text-align: center;
        margin: 16px;

        .logo {
            max-width: 70%;
            max-height: 50px;
            height: auto;
            margin: 40px auto 20px;
            user-select: none;
        }

        .body {
            input {
                display: block;
                border: solid 1px #bbb;
                border-radius: 6px;
                padding: 10px;
                margin-top: 30px;
                width: 100%;
                font-size: 20px;
                font-weight: 500;
                letter-spacing: 2px;
                line-height: 20px;
                text-align: center;
                color: #333;
                text-transform: uppercase;
            }
        }
    }
}

.warning {
    color: darkorange;
    font-weight: 500;
}

.portal {
    .header {
        width: 100%;
        display: flex;
        align-items: center;
        user-select: none;

        .navigation {
            padding: 16px;
            flex-shrink: 0;
            border: none;
            text-decoration: none !important;
            border-right: solid 1px #ddd;
            align-self: stretch;
            display: flex;
            align-items: center;
            cursor: pointer;
            font-size: 24px;
            color: #aaa;

            &:hover, &:focus {
                color: #333;
            }
        }

        .title {
            padding: 16px 20px;
            display: flex;
            flex-direction: column;
            white-space: nowrap;
            flex-shrink: 1;
            overflow: hidden;
            text-overflow: ellipsis;

            h1 {
                font-size: 18px;
                font-weight: 500;
                line-height: 24px;
                margin: 0 0 2px;
                color: #333;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            small {
                font-size: 14px;
                line-height: 20px;
                color: #666;
                overflow: hidden;
                text-overflow: ellipsis;
            }
        }

        .space {
            flex-grow: 1;
        }

        .user {
            flex-shrink: 0;
            padding: 10px 20px;

            .avatar {
                border: none;
                background: #eee;
                color: #333;
                font-size: 16px;
                font-weight: 500;
                width: 42px;
                height: 42px;
                border-radius: 50%;
                margin: 0;
                text-align: center;
                display: flex;
                align-items: center;
                justify-content: center;
                cursor: pointer;
            }

            .user-popover {
                position: absolute;
                left: auto;
                bottom: auto;
                top: 70px;
                right: 20px;
                z-index: 1000;
                text-align: left;
                min-width: 280px;
                border-color: #999;

                &::backdrop {
                    background: rgba(0, 0, 0, 0.2);
                }

                .body {
                    text-align: center;
                    font-size: 16px;
                    line-height: 24px;
                }
            }
        }
    }

    .main {
        padding: 50px 30px;
        max-width: 1420px;
        margin: 0 auto;

        .logo {
            max-width: 80%;
            max-height: 40px;
            width: auto;
            margin: 0 0 60px;
            user-select: none;

            @media (max-width: 960px) {
                margin-left: auto;
                margin-right: auto;
            }
        }

        .grid {
            margin: 30px auto 60px;
            display: flex;
            flex-wrap: wrap;
            gap: 20px;

            .box {
                width: 440px;

                @media (max-width: 960px) {
                    width: 100%;
                }
            }
        }
    }

    form {
        margin: 30px auto 60px;

        .box {
            width: 700px;

            @media (max-width: 960px) {
                width: 100%;
            }
        }

        input[type=text], input[type=tel], input[type=email], select, textarea {
            background: white;
            display: block;
            border: solid 1px #bbb;
            border-radius: 6px;
            padding: 10px 14px;
            margin-top: 15px;
            margin-bottom: 15px;
            width: 100%;
            font-size: 16px;
            font-weight: 400;
            line-height: 24px;
            color: #333;
            resize: none;
            font-family: 'Roboto', sans-serif;

            &:hover {
                border-color: #888;
            }

            &:focus {
                border-color: var(--darken-color);
            }

            &:user-invalid {
                border-color: #f00;
            }
        }

        textarea {
            height: 300px;
            overflow-y: scroll;
        }

        input[type=checkbox] {
            margin-right: 10px;
        }

        label:has(input[type=checkbox]) {
            font-weight: inherit;
            font-size: inherit;
            line-height: inherit;
            color: inherit;
            display: contents;
        }

        .error {
            margin: 0;
        }
    }


    .center {
        margin: 0 24px;

        @media (max-width: 960px) {
            margin: 0 auto;
            text-align: center;
        }
    }
}
