/* ============================================
   Календарь — Цветовая схема
   #ABADAC, #7F9576, #455240
   ============================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-bg: #ABADAC;
    --color-accent: #7F9576;
    --color-dark: #455240;
    --color-white: #f5f5f0;
    --color-text: #2a2a2a;
    --color-text-light: #6a6a6a;
    --color-border: #9a9c92;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(69, 82, 64, 0.12);
}

html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

/* ========== ОСНОВНОЙ МАКЕТ ========== */

.main {
    max-width: 1400px; margin: 0 auto;
    display: grid; grid-template-columns: auto 1fr;
    gap: 24px; padding: 24px;
    min-height: 100vh;
}

.content {
    display: flex; flex-direction: column;
    gap: 24px; min-width: 0;
    order: 2;
}

/* ========== САЙДБАР ========== */

.sidebar {
    background: var(--color-white); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow);
}

/* ========== НАВИГАЦИЯ СОЦСЕТИ ========== */

.social-nav {
    position: relative;
    display: flex; flex-direction: column; gap: 14px;
    align-self: stretch; justify-content: center;
    background: var(--color-white); border-radius: var(--radius);
    padding: 12px 10px; box-shadow: var(--shadow);
    width: 72px; overflow: hidden;
    order: 1;
    transition: width 0.25s ease;
}

.social-nav:hover { width: 200px; }

.social-link {
    display: flex; align-items: center; gap: 12px;
    width: 100%; height: 44px; padding: 0 10px;
    border-radius: 10px; white-space: nowrap;
    text-decoration: none;
    transition: background 0.2s;
}

.social-link img { width: 32px; height: 32px; display: block; flex-shrink: 0; }

.nav-icon { position: relative; display: inline-flex; flex-shrink: 0; }

.nav-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #e53935;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-sizing: border-box;
}

.nav-badge.show { display: flex; }

/* Кнопка настроек (шестерёнка) */
.nav-settings-btn {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.nav-settings-btn:hover { background: rgba(127, 149, 118, 0.12); }
.nav-settings-btn img { width: 22px; height: 22px; display: block; }

@media (max-width: 900px) {
    .nav-settings-btn {
        left: 10px;
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
    }
}

/* Переключатель (switch) */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc;
    border-radius: 24px;
    transition: background 0.2s;
}

.switch-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.switch input:checked + .switch-slider { background: var(--color-accent); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

/* Модалка настроек */
.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(154, 156, 146, 0.25);
}

.settings-label {
    font-size: 0.9rem;
    color: var(--color-text);
    font-weight: 500;
}

.settings-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(154, 156, 146, 0.4);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--color-text);
    box-sizing: border-box;
}

.settings-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
}

.settings-save-btn {
    border: none;
    cursor: pointer;
    background: var(--color-accent);
    color: var(--color-white);
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s;
}

.settings-save-btn:hover { background: var(--color-dark); }

.settings-restore-btn {
    border: 1px solid var(--color-accent);
    background: none;
    color: var(--color-accent);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.settings-restore-btn:hover { background: rgba(127, 149, 118, 0.12); }

.settings-restore-full {
    width: 100%;
    margin: 12px 0 4px;
    padding: 10px 12px;
    border-radius: 10px;
    text-align: center;
}

.settings-link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 0;
    border: none;
    border-bottom: 1px solid rgba(154, 156, 146, 0.25);
    background: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
}

.settings-link-item:hover { color: var(--color-accent); }

.settings-link-arrow { color: var(--color-text-light); font-size: 1.1rem; line-height: 1; }

.restore-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 2px;
    max-height: 240px;
    overflow-y: auto;
}

.restore-list[hidden] { display: none; }

.restore-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: rgba(127, 149, 118, 0.06);
    border-radius: 10px;
    padding: 8px 10px;
}

.restore-info {
    font-size: 0.85rem;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.restore-btn {
    border: 1px solid var(--color-accent);
    background: none;
    color: var(--color-accent);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    cursor: pointer;
    flex-shrink: 0;
}

.restore-btn:hover { background: rgba(127, 149, 118, 0.12); }

.restore-section { margin-bottom: 14px; }
.restore-section:last-of-type { margin-bottom: 0; }
.restore-section[hidden] { display: none; }
.restore-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-light);
    margin: 0 0 6px;
}
.restore-empty {
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin: 4px 0 0;
}

