/* === APP.CSS ===
   assets/css/app.css
   НАЗНАЧЕНИЕ: Все стили CommandOS — индустриальная эстетика
   РАЗМЕР: ~650 строк */

/* --- CSS Variables (Dark default) --- */
:root {
    --bg-primary: hsl(220, 15%, 6%);
    --bg-secondary: hsl(220, 14%, 9%);
    --bg-card: hsl(220, 13%, 11%);
    --bg-hover: hsl(220, 12%, 14%);
    --bg-input: hsl(220, 14%, 8%);
    --text-primary: hsl(0, 0%, 92%);
    --text-secondary: hsl(0, 0%, 70%);
    --text-muted: hsl(0, 0%, 50%);
    --border: hsl(220, 10%, 18%);
    --border-focus: hsl(217, 80%, 50%);
    --color-primary: hsl(217, 91%, 60%);
    --color-primary-hover: hsl(217, 91%, 50%);
    --color-danger: hsl(0, 84%, 60%);
    --color-success: hsl(142, 71%, 45%);
    --color-warning: hsl(38, 92%, 50%);
    --color-urgent: hsl(0, 84%, 60%);
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --radius: 4px;
    --font-display: 'JetBrains Mono', monospace;
    --font-body: 'Exo 2', sans-serif;
    --ai-green: #10b981;
    --gradient-primary: linear-gradient(135deg, hsl(217, 91%, 60%), hsl(262, 65%, 65%));
}

html.light-theme {
    --bg-primary: hsl(220, 20%, 97%);
    --bg-secondary: hsl(220, 18%, 94%);
    --bg-card: hsl(0, 0%, 100%);
    --bg-hover: hsl(220, 15%, 92%);
    --bg-input: hsl(0, 0%, 100%);
    --text-primary: hsl(220, 20%, 12%);
    --text-secondary: hsl(220, 10%, 40%);
    --text-muted: hsl(220, 8%, 60%);
    --border: hsl(220, 15%, 85%);
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; max-width: 100vw; }
body {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.5;
}

/* --- Theme toggle icons --- */
.tf-icon-sun { display: none; }
.tf-icon-moon { display: inline; }
html.light-theme .tf-icon-sun { display: inline; }
html.light-theme .tf-icon-moon { display: none; }

/* --- Login --- */
.tf-login-wrap {
    display: flex; align-items: center; justify-content: center;
    height: 100vh; background: var(--bg-primary);
}
.tf-login-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 6px; padding: 30px; width: 320px;
    box-shadow: var(--shadow);
}
.tf-login-logo {
    display: flex; align-items: center; gap: 8px;
    font-family: var(--font-display); font-size: 18px; font-weight: 600;
    margin-bottom: 20px; color: var(--color-primary);
}
.tf-login-error {
    background: hsla(0, 84%, 60%, 0.1); border: 1px solid var(--color-danger);
    color: var(--color-danger); padding: 6px 10px; border-radius: var(--radius);
    font-size: 12px; margin-bottom: 10px;
}
.tf-field { margin-bottom: 12px; }
.tf-field label { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; font-family: var(--font-display); }
.tf-field input, .tf-field select, .tf-field textarea {
    width: 100%; padding: 7px 10px; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text-primary); font-family: var(--font-body); font-size: 13px;
}
.tf-field input:focus, .tf-field select:focus, .tf-field textarea:focus {
    outline: none; border-color: var(--border-focus);
}
.tf-field textarea { resize: vertical; min-height: 60px; }

/* --- Buttons --- */
.tf-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border: 1px solid var(--border);
    border-radius: var(--radius); font-family: var(--font-display);
    font-size: 12px; cursor: pointer; transition: all 0.15s;
    background: var(--bg-card); color: var(--text-primary);
}
.tf-btn:hover { background: var(--bg-hover); }
.tf-btn-primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.tf-btn-primary:hover { background: var(--color-primary-hover); }
.tf-btn-sm { padding: 4px 8px; font-size: 11px; }
.tf-btn-danger { border-color: var(--color-danger); color: var(--color-danger); }
.tf-btn-danger:hover { background: hsla(0, 84%, 60%, 0.1); }
.tf-btn-warning { border-color: hsl(45, 93%, 47%); color: hsl(45, 93%, 47%); }
.tf-btn-warning:hover { background: hsla(45, 93%, 47%, 0.1); }
.tf-btn-success { border-color: var(--color-success); color: var(--color-success); }
.tf-btn-success:hover { background: hsla(142, 71%, 45%, 0.1); }
.tf-pending-notice { font-size: 11px; color: hsl(45, 93%, 47%); font-style: italic; padding: 4px 0; }
.tf-btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border: 1px solid var(--border);
    border-radius: var(--radius); background: transparent;
    color: var(--text-secondary); cursor: pointer; transition: all 0.15s;
}
.tf-btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }

/* --- User Badge --- */
.tf-user-badge {
    display: flex; align-items: center; gap: 6px;
    padding: 2px 8px 2px 2px; border-radius: var(--radius);
    border: 1px solid var(--border); cursor: default;
    font-size: 11px; color: var(--text-secondary);
}
.tf-user-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--gradient-primary); color: #fff;
    font-size: 11px; font-weight: 700; font-family: var(--font-display);
    letter-spacing: 0.5px; flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.tf-user-avatar-img {
    background: var(--border); padding: 0; overflow: hidden;
}
.tf-user-avatar-img img {
    width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block;
}
.tf-user-name {
    white-space: nowrap; font-weight: 500;
    max-width: 120px; overflow: hidden; text-overflow: ellipsis;
}

/* --- App Layout --- */
.tf-app { display: flex; flex-direction: column; height: 100vh; max-width: 100vw; overflow-x: hidden; }

/* --- Header --- */
.tf-header {
    display: flex; align-items: center;
    padding: 0 8px; height: 42px; min-height: 42px;
    background: var(--bg-secondary); border-bottom: 1px solid var(--border);
    position: relative; width: 100%;
}
.tf-header-left { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.tf-header-right { display: flex; align-items: center; gap: 4px; margin-left: auto; min-width: 0; }
.tf-brand { font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--color-primary); }
.tf-brand-os { font-weight: 700; color: var(--ai-green); letter-spacing: 1px; font-size: 1.1em; }
.tf-logo-icon { color: var(--color-primary); }

/* Brand subtitle */
.tf-brand-sub {
    font-size: 10px; color: var(--text-muted);
    margin-left: 4px; font-weight: 400; white-space: nowrap;
}

/* Navigation - иконочные кнопки */
.tf-nav { display: flex; gap: 2px; align-items: center; flex-shrink: 0; }
.tf-nav-item {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; padding: 0;
    color: var(--text-secondary); text-decoration: none;
    border-radius: var(--radius); transition: all 0.15s;
}
.tf-nav-item svg { flex-shrink: 0; width: 14px; height: 14px; }
.tf-nav-item:hover { color: var(--text-primary); background: var(--bg-hover); }
.tf-nav-item.active { color: var(--color-primary); background: hsla(217, 91%, 60%, 0.1); }
.tf-nav-group {
    display: inline-flex; align-items: center; gap: 0;
    border: 1px solid var(--border, hsl(220, 10%, 18%));
    border-radius: 6px; padding: 1px 2px;
    background: hsla(220, 10%, 50%, 0.04);
}
.tf-nav-group:empty { display: none; }
.tf-nav-group .tf-nav-item { border-radius: 6px; }
/* Цветовые оттенки групп навигации */
.tf-nav-group--work { border-color: hsla(217, 70%, 55%, 0.3); background: hsla(217, 70%, 55%, 0.06); }
.tf-nav-group--team { border-color: hsla(262, 60%, 58%, 0.3); background: hsla(262, 60%, 58%, 0.06); }
.tf-nav-group--knowledge { border-color: hsla(160, 60%, 45%, 0.3); background: hsla(160, 60%, 45%, 0.06); }
.tf-nav-group--admin { border-color: hsla(25, 70%, 50%, 0.3); background: hsla(25, 70%, 50%, 0.06); }
/* Light theme оттенки */
html.light-theme .tf-nav-group--work { border-color: hsla(217, 70%, 50%, 0.25); background: hsla(217, 70%, 50%, 0.05); }
html.light-theme .tf-nav-group--team { border-color: hsla(262, 55%, 55%, 0.25); background: hsla(262, 55%, 55%, 0.05); }
html.light-theme .tf-nav-group--knowledge { border-color: hsla(160, 55%, 40%, 0.25); background: hsla(160, 55%, 40%, 0.05); }
html.light-theme .tf-nav-group--admin { border-color: hsla(25, 65%, 48%, 0.25); background: hsla(25, 65%, 48%, 0.05); }
.tf-nav-divider { width: 1px; height: 14px; background: var(--border, hsl(220, 10%, 18%)); margin: 0 1px; flex-shrink: 0; opacity: 0.4; }

