:root {
    --bg-main: #030816;
    --bg-soft: #071024;
    --bg-card: rgba(15, 23, 42, 0.62);

    --border-soft: rgba(148, 163, 184, 0.16);
    --border-blue: rgba(96, 165, 250, 0.24);

    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --text-soft: #CBD5E1;

    --blue: #2563EB;
    --blue-light: #60A5FA;
    --violet: #5B21B6;
    --violet-light: #8B5CF6;

    --danger: #EF4444;

    --layout-max-width: 1120px;
    --layout-gutter: 24px;
}

body {
    font-family: 'EB Garamond', sans-serif;
    margin: 0;
    min-height: 100vh;
    background:
            radial-gradient(circle at 70% 20%, rgba(124, 58, 237, 0.18), transparent 32%),
            radial-gradient(circle at 25% 10%, rgba(37, 99, 235, 0.16), transparent 28%),
            linear-gradient(180deg, #030816 0%, #050A18 45%, #020617 100%);
    color: var(--text-main);
}

.layout-container {
    width: min(calc(100% - (var(--layout-gutter) * 2)), var(--layout-max-width));
    margin: 0 auto;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    min-height: 42px;
    padding: 0 14px;

    border-radius: 5px;
    font-size: 17px;
    font-weight: 400;
    line-height: 1;

    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;

    transition:
            transform 180ms ease,
            box-shadow 180ms ease,
            border-color 180ms ease,
            background 180ms ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
    background: linear-gradient(135deg, var(--blue), var(--violet));
    box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.12) inset,
            0 18px 42px rgba(37, 99, 235, 0.28),
            0 0 32px rgba(91, 33, 182, 0.24);
}

.btn-primary:hover {
    box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.18) inset,
            0 22px 52px rgba(37, 99, 235, 0.36),
            0 0 42px rgba(91, 33, 182, 0.34);
}

.btn-secondary {
    color: var(--text-soft);
    background: rgba(15, 23, 42, 0.46);
    border-color: var(--border-soft);
    backdrop-filter: blur(18px);
}

.btn-secondary:hover {
    color: white;
    border-color: var(--border-blue);
    background: rgba(15, 23, 42, 0.72);
}

.app-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(10px);
}

.app-modal.hidden {
    display: none;
}

.app-modal-dialog {
    width: min(100%, 440px);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 6px;
    background: rgba(7, 16, 36, 0.96);
    box-shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
}

.app-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 20px 0;
}

.app-modal-title {
    margin: 0;
    color: #f8f5ee;
    font-size: 22px;
    line-height: 1;
    font-weight: 400;
}

.app-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 5px;
    background: rgba(15, 23, 42, 0.48);
    color: rgba(203, 213, 225, 0.82);
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.app-modal-close:hover {
    border-color: rgba(96, 165, 250, 0.24);
    background: rgba(15, 23, 42, 0.72);
    color: #f8f5ee;
}

.app-modal-close:focus-visible {
    outline: none;
    border-color: rgba(96, 165, 250, 0.42);
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.24);
}

.app-modal-close span {
    font-size: 22px;
    line-height: 1;
}

.app-modal-body {
    display: grid;
    gap: 18px;
    padding: 20px;
}

.app-modal-stack {
    display: grid;
    gap: 8px;
}

.app-modal-copy {
    margin: 0;
    color: #f8f5ee;
    font-family: 'Roboto Flex', sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

.app-modal-copy.is-muted {
    color: rgba(203, 213, 225, 0.68);
}

.app-modal-field {
    display: grid;
    gap: 8px;
}

.app-modal-field-label {
    color: rgba(203, 213, 225, 0.82);
    font-family: 'Roboto Flex', sans-serif;
    font-size: 14px;
    line-height: 1;
}

.app-modal-field-input {
    min-width: 0;
    height: 44px;
    padding: 0 14px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 5px;
    background: rgba(7, 16, 36, 0.72);
    color: #f8f5ee;
    font-family: 'Roboto Flex', sans-serif;
    font-size: 15px;
}

.app-modal-field-input:focus {
    outline: none;
    border-color: rgba(96, 165, 250, 0.42);
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.24);
}

.app-modal-field-input::placeholder {
    color: rgba(148, 163, 184, 0.72);
}

.app-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.app-modal-actions .btn {
    min-width: 120px;
}

.app-modal-submit {
    width: 100%;
}

.app-modal-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.app-modal-tab {
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 5px;
    background: rgba(15, 23, 42, 0.48);
    color: rgba(203, 213, 225, 0.72);
    font-family: 'Roboto Flex', sans-serif;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.app-modal-tab:hover {
    color: #f8f5ee;
    border-color: rgba(96, 165, 250, 0.24);
    background: rgba(15, 23, 42, 0.72);
}

.app-modal-tab.is-active {
    color: #f8f5ee;
    border-color: rgba(255, 255, 255, 0.5);
    background: linear-gradient(135deg, var(--blue), var(--violet));
    box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.12) inset,
            0 18px 42px rgba(37, 99, 235, 0.28),
            0 0 32px rgba(91, 33, 182, 0.24);
}

.app-modal-form {
    display: grid;
    gap: 18px;
}

.app-modal-message {
    margin: 0;
    color: #f8f5ee;
    font-family: 'Roboto Flex', sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

@media (max-width: 640px) {
    :root {
        --layout-gutter: 12px;
    }

    .app-modal {
        padding: 12px;
    }

    .app-modal-head,
    .app-modal-body {
        padding-left: 16px;
        padding-right: 16px;
    }

    .app-modal-actions {
        flex-direction: column-reverse;
    }

    .app-modal-actions .btn {
        width: 100%;
    }
}
