/* =========================================================================
   CRM ZXY v1.1 — style.css
   Тёмная тема, современный UI/UX (вдохновлено Linear, Vercel, Notion).
   ========================================================================= */

/* === Reset & Base ====================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* === Цветовая система === */
    --bg-primary: #0f172a;        /* основной фон */
    --bg-secondary: #1e293b;      /* панели, карточки */
    --bg-tertiary: #334155;       /* инпуты, hover */
    --bg-elevated: #475569;       /* ещё выше */
    --bg-overlay: rgba(15, 23, 42, 0.85);

    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: rgba(59, 130, 246, 0.12);
    --accent-text: #60a5fa;

    --success: #22c55e;
    --success-light: rgba(34, 197, 94, 0.12);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.12);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.12);
    --info: #06b6d4;
    --info-light: rgba(6, 182, 212, 0.12);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border: #334155;
    --border-light: #1e293b;
    --border-strong: #475569;

    --status-new: #3b82f6;
    --status-progress: #f59e0b;
    --status-done: #22c55e;
    --status-cancelled: #64748b;

    /* === Размеры === */
    --sidebar-w: 240px;
    --sidebar-w-collapsed: 64px;
    --header-h: 56px;
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    /* === Тени === */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.15);
    --shadow: 0 4px 12px rgba(0,0,0,0.25);
    --shadow-lg: 0 12px 28px rgba(0,0,0,0.35);
    --shadow-xl: 0 24px 48px rgba(0,0,0,0.45);

    /* === Переходы === */
    --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 100ms cubic-bezier(0.4, 0, 0.2, 1);

    /* === Шрифты === */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Menlo, Monaco, Consolas, monospace;

    --note-yellow: #fef08a;
    --note-green: #bbf7d0;
    --note-pink: #fbcfe8;
    --note-blue: #bfdbfe;
    --note-orange: #fed7aa;
    --note-purple: #ddd6fe;
}

html, body { height: 100%; }
body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

/* === Скроллбары ===================================================== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 5px;
    border: 2px solid var(--bg-primary);
}
::-webkit-scrollbar-thumb:hover { background: var(--bg-elevated); }

/* === Spinner ======================================================== */
.spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid var(--bg-tertiary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.app-loader {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 16px;
    color: var(--text-secondary);
    background: var(--bg-primary);
}

/* Кружочки-аватарки с инициалами убраны везде.
   Функция avatarHtml() возвращает пустую строку. */

.form-error-msg {
    margin-top: 4px;
    padding: 6px 10px;
    background: var(--danger-light);
    color: var(--danger);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    border-left: 3px solid var(--danger);
    animation: shakeError 0.3s ease;
}
@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}
.form-input-error {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px var(--danger-light) !important;
}

/* === Auth (login/register) ========================================== */
.auth-page {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at top, var(--bg-secondary) 0%, var(--bg-primary) 60%);
    padding: 20px;
}
.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
}
.auth-logo {
    display: flex; align-items: center; gap: 10px;
    font-size: 22px; font-weight: 800;
    color: var(--accent);
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}
.auth-logo .logo-icon {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 900; font-size: 16px;
}
.auth-card h1 { font-size: 20px; margin-bottom: 6px; font-weight: 700; }
.auth-subtitle { color: var(--text-secondary); margin-bottom: 24px; font-size: 13px; }
.auth-tabs {
    display: flex; gap: 4px;
    background: var(--bg-primary);
    padding: 4px; border-radius: var(--radius);
    margin-bottom: 20px;
}
.auth-tab {
    flex: 1; padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px; font-weight: 500;
    transition: all var(--transition);
}
.auth-tab.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* === Forms ========================================================== */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-label, label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.form-input, .form-select, .form-textarea {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
.form-row { display: flex; gap: 12px; }
.form-row > .form-group { flex: 1; }

/* === Password eye =================================================== */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px !important; }
.pw-eye {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: transparent; border: 0; color: var(--text-secondary);
    cursor: pointer; padding: 6px; border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
}
.pw-eye:hover { color: var(--text-primary); background: var(--bg-tertiary); }

/* === Buttons ======================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-elevated); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #16a34a; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover:not(:disabled) { background: #d97706; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }
.btn-block { width: 100%; }

/* === App layout ===================================================== */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--header-h) 1fr;
    grid-template-areas: "sidebar header" "sidebar main";
    height: 100vh;
    overflow: hidden;
}

/* === Sidebar ======================================================== */
.sidebar {
    grid-area: sidebar;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.sidebar-brand {
    height: var(--header-h);
    display: flex; align-items: center; gap: 10px;
    padding: 0 18px;
    border-bottom: 1px solid var(--border);
    font-size: 17px; font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}
.sidebar-brand .brand-icon {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 900; font-size: 14px;
    flex-shrink: 0;
}
.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 2px;
}
.sidebar-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px 12px 6px;
}
.sidebar-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13px; font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}
.sidebar-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.sidebar-item.active {
    background: var(--accent-light);
    color: var(--accent-text);
    font-weight: 600;
}
.sidebar-item.active::before {
    content: ''; position: absolute; left: -10px; top: 50%;
    width: 3px; height: 60%;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
    transform: translateY(-50%);
}
.sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-item .item-label { flex: 1; }
.sidebar-item .item-badge {
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
}
.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border);
}
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition-fast);
}
.sidebar-user:hover { background: var(--bg-tertiary); }
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .user-role { font-size: 11px; color: var(--text-secondary); }

