/* === 1. ПЕРЕМЕННЫЕ И ТЕМЫ === */
:root {
    --cb-bg: #f8fafc;
    --cb-surface: #ffffff;
    --cb-border: #e2e8f0;
    --cb-text: #0f172a;
    --cb-text-muted: #64748b;
    --cb-primary: #6366f1;
    --cb-primary-hover: #4f46e5;
    --cb-danger: #ef4444;
    --cb-success: #10b981;
    --cb-overlay: rgba(0, 0, 0, 0.6);
    --cb-radius: 16px;
    --cb-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ТЕМНАЯ ТЕМА (Жесткое переопределение) */
#cboost-app.cb-dark {
    --cb-bg: #0f172a;
    --cb-surface: #1e293b;
    --cb-border: #334155;
    --cb-text: #f1f5f9;
    --cb-text-muted: #94a3b8;
    --cb-primary: #818cf8;
    --cb-overlay: rgba(0, 0, 0, 0.9);
}

/* === 2. ОСНОВНОЙ ЛЕЙАУТ === */
#cboost-app {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--cb-bg);
    color: var(--cb-text);
    min-height: 85vh;
    display: flex;
    width: 100%;
    position: relative;
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius);
    box-sizing: border-box;
    overflow: hidden;
}
#cboost-app * { box-sizing: border-box; outline: none; }

/* Сайдбар (Только десктоп) */
.cb-sidebar {
    width: 260px;
    background: var(--cb-surface);
    border-right: 1px solid var(--cb-border);
    padding: 24px;
    display: flex; flex-direction: column; flex-shrink: 0;
    z-index: 50;
}

.cb-brand { font-size: 22px; font-weight: 800; margin-bottom: 30px; color: var(--cb-primary); display: flex; align-items: center; gap: 10px; }

.cb-nav-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    color: var(--cb-text-muted); text-decoration: none;
    border-radius: 12px; margin-bottom: 5px; font-weight: 500;
    transition: 0.2s; cursor: pointer;
}
.cb-nav-item:hover { background: rgba(99, 102, 241, 0.1); color: var(--cb-primary); }
.cb-nav-item.is-active { background: var(--cb-primary); color: #fff; box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3); }

/* Контент */
.cb-main { flex: 1; display: flex; flex-direction: column; height: 100%; overflow: hidden; background: var(--cb-bg); position: relative; }
.cb-content { padding: 30px; overflow-y: auto; height: 100%; padding-bottom: 80px; /* Отступ для мобильного меню */ }

.cb-topbar {
    height: 70px; background: var(--cb-surface);
    border-bottom: 1px solid var(--cb-border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 30px; flex-shrink: 0;
}

/* === 3. КОМПОНЕНТЫ === */
.cb-card { background: var(--cb-surface); border: 1px solid var(--cb-border); border-radius: var(--cb-radius); padding: 24px; margin-bottom: 24px; box-shadow: var(--cb-shadow); }
.cb-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.cb-header-row h3 { margin: 0; font-size: 18px; color: var(--cb-text); }

/* Inputs & Selects (Исправление цвета текста) */
.cb-input, select.cb-input {
    width: 100%; padding: 12px;
    background: var(--cb-bg);
    border: 1px solid var(--cb-border);
    border-radius: 10px;
    color: var(--cb-text) !important;
    font-size: 14px; appearance: none;
}
.cb-input:focus { border-color: var(--cb-primary); }

/* Buttons */
.cb-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 14px;
    cursor: pointer; border: 1px solid var(--cb-border);
    background: var(--cb-surface); color: var(--cb-text); transition: 0.2s;
}
.cb-btn:hover { background: var(--cb-bg); }
.cb-btn.primary { background: var(--cb-primary); color: #fff; border-color: var(--cb-primary); }
.cb-btn.primary:hover { opacity: 0.9; }
.cb-btn.danger { color: var(--cb-danger); border-color: rgba(239, 68, 68, 0.3); }
.cb-btn.icon-only { width: 38px; height: 38px; padding: 0; border-radius: 50%; }

/* Таблицы */
.cb-table { width: 100%; border-collapse: collapse; }
.cb-table th { text-align: left; padding: 15px; color: var(--cb-text-muted); border-bottom: 1px solid var(--cb-border); font-size: 12px; text-transform: uppercase; }
.cb-table td { padding: 15px; border-bottom: 1px solid var(--cb-border); color: var(--cb-text); }

/* === 4. КАЛЕНДАРЬ (ПРОКАЧАННЫЙ) === */
.cb-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.cb-cal-day {
    background: var(--cb-surface); border: 1px solid var(--cb-border);
    border-radius: 12px; min-height: 110px; padding: 10px;
    cursor: pointer; display: flex; flex-direction: column; justify-content: space-between;
    transition: 0.2s; position: relative;
}
.cb-cal-day:hover { border-color: var(--cb-primary); transform: translateY(-2px); }

/* Выходной день (Крестик) */
.cb-cal-day.is-off { opacity: 0.6; background: rgba(0,0,0,0.02); }
.cb-cal-day.is-off::after {
    content: '✕'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 24px; color: var(--cb-text-muted); opacity: 0.2; pointer-events: none;
}

.cb-shift-badge { background: rgba(99, 102, 241, 0.1); color: var(--cb-primary); border: 1px solid var(--cb-primary); padding: 4px; border-radius: 6px; font-size: 11px; text-align: center; }
.cb-break-badge { font-size: 10px; color: var(--cb-text-muted); text-align: center; margin-top: 2px; }

/* === 5. МОДАЛКИ (ИСПРАВЛЕНИЕ ПРОЗРАЧНОСТИ) === */
.cb-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--cb-overlay) !important; /* Темный фон */
    backdrop-filter: blur(5px);
    z-index: 999999; /* Поверх всего */
    display: none; align-items: center; justify-content: center;
}
.cb-modal.is-open { display: flex; }