.join-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-size: 1rem;
    color: var(--color-text);
    text-align: center;
}

.social-link-ezh img { width: 45px; height: 45px; }

.social-label {
    font-size: 0.9rem; font-weight: 500;
    color: var(--color-text);
    opacity: 0; transition: opacity 0.15s;
}

.social-nav:hover .social-label { opacity: 1; }

.social-link:hover { background: rgba(127, 149, 118, 0.12); }
.social-link.active { background: rgba(127, 149, 118, 0.2); }

/* Аватар пользователя в навигации */
.nav-avatar-btn {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 48px; height: 48px;
    border-radius: 50%;
    border: 2px solid var(--color-accent);
    background: var(--color-accent);
    color: var(--color-white);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    margin: 0;
    z-index: 1;
    transition: transform 0.15s;
}

.nav-avatar-btn:hover { transform: translateX(-50%) scale(1.08); }

.nav-avatar-btn img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

/* Модалка профиля */
.modal-profile { max-width: 380px; }

.profile-avatar {
    width: 99px; height: 99px;
    border-radius: 50%;
    margin: 0 auto -8px;
    background: var(--color-accent);
    color: var(--color-white);
    font-weight: 700;
    font-size: 1.8rem;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    user-select: none;
    position: relative;
    cursor: pointer;
}

.profile-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

.profile-avatar::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.35);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 15.2a3.2 3.2 0 1 0 0-6.4 3.2 3.2 0 0 0 0 6.4z'/%3E%3Cpath d='M9 3 7.2 5H4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-3.2L15 3H9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 24px 24px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.profile-avatar:hover::after { opacity: 1; }

.profile-username {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
}

.profile-username.copied { color: var(--color-accent); }

.btn-logout {
    display: block;
    width: 100%;
    margin-top: 12px;
    border: 1px solid #d9534f;
    background: none;
    color: #d9534f;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 16px;
    cursor: pointer;
    font-family: inherit;
}

.btn-logout:hover { background: rgba(217, 83, 79, 0.12); }

#changeLoginBtn {
    background: transparent;
    color: var(--color-accent);
    padding: 4px 0;
    margin-top: 0;
    font-size: 0.85rem;
}

#changeLoginBtn:hover { background: transparent; color: var(--color-dark); }

.sidebar-section { margin-bottom: 28px; }
.sidebar-section:last-child { margin-bottom: 0; }

.sidebar-title {
    font-size: 0.8rem; text-transform: uppercase;
    letter-spacing: 1px; color: var(--color-text-light);
    margin-bottom: 12px; font-weight: 600;
}

.calendar-list { list-style: none; }

.calendar-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px;
    cursor: pointer; font-size: 0.9rem; transition: background 0.2s;
}

.calendar-item:hover { background: rgba(127, 149, 118, 0.1); }
.calendar-item.active { background: rgba(127, 149, 118, 0.15); font-weight: 600; }

.calendar-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Задачи */

.task-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid rgba(154, 156, 146, 0.2);
}

.task-item:last-of-type { border-bottom: none; }

.task-checkbox {
    appearance: none; width: 18px; height: 18px;
    border: 2px solid var(--color-border); border-radius: 4px;
    cursor: pointer; flex-shrink: 0; margin-top: 2px;
    transition: all 0.2s; position: relative;
}

.task-checkbox:checked { background: var(--color-accent); border-color: var(--color-accent); }

.task-checkbox:checked::after {
    content: '✓'; position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 12px; font-weight: 700;
}

.task-info { display: flex; flex-direction: column; cursor: pointer; flex: 1; }

.task-text { font-size: 0.9rem; line-height: 1.3; }

.task-group-date {
    font-size: 0.75rem; font-weight: 700;
    color: var(--color-accent); letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-top: 12px; margin-bottom: 4px;
}
.task-group-date:first-child { margin-top: 0; }

.task-checkbox:checked ~ .task-info .task-text {
    text-decoration: line-through; opacity: 0.5;
}

.task-reminder-badge {
    font-size: 0.75rem; color: var(--color-accent);
    margin-top: 2px; display: flex; align-items: center; gap: 4px;
}

.task-reminder-badge .task-reminder-icon { font-size: 0.7rem; }

