html, body { height: 100%; margin: 0; padding: 0; }
* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; }
body { font-family: -apple-system, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, sans-serif;  color: #e2e8f0; min-height: 100vh; }
    margin: 0; padding: 0;
    text-align: center;
    background: var(--bg-image, #0f172a) center/cover fixed;

.envelope {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
}
.glass-card {
    margin: 0 auto !important;
    width: 320px;
    max-width: 90vw;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 44px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.3) inset;
    border: 0.5px solid rgba(255, 255, 255, 0.3);
    padding: 24px 20px;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.glass-avatar {
    width: 60px; height: 60px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 0.5px solid rgba(255, 255, 255, 0.3);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; margin-bottom: 16px; color: #fff;
}
.glass-greeting { font-size: 24px; font-weight: 600; margin-bottom: 4px; letter-spacing: -0.3px; }
.glass-sub { font-size: 15px; opacity: 0.8; margin-bottom: 28px; font-weight: 400; }
.glass-btn {
    display: block; width: 100%; padding: 14px 0;
    font-size: 18px; font-weight: 500; color: #fff;
    background: none; border: none;
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.2);
    cursor: pointer; text-align: left;
    transition: 0.2s ease;
    backdrop-filter: blur(5px);
}
.glass-btn:last-of-type { border-bottom: none; }
.glass-btn:active { opacity: 0.6; transform: scale(0.98); }
.glass-btn.logout { color: #ff453a; margin-top: 12px; border-top: 0.5px solid rgba(255, 255, 255, 0.2); border-bottom: none; }

/* Календарь */
.calendar-container { padding: 10px 0; }
.fc { background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(15px); border-radius: 16px; padding: 10px; border: 0.5px solid rgba(255,255,255,0.1); font-size: 13px !important; }
.fc-toolbar-title { color: #fff !important; }
.fc-button { background: rgba(255,255,255,0.1) !important; border: 0.5px solid rgba(255,255,255,0.2) !important; border-radius: 8px !important; color: #fff !important; }
.fc-button-active { background: rgba(59,130,246,0.4) !important; }
.fc-event { border: none !important; border-radius: 5px !important; font-size: 11px !important; }
.fc-event.task { background: linear-gradient(135deg, rgba(59,130,246,0.7), rgba(139,92,246,0.7)) !important; }

.event-item { background: rgba(255,255,255,0.1); backdrop-filter: blur(15px); border: 0.5px solid rgba(255,255,255,0.1); border-radius: 14px; padding: 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.event-info { flex: 1; }
.event-date { font-size: 11px; opacity: 0.5; }
.fab { position: fixed; bottom: 25px; right: 25px; width: 56px; height: 56px; border-radius: 50%; background: rgba(59,130,246,0.5); backdrop-filter: blur(15px); border: 0.5px solid rgba(255,255,255,0.2); color: white; font-size: 28px; cursor: pointer; z-index: 999; display: flex; align-items: center; justify-content: center; }
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); backdrop-filter: blur(10px); z-index: 2000; align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-content { background: rgba(30,41,59,0.7); backdrop-filter: blur(30px); border: 0.5px solid rgba(255,255,255,0.15); border-radius: 20px; padding: 25px; width: 90%; max-width: 400px; }
.modal-content h3 { margin-bottom: 15px; }
.modal-content input, .modal-content select, .modal-content textarea { width: 100%; padding: 12px; margin-bottom: 10px; border-radius: 10px; border: 0.5px solid rgba(255,255,255,0.15); background: rgba(15,23,42,0.4); color: #e2e8f0; font-size: 14px; }
.modal-content .buttons { display: flex; gap: 10px; justify-content: flex-end; }
.btn { background: rgba(59,130,246,0.5); backdrop-filter: blur(15px); border: 0.5px solid rgba(255,255,255,0.2); color: white; padding: 14px; border-radius: 14px; font-size: 15px; cursor: pointer; font-weight: 600; width: 100%; }
.btn-sm { padding: 10px 18px; font-size: 13px; width: auto; border-radius: 10px; }
.action-btn { border: none; color: #fff; padding: 5px 10px; border-radius: 8px; font-size: 11px; cursor: pointer; }
.divider { width: 100%; text-align: center; opacity: 0.4; font-size: 11px; padding: 10px 0; border-top: 0.5px solid rgba(255,255,255,0.1); }
.time-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.time-row input { flex: 1; margin-bottom: 0 !important; }
.time-row span { opacity: 0.5; }

/* Кнопка fab поверх конверта */
.fab {
    z-index: 10000 !important;
}

/* Модальные окна поверх всего */
.modal {
    z-index: 10000 !important;
}

/* ========== МОБИЛЬНАЯ АДАПТАЦИЯ ========== */

/* Безопасные зоны для iPhone X+ */
body {
    margin: 0; padding: 0;
    text-align: center;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left) !important;
}

/* Увеличиваем touch-области для всех кнопок */
button, .btn, .btn-sm, .glass-btn, .action-btn, .dir-tab {
    min-height: 44px;
    min-width: 44px;
}

/* Модальные окна на мобильных */
@media (max-width: 480px) {
    .modal-content {
        width: 92% !important;
        max-width: 92% !important;
        padding: 20px 15px !important;
        border-radius: 20px 20px 0 0 !important;
        margin-top: auto !important;
        margin-bottom: 0 !important;
        max-height: 85vh !important;
        overflow-y: auto !important;
    }
    
    /* Прижимаем модалки к низу экрана */
    .modal {
        
    }
    
    /* Карточки на полную ширину */
    .glass-card {
    margin: 0 auto !important;
    margin-left: auto; margin-right: auto;
        width: 92% !important;
        max-width: 92% !important;
        padding: 25px 18px !important;
    }
    
    /* Календарь на мобильных */
    .fc {
        font-size: 12px !important;
    }
    .fc .fc-toolbar-title {
        font-size: 16px !important;
    }
    .fc .fc-button {
        padding: 6px 10px !important;
        font-size: 12px !important;
    }
    
    /* Списки задач/смен */
    .event-item {
        padding: 12px 10px !important;
        font-size: 13px !important;
    }
    
    /* Поля ввода */
    input, select, textarea {
        font-size: 16px !important; /* чтобы не было зума на iOS */
        padding: 12px !important;
    }
    
    /* Кнопка "плюс" чуть меньше */
    .fab {
        width: 50px;
        height: 50px;
        font-size: 24px;
        bottom: 20px;
        right: 20px;
    }
    
    /* Уведомления на полный экран */
    .notif-panel {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* Для очень маленьких экранов (iPhone SE) */
@media (max-width: 374px) {
    .glass-card {
    margin: 0 auto !important;
    margin-left: auto; margin-right: auto;
        padding: 20px 12px !important;
    }
    .glass-greeting {
        font-size: 20px !important;
    }
    .glass-btn {
        font-size: 15px !important;
        padding: 12px 0 !important;
    }
}

/* Фикс кнопок в задачах */
.event-item > div:last-child {
    margin-left: auto;
    flex-shrink: 0;
}

/* Одинаковые поля в модальных окнах */
.modal-content input,
.modal-content select,
.modal-content textarea {
    width: 100% !important;
    padding: 12px !important;
    margin-bottom: 12px !important;
    box-sizing: border-box !important;
}

/* Адаптация строки "Назначить другому" для мобильных */
@media (max-width: 480px) {
    label[for="assignCheck"] {
        font-size: 13px !important;
    }
    #taskAssigned {
        font-size: 14px !important;
        padding: 8px !important;
    }
}

/* Прижать текст к галочке "Назначить другому" */
label[for="assignCheck"] {
    gap: 4px !important;
    font-size: 13px !important;
}
label[for="assignCheck"] input[type="checkbox"] {
    margin: 0 4px 0 0 !important;
    width: auto !important;
}

/* Стили для чекбоксов */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #94a3b8;
    cursor: pointer;
    margin-bottom: 10px;
    user-select: none;
}
.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
    cursor: pointer;
    flex-shrink: 0;
}

/* Улучшенные стили для модальных окон */
.modal-content {
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px;
}

.modal-content h3 {
    margin-bottom: 15px;
}

.modal-content label {
    display: block;
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 4px;
    margin-top: 10px;
}

.modal-content input[type="text"],
.modal-content input[type="date"],
.modal-content input[type="time"],
.modal-content input[type="number"],
.modal-content select,
.modal-content textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(15,23,42,0.5);
    color: #e2e8f0;
    font-size: 14px;
    box-sizing: border-box;
}

.modal-content textarea {
    height: 70px;
    resize: vertical;
}

.modal-content .buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
}

.modal-content .btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 10px;
}

/* Убираем лишние отступы у первого поля после заголовка */
.modal-content h3 + input,
.modal-content h3 + select,
.modal-content h3 + textarea,
.modal-content h3 + div {
    margin-top: 0;
}

.modal-label {
    display: block;
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 4px;
    margin-top: 10px;
}

/* ====== СВЕТЛАЯ ТЕМА ====== */
body.light-theme .glass-card {
    background: rgba(255,255,255,0.8) !important;
    color: #1a1a2e !important;
}
body.light-theme .glass-card .provider-name {
    color: #1a1a2e !important;
}
body.light-theme .glass-btn {
    background: #3b82f6 !important;
    color: #fff !important;
}
body.light-theme .glass-greeting,
body.light-theme .glass-sub {
    color: #1a1a2e !important;
}
body.light-theme .section-title {
    color: #475569 !important;
}
body.light-theme .bind-card {
    background: rgba(0,0,0,0.03) !important;
}
body.light-theme .unbind-btn {
    color: #dc2626 !important;
    border-color: #dc2626 !important;
}