.cb-modal__panel {
    background: var(--cb-surface) !important; /* НЕ ПРОЗРАЧНЫЙ */
    width: 100%; max-width: 550px;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    display: flex; flex-direction: column;
    max-height: 90vh;
    animation: cbSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative; z-index: 1000000;
}
.super-panel { max-width: 800px; height: 85vh; }

.cb-modal-header { padding: 20px; border-bottom: 1px solid var(--cb-border); display: flex; justify-content: space-between; align-items: center; background: var(--cb-surface); }
.cb-modal-body { padding: 25px; overflow-y: auto; flex: 1; background: var(--cb-surface); }
.cb-modal-footer { padding: 20px; border-top: 1px solid var(--cb-border); background: var(--cb-bg); text-align: right; }

/* === 6. МОБИЛЬНАЯ ВЕРСТКА (APP STYLE) === */
.cb-bottom-nav { display: none; } /* Скрыто на ПК */

@media (max-width: 768px) {
    /* Скрываем Сайдбар и Топбар */
    .cb-sidebar { display: none; }
    .cb-topbar { padding: 0 15px; }
    
    /* Нижняя панель (App Navigation) */
    .cb-bottom-nav {
        display: flex; position: fixed; bottom: 0; left: 0; width: 100%;
        background: var(--cb-surface); border-top: 1px solid var(--cb-border);
        height: 65px; z-index: 9999; padding-bottom: env(safe-area-inset-bottom);
        justify-content: space-around; align-items: center;
        box-shadow: 0 -5px 15px rgba(0,0,0,0.05);
    }
    .cb-b-item {
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        color: var(--cb-text-muted); font-size: 10px; gap: 4px; text-decoration: none; width: 20%;
    }
    .cb-b-item i { font-size: 24px; margin-bottom: 2px; }
    .cb-b-item.is-active { color: var(--cb-primary); }

    /* Контент */
    .cb-content { padding: 15px; padding-bottom: 90px; }
    .cb-card { padding: 15px; border-radius: 12px; }
    
    /* Таблицы (карточки вместо строк для мобилки - опционально, пока скролл) */
    .cb-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    
    /* Календарь в 1 колонку */
    .cb-calendar-grid { grid-template-columns: 1fr; gap: 8px; }
    .cb-cal-day { min-height: 60px; flex-direction: row; align-items: center; }
    
    /* Модалки снизу */
    .cb-modal { align-items: flex-end; }
    .cb-modal__panel { border-radius: 20px 20px 0 0; width: 100%; max-height: 92vh; }
    
    /* Сетка форм */
    .grid-2 { display: grid; grid-template-columns: 1fr !important; gap: 15px !important; }
    .profile-layout { flex-direction: column; align-items: center; text-align: center; }
}

@keyframes cbSlideUp { from { transform: translateY(50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }