@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --bg-main: #12091f;
    --bg-soft: #1b1030;
    --bg-card: #24153f;
    --bg-card-hover: #2b1950;
    --border: #4b2f7e;
    --text-main: #f4ecff;
    --text-muted: #bcabd9;
    --accent: #8f5bff;
    --accent-strong: #a572ff;
    --success: #37d59c;
    --error: #ff6f91;
    --shadow: 0 14px 36px rgba(7, 2, 16, 0.55);
    color-scheme: dark;
    --font-main: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.45;
    background:
        radial-gradient(circle at 8% -10%, rgba(143, 91, 255, 0.23), transparent 46%),
        radial-gradient(circle at 92% 0%, rgba(82, 26, 168, 0.3), transparent 38%),
        var(--bg-main);
    color: var(--text-main);
    animation: pageFadeIn 0.35s ease;
}

.page {
    max-width: 1480px;
    margin: 0 auto;
    padding: 28px 32px 40px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 36px;
}

.logo {
    font-size: 42px;
    font-weight: 800;
    color: var(--accent-strong);
    line-height: 1;
    letter-spacing: 1px;
}

.nav {
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
}

.nav a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 20px;
    font-weight: 500;
    line-height: 1;
    transition: color 0.2s ease;
}

.nav a:hover,
.nav a.active {
    color: var(--text-main);
}

.flash {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.success {
    background: rgba(55, 213, 156, 0.16);
    border: 1px solid rgba(55, 213, 156, 0.44);
    color: #b9ffe6;
}

.error {
    background: rgba(255, 111, 145, 0.14);
    border: 1px solid rgba(255, 111, 145, 0.42);
    color: #ffd5df;
}

.card {
    background: linear-gradient(180deg, rgba(43, 25, 80, 0.78), rgba(31, 18, 58, 0.9));
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(7, 2, 16, 0.62);
}

.btn {
    display: inline-block;
    padding: 12px 18px;
    border-radius: 12px;
    border: 1px solid #7247c5;
    background: linear-gradient(135deg, var(--accent), #6a45bf);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    transition: transform 0.2s ease, filter 0.2s ease;
}

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

.btn.secondary {
    background: #3e2a64;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #5a3a92;
    border-radius: 12px;
    box-sizing: border-box;
    font-size: 15px;
    color: var(--text-main);
    background: rgba(20, 12, 36, 0.72);
}

select.form-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 42px;
    min-height: 44px;
    line-height: 1.35;
    cursor: pointer;
    background-color: rgba(20, 12, 36, 0.72);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23d9c7ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
}

select.form-input:focus {
    outline: none;
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 1px rgba(165, 114, 255, 0.35);
}

select.form-input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

select.form-input option,
select.form-input optgroup {
    background-color: var(--bg-soft);
    color: var(--text-main);
}

input[type="datetime-local"].form-input,
input[type="date"].form-input,
input[type="time"].form-input,
input[type="month"].form-input,
input[type="week"].form-input {
    color-scheme: dark;
    min-height: 44px;
    line-height: 1.35;
}

input[type="number"].form-input {
    min-height: 46px;
    line-height: 1.35;
}

input[type="datetime-local"].form-input::-webkit-calendar-picker-indicator,
input[type="date"].form-input::-webkit-calendar-picker-indicator,
input[type="month"].form-input::-webkit-calendar-picker-indicator,
input[type="week"].form-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.95;
    filter: invert(1) brightness(1.35) saturate(0.3);
}

input[type="time"].form-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.95;
    filter: invert(1) brightness(1.35) saturate(0.3);
}

.form-input:focus-visible {
    outline: none;
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 1px rgba(165, 114, 255, 0.35);
}

.form-group {
    margin-bottom: 18px;
}

label.form-check {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0;
    padding-left: 34px;
    min-height: 28px;
    position: relative;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    user-select: none;
}

