:root {
    --bg-dark: #09090b;
    --bg-deep: #000000;
    --glass-bg: rgba(23, 23, 23, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.03);
    --input-bg: rgba(255, 255, 255, 0.03);
    --logo-bg: #121214;
    --primary: #7c3aed;
    --primary-bright: #8b5cf6;
    --accent: #db2777;
    --accent-bright: #ec4899;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --gold: #fbbf24;

    --text-main: #ffffff;
    --text-muted: #a1a1aa;

    --font-main: 'Plus Jakarta Sans', sans-serif;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --app-height: 100dvh;
}

body,
html {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    /* Запрещаем общий скролл, чтобы работал внутренний */
    background: var(--bg-dark);
}

[data-theme="light"] {
   --bg-dark: #e5e7eb; /* Потемнее (серый) */
    /* ИЛИ */
    --bg-dark: #dbeafe; /* Голубоватый (чтобы точно увидеть разницу) */
    
    --bg-deep: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.06);
    --input-bg: rgba(0, 0, 0, 0.04);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --logo-bg: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    min-height: 100vh;
    overflow: hidden;
}

/* --- PREMIUM LIQUID BACKGROUNDS --- */

/* Фиксированный контейнер для фона */
.liquid-background {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: var(--bg-dark); /* Базовый цвет */
}

/* Элементы "жидкости" */
.liquid-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px); /* Сильное размытие для эффекта жидкости */
    opacity: 0.6;
    animation: liquidMove 20s infinite ease-in-out alternate;
}

/* --- Dark Theme Orbs (Насыщенные, глубокие цвета) --- */
html[data-theme="dark"] .liquid-orb.one {
    top: -10%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, #4c1d95 0%, transparent 70%); /* Deep Violet */
    animation-duration: 25s;
}

html[data-theme="dark"] .liquid-orb.two {
    bottom: -10%;
    right: -10%;
    width: 70vw;
    height: 70vw;
    background: radial-gradient(circle, #be185d 0%, transparent 70%); /* Pink/Magenta */
    animation-delay: -5s;
    animation-duration: 28s;
}

html[data-theme="dark"] .liquid-orb.three {
    top: 40%;
    left: 40%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, #1e3a8a 0%, transparent 70%); /* Deep Blue */
    animation-delay: -10s;
    animation-duration: 30s;
}

/* --- PREMIUM LIGHT THEME (Holographic / Aurora) --- */

html[data-theme="light"] .liquid-background {
    /* 1. Чистая белая база, чтобы цвета выглядели свежо */
    background: var(--bg-dark);
}

html[data-theme="light"] .liquid-orb {
    /* 2. Убираем mix-blend-mode, так как он "съедает" цвета на белом.
       Используем normal, чтобы цвета были видны. */
    mix-blend-mode: normal; 
    
    /* 3. Очень сильный блюр для идеальной гладкости без пикселей */
    filter: blur(80px); 
    
    /* 4. Высокая прозрачность (opacity), чтобы шары смешивались друг с другом */
    opacity: 0.8;
}

/* Шар 1: Мягкий Индиго/Фиолетовый (Верхний левый) */
html[data-theme="light"] .liquid-orb.one {
    top: -10%;
    left: -10%;
    width: 70vw;
    height: 70vw;
    /* Используем насыщенный цвет в центре, уходящий в 0% прозрачности к краям */
    background: radial-gradient(circle, rgba(165, 180, 252, 0.6) 0%, rgba(165, 180, 252, 0) 70%);
    animation-duration: 20s;
}

/* Шар 2: Теплый Розовый (Нижний правый) */
html[data-theme="light"] .liquid-orb.two {
    bottom: -10%;
    right: -10%;
    width: 80vw;
    height: 80vw;
    background: radial-gradient(circle, rgba(249, 168, 212, 0.5) 0%, rgba(249, 168, 212, 0) 70%);
    animation-delay: -5s;
    animation-duration: 25s;
}

/* Шар 3: Свежий Голубой/Циан (Центр/Движущийся) */
html[data-theme="light"] .liquid-orb.three {
    top: 40%;
    left: 30%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(103, 232, 249, 0.5) 0%, rgba(103, 232, 249, 0) 70%);
    animation-delay: -10s;
    animation-duration: 30s;
}

/* Дополнительный слой шума для текстуры (Film Grain) */
.noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.07; /* Едва заметный шум */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}
#users-search-input {
    font-size: 16px !important;
}
/* Кнопка редактирования (рядом с удалением) */
.edit-mini-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: 0.2s;
    color: var(--primary-bright);
    background: rgba(139, 92, 246, 0.1);
    margin-right: 5px; /* Отступ от кнопки удаления */
}

.edit-mini-btn:hover {
    background: var(--primary-bright);
    color: white;
}
/* Анимация движения */
@keyframes liquidMove {
    0% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -50px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
    100% {
        transform: translate(0, 0) scale(1);
    }
}