/* === Header ========================================================= */
.header {
    grid-area: header;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px;
    padding: 0 24px;
}
.header-title { font-size: 16px; font-weight: 700; flex: 1; }

/* П.6: 3D плашка с датой и временем */
.datetime-3d {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 6px 16px;
    background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-primary) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.06),
        inset 0 -1px 0 rgba(0,0,0,0.3),
        0 2px 4px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}
.datetime-3d::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    pointer-events: none;
}
.datetime-3d-time {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 800;
    color: var(--accent-text);
    letter-spacing: 0.05em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.datetime-3d-date {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.header-search {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    width: 320px;
}
.header-search input {
    background: transparent; border: none; outline: none;
    color: var(--text-primary); width: 100%; font-size: 13px;
}
.header-search svg { color: var(--text-muted); width: 16px; height: 16px; }

/* === Main content area ============================================== */
.main {
    grid-area: main;
    overflow-y: auto;
    background: var(--bg-primary);
    position: relative;
}
.main-content { padding: 24px; }
.page-header {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    margin-bottom: 14px;
}
/* П.5: page-title и page-subtitle скрыты везде */
.page-title, .page-subtitle { display: none !important; }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* === Toolbar / Filters ============================================== */
.toolbar {
    display: flex; flex-wrap: wrap; gap: 10px;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 16px;
}
.toolbar-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.toolbar-item label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.toolbar-item .form-input,
.toolbar-item .form-select { padding: 7px 12px; font-size: 13px; min-width: 120px; }
.toolbar-spacer { flex: 1; }
.toolbar-search {
    position: relative;
    min-width: 240px;
    flex: 1;
    max-width: 400px;
}
/* П.3: надпись ПОИСК над всеми полями поиска в toolbar */
.toolbar .toolbar-search {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.toolbar .toolbar-search::before {
    content: 'Поиск';
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    display: block;
}
/* Иконка лупы убрана */
.toolbar .toolbar-search input {
    padding-left: 12px;
}
/* П.7: В блоке пользователей поиск выровнен с другими полями */
.users-toolbar {
    align-items: flex-end;
}
.toolbar-search input {
    width: 100%; padding: 8px 12px 8px 36px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary); font-size: 13px;
    outline: none;
}
.toolbar-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.toolbar-search svg {
    position: absolute; left: 10px; top: 70%; transform: translateY(-50%);
    color: var(--text-muted); width: 16px; height: 16px;
}

/* === Card =========================================================== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-body { padding: 18px; }
.card-body.no-pad { padding: 0; }

/* === Tables ========================================================= */
.table-wrap {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead {
    background: var(--bg-primary);
}
.data-table th {
    text-align: left;
    padding: 11px 14px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
/* П.11: сортируемые заголовки */
.data-table th.th-sortable {
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-fast), background var(--transition-fast);
}
.data-table th.th-sortable:hover {
    color: var(--accent-text);
    background: var(--bg-tertiary);
}
/* Кнопки под таблицей */
.table-footer-actions {
    display: flex;
    justify-content: flex-end;
    padding: 14px 0 0;
    gap: 8px;
}
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr {
    cursor: pointer;
    transition: background var(--transition-fast);
}
.data-table tbody tr:hover { background: var(--bg-tertiary); }
.data-table tbody tr.selected { background: var(--accent-light); }

.table-empty {
    text-align: center; padding: 40px 20px;
    color: var(--text-secondary); font-size: 13px;
}
.table-empty svg { width: 48px; height: 48px; margin: 0 auto 12px; opacity: 0.4; }

/* === Status badges ================================================== */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
    white-space: nowrap;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-muted { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-new { background: rgba(59, 130, 246, 0.15); color: var(--accent-text); }
.badge-progress { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-done { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge-cancelled { background: rgba(100, 116, 139, 0.2); color: var(--text-secondary); }

/* Метки статусов в канбане — вместо кружков цветной текст */
.kanban-status-label {
    font-size: 13px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.kanban-status-label.new { background: rgba(59, 130, 246, 0.15); color: var(--accent-text); }
.kanban-status-label.in_progress { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.kanban-status-label.done { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.kanban-status-label.cancelled { background: rgba(100, 116, 139, 0.2); color: var(--text-secondary); }

/* === Stat cards ===================================================== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    display: flex; align-items: center; gap: 14px;
    transition: border-color var(--transition), transform var(--transition-fast);
}
.stat-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.stat-card .stat-icon {
    width: 42px; height: 42px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-card .stat-icon svg { width: 22px; height: 22px; }
.stat-card .stat-icon.blue { background: var(--accent-light); color: var(--accent); }
.stat-card .stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-card .stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-card .stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-card .stat-icon.gray { background: rgba(100, 116, 139, 0.15); color: var(--text-secondary); }
.stat-card .stat-value { font-size: 24px; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }

.kanban-toolbar {
    margin-bottom: 12px;
}

/* === Kanban ========================================================= */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    height: calc(100vh - var(--header-h) - 130px);
    overflow: hidden;
}
.kanban-column {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.kanban-column-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    font-size: 13px; font-weight: 600;
}
.kanban-column-header .col-count {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 1px 8px;
    border-radius: var(--radius-full);
    font-size: 11px; font-weight: 600;
}
.kanban-column-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex; flex-direction: column; gap: 8px;
}
.kanban-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    cursor: pointer;
    transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}
.kanban-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.kanban-card.kanban-draggable {
    cursor: grab;
}
.kanban-card.kanban-draggable:active {
    cursor: grabbing;
}
.kanban-card.kanban-dragging {
    opacity: 0.4;
    transform: rotate(2deg) scale(0.98);
}
.kanban-column-body.kanban-drag-over {
    background: var(--accent-light);
    border: 2px dashed var(--accent);
    border-radius: var(--radius);
}
.kanban-card-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; line-height: 1.4; }
.kanban-card-meta {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; font-size: 11px; color: var(--text-secondary);
}
.kanban-card-meta .kanban-user {
    display: flex; align-items: center; gap: 5px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kanban-card-meta .kanban-date { font-size: 11px; white-space: nowrap; }
.kanban-empty { text-align: center; padding: 20px; color: var(--text-muted); font-size: 12px; }

/* === 3D Calendar inputs (datetime-local) ============================ */
/* П.1: современный 3D-стиль для input[type=datetime-local] и input[type=date] */
input.dt-picker,
input[type="datetime-local"],
input[type="date"] {
    /* 3D-эффект: лёгкая тень снизу, блик сверху */
    background: linear-gradient(180deg, var(--bg-primary) 0%, #0a0f1d 100%);
    border: 1px solid var(--border);
    border-bottom-color: var(--border-strong);
    border-top-color: var(--bg-elevated);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        inset 0 -1px 0 rgba(0,0,0,0.3),
        0 1px 2px rgba(0,0,0,0.2);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    width: 100%;
    transition: border-color var(--transition), box-shadow var(--transition);
    cursor: pointer;
}
input.dt-picker:hover,
input[type="datetime-local"]:hover,
input[type="date"]:hover {
    border-color: var(--accent);
}
input.dt-picker:focus,
input[type="datetime-local"]:focus,
input[type="date"]:focus {
    border-color: var(--accent);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        0 0 0 3px var(--accent-light);
}
/* П.2: скрыть стандартную иконку календарика — открывается по клику на поле */
input.dt-picker::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0;
    position: absolute;
    right: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
}
/* Контейнер для position:relative чтобы absolute индикатор перекрыл всё поле */
input.dt-picker,
input[type="datetime-local"],
input[type="date"] {
    position: relative;
    /* П.3: тёмная цветовая схема — нативный пикер откроется в тёмных цветах интерфейса */
    color-scheme: dark;
}
input.dt-picker::-webkit-inner-spin-button,
input[type="datetime-local"]::-webkit-inner-spin-button {
    opacity: 0.5;
}
/* Firefox: скрыть индикатор */
input.dt-picker::-moz-calendar-picker-indicator,
input[type="datetime-local"]::-moz-calendar-picker-indicator,
input[type="date"]::-moz-calendar-picker-indicator {
    opacity: 0;
}
/* П.3: стилизация нативного dropdown-пикера через ::-webkit-datetime-edit */
input.dt-picker::-webkit-datetime-edit,
input[type="datetime-local"]::-webkit-datetime-edit,
input[type="date"]::-webkit-datetime-edit {
    color: var(--text-primary);
    background: transparent;
}
input.dt-picker::-webkit-datetime-edit-fields-wrapper,
input[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper,
input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    background: transparent;
    color: var(--text-primary);
}
input.dt-picker::-webkit-datetime-edit-year-field,
input.dt-picker::-webkit-datetime-edit-month-field,
input.dt-picker::-webkit-datetime-edit-day-field,
input.dt-picker::-webkit-datetime-edit-hour-field,
input.dt-picker::-webkit-datetime-edit-minute-field,
input.dt-picker::-webkit-datetime-edit-text,
input[type="datetime-local"]::-webkit-datetime-edit-year-field,
input[type="datetime-local"]::-webkit-datetime-edit-month-field,
input[type="datetime-local"]::-webkit-datetime-edit-day-field,
input[type="datetime-local"]::-webkit-datetime-edit-hour-field,
input[type="datetime-local"]::-webkit-datetime-edit-minute-field,
input[type="datetime-local"]::-webkit-datetime-edit-text,
input[type="date"]::-webkit-datetime-edit-year-field,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-text {
    color: var(--text-primary);
    background: transparent;
}

/* П.2: Стили для новых режимов календаря (Сегодня/Неделя/Месяц) */
.cal-mode-group {
    display: flex;
    align-items: center;
    gap: 4px;
}
.cal-nav-spacer {
    width: 12px;
}
.cal-toolbar {
    margin-bottom: 14px;
}
.cal-period-label {
    min-width: 130px;
    text-transform: capitalize;
    font-weight: 600;
}

/* Плашка задачи — высота по содержимому, скролл при необходимости */
.cal-chip {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    border-left: 3px solid var(--accent);
    transition: background var(--transition-fast);
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin-bottom: 3px;
}
.cal-chip:hover {
    background: var(--bg-elevated);
}
.cal-chip.new { border-left-color: var(--status-new); }
.cal-chip.in_progress { border-left-color: var(--status-progress); }
.cal-chip.done { border-left-color: var(--status-done); }
.cal-chip.cancelled { border-left-color: var(--status-cancelled); opacity: 0.6; }
.cal-chip-time {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
    flex-shrink: 0;
    padding-top: 1px;
}
.cal-chip-text {
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.cal-chip-user {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
    padding-top: 1px;
}
/* П.1: Яркий ФИО в режиме "Сегодня" */
.cal-chip-user-bright {
    color: var(--accent-text);
    font-weight: 700;
    font-size: 13px;
}

/* В сетке месяца — чуть компактнее но тоже 14px */
.calendar-day .cal-chip {
    font-size: 14px;
    padding: 3px 6px;
    margin-bottom: 2px;
}
.calendar-task {
    /* Совместимость — оставлено для старых мест */
}

/* Режим "Сегодня" */
.cal-today-wrap {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.cal-today-header {
    padding: 16px 20px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.cal-today-header.is-today {
    background: var(--accent-light);
    border-bottom-color: var(--accent);
}
.cal-today-dayname {
    font-size: 16px;
    font-weight: 700;
    text-transform: capitalize;
}
.cal-today-count {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: var(--radius-full);
}
.cal-today-body {
    padding: 16px;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
}
.cal-chips-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cal-chips-list .cal-chip {
    font-size: 13px;
    padding: 8px 12px;
    margin-bottom: 0;
}

/* Режим "Неделя" — 7 карточек в столбец */
.cal-week-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cal-week-day {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.cal-week-day.is-today {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-light);
}
.cal-week-day.is-weekend {
    background: rgba(245, 158, 11, 0.04);
}
.cal-week-day-header {
    padding: 10px 14px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.cal-week-day.is-today .cal-week-day-header {
    background: var(--accent-light);
}
.cal-week-day-name {
    font-size: 13px;
    font-weight: 600;
    text-transform: capitalize;
}
.cal-week-day-date {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}
.cal-week-day-count {
    margin-left: auto;
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: var(--radius-full);
}
.cal-week-day-body {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 240px;
    overflow: hidden;
}
.cal-week-day-scroll {
    overflow-y: auto;
}
.cal-week-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 8px;
}

/* П.1: Бейдж ответственного отдела в таблице */
.dept-responsible-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 10px;
    background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-primary) 100%);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-text);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.06),
        inset 0 -1px 0 rgba(0,0,0,0.2),
        0 1px 2px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}
.dept-responsible-badge::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    pointer-events: none;
}

/* === Calendar ======================================================= */
.calendar {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 160px);
    min-height: 400px;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    flex: 1;
    min-height: 0;
    grid-auto-rows: 1fr;
}
/* Компактная строка дней недели — высота вплотную к тексту */
.calendar-weekday {
    background: var(--bg-primary);
    padding: 1px 4px;
    text-align: center;
    font-size: 10px; font-weight: 600;
    color: var(--text-secondary);
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
    height: auto;
    min-height: 0;
}
.calendar-day {
    background: var(--bg-secondary);
    padding: 4px;
    display: flex; flex-direction: column; gap: 2px;
    overflow: hidden;
    position: relative;
    min-height: 0;
}
.calendar-day.outside { background: var(--bg-primary); opacity: 0.6; }
.calendar-day.today { background: var(--accent-light); }
.calendar-day .day-number {
    font-size: 12px; font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}
.calendar-day.today .day-number { color: var(--accent-text); }
.calendar-day .day-num-val {
    font-size: 12px;
    margin-left: auto;
}
.calendar-day .day-tasks {
    display: flex; flex-direction: column; gap: 2px;
    overflow: hidden;
    flex: 1;
}
.calendar-day .day-tasks-scroll {
    overflow-y: auto;
    flex: 1;
    margin-right: -4px;
    padding-right: 4px;
}
.calendar-day .day-tasks-scroll::-webkit-scrollbar { width: 5px; }
.calendar-day .day-tasks-scroll::-webkit-scrollbar-track { background: transparent; }
.calendar-day .day-tasks-scroll::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
/* Счётчик задач — синий кружок в левом углу */
.calendar-day .day-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.calendar-task {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    cursor: pointer;
    border-left: 3px solid var(--accent);
}
.calendar-task.new { border-left-color: var(--status-new); }
.calendar-task.in_progress { border-left-color: var(--status-progress); }
.calendar-task.done { border-left-color: var(--status-done); }
.calendar-task.cancelled { border-left-color: var(--status-cancelled); opacity: 0.6; }
.calendar-task-more {
    font-size: 10px;
    color: var(--text-muted);
    padding: 1px 6px;
}

/* === Timeline ======================================================= */
.timeline-wrap {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.timeline-toolbar {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
.timeline-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - var(--header-h) - 200px);
    position: relative;
}
/* Скроллбар в 2 раза шире */
.timeline-container::-webkit-scrollbar {
    width: 20px;
    height: 20px;
}
.timeline-container::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 2px;
}
.timeline-container::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 4px;
    border: 2px solid var(--bg-primary);
}
.timeline-container::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
}
.timeline-container::-webkit-scrollbar-corner {
    background: var(--bg-primary);
}
.timeline-inner {
    position: relative;
    min-width: 100%;
}
.timeline-dates-header {
    position: relative;
    height: 24px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    z-index: 5;
    will-change: transform;
}
.timeline-date-col {
    position: absolute;
    top: 0; bottom: 0;
    border-right: 1px solid var(--border-light);
    font-size: 11px;
    color: var(--text-secondary);
    padding: 5px 8px;
    white-space: nowrap;
}
.timeline-row {
    position: relative;
    height: 36px;
    border-bottom: 1px solid var(--border-light);
}
.timeline-row:hover { background: var(--bg-tertiary); }
.timeline-row-label {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 220px;
    padding: 8px 12px;
    border-right: 1px solid var(--border);
    background: var(--bg-secondary);
    font-size: 12px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    color: var(--text-primary);
    z-index: 2;
    display: flex;
    align-items: center;
}
.timeline-row-label svg { flex-shrink: 0; }