/* Тултипы при наведении */
.tf-nav-item[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    margin-top: 6px; padding: 4px 8px;
    background: var(--bg-primary); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: 4px;
    font-family: var(--font-body); font-size: 11px; white-space: nowrap;
    z-index: 1000; pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Гамбургер - скрыт на десктопе */
.tf-burger {
    display: none; align-items: center; justify-content: center;
    width: 30px; height: 30px; padding: 0;
    background: transparent; border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-secondary);
    cursor: pointer; transition: all 0.15s;
}
.tf-burger:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Мобильное меню - скрыто по умолчанию */
.tf-mobile-menu {
    display: none; position: absolute; top: 42px; left: 0; right: 0;
    background: var(--bg-secondary); border-bottom: 1px solid var(--border);
    padding: 6px 10px; z-index: 999;
    flex-direction: column; gap: 2px;
    max-height: calc(100vh - 42px); overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.tf-mobile-menu.open { display: flex; }
.tf-mobile-item {
    display: block; padding: 8px 12px;
    font-family: var(--font-body); font-size: 13px;
    color: var(--text-secondary); text-decoration: none;
    border-radius: var(--radius); transition: all 0.15s;
}
.tf-mobile-item:hover { color: var(--text-primary); background: var(--bg-hover); }
.tf-mobile-item.active { color: var(--color-primary); background: hsla(217, 91%, 60%, 0.1); }

/* Средние экраны - прячем текст, оставляем иконки */
@media (max-width: 1280px) {
    .tf-brand-sub { display: none; }
    .tf-user-name { display: none; }
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .tf-nav { display: none; }
    .tf-burger { display: inline-flex; }
    .tf-brand-sub { display: none; }
    .tf-user-name { display: none; }
}

/* --- Main content --- */
.tf-main { flex: 1; overflow: hidden; padding: 10px; max-width: 100%; }
.tf-tab { height: 100%; overflow-y: auto; overflow-x: hidden; }

/* --- Two-column layout (tasks) --- */
.tf-split {
    display: flex; height: 100%;
}
.tf-panel-left {
    width: 360px; min-width: 200px; max-width: 800px; flex-shrink: 0;
}
.tf-panel-right {
    flex: 1; min-width: 0;
}

/* Resizable handle */
.tf-split-handle {
    width: 5px; flex-shrink: 0; cursor: col-resize;
    background: var(--border); position: relative;
    transition: background 0.15s;
}
.tf-split-handle:hover,
.tf-split-handle.active {
    background: var(--color-primary);
}
.tf-split-handle::after {
    content: ''; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 3px; height: 30px; border-radius: 2px;
    background: var(--text-muted); opacity: 0;
    transition: opacity 0.15s;
}
.tf-split-handle:hover::after,
.tf-split-handle.active::after {
    opacity: 0.6;
}
.tf-panel {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); display: flex; flex-direction: column;
    overflow: hidden;
}
.tf-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 10px; border-bottom: 1px solid var(--border);
    font-family: var(--font-display); font-size: 12px; font-weight: 500;
    flex: 0 0 auto;
}
.tf-panel-body { flex: 1; overflow-y: auto; padding: 0; }

/* --- Search bar --- */
.tf-search-bar {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px; border-bottom: 1px solid var(--border);
    flex: 0 0 auto; position: relative;
}
.tf-search-icon {
    flex: 0 0 14px; color: var(--text-muted); pointer-events: none;
}
.tf-search-bar input {
    flex: 1; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 5px 24px 5px 6px; font-size: 12px;
    color: var(--text-primary); font-family: var(--font-body);
}
.tf-search-bar input:focus { border-color: var(--border-focus); outline: none; }
.tf-search-bar input::placeholder { color: var(--text-muted); opacity: 0.7; }
.tf-search-clear {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font-size: 16px; line-height: 1; padding: 2px 4px; display: none;
}
.tf-search-clear:hover { color: var(--text-primary); }

/* --- Filters bar --- */
.tf-filters {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px; border-bottom: 1px solid var(--border);
    flex: 0 0 auto; flex-wrap: wrap;
}
.tf-filters select {
    padding: 3px 6px; font-size: 11px; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text-primary); font-family: var(--font-display);
    flex: 1 1 auto; min-width: 80px; max-width: 100%;
}

/* --- Task list items --- */
.tf-task-item {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 8px 10px; border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background 0.1s;
}
.tf-task-item:hover { background: var(--bg-hover); }
.tf-task-item.active { background: hsla(217, 91%, 60%, 0.08); border-left: 2px solid var(--color-primary); }
.tf-task-priority {
    width: 4px; min-height: 30px; border-radius: 2px; flex: 0 0 4px; margin-top: 2px;
}
.tf-task-priority.urgent { background: var(--color-urgent); }
.tf-task-priority.high { background: var(--color-warning); }
.tf-task-priority.normal { background: var(--color-success); }
.tf-task-priority.low { background: var(--text-muted); }
.tf-task-info { flex: 1; min-width: 0; }
.tf-task-title {
    font-size: 12px; font-weight: 500; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.tf-task-meta {
    display: flex; align-items: center; gap: 4px 6px;
    font-size: 10px; color: var(--text-muted); margin-top: 2px;
    font-family: var(--font-display); flex-wrap: wrap;
}
.tf-task-meta .overdue { color: var(--color-danger); font-weight: 600; }

/* --- Done tasks: strikethrough + faded --- */
.tf-task-item.status-done { opacity: 0.5; }
.tf-task-item.status-done .tf-task-title {
    text-decoration: line-through;
    text-decoration-thickness: 1px;
    text-decoration-color: var(--text-muted);
}

/* --- Task detail --- */
.tf-detail-empty {
    display: flex; align-items: center; justify-content: center;
    height: 100%; color: var(--text-muted); font-family: var(--font-display);
}
.tf-detail { padding: 10px; }
.tf-detail-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 10px;
}
.tf-detail-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; }
.tf-detail-id { font-family: var(--font-display); font-size: 11px; color: var(--text-muted); }
.tf-detail-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 8px; margin-bottom: 10px;
}
.tf-detail-field {
    display: flex; align-items: baseline; gap: 6px;
    font-size: 12px;
}
.tf-detail-label { color: var(--text-muted); font-family: var(--font-display); font-size: 10px; white-space: nowrap; }
.tf-detail-value { color: var(--text-primary); }

/* Status badges */
.tf-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 10px;
    font-family: var(--font-display); font-size: 10px; font-weight: 500;
    white-space: nowrap; flex: 0 0 auto;
}
.tf-badge-new { background: hsla(217, 91%, 60%, 0.15); color: var(--color-primary); }
.tf-badge-in_progress { background: hsla(38, 92%, 50%, 0.15); color: var(--color-warning); }
.tf-badge-pending_review { background: hsla(45, 93%, 47%, 0.15); color: hsl(45, 93%, 47%); }
.tf-badge-done { background: hsla(142, 71%, 45%, 0.15); color: var(--color-success); }
.tf-badge-cancelled { background: hsla(0, 0%, 50%, 0.15); color: var(--text-muted); }
.tf-badge-urgent { background: hsla(0, 84%, 60%, 0.15); color: var(--color-urgent); }
.tf-badge-high { background: hsla(38, 92%, 50%, 0.15); color: var(--color-warning); }
.tf-badge-normal { background: hsla(217, 91%, 60%, 0.15); color: var(--color-primary); }
.tf-badge-low { background: hsla(0, 0%, 50%, 0.15); color: var(--text-muted); }

/* Панель фильтра меток проекта */
.tf-label-bar {
    display: flex; align-items: center; gap: 5px;
    padding: 6px 10px; border-bottom: 1px solid var(--border);
    flex: 0 0 auto; flex-wrap: wrap;
}
.tf-label-chip {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 10px;
    background: var(--bg-hover); color: var(--text-secondary);
    font-family: var(--font-display); font-size: 11px; font-weight: 500;
    white-space: nowrap; cursor: pointer;
    border: 1px solid var(--border);
    transition: background 0.1s, color 0.1s, border-color 0.1s;
    user-select: none;
}
.tf-label-chip:hover {
    background: hsla(262, 65%, 65%, 0.18);
    color: hsl(262, 65%, 72%);
    border-color: hsla(262, 65%, 65%, 0.35);
}
.tf-label-chip.active {
    background: hsla(262, 65%, 65%, 0.22);
    color: hsl(262, 65%, 78%);
    border-color: hsla(262, 65%, 65%, 0.5);
    font-weight: 600;
}
html.light-theme .tf-label-chip {
    background: var(--bg-hover); color: var(--text-secondary);
    border-color: var(--border);
}
html.light-theme .tf-label-chip:hover,
html.light-theme .tf-label-chip.active {
    background: hsla(262, 65%, 50%, 0.12);
    color: hsl(262, 65%, 38%);
    border-color: hsla(262, 65%, 50%, 0.3);
}

/* Метка проекта */
.tf-project-chip {
    display: inline-flex; align-items: center;
    padding: 2px 8px; border-radius: 10px;
    background: hsla(262, 65%, 65%, 0.15); color: hsl(262, 65%, 72%);
    font-family: var(--font-display); font-size: 10px; font-weight: 500;
    white-space: nowrap; flex: 0 0 auto;
    border: 1px solid hsla(262, 65%, 65%, 0.25);
    cursor: pointer;
}
.tf-project-chip:hover { background: hsla(262, 65%, 65%, 0.28); }
html.light-theme .tf-project-chip {
    background: hsla(262, 65%, 50%, 0.1); color: hsl(262, 65%, 40%);
    border-color: hsla(262, 65%, 50%, 0.2);
}