/* --- TOAST --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    /* Делаем z-index больше, чем у модалок (10001) и окна авторизации (99999) */
    z-index: 200000 !important;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    pointer-events: all;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--primary-bright);
    color: var(--text-main);
    padding: 16px 20px;
    border-radius: 16px;
    min-width: 300px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: toastSlideIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: 0.3s;
}

.toast:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.success {
    border-left-color: var(--success);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
}

.toast-icon {
    font-size: 20px;
    color: var(--text-muted);
}

.toast.error .toast-icon {
    color: var(--danger);
}

.toast.success .toast-icon {
    color: var(--success);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(50px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* --- GLASS SYSTEM --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(30px) saturate(160%);
    -webkit-backdrop-filter: blur(30px) saturate(160%);
    border: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-highlight);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-lg);
}

.glass-panel-sm {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.glass-btn {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    cursor: pointer;
    transition: 0.2s;
}

.glass-btn:active {
    transform: scale(0.95);
}

/* --- LAYOUT --- */
.app-wrapper {
    height: var(--app-height);
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

.sidebar {
    display: flex;
    flex-direction: column;
    width: 280px;
    /* Возвращаем внешние отступы, чтобы меню не липло к краям экрана */
    margin: 20px 0 20px 20px !important;
    /* Добавляем внутренний отступ сверху для логотипа */
    padding: 30px 24px 24px 24px !important;
    height: calc(100dvh - 40px) !important;
    overflow-y: auto;
    scrollbar-width: none;
    z-index: 20;
}

.sidebar .logo-area {
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.logo {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.05em;
    margin-bottom: 2px;
}

.logo span {
    color: var(--primary-bright);
}

.studio-badge {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: var(--primary-bright);
    padding: 4px 10px;
    border-radius: 8px;
    display: inline-block;
    font-weight: 600;
}

.nav-menu {
    flex: 1;
}

.divider {
    width: 100%;
    height: 1px;
    background: var(--glass-border);
    margin: 5px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: 0.25s ease;
    width: 100%;
    text-align: left;
    position: relative;
}

.nav-link i {
    font-size: 20px;
}

.nav-link:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.15), transparent);
    color: var(--primary-bright);
    border-left: 3px solid var(--primary-bright);
    border-radius: 4px var(--radius-md) var(--radius-md) 4px;
}

.badge-count {
    position: absolute;
    right: 10px;
    background: var(--accent);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 700;
}

.sub-dot {
    position: absolute;
    right: 12px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 8px var(--gold);
}

.sidebar-footer {
    margin-top: auto;
    /* Прижимает профиль и кнопку темы к низу */
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-mini-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.user-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.user-info span {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

.logout-hover {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
}

.logout-hover:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
    position: relative;
}

/* Находим .top-bar и обновляем его */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    /* Добавляем горизонтальные отступы 24px как в сайдбаре */
    padding: calc(15px + env(safe-area-inset-top)) 24px 15px 24px !important;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    /* Добавим flex, чтобы распределить заголовок и статус */
    justify-content: space-between;
    align-items: center;
}

/* Исправляем отступ подзаголовка */
.header-content h1 {
    font-size: 26px;
    /* Чуть крупнее */
    font-weight: 800;
    margin-bottom: 6px;
    /* Отступ от подзаголовка */
}

.subtitle {
    font-size: 14px;
    letter-spacing: 0.3px;
    opacity: 0.8;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.studio-status {
    padding: 8px 16px;
    border-radius: 30px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.status-dot.busy {
    background: var(--danger);
    box-shadow: 0 0 10px var(--danger);
}

/* REMINDER */
.sub-reminder {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.2);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sub-reminder i {
    font-size: 18px;
    margin-right: 10px;
}

.sub-reminder span {
    font-size: 13px;
    font-weight: 600;
}

/* TABS */
.tab-pane {
    display: none;
    height: 100%;
    flex-direction: column;
    overflow-y: auto;
    padding-bottom: 20px;
    padding-right: 5px;
}

.tab-pane.active {
    display: flex;
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* STATS GRID */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    position: relative;
    padding: 24px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 120px;
}

.stat-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card h2 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
    margin: 4px 0;
}

.stat-sub {
    font-size: 12px;
    opacity: 0.7;
}

.stat-icon-bg {
    font-size: 48px;
    color: var(--text-main);
    opacity: 0.05;
    position: absolute;
    right: 20px;
    bottom: -10px;
    transform: rotate(-10deg);
    z-index: 1;
}

.gradient-card-revenue {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(219, 39, 119, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.gradient-card-revenue h2 {
    background: linear-gradient(90deg, #ffffff, #e9d5ff);
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent;
}

.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    min-height: 400px;
}

.chart-container {
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.canvas-wrapper {
    flex: 1;
    position: relative;
    margin-top: 20px;
    width: 100%;
    height: 100%;
}

/* CALENDAR */
.calendar-wrapper {
    padding: 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.nav-btn {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-muted);
}

#month-label-lg {
    font-size: 20px;
    font-weight: 700;
    text-transform: capitalize;
}

.weekdays-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 12px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.weekend {
    color: var(--accent-bright);
    opacity: 0.8;
}

.days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    flex: 1;
    overflow-y: auto;
    min-width: 0;
}

.day-cell {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    flex-direction: column;
    padding: 10px;
    min-height: 100px;
    overflow: hidden;
}

.day-cell:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary-bright);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.day-cell.today {
    background: rgba(139, 92, 246, 0.08);
    border-color: var(--primary);
}

.day-number {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 6px;
}

.day-cell.today .day-number {
    color: var(--primary-bright);
}

.event-pill {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    margin-bottom: 4px;
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    border: 1px solid rgba(139, 92, 246, 0.1);
}

.event-pill.daily {
    background: rgba(236, 72, 153, 0.15);
    color: var(--accent-bright);
    border-color: rgba(236, 72, 153, 0.1);
}

.event-pill.permanent {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.1);
}