/* 3D-бейдж группы исполнителя — на всю ширину 220px */
.timeline-group-label {
    display: flex;
    align-items: stretch;
    padding: 4px;
    border-right: 2px solid var(--accent);
}
.tl-group-badge {
    flex: 1;
    background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-primary) 100%);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-text);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    word-break: break-word;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.06),
        inset 0 -1px 0 rgba(0,0,0,0.2),
        0 2px 4px rgba(0,0,0,0.2);
    position: relative;
    min-height: 28px;
}
.tl-group-badge::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    border-radius: var(--radius) var(--radius) 0 0;
    pointer-events: none;
}
.timeline-date-col.weekend { color: var(--warning); }
.timeline-toolbar .btn-group {
    display: flex;
    gap: 0;
}
.timeline-toolbar .btn-group .btn {
    border-radius: 0;
    border-right: 0;
}
.timeline-toolbar .btn-group .btn:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.timeline-toolbar .btn-group .btn:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    border-right: 1px solid var(--border);
}
.timeline-bar {
    position: absolute;
    top: 6px;
    height: 24px;
    border-radius: 4px;
    padding: 3px 8px 3px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: filter var(--transition-fast);
    display: flex;
    align-items: center;
    overflow: hidden;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9), 0 0 2px rgba(0,0,0,1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
/* Менее яркие фоны линий */
.timeline-bar.new { background: rgba(59, 130, 246, 0.55); border: 1px solid rgba(59, 130, 246, 0.8); }
.timeline-bar.in_progress { background: rgba(245, 158, 11, 0.55); border: 1px solid rgba(245, 158, 11, 0.8); }
.timeline-bar.done { background: rgba(34, 197, 94, 0.55); border: 1px solid rgba(34, 197, 94, 0.8); }
.timeline-bar.cancelled { background: rgba(100, 116, 139, 0.5); border: 1px solid rgba(100, 116, 139, 0.7); opacity: 0.8; }
.timeline-bar:hover { filter: brightness(1.25); }
/* П.2: текст прижимается к видимой части бара.
   JS устанавливает padding-left динамически при скролле. */
.timeline-bar-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    max-width: 100%;
    padding-left: 6px;
    transition: padding-left 0.05s linear;
}
/* П.1: если задача заканчивается до конца видимого периода —
   текст прижимается к правому краю бара */
