/* TaskFlow — минималистичный дизайн, плавные переходы, адаптивная вёрстка. */

:root {
    --color-bg: #f5f6f8;
    --color-surface: #ffffff;
    --color-border: #e4e7eb;
    --color-text: #1b1f27;
    --color-text-muted: #6b7280;
    --color-primary: #3457d5;
    --color-primary-hover: #2a45ad;
    --color-danger: #d33a4b;
    --color-success: #1f9d55;
    --color-warning: #b8860b;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 12px rgba(16, 24, 40, 0.04);
    --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

#app, .app {
    min-height: 100vh;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* Анимации переходов между экранами */
.fade-in {
    animation: fadeIn 220ms ease-out;
}

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

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Экран входа */
.auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
}

.auth-card h1 {
    font-size: 22px;
    margin: 0 0 4px;
}

.auth-card .subtitle {
    color: var(--color-text-muted);
    font-size: 14px;
    margin: 0 0 24px;
}

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--color-surface)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236b7280' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E")
        no-repeat right 12px center;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 10px 34px 10px 14px;
    font-size: 14px;
    font-family: var(--font);
    color: var(--color-text);
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.select:hover {
    border-color: var(--color-primary);
}

.select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(52, 87, 213, 0.12);
}

.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.field-checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--color-text);
    cursor: pointer;
    line-height: 1.4;
}

.field-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    flex-shrink: 0;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.field select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--color-surface)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236b7280' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E")
        no-repeat right 12px center;
    padding-right: 34px;
    cursor: pointer;
}

.field input:not([type="checkbox"]):not([type="radio"]):focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(52, 87, 213, 0.12);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

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

.btn-block {
    width: 100%;
}

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

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

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

.btn-danger {
    background: transparent;
    color: var(--color-danger);
    border: 1px solid rgba(211, 58, 75, 0.3);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 16px;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

.btn-icon:hover {
    background: var(--color-bg);
}

.btn-icon:active {
    transform: scale(0.95);
}

.task-map-node {
    margin-top: 8px;
}

.task-map-card {
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-success);
    border-radius: var(--radius);
    padding: 12px 14px;
    background: var(--color-surface);
    transition: box-shadow var(--transition);
}

.task-map-card:hover {
    box-shadow: var(--shadow);
}

.task-map-card.state-warning {
    border-left-color: var(--color-warning);
    background: rgba(238, 165, 38, 0.05);
}

.task-map-card.state-danger {
    border-left-color: var(--color-danger);
    background: rgba(211, 58, 75, 0.05);
}

.task-map-critical {
    outline: 1px solid var(--color-primary);
    outline-offset: 1px;
}

.task-map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.task-map-title {
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
}

.task-map-title:hover {
    text-decoration: underline;
}

.task-map-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    color: var(--color-text-muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.task-map-deps {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 6px;
}

.task-map-deps a {
    color: var(--color-text);
}

.task-map-progressbar {
    height: 6px;
    background: var(--color-bg);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.task-map-progress {
    height: 100%;
    border-radius: 3px;
    transition: width var(--transition);
}

.btn-danger:hover {
    background: rgba(211, 58, 75, 0.08);
}

.error-text {
    color: var(--color-danger);
    font-size: 13px;
    margin-top: 12px;
}

/* Основной каркас после входа */
.shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: relative;
    width: 240px;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar .brand {
    font-size: 18px;
    font-weight: 700;
    padding: 0 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notif-bell {
    position: relative;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background var(--transition);
}

.notif-bell:hover {
    background: var(--color-bg);
}

.notif-bell-active {
    color: var(--color-danger);
    animation: notif-ring 2.2s ease-in-out infinite;
}

@keyframes notif-ring {
    0%, 80%, 100% { transform: rotate(0deg); }
    82% { transform: rotate(-12deg); }
    85% { transform: rotate(10deg); }
    88% { transform: rotate(-8deg); }
    91% { transform: rotate(4deg); }
    94% { transform: rotate(0deg); }
}

.notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--color-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.notif-panel {
    position: absolute;
    top: 44px;
    left: 12px;
    width: 320px;
    max-height: 420px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 60;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.notif-panel.open {
    display: flex;
}

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

.notif-list {
    overflow-y: auto;
    max-height: 360px;
}

.notif-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
    cursor: default;
}

.notif-item.notif-unread {
    background: rgba(52, 87, 213, 0.06);
    cursor: pointer;
}

.notif-title {
    font-weight: 600;
}

.notif-title a {
    color: var(--color-text);
    text-decoration: none;
}

.notif-body {
    color: var(--color-text-muted);
    margin-top: 2px;
}

.notif-time {
    color: var(--color-text-muted);
    font-size: 11px;
    margin-top: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--color-text);
    font-size: 14px;
    transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
    background: var(--color-bg);
}

.nav-link.active {
    background: rgba(52, 87, 213, 0.1);
    color: var(--color-primary);
    font-weight: 600;
}

.sidebar .spacer {
    flex: 1;
}

.sidebar .user-card {
    border-top: 1px solid var(--color-border);
    padding: 12px;
    font-size: 13px;
}

.sidebar .user-card .role {
    color: var(--color-text-muted);
}

.user-settings-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 6px;
    transition: background var(--transition);
}

.user-settings-btn:hover {
    background: var(--color-bg);
}

.user-card-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
}