.event-pill.tail {
    opacity: 0.7;
    border-style: dashed;
    border-width: 1px;
    background: rgba(139, 92, 246, 0.1);
}

.event-pill.tail::before {
    content: '↳ ';
    font-size: 10px;
    opacity: 0.7;
    margin-right: 2px;
}

.mobile-dots-container {
    display: none;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: auto;
    justify-content: center;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-bright);
}

.dot.daily {
    background: var(--accent-bright);
}

/* LISTS */
.history-list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-date-header {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    margin-top: 15px;
    margin-bottom: 5px;
}

/* AUTH & MODALS */
.active-flex {
    display: flex !important;
    justify-content: center;
    align-items: center;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    margin: auto;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 30px;
}

.input-wrapper {
    position: relative;
    /* Важно! Чтобы абсолютные элементы были внутри этого блока */
    display: flex;
    align-items: center;
    width: 100%;
}

.input-wrapper i.ri-mail-line,
.input-wrapper i.ri-lock-2-line,
.input-wrapper i.ri-user-smile-line {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 18px;
    pointer-events: none;
    /* Чтобы клик проходил сквозь иконку в инпут */
    z-index: 5;
}

.input-wrapper i {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 18px;
    pointer-events: none;
}

.input-wrapper input {
    padding-left: 48px;
    padding-right: 16px;
    height: 52px;
}

.auth-switch {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-muted);
}

.text-btn {
    background: none;
    border: none;
    color: var(--primary-bright);
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
    padding: 0 5px;
    text-decoration: none;
    transition: 0.2s;
}

.text-btn:hover {
    text-decoration: underline;
    color: var(--accent-bright);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    color: white;
    height: 52px;
    width: 100%;
    border-radius: 14px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 10px 25px -5px var(--primary);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    margin-top: 10px;
}

.btn-primary:hover {
    box-shadow: 0 15px 35px -5px var(--primary);
    transform: translateY(-2px);
}

.liquid-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: skewX(-20deg);
    transition: 0.6s;
}

.glass-input {
    width: 100%;
    padding-left: 48px;
    /* Место под левую иконку */
    padding-right: 48px !important;
    /* Место под ГЛАЗОК справа */
    height: 52px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    color: var(--text-main);
    font-size: 15px;
    font-family: var(--font-main);
    transition: 0.3s;
}

/* 4. Кнопка "Глазок" (FIXED) */
.password-toggle-btn {
    position: absolute;
    right: 14px;
    /* Фиксированный отступ справа */
    top: 50%;
    /* Центр по вертикали */
    transform: translateY(-50%);
    /* Корректировка центра */

    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 20px;

    /* Сброс размеров и отступов, чтобы не "плыло" */
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;

    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    /* Поверх инпута */
    border-radius: 50%;
    /* Круглый ховер */
    transition: color 0.2s, background 0.2s;
}

.password-toggle-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.liquid-btn:hover::before {
    left: 150%;
}

.form-group {
    margin-bottom: 15px;
    width: 100%;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    margin-left: 4px;
}

.glass-input,
.glass-select {
    height: 52px;
    /* Фиксированная высота для всех полей */
    line-height: 52px;
    padding: 0 16px;
    display: block;
    width: 100%;
}

.glass-input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}

.glass-select option {
    background: var(--bg-deep);
    color: var(--text-main);
}

.rent-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.radio-box input {
    display: none;
}

.box-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    cursor: pointer;
    transition: 0.2s;
    color: var(--text-muted);
}

.radio-box input:checked+.box-content {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px;
    border-radius: 12px;
    background: var(--input-bg);
    transition: 0.2s;
}

.custom-checkbox:hover {
    background: rgba(255, 255, 255, 0.05);
}

.checkmark {
    width: 22px;
    height: 22px;
    border: 2px solid var(--text-muted);
    border-radius: 6px;
    position: relative;
    transition: 0.2s;
}

.custom-checkbox input:checked~.checkmark {
    background: var(--success);
    border-color: var(--success);
}

/* Было: display: none; — это вызывало ошибку */
.custom-checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    cursor: pointer;
    z-index: -1;
    /* Чтобы не перекрывал клики по label */
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    z-index: 10001;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
}