.task-del {
    background: none; border: none; color: var(--color-border);
    font-size: 1.1rem; cursor: pointer; padding: 0 4px; transition: color 0.2s;
}

.task-del:hover { color: #c0392b; }

.btn-add-task {
    margin-top: 12px; width: 100%; padding: 8px;
    background: none; border: 1px dashed var(--color-border);
    border-radius: 8px; color: var(--color-text-light);
    font-size: 0.85rem; cursor: pointer; transition: all 0.2s;
}

.btn-add-task:hover { border-color: var(--color-accent); color: var(--color-accent); background: rgba(127, 149, 118, 0.05); }

.task-done-section { margin-top: 16px; padding-top: 12px; border-top: 1px solid rgba(154, 156, 146, 0.25); }

.task-done-title {
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--color-text-light); font-weight: 600; margin-bottom: 4px;
}

.task-done-section .task-item { opacity: 0.6; }
.task-done-section .task-item .task-text { text-decoration: line-through; }

/* ========== КАЛЕНДАРЬ ========== */

.calendar {
    background: var(--color-white); border-radius: var(--radius);
    padding: 24px; box-shadow: var(--shadow);
}

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

.calendar-heading { display: flex; flex-direction: column; gap: 2px; }

.calendar-title { font-size: 1.6rem; font-weight: 700; color: var(--color-dark); line-height: 1.2; }

.calendar-subtitle { font-size: 0.85rem; color: var(--color-text-light); }

.calendar-controls { display: flex; align-items: center; gap: 8px; }

.cal-nav-btn {
    width: 38px; height: 38px; border: 1px solid var(--color-border);
    background: var(--color-white); border-radius: 10px;
    font-size: 1.2rem; cursor: pointer; color: var(--color-dark);
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}

.cal-nav-btn:hover { background: var(--color-accent); color: var(--color-white); border-color: var(--color-accent); }

.btn-today {
    height: 38px; padding: 0 18px; background: var(--color-accent); color: var(--color-white);
    border: none; border-radius: 8px; font-size: 0.85rem;
    font-weight: 600; cursor: pointer; transition: background 0.2s;
}

.btn-today:hover { background: var(--color-dark); }

.calendar-grid {
    display: grid; grid-template-columns: 32px repeat(7, 1fr);
    gap: 6px; margin-bottom: 6px;
}

.day-header-spacer { width: 32px; }

.day-header {
    text-align: center; font-size: 0.78rem; font-weight: 600;
    color: var(--color-text-light); padding: 6px 0;
    text-transform: uppercase; letter-spacing: 0.5px;
}

/* Строки календаря */

.calendar-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cal-week-row {
    display: grid; grid-template-columns: 32px repeat(7, 1fr);
    gap: 6px; align-items: stretch;
}

.week-free-btn {
    display: flex; align-items: center; justify-content: center;
    background: rgba(127, 149, 118, 0.08);
    border: 1px dashed var(--color-border);
    border-radius: 10px; cursor: pointer; font-size: 1.2rem;
    color: var(--color-text-light); transition: all 0.2s;
}

.week-free-btn:hover {
    background: var(--color-accent); color: var(--color-white);
    border-color: var(--color-accent);
}

/* Дни */

.calendar-day {
    height: 88px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    border-radius: 10px; cursor: pointer;
    border: 1px solid #DEE7D6;
    font-size: 0.95rem; font-weight: 500;
    transition: all 0.2s; position: relative;
    user-select: none;
    overflow: hidden;
}

.calendar-day:hover { background: rgba(127, 149, 118, 0.1); }
.calendar-day.other-month { color: var(--color-border); }

.calendar-day.today { background: var(--color-accent); color: var(--color-white); font-weight: 700; }
.calendar-day.selected { outline: 2px solid var(--color-dark); outline-offset: -2px; }

.calendar-day .day-number { font-size: 0.9rem; line-height: 1; z-index: 1; }

.calendar-day .day-dots {
    display: flex; gap: 3px; justify-content: center;
    flex-wrap: wrap; margin-top: 4px; z-index: 1;
    max-width: 90%;
}
.calendar-day .day-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--color-accent); }
.calendar-day .day-dots.small { gap: 2px; }
.calendar-day .day-dots.small .day-dot { width: 4px; height: 4px; }
.calendar-day .day-dots.tiny { gap: 1px; }
.calendar-day .day-dots.tiny .day-dot { width: 3px; height: 3px; }
.calendar-day.today .day-dot { background: var(--color-white); }