.timeline-bar-text-right {
    text-align: right;
    direction: rtl;
}
.timeline-bar:hover { filter: brightness(1.15); }

/* === Chat layout ==================================================== */
.chat-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    height: calc(100vh - var(--header-h));
    overflow: hidden;
}
.chat-sidebar-panel {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.chat-sidebar-header {
    padding: 14px;
    border-bottom: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 10px;
}
.chat-sidebar-header .chat-title { font-size: 16px; font-weight: 700; }
.chat-search {
    position: relative;
}
.chat-search input {
    width: 100%; padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary); font-size: 13px;
    outline: none;
}
.chat-search input:focus { border-color: var(--accent); }
.chat-conversations-list {
    flex: 1; overflow-y: auto;
    padding: 8px;
}
.chat-conversation-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition-fast);
    margin-bottom: 2px;
}
.chat-conversation-item:hover { background: var(--bg-tertiary); }
.chat-conversation-item.active { background: var(--accent-light); }
/* Бейджи диалогов — прямоугольные, без кружков */
.conv-badge {
    width: 36px; height: 36px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: white;
}
.conv-badge-user {
    background: var(--accent);
}
.conv-badge-group {
    background: var(--success);
}
.chat-main-header .conv-badge {
    width: 40px; height: 40px;
    font-size: 12px;
}
.chat-conversation-item .conv-info { flex: 1; min-width: 0; }
.chat-conversation-item .conv-name {
    font-size: 13px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-conversation-item .conv-last {
    font-size: 11px; color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-top: 2px;
}
.chat-conversation-item .conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.chat-conversation-item .conv-time { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.chat-conversation-item .conv-unread {
    background: var(--accent);
    color: white;
    font-size: 10px; font-weight: 700;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    min-width: 18px; text-align: center;
}

.chat-main-panel {
    display: flex; flex-direction: column;
    background: var(--bg-primary);
    overflow: hidden;
    min-width: 0;
}
.chat-main-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
    background: var(--bg-secondary);
}
.chat-main-header .header-info { flex: 1; min-width: 0; }
.chat-main-header .header-name { font-size: 14px; font-weight: 600; }
.chat-main-header .header-sub { font-size: 11px; color: var(--text-secondary); }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex; flex-direction: column; gap: 6px;
}
.chat-date-divider {
    text-align: center;
    margin: 14px 0 8px;
    font-size: 11px;
    color: var(--text-muted);
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.chat-date-divider::before,
.chat-date-divider::after {
    content: ''; position: absolute; top: 50%;
    width: calc(50% - 60px); height: 1px;
    background: var(--border);
}
.chat-date-divider::before { left: 0; }
.chat-date-divider::after { right: 0; }

.chat-message {
    display: flex; gap: 10px;
    max-width: 80%;
    align-items: flex-end;
}
.chat-message.own {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.chat-message .msg-avatar {
    width: 28px; height: 28px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), #818cf8);
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 11px;
    flex-shrink: 0;
}
.chat-message .msg-bubble {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 9px 13px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.45;
    word-wrap: break-word;
    max-width: 100%;
}
.chat-message.own .msg-bubble {
    background: var(--accent);
    color: white;
    border-color: var(--accent-hover);
}
.chat-message .msg-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}
.chat-message.own .msg-time { text-align: right; }