.user-card-photo-empty {
    background: var(--color-bg);
    border-radius: 50%;
}

.settings-photo-block {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--color-bg);
    border-radius: var(--radius);
}

.settings-photo-preview {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 12px;
    border: 1px solid var(--color-border);
}

.settings-readonly {
    margin: 16px 0;
    padding: 12px;
    background: var(--color-bg);
    border-radius: var(--radius);
}

.settings-readonly-value {
    padding: 10px 0;
    color: var(--color-text);
    font-weight: 500;
}

.main {
    flex: 1;
    padding: 32px;
    max-width: 1200px;
}

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

.page-header h2 {
    margin: 0;
    font-size: 22px;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
}

th {
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 13px;
}

tr {
    transition: background var(--transition);
}

tbody tr:hover {
    background: var(--color-bg);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-active {
    background: rgba(31, 157, 85, 0.12);
    color: var(--color-success);
}

.badge-blocked {
    background: rgba(211, 58, 75, 0.12);
    color: var(--color-danger);
}

.badge-warning {
    background: rgba(184, 134, 11, 0.12);
    color: var(--color-warning);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.kanban-drop-indicator {
    height: 3px;
    background: var(--color-primary);
    border-radius: 2px;
    margin: 4px 0 12px;
    animation: fadeIn 120ms ease-out;
}

.priority-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
}

.priority-low {
    background: rgba(31, 157, 85, 0.12);
    color: var(--color-success);
}

.priority-normal {
    background: rgba(52, 87, 213, 0.12);
    color: var(--color-primary);
}

.priority-high {
    background: rgba(184, 134, 11, 0.14);
    color: var(--color-warning);
}

.priority-urgent {
    background: rgba(211, 58, 75, 0.12);
    color: var(--color-danger);
}

.doc-viewer-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-bg);
    z-index: 200;
    display: flex;
    flex-direction: column;
    animation: fadeIn 150ms ease-out;
}

.doc-viewer-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow);
    z-index: 1;
}

.doc-viewer-hint {
    flex: 1;
    font-size: 12px;
    color: var(--color-text-muted);
}

.doc-viewer-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.doc-viewer-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    user-select: none;
    -webkit-user-select: none;
}

.doc-viewer-page {
    max-width: 100%;
    box-shadow: var(--shadow);
    border-radius: 4px;
    pointer-events: none;
}

.doc-viewer-watermark-layer {
    position: fixed;
    inset: 0;
    top: 60px;
    pointer-events: none;
    background-repeat: repeat;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    animation: fadeIn 150ms ease-out;
}