/* Status icons */
.tf-status-icon {
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto; width: 18px; height: 18px;
}
.tf-status-svg {
    width: 14px; height: 14px;
}
.tf-badge-new .tf-status-svg,
.tf-status-icon[title="Новая"] { color: var(--color-primary); }
.tf-status-icon[title="В работе"] { color: var(--color-warning); }
.tf-status-icon[title="На проверке"] { color: hsl(45, 93%, 47%); }
.tf-status-icon[title="Выполнена"] { color: var(--color-success); }
.tf-status-icon[title="Отменена"] { color: var(--text-muted); }

/* --- Section / Accordion --- */
.tf-section { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.tf-section-header {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px; cursor: pointer; font-family: var(--font-display);
    font-size: 11px; font-weight: 500; user-select: none;
}
.tf-section-header:hover { background: var(--bg-hover); }
.tf-section-arrow { transition: transform 0.15s; font-size: 10px; }
.tf-section.collapsed .tf-section-body { display: none; }
.tf-section.collapsed .tf-section-arrow { transform: rotate(-90deg); }
.tf-section-body { padding: 8px 10px; border-top: 1px solid var(--border); }

/* --- Comments --- */
.tf-comment {
    display: flex; gap: 8px; padding: 6px 0;
    border-bottom: 1px solid var(--border); font-size: 12px;
}
.tf-comment:last-child { border-bottom: none; }
.tf-comment-author { font-family: var(--font-display); font-size: 10px; color: var(--color-primary); white-space: nowrap; }
.tf-comment-time { font-family: var(--font-display); font-size: 9px; color: var(--text-muted); }
.tf-comment-text { flex: 1; }
.tf-comment-source { font-size: 9px; color: var(--text-muted); font-family: var(--font-display); }
.tf-comment-form { display: flex; gap: 6px; margin-top: 6px; }
.tf-comment-form input { flex: 1; }

/* --- Inline form (create task) --- */
.tf-inline-form {
    padding: 10px; border-bottom: 2px solid var(--color-primary);
    background: var(--bg-secondary); display: none;
}
.tf-inline-form.open { display: block; overflow-y: auto; flex: 1 1 auto; }
.tf-inline-form .tf-form-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px;
}
.tf-inline-form .tf-form-actions {
    display: flex; gap: 6px; justify-content: flex-end; margin-top: 8px;
}

/* --- Attach zone in create form --- */
.tf-attach-zone { margin-top: 2px; }
.tf-attach-area {
    border: 1px dashed var(--border); border-radius: var(--radius);
    padding: 8px; transition: border-color 0.15s, background 0.15s;
}
.tf-attach-area.tf-attach-dragover {
    border-color: var(--color-primary); background: hsla(217, 91%, 60%, 0.06);
}
.tf-btn-outline {
    background: transparent; border: 1px solid var(--border); color: var(--text-primary);
    cursor: pointer; border-radius: var(--radius); font-size: 11px; padding: 4px 10px;
    font-family: var(--font-display); transition: border-color 0.15s;
}
.tf-btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }
.tf-attach-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.tf-attach-list:empty { margin-top: 0; }
.tf-attach-file {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 8px; background: var(--bg-input); border-radius: var(--radius);
    font-size: 11px;
}
.tf-attach-file-name {
    flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--text-primary); font-family: var(--font-display);
}
.tf-attach-file-size { color: var(--text-muted); font-size: 10px; flex: 0 0 auto; }
.tf-attach-file-remove {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font-size: 14px; line-height: 1; padding: 0 2px; flex: 0 0 auto;
}
.tf-attach-file-remove:hover { color: var(--color-danger); }