.modal-overlay.active,
.modal-overlay.active-flex {
    opacity: 1;
    pointer-events: all;
}

.center-overlay {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-card {
    width: 100%;
    max-width: 440px;
    padding: 32px;
    transform: scale(0.95);
    transition: 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-overlay.active .modal-card,
.modal-overlay.active-flex .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 26px;
    cursor: pointer;
    transition: 0.2s;
}

.close-btn:hover {
    color: var(--text-main);
    transform: rotate(90deg);
}

.sheet-overlay {
    display: flex;
    align-items: center;
    /* Было flex-end */
    justify-content: center;
    padding: 20px;
    /* Отступ от краев экрана на мобилках */
}

.sheet-card {
    width: 100%;
    max-width: 500px;
    max-height: 85dvh;
    /* Ограничиваем высоту */

    /* === ДОБАВЛЕНО ДЛЯ РАБОТЫ СКРОЛЛА === */
    display: flex;
    /* Превращаем в flex-контейнер */
    flex-direction: column;
    /* Элементы друг под другом */
    /* ==================================== */

    background: var(--bg-deep);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);

    position: relative;
    bottom: auto;
    padding: 32px;

    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.modal-overlay.active .sheet-card {
    transform: scale(1);
    /* Было translateY(0) */
    opacity: 1;
}

/* 4. Убираем "ручку" (полоску сверху), она больше не нужна */
.sheet-handle {
    display: none;
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.sheet-title-area h2 {
    font-size: 24px;
    font-weight: 700;
}

.sheet-body {
    overflow-y: auto;
    /* Разрешаем скролл */
    flex: 1;
    /* Занимаем все доступное место */
    min-height: 0;
    /* ВАЖНО: Фикс для Safari/Firefox, чтобы скролл работал внутри Flex */
    padding-bottom: 120px !important;
}

.booking-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    background: var(--input-bg);
    border-radius: 18px;
    margin-bottom: 12px;
    border: 1px solid transparent;
    transition: 0.2s;
}

.booking-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.booking-item.mine {
    border-color: rgba(139, 92, 246, 0.3);
    background: rgba(139, 92, 246, 0.05);
}

.b-time {
    font-weight: 800;
    font-size: 16px;
    width: 60px;
    text-align: center;
    color: var(--text-main);
    line-height: 1.3;
}

.b-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.b-name {
    font-weight: 700;
    font-size: 16px;
}

.b-detail {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    gap: 10px;
    align-items: center;
}

.delete-mini-btn,
.approve-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: 0.2s;
}

.delete-mini-btn {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.delete-mini-btn:hover {
    background: var(--danger);
    color: white;
}

.approve-btn {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    margin-right: 5px;
}

.approve-btn:hover {
    background: var(--success);
    color: white;
}

/* USER LIST & STUDIO LIST */
.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--input-bg);
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    margin-bottom: 10px;
}

.user-info-mini {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.role-badge {
    font-size: 10px;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    width: fit-content;
    margin-top: 4px;
}

.role-badge.studio {
    background: rgba(139, 92, 246, 0.2);
    color: var(--primary-bright);
}

.studio-list-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.studio-card {
    padding: 20px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.studio-card:hover {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
}

.studio-card h4 {
    font-size: 16px;
    font-weight: 700;
}

.studio-card p {
    font-size: 12px;
    color: var(--text-muted);
}

/* PREMIUM CARD STYLES */
.premium-card {
    background: linear-gradient(135deg, #101010, #202022);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.premium-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
    animation: pulseGlow 5s infinite;
}

@keyframes pulseGlow {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

.pc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
}

.pc-title {
    font-size: 12px;
    letter-spacing: 0.1em;
    font-weight: 800;
    color: var(--primary-bright);
    text-transform: uppercase;
}

.pc-price {
    font-size: 28px;
    font-weight: 800;
    color: white;
}

.pc-price span {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.pc-features {
    list-style: none;
    position: relative;
    z-index: 2;
}

.pc-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    margin-bottom: 12px;
    color: #e5e7eb;
}

.pc-features li i {
    color: var(--success);
    font-size: 18px;
}

.active-sub-card {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(0, 0, 0, 0.4));
    border: 1px solid var(--primary);
    padding: 30px;
    text-align: center;
    border-radius: 20px;
    margin-bottom: 20px;
}

.asc-icon {
    font-size: 48px;
    color: var(--gold);
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.asc-status {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid var(--gold);
    color: var(--gold);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 15px;
}

.sub-info-block {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    text-align: center;
}

/* UTILS */
.admin-only {
    display: none !important;
}

.super-admin-only {
    display: none !important;
}

body.is-admin .admin-only {
    display: flex !important;
}

body.is-super-admin .super-admin-only {
    display: flex !important;
}

.desktop-only {
    display: flex;
}

.mobile-only {
    display: none;
}

.full-width {
    width: 100%;
}

.input-wrapper-relative {
    position: relative;
    width: 100%;
}

.overnight-badge {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid var(--primary-bright);
    color: var(--primary-bright);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 8px;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.charts-row>.chart-container:last-child {
    padding-bottom: 70px;
    /* пространство под легенду на десктопе */
}

/* Гарантированное центрирование логотипа в профиле студии */
#profile-logo-big,
#profile-logo-fallback {
    margin: 0 auto !important;
    display: block !important;
}

/* Центрирование буквы в fallback-круге (уже было в avatar-circle, но на всякий) */
#profile-logo-fallback {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Контакты — иконка слева от текста, но весь блок по центру */
#profile-contacts-view p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 12px 0;
}

#profile-contacts-view p i {
    font-size: 20px;
    color: var(--primary-bright);
    flex-shrink: 0;
}


.profile-logo-container {
    width: 180px;
    height: 180px;
    margin: 20px auto 40px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border: 4px solid var(--glass-border);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    position: relative;
}

.profile-logo-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

#profile-logo-fallback {
    width: 160px;
    height: 160px;
    font-size: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Логотип в списке студий — тот же стиль, что и в профиле, но поменьше */
.studio-list-logo-container {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    border: 3px solid var(--glass-border);

    /* ИЗМЕНЕНИЕ: По умолчанию фон адаптивный (черный/белый), а не градиент */
    background: var(--logo-bg);

    position: relative;
    flex-shrink: 0;

    /* Центрирование содержимого (для букв) */
    display: flex;
    align-items: center;
    justify-content: center;
}

.studio-list-logo-container.gradient-fallback {
    background: linear-gradient(135deg, var(--primary), var(--accent)) !important;
}

.studio-list-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Заполняет круг */
    /* Или используй object-fit: contain; padding: 10px; если хочешь, чтобы логотип не обрезался, а был внутри круга */
}