.chat-empty {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 16px; color: var(--text-secondary);
    padding: 40px 20px;
    text-align: center;
}
.chat-empty svg { width: 64px; height: 64px; opacity: 0.3; }

.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    display: flex; align-items: flex-end; gap: 10px;
}
.chat-input-area textarea {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 13px;
    outline: none;
    resize: none;
    max-height: 120px;
    min-height: 40px;
    transition: border-color var(--transition);
}
.chat-input-area textarea:focus { border-color: var(--accent); }
.chat-input-area textarea::placeholder { color: var(--text-muted); }

/* === Modals ========================================================= */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(3px);
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: fadeIn 150ms ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-xl);
    animation: slideUp 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal.modal-lg { max-width: 800px; }
.modal.modal-sm { max-width: 400px; }
/* Полнoэкранная модалка по ширине — для редактирования роли */
.modal.modal-fullscreen {
    max-width: none;
    width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
}
.modal.modal-fullscreen .modal-body {
    flex: 1;
    overflow-y: auto;
}
/* На больших экранах — на всю ширину с отступом 16px */
@media (min-width: 1400px) {
    .modal.modal-fullscreen {
        width: calc(100vw - 32px);
    }
}
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
    color: var(--text-secondary);
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
}
.modal-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}

/* === Toasts ========================================================= */
.toast-container {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 9999;
    display: flex; flex-direction: column; gap: 10px;
    pointer-events: none;
}
.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 12px 16px 12px 14px;
    color: var(--text-primary);
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-width: 380px;
    display: flex; align-items: center; gap: 10px;
    pointer-events: auto;
    animation: toastIn 250ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes toastIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.toast-out { animation: toastOut 200ms ease forwards; }