/* Заливка свободного времени — улучшенная */

.calendar-day .free-fill {
    position: absolute; inset: 0; border-radius: 10px;
    pointer-events: none; opacity: 0;
    transition: opacity 0.25s;
}

/* до 16:00 — мягкая светло-зелёная заливка */
.calendar-day .free-fill.top {
    background: linear-gradient(135deg, #7F9576 0%, #DEE7D6 30%, #DEE7D6 100%);
    opacity: 0;
}

.calendar-day .free-fill.top.active {
    opacity: 0.4;
}

/* после 16:00 — мягкая тёмно-зелёная заливка (светлый тон доминирует) */
.calendar-day .free-fill.bottom {
    background: linear-gradient(135deg, #CFD6CB 0%, #CFD6CB 70%, #455240 100%);
    opacity: 0;
}

.calendar-day .free-fill.bottom.active {
    opacity: 0.4;
}

/* обе половины — мягкое деление 70/30 */
.calendar-day .free-fill.both {
    background: linear-gradient(135deg, #7F9576 0%, #7F9576 70%, #455240 100%);
    opacity: 0;
}

.calendar-day .free-fill.both.active {
    opacity: 0.45;
}

/* Анимация зажатия */

.calendar-day .hold-ring {
    position: absolute; inset: -2px; border-radius: 12px;
    border: 4px solid var(--color-dark);
    opacity: 0; pointer-events: none; transition: opacity 0.15s;
}

.calendar-day .hold-ring.active { opacity: 1; animation: holdRingAnim 0.7s linear forwards; }

@keyframes holdRingAnim {
    0%   { clip-path: inset(0 100% 100% 0); }
    25%  { clip-path: inset(0 0 100% 0); }
    50%  { clip-path: inset(0 0 0 0); }
    75%  { clip-path: inset(100% 0 0 0); }
    100% { clip-path: inset(0 100% 0 0); }
}

/* ========== МОДАЛКА ДНЯ ========== */

.modal-day {
    width: 600px; max-width: 95vw; max-height: 85vh;
    display: flex; flex-direction: column; padding: 20px 24px;
}

.modal-day .modal-header { margin-bottom: 16px; flex-shrink: 0; }
.modal-day .modal-header h3 { font-size: 1.3rem; }
.modal-day .timeline-grid { flex: 1; overflow-y: auto; padding-right: 4px; }

/* ========== ТАЙМЛАЙН ========== */

.timeline-grid {
    display: flex; flex-direction: column; gap: 2px;
}

.timeline-grid::-webkit-scrollbar { width: 6px; }
.timeline-grid::-webkit-scrollbar-track { background: rgba(154, 156, 146, 0.15); border-radius: 3px; }
.timeline-grid::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }

.timeline-slot {
    display: grid; grid-template-columns: 60px 1fr;
    gap: 8px; min-height: 48px; border-radius: 8px;
    transition: background 0.2s; cursor: pointer;
}

.timeline-slot:hover { background: rgba(127, 149, 118, 0.06); }
.timeline-slot.has-event { background: rgba(127, 149, 118, 0.08); }

.timeline-time {
    font-size: 0.8rem; font-weight: 600; color: var(--color-text-light);
    padding: 6px 8px; text-align: right;
    border-right: 2px solid rgba(154, 156, 146, 0.2);
    align-self: start; padding-top: 14px;
}

.timeline-content {
    padding: 6px 12px; min-height: 48px;
    display: flex; flex-direction: column; justify-content: center; gap: 4px;
}

.timeline-event {
    background: var(--color-accent); color: var(--color-white);
    padding: 6px 12px; border-radius: 6px;
    font-size: 0.85rem; font-weight: 500;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

.timeline-event .event-del {
    opacity: 0.6; font-size: 1rem; cursor: pointer;
    background: none; border: none; color: inherit; padding: 0 2px;
}

.timeline-event .event-del:hover { opacity: 1; }

.timeline-event.done { opacity: 0.55; }
.timeline-event.done span { text-decoration: line-through; }

.timeline-add-hint {
    font-size: 0.8rem; color: var(--color-border);
    opacity: 0; transition: opacity 0.2s;
}

.timeline-slot:hover .timeline-add-hint { opacity: 1; }

/* ========== МОДАЛКА СВОБОДНОГО ВРЕМЕНИ ========== */

.modal-free { width: 700px; max-width: 95vw; }

.free-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.free-cell {
    display: flex; flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: 10px; overflow: hidden;
    background: var(--color-white);
}

.free-cell-date {
    text-align: center; padding: 8px 4px;
    font-size: 0.85rem; font-weight: 600;
    color: var(--color-dark);
    background: rgba(127, 149, 118, 0.06);
    border-bottom: 1px solid var(--color-border);
}

.free-cell-half {
    padding: 10px 8px; text-align: center;
    font-size: 0.8rem; cursor: pointer;
    transition: all 0.2s; user-select: none;
    border-bottom: 1px solid rgba(154, 156, 146, 0.15);
}

.free-cell-half:last-child { border-bottom: none; }

.free-cell-half:hover { background: rgba(127, 149, 118, 0.08); }

.free-cell-half.filled-top {
    background: #7F9576;
    color: var(--color-white);
    font-weight: 500;
}

.free-cell-half.filled-bottom {
    background: #455240;
    color: var(--color-white);
    font-weight: 500;
}

.free-cell-half.filled-both {
    background: linear-gradient(135deg, #7F9576 0%, #7F9576 50%, #455240 50.1%, #455240 100%);
    color: var(--color-white);
    font-weight: 500;
}

.free-cell-half.filled-top:hover,
.free-cell-half.filled-bottom:hover,
.free-cell-half.filled-both:hover {
    filter: brightness(0.85);
}

.free-cell-time {
    padding: 9px 6px;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-dark);
    cursor: pointer;
    background: rgba(127, 149, 118, 0.06);
    border-bottom: 1px solid rgba(154, 156, 146, 0.15);
    transition: background 0.2s;
    user-select: none;
}

.free-cell-time:hover { background: rgba(127, 149, 118, 0.16); }

.btn-import-free,
.btn-clear-free {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none;
    border-radius: 8px; cursor: pointer;
    transition: all 0.2s; padding: 0;
}

.btn-import-free img,
.btn-clear-free img {
    width: 18px; height: 18px; display: block;
}

.btn-import-free:hover { background: rgba(127, 149, 118, 0.12); }

.btn-import-free[hidden] { display: none; }

.btn-clear-free { border: 1.5px solid var(--color-dark); }

.btn-clear-free:hover {
    background: rgba(176, 68, 59, 0.08);
    border-color: #B0443B;
}

.modal-confirm { width: 400px; max-width: 90vw; }

.confirm-text {
    font-size: 0.95rem; color: var(--color-text); line-height: 1.5;
}

.confirm-actions {
    display: flex; justify-content: flex-end; gap: 10px;
}

.delete-for-all {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--color-text);
    cursor: pointer;
    user-select: none;
}

.delete-for-all input {
    width: 16px;
    height: 16px;
    accent-color: var(--color-accent);
    cursor: pointer;
}

.btn-confirm-cancel {
    height: 38px; padding: 0 16px;
    background: none; border: 1px solid var(--color-border);
    border-radius: 8px; color: var(--color-text);
    font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.2s;
}

.btn-confirm-cancel:hover { background: rgba(154, 156, 146, 0.12); }

.btn-confirm-clear {
    height: 38px; padding: 0 16px;
    background: #B0443B; color: var(--color-white);
    border: none; border-radius: 8px;
    font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.2s;
}

.btn-confirm-clear:hover { background: #8F342C; }

/* ========== КРУТИЛКА ВРЕМЕНИ ========== */

.time-picker {
    width: 240px;
    max-width: 90vw;
    background: var(--color-white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 8px 32px rgba(69, 82, 64, 0.25);
    animation: modalIn 0.2s ease-out;
}

.time-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.time-picker-header span {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-dark);
}

.time-picker-wheel-wrap {
    position: relative;
    height: 200px;
    margin-bottom: 16px;
}

.time-picker-band {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 44px;
    background: rgba(127, 149, 118, 0.10);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    border-radius: 8px;
    pointer-events: none;
}

.time-picker-wheel {
    position: relative;
    z-index: 1;
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.time-picker-wheel::-webkit-scrollbar { display: none; }

.time-picker-spacer { height: 78px; }

.time-picker-item {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--color-text-light);
    scroll-snap-align: center;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s, font-size 0.15s;
}

.time-picker-item.selected {
    color: var(--color-dark);
    font-weight: 700;
    font-size: 1.2rem;
}

.time-picker-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ========== МОДАЛЬНЫЕ ОКНА ========== */

.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(69, 82, 64, 0.5);
    z-index: 200;
    align-items: center; justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--color-white); border-radius: var(--radius);
    padding: 28px; width: 440px; max-width: 90vw;
    box-shadow: 0 8px 32px rgba(69, 82, 64, 0.25);
    animation: modalIn 0.2s ease-out;
}

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

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

.modal-header h3 { font-size: 1.2rem; font-weight: 700; color: var(--color-dark); }

.modal-close {
    background: none; border: none; font-size: 1.5rem;
    color: var(--color-text-light); cursor: pointer;
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}

.modal-close:hover { background: rgba(154, 156, 146, 0.2); color: var(--color-text); }

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

.modal-label { font-size: 0.85rem; font-weight: 600; color: var(--color-text); margin-bottom: -6px; }

.modal-input {
    width: 100%; padding: 10px 14px;
    border: 1px solid var(--color-border); border-radius: 8px;
    font-size: 0.9rem; background: var(--color-white);
    color: var(--color-text); transition: border-color 0.2s; font-family: inherit;
}

.modal-input:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(127, 149, 118, 0.15); }