.form-check-input {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.form-check-input:disabled {
    cursor: not-allowed;
}

.form-check-input:disabled + .form-check-box {
    opacity: 0.5;
}

.form-check-box {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 7px;
    border: 2px solid #5a3a92;
    background: rgba(20, 12, 36, 0.92);
    box-sizing: border-box;
    pointer-events: none;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.form-check-input:focus-visible + .form-check-box {
    outline: none;
    box-shadow: 0 0 0 2px rgba(165, 114, 255, 0.45);
    border-color: var(--accent-strong);
}

.form-check-input:checked + .form-check-box {
    background: linear-gradient(135deg, var(--accent), #6a45bf);
    border-color: var(--accent-strong);
}

.form-check-input:checked + .form-check-box::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.form-check-text {
    line-height: 1.35;
    color: var(--text-muted);
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-muted);
}

.grid-two {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 28px;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 22px;
}

.muted {
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 15px;
}

.center-card {
    width: min(92vw, 860px);
    margin: 40px auto;
    padding: 40px 44px;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.center-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-title {
    margin: 0 0 20px;
    font-size: 30px;
}

.auth-text {
    font-size: 16px;
    line-height: 1.5;
    margin: 0 0 24px;
    color: var(--text-muted);
}

.qr-box {
    background: #fff;
    display: inline-block;
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 20px;
}

.link {
    color: #d9c7ff;
    word-break: break-all;
}

.auth-form .form-group {
    margin-bottom: 18px;
}

.auth-page .auth-title {
    font-size: 34px;
    margin-bottom: 24px;
}

.auth-page .btn {
    padding: 14px 18px;
    font-size: 16px;
}

.settings-page {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: calc(100vh - 200px);
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    width: 100%;
    max-width: 960px;
    align-items: stretch;
}

.settings-grid--club-centered {
    max-width: 920px;
    margin: 0 auto;
    align-items: start;
}

.settings-card--sync {
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
    min-height: 0;
}

.settings-card--sync .stack {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-card--sync .stack .btn {
    width: 100%;
    justify-content: center;
}

.settings-card {
    padding: 28px;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    height: auto;
    box-sizing: border-box;
}

.settings-card .stack {
    flex: 1 1 auto;
}

.settings-card .muted {
    margin-top: auto;
}

@media (max-width: 900px) {
    .settings-grid {
        grid-template-columns: 1fr;
        max-width: 560px;
        margin: 0 auto;
    }

    .settings-grid--club-centered {
        max-width: 560px;
    }

    .settings-card--sync {
        max-width: none;
    }
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: rgba(6, 3, 11, 0.78);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-panel {
    width: min(820px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    margin: auto 0;
    padding: 28px;
    overscroll-behavior: contain;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.modal-panel .form-input,
.modal-panel textarea.form-input {
    background-color: var(--bg-soft);
}

.modal-overlay.is-open .modal-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.modal-panel--wide {
    width: min(900px, 100%);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.modal-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
}

.modal-close {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Owner shell: горизонтальная навигация сверху */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-shell--topnav {
    background: radial-gradient(circle at 12% 0%, rgba(143, 91, 255, 0.14), transparent 42%),
        var(--bg-deep, #0f0818);
}

.owner-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding: 16px 28px 14px;
    border-bottom: 1px solid rgba(143, 91, 255, 0.18);
    background: rgba(12, 7, 22, 0.72);
    backdrop-filter: blur(10px);
}

.owner-topbar__brand .logo {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 0.02em;
}

.owner-topbar__brand {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 220px;
    flex: 0 0 auto;
}


.owner-topbar__right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.owner-user-menu {
    position: relative;
    flex: 0 0 auto;
}

.owner-user-menu__trigger {
    list-style: none;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 240px;
    padding: 8px 14px;
    border-radius: 14px;
    border: 1px solid rgba(165, 114, 255, 0.32);
    background: rgba(143, 91, 255, 0.12);
    color: var(--text-main);
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.owner-user-menu__trigger::-webkit-details-marker {
    display: none;
}

.owner-user-menu__trigger:hover {
    background: rgba(143, 91, 255, 0.2);
    border-color: rgba(165, 114, 255, 0.52);
    transform: translateY(-1px);
}

.owner-user-menu__name {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.owner-user-menu__chevron {
    color: var(--text-muted);
    font-size: 12px;
}

.owner-user-menu[open] .owner-user-menu__chevron {
    transform: rotate(180deg);
}

.owner-user-menu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    z-index: 50;
    width: 260px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(165, 114, 255, 0.34);
    background: rgba(22, 12, 39, 0.96);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.owner-user-menu__title {
    color: var(--text-main);
    font-size: 15px;
    font-weight: 900;
    line-height: 1.25;
    margin-bottom: 6px;
}

.owner-user-menu__meta {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.35;
    margin-bottom: 12px;
    word-break: break-word;
}

.owner-user-menu__meta span {
    color: var(--text-main);
    font-weight: 800;
}

.owner-user-menu__logout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 12px;
    color: #fff;
    background: rgba(255, 111, 145, 0.15);
    border: 1px solid rgba(255, 111, 145, 0.35);
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    transition: background 0.16s ease, border-color 0.16s ease;
}

.owner-user-menu__logout:hover {
    background: rgba(255, 111, 145, 0.24);
    border-color: rgba(255, 111, 145, 0.55);
}

.owner-topnav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.owner-topnav__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 16px;
    border-radius: 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    border: 1px solid transparent;
    transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.owner-topnav__link:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(143, 91, 255, 0.2);
}

.owner-topnav__link.is-active {
    color: #fff;
    background: rgba(143, 91, 255, 0.22);
    border-color: rgba(165, 114, 255, 0.45);
}

.owner-page {
    max-width: 1480px;
    margin: 0 auto;
    width: 100%;
    min-width: 0;
    flex: 1;
    padding: 22px 28px 40px;
    box-sizing: border-box;
    animation: pageFadeIn 0.35s ease;
}

.settings-page--wide {
    align-items: flex-start;
    min-height: auto;
}

.settings-shell {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.settings-tabs {
    min-height: auto;
    padding: 10px;
    margin-bottom: 24px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.settings-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 16px;
    border-radius: 14px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 700;
    border: 1px solid transparent;
}

.settings-tab:hover,
.settings-tab.active {
    color: #fff;
    background: rgba(143, 91, 255, 0.22);
    border-color: rgba(143, 91, 255, 0.45);
}

.crm-hero {
    min-height: auto;
    padding: 28px 30px;
    margin-bottom: 24px;
}

.crm-hero .section-title {
    margin-bottom: 8px;
}

.crm-hero-text {
    margin-top: 0;
}

@media (max-width: 900px) {
    .owner-topbar {
        padding: 14px 16px;
    }

    .owner-topnav {
        width: 100%;
        justify-content: flex-start;
    }

    .owner-page {
        padding: 16px 16px 32px;
    }
}

html {
    scroll-behavior: smooth;
}

/* Global typography: Manrope across all app UI */
html,
body,
button,
input,
textarea,
select {
    font-family: var(--font-main) !important;
}

.app-shell,
.app-shell *,
.owner-page,
.owner-page *,
.card,
.card *,
.owner-topbar,
.owner-topbar *,
.modal,
.modal *,
.app-modal,
.app-modal * {
    font-family: var(--font-main) !important;
}

.card-value,
.small-card-value,
.stats-big,
.metric-value,
.stat-value,
.kpi-number,
.big-number {
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
}


@media (max-width: 920px) {
    .owner-topbar__right {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .owner-topnav {
        justify-content: flex-start;
    }

    .owner-user-menu__panel {
        left: 0;
        right: auto;
    }
}