@keyframes toastOut { to { transform: translateX(120%); opacity: 0; } }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--info); }
.toast.warning { border-left-color: var(--warning); }
.toast .toast-icon { flex-shrink: 0; }
.toast .toast-content { flex: 1; }
.toast .toast-close { color: var(--text-muted); padding: 2px; cursor: pointer; }
.toast .toast-close:hover { color: var(--text-primary); }

/* === Pagination ===================================================== */
.pagination {
    display: flex; align-items: center; gap: 4px;
    justify-content: flex-end;
    margin-top: 14px;
    font-size: 13px;
}
.pagination-info { color: var(--text-secondary); margin-right: 12px; }
.pagination button {
    min-width: 32px; height: 32px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    font-size: 13px;
    transition: all var(--transition-fast);
}
.pagination button:hover:not(:disabled) { background: var(--bg-tertiary); border-color: var(--border-strong); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination button.active { background: var(--accent); color: white; border-color: var(--accent); }

/* === Empty state ==================================================== */
.empty-state {
    text-align: center; padding: 60px 20px;
    color: var(--text-secondary);
}
.empty-state svg { width: 64px; height: 64px; margin: 0 auto 16px; opacity: 0.3; }
.empty-state h3 { font-size: 16px; color: var(--text-primary); margin-bottom: 6px; font-weight: 600; }
.empty-state p { font-size: 13px; max-width: 320px; margin: 0 auto; }

/* === Avatar (убрано — кружочки с инициалами больше не используются) ===== */
/* Стили оставлены пустыми для обратной совместимости — функции avatarHtml() возвращает '' */

/* Аккордеон прав ролей — компактный, со скроллом */
.permissions-accordion {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.permissions-accordion::-webkit-scrollbar { width: 8px; }
.permissions-accordion::-webkit-scrollbar-track { background: transparent; }
.permissions-accordion::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 4px; }

.perm-group {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition-fast);
}
.perm-group.open {
    border-color: var(--accent);
}
.perm-group-title {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast);
}
.perm-group-title:hover {
    background: var(--bg-elevated);
}
.perm-group.open .perm-group-title {
    background: var(--accent-light);
    color: var(--accent-text);
}
/* Шеврон — поворот при раскрытии */
.perm-group-chevron {
    display: inline-flex;
    color: var(--text-secondary);
    transition: transform var(--transition-fast);
}
.perm-group.open .perm-group-chevron {
    transform: rotate(180deg);
    color: var(--accent);
}
.perm-group-name {
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 12px;
    font-weight: 700;
}
.perm-group-stats {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    min-width: 32px;
    text-align: center;
}
.perm-group-stats.partial {
    background: var(--warning-light);
    color: var(--warning);
}
.perm-group-stats.all {
    background: var(--success-light);
    color: var(--success);
}
/* Чекбокс "все" в заголовке группы */
.perm-group-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 11px;
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
}
.perm-group-toggle input[type="checkbox"] {
    width: 14px; height: 14px;
    cursor: pointer;
    accent-color: var(--accent);
    margin: 0;
}
.perm-group-toggle-label {
    text-transform: lowercase;
    font-weight: 500;
}

/* Тело группы — скрыто по умолчанию */
.perm-group-items {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2px;
    padding: 8px;
    background: var(--bg-primary);
}
.perm-group.open .perm-group-items {
    display: grid;
}
.perm-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}
.perm-row:hover { background: var(--bg-tertiary); }
.perm-row input[type="checkbox"] {
    width: 16px; height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
    margin-top: 2px;
    flex-shrink: 0;
}
.perm-row .perm-info { flex: 1; min-width: 0; }
.perm-row .perm-name { font-size: 13px; font-weight: 500; }
.perm-row .perm-key { font-size: 10px; font-family: var(--font-mono); margin-top: 2px; color: var(--text-muted); }

