        /* Детали выполненной задачи: десктоп — модалка, мобиле — sheet */
        .done-detail-overlay {
            position: fixed;
            inset: 0;
            background: rgba(11, 15, 25, 0.55);
            z-index: 255;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transition: opacity 0.28s ease, visibility 0.28s ease;
        }
        .done-detail-overlay.active {
            opacity: 1;
            visibility: visible;
            pointer-events: auto;
        }
        .done-detail-panel {
            width: min(520px, 100%);
            max-height: min(86vh, 720px);
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-lg);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .done-detail-grab {
            display: none;
        }
        .done-detail-head {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 10px;
            padding: 16px 16px 10px;
            border-bottom: 1px solid var(--border-subtle);
            flex-shrink: 0;
        }
        .done-detail-head h3 {
            font-size: var(--fs-lg);
            font-weight: 700;
            line-height: 1.35;
            margin: 0;
            word-break: break-word;
        }
        .done-detail-body {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            overscroll-behavior: contain;
            padding: 14px 16px;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        .done-meta-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
        }
        .done-meta-item {
            background: var(--bg-subtle);
            border: 1px solid var(--border-subtle);
            border-radius: 10px;
            padding: 8px 10px;
        }
        .done-meta-item .lbl {
            display: block;
            font-size: var(--fs-xs);
            font-weight: 600;
            color: var(--text-muted);
            margin-bottom: 2px;
        }
        .done-meta-item .val {
            font-size: var(--fs-base);
            font-weight: 700;
            color: var(--text-primary);
        }
        .done-detail-footer {
            flex-shrink: 0;
            padding: 12px 16px;
            border-top: 1px solid var(--border);
            display: flex;
            justify-content: flex-end;
            gap: 8px;
            flex-wrap: wrap;
        }
        .done-detail-footer .btn-restore-work {
            margin-right: auto;
        }
        @media (max-width: 1024px) {
            .done-detail-overlay {
                align-items: flex-end;
                justify-content: stretch;
                padding: 0;
                background: rgba(11, 15, 25, 0.72);
            }
            .done-detail-panel {
                width: 100%;
                max-width: none;
                max-height: min(92dvh, 92vh, calc(var(--app-height, 100dvh) - 8px));
                border-radius: 20px 20px 0 0;
                border: none;
                border-top: 1px solid var(--border);
                transform: translateY(110%);
                transition: transform 0.36s cubic-bezier(0.32, 0.72, 0, 1);
            }
            .done-detail-overlay.active .done-detail-panel {
                transform: translateY(0);
            }
            .done-detail-panel.is-dragging {
                transition: none;
            }
            .done-detail-grab {
                display: block;
                flex-shrink: 0;
                padding: 8px 16px 4px;
                touch-action: none;
                user-select: none;
                cursor: grab;
            }
            .done-detail-grab .task-sheet-handle {
                margin: 0 auto;
            }
            .done-detail-grab-hint {
                text-align: center;
                font-size: var(--fs-xs);
                color: var(--text-muted);
                margin-top: 6px;
            }
            .done-detail-head .btn-icon-only {
                display: none;
            }
            .done-detail-footer {
                padding-bottom: max(12px, env(safe-area-inset-bottom));
                flex-direction: column-reverse;
            }
            .done-detail-footer button {
                width: 100%;
                min-height: 44px;
                justify-content: center;
            }
            .done-detail-footer .btn-restore-work {
                margin-right: 0;
            }
            .done-meta-grid {
                grid-template-columns: 1fr;
            }
            .done-chip .done-chip-title {
                max-width: min(220px, 55vw);
            }
        }

        /* ИИ-ассистент */
        .ai-assist-overlay {
            position: fixed;
            inset: 0;
            z-index: 280;
            background: rgba(15, 18, 28, 0.55);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px 16px;
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transition: opacity 0.2s ease, visibility 0.2s ease;
        }
        .ai-assist-overlay.active {
            opacity: 1;
            visibility: visible;
            pointer-events: auto;
        }
        .ai-assist-modal {
            width: min(520px, 100%);
            max-height: min(78vh, 640px);
            background: var(--bg-card, #fff);
            color: var(--text-primary);
            border-radius: 18px;
            border: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
            box-shadow: 0 18px 48px rgba(0,0,0,0.22);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .ai-assist-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 16px 18px 10px;
        }
        .ai-assist-head h3 {
            margin: 0;
            font-size: var(--fs-lg);
            font-weight: 700;
        }
        .ai-assist-body {
            padding: 4px 18px 14px;
            overflow-y: auto;
            font-size: var(--fs-md);
            line-height: 1.45;
            color: var(--text-secondary);
        }
        .ai-assist-body .ai-headline {
            font-size: var(--fs-ml);
            font-weight: 650;
            color: var(--text-primary);
            margin: 0 0 10px;
        }
        .ai-assist-body ul {
            margin: 0;
            padding-left: 1.15em;
        }
        .ai-assist-body li { margin: 0.35em 0; }
        .ai-assist-body .ai-warn {
            margin-top: 12px;
            padding: 10px 12px;
            border-radius: 12px;
            background: rgba(220, 120, 40, 0.12);
            color: var(--text-primary);
        }
        .ai-assist-footer {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            justify-content: flex-end;
            padding: 12px 18px 16px;
            border-top: 1px solid var(--border-subtle, rgba(0,0,0,0.06));
        }
        .ai-assist-footer:empty { display: none; }

        /* ===== Deep Focus (Canva) — полная концепция ===== */
        .focus-help {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            gap: 10px;
            margin-top: 8px;
            padding-top: 4px;
        }
        .focus-help-toggle {
            appearance: none;
            border: 0;
            background: transparent;
            color: var(--text-muted);
            font: inherit;
            font-size: var(--fs-sm);
            font-weight: 600;
            padding: 8px 4px;
            margin: 0 auto;
            cursor: pointer;
            text-decoration: none;
            text-align: center;
        }
        .focus-help-toggle:hover { color: var(--accent); }
        .focus-help.is-open .focus-help-toggle { color: var(--accent); }
        .focus-ai-bar {
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            align-items: center;
            justify-content: center;
            gap: 8px;
            margin: 0;
            width: 100%;
        }
        .focus-ai-bar[hidden] { display: none !important; }
        .focus-ai-chip {
            appearance: none;
            flex: 0 0 auto;
            border: 1px solid var(--border-subtle);
            background: var(--bg-panel);
            color: var(--text-secondary);
            border-radius: 999px;
            padding: 7px 12px;
            font: inherit;
            font-size: var(--fs-xs);
            font-weight: 650;
            cursor: pointer;
            line-height: 1.2;
            white-space: nowrap;
        }
        .focus-ai-chip:hover {
            color: var(--accent);
            border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
            background: var(--accent-soft);
        }
        .focus-ai-chip:disabled {
            opacity: 0.55;
            cursor: wait;
        }
        .focus-ai-hint {
            margin: 0;
            width: 100%;
            padding: 10px 12px;
            border-radius: var(--radius-md, 14px);
            background: var(--bg-subtle, #e8ebf2);
            border: 0;
            color: var(--text-primary);
            font-size: var(--fs-sm);
            line-height: 1.45;
        }
        .focus-ai-hint[hidden] { display: none !important; }
        .visually-hidden {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
        }
        .focus-clarify-sec + .focus-clarify-sec { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(127,127,127,.18); }
        .focus-clarify-label { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; opacity: .6; margin-bottom: 3px; }
        .focus-clarify-btn { margin-top: 6px; }

        /* Фокус: полноэкранная сцена, центрированная колонка (макет «Глубокий Фокус») */
        body.focus-open {
            overflow: hidden;
        }
        .focus-overlay {
            position: fixed;
            inset: 0;
            background: var(--bg-app);
            z-index: 260;
            display: flex;
            justify-content: center;
            align-items: stretch;
            padding: 0;
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transition: opacity 0.28s ease, visibility 0.28s ease;
        }
        .focus-overlay.active {
            opacity: 1;
            visibility: visible;
            pointer-events: auto;
        }

        .focus-modal {
            position: relative;
            width: 100%;
            max-width: 560px;
            height: 100%;
            max-height: 100%;
            margin: 0 auto;
            background: var(--bg-app);
            border: none;
            border-radius: 0;
            padding: 0;
            box-shadow: none;
            display: flex;
            flex-direction: column;
            gap: 0;
            overflow: hidden;
        }

        .focus-modal-scroll {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            overscroll-behavior: contain;
            padding: 4px 22px max(28px, env(safe-area-inset-bottom));
            display: flex;
            flex-direction: column;
            gap: 0;
            max-width: 440px;
            width: 100%;
            margin: 0 auto;
            box-sizing: border-box;
        }

        .focus-stage-wrap {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            width: 100%;
            min-width: 0;
        }

        /* legacy desk-grid: collapse to single column concept */
        .focus-desk-grid {
            display: flex;
            flex-direction: column;
            gap: 18px;
            width: 100%;
            min-width: 0;
        }

        .focus-sheet-grab {
            display: none;
            flex-shrink: 0;
            padding: 10px 16px 2px;
            cursor: grab;
            touch-action: none;
            user-select: none;
        }

        .focus-topbar {
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 10px 16px 2px;
            padding-top: max(10px, env(safe-area-inset-top));
            max-width: 440px;
            width: 100%;
            margin: 0 auto;
            box-sizing: border-box;
        }
        .focus-back-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 40px;
            height: 40px;
            min-height: 40px;
            padding: 0;
            border-radius: 12px;
            border: 0;
            background: transparent;
            color: var(--text-secondary);
            font-size: var(--fs-sm);
            font-weight: 650;
            cursor: pointer;
        }
        .focus-back-btn:hover {
            background: var(--bg-subtle, rgba(15,23,42,.04));
            color: var(--text-primary);
        }
        .focus-back-btn .icon {
            width: 18px;
            height: 18px;
        }
        .focus-live-pill {
            display: inline-flex;
            align-items: center;
            gap: 7px;
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: var(--text-muted);
            padding: 4px 2px;
            border-radius: 0;
            background: transparent;
            border: 0;
            margin: 0 auto;
        }
        .focus-live-pill[hidden] { display: none !important; }
        .focus-live-pill .dot {
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background: var(--text-muted);
            flex-shrink: 0;
        }
        .focus-live-pill.is-live {
            color: #dc2626;
            background: transparent;
            border: 0;
        }
        .focus-live-pill.is-live .dot {
            background: #dc2626;
            box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45);
            animation: focus-live-ping 1.8s ease-out infinite;
        }
        .focus-live-pill.is-paused {
            color: #d97706;
            background: transparent;
            border: 0;
        }
        .focus-live-pill.is-paused .dot {
            background: #d97706;
            animation: none;
        }
        @keyframes focus-live-ping {
            0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
            70% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
            100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
        }

        .focus-head-row { display: none; }

        .focus-close-btn {
            width: 40px;
            height: 40px;
            border-radius: 12px;
            border: 0;
            background: transparent;
            color: var(--text-muted);
            padding: 0;
            flex-shrink: 0;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
        }
        .focus-close-btn:hover {
            background: var(--bg-subtle, rgba(15,23,42,.04));
            color: var(--text-primary);
        }
        .focus-close-btn .icon {
            width: 18px;
            height: 18px;
        }

        .focus-footer-bar { display: none !important; }

        .focus-kicker {
            margin: 6px 0 8px;
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--text-muted);
            text-align: left;
        }

        .focus-cta-row {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            gap: 10px;
            width: 100%;
            margin: 0;
        }
        .focus-start-btn {
            width: 100%;
            min-height: 52px;
            justify-content: center;
            padding: 14px 18px;
            font-size: 15px;
            font-weight: 750;
            border-radius: 999px;
            border: none;
            box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 28%, transparent);
            gap: 8px;
        }
        .focus-start-btn:hover {
            box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 34%, transparent);
        }
        .focus-start-btn .icon {
            width: 16px;
            height: 16px;
        }
        .focus-done-btn {
            width: 100%;
            min-height: 44px;
            justify-content: center;
            padding: 10px 12px;
            font-size: 14px;
            font-weight: 650;
            border-radius: 999px;
            border: 1px solid var(--border-subtle);
            background: transparent;
            color: var(--text-secondary);
            gap: 6px;
            cursor: pointer;
        }
        .focus-done-btn:hover {
            background: var(--bg-panel);
            color: var(--text-primary);
            border-color: var(--border);
        }
        .focus-done-btn .icon {
            width: 15px;
            height: 15px;
        }

        .focus-modal.is-dragging {
            transition: none !important;
        }

        .focus-sheet-handle {
            width: 40px;
            height: 4px;
            border-radius: 99px;
            background: var(--border);
            margin: 0 auto;
            flex-shrink: 0;
        }

        .focus-hero {
            display: flex;
            flex-direction: column;
            gap: 6px;
            padding-top: 2px;
            text-align: left;
            align-items: stretch;
        }

        .focus-task-title {
            font-size: clamp(1.35rem, 4.5vw, 1.65rem);
            text-align: left;
            font-weight: 800;
            letter-spacing: -0.03em;
            line-height: 1.25;
            margin: 0 0 10px;
            padding-right: 0;
            color: var(--text-primary);
            word-break: break-word;
            max-width: none;
        }

        .focus-task-meta {
            display: flex;
            flex-wrap: wrap;
            justify-content: flex-start;
            align-items: center;
            gap: 8px 10px;
            margin: 0 0 14px;
            font-size: 13px;
            font-weight: 600;
            color: var(--text-muted);
            line-height: 1.4;
        }
        .focus-meta-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--accent);
            flex-shrink: 0;
        }
        .focus-meta-realm {
            color: var(--accent);
            font-weight: 700;
        }
        .focus-meta-item { color: var(--text-muted); font-weight: 550; font-style: italic; }
        .focus-meta-sep { opacity: 0.55; font-style: normal; }
        .focus-task-meta .badge {
            font-size: inherit;
            font-weight: inherit;
            border-radius: 0;
            padding: 0;
            background: transparent;
            border: 0;
            color: var(--text-muted);
        }
        .focus-task-meta .badge.type-main {
            background: transparent;
            color: var(--text-muted);
            border: 0;
        }

        .focus-task-desc {
            text-align: left;
            max-width: none;
            width: 100%;
            margin: 0 0 16px;
            display: block;
            font-size: 13px;
            line-height: 1.45;
            color: var(--text-secondary);
            white-space: pre-wrap;
            background: var(--bg-subtle, #e8ebf2);
            border-radius: var(--radius-md, 14px);
            padding: 12px 14px;
            box-sizing: border-box;
            cursor: pointer;
        }
        .focus-task-desc.is-empty {
            color: var(--text-muted);
            font-style: italic;
            font-weight: 500;
        }
        .focus-task-desc[hidden] { display: none !important; }
        .focus-desc-edit {
            display: block;
            width: 100%;
            min-height: 72px;
            margin: 0;
            padding: 0;
            border: 0;
            background: transparent;
            color: var(--text-primary);
            font: inherit;
            font-size: 13px;
            line-height: 1.45;
            resize: vertical;
            box-sizing: border-box;
            outline: none;
            white-space: pre-wrap;
        }

        .focus-stage {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            gap: 16px;
            padding: 0;
        }

        .focus-timer-panel {
            display: flex;
            flex-direction: column;
            gap: 16px;
            padding: 8px 0 0;
            border-radius: 0;
            background: transparent;
            border: 0;
            box-shadow: none;
            width: 100%;
            align-items: stretch;
        }

        .timer-readout {
            font-family: var(--td-font-sans) ;
            font-size: clamp(3.4rem, 14vw, 4.25rem);
            font-weight: 800;
            text-align: center;
            color: var(--text-primary);
            letter-spacing: -0.04em;
            line-height: 1;
            padding: 6px 0 4px;
            font-variant-numeric: tabular-nums;
        }

        .focus-timer-actions {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: stretch;
            gap: 10px;
        }

        .focus-preset-row {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 8px;
            width: 100%;
            padding: 0;
            border-radius: 0;
            background: transparent;
        }

        .focus-preset-btn {
            flex: 1 1 0;
            min-width: 0;
            min-height: 44px;
            border-radius: 14px;
            border: 0;
            background: var(--bg-subtle, #e8ebf2);
            color: var(--text-primary);
            font-weight: 750;
            font-size: 11px;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            padding: 10px 8px;
            cursor: pointer;
            line-height: 1.2;
        }
        .focus-preset-btn:hover {
            color: var(--text-primary);
            background: color-mix(in srgb, var(--bg-subtle, #e8ebf2) 70%, var(--accent-soft));
        }
        .focus-preset-btn.is-active {
            border: 0;
            color: #fff;
            background: var(--accent);
            box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 28%, transparent);
        }
        .focus-preset-label { display: block; }

        .focus-preset-more-wrap {
            position: relative;
            display: flex;
            justify-content: center;
            flex: 0 0 auto;
            margin: -4px 0 0;
            padding: 0;
        }
        .focus-preset-more {
            min-width: 0;
            width: auto;
            min-height: 32px;
            padding: 4px 12px;
            font-weight: 600;
            font-size: 12px;
            letter-spacing: 0;
            text-transform: none;
            color: var(--text-muted);
            background: transparent !important;
            box-shadow: none !important;
            white-space: nowrap;
        }
        .focus-preset-more.is-active {
            color: var(--accent) !important;
            background: transparent !important;
        }
        .focus-preset-more:focus-visible {
            outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
            outline-offset: 1px;
        }
        .focus-duration-menu {
            position: absolute;
            top: calc(100% + 8px);
            left: 50%;
            transform: translateX(-50%);
            z-index: 40;
            display: flex;
            flex-wrap: wrap;
            gap: 4px;
            justify-content: center;
            width: max-content;
            max-width: min(320px, calc(100vw - 32px));
            min-width: 0;
            padding: 8px;
            border-radius: 18px;
            background: var(--bg-panel);
            border: 1px solid var(--border-subtle);
            box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
            box-sizing: border-box;
        }
        .focus-duration-menu[hidden] { display: none !important; }
        .focus-duration-opt {
            appearance: none;
            flex: 0 0 auto;
            min-height: 34px;
            border: 0;
            border-radius: 999px;
            background: var(--bg-subtle, #e8ebf2);
            color: var(--text-secondary);
            font: inherit;
            font-size: var(--fs-sm);
            font-weight: 700;
            padding: 6px 12px;
            cursor: pointer;
            white-space: nowrap;
            line-height: 1.2;
        }
        .focus-duration-opt:hover {
            color: var(--text-primary);
            background: color-mix(in srgb, var(--bg-subtle, #e8ebf2) 70%, var(--accent-soft));
        }
        .focus-duration-opt.is-active {
            color: #fff;
            background: var(--accent);
            box-shadow: none;
        }

        .focus-modal .subtasks-box {
            background: transparent;
            border: 0;
            border-radius: 0;
            padding: 0 0 6px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            box-shadow: none;
            border-top: 0;
            margin-bottom: 8px;
        }
        .focus-subtasks-head { display: none; }
        .focus-subtasks-title { display: none; }
        .focus-subtasks-progress { display: none; }
        .focus-subtasks-list {
            display: flex;
            flex-direction: column;
            gap: 0;
            width: 100%;
        }
        .focus-subtasks-empty { display: none; }
        .focus-subtasks-empty-hint {
            display: block;
            padding: 6px 0 10px;
            font-size: 13px;
            line-height: 1.4;
            color: var(--text-muted);
            font-style: italic;
        }
        .focus-modal .subtask-row {
            background: transparent;
            border: 0;
            border-bottom: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.08));
            border-radius: 0;
            padding: 10px 0;
            color: var(--text-primary);
            gap: 10px;
            cursor: default;
            transition: background 0.15s ease;
        }
        .focus-modal .subtask-row:last-child { border-bottom: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.08)); }
        .focus-modal .subtask-row:hover {
            border-color: var(--border-subtle, rgba(15, 23, 42, 0.08));
            background: transparent;
        }
        .focus-modal .subtask-row .subtask-row-main {
            display: flex;
            align-items: center;
            gap: 10px;
            flex: 1;
            min-width: 0;
            font-size: 14px;
            font-weight: 500;
        }



        /* Мобильный sheet деталей задачи (снизу вверх, как режим работы) */
        .task-sheet-overlay {
            position: fixed;
            inset: 0;
            background: rgba(11, 15, 25, 0.72);
            z-index: 250;
            display: flex;
            align-items: flex-end;
            justify-content: stretch;
            padding: 0;
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transition: opacity 0.28s ease, visibility 0.28s ease;
        }
        .task-sheet-overlay.active {
            opacity: 1;
            visibility: visible;
            pointer-events: auto;
        }
        .task-sheet {
            width: 100%;
            max-height: min(92dvh, 92vh, calc(var(--app-height, 100dvh) - 8px));
            background: var(--bg-panel);
            border-radius: 20px 20px 0 0;
            border-top: 1px solid var(--border);
            box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.28);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            transform: translateY(110%);
            transition: transform 0.36s cubic-bezier(0.32, 0.72, 0, 1);
            touch-action: pan-y;
        }
        .task-sheet-overlay.active .task-sheet {
            transform: translateY(0);
        }
        .task-sheet.is-dragging {
            transition: none;
        }
        .task-sheet-grab {
            flex-shrink: 0;
            padding: 12px 16px 10px;
            cursor: grab;
            touch-action: none;
            user-select: none;
        }
        .task-sheet-handle {
            width: 40px;
            height: 4px;
            border-radius: 99px;
            background: var(--border);
            margin: 0 auto;
        }
        .task-sheet-grab-hint {
            display: none;
        }
        .task-sheet-scroll {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            overscroll-behavior: contain;
            padding: 4px 16px 14px;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        .task-sheet-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
        }
        .task-sheet-status {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            flex-wrap: wrap;
            min-width: 0;
        }
        .task-sheet-status-pill {
            display: inline-flex;
            align-items: center;
            font-size: var(--fs-xs);
            font-weight: 650;
            letter-spacing: 0;
            text-transform: none;
            padding: 4px 9px;
            border-radius: 999px;
            background: var(--accent-soft);
            color: var(--accent);
            white-space: nowrap;
        }
        .task-sheet-status-dot {
            width: 4px;
            height: 4px;
            border-radius: 50%;
            background: var(--text-muted);
            flex-shrink: 0;
        }
        .task-sheet-close {
            width: 32px;
            height: 32px;
            border: none;
            border-radius: 50%;
            background: transparent;
            color: var(--text-muted);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            flex-shrink: 0;
            padding: 0;
        }
        .task-sheet-close:hover {
            background: var(--bg-subtle);
            color: var(--text-primary);
        }
        .task-sheet-close .icon {
            width: 18px;
            height: 18px;
        }
        .task-sheet-title {
            font-size: var(--fs-lg);
            font-weight: 750;
            line-height: 1.3;
            word-break: break-word;
            margin: 0;
            color: var(--text-primary);
        }
        .task-sheet-desc {
            font-size: var(--fs-sm);
            color: var(--text-secondary);
            line-height: 1.45;
            white-space: pre-wrap;
        }
        .task-sheet-steps {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .task-sheet-steps .drawer-step-row {
            padding: 8px 10px;
            background: var(--bg-subtle);
            border: 1px solid var(--border);
            color: var(--text-primary);
        }
        .task-sheet-steps .drawer-step-row span {
            color: var(--text-primary);
        }
        .task-sheet-steps .drawer-step-row.done span {
            color: var(--text-muted);
        }
        .task-sheet-chips {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-wrap: wrap;
        }
        .task-sheet-chips .attr-chip,
        .task-sheet-chips .mini-chip {
            font-size: var(--fs-xs);
            padding: 6px 10px;
            border-radius: 999px;
        }
        .task-sheet-footer {
            flex-shrink: 0;
            display: flex;
            flex-wrap: wrap;
            align-items: stretch;
            gap: 8px;
            padding: 10px 16px max(14px, env(safe-area-inset-bottom));
            border-top: none;
            background: var(--bg-panel);
            box-shadow: none;
        }
        .task-sheet-footer.is-single {
            display: flex;
        }
        .task-sheet-chips .task-sheet-delete-chip {
            width: 34px;
            height: 34px;
            padding: 0;
            border-radius: 999px;
            border: 1px solid rgba(220, 38, 38, 0.28);
            background: var(--danger-soft);
            color: var(--danger);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }
        .task-sheet-chips .task-sheet-delete-chip:hover {
            background: rgba(220, 38, 38, 0.16);
            border-color: rgba(220, 38, 38, 0.45);
        }
        .task-sheet-chips .task-sheet-delete-chip .icon {
            width: 14px;
            height: 14px;
        }
        .task-sheet-footer-row {
            display: contents;
        }
        .task-sheet-footer-row button,
        .task-sheet-footer > button {
            flex: 1 1 calc(50% - 4px);
            min-width: min(100%, 8.5rem);
            min-height: 48px;
            justify-content: center;
            padding: 10px 12px;
            font-size: var(--fs-base);
            font-weight: 700;
            border-radius: 12px;
            border: none;
            white-space: nowrap;
        }
        .task-sheet-footer.is-single > button,
        .task-sheet-footer.is-single .task-sheet-footer-row button {
            flex: 1 1 100%;
        }
        .task-sheet-footer .btn-success {
            background: var(--success);
            border-color: var(--success);
            color: #fff;
        }
        .task-sheet-footer .btn-success:hover {
            background: #047857;
            border-color: #047857;
            color: #fff;
        }
        .task-sheet-footer .btn-primary {
            width: auto;
            min-height: 48px;
            justify-content: center;
            background: var(--accent);
            color: #fff;
        }
        @media (max-width: 380px) {
            .task-sheet-footer-row button,
            .task-sheet-footer > button {
                font-size: var(--fs-sm);
                padding: 10px 8px;
            }
        }
        /* Шторка задачи — только мобиль/планшет; на десктопе раскрытие в строке */
        @media (min-width: 1025px) {
            .task-sheet-overlay { display: none !important; }
        }


        /* Deep Focus desktop ≥1025px — та же концепция, что на мобиле */
        @media (min-width: 1025px) {
            .focus-overlay {
                align-items: stretch;
                justify-content: center;
                padding: 0;
                background: var(--bg-app);
                -webkit-backdrop-filter: none;
                backdrop-filter: none;
            }
            .focus-modal {
                width: 100%;
                max-width: none;
                height: 100%;
                max-height: none;
                margin: 0;
                background: var(--bg-app);
                border: none;
                border-radius: 0;
                box-shadow: none;
                display: flex;
                flex-direction: column;
            }
            .focus-sheet-grab { display: none !important; }
            .focus-topbar {
                max-width: 420px;
                width: 100%;
                margin: 0 auto;
                padding: 20px 8px 4px;
                border-bottom: 0;
                box-sizing: border-box;
            }
            .focus-back-btn,
            .focus-close-btn {
                width: 40px;
                height: 40px;
            }
            .focus-modal-scroll {
                max-width: 420px;
                width: 100%;
                margin: 0 auto;
                padding: 8px 8px 48px;
                box-sizing: border-box;
                display: flex;
                flex-direction: column;
            }
            .focus-stage-wrap {
                display: flex;
                flex-direction: column;
                align-items: stretch;
                width: 100%;
                gap: 0;
            }
            .focus-desk-grid {
                display: flex !important;
                flex-direction: column;
                grid-template-columns: none;
                grid-template-areas: none;
                gap: 0;
            }
            .focus-desk-grid > .focus-hero,
            .focus-desk-grid > .focus-stage,
            .focus-desk-grid > .subtasks-box {
                grid-area: auto;
            }
            .focus-kicker {
                margin: 8px 0 10px;
                text-align: left;
            }
            .focus-task-title {
                text-align: left;
                max-width: none;
                font-size: clamp(1.45rem, 1.8vw, 1.7rem);
                font-weight: 800;
                margin: 0 0 10px;
            }
            .focus-task-meta {
                justify-content: flex-start;
                margin: 0 0 14px;
            }
            .focus-task-desc {
                text-align: left;
                max-width: none;
                width: 100%;
                margin: 0 0 16px;
                font-size: 13px;
                background: var(--bg-subtle, #e8ebf2);
                border-radius: var(--radius-md, 14px);
                padding: 12px 14px;
            }
            .focus-stage {
                position: static !important;
                top: auto;
                border: 0 !important;
                border-left: 0 !important;
                background: transparent !important;
                padding: 0 !important;
                margin: 0 !important;
                align-items: stretch;
                min-height: 0;
            }
            .focus-timer-panel {
                display: flex;
                flex-direction: column;
                align-items: stretch;
                gap: 16px;
                padding: 8px 0 0;
                width: 100%;
            }
            .focus-timer-actions {
                align-items: stretch;
            }
            .focus-preset-row {
                display: grid !important;
                grid-template-columns: repeat(3, minmax(0, 1fr));
                gap: 8px;
                width: 100%;
                padding: 0;
                border-radius: 0;
                background: transparent !important;
                align-self: stretch;
            }
            .focus-preset-btn {
                min-height: 44px;
                border-radius: 14px;
                background: var(--bg-subtle, #e8ebf2);
                color: var(--text-primary);
                font-size: 11px;
                font-weight: 750;
                letter-spacing: 0.04em;
                text-transform: uppercase;
                box-shadow: none;
            }
            .focus-preset-btn.is-active {
                color: #fff !important;
                background: var(--accent) !important;
                box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 28%, transparent);
            }
            .focus-preset-more-wrap {
                justify-content: center;
                align-self: center;
            }
            .focus-preset-more {
                background: transparent !important;
                color: var(--text-muted) !important;
                box-shadow: none !important;
            }
            .focus-preset-more.is-active {
                color: var(--accent) !important;
                background: transparent !important;
            }
            .focus-duration-menu {
                left: 50%;
                right: auto;
                transform: translateX(-50%);
            }
            .timer-readout {
                font-size: clamp(3.6rem, 5vw, 4.25rem);
                text-align: center;
                padding: 6px 0 4px;
            }
            .focus-cta-row {
                max-width: none;
                width: 100%;
                margin: 0;
                display: flex;
                flex-direction: column;
                gap: 10px;
            }
            .focus-start-btn {
                width: 100%;
                min-height: 52px;
                border-radius: 999px;
                font-size: 15px;
            }
            .focus-done-btn {
                width: 100%;
                min-height: 44px;
                border-radius: 999px;
                border: 1px solid var(--border-subtle);
                background: transparent;
                color: var(--text-secondary);
            }
            .focus-done-btn:hover {
                background: var(--bg-panel);
                color: var(--text-primary);
            }
            .focus-modal .subtasks-box {
                border-top: 0;
                padding-top: 0;
                margin-top: 0;
                margin-bottom: 8px;
            }
            .focus-modal .subtask-row {
                border-bottom: 1px solid var(--border-subtle, rgba(15, 23, 42, 0.08));
                padding: 10px 0;
            }
            .focus-help {
                align-items: stretch;
                margin-top: 8px;
            }
            .focus-ai-bar {
                justify-content: center;
            }
            .focus-footer-bar { display: none !important; }
            #focusAudioContainer {
                width: 100%;
                justify-content: flex-start;
            }
        }


        .focus-modal .subtask-row .subtask-row-main input[type="checkbox"] {
            width: 18px;
            height: 18px;
            accent-color: var(--accent);
            flex-shrink: 0;
        }
        .focus-modal .subtask-row.done .subtask-row-main span {
            opacity: 0.55;
            text-decoration: line-through;
        }
        .focus-subtask-add {
            display: flex;
            gap: 8px;
            align-items: center;
            margin-top: 4px;
        }
        .focus-subtask-add .field-with-mic {
            flex: 1;
            min-width: 0;
        }
        .focus-subtask-add input {
            width: 100%;
            min-height: 40px;
            border-radius: 12px;
            border: 1px solid var(--border-subtle);
            background: var(--bg-panel);
            padding: 8px 40px 8px 12px;
            font: inherit;
            font-size: var(--fs-sm);
        }
        .focus-subtask-add input:focus {
            outline: none;
            border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
        }
        .focus-subtask-add > button {
            flex-shrink: 0;
            min-height: 40px;
            border-radius: 12px;
            border: 0;
            background: var(--bg-subtle, #e8ebf2);
            color: var(--text-secondary);
            font-weight: 650;
            font-size: var(--fs-sm);
            padding: 8px 12px;
            cursor: pointer;
        }
        .focus-subtask-add > button:hover {
            color: var(--accent);
            background: var(--accent-soft);
        }


        /* Модальное окно настроек */
        .modal-backdrop {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.65);
            z-index: 90;
            display: none;
            justify-content: center;
            align-items: center;
            padding: 16px;
        }
        .modal-backdrop.active {
            display: flex;
        }

        #settingsModal.modal-backdrop {
            z-index: 280;
            background: rgba(15, 23, 42, 0.42);
            -webkit-backdrop-filter: blur(2px);
            backdrop-filter: blur(2px);
        }

        .modal-dialog {
            background: var(--bg-panel);
            border: 1px solid var(--border-subtle);
            border-radius: 18px;
            max-width: 460px;
            width: 100%;
            padding: 22px 24px 20px;
            display: flex;
            flex-direction: column;
            gap: 18px;
            box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
            max-height: min(88vh, 720px);
            overflow: hidden;
        }

        .settings-grab {
            display: none;
        }
        .settings-sheet-head {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 10px;
            flex-shrink: 0;
        }
        .settings-sheet-head h3 {
            font-size: var(--fs-xl);
            font-weight: 800;
            letter-spacing: -0.02em;
            color: var(--text-primary);
            margin: 0;
        }
        #settingsModal .settings-sheet-head .btn-icon-only {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            border: 1px solid var(--border-subtle);
            background: var(--bg-subtle);
            color: var(--text-muted);
            padding: 0;
        }
        #settingsModal .settings-sheet-head .btn-icon-only:hover {
            background: var(--bg-card-hover);
            color: var(--text-primary);
        }
        .settings-sheet-body {
            display: flex;
            flex-direction: column;
            gap: 16px;
            min-height: 0;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            overscroll-behavior: contain;
        }
        .settings-lead {
            font-size: var(--fs-base);
            line-height: 1.45;
            color: var(--text-secondary);
            margin: 0;
        }
        .settings-hint {
            font-size: var(--fs-sm);
            color: var(--text-muted);
            margin: 0;
        }
        /* Смена по дням недели */
        .ww-grid { display: flex; flex-direction: column; gap: 4px; }
        .ww-row { display: flex; align-items: center; gap: 6px; min-height: 30px; }
        .ww-day {
            width: 40px; height: 28px; flex-shrink: 0; padding: 0; margin: 0;
            border-radius: 8px; border: 1px solid #c7d2fe; background: #eef2ff; color: #4338ca;
            font-size: 12px; font-weight: 750; cursor: pointer; box-shadow: none;
        }
        .ww-row.is-off .ww-day { background: transparent; border-color: var(--border, #e2e8f0); color: var(--text-muted); }
        #settingsModal .ww-time {
            width: 86px; height: 28px; padding: 0 6px; margin: 0;
            border: 1px solid transparent; border-radius: 8px; background: var(--bg-subtle);
            font-size: 13px; font-weight: 650; color: var(--text-primary); font-family: inherit; font-variant-numeric: tabular-nums;
            box-shadow: none;
        }
        #settingsModal .ww-time:focus { outline: none; border-color: #6366f1; }
        .ww-sep { color: var(--text-muted); font-size: 12px; }
        .ww-off { display: none; font-size: 12px; color: var(--text-muted); }
        .ww-row.is-off .ww-time, .ww-row.is-off .ww-sep { display: none; }
        .ww-row.is-off .ww-off { display: inline; }
        html[data-theme="dark"] .ww-day { background: rgba(99, 102, 241, 0.18); border-color: rgba(129, 140, 248, 0.45); color: #c7d2fe; }
        html[data-theme="dark"] .ww-row.is-off .ww-day { background: transparent; border-color: rgba(56, 56, 56, 0.95); color: #71717a; }
        html[data-theme="dark"] #settingsModal .ww-time { color-scheme: dark; }
        #settingsModal .tz-select {
            width: 100%; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid transparent;
            background: var(--bg-subtle); color: var(--text-primary); font-size: 13px; font-weight: 600;
        }
        #settingsModal .tz-select:focus { outline: none; border-color: #6366f1; }
        .tz-hint { margin-top: 6px; }
        .tz-use {
            border: 0; background: none; padding: 0; margin: 0; color: #4f46e5; font: inherit; font-weight: 700;
            cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
        }
        html[data-theme="dark"] .tz-use { color: #a5b4fc; }
        .cal-day.is-offday:not(.is-peek):not(.is-today) { color: var(--text-muted); opacity: 0.75; }
        .settings-hours-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }
        .settings-field-label {
            font-size: var(--fs-xs);
            color: var(--text-secondary);
            display: block;
            margin-bottom: 6px;
            font-weight: 600;
        }
        #settingsModal .settings-hours-grid input,
        #settingsModal #remindMinutesInput {
            width: 100%;
            border: 1px solid transparent;
            background: var(--bg-subtle);
            border-radius: 10px;
            padding: 10px 12px;
            font-size: var(--fs-md);
            font-weight: 650;
            color: var(--text-primary);
            box-shadow: none;
        }
        #settingsModal .settings-hours-grid input:focus,
        #settingsModal #remindMinutesInput:focus {
            outline: none;
            border-color: rgba(37, 99, 235, 0.45);
            background: var(--bg-panel);
            box-shadow: 0 0 0 3px var(--accent-soft);
        }
        #settingsModal #remindMinutesInput {
            max-width: 120px;
        }
        .settings-sheet-footer {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            flex-shrink: 0;
            padding-top: 2px;
        }
        #settingsModal .settings-sheet-footer button {
            min-height: 40px;
            padding: 0 16px;
            border-radius: 10px;
            font-weight: 700;
        }
        #settingsModal .settings-sheet-footer button:not(.btn-primary) {
            background: var(--bg-subtle);
            border: 1px solid var(--border);
            color: var(--text-primary);
        }
        #settingsModal .settings-sheet-footer .btn-primary {
            box-shadow: 0 6px 16px rgba(37, 99, 235, 0.22);
        }
        .settings-remind-block {
            margin-top: 2px;
            padding-top: 16px;
            border-top: 1px solid var(--border-subtle);
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        .settings-remind-title {
            font-size: var(--fs-md);
            font-weight: 800;
            color: var(--text-primary);
            letter-spacing: -0.01em;
        }
        .settings-check {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            font-size: var(--fs-base);
            color: var(--text-primary);
            cursor: pointer;
            font-weight: 550;
            line-height: 1.35;
        }
        .settings-check input {
            margin-top: 2px;
            flex-shrink: 0;
            width: 16px;
            height: 16px;
            accent-color: var(--accent);
        }
        .settings-link-btn {
            align-self: flex-start;
            border: none;
            background: transparent;
            color: var(--accent);
            font-family: inherit;
            font-size: var(--fs-sm);
            font-weight: 700;
            padding: 0;
            cursor: pointer;
            box-shadow: none;
        }
        /* Статус уведомлений на этом устройстве (настройки) */
        .push-status {
            display: flex;
            flex-direction: column;
            gap: 8px;
            padding: 10px 12px;
            border-radius: 12px;
            border: 1px solid var(--border-subtle);
            background: var(--bg-subtle);
            color: var(--text-primary);
            font-size: var(--fs-sm);
            line-height: 1.4;
        }
        .push-status-line { font-weight: 700; }
        .push-status-note { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 500; }
        .push-status-note[hidden], .push-status-actions [hidden] { display: none !important; }
        .push-status-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; }
        .push-status-actions:empty { display: none; }
        .push-status.is-ok { background: rgba(5, 150, 105, 0.08); border-color: rgba(5, 150, 105, 0.35); }
        .push-status.is-ok .push-status-line { color: var(--success); }
        .push-status.is-warn { background: rgba(217, 119, 6, 0.09); border-color: rgba(217, 119, 6, 0.35); }
        .push-status.is-warn .push-status-line { color: #b45309; }
        .push-status.is-bad { background: rgba(220, 38, 38, 0.08); border-color: rgba(220, 38, 38, 0.35); }
        .push-status.is-bad .push-status-line { color: var(--danger); }
        html[data-theme="dark"] .push-status.is-warn .push-status-line { color: #fbbf24; }
        html[data-theme="dark"] .push-status.is-ok { background: rgba(52, 211, 153, 0.08); }
        html[data-theme="dark"] .push-status.is-bad { background: rgba(248, 113, 113, 0.08); }
        .settings-link-btn:disabled { opacity: 0.5; cursor: default; text-decoration: none; }
        .settings-link-btn:hover {
            color: var(--accent-hover);
            text-decoration: underline;
            background: transparent;
            border: none;
        }

        /* Уведомления — справа под шапкой (не поверх topbar), поверх модалок и оверлеев */
        .toast {
            position: fixed;
            top: var(--toast-top, calc(env(safe-area-inset-top, 0px) + 80px));
            right: var(--toast-right, 16px);
            left: auto;
            bottom: auto;
            width: max-content;
            max-width: min(320px, calc(100vw - 24px));
            box-sizing: border-box;
            display: flex;
            align-items: center;
            gap: 10px;
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-left: 3px solid var(--accent);
            padding: 8px 12px;
            border-radius: 8px;
            box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
            font-size: var(--fs-sm);
            font-weight: 500;
            line-height: 1.35;
            z-index: 10050;
            opacity: 0;
            transform: translateX(24px);
            pointer-events: none;
            overflow: hidden;
            transition: opacity 0.18s ease, transform 0.22s ease;
        }
        .toast.show {
            opacity: 1;
            transform: translateX(0);
        }
        .toast-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
        /* Тост с отменой: текст и маленькая кнопка в одну строку + тонкая полоска времени */
        .toast.has-action { padding-bottom: 10px; }
        .toast.show.has-action { pointer-events: auto; }
        .toast-action-btn {
            flex: 0 0 auto;
            align-self: center;
            height: 26px;
            padding: 2px 10px;
            border: 1px solid var(--accent);
            border-radius: 6px;
            background: transparent;
            color: var(--accent);
            font-family: inherit;
            font-size: var(--fs-sm);
            font-weight: 600;
            line-height: 1;
            white-space: nowrap;
            cursor: pointer;
            -webkit-tap-highlight-color: transparent;
            transition: background 0.15s ease, box-shadow 0.15s ease;
        }
        .toast-action-btn:hover {
            background: rgba(37, 99, 235, 0.1);
            background: color-mix(in srgb, var(--accent) 12%, transparent);
        }
        .toast-action-btn:focus-visible {
            outline: none;
            box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.4);
            box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent);
        }
        .toast-action-btn:active { transform: scale(0.97); }
        .toast-progress {
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            height: 2px;
            background: var(--accent);
            opacity: 0.8;
            transform-origin: left center;
            animation: toastProgress var(--toast-ms, 6000ms) linear forwards;
        }
        @keyframes toastProgress {
            from { transform: scaleX(1); }
            to { transform: scaleX(0); }
        }
        @media (max-width: 1024px) {
            .toast { --toast-right: 12px; }
        }
        @media (prefers-reduced-motion: reduce) {
            .toast { transition: opacity 0.15s ease; }
        }

        .task-date-row {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            margin-top: 4px;
        }

        .task-date-row .task-date-label {
            font-size: var(--fs-xs);
            font-weight: 600;
            color: var(--text-secondary);
        }

        .task-plan-bar {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 6px;
            margin-top: 6px;
        }
        .task-plan-bar .date-picker-btn {
            flex: 0 1 auto;
            min-width: 0;
            min-height: 30px;
            padding: 3px 8px;
            font-size: var(--fs-xs);
            background: var(--bg-subtle);
            border-color: var(--border);
        }
        .task-plan-bar .date-picker-btn.has-value {
            border-color: rgba(37, 99, 235, 0.35);
            background: var(--bg-panel);
        }
        .task-plan-bar .date-picker-btn .icon {
            width: 12px;
            height: 12px;
        }
        .task-plan-bar .task-recur-select {
            flex: 1 1 110px;
            min-width: 0;
            min-height: 30px;
            padding: 3px 8px;
            font-size: var(--fs-xs);
            font-weight: 600;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: var(--bg-subtle);
            color: var(--text-primary);
        }

        .when-block {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            gap: 8px;
            padding: 0;
            background: transparent;
            border: none;
            border-radius: 0;
        }

        .when-label {
            font-size: var(--fs-sm);
            font-weight: 600;
            color: var(--text-secondary);
            margin: 0;
        }

        .when-chips {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
        }

        .when-chip {
            padding: 6px 12px;
            font-size: var(--fs-xs);
            font-weight: 600;
            border-radius: 10px;
            border: 1px solid var(--border-subtle);
            background: var(--bg-subtle);
            color: var(--text-secondary);
            cursor: pointer;
        }

        .when-chip:hover {
            border-color: var(--accent);
            color: var(--accent);
        }

        .when-chip.active {
            background: var(--accent);
            border-color: var(--accent);
            color: #fff;
        }

        .when-block .date-picker-wrap {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            width: 100%;
        }

        .when-block .date-picker-btn {
            flex: 1 1 120px;
            min-width: 0;
            justify-content: center;
            min-height: 34px;
            padding: 5px 10px;
            font-size: var(--fs-xs);
            border-radius: 10px;
            border-color: var(--border-subtle);
            background: var(--bg-subtle);
        }

        .when-block .capacity-hint {
            margin: 0;
            padding: 0;
            font-size: var(--fs-xs);
            color: var(--text-muted);
            background: transparent;
            border: none;
        }

        .date-picker-wrap {
            position: relative;
            display: inline-flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 6px;
        }

        .date-picker-btn {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 5px 10px;
            font-size: var(--fs-xs);
            font-weight: 600;
            border-radius: 8px;
            border: 1px solid rgba(37, 99, 235, 0.35);
            background: var(--bg-panel);
            color: var(--text-primary);
            cursor: pointer;
            min-width: 132px;
        }
        .date-picker-btn:hover {
            border-color: var(--accent);
            color: var(--accent);
        }
        .date-picker-btn .icon {
            width: 14px;
            height: 14px;
            color: var(--accent);
        }

        .date-picker-pop {
            display: none;
            position: absolute;
            left: 0;
            top: calc(100% + 8px);
            z-index: 20;
            width: 280px;
            padding: 12px;
            background: #fff;
            border: 1px solid rgba(226, 232, 240, 0.95);
            border-radius: 16px;
            box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.05);
        }
        .date-picker-pop.open {
            display: block;
        }
        .date-picker-pop .cal-month-panel {
            border: none;
            padding: 0;
            background: transparent;
        }
        .date-picker-actions {
            display: flex;
            justify-content: flex-end;
            align-items: center;
            flex-wrap: wrap;
            gap: 6px;
            margin-top: 10px;
            padding-top: 10px;
            border-top: 1px solid #e2e8f0;
        }
        .date-picker-actions .btn-ghost:first-child {
            margin-right: auto;
        }
        .date-picker-actions button {
            font-size: var(--fs-sm);
            padding: 7px 12px;
            border-radius: 10px;
            font-weight: 650;
        }
        .date-picker-actions .btn-primary {
            min-width: 88px;
            justify-content: center;
            box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
        }

        .task-date-row .date-picker-btn {
            background: var(--bg-subtle);
            border-color: var(--border);
            min-width: 118px;
        }
        .task-date-row .date-picker-btn.has-value {
            border-color: rgba(37, 99, 235, 0.35);
            background: var(--bg-panel);
        }

        .task-schedule-pop {
            display: none;
            position: fixed;
            z-index: 300;
            width: min(320px, calc(100vw - 24px));
            padding: 16px;
            background: #fff;
            border: 1px solid #e3e8f0;
            border-radius: 16px;
            box-shadow: 0 12px 32px rgba(26, 36, 51, 0.10);
        }
        .task-schedule-pop.open {
            display: block;
        }
        .task-schedule-pop .cal-month-panel {
            border: none;
            padding: 0;
            background: transparent;
        }
        .task-schedule-pop .cal-month-title {
            font-size: var(--fs-base);
            font-weight: 750;
            letter-spacing: -0.02em;
        }
        .task-schedule-pop .cal-grid {
            gap: 4px;
        }
        .task-schedule-pop .cal-day {
            height: 34px;
            border-radius: 10px;
            background: #f1f5f9;
            font-size: var(--fs-sm);
            font-weight: 650;
        }
        .task-schedule-pop .cal-day.is-today {
            border-color: rgba(37, 99, 235, 0.55);
            background: #fff;
            color: var(--text-primary);
        }
        .task-schedule-pop .cal-day.is-today:hover:not(:disabled):not(.is-peek) {
            background: var(--accent-soft);
            color: var(--accent);
        }
        .task-schedule-pop .cal-day.is-peek {
            background: var(--accent);
            color: #fff;
            border-color: var(--accent);
            box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
        }
        .task-schedule-pop .cal-day.is-peek:hover:not(:disabled) {
            background: var(--accent-hover);
            border-color: var(--accent-hover);
            color: #fff;
        }
        .task-schedule-pop .date-picker-actions {
            margin-top: 10px;
            padding-top: 10px;
        }
        /* Выбор времени — Figma: лёгкие поля #e0e5ed, без тяжёлых степперов/теней */
        .time-picker-panel {
            border: none;
            padding: 0;
            background: transparent;
        }
        .time-picker-head {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 4px;
            margin-bottom: 14px;
        }
        .time-picker-head .cal-month-title {
            width: 100%;
            text-align: left;
            font-size: 18px;
            font-weight: 650;
            letter-spacing: -0.02em;
            color: #1a2433;
        }
        .time-picker-date-hint {
            font-size: 13px;
            font-weight: 500;
            color: #6e7a8f;
            letter-spacing: 0;
        }
        .time-picker-hm {
            display: grid;
            grid-template-columns: 1fr auto 1fr;
            align-items: end;
            gap: 10px;
            margin-bottom: 14px;
        }
        .time-picker-hm-col {
            display: flex;
            flex-direction: column;
            gap: 7px;
            min-width: 0;
        }
        .time-picker-hm-col label {
            font-size: 12px;
            font-weight: 500;
            letter-spacing: 0;
            text-transform: none;
            color: #1a2433;
            text-align: left;
        }
        .time-picker-step {
            display: grid;
            grid-template-columns: 32px 1fr 32px;
            align-items: center;
            gap: 2px;
            min-height: 48px;
            padding: 4px 6px;
            border-radius: 12px;
            border: 1px solid #e0e5ed;
            background: #fff;
        }
        .task-schedule-pop .time-picker-step {
            background: #fff;
            border-color: #e0e5ed;
        }
        .time-picker-step-btn {
            width: 32px;
            height: 32px;
            border: none;
            border-radius: 8px;
            background: transparent;
            color: #6e7a8f;
            font-size: 18px;
            font-weight: 500;
            line-height: 1;
            cursor: pointer;
            box-shadow: none;
        }
        .time-picker-step-btn:hover {
            background: #f6f7f9 !important;
            color: var(--accent) !important;
            border-color: transparent !important;
        }
        .time-picker-step-btn:active {
            background: var(--accent-soft) !important;
            color: var(--accent) !important;
        }
        .time-picker-step-val {
            text-align: center;
            font-size: 20px;
            font-weight: 600;
            font-variant-numeric: tabular-nums;
            color: #1a2433;
            user-select: none;
            letter-spacing: -0.02em;
        }
        .time-picker-hm-sep {
            font-size: 18px;
            font-weight: 500;
            color: #6e7a8f;
            padding-bottom: 12px;
            line-height: 1;
            text-align: center;
        }
        .time-picker-quicks {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 8px;
        }
        .time-picker-quick {
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 36px;
            padding: 8px 6px;
            font-size: 13px;
            font-weight: 500;
            font-variant-numeric: tabular-nums;
            border-radius: 10px;
            border: 1px solid transparent;
            background: #f6f7f9;
            color: #1a2433;
            cursor: pointer;
            line-height: 1.15;
            text-align: center;
            box-shadow: none;
        }
        .time-picker-quick.is-now {
            grid-column: span 2;
        }
        .time-picker-quick:hover {
            border-color: #e0e5ed !important;
            color: var(--accent) !important;
            background: #fff !important;
        }
        .time-picker-quick.active,
        .time-picker-quick.is-active {
            background: var(--accent-soft) !important;
            border-color: transparent !important;
            color: var(--accent) !important;
            box-shadow: none;
            font-weight: 600;
        }
        .task-schedule-pop .date-picker-actions {
            border-top: 1px solid #eef1f5;
            margin-top: 14px;
            padding-top: 12px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
        }
        .task-schedule-pop .date-picker-actions .btn-ghost {
            border: none;
            background: transparent;
            color: #1a2433;
            font-weight: 550;
            padding: 8px 10px;
            box-shadow: none;
        }
        .task-schedule-pop .date-picker-actions .btn-ghost:hover {
            background: #f6f7f9 !important;
            color: #1a2433 !important;
        }
        .task-schedule-pop .date-picker-actions .btn-primary {
            border-radius: 10px;
            padding: 8px 16px;
            font-weight: 600;
            box-shadow: none;
        }

        .capacity-hint {
            width: 100%;
            font-size: var(--fs-xs);
            color: var(--text-secondary);
            line-height: 1.35;
        }

        .capacity-hint.warn {
            color: var(--warning);
            font-weight: 600;
        }

        .capacity-hint.danger {
            color: var(--danger);
            font-weight: 600;
        }

        .plan-time-badge {
            font-variant-numeric: tabular-nums;
        }

        .backlog-group {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-bottom: 14px;
        }

        .backlog-group-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            font-size: var(--fs-xs);
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--text-muted);
            padding: 0 2px;
        }

        .backlog-group-head .grp-count {
            font-family: ui-monospace, monospace;
            font-weight: 600;
            text-transform: none;
            letter-spacing: 0;
        }

        .backlog-group.is-overdue .backlog-group-head { color: var(--danger); }
        .backlog-group.is-today .backlog-group-head { color: var(--accent); }
        .backlog-group.is-nodate .backlog-group-head { color: var(--warning); }

        .day-load-banner {
            display: none;
            align-items: center;
            gap: 8px;
            padding: 8px 12px;
            border-radius: var(--radius-md);
            background: var(--warning-soft);
            border: 1px solid rgba(217, 119, 6, 0.28);
            color: #92400e; /* AA на светлом янтарном фоне */
            font-size: var(--fs-sm);
            font-weight: 600;
            flex-shrink: 0;
        }

        .day-load-banner.show {
            display: flex;
        }
        html[data-theme="dark"] .day-load-banner { color: #fcd34d; }

        /* Выпадающая панель календаря из шапки (у правого края / галочки) */
        .cal-widget-panel {
            display: none;
            position: absolute;
            top: calc(100% + 8px);
            left: auto;
            right: 0;
            width: 360px;
            max-width: min(360px, calc(100vw - 24px));
            padding: 10px;
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: 16px;
            box-shadow: var(--shadow-lg);
            max-height: min(82vh, 640px);
            overflow: hidden;
            z-index: 170;
        }

        .cal-widget.open .cal-widget-panel {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .cal-widget-panel .cal-month-panel {
            padding: 8px;
            flex-shrink: 0;
            border: none;
            background: transparent;
        }

        .cal-widget-panel .cal-month-head {
            margin-bottom: 8px;
            gap: 8px;
        }

        .cal-widget-panel .cal-weekdays,
        .cal-widget-panel .cal-grid {
            gap: 4px;
        }

        .cal-widget-panel .cal-weekdays span {
            font-size: var(--fs-xs);
            padding: 0 0 4px;
            line-height: 1.2;
        }
        .cal-widget-panel .cal-weekdays span:nth-child(5) {
            color: var(--accent);
        }

        .cal-widget-panel .cal-day {
            height: 32px;
            aspect-ratio: auto;
            border-radius: 8px;
            font-size: var(--fs-xs);
        }

        .cal-widget-panel .cal-day.has-tasks::after {
            bottom: 3px;
            width: 4px;
            height: 4px;
        }

        .cal-widget-panel.is-week-mode .cal-day.other-month {
            opacity: 1;
        }

        .cal-peek-box {
            background: var(--bg-subtle);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 10px 12px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            flex: 1 1 auto;
            min-height: 180px;
            max-height: none;
            overflow: hidden;
            order: 2;
        }

        .cal-peek-head-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            flex-shrink: 0;
        }

        .cal-peek-head {
            font-size: var(--fs-xs);
            font-weight: 750;
            color: var(--text-primary);
            flex: 1 1 auto;
            min-width: 0;
        }

        .cal-peek-shift {
            font-size: var(--fs-xs);
            color: var(--text-muted);
            white-space: nowrap;
            flex-shrink: 0;
        }

        .cal-peek-note {
            display: none;
        }

        .cal-peek-list {
            display: flex;
            flex-direction: column;
            gap: 5px;
            flex: 1 1 auto;
            min-height: 100px;
            max-height: min(38vh, 280px);
            overflow: auto;
            -webkit-overflow-scrolling: touch;
        }

        .cal-peek-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            padding: 6px 9px;
            border-radius: 8px;
            background: var(--bg-panel);
            border: 1px solid var(--border);
            font-size: var(--fs-xs);
        }

        .cal-peek-item-title {
            font-weight: 600;
            color: var(--text-primary);
            line-height: 1.25;
            display: -webkit-box;
            -webkit-line-clamp: 1;
            -webkit-box-orient: vertical;
            overflow: hidden;
            flex: 1 1 auto;
            min-width: 0;
        }

        .cal-peek-empty {
            font-size: var(--fs-xs);
            color: var(--text-muted);
            padding: 4px 0;
        }

        .cal-peek-footer {
            display: flex;
            align-items: center;
            justify-content: flex-start;
            flex-wrap: wrap;
            gap: 8px;
            padding-top: 2px;
            flex-shrink: 0;
        }
        .cal-peek-footer .cal-peek-chip:last-child {
            margin-left: auto;
        }

        .cal-peek-chip {
            border: 1px solid var(--border);
            background: var(--bg-panel);
            color: var(--text-secondary);
            font-family: inherit;
            font-size: var(--fs-xs);
            font-weight: 700;
            border-radius: 8px;
            padding: 5px 10px;
            cursor: pointer;
            transition: all 0.14s ease;
        }

        .backlog-day-focus-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            flex-wrap: wrap;
            padding: 10px 12px;
            margin-bottom: 10px;
            border-radius: 12px;
            background: var(--accent-soft);
            border: 1px solid rgba(37, 99, 235, 0.22);
        }
        .backlog-day-focus-bar .bd-title {
            font-size: var(--fs-sm);
            font-weight: 750;
            color: var(--accent);
        }
        .backlog-day-focus-bar .bd-hint {
            font-size: var(--fs-xs);
            font-weight: 550;
            color: var(--text-secondary);
            margin-left: 4px;
        }
        .backlog-day-focus-bar .mini-chip {
            flex-shrink: 0;
            background: #fff;
            border-color: rgba(37, 99, 235, 0.28);
            color: var(--accent);
        }
        .cal-peek-chip:hover {
            background: var(--bg-card-hover);
            color: var(--text-primary);
        }
        .cal-peek-chip.is-accent {
            color: var(--accent);
            border-color: rgba(37, 99, 235, 0.35);
            background: var(--accent-soft);
        }
        .cal-peek-chip.is-accent:hover {
            border-color: rgba(37, 99, 235, 0.55);
            background: rgba(37, 99, 235, 0.14);
        }

        .cal-month-panel {
            border: 1px solid var(--border-subtle);
            border-radius: 10px;
            background: var(--bg-panel);
            padding: 8px;
            order: 1;
        }

        .cal-month-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 6px;
            gap: 8px;
        }

        .cal-nav-group {
            display: inline-flex;
            align-items: center;
            gap: 2px;
            min-width: 0;
            flex: 1 1 auto;
        }

        .cal-month-head .btn-icon-only {
            width: 28px;
            height: 28px;
            padding: 0;
            border-radius: 8px;
            flex-shrink: 0;
        }

        .cal-month-title {
            font-size: var(--fs-base);
            font-weight: 750;
            text-transform: capitalize;
            min-width: 0;
            text-align: center;
            flex: 1 1 auto;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .cal-mode-switch {
            display: inline-flex;
            background: var(--bg-subtle);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 2px;
            gap: 2px;
            flex-shrink: 0;
        }
        .cal-mode-btn {
            border: none;
            background: transparent;
            color: var(--text-secondary);
            font-family: inherit;
            font-size: var(--fs-xs);
            font-weight: 700;
            padding: 4px 8px;
            border-radius: 6px;
            cursor: pointer;
            box-shadow: none;
        }
        .cal-mode-btn:hover {
            color: var(--text-primary);
            background: transparent;
            border: none;
        }
        .cal-mode-btn.active {
            background: var(--bg-panel);
            color: var(--accent);
            box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
        }

        .cal-weekdays,
        .cal-grid {
            display: grid;
            grid-template-columns: repeat(7, 1fr);
            gap: 2px;
        }

        .cal-weekdays span {
            text-align: center;
            font-size: var(--fs-xs);
            font-weight: 700;
            color: var(--text-muted);
            text-transform: uppercase;
            padding: 1px 0;
        }

        .cal-day {
            position: relative;
            aspect-ratio: 1;
            min-height: 0;
            height: 28px;
            border: 1px solid transparent;
            border-radius: 6px;
            background: var(--bg-subtle);
            color: var(--text-primary);
            font-size: var(--fs-xs);
            font-weight: 600;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0;
        }

        .cal-day:hover:not(:disabled) {
            border-color: var(--accent);
            color: var(--accent);
        }

        .cal-day:disabled {
            opacity: 0;
            cursor: default;
            background: transparent;
        }

        .cal-day.is-today {
            border-color: rgba(37, 99, 235, 0.45);
            color: var(--text-primary);
        }
        .cal-day.is-today:hover:not(:disabled):not(.is-peek) {
            background: var(--accent-soft);
            border-color: var(--accent);
            color: var(--accent);
        }

        .cal-day.is-peek {
            background: var(--accent);
            color: #fff;
            border-color: var(--accent);
        }
        .cal-day.is-peek:hover:not(:disabled) {
            background: var(--accent-hover);
            border-color: var(--accent-hover);
            color: #fff;
        }

        .cal-day.is-friday:not(.is-peek) {
            color: var(--accent);
        }

        .cal-day.has-tasks::after {
            content: '';
            position: absolute;
            bottom: 2px;
            width: 3px;
            height: 3px;
            border-radius: 50%;
            background: var(--accent);
        }

        .cal-day.is-peek.has-tasks::after {
            background: #fff;
        }