.modal-time-row { display: flex; align-items: center; gap: 8px; }
.modal-input-half { flex: 1; }
.modal-time-sep { color: var(--color-text-light); font-weight: 500; }

.btn-toggle-reminder {
    padding: 8px 16px; background: none; border: 1px dashed var(--color-border);
    border-radius: 8px; color: var(--color-text-light);
    font-size: 0.85rem; cursor: pointer; transition: all 0.2s; align-self: flex-start;
}

.btn-toggle-reminder:hover { border-color: var(--color-accent); color: var(--color-accent); }
.btn-toggle-reminder.active { border-color: var(--color-accent); color: var(--color-accent); background: rgba(127, 149, 118, 0.05); }

.reminder-settings { display: flex; flex-direction: column; gap: 10px; }

.reminder-row { display: flex; align-items: center; gap: 12px; }
.reminder-row-label { font-size: 0.85rem; color: var(--color-text); min-width: 40px; font-weight: 500; }
.reminder-row .modal-input { flex: 1; }

.btn-reminder-save {
    margin-top: 4px; padding: 10px 20px;
    background: var(--color-accent); color: var(--color-white);
    border: none; border-radius: 8px;
    font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: background 0.2s;
}

.btn-reminder-save:hover { background: var(--color-dark); }

/* ========== АДАПТИВНОСТЬ ========== */