/* П.3: Чеклист задачи */
.checklist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.checklist-header label {
    margin: 0;
}
.checklist-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
.checklist-item:hover {
    border-color: var(--border-strong);
}
.checklist-item-checked {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.3);
}
.checklist-item-checked .checklist-text-input {
    text-decoration: line-through;
    color: var(--text-secondary);
}
/* 3D галочка */
.checklist-3d-check {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 2px solid var(--border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    color: transparent;
    transition: all var(--transition-fast);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.08),
        inset 0 -1px 0 rgba(0,0,0,0.2),
        0 1px 2px rgba(0,0,0,0.2);
    position: relative;
}
.checklist-3d-check::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, transparent 100%);
    border-radius: 4px 4px 0 0;
    pointer-events: none;
}
.checklist-3d-check:hover {
    border-color: var(--accent);
}
.checklist-3d-check.checked {
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
    border-color: #15803d;
    color: white;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.25),
        inset 0 -1px 0 rgba(0,0,0,0.2),
        0 2px 4px rgba(34,197,94,0.3);
}
.checklist-text-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    padding: 4px 0;
}
.checklist-text-input:focus {
    background: var(--bg-secondary);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}
.checklist-text-input:disabled {
    cursor: default;
}
.checklist-delete-btn {
    color: var(--text-muted);
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast), background var(--transition-fast);
}
.checklist-delete-btn:hover {
    color: var(--danger);
    background: var(--danger-light);
}

/* === Notes (sticky board) =========================================== */
.notes-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.note-card {
    border-radius: var(--radius-md);
    padding: 14px;
    min-height: 140px;
    display: flex; flex-direction: column; gap: 8px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.note-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.note-card.color-yellow { background: var(--note-yellow); color: #422006; }
.note-card.color-green { background: var(--note-green); color: #14532d; }
.note-card.color-pink { background: var(--note-pink); color: #831843; }
.note-card.color-blue { background: var(--note-blue); color: #1e3a8a; }
.note-card.color-orange { background: var(--note-orange); color: #7c2d12; }
.note-card.color-purple { background: var(--note-purple); color: #4c1d95; }
.note-card .note-title { font-size: 14px; font-weight: 700; }
.note-card .note-content { font-size: 12px; line-height: 1.5; flex: 1; white-space: pre-wrap; word-wrap: break-word; }
.note-card .note-footer { font-size: 10px; opacity: 0.7; }
.note-card .note-actions { position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity var(--transition-fast); }
.note-card:hover .note-actions { opacity: 1; }

/* === Members list (group edit) ====================================== */
.members-list {
    display: flex; flex-direction: column; gap: 4px;
    max-height: 280px; overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    background: var(--bg-primary);
}
.member-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}
.member-row:hover { background: var(--bg-tertiary); }
.member-row.member-row-active {
    background: var(--accent-light);
    border-left: 3px solid var(--accent);
    padding-left: 7px;
}
.member-row input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.member-row .member-info { flex: 1; min-width: 0; }
.member-row .member-name { font-size: 13px; font-weight: 500; }
.member-row .member-meta { font-size: 11px; color: var(--text-secondary); }

/* === File attachments =============================================== */
.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--transition-fast);
}
.file-item:hover { border-color: var(--accent); }
.file-icon { width: 32px; height: 32px; background: var(--bg-tertiary); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: var(--accent-text); flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 11px; color: var(--text-secondary); }
.file-actions { display: flex; gap: 4px; }

/* === History timeline (task detail) ================================= */
.history-timeline { display: flex; flex-direction: column; gap: 0; }
.history-item {
    display: flex; gap: 12px;
    padding: 8px 0;
    position: relative;
    font-size: 12px;
}
.history-item::before {
    content: '';
    position: absolute;
    left: 5px; top: 22px; bottom: -8px;
    width: 2px;
    background: var(--border);
}
.history-item:last-child::before { display: none; }
.history-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-secondary);
    flex-shrink: 0;
    margin-top: 4px;
    z-index: 1;
}
.history-content { flex: 1; }
.history-action { font-weight: 600; color: var(--text-primary); }
.history-meta { color: var(--text-secondary); font-size: 11px; margin-top: 2px; }
.history-chevron {
    color: var(--text-secondary);
    font-size: 14px;
    transition: transform var(--transition-fast);
}

/* === User profile card ============================================== */
.user-profile-card {
    display: flex; align-items: center; gap: 14px;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.user-profile-card .user-name { font-size: 16px; font-weight: 700; }
.user-profile-card .user-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ИИ-чат панель */
.ai-chat-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 16px;
}
.ai-chat-messages {
    height: 300px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-primary);
}
.ai-chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 13px;
}
.ai-chat-empty svg { opacity: 0.3; }
.ai-chat-msg {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    max-width: 85%;
}
.ai-chat-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.ai-chat-msg-avatar {
    width: 28px; height: 28px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-secondary);
}
.ai-chat-msg.user .ai-chat-msg-avatar {
    background: var(--accent);
    color: white;
}
.ai-chat-msg-bubble {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
}
.ai-chat-msg.user .ai-chat-msg-bubble {
    background: var(--accent);
    color: white;
    border-color: var(--accent-hover);
}
.ai-chat-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}
.ai-chat-input-area {
    border-top: 1px solid var(--border);
    padding: 12px;
    display: flex;
    gap: 8px;
    background: var(--bg-secondary);
}
.ai-chat-input-area textarea {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 13px;
    outline: none;
    resize: none;
    max-height: 100px;
    min-height: 40px;
}
.ai-chat-input-area textarea:focus { border-color: var(--accent); }
.ai-chat-input-area .btn-icon { flex-shrink: 0; }

