/* ============================================
   TaskReminderPro - Основные стили
   ============================================ */

:root {
    --primary-color: #f07b2d;
    --primary-dark: #d9651f;
    --secondary-color: #95a5a6;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --background: #f7f8fb;
    --surface: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #dee2e6;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    --border-radius: 8px;
}

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

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

/* ============================================
   Страница авторизации
   ============================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: var(--surface);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px;
}

.logo-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    width: 1em;
    height: 1em;
    font-size: 2em; /* Размер относительно h1, который имеет font-size: 2em */
    object-fit: contain;
}

.login-header h1 {
    color: var(--primary-color);
    font-size: 2em;
    margin: 0;
    display: inline-block;
}

.login-header .subtitle {
    color: var(--text-secondary);
    font-size: 1em;
    font-weight: 500;
}

.login-form {
    margin-top: 30px;
}

/* ============================================
   Основная страница задач
   ============================================ */

.header {
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-search {
    position: relative; /* нужно для иконки/кнопки/дропдауна */
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-search input {
    width: 320px;
    padding: 12px 44px 12px 44px; /* место под иконку слева и кнопку справа */
    border: 1px solid var(--border-color);
    border-radius: 999px; /* как на скрине */
    background: #fff;
}

.header-search-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    opacity: 0.55;
    pointer-events: none;
    border-radius: 50%;
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.55);
}
.header-search-icon::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 2px;
    background: rgba(0,0,0,0.55);
    right: -8px;
    bottom: -3px;
    transform: rotate(45deg);
    border-radius: 2px;
}

.header-search-btn {
    padding: 10px 14px;
}

.header-search-btn.btn-primary {
    background: var(--primary-color);
}

/* Кнопка поиска как иконка */
.header-search-btn.icon-only {
    position: absolute;
    right: 6px;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.header-search-btn.icon-only::before {
    content: "⌕";
    font-weight: 800;
    font-size: 18px;
    line-height: 1;
}

/* Выпадающие результаты поиска */
.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.10);
    border-radius: 14px;
    box-shadow: 0 14px 30px rgba(0,0,0,0.12);
    overflow: hidden;
    z-index: 10000;
}
.search-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
}
.search-item:hover {
    background: rgba(0,0,0,0.04);
}
.search-item-title {
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.search-item-meta {
    font-size: 0.9em;
    color: var(--text-secondary);
    white-space: nowrap;
}
.search-empty {
    padding: 12px;
    color: var(--text-secondary);
    text-align: center;
}

/* Подсветка найденной задачи */
.task-card.search-hit {
    outline: 3px solid rgba(240, 123, 45, 0.55);
    outline-offset: 2px;
}
.schedule-item.search-hit {
    outline: 2px solid rgba(240, 123, 45, 0.55);
    outline-offset: 2px;
    border-radius: 10px;
}

/* Меню пользователя */
.header-user {
    position: relative;
}
.user-menu-btn {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 2px solid rgba(0,0,0,0.08);
    background: #e8f3ec;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.user-menu-btn::before {
    content: "⚙";
    font-size: 18px;
    opacity: 0.85;
}
.user-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 210px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.10);
    border-radius: 14px;
    box-shadow: 0 14px 30px rgba(0,0,0,0.12);
    padding: 8px;
    z-index: 10000;
}
.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
}
.user-menu-item:hover {
    background: rgba(0,0,0,0.04);
}
.user-menu-item.danger {
    color: #d9534f;
}
.user-menu-sep {
    height: 1px;
    background: rgba(0,0,0,0.08);
    margin: 6px 4px;
}

/* =========================================================
   Страница настроек (как на скрине)
   ========================================================= */
.settings-layout {
    display: grid;
    grid-template-columns: 260px 1fr 360px;
    gap: 18px;
    align-items: start;
}
.settings-left,
.settings-main,
.settings-right {
    padding: 18px;
}
.settings-title {
    margin: 0;
    font-size: 1.6em;
    font-weight: 800;
    color: var(--text-primary);
}

/* Подзаголовок слева под "Настройки" */
.settings-left-subtitle {
    margin-top: 10px;
    font-family: Calibri, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    font-weight: 600; /* semibold */
    color: var(--text-primary);
}
.settings-section-title {
    margin: 0 0 8px;
    font-size: 1.05em;
    font-weight: 800;
    color: var(--primary-color);
}

/* Заголовок в центре на странице Настройки (semibold) */
.settings-main-title {
    margin: 0 0 8px;
    font-size: 1.05em;
    font-weight: 600; /* semibold */
    color: var(--primary-color);
}
.settings-subtitle {
    margin: 0 0 14px;
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: 1.35;
}
.settings-form .form-group {
    margin-bottom: 12px;
}
.settings-inline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text-primary);
}
.settings-hint {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 0.9em;
}
.settings-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}
.settings-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.settings-label {
    font-weight: 700;
    color: var(--text-primary);
}
.settings-fixed-value {
    font-weight: 800;
    color: #d9534f; /* как на скрине: красная "2" */
}
.settings-bullets {
    margin: 0;
    padding-left: 18px;
    color: var(--text-secondary);
}
.settings-bullets li {
    margin: 6px 0;
}

/* Блок версии на странице настроек (ниже на 100px, Calibri 11) */
.settings-version-block {
    margin-top: calc(100px + 1cm); /* ниже ещё на 1 см */
    text-align: center;
    font-family: Calibri, "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    font-weight: 600; /* semibold */
    line-height: 1.35;
    color: #6E7F80;
}

/* Адаптив */
@media (max-width: 1100px) {
    .settings-layout {
        grid-template-columns: 1fr;
    }
    .settings-left { order: 1; }
    .settings-main { order: 2; }
    .settings-right { order: 3; }
}

/* =========================================================
   Тёмная тема (пересобрано красиво и читабельно)
   - Главная идея: меняем CSS-переменные (фон/текст/рамки),
     тогда вся UI-типографика становится контрастной автоматически.
   ========================================================= */
body.theme-dark {
    /* Палитра как на примере (скрин2): тёмно-синий + мягкий контраст */
    --background: #07101f;          /* общий фон */
    --surface: #0b1628;             /* панели/карточки */
    --text-primary: #e6f0ff;        /* основной текст */
    --text-secondary: rgba(200, 220, 255, 0.72); /* второстепенный текст */
    --border-color: rgba(120, 170, 255, 0.18);
    --shadow: 0 10px 28px rgba(0,0,0,0.45);
    --shadow-lg: 0 18px 46px rgba(0,0,0,0.55);

    background: radial-gradient(1200px 600px at 50% 0%, rgba(25, 60, 120, 0.25) 0%, rgba(7, 16, 31, 1) 55%) , var(--background);
    color: var(--text-primary);
}

/* Панели/карточки */
body.theme-dark .header,
body.theme-dark .panel,
body.theme-dark .sidebar-block,
body.theme-dark .calendar-panel,
body.theme-dark .tasks-container,
body.theme-dark .timeline-panel,
body.theme-dark .task-card {
    background: var(--surface);
}

/* Поля ввода/селекты */
body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea {
    background: #061225;
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Таймлайн */
body.theme-dark .schedule-slot {
    background: var(--surface);
    border-color: rgba(120, 170, 255, 0.10);
}
body.theme-dark .schedule-slot.alt {
    background: rgba(255,255,255,0.02);
}
body.theme-dark .schedule-time {
    /* как на скрине: время с лёгким зелёным оттенком */
    color: rgba(140, 255, 210, 0.55);
}
body.theme-dark .schedule-time.hour {
    color: rgba(140, 255, 210, 0.92);
}
body.theme-dark .schedule-item {
    box-shadow: 0 10px 22px rgba(0,0,0,0.42);
}

/* Шапка "Задачи на день" + дата: делаем читаемо */
body.theme-dark .app-top-right .timeline-header small {
    color: var(--text-primary); /* важное: чтобы дата читалась */
    opacity: 0.95;
}

/* Календарь в тёмной теме (читабельно, как на примере) */
body.theme-dark .calendar-weekdays span,
body.theme-dark .sidebar-title {
    color: var(--text-secondary);
}
body.theme-dark .calendar-cell {
    background: rgba(255,255,255,0.04);
    border-color: rgba(120, 170, 255, 0.14);
    color: var(--text-primary);
}
body.theme-dark .calendar-cell:hover {
    background: rgba(255,255,255,0.06);
}
body.theme-dark .calendar-cell.muted {
    opacity: 0.35;
}
body.theme-dark .calendar-cell.selected {
    background: rgba(240, 123, 45, 0.18);
    border: 1px solid rgba(240, 123, 45, 0.75);
    color: var(--text-primary);
    -webkit-text-fill-color: var(--text-primary);
}
body.theme-dark .calendar-cell.today {
    border: 1px solid rgba(240, 123, 45, 0.75);
}

/* Дропдауны/меню в тёмной теме */
body.theme-dark .user-menu,
body.theme-dark .search-dropdown {
    background: #0b1628;
    border-color: rgba(120, 170, 255, 0.18);
}
body.theme-dark .search-item-meta,
body.theme-dark .search-empty {
    color: var(--text-secondary);
}

/* =========================================================
   Dark: исправление читабельности
   - календарь (дни с подсветкой приоритета)
   - модалки "Создать/Редактировать" (поля и текст)
   ========================================================= */

/* 1) Календарь: дни с задачами (has-tasks-*) — делаем тёмные заливки + читабельный текст */
body.theme-dark .calendar-cell.has-tasks {
    color: var(--text-primary);
    -webkit-text-fill-color: var(--text-primary);
    background: rgba(255,255,255,0.06);
    border-color: rgba(120, 170, 255, 0.18);
}
body.theme-dark .calendar-cell.has-tasks.has-tasks-low {
    background: rgba(255, 193, 7, 0.18);
    border-color: rgba(255, 193, 7, 0.45);
}
body.theme-dark .calendar-cell.has-tasks.has-tasks-medium {
    background: rgba(40, 167, 69, 0.18);
    border-color: rgba(40, 167, 69, 0.45);
}
body.theme-dark .calendar-cell.has-tasks.has-tasks-high {
    background: rgba(220, 53, 69, 0.18);
    border-color: rgba(220, 53, 69, 0.45);
}
body.theme-dark .calendar-cell.has-tasks.has-tasks-mixed {
    background: rgba(66, 63, 231, 0.18);
    border-color: rgba(66, 63, 231, 0.45);
}
/* Выбранный день с задачами: рамка приоритета, но текст остаётся читабельным */
body.theme-dark .calendar-cell.has-tasks.selected {
    color: var(--text-primary);
    -webkit-text-fill-color: var(--text-primary);
}

/* 2) Модалки: текст/поля в dark должны быть контрастными */
body.theme-dark .modal-content {
    background: var(--surface);
    border-color: rgba(120, 170, 255, 0.18);
}
body.theme-dark .modal-header {
    border-bottom-color: rgba(120, 170, 255, 0.14);
}
body.theme-dark .modal-header h2 {
    color: var(--text-primary);
}
body.theme-dark .form-group label {
    color: rgba(233, 238, 245, 0.92);
}

/* Поля внутри форм (с более высокой специфичностью, чтобы не перебивалось "светлыми" правилами) */
body.theme-dark .task-form input,
body.theme-dark .task-form textarea,
body.theme-dark .task-form select {
    background: #061225;
    color: var(--text-primary);
    border-color: rgba(120, 170, 255, 0.18);
}
body.theme-dark .task-form input:focus,
body.theme-dark .task-form textarea:focus,
body.theme-dark .task-form select:focus {
    border-color: rgba(240, 123, 45, 0.85);
    box-shadow: 0 0 0 3px rgba(240, 123, 45, 0.18);
}
body.theme-dark .task-form ::placeholder {
    color: rgba(200, 220, 255, 0.45);
}

/* Приоритет в модалке: не делаем "кислотные" светлые заливки, чтобы текст читался */
body.theme-dark .task-form[data-priority="low"] #taskPriority {
    background: rgba(255, 193, 7, 0.18);
    border-color: rgba(255, 193, 7, 0.55);
    color: var(--text-primary);
}
body.theme-dark .task-form[data-priority="medium"] #taskPriority {
    background: rgba(40, 167, 69, 0.18);
    border-color: rgba(40, 167, 69, 0.55);
    color: var(--text-primary);
}
body.theme-dark .task-form[data-priority="high"] #taskPriority {
    background: rgba(220, 53, 69, 0.18);
    border-color: rgba(220, 53, 69, 0.55);
    color: var(--text-primary);
}