/* Карточка студии в списке */
.studio-card.profile-enhanced {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
}

.studio-card.profile-enhanced .studio-info {
    flex: 1;
}

.studio-card.profile-enhanced h4 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.studio-card.profile-enhanced .studio-description {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.studio-card.profile-enhanced .studio-contacts {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

.studio-card.profile-enhanced .studio-contacts p {
    margin: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- SEARCH BAR --- */
.search-bar-container {
    position: relative;
    margin-bottom: 20px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px;
    pointer-events: none;
}

.search-input {
    padding-left: 44px !important;
    /* Место под иконку */
}

/* --- COMPACT STUDIO LIST (DESKTOP & MOBILE SHARED) --- */
.studio-card.compact-card {
    display: flex;
    flex-direction: row;
    /* Всегда в строку */
    align-items: center;
    gap: 16px;
    padding: 16px;
    min-height: 80px;
}

.studio-card.compact-card .studio-list-logo-container {
    width: 60px;
    height: 60px;
    min-width: 60px;
    /* Чтобы не сжималось */
    border-radius: 14px;
    /* Чуть квадратнее */
    display: flex;
    align-items: center;
    justify-content: center;
    border-width: 2px;
}

.studio-card.compact-card .studio-info {
    flex: 1;
    min-width: 0;
    /* Важно для обрезания текста */
}

.studio-card.compact-card h4 {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.studio-card.compact-card .studio-description {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    line-height: 1.2;
}

.studio-contacts.compact p {
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.arrow-icon {
    color: var(--text-muted);
    font-size: 20px;
}

.label-text a:hover {
    text-decoration: underline !important;
    color: var(--accent-bright) !important;
}

/* --- МОБИЛЬНАЯ АДАПТАЦИЯ (ИСПРАВЛЕНАЯ) --- */
/* --- МОБИЛЬНАЯ АДАПТАЦИЯ (FINAL: NO TOP BAR) --- */
@media (max-width: 768px) {

    /* 1. СКРЫВАЕМ ВЕРХНЮЮ ПЛАШКУ ПОЛНОСТЬЮ */
    .top-bar {
        display: none !important;
    }

    .header-content h1 {
        font-size: 20px;
        /* Уменьшаем шрифт заголовка */
        margin-bottom: 2px;
    }

    /* 2. Адаптируем основной контент */
    .app-wrapper {
        flex-direction: column;
        padding: 0;
    }

    .main-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;

        /* ВАЖНО: Отступ сверху, чтобы календарь не лез под часы/челку */
        /* safe-area + 20px воздуха */
        padding-top: calc(20px + env(safe-area-inset-top)) !important;

        /* Отступ снизу под нижнее меню */
        padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important;
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Скрываем десктопные элементы */
    .mobile-menu-hidden,
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
    }

    /* Карточки студий */
    .studio-card.profile-enhanced {
        flex-direction: row !important;
        align-items: center !important;
        gap: 12px !important;
        padding: 12px !important;
    }

    .studio-card.compact-card .studio-list-logo-container {
        width: 50px;
        height: 50px;
        min-width: 50px;
        border-radius: 12px;
    }

    .studio-card.compact-card h4 {
        font-size: 15px;
    }

    .studio-card.compact-card .studio-description {
        font-size: 12px;
    }

    .studio-description {
        max-width: 200px;
    }

    /* Модалки */
    #studio-list-modal .modal-card {
        width: 100%;
        height: 90vh;
        max-height: 90vh;
        border-radius: 24px 24px 0 0;
        align-self: flex-end;
        margin: 0;
        transform: translateY(100%);
    }

    #studio-list-modal.active .modal-card {
        transform: translateY(0);
    }

    .modal-card {
        width: 95%;
        padding: 24px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .auth-card {
        padding: 30px 20px;
    }

    /* --- НИЖНЕЕ МЕНЮ (FIXED BOTTOM BAR) --- */
    .sidebar {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: auto !important;
        /* ВАЖНО: теперь оно не на весь экран */
        margin: 0 !important;
        padding: 10px 16px !important;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 20px)) !important;
        flex-direction: row !important;
        /* Выстраиваем кнопки в ряд */
        background: rgba(9, 9, 11, 0.98) !important;
        border-radius: 0 !important;
        border-top: 1px solid var(--glass-border) !important;
        z-index: 9999 !important;
        overflow: visible !important;
        /* Убираем лишние скроллы в меню */
    }

    .header-content {
        flex: 1;
        /* Позволяет заголовку занимать свободное место */
        min-width: 0;
        /* Важно для предотвращения распирания флекс-контейнера */
    }

    .header-actions {
        display: flex;
        align-items: center;
        gap: 16px;
        flex-shrink: 0;
        /* Запрещаем кнопкам и статусу сжиматься */
        margin-left: 20px;
    }

    .studio-status {
        padding: 8px 16px;
        border-radius: 30px;
        background: var(--input-bg);
        border: 1px solid var(--glass-border);
        font-size: 13px;
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 8px;
        white-space: nowrap;
        /* ЗАПРЕЩАЕМ переносы текста и вылет за пределы */
    }

    .sidebar .nav-menu {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        width: 100%;
        margin: 0;
    }

    /* Скрываем всё, кроме нужных */
    body .sidebar .nav-link,
    body.is-admin .sidebar .nav-link,
    body.is-super-admin .sidebar .nav-link {
        display: none !important;
    }

    /* Показываем Календарь и Меню */
    body .sidebar .nav-link.mobile-visible,
    body.is-admin .sidebar .nav-link.mobile-visible {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 0;
        height: 100%;
        border: none !important;
        background: transparent !important;
        color: var(--text-muted);
        border-radius: 12px;
    }

    .sidebar .nav-link.mobile-visible i {
        font-size: 24px;
        margin: 0;
    }

    .sidebar .nav-link.mobile-visible span.text {
        font-size: 11px;
        font-weight: 600;
        display: block;
    }

    .sidebar .nav-link.active {
        color: var(--primary-bright) !important;
        background: rgba(139, 92, 246, 0.1) !important;
    }

    .sidebar .nav-link.active::before {
        display: none;
    }

    /* Элементы меню (Sheet) */
    .mobile-menu-item {
        display: flex;
        flex-direction: row !important;
        justify-content: flex-start !important;
        align-items: center !important;
        padding: 16px !important;
        background: var(--input-bg) !important;
        border: 1px solid var(--glass-border) !important;
        width: 100%;
        border-radius: 16px !important;
        font-size: 16px !important;
        margin-bottom: 8px;
        height: auto !important;
        color: var(--text-muted) !important;
    }

    .mobile-menu-item.admin-only,
    .mobile-menu-item.super-admin-only {
        display: none !important;
    }

    body.is-admin .mobile-menu-item.admin-only {
        display: flex !important;
    }

    body.is-super-admin .mobile-menu-item.super-admin-only {
        display: flex !important;
    }

    .mobile-menu-item i {
        font-size: 20px !important;
        margin-right: 12px;
        margin-bottom: 0 !important;
    }

    .badge-count-mobile {
        margin-left: auto;
        background: var(--accent);
        color: white;
        font-size: 12px;
        padding: 2px 8px;
        border-radius: 10px;
        font-weight: 700;
        display: inline-block;
    }

    /* Стили для контейнера статуса и темы в мобильном меню */
    #mobile-menu-modal .sheet-body .glass-panel-sm {
        margin-top: 5px;
        margin-bottom: 25px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--glass-border);
        padding: 16px 20px !important;
        /* Увеличим отступы внутри плашки */
        border-radius: 20px;
    }

    /* Фикс для самой кнопки темы на мобилках */
    #mobile-theme-switch-btn {
        flex-shrink: 0;
        /* Чтобы кнопка не сжималась */
    }

    /* Увеличим отступ снизу в мобильном меню, чтобы скролл не прятал кнопки */
    .sheet-body {
        padding-bottom: calc(40px + env(safe-area-inset-bottom)) !important;
    }

    /* Календарь и Графики */
    .calendar-wrapper {
        padding: 16px;
        min-height: auto;
        flex: none;
        height: auto;
    }

    .days-grid {
        gap: 6px;
        overflow: visible;
    }

    .day-cell {
        min-height: 50px;
        padding: 4px;
    }

    .day-number {
        font-size: 13px;
    }

    .event-pill {
        display: none;
    }

    .mobile-dots-container {
        display: flex;
    }

    .canvas-wrapper {
        height: 100%;
    }

    .charts-row>.chart-container:first-child {
        min-height: 400px !important;
    }

    .charts-row>.chart-container:last-child {
        padding-bottom: 90px !important;
        min-height: 420px !important;
    }

    .charts-row {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
    }

    .chart-container {
        min-height: 320px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Предпросмотр логотипа в редакторе профиля */
#profile-logo-preview {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    object-fit: contain;
}