.modal {
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.modal h3 {
    margin-top: 0;
}

.toast-host {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 340px;
}

.toast {
    background: var(--color-text);
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    font-size: 14px;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity var(--transition), transform var(--transition);
}

.toast-visible {
    opacity: 1;
    transform: translateX(0);
}

.toast-error {
    background: var(--color-danger);
}

.toast-success {
    background: var(--color-success);
}

.gantt-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.gantt-row-label {
    width: 220px;
    flex-shrink: 0;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gantt-track {
    position: relative;
    flex: 1;
    height: 26px;
    background: var(--color-bg);
    border-radius: 6px;
}

.gantt-bar {
    position: absolute;
    top: 3px;
    bottom: 3px;
    min-width: 10px;
    border-radius: 5px;
    background: var(--color-primary);
    transition: filter var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 6px;
    font-size: 10px;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    overflow: hidden;
}

.gantt-bar.status-done { background: var(--color-success); }
.gantt-bar.status-in_review { background: var(--color-warning); }
.gantt-bar.status-new, .gantt-bar.status-not_started { background: var(--color-text-muted); }
.gantt-bar.status-cancelled { background: var(--color-border); opacity: 0.6; }

/* Риск срыва — отметка поверх статуса (не отдельный цвет, см. ТЗ 5.4): диагональная
   штриховка на полосе плюс красная рамка, независимо от того, какой у задачи статус. */
.gantt-bar.gantt-risk {
    background-image: repeating-linear-gradient(
        135deg, rgba(211, 58, 75, 0.55) 0 6px, transparent 6px 14px
    );
    border: 2px solid var(--color-danger);
}

.gantt-today-line {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 2px;
    background: var(--color-danger);
    opacity: 0.5;
}

.gantt-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 16px;
}

.gantt-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.gantt-legend .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Icons & avatars */
.icon {
    display: inline-block;
    flex-shrink: 0;
    color: currentColor;
}

.avatar {
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}

.avatar-placeholder {
    background: var(--color-primary);
    color: #fff;
    text-align: center;
    font-weight: 600;
    user-select: none;
}

/* Sidebar brand & nav */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px 20px;
}

.brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--color-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.brand-title {
    flex: 1;
    font-weight: 700;
    font-size: 18px;
}

.notif-bell {
    position: relative;
    background: var(--color-bg);
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.notif-bell:hover {
    background: var(--color-border);
}

.nav-link {
    gap: 10px;
}

.nav-link .icon {
    color: var(--color-text-muted);
}

.nav-link.active .icon {
    color: var(--color-primary);
}

.nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* User card */
.user-card {
    padding: 14px;
}

.user-card-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--color-border);
}

.user-card-photo.avatar-placeholder {
    border: none;
}

.user-settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--color-text-muted);
    border: none;
    background: none;
    cursor: pointer;
}

.user-settings-btn:hover {
    background: var(--color-bg);
}

/* Dashboard */
.page-subtitle {
    margin-top: 4px;
    color: var(--color-text-muted);
    font-size: 14px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    align-items: start;
}

.dashboard-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    transition: box-shadow var(--transition);
}

.dashboard-card:hover {
    box-shadow: 0 4px 16px rgba(16, 24, 40, 0.06);
}

.dashboard-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.dashboard-card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.dashboard-card-count {
    color: var(--color-text-muted);
    font-weight: 500;
}

.dashboard-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    background: var(--color-bg);
}

.dashboard-card-icon .icon {
    color: inherit;
}

.dashboard-list-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 0;
    font-size: 14px;
    border-bottom: 1px solid rgba(228, 231, 235, 0.6);
}

.dashboard-list-item:last-child {
    border-bottom: none;
}

.dashboard-list-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.dashboard-list-body a,
.dashboard-list-item > a,
.dashboard-list-item > span {
    word-break: break-word;
}

.dashboard-list-meta {
    color: var(--color-text-muted);
    font-size: 13px;
    line-height: 1.3;
    word-break: break-word;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

.status-dot-green { background: var(--color-success); }
.status-dot-blue { background: var(--color-primary); }
.status-dot-red { background: var(--color-danger); }
.status-dot-orange { background: var(--color-warning); }
.status-dot-grey { background: var(--color-text-muted); }

.workload-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.workload-info {
    flex: 1;
    min-width: 0;
}

.workload-name {
    font-size: 14px;
    margin-bottom: 4px;
}

.workload-bar-wrap {
    height: 6px;
    background: var(--color-bg);
    border-radius: 3px;
    overflow: hidden;
}

.workload-bar {
    height: 100%;
    background: var(--color-primary);
    border-radius: 3px;
    transition: width var(--transition);
}

.workload-count {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    min-width: 24px;
    text-align: right;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 0;
    color: var(--color-text-muted);
}

.empty-icon {
    color: var(--color-primary);
    opacity: 0.4;
    margin-bottom: 12px;
}

.empty-title {
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}

.empty-text {
    font-size: 13px;
    max-width: 260px;
}

.dashboard-empty {
    color: var(--color-text-muted);
    font-size: 14px;
    padding: 8px 0;
}

/* ——— Паспорт проекта (режим просмотра) ——— */

.passport-document {
    line-height: 1.7;
}

.passport-doc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.passport-section {
    margin-bottom: 16px;
}

.passport-label {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.passport-value {
    font-size: 15px;
    color: var(--color-text);
}

/* ——— Портал клиента CMO ——— */

.client-orders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.client-order-card {
    text-decoration: none;
    color: inherit;
    transition: transform var(--transition), box-shadow var(--transition);
    cursor: pointer;
}
.client-order-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}
.client-order-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.client-order-card__code {
    font-size: 12px;
    color: var(--color-text-muted);
    font-weight: 600;
}
.client-order-card__status {
    font-size: 12px;
    font-weight: 600;
}
.client-order-card__title {
    margin: 0 0 12px;
    font-size: 16px;
}
.client-order-card__footer {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--color-text-muted);
}
.client-order-card__footer span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.client-detail-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 16px;
    align-items: start;
}
@media (max-width: 1024px) {
    .client-detail-grid {
        grid-template-columns: 1fr;
    }
}

.client-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--color-bg);
    border-radius: 4px;
    overflow: hidden;
}
.client-progress-bar__fill {
    height: 100%;
    background: var(--color-success);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.client-stages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.client-stage-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--color-bg);
}
.client-stage-item--active {
    background: rgba(79,70,229,0.08);
    border-left: 3px solid var(--color-primary);
}
.client-stage-item--done {
    opacity: 0.7;
}
.client-stage-item__num {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--color-surface);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    flex-shrink: 0;
}
.client-stage-item--done .client-stage-item__num {
    color: var(--color-success);
}
.client-stage-item__content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    gap: 8px;
}
.client-stage-item__name {
    font-size: 14px;
    font-weight: 500;
}
.client-stage-item__status {
    font-size: 12px;
    color: var(--color-text-muted);
}

.client-docs-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.client-doc-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.client-doc-item a {
    color: var(--color-primary);
    text-decoration: none;
}
.client-doc-item a:hover {
    text-decoration: underline;
}

.client-messages-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
    max-height: 450px;
}
.client-message {
    padding: 10px 14px;
    background: rgba(100, 116, 139, 0.14);
    border: 1px solid rgba(100, 116, 139, 0.2);
    border-radius: 16px 16px 16px 4px;
    max-width: 78%;
    align-self: flex-start;
}
.client-message--own {
    background: rgba(52, 87, 213, 0.16);
    border-color: rgba(52, 87, 213, 0.25);
    border-radius: 16px 16px 4px 16px;
    align-self: flex-end;
}
.client-message__author {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text);
}
.client-message__position,
.msg-author-position {
    display: block;
    font-size: 10px;
    font-weight: 500;
    color: var(--color-text-muted);
    line-height: 1.25;
    margin-bottom: 3px;
}
.client-message__body {
    font-size: 14px;
    line-height: 1.4;
}
.client-message__time {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 4px;
    text-align: right;
}
.client-message-form {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}
.client-message-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--color-bg);
    color: var(--color-text);
}

/* ——— Обсуждение (WebSocket чат) ——— */

.discussion-panel {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    max-height: 520px;
}

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

.discussion-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.discussion-status {
    font-size: 12px;
    font-weight: 500;
}

.status-online {
    color: var(--color-success);
}

.status-offline {
    color: var(--color-text-muted);
}

.discussion-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 100px;
}

.discussion-msg {
    padding: 10px 14px;
    border-radius: 16px 16px 16px 4px;
    background: rgba(100, 116, 139, 0.14);
    border: 1px solid rgba(100, 116, 139, 0.2);
    max-width: 78%;
    align-self: flex-start;
    word-break: break-word;
    animation: fadeIn 200ms ease-out;
}

.discussion-msg.msg-mine {
    align-self: flex-end;
    background: rgba(52, 87, 213, 0.16);
    border-color: rgba(52, 87, 213, 0.25);
    border-radius: 16px 16px 4px 16px;
}

.discussion-msg.role-owner,
.client-message.role-owner {
    background: rgba(124, 58, 237, 0.2);
    border-color: rgba(124, 58, 237, 0.48);
}

.discussion-msg.role-admin,
.client-message.role-admin {
    background: rgba(225, 29, 72, 0.18);
    border-color: rgba(225, 29, 72, 0.46);
}

.discussion-msg.role-top-manager,
.client-message.role-top-manager {
    background: rgba(79, 70, 229, 0.2);
    border-color: rgba(79, 70, 229, 0.48);
}

.discussion-msg.role-manager,
.client-message.role-manager {
    background: rgba(2, 132, 199, 0.18);
    border-color: rgba(2, 132, 199, 0.46);
}

.discussion-msg.role-employee,
.client-message.role-employee {
    background: rgba(22, 163, 74, 0.16);
    border-color: rgba(22, 163, 74, 0.42);
}

.discussion-msg.role-observer,
.client-message.role-observer {
    background: rgba(100, 116, 139, 0.18);
    border-color: rgba(100, 116, 139, 0.44);
}

.discussion-msg.role-client,
.client-message.role-client {
    background: rgba(217, 119, 6, 0.18);
    border-color: rgba(217, 119, 6, 0.46);
}

.msg-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 13px;
    margin-bottom: 4px;
}

.msg-header strong {
    color: var(--color-text);
}

.msg-time {
    color: var(--color-text-muted);
    font-size: 12px;
    margin-left: auto;
}

.edited-mark {
    color: var(--color-text-muted);
    font-size: 11px;
}

.pinned-mark {
    font-size: 13px;
}

.client-badge {
    display: inline-block;
    background: var(--color-warning);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
}

.msg-body {
    font-size: 14px;
    line-height: 1.5;
}

.msg-body a {
    color: var(--color-primary);
    word-break: break-all;
}

.msg-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.msg-actions .btn-link {
    font-size: 12px;
    color: var(--color-text-muted);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.msg-actions .btn-link:hover {
    color: var(--color-primary);
}

.reply-ref {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}

.discussion-reply-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(52, 87, 213, 0.06);
    font-size: 13px;
    color: var(--color-primary);
    border-top: 1px solid var(--color-border);
}

.discussion-reply-banner .btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 0 4px;
}

.discussion-typing {
    padding: 4px 16px;
    font-size: 12px;
    color: var(--color-text-muted);
    font-style: italic;
}

.discussion-form {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--color-border);
    align-items: flex-end;
}

.discussion-form textarea {
    flex: 1;
    resize: none;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 14px;
    font-family: var(--font);
    line-height: 1.4;
    min-height: 36px;
    max-height: 150px;
    transition: border-color var(--transition);
}

.discussion-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.discussion-form .btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    white-space: nowrap;
}

.mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 16px;
    right: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-shadow: 0 -4px 12px rgba(0,0,0,.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
}

.mention-item {
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
}

.mention-item:hover, .mention-item.active {
    background: rgba(52, 87, 213, 0.08);
    color: var(--color-primary);
}

.mention {
    color: var(--color-primary);
    font-weight: 600;
    background: rgba(52, 87, 213, 0.06);
    padding: 1px 3px;
    border-radius: 3px;
}

/* Чек-лист задачи */
.checklist-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.checklist-progress .bar {
    flex: 1;
    height: 6px;
    background: var(--color-bg);
    border-radius: 999px;
    overflow: hidden;
}

.checklist-progress .bar > div {
    height: 100%;
    background: var(--color-primary);
    border-radius: 999px;
    transition: width var(--transition);
}

.checklist-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    transition: background var(--transition);
    min-height: 40px;
}

.checklist-item:hover {
    background: var(--color-bg);
}

.checklist-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.checklist-item .title {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
}

.checklist-item .title.done {
    text-decoration: line-through;
    color: var(--color-text-muted);
}

.checklist-item .delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    opacity: 0.6;
    transition: color var(--transition), background var(--transition), border-color var(--transition), opacity var(--transition);
}

.checklist-item:hover .delete-btn {
    opacity: 1;
    border-color: var(--color-border);
}

.checklist-item .delete-btn:hover {
    color: var(--color-danger);
    background: rgba(211, 58, 75, 0.08);
    border-color: var(--color-danger);
}

.checklist-add-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.checklist-add-row input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    font-size: 14px;
}

.checklist-add-row input[type="text"]:focus {
    outline: none;
    border-color: var(--color-primary);
}

@media (max-width: 720px) {
    .shell {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }
    .sidebar .spacer, .sidebar .user-card, .sidebar .brand {
        display: none;
    }
    .main {
        padding: 16px;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}