/* 3) Таймлайн (3-я колонка): в dark НЕ используем светлые фоны приоритета */
body.theme-dark .schedule-item {
    background: rgba(11, 22, 40, 0.92);
}
body.theme-dark .schedule-item-title {
    color: var(--text-primary);
}
body.theme-dark .schedule-item-sub {
    color: var(--text-secondary);
}
/* Приоритет — только цветная полоса слева (как акцент) */
body.theme-dark .schedule-item.priority-high {
    background: rgba(11, 22, 40, 0.92);
    box-shadow: inset 4px 0 0 #FD1423, 0 10px 22px rgba(0,0,0,0.42);
}
body.theme-dark .schedule-item.priority-medium {
    background: rgba(11, 22, 40, 0.92);
    box-shadow: inset 4px 0 0 #28A745, 0 10px 22px rgba(0,0,0,0.42);
}
body.theme-dark .schedule-item.priority-low {
    background: rgba(11, 22, 40, 0.92);
    box-shadow: inset 4px 0 0 #FFC107, 0 10px 22px rgba(0,0,0,0.42);
}
/* Бейджи приоритета — контрастные */
body.theme-dark .schedule-item.priority-high .schedule-badge { background: #FD1423; color: #fff; }
body.theme-dark .schedule-item.priority-medium .schedule-badge { background: #28A745; color: #fff; }
body.theme-dark .schedule-item.priority-low .schedule-badge { background: #FFC107; color: #061225; }

/* Зачёркивание в dark должно быть светлым */
body.theme-dark .schedule-item.completed .schedule-item-title {
    text-decoration-color: rgba(233, 238, 245, 0.65);
}

/* Выпадашки (поиск/меню) */
body.theme-dark .user-menu,
body.theme-dark .search-dropdown {
    background: #141722;
    border-color: var(--border-color);
}
body.theme-dark .user-menu-item:hover,
body.theme-dark .search-item:hover {
    background: rgba(255,255,255,0.06);
}

/* Иконка лупы в поиске — светлее */
body.theme-dark .header-search-icon {
    opacity: 0.75;
    box-shadow: inset 0 0 0 2px rgba(233,238,245,0.55);
}
body.theme-dark .header-search-icon::after {
    background: rgba(233,238,245,0.55);
}

/* Приоритетные карточки в dark: не "ядовито", но видно */
body.theme-dark .task-card.priority-high {
    background: rgba(220, 53, 69, 0.14);
    border-color: rgba(220, 53, 69, 0.22);
}
body.theme-dark .task-card.priority-medium {
    background: rgba(40, 167, 69, 0.14);
    border-color: rgba(40, 167, 69, 0.22);
}
body.theme-dark .task-card.priority-low {
    background: rgba(255, 193, 7, 0.14);
    border-color: rgba(255, 193, 7, 0.22);
}

.logo {
    font-size: 1.5em;
    color: var(--primary-color);
    font-weight: 600;
}

/* В слове TaskReminderPro делаем "Pro" курсивом и чуть меньше (по просьбе пользователя) */
.logo .logo-pro {
    font-style: italic;
    font-weight: 600; /* semibold */
    /* "Pro" как степень (superscript) */
    font-size: 0.68em;           /* еще меньше */
    line-height: 1;
    vertical-align: super;       /* приподнять как степень */
    margin-left: 2px;
}

/* На странице входа заголовок без класса .logo, поэтому делаем то же самое отдельно */
.login-header h1 .logo-pro {
    font-style: italic;
    font-weight: 600; /* semibold */
    font-size: 0.68em;
    line-height: 1;
    vertical-align: super;
    margin-left: 2px;
}

.logo-block {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-mark {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    box-shadow: var(--shadow);
    object-fit: contain;
}

.main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* ============================================
   Новый макет (как на скрине: слева календарь, центр список, справа расписание)
   ============================================ */

.app-shell {
    display: grid;
    /* Ресайз правой панели через CSS-переменную (меняется JS), по умолчанию как раньше: 520px */
    --right-pane-width: 520px;
    grid-template-columns: 320px 1fr var(--right-pane-width);
    grid-template-rows: auto 1fr;
    gap: 18px;
    align-items: start;
}

.app-top-left,
.app-top-center,
.app-top-right {
    align-self: start;
    min-width: 0;
}

/* Верхняя линия: центрируем элементы внутри своих колонок */
.app-top-left,
.app-top-center,
.app-top-right {
    display: flex;
    align-items: center;
}
.app-top-left { justify-content: center; }
.app-top-center { justify-content: center; }
.app-top-right { justify-content: center; }

/* Единая "толщина" и шрифт как у кнопки "+ Создать задачу" */
.app-top-left .btn,
.app-top-center .btn,
.app-top-right .timeline-header h3 {
    font-weight: 500;
    font-size: 1em;
    line-height: 1.2;
    min-height: 44px; /* единая "толщина" (высота) */
}

/* Заголовок справа делаем как btn-primary */
.app-top-right .timeline-header h3 {
    margin: 0;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    background: var(--primary-color);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Дата справа — рядом, шрифт как у кнопок (но без заливки) */
.app-top-right .timeline-header small {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 1em;
    line-height: 1.2;
}

/* Вкладка "Месяц" — делаем как btn-primary той же толщины/шрифта */
.sidebar-tabs .tab {
    width: 100%;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    background: var(--primary-color);
    color: #fff;
    font-weight: 500;
    font-size: 1em;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s;
}
.sidebar-tabs .tab:hover {
    background: var(--primary-dark);
}

.sidebar,
.right-pane {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* =========================================================
   РЕСАЙЗЕР между центром и правой панелью (как на скрине)
   - добавляется JS внутрь .right-pane
   - работает только в 3-колоночном режиме (на адаптиве скрываем)
   ========================================================= */

.right-pane {
    position: relative; /* нужно для абсолютного позиционирования ресайзера */
}

.right-pane-resizer {
    position: absolute;
    left: -12px; /* немного залезаем в зазор между колонками, чтобы удобно хватать */
    top: 12px;
    bottom: 12px;
    width: 24px;
    cursor: col-resize;
    z-index: 5;
    touch-action: none; /* важно: чтобы перетаскивание работало на тач-устройствах */
}

.right-pane-resizer::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
}

.right-pane-resizer::after {
    content: "↔";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #1f3d2f;
    background: #cfe9d9;
    border: 2px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 18px rgba(0,0,0,0.10);
}

.right-pane-resizer:hover::after {
    background: #bfe3cf;
}

/* Когда тянем — запрещаем выделение текста и даём единый курсор */
body.is-resizing,
body.is-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}

.main-pane {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sidebar-block {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 14px;
}

.sidebar-title {
    font-weight: 800;
    font-size: 1.1em;
    margin-bottom: 10px;
    text-align: center; /* по скрину: "Календарь" по центру */
}

.sidebar-subtitle .muted {
    color: var(--text-secondary);
    font-size: 0.85em;
}

.sidebar-tabs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 10px;
}

.tab {
    border: 1px solid var(--border-color);
    background: #f6f7f9;
    border-radius: 8px;
    padding: 8px 10px;
    font-weight: 700;
    cursor: pointer;
}

.tab.active {
    background: #fff;
    border-color: rgba(0,0,0,0.08);
}

/* Активная вкладка (оставляем таким же как btn-primary) */
.tab.active {
    background: var(--primary-color);
    color: #fff;
}

.tab:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-block {
    width: 100%;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin: 10px 0 8px;
    color: var(--text-secondary);
    font-size: 0.75em;
    font-weight: 700;
    text-align: center;
}


.sidebar-date-controls {
    margin-bottom: 10px;
}

.sidebar-selected {
    margin-top: 10px;
}

.sidebar-selected-label {
    color: var(--text-secondary);
    font-size: 0.85em;
    margin-bottom: 4px;
    text-align: center; /* по скрину */
}

.sidebar-selected-date {
    font-weight: 800;
    font-size: 0.95em;
    margin-bottom: 6px;
    text-align: center; /* по скрину */
}

/* Левая колонка: кнопка "Сегодня" как на скрине (серый широкий блок) */
.sidebar #todayBtn {
    background: #9aa7a7;
    border-color: #9aa7a7;
    color: #fff;
    font-weight: 800;
    border-radius: 10px;
    padding: 10px 12px;
}
.sidebar #todayBtn:hover {
    background: #879595;
    border-color: #879595;
}

.tasks-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.layout-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.layout-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Выбор даты */
.date-selector {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.date-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.date-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1em;
    flex: 1;
    min-width: 150px;
}

.date-display h2 {
    font-size: 1.5em;
    margin-bottom: 5px;
}

.task-count {
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* Действия с задачами */
.task-actions {
    margin-bottom: 20px;
}

/* Список задач */
.tasks-container {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    /* Не фиксируем высоту — контейнер должен быть "как на макете" и по содержимому */
    min-height: 0;
    /* Убираем возможную "ручку" изменения размера (как у textarea), если её где-то включает браузер/стили */
    resize: none;
    overflow: visible;
}

.tasks-container.highlight-pulse {
    animation: pulseBorder 1.2s ease;
}

@keyframes pulseBorder {
    0% { box-shadow: 0 0 0 0 rgba(52,152,219,0.6); }
    70% { box-shadow: 0 0 0 8px rgba(52,152,219,0); }
    100% { box-shadow: 0 0 0 0 rgba(52,152,219,0); }
}

/* Контейнер для нескольких напоминаний (стеком справа снизу) */
.reminder-toasts {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
    pointer-events: none; /* клики только по самому toast */
}

/* Модалка "Задачи на день" */
.day-tasks-modal {
    max-width: 720px;
}

.day-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 0 4px;
}

.day-task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    background: var(--surface);
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.day-task-item:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.day-task-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.day-task-time {
    font-weight: 700;
    min-width: 52px;
}

.day-task-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.day-task-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.day-task-priority {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.85em;
    font-weight: 700;
    background: #f2f2f2;
}

.day-task-priority.low { background: #fff7db; color: #b07b00; }
.day-task-priority.medium { background: #e7f8ed; color: #1c7c36; }
.day-task-priority.high { background: #ffe8ea; color: #b3121f; }

.task-count {
    cursor: pointer;
    user-select: none;
}

.task-count:hover {
    text-decoration: underline;
}

.day-empty-click:hover {
    box-shadow: var(--shadow);
}

/* Пустое состояние в окне "Напоминания на ..." */
.day-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 6px 0 2px;
}

.day-empty-text {
    color: #004242;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    margin-top: -4px; /* чуть выше */
}

.day-create-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center; /* симметрично по центру */
    gap: 8px;
    min-width: 280px;
}

.day-create-plus {
    font-size: 18px;
    line-height: 1;
    font-weight: 800;
}

/* Toast напоминания */
.reminder-toast {
    /* Цвета мигания (по умолчанию = высокий приоритет) */
    --reminder-bg-1: #FDF5E6;
    --reminder-bg-2: #FD1423;
    --reminder-border: #FD1423;
    --reminder-shadow-1: rgba(253, 20, 35, 0.45);
    --reminder-shadow-2: rgba(253, 20, 35, 0.40);

    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    color: #2c3e50;
    padding: 14px 42px 14px 16px; /* справа место под крестик */
    border-radius: 10px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.18);
    border: 1px solid var(--reminder-border);
    animation: reminderBlink 0.6s ease-in-out infinite alternate;
    font-weight: 600;
    position: relative;
    pointer-events: auto;
}

/* Приоритеты (второй цвет мигания) */
.reminder-toast.reminder-priority-low {
    --reminder-bg-2: #FFC107;
    --reminder-border: #FFC107;
    --reminder-shadow-1: rgba(255, 193, 7, 0.45);
    --reminder-shadow-2: rgba(255, 193, 7, 0.40);
}

.reminder-toast.reminder-priority-medium {
    --reminder-bg-2: #28A745;
    --reminder-border: #28A745;
    --reminder-shadow-1: rgba(40, 167, 69, 0.45);
    --reminder-shadow-2: rgba(40, 167, 69, 0.40);
}

.reminder-toast.reminder-priority-high {
    --reminder-bg-2: #FD1423;
    --reminder-border: #FD1423;
    --reminder-shadow-1: rgba(253, 20, 35, 0.45);
    --reminder-shadow-2: rgba(253, 20, 35, 0.40);
}

.reminder-close {
    position: absolute;
    top: 6px;
    right: 10px;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 8px;
    background: rgba(255,255,255,0.25);
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.reminder-close:hover {
    background: rgba(255,255,255,0.35);
}

.reminder-icon {
    font-size: 20px;
}

@keyframes reminderBlink {
    0% { transform: scale(1); box-shadow: 0 0 0 0 var(--reminder-shadow-1); background: var(--reminder-bg-1); }
    100% { transform: scale(1.05); box-shadow: 0 0 14px 4px var(--reminder-shadow-2); background: var(--reminder-bg-2); color: #fff; }
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.task-card {
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    transition: all 0.3s;
    position: relative;
}

/* Подложка карточек по приоритету (как на примере) */
.task-card.priority-high {
    background: #F8D7DA;
    border-color: rgba(253, 20, 35, 0.25);
}
.task-card.priority-medium {
    background: #D1F2DA;
    border-color: rgba(40, 167, 69, 0.25);
}
.task-card.priority-low {
    background: #FFF4C2;
    border-color: rgba(255, 193, 7, 0.30);
}

.task-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.task-card.completed {
    opacity: 0.7;
    background: #f8f9fa;
}

/* Выполнено: зачёркиваем текст (колонка 2) */
.task-card.completed .task-title {
    text-decoration: line-through;
    text-decoration-thickness: 1px; /* тонкая линия */
    text-decoration-color: rgba(0,0,0,0.55);
}

/* Просрочено по времени: подчёркиваем КРАСНЫМ (но только если не выполнено) */
.task-card.overdue:not(.completed) .task-title {
    text-decoration: underline;
    text-decoration-thickness: 1px; /* тонкая линия */
    text-decoration-color: #d9534f; /* красный */
}

/* Таймлайн (колонка 3): выполнено = зачёркнуто, просрочено = красное подчёркивание */
.schedule-item.completed .schedule-item-title {
    text-decoration: line-through;
    text-decoration-thickness: 1px; /* тонкая линия */
    text-decoration-color: rgba(0,0,0,0.55);
}
.schedule-item.overdue:not(.completed) .schedule-item-title {
    text-decoration: underline;
    text-decoration-thickness: 1px; /* тонкая линия */
    text-decoration-color: #d9534f;
}

.task-card.priority-high {
    border-left: 4px solid var(--danger-color);
}

.task-card.priority-medium {
    border-left: 4px solid var(--success-color);
}

.task-card.priority-low {
    border-left: 4px solid var(--warning-color);
}

.task-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 10px;
}

.task-checkbox {
    margin-top: 3px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Меню действий по клику на квадратик задачи: "Выполнено" / "Отложить" */
.task-status-menu {
    position: absolute;
    z-index: 9999;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
    padding: 6px;
    min-width: 140px;
}
.task-status-menu-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 10px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
}
.task-status-menu-item:hover {
    background: rgba(0,0,0,0.05);
}

.task-content {
    flex: 1;
}

.task-title {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.task-description {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 10px;
}

.task-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 10px;
}

.task-remind-at {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.priority-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.priority-badge.high {
    background: #fee;
    color: var(--danger-color);
}

.priority-badge.medium {
    background: #efe;
    color: var(--success-color);
}

.priority-badge.low {
    background: #fffbee;
    color: #f39c12;
}

.task-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.tag {
    display: inline-block;
    padding: 4px 8px;
    background: #e9ecef;
    color: var(--text-primary);
    border-radius: 12px;
    font-size: 0.8em;
}

.task-actions-buttons {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 5px;
    opacity: 1; /* показываем всегда (пользователю нужно видеть карандаш/корзину постоянно) */
    transition: opacity 0.2s;
    /* Иконки справа сверху как на скрине */
    flex-direction: row;
    align-items: center;
}

/* hover-правило больше не нужно, но оставим нейтральным (на случай старых стилей) */
.task-card:hover .task-actions-buttons { opacity: 1; }

.btn-icon-small {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(0,0,0,0.10);
    cursor: pointer;
    padding: 6px 8px;
    color: rgba(0,0,0,0.65);
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 14px; /* показываем emoji-иконки */
    line-height: 1;
}

.btn-icon-small:hover {
    background: rgba(255, 255, 255, 0.9);
    color: rgba(0,0,0,0.9);
    transform: translateY(-1px);
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
    opacity: 0.3;
}

/* Мини-календарь */
.calendar-panel {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 16px;
}

.calendar-header {
    /* по скрину: стрелка — месяц — стрелка, месяц строго по центру */
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: capitalize;
}

#calMonthLabel {
    text-align: center;
    font-weight: 800;
}

/* Серые "плитки" стрелок как на скрине */
.calendar-header .btn.btn-icon,
.calendar-header #calPrevBtn,
.calendar-header #calNextBtn {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
    background: #f1f3f5;
    border: 1px solid rgba(0,0,0,0.08);
    color: rgba(0,0,0,0.55);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.calendar-header .btn.btn-icon:hover,
.calendar-header #calPrevBtn:hover,
.calendar-header #calNextBtn:hover {
    background: #e9ecef;
}

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

.calendar-cell {
    border: 1px solid var(--border-color);
    border-radius: 10px; /* более округлые клетки */
    padding: 10px 0;
    background: #f7f8fa;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 400; /* одинаковый обычный шрифт для всех дней */
}

.calendar-cell.other {
    color: var(--text-secondary);
    background: #f1f3f5;
}

.calendar-cell.today {
    border: 1px solid var(--primary-color);
    font-weight: 400; /* не выделяем шрифтом, только рамкой */
}

.calendar-cell.selected {
    background: #e8f3ff;
    border: 1px solid var(--primary-color);
    color: #00308F;
    -webkit-text-fill-color: #00308F; /* для некоторых браузеров, где color игнорируется на кнопках */
    font-weight: 700;
}

.calendar-cell.has-tasks {
    /* День, в котором есть задачи */
    background: #fff7db;
    border: 1px solid rgba(0,0,0,0.10);
    font-weight: 400; /* цифры не жирные, как во всем календаре */
}

.calendar-cell.has-tasks.has-tasks-low {
    /* Светлый оттенок #FFC107 */
    background: #FFF4C2;
    color: var(--text-primary); /* число как у остальных дней */
    border-color: rgba(255, 193, 7, 0.55);
    box-shadow: inset 0 -4px 0 #FFC107;
}

.calendar-cell.has-tasks.has-tasks-medium {
    /* Светлый оттенок #28A745 */
    background: #D1F2DA;
    color: var(--text-primary); /* число как у остальных дней */
    border-color: rgba(40, 167, 69, 0.55);
    box-shadow: inset 0 -4px 0 #28A745;
}

.calendar-cell.has-tasks.has-tasks-high {
    /* Светлый оттенок #FD1423 */
    background: #FFD6DA;
    color: var(--text-primary); /* число как у остальных дней */
    border-color: rgba(253, 20, 35, 0.50);
    box-shadow: inset 0 -4px 0 #FD1423;
}

.calendar-cell.has-tasks.has-tasks-mixed {
    /* Светлый оттенок #423FE7 (комбинированные задачи) */
    background: #E2E1FF;
    color: var(--text-primary); /* число как у остальных дней */
    border-color: rgba(66, 63, 231, 0.55);
    box-shadow: inset 0 -4px 0 #423FE7;
}

/* Выбранный день с задачами: рамка должна быть ЦВЕТОМ ПРИОРИТЕТА (не синей темой) */
.calendar-cell.has-tasks.has-tasks-low.selected {
    background: #FFF4C2;
    border: 2px solid #FFC107;
    color: #00308F;
    font-weight: 700;
}

.calendar-cell.has-tasks.has-tasks-medium.selected {
    background: #D1F2DA;
    border: 2px solid #28A745;
    color: #00308F;
    font-weight: 700;
}

.calendar-cell.has-tasks.has-tasks-high.selected {
    background: #FFD6DA;
    border: 2px solid #FD1423;
    color: #00308F;
    font-weight: 700;
}

.calendar-cell.has-tasks.has-tasks-mixed.selected {
    background: #E2E1FF;
    border: 2px solid #423FE7;
    color: #00308F;
    font-weight: 700;
}

.calendar-cell:hover {
    /* День под курсором: выделяем число, но НЕ ломаем фон приоритета */
    color: #00308F;
    -webkit-text-fill-color: #00308F;
    font-weight: 700;
    border-color: rgba(0, 48, 143, 0.35);
}

/* Для обычных (без задач) дней можно слегка подсветить фон при наведении */
.calendar-cell:hover:not(.has-tasks):not(.selected) {
    background: #eef5ff;
}

/* При навигации с клавиатуры (Tab) — тоже выделяем как "под курсором" */
.calendar-cell:focus-visible {
    outline: none;
    border: 2px solid var(--primary-color);
    color: #00308F;
    -webkit-text-fill-color: #00308F;
    font-weight: 700;
}

/* Фолбэк для браузеров/сценариев, где focus-visible не срабатывает */
.calendar-cell:focus {
    outline: none;
    border: 2px solid var(--primary-color);
    color: #00308F;
    -webkit-text-fill-color: #00308F;
    font-weight: 700;
}

.calendar-legend {
    margin-top: 10px;
    display: flex;
    gap: 12px;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.legend-item {
    width: 10px;
    height: 10px;
    display: inline-block;
    border-radius: 50%;
    margin-right: 4px;
}

.today-dot {
    background: var(--primary-color);
}

.selected-dot {
    background: #f39c12;
}

/* Таймлайн справа */
.timeline-panel {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 16px;
    min-height: 200px;
}

/* Правый блок "расписание" (тайм-слоты) */
.schedule {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 0;
    padding-left: 6px;
}

.schedule-row {
    display: contents;
}

.schedule-time {
    padding: 8px 8px 8px 0;
    color: var(--text-secondary);
    font-size: 0.85em;
    text-align: right;
}

.schedule-time.hour {
    font-weight: 800;
    color: #2c3e50;
}

.schedule-slot {
    border-top: 1px solid rgba(0,0,0,0.04);
    min-height: 34px;
    padding: 4px 0 4px 10px;
    position: relative;
    border-left: 3px solid rgba(240, 123, 45, 0.55); /* вертикальная линия как на скрине */
}

.schedule-slot.alt { /* полосатость */
    background: rgba(0,0,0,0.02);
}

/* Конец суток (24:00): визуальная метка, не интерактивный слот */
.schedule-slot.end-of-day {
    background: transparent;
    cursor: default;
}

.schedule-item {
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
    max-width: 100%;
}

.schedule-item-title {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.schedule-item-sub {
    font-size: 0.82em;
    color: rgba(0,0,0,0.55);
    margin-top: 2px;
}

.schedule-badge {
    font-size: 0.75em;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.schedule-item.priority-high {
    background: #F8D7DA;
    box-shadow: inset 4px 0 0 #FD1423, 0 2px 8px rgba(0,0,0,0.06);
}
.schedule-item.priority-high .schedule-badge { background: #FD1423; color: #fff; }

.schedule-item.priority-medium {
    background: #D1F2DA;
    box-shadow: inset 4px 0 0 #28A745, 0 2px 8px rgba(0,0,0,0.06);
}
.schedule-item.priority-medium .schedule-badge { background: #28A745; color: #fff; }

.schedule-item.priority-low {
    background: #FFF4C2;
    box-shadow: inset 4px 0 0 #FFC107, 0 2px 8px rgba(0,0,0,0.06);
}
.schedule-item.priority-low .schedule-badge { background: #FFC107; color: #1f2d2d; }

.timeline-header {
    display: flex;
    flex-direction: row; /* заголовок + дата в одной строке */
    align-items: baseline;
    justify-content: flex-start; /* без разнесения по краям */
    gap: 10px; /* небольшое расстояние между текстами */
    margin-bottom: 12px;
}

.timeline-header h3 {
    font-size: 1.05em;
    margin: 0; /* чтобы не было лишних отступов и дата шла сразу */
}

.timeline-header small {
    /* Как в левой колонке (дата выделена) */
    color: var(--text-primary);
    font-weight: 800;
    font-size: 0.95em;
}

.timeline-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Скролл как на скрине */
.right-pane .timeline-list {
    max-height: 620px;
    overflow-y: auto;
    padding-right: 6px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fafbfc;
}

.timeline-time {
    font-weight: 700;
    color: var(--text-primary);
}

.timeline-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.timeline-desc {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.timeline-item.priority-high {
    border-left: 4px solid var(--danger-color);
}
.timeline-item.priority-medium {
    border-left: 4px solid var(--success-color);
}
.timeline-item.priority-low {
    border-left: 4px solid var(--warning-color);
}

.empty-timeline {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px 0;
}

/* Напоминание доп-поля */
.form-row .date-time-input {
    width: 100%;
}

.converted-hint {
    display: block;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 0.85em;
}

/* =========================================================
   Модалка "Создать задачу" как на скрине: Дата + От + До
   ========================================================= */

.form-row.triple {
    display: grid;
    grid-template-columns: 1fr 140px 140px;
    gap: 12px;
    align-items: end;
}

/* Дата + Время (без "До") */
.form-row.double {
    display: grid;
    grid-template-columns: 1fr 180px;
    gap: 12px;
    align-items: end;
}

/* На узких экранах складываем в столбик */
@media (max-width: 520px) {
    .form-row.triple {
        grid-template-columns: 1fr;
    }
    .form-row.double {
        grid-template-columns: 1fr;
    }
}

.task-advanced {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0,0,0,0.12);
}

.task-advanced > summary {
    cursor: pointer;
    font-weight: 800;
    color: rgba(0,0,0,0.65);
    list-style: none;
    margin-bottom: 10px;
}
.task-advanced > summary::-webkit-details-marker { display: none; }
.task-advanced > summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 8px;
    transform: translateY(-1px);
}
.task-advanced[open] > summary::before { content: "▾"; }

/* Тёмная тема: "Установить напоминания" должен быть светлым и читабельным */
body.theme-dark .task-advanced {
    border-top-color: rgba(120, 170, 255, 0.14);
}
body.theme-dark .task-advanced > summary {
    color: rgba(233, 238, 245, 0.92);
    font-weight: 600; /* semibold */
}
body.theme-dark .task-advanced > summary:hover {
    color: rgba(233, 238, 245, 1);
}

/* =========================================================
   О программе: "лист бумаги" по центру + фон вокруг (как на скрине)
   ========================================================= */
.about-page {
    /* фон вокруг "листа" — фирменный, но мягкий */
    background:
        radial-gradient(900px 420px at 50% 0%, rgba(240, 123, 45, 0.12) 0%, rgba(240, 123, 45, 0.00) 60%),
        var(--background);
}
.about-content {
    padding-top: 28px;
    padding-bottom: 36px;
}
.about-wrap {
    display: flex;
    justify-content: center;
}
.about-paper {
    position: relative;
    width: min(920px, 100%);
    background: #fff; /* лист бумаги */
    color: #2c3e50;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 14px 38px rgba(0,0,0,0.10);
}
/* Тень "у нижнего края листа", как на примере */
.about-paper::after {
    content: "";
    position: absolute;
    left: 6%;
    right: 6%;
    bottom: -18px;
    height: 28px;
    background: rgba(0,0,0,0.22);
    filter: blur(18px);
    border-radius: 999px;
    pointer-events: none;
}
.about-paper-inner {
    padding: 28px 36px 34px;
}
.about-h2 {
    margin: 4px 0 14px;
    font-size: 1.55em;
    font-weight: 800;
    color: #d9534f; /* одинаковым "красным" цветом */
}
.about-h3 {
    margin: 18px 0 10px;
    font-size: 1.08em;
    font-weight: 800;
    color: #d9534f; /* одинаковым "красным" цветом */
}
.about-p {
    margin: 0 0 14px;
    color: rgba(44, 62, 80, 0.72);
    line-height: 1.55;
}
.about-p-last {
    margin-bottom: 0;
}

@media (max-width: 760px) {
    .about-paper-inner {
        padding: 20px 18px 22px;
    }
}

/* =========================================================
   Профиль: дизайн "лист по центру" (как скрин 3)
   ========================================================= */
.profile-page {
    background:
        radial-gradient(900px 420px at 50% 0%, rgba(240, 123, 45, 0.10) 0%, rgba(240, 123, 45, 0.00) 60%),
        var(--background);
}
.profile-content {
    padding-top: 28px;
    padding-bottom: 36px;
}
.profile-wrap {
    display: flex;
    justify-content: center;
}
.profile-paper {
    position: relative;
    width: min(920px, 100%);
    background: #fff;
    color: #2c3e50;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 14px 38px rgba(0,0,0,0.10);
}
.profile-paper::after {
    content: "";
    position: absolute;
    left: 6%;
    right: 6%;
    bottom: -18px;
    height: 28px;
    background: rgba(0,0,0,0.22);
    filter: blur(18px);
    border-radius: 999px;
    pointer-events: none;
}
.profile-paper-inner {
    padding: 28px 36px 28px;
}
.profile-h2 {
    margin: 0 0 8px;
    font-size: 1.55em;
    font-weight: 800;
    color: #d9534f;
}
.profile-h3 {
    margin: 20px 0 10px;
    font-size: 1.08em;
    font-weight: 800;
    color: #d9534f;
}
.profile-subtitle {
    margin: 0 0 14px;
    color: rgba(44, 62, 80, 0.70);
    line-height: 1.55;
}
.profile-form .form-group {
    margin-bottom: 14px;
}
.profile-form .form-group label {
    display: block;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 6px;
}
.profile-form input,
.profile-form select {
    width: 100%;
    padding: 12px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.12);
    background: #fff;
    color: #2c3e50;
}
.profile-form input:focus,
.profile-form select:focus {
    outline: none;
    border-color: rgba(240, 123, 45, 0.85);
    box-shadow: 0 0 0 3px rgba(240, 123, 45, 0.18);
}
.profile-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
.profile-footer {
    margin-top: 22px;
    padding-top: 14px;
    border-top: 1px solid rgba(0,0,0,0.08);
    text-align: center;
    font-family: Calibri, "Segoe UI", Arial, sans-serif;
    font-size: 11px;
    line-height: 1.35;
    color: #6E7F80;
}

@media (max-width: 760px) {
    .profile-paper-inner {
        padding: 20px 18px 20px;
    }
}

/* =========================================================
   Подсветка приоритета в модалке (как цветная плашка на скрине)
   ========================================================= */

.task-form[data-priority="low"] #taskPriority {
    background: #FFF4C2; /* светлый #FFC107 */
    border-color: rgba(255, 193, 7, 0.55);
    box-shadow: inset 0 -4px 0 #FFC107;
}

.task-form[data-priority="medium"] #taskPriority {
    background: #D1F2DA; /* светлый #28A745 */
    border-color: rgba(40, 167, 69, 0.55);
    box-shadow: inset 0 -4px 0 #28A745;
}

.task-form[data-priority="high"] #taskPriority {
    background: #FFD6DA; /* светлый #FD1423 */
    border-color: rgba(253, 20, 35, 0.50);
    box-shadow: inset 0 -4px 0 #FD1423;
}

/* =========================
   Адаптивность по фактическим px (по вашим скринам debug):
   - <= 1354px: 2 колонки сверху (левый + центр), правый блок уходит вниз
   - <= 846px:  1 колонка (все блоки друг под другом)
   ========================= */

/* <= 1354px и >= 847px: 2 колонки (левый + центр), правый блок переносим вниз */
@media (max-width: 1354px) and (min-width: 847px) {
    .header-search input {
        width: 220px;
    }
    .app-shell {
        grid-template-columns: 300px 1fr !important; /* важно: ровно 2 колонки сверху */
    }
    .right-pane {
        grid-column: 1 / -1 !important; /* важно: перенос вниз на всю ширину */
        display: block !important;
    }
}

/* <= 846px: 1 колонка */
@media (max-width: 846px) {
    .header-content {
        flex-wrap: wrap;
        gap: 10px;
    }
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    .header-search {
        flex: 1;
    }
    .header-search input {
        width: 100%;
        min-width: 0;
    }
    .app-shell {
        grid-template-columns: 1fr !important; /* важно: 1 колонка */
    }
    .sidebar,
    .main-pane,
    .right-pane {
        grid-column: 1 / -1;
    }
    .right-pane {
        display: block !important;
        grid-column: 1 / -1 !important;
    }
}

/* ============================================
   Модальное окно
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    background: var(--surface);
    border-radius: var(--border-radius);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    z-index: 1001;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.5em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--background);
    color: var(--text-primary);
}

.task-form {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.3s;
    background-color: #ffffff;
    color: var(--text-primary);
}

/* Убеждаемся, что поле пароля выглядит точно так же как поле логина */
.form-group input[type="password"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.reminder-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.date-time-input {
    flex: 1;
    min-width: 150px;
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    font-size: 0.9em;
}

.tag-chip .remove {
    cursor: pointer;
    font-weight: bold;
}

.tags-suggestions {
    margin-top: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tag-suggestion {
    padding: 5px 10px;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.3s;
}

.tag-suggestion:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.comments-list {
    margin-bottom: 15px;
    max-height: 200px;
    overflow-y: auto;
}

.comment {
    padding: 10px;
    background: var(--background);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
}

.comment-text {
    margin-bottom: 5px;
}

.comment-date {
    font-size: 0.8em;
    color: var(--text-secondary);
}

.comment-form textarea {
    margin-bottom: 10px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
}

/* ============================================
   Кнопки
   ============================================ */

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1em;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

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

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 1.5em;
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.9em;
}

/* ============================================
   Формы
   ============================================ */

.form-group {
    margin-bottom: 15px;
}

.error-message {
    background: #fee;
    color: var(--danger-color);
    padding: 12px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    border: 1px solid var(--danger-color);
}

.success-message {
    background: #efe;
    color: var(--success-color);
    padding: 12px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    border: 1px solid var(--success-color);
}

/* ============================================
   Уведомления
   ============================================ */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    max-width: 300px;
    animation: slideIn 0.3s;
}

.notification.success {
    border-left: 4px solid var(--success-color);
}

.notification.error {
    border-left: 4px solid var(--danger-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   Адаптивность
   ============================================ */

@media (max-width: 768px) {
    .main-content {
        padding: 15px 10px;
    }
    
    .header-content {
        padding: 0 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .date-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-input {
        width: 100%;
    }
    
    .task-actions-buttons {
        position: static;
        opacity: 1;
        margin-top: 10px;
    }
    
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        max-height: 95vh;
    }
}

/* =========================================================
   ФИНАЛЬНЫЕ ПРАВИЛА СЕТКИ (перебивают всё выше по файлу)
   Диапазоны:
   - 1200px..830px: 3 столбца
   - 830px..620px: 2 столбца сверху, правый блок уходит вниз
   - < 620px: 1 столбец
   ========================================================= */

.app-shell {
    grid-template-areas:
        "top-left top-center top-right"
        "sidebar main right";
}
.app-top-left { grid-area: top-left; }
.app-top-center { grid-area: top-center; }
.app-top-right { grid-area: top-right; }
.sidebar { grid-area: sidebar; }
.main-pane { grid-area: main; }
.right-pane { grid-area: right; }

@media (max-width: 1354px) {
    .app-shell {
        grid-template-columns: 300px 1fr !important; /* 2 колонки сверху */
        grid-template-areas:
            "top-left top-center"
            "sidebar main"
            "top-right top-right"
            "right right"; /* правый блок вниз */
    }
    .right-pane {
        display: block !important;
        grid-column: 1 / -1 !important;
    }
    /* На 2-колоночном режиме (правый блок снизу) ресайзер не нужен */
    .right-pane-resizer { display: none !important; }
}

@media (max-width: 846px) {
    .app-shell {
        grid-template-columns: 1fr !important; /* 1 колонка */
        grid-template-areas:
            "top-left"
            "top-center"
            "top-right"
            "sidebar"
            "main"
            "right";
    }
    .right-pane {
        display: block !important;
        grid-column: 1 / -1 !important;
    }
    /* На мобилке ресайзер не нужен */
    .right-pane-resizer { display: none !important; }
}