@media (max-width: 900px) {
    .main {
        display: block;
        padding: 16px;
        padding-bottom: 88px;
    }
    .content { gap: 16px; }
    .social-nav {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        top: auto;
        width: auto; height: auto;
        flex-direction: row;
        gap: 9px;
        justify-content: center;
        align-items: center;
        z-index: 100;
        border-radius: 0;
        padding: 10px 56px 10px 10px;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
        overflow: visible;
    }
    .social-nav:hover { width: auto; }
    .social-link { width: auto; height: 44px; padding: 0; justify-content: center; }
    .social-label { display: none; }
    .nav-avatar-btn { position: absolute; left: auto; right: 10px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; }
    .nav-avatar-btn:hover { transform: translateY(-50%) scale(1.08); }
}

@media (max-width: 500px) {
    .calendar-day { height: 56px; font-size: 0.8rem; }
    .calendar-title { font-size: 1.2rem; }
    .calendar-header { flex-wrap: wrap; }
    .timeline-slot { grid-template-columns: 50px 1fr; }
}

/* Адаптив модалки свободного времени: 2 ряда (4 + 3) на узких экранах */
@media (max-width: 600px) {
    .modal.modal-free { padding: 16px; }
    .free-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
    .free-cell-half { padding: 10px 4px; }
}

/* ========== ГРУППОВОЕ СОВПАДЕНИЕ ========== */