/* === Settings form ================================================== */
.settings-form { max-width: 600px; }

/* Блок загрузки файлов */
.upload-zone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-md);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    color: var(--text-secondary);
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-light);
}
.upload-zone.drag-over {
    border-style: solid;
}
.upload-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.upload-zone-content svg {
    color: var(--accent);
    opacity: 0.6;
}
.upload-zone-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.upload-zone-hint {
    font-size: 12px;
    color: var(--text-muted);
}
.upload-zone-hint code {
    background: var(--bg-tertiary);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 11px;
}
/* Список файлов */
.upload-file-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.upload-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.upload-file-icon {
    color: var(--accent-text);
    flex-shrink: 0;
}
.upload-file-info { flex: 1; min-width: 0; }
.upload-file-name { font-size: 13px; font-weight: 600; }
.upload-file-size { font-size: 11px; color: var(--text-muted); }
.upload-file-remove {
    color: var(--text-muted);
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background var(--transition-fast);
}
.upload-file-remove:hover { color: var(--danger); background: var(--danger-light); }
/* Кнопка Запуск — 3D */
.upload-run-wrap {
    margin-top: 16px;
    display: flex;
    justify-content: center;
}
.btn-upload-run {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 48px;
    font-size: 16px;
    font-weight: 700;
    color: white;
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
    border: 1px solid #1e40af;
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.25),
        inset 0 -2px 0 rgba(0,0,0,0.2),
        0 4px 12px rgba(59,130,246,0.4),
        0 2px 4px rgba(0,0,0,0.2);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}
.btn-upload-run::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 100%);
    pointer-events: none;
}
.btn-upload-run:hover:not(:disabled) {
    background: linear-gradient(180deg, #4287f5 0%, #2b63e0 50%, #2154c8 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.3),
        inset 0 -2px 0 rgba(0,0,0,0.2),
        0 6px 16px rgba(59,130,246,0.5),
        0 2px 4px rgba(0,0,0,0.2);
    transform: translateY(-1px);
}
.btn-upload-run:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow:
        inset 0 2px 4px rgba(0,0,0,0.2),
        0 1px 2px rgba(0,0,0,0.2);
}
.btn-upload-run:disabled { opacity: 0.6; cursor: not-allowed; }
/* Результаты загрузки */
.upload-result {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.upload-result-item {
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 8px;
    line-height: 1.55;
}
.upload-result-item.success {
    background: var(--success-light);
    color: var(--success);
    border-left: 3px solid var(--success);
}
.upload-result-item.warn {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border-left: 3px solid #f59e0b;
}
.upload-result-item.error {
    background: var(--danger-light);
    color: var(--danger);
    border-left: 3px solid var(--danger);
}
.upload-result-item strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}
.upload-result-item .ur-summary {
    font-weight: 600;
    margin-bottom: 8px;
    padding: 4px 0;
}
.upload-result-item .ur-summary.ok { color: var(--success); }
.upload-result-item .ur-summary.warn { color: #f59e0b; }
.upload-result-item .ur-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-top: 8px;
    margin-bottom: 4px;
}
.upload-result-item .ur-errors-title { color: var(--danger); }
.upload-result-item .ur-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}
.upload-result-item .ur-list li {
    padding: 2px 0 2px 14px;
    position: relative;
}
.upload-result-item .ur-list li::before {
    content: '·';
    position: absolute;
    left: 4px;
    color: var(--text-muted);
}
.upload-result-item .ur-errors li { color: var(--danger); }
.settings-section { margin-bottom: 28px; }
.settings-section h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--text-primary); }
.settings-section .setting-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}
.settings-section .setting-row:last-child { border-bottom: none; }
.settings-section .setting-row .setting-info { flex: 1; }
.settings-section .setting-row .setting-name { font-size: 13px; font-weight: 500; }
.settings-section .setting-row .setting-desc { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* === Utilities ====================================================== */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.uppercase { text-transform: uppercase; letter-spacing: 0.04em; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden { display: none !important; }
.cursor-pointer { cursor: pointer; }
.rounded { border-radius: var(--radius); }
.rounded-full { border-radius: var(--radius-full); }
.border { border: 1px solid var(--border); }
.bg-secondary { background: var(--bg-secondary); }
.bg-primary { background: var(--bg-primary); }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.relative { position: relative; }
.absolute { position: absolute; }

/* === Responsive ===================================================== */
@media (max-width: 1024px) {
    .kanban-board { grid-template-columns: repeat(2, 1fr); }
    .chat-layout { grid-template-columns: 240px 1fr; }
}
@media (max-width: 768px) {
    :root { --sidebar-w: 64px; }
    .sidebar-brand .brand-text,
    .sidebar-item .item-label,
    .sidebar-item .item-badge,
    .sidebar-section-label,
    .sidebar-user .user-info { display: none; }
    .sidebar-item { justify-content: center; padding: 11px; }
    .sidebar-user { justify-content: center; }
    .kanban-board { grid-template-columns: 1fr; height: auto; }
    .chat-layout { grid-template-columns: 1fr; }
    .chat-sidebar-panel { display: none; }
    .chat-sidebar-panel.show { display: flex; position: fixed; inset: var(--header-h) 0 0 0; z-index: 100; }
    .header-search { width: auto; flex: 1; }
    .main-content { padding: 14px; }
}