/* --- Table (users, departments) --- */
.tf-table-wrap { padding: 10px; }
.tf-table {
    width: 100%; border-collapse: collapse; font-size: 12px;
}
.tf-table th {
    text-align: left; padding: 6px 10px; font-family: var(--font-display);
    font-size: 10px; font-weight: 500; color: var(--text-muted);
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tf-table td {
    padding: 6px 10px; border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.tf-table tr:hover td { background: var(--bg-hover); }

/* Telegram indicator */
.tf-tg-status {
    display: inline-block; width: 8px; height: 8px;
    border-radius: 50%; margin-right: 4px;
}
.tf-tg-status.linked { background: var(--color-success); }
.tf-tg-status.unlinked { background: var(--text-muted); }

/* --- Settings page --- */
.tf-settings { padding: 10px; max-width: 600px; }
.tf-settings-group {
    margin-bottom: 16px; padding: 10px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius);
}
.tf-settings-title {
    font-family: var(--font-display); font-size: 12px; font-weight: 600;
    margin-bottom: 10px; color: var(--color-primary);
}

/* --- Toast notification --- */
.tf-toast {
    position: fixed; bottom: 20px; right: 20px;
    padding: 10px 16px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: 6px;
    font-family: var(--font-display); font-size: 13px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.35); z-index: 9999;
    animation: tfToastIn 0.25s ease-out;
    cursor: pointer; max-width: 400px; line-height: 1.4;
    color: var(--text-primary);
}
.tf-toast.success { border-left: 3px solid var(--color-success); }
.tf-toast.error { border-left: 3px solid var(--color-danger); }
@keyframes tfToastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- Loading --- */
.tf-loading {
    display: flex; align-items: center; justify-content: center;
    padding: 20px; color: var(--text-muted);
    font-family: var(--font-display); font-size: 11px;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========== МОДУЛЬ АРХИВА (ЖУРНАЛ) ========== */
.tf-archive { padding: 10px; }
.tf-archive-header { margin-bottom: 10px; }
.tf-archive-tabs { display: inline-flex; gap: 4px; }
.tf-archive-tab.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.tf-badge-archived { background: hsla(260, 50%, 50%, 0.15); color: hsl(260, 50%, 65%); }
.tf-badge-deleted { background: hsla(0, 60%, 45%, 0.15); color: hsl(0, 60%, 60%); }

/* Список карточек */
.tf-archive-list { display: flex; flex-direction: column; gap: 6px; }

/* Карточка задачи */
.tf-archive-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
}
.tf-archive-card-done { border-left-color: var(--ai-green, #10b981); }
.tf-archive-card-cancelled { border-left-color: var(--color-warning, #f59e0b); }
.tf-archive-card-deleted { border-left-color: var(--color-danger, #ef4444); opacity: 0.75; }

/* Верхняя строка: ID + Название + Бейджи */
.tf-archive-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.tf-archive-id {
    font-family: var(--font-display);
    font-size: 11px;
    color: var(--text-muted);
    flex: 0 0 auto;
}
.tf-archive-title {
    font-size: 13px;
    font-weight: 600;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Описание */
.tf-archive-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

/* Мета-данные */
.tf-archive-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 6px;
}
.tf-archive-meta-item {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.tf-archive-meta-label {
    color: var(--text-muted);
    white-space: nowrap;
}

/* Даты жизненного цикла */
.tf-archive-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-color);
}
.tf-archive-date-item {
    font-family: var(--font-display);
    font-size: 10px;
    color: var(--text-muted);
}
.tf-archive-date-label {
    color: var(--text-muted);
    opacity: 0.7;
}
.tf-archive-date-deleted {
    color: var(--color-danger, #ef4444);
}

/* Действия */
.tf-archive-actions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

/* ========== МОДУЛЬ СОВЕЩАНИЙ ========== */

.tf-meeting { padding: 10px; }
.tf-meeting-header { margin-bottom: 10px; }

/* Табы режимов ввода */
.tf-meeting-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.tf-mtab {
    padding: 6px 14px; border: 1px solid var(--border);
    background: transparent; color: var(--text-muted); border-radius: var(--radius);
    font-family: var(--font-display); font-size: 11px; cursor: pointer;
    transition: all 0.15s;
}
.tf-mtab:hover { color: var(--text-primary); border-color: var(--text-muted); }
.tf-mtab.active {
    background: var(--color-primary); color: #fff;
    border-color: var(--color-primary);
}

/* Textarea стенограммы */
.tf-meeting-input textarea {
    width: 100%; padding: 10px; background: var(--bg-card); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-family: var(--font-body); font-size: 12px; line-height: 1.5; resize: vertical;
}
.tf-meeting-input textarea:focus { border-color: var(--color-primary); outline: none; }

/* Зона загрузки аудио */
.tf-m-upload-zone {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 20px; text-align: center; color: var(--text-muted);
    font-size: 12px; cursor: pointer; transition: all 0.15s;
}
.tf-m-upload-zone:hover,
.tf-m-upload-zone.dragover {
    border-color: var(--color-primary); background: rgba(59,130,246,0.05);
}

/* Кнопка диктовки */
.tf-m-dictate-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: 50px;
    font-family: var(--font-display); font-size: 12px;
    transition: all 0.2s;
}
.tf-m-dictate-btn.recording {
    background: var(--color-danger); color: #fff;
    border-color: var(--color-danger);
    animation: tfPulse 1.5s ease-in-out infinite;
}
@keyframes tfPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
    50% { box-shadow: 0 0 0 10px rgba(239,68,68,0); }
}

/* Спиннер загрузки */
.tf-m-spinner {
    display: inline-block; width: 14px; height: 14px;
    border: 2px solid var(--border); border-top-color: var(--color-primary);
    border-radius: 50%; animation: tfSpin 0.6s linear infinite;
    vertical-align: middle; margin-right: 6px;
}
@keyframes tfSpin { to { transform: rotate(360deg); } }

/* Превью задач — заголовок */
.tf-m-preview-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--border); margin-bottom: 6px;
}

/* Таблица задач */
.tf-m-tasks-table { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tf-m-task-header {
    display: flex; gap: 6px; padding: 6px 8px;
    background: var(--bg-card); border-bottom: 1px solid var(--border);
}
.tf-m-th { font-family: var(--font-display); font-size: 10px; color: var(--text-muted); text-transform: uppercase; }

.tf-m-task-row {
    display: flex; gap: 6px; padding: 6px 8px; align-items: center;
    border-bottom: 1px solid var(--border); transition: background 0.1s;
}
.tf-m-task-row:last-child { border-bottom: none; }
.tf-m-task-row:hover { background: rgba(59,130,246,0.03); }

/* Inline-элементы в превью */
.tf-m-inline-input {
    width: 100%; padding: 4px 6px; background: transparent; color: var(--text-primary);
    border: 1px solid transparent; border-radius: 3px;
    font-family: var(--font-body); font-size: 11px;
}
.tf-m-inline-input:focus { border-color: var(--color-primary); background: var(--bg-card); outline: none; }

.tf-m-inline-select {
    width: 100%; padding: 3px 4px; background: transparent; color: var(--text-primary);
    border: 1px solid transparent; border-radius: 3px;
    font-size: 11px; cursor: pointer;
}
.tf-m-inline-select:focus { border-color: var(--color-primary); outline: none; }
.tf-m-inline-select option { background: var(--bg-card); color: var(--text-primary); }

.tf-m-task-desc {
    font-size: 10px; color: var(--text-muted); margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px;
}

/* AI подсказка (нераспознанный ответственный) */
.tf-m-ai-hint {
    font-size: 9px; color: var(--color-warning, hsl(38, 92%, 50%));
    font-style: italic; margin-top: 2px;
}

/* Фото OCR — превью изображения */
.tf-m-photo-preview-wrap {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 10px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius);
}
.tf-m-photo-thumb {
    max-width: 200px; max-height: 150px; border-radius: 4px;
    object-fit: contain; border: 1px solid var(--border);
}
.tf-m-photo-info { flex: 1; }

/* OCR результат */
.tf-m-ocr-result-wrap {
    padding: 10px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius);
}
.tf-m-ocr-textarea {
    width: 100%; padding: 8px; background: var(--bg-primary); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-family: var(--font-body); font-size: 12px; resize: vertical;
}
.tf-m-ocr-textarea:focus { border-color: var(--color-primary); outline: none; }

/* Фото зона — специфические стили */
.tf-m-photo-zone { min-height: 120px; }

/* --- История стенограмм --- */
.tf-m-history-section {
    border-top: 1px solid var(--border);
    padding-top: 10px;
}
.tf-m-history-header {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px 0;
    user-select: none;
}
.tf-m-history-header:hover { opacity: 0.8; }
.tf-m-history-arrow {
    transition: transform 0.2s;
    flex-shrink: 0;
}
.tf-m-history-arrow.open { transform: rotate(180deg); }
.tf-m-history-badge {
    font-size: 10px;
    background: var(--color-primary);
    color: #fff;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 600;
}
.tf-m-history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px 0;
}
.tf-m-history-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 11px;
}
.tf-m-history-item:hover { border-color: var(--color-primary); }
.tf-m-history-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    white-space: nowrap;
}
.tf-m-history-date {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text-primary);
}
.tf-m-history-source {
    color: var(--text-muted);
    display: flex;
    align-items: center;
}
.tf-m-history-user {
    color: var(--text-muted);
    font-size: 10px;
}
.tf-m-history-tasks-badge {
    font-size: 10px;
    background: hsl(142, 71%, 45%);
    color: #fff;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 600;
}
.tf-m-history-snippet {
    flex: 1;
    min-width: 120px;
    color: var(--text-muted);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tf-m-history-actions {
    flex: 0 0 auto;
}
.tf-m-recheck-btn {
    font-size: 10px !important;
    padding: 3px 8px !important;
}
/* Подсветка строк повторной проверки */
.tf-m-recheck-row {
    border-left: 3px solid var(--color-warning, #f59e0b);
}
/* Блок уже созданных задач (при повторной проверке) */
.tf-m-existing-block {
    background: var(--card-bg, #1a1a2e);
    border: 1px solid var(--border-color, #2a2a3e);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px;
}
.tf-m-existing-header {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    color: var(--ai-green, #10b981);
    margin-bottom: 6px;
}
.tf-m-existing-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.tf-m-existing-item {
    font-size: 11px;
    color: var(--text-muted, #999);
    background: var(--bg-primary, #0d0d1a);
    border: 1px solid var(--border-color, #2a2a3e);
    border-radius: 4px;
    padding: 3px 8px;
    white-space: nowrap;
}

/* ========== ДАШБОРД ========== */
.tf-dash { padding: 0; }

/* Счетчики — одна строка */
.tf-dash-counters {
    display: flex; gap: 10px; margin-bottom: 10px;
}
.tf-dash-card {
    flex: 1; padding: 10px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); text-align: center;
}
.tf-dash-card-value {
    font-family: var(--font-display); font-size: 24px; font-weight: 700;
    line-height: 1.2;
}
.tf-dash-card-label {
    font-family: var(--font-display); font-size: 10px;
    color: var(--text-muted); margin-top: 2px; text-transform: uppercase;
}
.tf-dash-card-new .tf-dash-card-value { color: var(--color-primary); }
.tf-dash-card-in_progress .tf-dash-card-value { color: var(--color-warning); }
.tf-dash-card-done .tf-dash-card-value { color: var(--color-success); }
.tf-dash-card-overdue .tf-dash-card-value { color: var(--color-danger); }

/* Ряд: 2 блока рядом */
.tf-dash-row {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 10px; margin-bottom: 10px; max-width: 100%;
}

/* Общий блок */
.tf-dash-block {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 10px;
    overflow: hidden; display: flex; flex-direction: column;
}
.tf-dash-block-title {
    font-family: var(--font-display); font-size: 11px; font-weight: 600;
    color: var(--color-primary); margin-bottom: 8px; text-transform: uppercase;
}
.tf-dash-empty {
    color: var(--text-muted); font-size: 12px; padding: 10px 0;
    font-family: var(--font-display);
}

/* Средний ряд: 3 колонки с resize (Live + Chart + Блоки) */
.tf-dash-row-mid {
    display: flex; align-items: stretch;
    grid-template-columns: none; overflow: hidden;
}
.tf-dash-row-mid > .tf-dash-block {
    overflow: hidden; min-width: 0; overflow-x: auto;
}
.tf-dash-dept-block .tf-table { width: 100%; table-layout: fixed; }
.tf-dash-dept-block .tf-table th:first-child,
.tf-dash-dept-block .tf-table td:first-child {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* График */
.tf-dash-chart-wrap {
    flex: 1; min-height: 160px; max-height: 210px;
    position: relative;
}

/* Live Activity Feed */
.tf-dash-live { display: flex; flex-direction: column; height: 100%; }
.tf-dash-live-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 6px;
}
.tf-dash-live-header .tf-dash-block-title { margin: 0; flex: 1; }
.tf-dash-live-online {
    display: flex; align-items: center; gap: 4px;
    font-size: 10px; color: var(--ai-green, #10b981);
    font-family: var(--font-display); font-weight: 600;
}
.tf-dash-live-online::before {
    content: ''; width: 6px; height: 6px;
    background: var(--ai-green, #10b981); border-radius: 50%;
    animation: tf-pulse-speak 1.5s infinite;
}
.tf-dash-live-pause {
    background: none; border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text-muted); cursor: pointer; padding: 2px 6px; font-size: 10px;
    font-family: var(--font-display);
}
.tf-dash-live-pause:hover { color: var(--text-primary); border-color: var(--text-muted); }
.tf-dash-live-pause.paused { color: var(--color-danger); border-color: var(--color-danger); }
.tf-dash-live-list {
    flex: 1; overflow-y: auto; min-height: 140px; max-height: 240px;
}
.tf-dash-live-list::-webkit-scrollbar { width: 3px; }
.tf-dash-live-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.tf-dash-live-item {
    display: flex; align-items: flex-start; gap: 6px;
    padding: 4px 0; border-bottom: 1px solid var(--border);
    font-size: 11px; line-height: 1.35;
}
.tf-dash-live-item:last-child { border-bottom: none; }
.tf-dash-live-icon { flex: 0 0 16px; width: 16px; height: 16px; margin-top: 1px; }
.tf-dash-live-text { flex: 1; color: var(--text-primary); word-break: break-word; }
.tf-dash-live-text b { font-weight: 600; }
.tf-dash-live-via {
    flex: 0 0 auto; font-size: 9px; padding: 1px 4px;
    border-radius: 3px; background: var(--bg-hover); color: var(--text-muted);
    font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.5px;
}
.tf-dash-live-time {
    flex: 0 0 auto; font-size: 10px; color: var(--text-muted);
    font-family: var(--font-display); white-space: nowrap;
}
.tf-dash-live-empty {
    text-align: center; padding: 30px 10px;
    font-size: 11px; color: var(--text-muted);
}
.tf-dash-live-new { animation: tf-live-flash 0.6s ease-out; }
@keyframes tf-live-flash {
    0% { background: hsla(217, 91%, 60%, 0.15); }
    100% { background: transparent; }
}

/* Таблица по отделам */
.tf-dash-table { font-size: 11px; width: 100%; table-layout: auto; }
.tf-dash-table td { padding: 4px 6px; white-space: nowrap; }
.tf-dash-table th { padding: 4px 6px; white-space: nowrap; font-size: 10px; }
.tf-dash-num { text-align: center; font-family: var(--font-display); }
.tf-dash-num.overdue { color: var(--color-danger); font-weight: 600; }
.tf-dash-dept-row { cursor: pointer; }
.tf-dash-dept-row:hover td { background: var(--bg-hover); }

/* Последние задачи */
.tf-dash-recent-list { overflow-y: auto; max-height: 260px; }
.tf-dash-recent-item {
    padding: 6px 0; border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background 0.1s;
}
.tf-dash-recent-item:last-child { border-bottom: none; }
.tf-dash-recent-item:hover { background: var(--bg-hover); padding-left: 4px; padding-right: 4px; border-radius: var(--radius); }
.tf-dash-recent-top {
    display: flex; align-items: center; gap: 6px;
}
.tf-dash-recent-title {
    flex: 1; font-size: 12px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tf-dash-recent-meta {
    display: flex; gap: 8px; font-size: 10px;
    color: var(--text-muted); font-family: var(--font-display); margin-top: 2px;
}

/* Топ сотрудников */
.tf-dash-users-list { overflow-y: auto; max-height: 260px; }
.tf-dash-user-row {
    padding: 5px 0; border-bottom: 1px solid var(--border);
    cursor: pointer;
}
.tf-dash-user-row:last-child { border-bottom: none; }
.tf-dash-user-row:hover { background: var(--bg-hover); }
.tf-dash-user-info {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 3px;
}
.tf-dash-user-name { font-size: 12px; font-weight: 500; }
.tf-dash-user-count {
    font-family: var(--font-display); font-size: 11px;
    color: var(--color-primary); font-weight: 600;
}
.tf-dash-user-bar {
    height: 4px; background: var(--border); border-radius: 2px;
    overflow: hidden;
}
.tf-dash-user-bar-fill {
    height: 100%; background: var(--color-primary);
    border-radius: 2px; transition: width 0.3s ease;
}

/* Нижний ряд: 3 колонки с resize (задачи + сотрудники + AI чат) */
.tf-dash-row-bottom {
    display: flex; align-items: stretch;
    grid-template-columns: none;
}
.tf-dash-row-bottom > .tf-dash-block {
    overflow: visible; min-width: 120px; min-height: 300px;
}
/* Вертикальный разделитель для resize */
.tf-dash-resize-handle {
    flex: 0 0 6px; cursor: col-resize;
    background: var(--border); border-radius: 3px;
    position: relative; z-index: 2;
    transition: background 0.15s;
}
.tf-dash-resize-handle:hover,
.tf-dash-resize-handle.active {
    background: var(--color-primary);
}
.tf-dash-resize-handle::after {
    content: ''; position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 2px; height: 24px;
    background: var(--text-muted); border-radius: 1px;
    opacity: 0.4;
}
.tf-dash-resize-handle:hover::after,
.tf-dash-resize-handle.active::after {
    opacity: 0.8; background: #fff;
}

/* AI Чат на дашборде */
/* --- Dash AI Header + Voice --- */
.tf-dash-ai-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 4px;
}
.tf-dash-ai-voice-toggle {
    background: none; border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text-muted); cursor: pointer; padding: 3px 6px;
    display: flex; align-items: center; transition: all 0.15s;
}
.tf-dash-ai-voice-toggle:hover { color: var(--text-primary); border-color: var(--text-muted); }
.tf-dash-ai-voice-toggle.active {
    color: var(--ai-green, #10b981); border-color: var(--ai-green, #10b981);
    background: hsla(160, 84%, 39%, 0.1);
}
.tf-dash-ai-speak-btn {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    padding: 2px 4px; border-radius: 3px; flex-shrink: 0;
    opacity: 0; transition: opacity 0.15s, color 0.15s;
}
.tf-dash-ai-msg-bot:hover .tf-dash-ai-speak-btn { opacity: 1; }
.tf-dash-ai-speak-btn:hover { color: var(--ai-green, #10b981); }
.tf-dash-ai-speak-btn.speaking {
    opacity: 1; color: var(--ai-green, #10b981);
    animation: tf-pulse-speak 1.5s infinite;
}

.tf-dash-ai-block {
    display: flex; flex-direction: column;
    min-height: 280px;
}
.tf-dash-ai-messages {
    flex: 1; overflow-y: auto; padding: 8px;
    min-height: 180px;
    border: 1px solid hsla(142, 71%, 45%, 0.2);
    border-radius: var(--radius);
    background: var(--bg-primary);
}
.tf-dash-ai-messages::-webkit-scrollbar { width: 4px; }
.tf-dash-ai-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.tf-dash-ai-msg {
    margin-bottom: 6px; padding: 6px 8px;
    border-radius: var(--radius); font-size: 12px;
    line-height: 1.4; max-width: 85%; word-wrap: break-word;
}
.tf-dash-ai-msg-user {
    background: hsla(217, 91%, 60%, 0.15); color: var(--text-primary);
    margin-left: auto; text-align: right;
}
.tf-dash-ai-msg-bot {
    background: var(--bg-hover); color: var(--text-primary);
    display: flex; align-items: flex-start; gap: 4px;
}
.tf-dash-ai-msg-content { flex: 1; min-width: 0; word-wrap: break-word; }
.tf-dash-ai-msg-bot .tf-dash-ai-sender {
    font-size: 9px; color: var(--ai-green, #10b981); font-family: var(--font-display);
    font-weight: 600; margin-bottom: 2px;
}
.tf-dash-ai-input-row {
    display: flex; gap: 6px; margin-top: 6px;
    padding-top: 6px; border-top: 1px solid var(--border);
}
.tf-dash-ai-input {
    flex: 1; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 6px 8px; font-size: 12px;
    font-family: var(--font-body); color: var(--text-primary); resize: none;
    min-height: 32px; max-height: 60px;
}
.tf-dash-ai-input:focus { border-color: var(--border-focus); outline: none; }
.tf-dash-ai-send {
    flex: 0 0 auto; background: var(--ai-green, #10b981); color: #fff;
    border: none; border-radius: var(--radius); padding: 6px 10px;
    cursor: pointer; font-size: 11px; font-family: var(--font-display);
    font-weight: 600; white-space: nowrap;
}
.tf-dash-ai-send:hover { opacity: 0.85; }
.tf-dash-ai-send:disabled { opacity: 0.5; cursor: not-allowed; }
.tf-dash-ai-typing {
    font-size: 11px; color: var(--text-muted); font-family: var(--font-display);
    padding: 4px 8px; animation: tf-pulse-speak 1.5s infinite;
}
.tf-dash-ai-welcome {
    font-size: 11px; color: var(--text-muted); text-align: center;
    padding: 20px 10px; line-height: 1.5;
}

/* === File attach button === */
.tf-dash-ai-attach {
    flex: 0 0 auto; background: none; border: 1px solid var(--border);
    color: var(--text-muted); border-radius: var(--radius); padding: 4px 6px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: color 0.15s, border-color 0.15s;
}
.tf-dash-ai-attach:hover { color: var(--color-primary); border-color: var(--color-primary); }

/* === File preview === */
.tf-dash-ai-file-preview {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 8px; margin-top: 4px;
    background: rgba(59, 130, 246, 0.08); border-radius: var(--radius);
    font-size: 11px; color: var(--color-primary);
}
.tf-dash-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-dash-file-remove {
    flex: 0 0 auto; background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px;
}
.tf-dash-file-remove:hover { color: var(--color-danger); }

/* === Task checklist === */
.tf-dash-ai-checklist {
    margin-top: 8px; padding: 8px; background: rgba(255,255,255,0.03);
    border: 1px solid var(--border); border-radius: var(--radius);
}
.tf-dash-check-item {
    display: flex; align-items: flex-start; gap: 6px;
    padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer; font-size: 12px; color: var(--text-primary);
}
.tf-dash-check-item:last-of-type { border-bottom: none; }
.tf-dash-check-item input[type=checkbox] {
    flex: 0 0 auto; margin-top: 2px; accent-color: var(--color-primary);
    width: 14px; height: 14px; cursor: pointer;
}
.tf-dash-check-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tf-dash-check-title { font-weight: 500; line-height: 1.3; }
.tf-dash-check-desc {
    font-size: 10px; color: var(--text-muted); line-height: 1.3;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tf-dash-check-badge {
    flex: 0 0 auto; padding: 1px 5px; border-radius: 3px;
    font-size: 9px; font-weight: 600; text-transform: uppercase;
    white-space: nowrap; margin-top: 2px;
}
.tf-dash-check-high { background: rgba(251,191,36,0.15); color: #fbbf24; }
.tf-dash-check-urgent { background: rgba(239,68,68,0.15); color: #ef4444; }
.tf-dash-check-low { background: rgba(148,163,184,0.15); color: #94a3b8; }

.tf-dash-check-actions {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; margin-top: 8px; padding-top: 6px;
    border-top: 1px solid var(--border);
}
.tf-dash-check-count { font-size: 10px; color: var(--text-muted); }
.tf-dash-check-create {
    background: var(--color-primary); color: #fff; border: none;
    border-radius: var(--radius); padding: 5px 12px; font-size: 11px;
    font-weight: 600; cursor: pointer; white-space: nowrap;
    transition: opacity 0.15s;
}
.tf-dash-check-create:hover { opacity: 0.85; }
.tf-dash-check-create:disabled { opacity: 0.5; cursor: not-allowed; }

.tf-dash-check-done {
    text-align: center; padding: 10px; font-size: 12px;
    color: var(--ai-green, #10b981); font-weight: 600;
}
.tf-dash-check-created-list { margin-top: 4px; }
.tf-dash-check-created-item {
    font-size: 11px; color: var(--text-muted); padding: 2px 0;
    text-align: center;
}

@media (max-width: 768px) {
    .tf-dash-row-mid { flex-direction: column; }
    .tf-dash-row-mid > .tf-dash-block { width: 100% !important; }
    .tf-dash-row-bottom { flex-direction: column; }
    .tf-dash-row-bottom > .tf-dash-block { width: 100% !important; }
    .tf-dash-resize-handle { display: none; }
}

/* ========== МОДУЛЬ СТРУКТУРА ========== */
.tf-structure { padding: 10px; }
.tf-structure-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.tf-structure-title {
    font-family: var(--font-display); font-size: 14px; font-weight: 600;
}
.tf-str-block { margin-bottom: 6px; }
/* Цветовая точка блока (направления) — используется везде */
.tf-block-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 8px;
    vertical-align: middle;
}
.tf-str-color {
    display: inline-block; width: 10px; height: 10px;
    border-radius: 2px; flex: 0 0 10px;
}
.tf-str-block-name { font-weight: 600; font-size: 12px; }
.tf-str-meta {
    font-size: 10px; color: var(--text-muted); margin-left: auto; margin-right: 8px;
}
.tf-str-owner {
    font-size: 10px; color: var(--text-secondary); margin-right: 8px;
}
.tf-str-status { margin-right: 6px; }
.tf-str-empty {
    padding: 10px; color: var(--text-muted); font-size: 11px;
    font-family: var(--font-display);
}
.tf-str-fn-table { margin: 0; }
.tf-str-sort {
    font-family: var(--font-display); font-size: 10px;
    color: var(--text-muted); width: 30px; text-align: center;
}
.tf-text-muted { color: var(--text-muted); }

/* ========== ВЛОЖЕНИЯ К ЗАДАЧАМ ========== */
.tf-att-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.tf-att-list { display: flex; flex-direction: column; gap: 4px; }
.tf-att-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px; border: 1px solid var(--border-color);
    border-radius: 4px; font-size: 11px; transition: background 0.15s;
}
.tf-att-item:hover { background: var(--bg-hover); }
.tf-att-icon { flex: 0 0 auto; width: 20px; height: 20px; }
.tf-att-icon svg { width: 20px; height: 20px; }
.tf-att-info { flex: 1; min-width: 0; }
.tf-att-name {
    font-weight: 500; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.tf-att-meta {
    font-size: 9px; color: var(--text-muted);
    font-family: var(--font-display); display: flex; gap: 8px;
}
.tf-att-collab { display: inline-flex; gap: 3px; margin-left: 4px; }
.tf-att-collab-badge {
    font-size: 9px; padding: 1px 5px; border-radius: 8px;
    background: hsla(217, 91%, 60%, 0.1); color: var(--color-primary);
    font-family: var(--font-display);
}
.tf-att-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.tf-att-upload-zone {
    display: none; padding: 8px; margin-top: 6px;
    border: 1px dashed var(--border-color); border-radius: 4px;
}
.tf-att-upload-zone.open { display: block; }
.tf-att-collab-select { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tf-att-collab-check { display: flex; align-items: center; gap: 3px; font-size: 11px; cursor: pointer; }
.tf-att-empty { padding: 10px; color: var(--text-muted); font-size: 11px; text-align: center; }

/* ========== МИНИ-ЧАТ В ЗАДАЧЕ ========== */
.tf-chat-wrap {
    display: flex; flex-direction: column;
    min-height: 150px; max-height: calc(100vh - 500px);
    overflow-y: auto; padding: 6px 0;
}
.tf-chat-msg {
    max-width: 75%; padding: 6px 10px; margin-bottom: 4px;
    border-radius: 8px; font-size: 12px; line-height: 1.4;
    word-wrap: break-word; color: var(--text-primary);
}
.tf-chat-msg-text { color: var(--text-primary); }
.tf-chat-outgoing {
    align-self: flex-end; margin-left: auto;
    background: hsla(217, 91%, 60%, 0.12);
    border-bottom-right-radius: 2px;
}
.tf-chat-incoming {
    align-self: flex-start;
    background: var(--bg-hover, hsla(0, 0%, 50%, 0.08));
    border-bottom-left-radius: 2px;
}
.tf-chat-ai {
    align-self: flex-start;
    background: hsla(142, 71%, 45%, 0.08);
    border-left: 2px solid var(--ai-green, #10b981);
    border-bottom-left-radius: 2px;
}
.tf-chat-speak-btn {
    background: none; border: none; cursor: pointer; padding: 0 2px;
    color: var(--ai-green, #10b981); opacity: 0.6; transition: opacity 0.2s;
    vertical-align: middle; margin-left: 4px;
}
.tf-chat-speak-btn:hover { opacity: 1; }
.tf-chat-speak-btn.speaking { opacity: 1; animation: tf-pulse-speak 1s infinite; }
@keyframes tf-pulse-speak {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.tf-chat-sender {
    font-size: 9px; color: var(--text-muted); opacity: 0.8;
    font-family: var(--font-display); margin-bottom: 2px;
}
.tf-chat-time {
    font-size: 9px; color: var(--text-muted); opacity: 0.6;
    font-family: var(--font-display); margin-top: 2px; text-align: right;
}
.tf-chat-ai-badge {
    font-size: 9px; padding: 1px 5px; border-radius: 8px;
    background: hsla(142, 71%, 45%, 0.15); color: var(--ai-green, #10b981);
    font-family: var(--font-display); font-weight: 600;
}
.tf-chat-feedback {
    display: flex; gap: 4px; margin-top: 4px; justify-content: flex-start;
}
.tf-chat-fb-btn {
    background: none; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 2px 6px; cursor: pointer; opacity: 0.5; color: var(--text-muted);
    transition: opacity 0.2s, color 0.2s, border-color 0.2s;
    display: flex; align-items: center;
}
.tf-chat-fb-btn:hover { opacity: 1; }
.tf-chat-fb-up:hover { color: var(--color-success); border-color: var(--color-success); }
.tf-chat-fb-down:hover { color: var(--color-danger); border-color: var(--color-danger); }
.tf-chat-input {
    display: flex; gap: 6px; margin-top: 6px;
    padding-top: 6px; border-top: 1px solid var(--border-color);
}
.tf-chat-input input { flex: 1; }
.tf-chat-ai-area {
    display: none; margin-top: 6px; padding: 6px;
    background: hsla(142, 71%, 45%, 0.04);
    border: 1px solid hsla(142, 71%, 45%, 0.15);
    border-radius: 4px;
}
.tf-chat-ai-area.open { display: flex; gap: 6px; align-items: center; }
.tf-chat-ai-area.tf-chat-ai-always { display: flex; gap: 6px; align-items: center; }
.tf-chat-ai-area input { flex: 1; }
.tf-chat-ai-indicator {
    flex: 0 0 auto; display: flex; align-items: center;
    color: var(--ai-green, #10b981); opacity: 0.8;
}
.tf-btn-ai {
    background: var(--ai-green, #10b981); border-color: var(--ai-green, #10b981);
    color: #fff; font-size: 11px; padding: 3px 10px; border-radius: var(--radius, 6px);
    cursor: pointer; white-space: nowrap; transition: opacity 0.15s;
}
.tf-btn-ai:hover { opacity: 0.85; }
.tf-ai-file-preview {
    border-color: hsla(142, 71%, 45%, 0.3);
    background: hsla(142, 71%, 45%, 0.04);
}
.tf-chat-empty { padding: 20px; color: var(--text-muted); font-size: 11px; text-align: center; }
.tf-chat-typing {
    font-size: 10px; color: var(--ai-green, #10b981); padding: 4px 0;
    font-family: var(--font-display);
}
/* AI-изображения в чате */
.tf-chat-msg-image { margin: 4px 0; }
.tf-chat-msg-image a { display: block; }
.tf-chat-msg-image img {
    max-width: 100%; max-height: 300px; border-radius: 4px;
    cursor: pointer; transition: opacity 0.15s;
}
.tf-chat-msg-image img:hover { opacity: 0.85; }
.tf-chat-msg-caption {
    font-size: 10px; color: var(--text-muted); margin-top: 4px;
    line-height: 1.3; font-style: italic;
}

/* ========== AI НАСТРОЙКИ + БАЗА ЗНАНИЙ ========== */
.tf-ai-settings { display: flex; flex-direction: column; gap: 8px; }
.tf-kb-section { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.tf-kb-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.tf-kb-form {
    padding: 10px; margin-bottom: 8px;
    background: var(--bg-primary); border: 1px solid var(--border);
    border-radius: var(--radius);
}
.tf-kb-item {
    padding: 8px 10px; margin-bottom: 4px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); transition: border-color 0.15s;
}
.tf-kb-item:hover { border-color: var(--color-primary); }
.tf-kb-item.tf-kb-inactive { opacity: 0.5; }
.tf-kb-item-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 4px;
}
.tf-kb-item-title {
    font-weight: 600; font-size: 12px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tf-kb-item-meta {
    display: flex; align-items: center; gap: 6px; flex: 0 0 auto;
}
.tf-kb-category {
    font-size: 9px; padding: 1px 6px; border-radius: 8px;
    background: hsla(217, 91%, 60%, 0.1); color: var(--color-primary);
    font-family: var(--font-display); text-transform: uppercase;
}
.tf-kb-toggle-active { cursor: pointer; display: flex; align-items: center; }
.tf-kb-toggle-active:hover { opacity: 0.7; }
.tf-kb-item-content {
    font-size: 11px; color: var(--text-secondary); line-height: 1.4;
    margin-bottom: 4px;
}
.tf-kb-item-actions {
    display: flex; gap: 4px; justify-content: flex-end;
}
.tf-select {
    width: 100%; padding: 6px 8px; font-size: 12px;
    background: var(--bg-input); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-family: var(--font-body);
}
.tf-select:focus { border-color: var(--color-primary); outline: none; }

/* Структура команды — превью */
.tf-team-info {
    font-size: 11px; color: var(--text-muted); margin-bottom: 8px;
    font-family: var(--font-display); line-height: 1.4;
}
.tf-team-blocks { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.tf-team-block {
    padding: 6px 8px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius);
}
.tf-team-block-name {
    font-size: 12px; font-weight: 600;
    display: flex; align-items: center; gap: 6px;
}
.tf-team-owner {
    font-weight: 400; font-size: 10px; color: var(--color-primary);
    font-family: var(--font-display);
}
.tf-team-functions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tf-team-fn {
    font-size: 10px; padding: 2px 6px; border-radius: 4px;
    background: var(--bg-hover); color: var(--text-secondary);
    font-family: var(--font-display);
}
.tf-team-fn-owner { color: var(--text-muted); font-size: 9px; }
.tf-team-users { display: flex; flex-wrap: wrap; gap: 4px; }
.tf-team-user {
    font-size: 11px; padding: 3px 8px; border-radius: 4px;
    background: var(--bg-card); border: 1px solid var(--border);
}
.tf-team-user-block {
    font-size: 9px; color: var(--text-muted); font-family: var(--font-display);
}

/* ========== ГАЛЕРЕЯ ИЗОБРАЖЕНИЙ ========== */
.tf-gl-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.tf-gl-title {
    font-family: var(--font-display); font-size: 14px; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
}
.tf-gl-stats {
    display: flex; gap: 12px;
    font-size: 11px; color: var(--text-secondary);
    font-family: var(--font-display);
}
.tf-gl-stat b { color: var(--text-primary); font-weight: 600; }

/* Генератор */
.tf-gl-generator {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 10px; margin-bottom: 10px;
}
.tf-gl-gen-row {
    display: flex; gap: 8px; align-items: center;
}
.tf-gl-prompt-input { flex: 1; }
.tf-gl-size-group {
    display: flex; gap: 2px;
    background: var(--bg-primary); border-radius: var(--radius);
    padding: 2px;
}
.tf-gl-size-btn {
    background: none; border: none; color: var(--text-muted);
    font-family: var(--font-display); font-size: 10px;
    padding: 4px 8px; border-radius: 3px; cursor: pointer;
    transition: all 0.15s;
}
.tf-gl-size-btn:hover { color: var(--text-primary); }
.tf-gl-size-btn.active {
    background: var(--color-primary); color: #fff;
}

/* Тулбар фильтров */
.tf-gl-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px; gap: 10px;
}
.tf-gl-filters { display: flex; gap: 4px; }
.tf-gl-filter-btn {
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-secondary); font-size: 11px; padding: 4px 10px;
    border-radius: var(--radius); cursor: pointer; transition: all 0.15s;
    font-family: var(--font-body);
}
.tf-gl-filter-btn:hover { border-color: var(--color-primary); color: var(--text-primary); }
.tf-gl-filter-btn.active {
    background: var(--color-primary); border-color: var(--color-primary);
    color: #fff;
}
.tf-gl-search { max-width: 200px; }

/* Сетка карточек */
.tf-gl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    overflow-y: auto;
    max-height: calc(100vh - 260px);
    padding-bottom: 10px;
}

/* Карточка */
.tf-gl-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    cursor: pointer; transition: all 0.15s; position: relative;
}
.tf-gl-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.tf-gl-card-img {
    position: relative; overflow: hidden;
    aspect-ratio: 1; background: var(--bg-primary);
}
.tf-gl-card-img img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.2s;
}
.tf-gl-card:hover .tf-gl-card-img img {
    transform: scale(1.05);
}
.tf-gl-card-source {
    position: absolute; top: 6px; left: 6px;
    font-size: 9px; padding: 2px 6px; border-radius: 8px;
    background: rgba(0,0,0,0.7); color: #fff;
    font-family: var(--font-display); text-transform: uppercase;
}
.tf-gl-card-info { padding: 8px 10px; }
.tf-gl-card-title {
    font-size: 11px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 2px;
}
.tf-gl-card-meta {
    display: flex; gap: 8px; font-size: 10px;
    color: var(--text-muted); font-family: var(--font-display);
}
.tf-gl-card-actions {
    position: absolute; top: 6px; right: 6px;
    display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s;
}
.tf-gl-card:hover .tf-gl-card-actions { opacity: 1; }
.tf-gl-fav-btn, .tf-gl-del-btn {
    background: rgba(0,0,0,0.6); border: none; color: #fff;
    width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.15s;
}
.tf-gl-fav-btn:hover { background: rgba(0,0,0,0.8); }
.tf-gl-fav-btn.active { color: hsl(38, 92%, 50%); }
.tf-gl-del-btn:hover { background: hsla(0, 84%, 60%, 0.8); }

/* Пустое состояние */
.tf-gl-empty {
    grid-column: 1 / -1; text-align: center; padding: 60px 20px;
    color: var(--text-muted);
}
.tf-gl-empty p { margin-top: 8px; font-size: 13px; }
.tf-gl-empty-hint { font-size: 11px; color: var(--text-muted); }

/* ========== LIGHTBOX ========== */
.tf-gl-lightbox-overlay {
    position: fixed; inset: 0; z-index: 9000;
    background: rgba(0,0,0,0.92);
    display: flex; align-items: center; justify-content: center;
    animation: tf-gl-lb-fade 0.2s ease;
}
@keyframes tf-gl-lb-fade {
    from { opacity: 0; } to { opacity: 1; }
}
.tf-gl-lightbox {
    display: flex; gap: 0; max-width: 95vw; max-height: 92vh;
    background: var(--bg-card); border-radius: 6px;
    overflow: hidden; position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.tf-gl-lightbox-close {
    position: absolute; top: 8px; right: 8px; z-index: 10;
    background: rgba(0,0,0,0.5); border: none; color: #fff;
    width: 32px; height: 32px; border-radius: 50%;
    font-size: 20px; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: background 0.15s;
}
.tf-gl-lightbox-close:hover { background: rgba(0,0,0,0.8); }

/* Навигация */
.tf-gl-lightbox-prev, .tf-gl-lightbox-next {
    position: absolute; top: 50%; transform: translateY(-50%);
    z-index: 10; background: rgba(0,0,0,0.5); border: none;
    color: #fff; width: 36px; height: 36px; border-radius: 50%;
    font-size: 22px; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: background 0.15s;
}
.tf-gl-lightbox-prev { left: 8px; }
.tf-gl-lightbox-next { right: 8px; }
.tf-gl-lightbox-prev:hover, .tf-gl-lightbox-next:hover {
    background: rgba(0,0,0,0.8);
}

/* Изображение */
.tf-gl-lightbox-img-wrap {
    flex: 1; display: flex; align-items: center; justify-content: center;
    background: #000; min-width: 400px; max-width: 70vw;
}
.tf-gl-lightbox-img-wrap img {
    max-width: 100%; max-height: 90vh; object-fit: contain;
}

/* Информация */
.tf-gl-lightbox-info {
    width: 280px; min-width: 280px; padding: 16px;
    overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
    background: var(--bg-card); border-left: 1px solid var(--border);
}
.tf-gl-lightbox-title {
    font-family: var(--font-display); font-size: 13px; font-weight: 600;
    line-height: 1.3;
}
.tf-gl-lightbox-prompt {
    font-size: 11px; color: var(--text-secondary); line-height: 1.4;
    padding: 8px; background: var(--bg-primary);
    border-radius: var(--radius); border: 1px solid var(--border);
}
.tf-gl-lightbox-revised {
    font-size: 10px; color: var(--text-muted); line-height: 1.3;
}
.tf-gl-lightbox-revised span {
    font-weight: 600; color: var(--color-primary);
    font-family: var(--font-display);
}
.tf-gl-lightbox-meta {
    display: flex; flex-wrap: wrap; gap: 6px;
    font-size: 10px; color: var(--text-muted);
    font-family: var(--font-display);
}
.tf-gl-lightbox-meta span {
    padding: 2px 6px; background: var(--bg-primary);
    border-radius: 4px;
}

/* Действия в lightbox */
.tf-gl-lightbox-actions {
    display: flex; flex-direction: column; gap: 4px;
    margin-top: auto; padding-top: 10px;
    border-top: 1px solid var(--border);
}
.tf-gl-lb-fav, .tf-gl-lb-download, .tf-gl-lb-delete {
    background: var(--bg-primary); border: 1px solid var(--border);
    color: var(--text-secondary); padding: 6px 10px;
    border-radius: var(--radius); cursor: pointer;
    font-size: 11px; font-family: var(--font-body);
    display: flex; align-items: center; gap: 6px;
    transition: all 0.15s;
}
.tf-gl-lb-fav:hover { border-color: hsl(38, 92%, 50%); color: hsl(38, 92%, 50%); }
.tf-gl-lb-fav.active { color: hsl(38, 92%, 50%); border-color: hsl(38, 92%, 50%); }
.tf-gl-lb-download:hover { border-color: var(--color-primary); color: var(--color-primary); }
.tf-gl-lb-delete:hover { border-color: var(--color-danger); color: var(--color-danger); }

/* --- Responsive --- */

/* Адаптация деталей при средней ширине */
@media (max-width: 1200px) {
    .tf-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .tf-split { flex-direction: column; }
    .tf-panel-left { width: 100% !important; min-width: 0 !important; max-width: none !important; max-height: 40vh; }
    .tf-panel-right { max-height: 60vh; }
    .tf-split-handle { display: none; }
    .tf-webhook-bar { display: none; }
    .tf-m-task-header { display: none; }
    .tf-m-task-row { flex-wrap: wrap; }
    .tf-dash-counters { flex-wrap: wrap; }
    .tf-dash-card { flex: 0 0 calc(50% - 5px); }
    .tf-dash-row { grid-template-columns: 1fr; }
    .tf-detail-grid { grid-template-columns: 1fr; }
    .tf-filters select { min-width: 70px; }
}

/* ========== ЧАТ: ПРИКРЕПЛЕНИЕ ФАЙЛОВ ========== */
.tf-chat-file-preview {
    padding: 6px 8px;
    background: var(--bg-card);
    border: 1px solid var(--ai-green, #10b981);
    border-radius: var(--radius, 6px);
    margin-bottom: 4px;
}
.tf-chat-file-info {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; color: var(--text-primary);
    margin-bottom: 4px;
}
.tf-chat-file-info svg { flex: 0 0 auto; }
#tf-chat-file-name {
    flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-weight: 500;
}
.tf-chat-file-remove {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px;
}
.tf-chat-file-remove:hover { color: var(--color-danger, #e74c3c); }
#tf-chat-attach {
    color: var(--text-muted); transition: color 0.2s;
}
#tf-chat-attach:hover { color: var(--ai-green, #10b981); }

/* Файл в сообщении чата */
.tf-chat-msg-file {
    margin: 4px 0;
}
.tf-chat-file-link {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; color: var(--color-primary, #3b82f6);
    text-decoration: none; padding: 4px 8px;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 4px; border: 1px solid rgba(59, 130, 246, 0.2);
    transition: background 0.2s;
}
.tf-chat-file-link:hover {
    background: rgba(59, 130, 246, 0.15);
    text-decoration: none;
}
.tf-chat-file-caption {
    font-size: 11px; color: var(--text-secondary);
    margin-top: 3px; font-style: italic;
}

/* --- Meeting File Chat --- */
.tf-mfc-wrap { width: 100%; }

.tf-mfc-upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: border-color 0.2s, background 0.2s;
}
.tf-mfc-upload-zone:hover,
.tf-mfc-upload-zone.dragover {
    border-color: var(--color-primary);
    background: rgba(59, 130, 246, 0.05);
}

.tf-mfc-loader {
    padding: 10px;
    color: var(--text-muted);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tf-mfc-file-info {
    padding: 8px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.tf-mfc-messages {
    min-height: 200px;
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tf-mfc-msg {
    max-width: 85%;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.4;
}
.tf-mfc-msg-user {
    align-self: flex-end;
    background: var(--color-primary);
    color: #fff;
    border-bottom-right-radius: 2px;
}
.tf-mfc-msg-ai {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom-left-radius: 2px;
}

.tf-mfc-msg-sender {
    font-size: 9px;
    opacity: 0.7;
    margin-bottom: 2px;
}
.tf-mfc-msg-text { word-break: break-word; }
.tf-mfc-msg-time {
    font-size: 9px;
    opacity: 0.5;
    text-align: right;
    margin-top: 2px;
}

.tf-mfc-typing {
    padding: 6px 10px;
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

.tf-mfc-input-row {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}
.tf-mfc-input-row .tf-input {
    flex: 1;
}

/* === Мини-плеер записи совещания === */
.tf-rec-mini {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--color-danger);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 1000;
    overflow: hidden;
    font-family: var(--font-body);
}
.tf-rec-mini-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--color-danger);
    color: #fff;
}
.tf-rec-mini-indicator {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    animation: tfPulse 1.5s ease-in-out infinite;
}
.tf-rec-mini-title {
    flex: 1;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-display);
}
.tf-rec-mini-actions {
    display: flex;
    gap: 4px;
}
.tf-rec-mini-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.tf-rec-mini-btn:hover {
    background: rgba(255,255,255,0.35);
}
.tf-rec-mini-text {
    padding: 8px 10px;
    font-size: 11px;
    color: var(--text-muted);
    max-height: 60px;
    overflow-y: auto;
    line-height: 1.4;
    word-break: break-word;
}
.tf-rec-mini-timer {
    padding: 4px 10px 8px;
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-display);
}

/* === Кнопка голосового ввода (универсальная) === */
.tf-voice-btn {
    color: var(--text-muted);
    transition: color 0.15s;
    flex-shrink: 0;
}
.tf-voice-btn:hover {
    color: var(--text-primary);
}
.tf-voice-btn.tf-voice-active {
    color: var(--color-danger);
    animation: tfPulse 1.5s ease-in-out infinite;
}
/* В label — inline рядом с текстом */
label .tf-voice-btn {
    vertical-align: middle;
    margin-left: 4px;
    padding: 2px 4px;
}

/* --- Private Tasks --- */
.tf-private-icon {
    color: var(--color-warning, hsl(45, 90%, 55%));
    vertical-align: -2px;
    flex-shrink: 0;
}
.tf-private-toggle {
    margin-top: 4px;
}
.tf-toggle-label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
}
.tf-toggle-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--color-primary);
    cursor: pointer;
}
.tf-toggle-label .tf-muted {
    color: var(--text-muted);
    font-size: 11px;
}
.tf-toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    user-select: none;
}
.tf-toggle-switch input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--color-warning);
    cursor: pointer;
    margin: 0;
}
.tf-toggle-switch.checked {
    color: var(--color-warning, hsl(45, 90%, 55%));
}
.tf-toggle-switch svg {
    vertical-align: -1px;
}
.tf-badge-private {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    color: hsl(45, 90%, 55%);
    background: hsla(45, 90%, 55%, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 6px;
}

/* --- Empty State --- */
.tf-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 16px;
    text-align: center;
    min-height: 120px;
}

/* --- Disabled buttons during request --- */
.tf-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- Журнал изменений --- */
.tf-history-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.tf-history-item {
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 11px;
    background: var(--card-bg);
    border-left: 3px solid var(--border-color);
}
.tf-history-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.tf-history-action {
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--border-color);
    color: var(--text-primary);
    white-space: nowrap;
}
.tf-history-action-delegate { background: hsl(210, 60%, 25%); color: hsl(210, 80%, 75%); }
.tf-history-action-deadline_change { background: hsl(30, 60%, 25%); color: hsl(30, 80%, 75%); }
.tf-history-action-field_change { background: hsl(260, 40%, 25%); color: hsl(260, 60%, 75%); }
.tf-history-action-status_change { background: hsl(150, 50%, 20%); color: hsl(150, 60%, 70%); }
.tf-history-action-create { background: hsl(120, 40%, 20%); color: hsl(120, 50%, 70%); }
.tf-history-action-rework { background: hsl(40, 60%, 25%); color: hsl(40, 80%, 70%); }
.tf-history-action-approve { background: hsl(150, 60%, 20%); color: hsl(150, 70%, 65%); }
html.light-theme .tf-history-action-delegate { background: hsl(210, 60%, 90%); color: hsl(210, 70%, 35%); }
html.light-theme .tf-history-action-deadline_change { background: hsl(30, 60%, 90%); color: hsl(30, 60%, 35%); }
html.light-theme .tf-history-action-field_change { background: hsl(260, 40%, 90%); color: hsl(260, 50%, 35%); }
html.light-theme .tf-history-action-status_change { background: hsl(150, 50%, 90%); color: hsl(150, 50%, 30%); }
html.light-theme .tf-history-action-create { background: hsl(120, 40%, 90%); color: hsl(120, 40%, 30%); }
html.light-theme .tf-history-action-rework { background: hsl(40, 60%, 90%); color: hsl(40, 60%, 30%); }
html.light-theme .tf-history-action-approve { background: hsl(150, 60%, 90%); color: hsl(150, 60%, 30%); }
html.light-theme .tf-history-item { background: hsl(220, 15%, 96%); }
.tf-history-who {
    color: var(--text-primary);
    font-weight: 500;
}
.tf-history-when {
    color: var(--text-muted);
    font-size: 10px;
    margin-left: auto;
    white-space: nowrap;
}
.tf-history-desc {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 11px;
}