.btn-group-match {
    height: 38px; padding: 0 14px;
    background: var(--color-dark); color: var(--color-white);
    border: none; border-radius: 8px; font-size: 0.85rem;
    font-weight: 600; cursor: pointer; transition: background 0.2s;
    white-space: nowrap;
}

.btn-group-match:hover { background: var(--color-accent); }
.btn-group-match[hidden] { display: none; }

.btn-add-event {
    height: 38px; padding: 0 14px;
    background: var(--color-accent); color: var(--color-white);
    border: none; border-radius: 8px; font-size: 0.85rem;
    font-weight: 600; cursor: pointer; transition: background 0.2s;
    white-space: nowrap;
}

.btn-add-event:hover { background: var(--color-dark); }
.btn-add-event[hidden] { display: none; }

.calendar-day .group-match-count {
    margin-top: 4px; z-index: 1;
    font-size: 0.72rem; font-weight: 600;
    color: var(--color-dark);
    display: flex; align-items: center; gap: 2px;
}

.calendar-day.today .group-match-count { color: var(--color-white); }

.group-match-footer {
    margin-top: 16px; padding: 14px 16px;
    background: rgba(127, 149, 118, 0.08);
    border-radius: 12px;
}

.group-match-footer[hidden] { display: none; }

.group-match-footer-title {
    font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--color-text-light); font-weight: 600; margin-bottom: 10px;
}

.super-match-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; margin-bottom: 6px;
    background: var(--color-white); border-radius: 8px;
    font-size: 0.88rem;
}

.super-match-item:last-child { margin-bottom: 0; }

.super-match-item .super-match-people {
    margin-left: auto; font-weight: 700; color: var(--color-accent); white-space: nowrap;
}

/* Иконка происхождения календаря (личный / хобби / проект) */
.calendar-origin-icon {
    width: 20px; height: 20px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}

.calendar-origin-icon img {
    width: 100%; height: 100%; object-fit: contain;
}

/* Ёжик (личный календарь) — увеличен относительно обычной иконки */
.calendar-origin-icon.large {
    width: 24px; height: 24px;
}

/* Ручка перетаскивания (drag handle) — у календарей и задач */
.drag-handle {
    width: 18px; height: 18px; flex-shrink: 0;
    cursor: grab; opacity: 0.5;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.2s;
}

.drag-handle img {
    width: 100%; height: 100%; object-fit: contain;
    pointer-events: none;
}

.drag-handle:hover { opacity: 1; }
.drag-handle:active { cursor: grabbing; }

.calendar-item .drag-handle { margin-left: auto; }
.task-item .drag-handle { margin-top: 2px; }

.calendar-item.dragging,
.task-item.dragging {
    opacity: 0.4;
}

/* Иконка-человечек в счётчике группового совпадения */
.group-match-count img {
    width: 14px; height: 14px; object-fit: contain;
    display: block;
}

.calendar-day.today .group-match-count img { filter: invert(1); }
.calendar-day.today .group-match-count img.matched { filter: none; }

/* ========== МОДАЛКА «СОВПАДЕНИЯ» ========== */

.modal-matches {
    max-width: 420px;
}

.matches-time {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-accent);
    margin-bottom: 16px;
    padding: 10px 12px;
    background: rgba(127, 149, 118, 0.08);
    border-radius: 8px;
}

.matches-users {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px 8px;
    justify-items: center;
}

.match-user {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    width: 100%;
}

.match-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.match-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.match-user-avatar.fallback {
    background: var(--color-dark);
}

.match-user-name {
    font-size: 0.76rem;
    color: var(--color-text);
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.matches-empty {
    color: var(--color-text-light);
    font-size: 0.85rem;
    text-align: center;
    padding: 10px 0;
}

/* ========== АККОРДЕОН ЗАГОЛОВКА САЙДБАРА ========== */

.sidebar-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.accordion-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-light);
    font-size: 0.9rem;
    padding: 2px 8px;
    border-radius: 5px;
    transition: transform 0.2s, color 0.2s, background 0.2s;
    line-height: 1;
}

.accordion-toggle:hover { color: var(--color-dark); background: rgba(127, 149, 118, 0.15); }

.accordion-toggle.expanded { transform: rotate(180deg); }

/* Кнопка раскрытия списка «Мои календари» — крупнее на 20% */
#calendarListToggle {
    font-size: 1.08rem;
    padding: 3px 10px;
}

