:root {
    --bg: var(--tg-theme-bg-color, #121212);
    --text: var(--tg-theme-text-color, #e0e0e0);
    --hint: var(--tg-theme-hint-color, #8e8e93);
    --card: var(--tg-theme-secondary-bg-color, #1e1e1e);
    --accent: var(--tg-theme-button-color, #3390ec);
    --border: rgba(255, 255, 255, 0.08);
    --c-green: #34c759; --c-red: #ff3b30; --c-orange: #ff9500;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); padding-bottom: 80px; }
.top-bar { position: sticky; top: 0; background: var(--bg); z-index: 10; padding: 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.top-bar h1 { font-size: 20px; font-weight: 700; }
.tab-content { display: none; padding: 16px; animation: fadeIn 0.2s ease-out; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Карточки */
.card { background: var(--card); border-radius: 12px; padding: 16px; margin-bottom: 12px; border: 1px solid var(--border); }
.card.clickable { cursor: pointer; transition: transform 0.1s; }
.card.clickable:active { transform: scale(0.98); }
.card-title { font-weight: 600; font-size: 16px; margin-bottom: 6px; display: flex; justify-content: space-between; }
.meta { color: var(--hint); font-size: 13px; line-height: 1.5; display: flex; align-items: center; gap: 6px; }
.tag { background: var(--accent); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.badge { background: var(--c-red); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }

/* Навигация и кнопки */
.date-nav { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.date-btn { background: var(--card); border: 1px solid var(--border); color: var(--text); padding: 8px 16px; border-radius: 8px; font-weight: 600; }
.date-title { flex: 1; text-align: center; font-weight: 600; }
.btn-action { display: block; width: 100%; padding: 14px; border-radius: 10px; background: var(--card); color: var(--text); border: 1px solid var(--border); font-weight: 600; font-size: 15px; margin-bottom: 12px; text-align: center; }
.btn-primary { background: var(--accent); color: #fff; border: none; }

/* Модальное окно действий */
.overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: none; align-items: flex-end; z-index: 100; }
.overlay.active { display: flex; }
.sheet { background: var(--card); width: 100%; border-radius: 20px 20px 0 0; padding: 20px; padding-bottom: env(safe-area-inset-bottom, 20px); }
.sheet-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; text-align: center; }
.sheet-btn { display: flex; align-items: center; justify-content: center; padding: 14px; border-radius: 10px; margin-bottom: 10px; font-weight: 600; border: none; width: 100%; font-size: 16px; cursor: pointer; }
.sheet-btn.green { background: rgba(52, 199, 89, 0.15); color: var(--c-green); }
.sheet-btn.orange { background: rgba(255, 149, 0, 0.15); color: var(--c-orange); }
.sheet-btn.red { background: rgba(255, 59, 48, 0.15); color: var(--c-red); }
.sheet-btn.gray { background: rgba(142, 142, 147, 0.15); color: var(--hint); }
.sheet-input { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); margin-bottom: 12px; font-size: 16px; }

/* Профиль */
.profile-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: white; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: bold; }
.switch-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--c-green); }
input:checked + .slider:before { transform: translateX(20px); }

/* Нижнее меню */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; height: 60px; background: var(--card); border-top: 1px solid var(--border); display: flex; justify-content: space-around; align-items: center; padding-bottom: env(safe-area-inset-bottom); z-index: 50; }
.nav-item { display: flex; flex-direction: column; align-items: center; color: var(--hint); font-size: 10px; font-weight: 600; width: 100%; height: 100%; justify-content: center; }
.nav-item.active { color: var(--accent); }
.nav-icon { font-size: 20px; margin-bottom: 2px; }

/* Фото ДЗ */
.hw-photo { width: 100%; border-radius: 8px; margin-top: 10px; border: 1px solid var(--border); }
/* Дни недели */
.week-nav { display: flex; justify-content: space-between; margin-bottom: 16px; gap: 4px; }
.day-btn { flex: 1; text-align: center; padding: 8px 0; background: var(--card); border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--hint); border: 1px solid transparent; transition: 0.2s; }
.day-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Анимация загрузки */
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