/* Улучшенные карточки студий в списке выбора */
.studio-card.profile-enhanced {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.studio-card.profile-enhanced .studio-logo {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    object-fit: cover;
    border: 2px solid var(--glass-border);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.studio-card.profile-enhanced .studio-info {
    flex: 1;
}

.studio-card.profile-enhanced .studio-description {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.4;
}

.studio-card.profile-enhanced .studio-contacts {
    margin-top: 8px;
    font-size: 12px;
    color: var(--primary-bright);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-alert {
    background: rgba(251, 191, 36, 0.05);
    /* Очень прозрачный желтый */
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 12px;
    padding: 16px;
}

#auth-overlay {
    /* Глубокий градиент: от темно-фиолетового сверху к черному низу */
    background: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #09090b 80%);
    backdrop-filter: blur(20px);
    /* Сильное размытие заднего плана */
    z-index: 99999;
    /* Чтобы точно было поверх всего */
}

/* Центрирование зоны логотипа */
.logo-area.center {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Центрирование по горизонтали (flex) */
    justify-content: center;
    text-align: center;
    /* Центрирование текста */
    width: 100%;
    margin-bottom: 32px;
    /* Отступ снизу до формы */
}

/* Сам текст логотипа */
.logo {
    font-size: 24px;
    /* Чуть аккуратнее размер */
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: center;
    /* Принудительное центрирование */
    width: 100%;
    /* Растягиваем на всю ширину */
    color: var(--text-main);
    text-shadow: 0 4px 20px rgba(124, 58, 237, 0.5);
    /* Красивое свечение */
}

.auth-subtitle {
    text-align: center;
    /* Центрирование подзаголовка */
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 8px;
    width: 100%;
}

/* Небольшая тень для карточки входа, чтобы она выделялась на новом фоне */
.auth-card {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* 1. Исправление высоты на iPhone (чтобы адресная строка не перекрывала меню) */
body,
.app-wrapper {
    min-height: 100vh;
    /* dvh учитывает плавающую адресную строку Safari */
    height: 100dvh;
    overflow: hidden;
    /* Важно, чтобы не скроллился сам body */
}

@supports (-webkit-touch-callout: none) {

    /* Фоллбек для старых iOS */
    .app-wrapper {
        height: -webkit-fill-available;
    }
}

/* 2. Плавная прокрутка на iOS */
.main-content,
.tab-pane,
.sheet-body,
.custom-scrollbar {
    -webkit-overflow-scrolling: touch;
}

/* 3. Исправление кликов на iOS (иногда div не кликабельны без этого) */
.nav-link,
.studio-card,
.day-cell,
button,
.close-btn {
    cursor: pointer;
    touch-action: manipulation;
    /* Убирает задержку 300мс при клике */
}

/* 4. Безопасные отступы для iPhone X/11/12/13/14/15 (Челка и нижняя полоска) */
.sidebar {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 20px)) !important;
}

.main-content {
    padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important;
    /* Больше отступа, чтобы контент не залез под меню */
}

/* 5. Фикс для модалок, чтобы они не улетали за экран */
.modal-overlay {
    position: fixed;
    inset: 0;
    height: 100dvh;
    /* Было 100vh или 100%, меняем на dvh */
    z-index: 10001;
    /* ...остальные стили фона (background, backdrop и т.д.)... */
}

/* --- PASSWORD TOGGLE (ГЛАЗИК) --- */

/* Кнопка глазика */
.password-toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 20px;
    z-index: 10;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.password-toggle-btn:hover {
    color: var(--text-main);
}

/* Важно: увеличиваем отступ справа у инпута, чтобы текст не залез под глазик */
.input-wrapper input {
    padding-right: 48px !important;
}

/* --- STATS CONTROLS --- */
.stats-controls {
    border: 1px solid var(--glass-border);
    background: var(--input-bg);
}

.stats-controls select {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 0 30px 0 10px;
    /* Место под стрелочку */
    appearance: none;
    /* Убираем стандартную стрелку */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23a1a1aa%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
    cursor: pointer;
    flex: 1;
}

.stats-controls select:focus {
    border-color: var(--primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.stats-controls select option {
    background-color: var(--bg-deep);
    /* Темный фон выпадающего списка */
    color: var(--text-main);
}

/* --- STATS FIXES & EXPORT --- */

/* Фикс цветов в селектах */
.stats-controls .glass-select {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-main) !important;
    /* Принудительно белый текст */
}

/* Цвет выпадающих опций (чтобы были читаемы на темном фоне) */
.stats-controls .glass-select option {
    background-color: #1a1a1a;
    /* Темно-серый фон списка */
    color: white;
}

/* Кнопки экспорта */
.icon-btn-export {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: 0.2s;
    color: white;
}

.icon-btn-export i {
    font-size: 18px;
}

.icon-btn-export.excel {
    background: rgba(16, 185, 129, 0.15);
    /* Зеленоватый */
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

.icon-btn-export.excel:hover {
    background: rgba(16, 185, 129, 0.25);
}

.icon-btn-export.pdf {
    background: rgba(239, 68, 68, 0.15);
    /* Красноватый */
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.icon-btn-export.pdf:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* Улучшение читаемости текста на карточках */
.stat-card h2 {
    color: var(--text-main);
}

.stat-label {
    color: var(--text-muted);
}

/* === FIX: Скролл для длинных модалок (Профиль) === */
#studio-profile-modal .modal-card {
    display: flex;
    padding-bottom: 40px;
    flex-direction: column;
    max-height: 90vh;
    /* Ограничиваем высоту */
    overflow-y: auto;
    /* Разрешаем скролл внутри карточки */
    -webkit-overflow-scrolling: touch;
}

/* Убираем скрытие скроллбара, чтобы было видно, что можно листать, или оставляем красивый */
#studio-profile-modal .modal-card::-webkit-scrollbar {
    width: 4px;
}

#studio-profile-modal .modal-card::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* === НОВЫЙ ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ (iOS Style) === */
.theme-toggle-wrapper {
    position: relative;
    width: 64px;
    height: 36px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.2);
    /* Темная подложка */
    border: 1px solid var(--glass-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    transition: 0.3s;
    overflow: hidden;
}

[data-theme="light"] .theme-toggle-wrapper {
    background: rgba(0, 0, 0, 0.05);
    /* Светлая подложка */
    border-color: rgba(0, 0, 0, 0.1);
}

/* Ползунок */
.theme-toggle-handle {
    position: absolute;
    left: 4px;
    top: 4px;
    width: 26px;
    height: 26px;
    background: #3f3f46;
    /* Темный ползунок для темной темы */
    border-radius: 50%;
    transition: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Пружинистый эффект */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

[data-theme="light"] .theme-toggle-handle {
    left: calc(100% - 30px);
    /* Сдвиг вправо */
    background: #ffffff;
    /* Белый ползунок */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Иконки на фоне */
.theme-icon {
    font-size: 16px;
    z-index: 1;
    transition: 0.3s;
}

.theme-icon.moon {
    color: #a1a1aa;
}

.theme-icon.sun {
    color: #fbbf24;
    opacity: 0.5;
}

[data-theme="light"] .theme-icon.moon {
    opacity: 0.5;
}

[data-theme="light"] .theme-icon.sun {
    opacity: 1;
}

/* === RECURRENCE & PROFILE STYLES === */

/* Компактные радио-кнопки */
.radio-box.compact .box-content {
    padding: 10px 5px;
    font-size: 13px;
    font-weight: 600;
}

/* Выбор дней недели (Кружочки) */
.week-selector {
    display: flex;
    justify-content: space-between;
    gap: 5px;
    margin-top: 5px;
}

.day-checkbox {
    position: relative;
    width: 36px;
    height: 36px;
}

.day-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    inset: 0;
    z-index: 2;
}

.day-checkbox span {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    /* Круглые */
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    transition: 0.2s;
    z-index: 1;
}

.day-checkbox input:checked+span {
    background: var(--success);
    /* Зеленый как у Apple */
    color: white;
    border-color: var(--success);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

/* Кнопка открытия мини-профиля (в календаре) */
.event-pill {
    pointer-events: auto;
    /* Чтобы клик работал */
}

.event-pill:active {
    transform: scale(0.95);
}

/* Кнопка Телеграм в мини-профиле */
.tg-btn {
    background: #229ED9;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    transition: 0.2s;
}

.tg-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

/* Кнопка создания события */
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Вид плашки события в календаре */
.event-pill.special-event {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.2);
    font-style: italic;
}

/* Точка события на мобильном */
.dot.special-event {
    background: #fbbf24;
}

/* В списке дня (Bottom Sheet) */
.booking-item.special-event {
    border-left: 3px solid #fbbf24;
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.05), transparent);
}

.booking-item.special-event .b-time {
    color: #fbbf24;
}

/* === FIX: Цвет цифр дохода на светлой теме === */
[data-theme="light"] .gradient-card-revenue h2 {
    background: none !important;
    -webkit-background-clip: border-box !important;
    background-clip: border-box !important;
    -webkit-text-fill-color: #09090b !important;
    /* Черный цвет */
    color: #09090b !important;
}

[data-theme="light"] .gradient-card-revenue .stat-sub {
    color: #52525b !important;
    /* Темно-серый для подписи */
}