.calendar-item.calendar-item-hidden { display: none; }

/* ========== ОКНО «ПЕРЕНЕСТИ» ========== */

.modal-import { max-width: 400px; }

.import-calendars {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
}

.import-calendar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    background: var(--color-white);
    transition: border-color 0.2s, background 0.2s;
}

.import-calendar-item:hover { border-color: var(--color-accent); background: rgba(127, 149, 118, 0.06); }

.import-calendar-item.import-item-hidden { display: none; }

.import-calendar-item .calendar-dot { width: 12px; height: 12px; }

.import-calendar-name { flex: 1; font-size: 0.9rem; color: var(--color-text); }

.import-accordion-toggle {
    width: 100%;
    padding: 8px;
    background: rgba(127, 149, 118, 0.08);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--color-text-light);
    font-size: 0.85rem;
    margin-bottom: 6px;
    transition: background 0.2s, color 0.2s;
}

.import-accordion-toggle:hover { background: rgba(127, 149, 118, 0.18); color: var(--color-dark); }

/* ========== МОДАЛКА СОБЫТИЯ ========== */

.modal-event { max-width: 460px; }

.event-time-row {
    display: flex;
    gap: 12px;
}

.event-time-col { flex: 1; }

.event-reminders {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.event-reminder-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.event-reminder-row input { flex: 1; }

.event-reminder-remove {
    background: none;
    border: none;
    color: var(--color-text-light);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 4px;
}

.event-reminder-remove:hover { color: #B0443B; }

.event-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.event-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s;
}

.event-color-swatch:hover { transform: scale(1.15); }

.event-color-swatch.selected { border-color: var(--color-dark); }

/* ========== ДЕТАЛИ СОБЫТИЯ ========== */

.modal-event-detail { max-width: 400px; }

.event-detail-time {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-accent);
    margin-bottom: 8px;
}

.event-detail-desc {
    font-size: 0.9rem;
    color: var(--color-text);
    white-space: pre-wrap;
    margin: 0;
}

/* ========== УГОЛКИ СОБЫТИЙ НА ЯЧЕЙКАХ ========== */

.event-corner {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.event-corner.br { clip-path: polygon(100% 100%, 100% 32%, 32% 100%); }
.event-corner.bl { clip-path: polygon(0 100%, 68% 100%, 0 32%); }
.event-corner.tl { clip-path: polygon(0 0, 0 68%, 68% 0); }
.event-corner.tr { clip-path: polygon(100% 0, 32% 0, 100% 68%); }

/* ========== БЛОК «СОБЫТИЯ» (ближайшие + аккордеон) ========== */

.events-block {
    margin-bottom: 14px;
    padding: 12px 14px;
    background: rgba(127, 149, 118, 0.06);
    border-radius: 12px;
}

.events-block-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-text-light);
    font-weight: 600;
    margin-bottom: 8px;
}

.event-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    margin-bottom: 4px;
    background: var(--color-white);
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
}

.event-list-item:last-child { margin-bottom: 0; }

.event-list-item.hidden-event { display: none; }

.event-list-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.event-list-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.event-list-time { color: var(--color-text-light); white-space: nowrap; }

/* ========== ПОДРАЗДЕЛЫ В ОКНЕ «СОВПАДЕНИЯ» ========== */

.matches-subsection-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-text-light);
    font-weight: 600;
    margin-bottom: 8px;
}

.matches-events { margin-bottom: 14px; }

.matches-events-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.matches-event-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    color: #fff;
    font-size: 0.85rem;
}

.matches-event-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.matches-event-time { opacity: 0.9; white-space: nowrap; }

/* ========== УДАЛЕНИЕ СОБЫТИЯ / КНОПКИ В МОДАЛКАХ ДНЯ ========== */

.btn-event-delete {
    margin-top: 14px;
    width: 100%;
    height: 38px;
    background: #B0443B;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-event-delete:hover { background: #8f352e; }
.btn-event-delete[hidden] { display: none; }

.day-events { flex-shrink: 0; margin-bottom: 12px; }

.day-add-event { flex-shrink: 0; width: 100%; margin-bottom: 12px; }

.matches-add-event { flex-shrink: 0; width: 100%; margin-top: 12px; }