:root {
    /* Приглушённая сине-серая палитра (blue gray / glaucous / faded denim) */
    --accent: #5b7fa6;
    --accent-dark: #435d7d;
    --accent-light: #e8edf5;
    --bg: #f4f6fa;
    --card: #ffffff;
    --text: #232b3d;
    --muted: #71829c;
    --border: #dde3ed;
    --radius: 20px;
    --shadow: 0 16px 40px rgba(35, 43, 61, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
}

a {
    color: inherit;
}

/* --- Страница --- */

.page {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

.page--centered {
    padding: 20px;
}

.page[hidden] {
    display: none;
}

.hero-decor {
    position: absolute;
    top: -120px;
    right: -120px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.16;
    filter: blur(10px);
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1000px;
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 56px;
    align-items: center;
}

/* --- Бренд --- */

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.brand--center {
    justify-content: center;
    margin-bottom: 18px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    flex-shrink: 0;
}

.brand-name {
    font-weight: 800;
    font-size: 17px;
}

/* --- Герой --- */

.hero h1 {
    margin: 0 0 10px;
    font-size: 32px;
    font-weight: 800;
    line-height: 1.15;
}

.hero-text {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.55;
    max-width: 380px;
}

/* --- Карточка авторизации --- */

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 380px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.auth-card--status {
    max-width: 340px;
    text-align: center;
}

.auth-card--profile {
    max-width: 400px;
}

.step-title {
    margin: 0 0 4px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.auth-form select {
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text);
    font-family: inherit;
    background: #fff;
}

.auth-form select:focus {
    outline: none;
    border-color: var(--accent);
}

.auth-form select:disabled {
    color: var(--muted);
    background: var(--bg);
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 130px;
    overflow-y: auto;
    padding: 2px;
}

.chip {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 12px;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}

.chip--active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.chip-list--tall {
    max-height: 260px;
}

.btn-link {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px;
    border: none;
    background: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 12px;
    text-align: center;
    cursor: pointer;
    text-decoration: underline;
}

.form-notice {
    background: var(--accent-light);
    color: var(--accent-dark);
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 13px;
    margin: 14px 0 0;
}

/* --- Основной интерфейс (после онбординга): dashboard/calendar/profile --- */

.app-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.app-shell[hidden] {
    display: none;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 14px 20px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.app-topbar .brand {
    margin: 0 auto;
    max-width: 640px;
    margin-bottom: 0;
}

.app-content {
    flex: 1;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 20px 90px;
}

.app-view[hidden] {
    display: none;
}

.app-view-header {
    margin-bottom: 20px;
}

.app-view-header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
}

.stub-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    margin-bottom: 16px;
}

.stub-card h2 {
    margin: 0 0 6px;
    font-size: 15px;
}

.stub-empty {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.badge {
    display: inline-block;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg);
    color: var(--muted);
}

.badge--ok {
    background: var(--accent-light);
    color: var(--accent-dark);
}

#view-profile .btn-outline {
    margin-top: 16px;
}

/* --- Фільтр за країною/містом на вкладці "Всі події" --- */

.events-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.events-filter label {
    flex: 1;
    min-width: 130px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
}

.events-filter select {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text);
    font-family: inherit;
    background: #fff;
}

.events-filter select:focus {
    outline: none;
    border-color: var(--accent);
}

.events-filter select:disabled {
    color: var(--muted);
    background: var(--bg);
}

/* --- Перегляд зустрічі (детали + чат для paid-учасників) --- */

.stub-card--clickable {
    cursor: pointer;
}

.back-link {
    display: inline-block;
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
}

.meeting-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.meeting-actions .btn-primary,
.meeting-actions .btn-outline {
    width: auto;
    flex: 1;
    margin-top: 0;
}

.meeting-actions [hidden] {
    display: none;
}

.participants-list {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
}

.participants-list li {
    margin-bottom: 4px;
}

.chat-messages {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.chat-message {
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bg);
}

.chat-message--admin {
    background: var(--accent-light);
}

.chat-message-meta {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 4px;
}

.chat-message-body {
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-form textarea {
    flex: 1;
    resize: vertical;
    min-height: 44px;
    max-height: 140px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
}

.chat-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.chat-form .btn-primary {
    width: auto;
    margin-top: 0;
}

/* Навигация: снизу на мобильном (fixed), сверху на десктопе (обычный поток) —
   один и тот же markup, позиция меняется только медиа-запросом. */
.app-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px));
    z-index: 10;
}

.app-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 0;
    border: none;
    background: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 12px;
}

.app-nav-item--active {
    color: var(--accent-dark);
}

.app-nav-icon {
    display: inline-flex;
}

@media (min-width: 721px) {
    .app-nav {
        position: static;
        border-top: none;
        border-bottom: 1px solid var(--border);
        justify-content: center;
        gap: 8px;
        padding: 14px 20px;
    }

    .app-nav-item {
        flex: none;
        flex-direction: row;
        padding: 8px 18px;
        border-radius: 999px;
    }

    .app-nav-item--active {
        background: var(--accent-light);
    }

    .app-content {
        padding: 32px 20px 40px;
        max-width: 720px;
    }

    .app-topbar .brand {
        max-width: 720px;
    }
}

@media (max-width: 720px) {
    .chip-list--tall {
        max-height: 220px;
    }

    /* Крок 3 (інтереси) на мобільному — картка на весь екран, а не
       маленька плашка по центру: список інтересів займає всю вільну
       висоту між заголовком і кнопками. */
    #screen-interests.page {
        align-items: stretch;
        padding: 0;
    }

    #screen-interests .auth-card {
        max-width: none;
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh;
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
        padding: 20px;
    }

    #screen-interests .auth-form {
        flex: 1;
        min-height: 0;
    }

    #screen-interests .chip-list--tall {
        flex: 1;
        min-height: 0;
        max-height: none;
    }
}

.status-text {
    margin: 0 0 4px;
    font-size: 15px;
}

.status-sub {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 13px;
}

.tabs {
    display: flex;
    gap: 4px;
    background: var(--bg);
    border-radius: 999px;
    padding: 4px;
}

.tab {
    flex: 1;
    text-align: center;
    padding: 9px 0;
    border: none;
    border-radius: 999px;
    background: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    text-decoration: none;
    cursor: pointer;
}

.tab--active {
    background: var(--accent);
    color: #fff;
}

.form-error {
    background: #fdecea;
    color: #b3261e;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 13px;
    margin: 14px 0 0;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.auth-form[hidden] {
    display: none;
}

.auth-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
}

.auth-form input {
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text);
    font-family: inherit;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.muted-link {
    align-self: flex-end;
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
    margin-top: -2px;
}

.btn-primary,
.btn-outline {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 12px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary {
    border: none;
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-dark);
}

.btn-outline {
    border: 1.5px solid var(--accent);
    background: none;
    color: var(--accent-dark);
}

/* --- Мобильные экраны: всё должно уместиться на одном экране без скролла --- */

@media (max-width: 720px) {
    .hero-decor {
        display: none;
    }

    .container {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 380px;
    }

    .hero {
        text-align: center;
    }

    .hero h1 {
        font-size: 22px;
    }

    .hero-text {
        font-size: 13px;
        max-width: none;
    }

    .auth-card {
        max-width: none;
        padding: 18px 20px;
    }

    .auth-form {
        gap: 8px;
        margin-top: 12px;
    }

    .auth-form input,
    .auth-form select {
        padding: 9px 12px;
    }

    .chip-list {
        max-height: 96px;
    }

    .page {
        padding: 14px;
    }
}
