/* ADONIS CRM — Base styles (nav, modal, toast, components) */

/* === CSS ПЕРЕМЕННЫЕ ADONIS === */
:root {
    --bg-primary: #09090b;
    --bg-secondary: #0f0f12;
    --bg-tertiary: #18181b;
    --border: #27272a;
    --border-hover: #3f3f46;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;
    --accent: #dc2626;
    --accent-hover: #ef4444;
    --accent-light: rgba(220, 38, 38, 0.12);
    --success: #22c55e;
    --success-light: rgba(34, 197, 94, 0.12);
    --danger: #dc2626;
    --danger-light: rgba(220, 38, 38, 0.12);
    --warning: #eab308;
    --warning-light: rgba(234, 179, 8, 0.12);
    --info: #71717a;
    --info-light: rgba(113, 113, 122, 0.12);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
    --transition-fast: 0.1s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* === СВЕТЛАЯ ТЕМА === */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent: #dc2626;
    --accent-hover: #ef4444;
    --accent-light: rgba(220, 38, 38, 0.08);
    --success: #16a34a;
    --success-light: rgba(22, 163, 74, 0.08);
    --danger: #dc2626;
    --danger-light: rgba(220, 38, 38, 0.08);
    --warning: #ca8a04;
    --warning-light: rgba(202, 138, 4, 0.08);
    --info: #64748b;
    --info-light: rgba(100, 116, 139, 0.08);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .navbar {
    background: linear-gradient(135deg, #1e293b, #0f172a) !important;
}
[data-theme="light"] .stat { 
    box-shadow: 0 1px 3px rgba(0,0,0,0.06); 
}

/* === ПЛАВНЫЕ ПЕРЕХОДЫ === */
*, *::before, *::after {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.2s ease, box-shadow 0.3s ease;
}
.btn, .nav-link, .card, .stat, input, select, textarea {
    transition: all 0.25s ease !important;
}

/* Профиль */
.profile-card {
    text-align: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1rem;
    color: white;
}
.profile-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.profile-role {
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.user-list {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 1rem;
}
.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}
.user-item-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.user-item-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

/* === БАЗОВЫЕ СТИЛИ === */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Плавное появление контента */
.content { animation: pageIn 0.35s ease; }
@keyframes pageIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Улучшенные кнопки */
.btn:active { transform: scale(0.97); }
.btn-primary:hover { box-shadow: 0 4px 15px rgba(220,38,38,0.35); }

/* === НАВИГАЦИЯ === */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0.45rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    min-width: 0;
    gap: 0.5rem;
}

.nav-brand {
    display: flex; align-items: center; text-decoration: none; font-family: 'Montserrat', sans-serif;
    font-size: 1.15rem; font-weight: 900; letter-spacing: 0.08em;
    flex-shrink: 0;
}
.nav-brand-a { color: #dc2626; }
.nav-brand-d { color: #e8e8e8; }
.nav-brand-o { color: #dc2626; text-shadow: 0 0 12px rgba(220,38,38,0.4); }
.nav-brand-n { color: #e8e8e8; }
.nav-brand-i { color: #e8e8e8; }
.nav-brand-s { color: #e8e8e8; }

.brand-icon {
    font-size: 1.5rem;
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fafafa;
    letter-spacing: 0.05em;
}

.version-badge {
    font-size: 0.65rem;
    font-weight: 600;
    background: var(--accent-light);
    color: var(--accent);
    padding: 0.15rem 0.4rem;
    border-radius: 20px;
}

.nav-links {
    display: flex;
    gap: 0.15rem;
    flex-wrap: nowrap;
    overflow: hidden;
    min-width: 0;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.38rem 0.6rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.8rem;
    transition: all var(--transition-fast);
    white-space: nowrap;
    flex-shrink: 0;
}

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

.nav-link.active {
    color: var(--accent);
    background: var(--accent-light);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.user-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* === ОСНОВНОЙ КОНТЕЙНЕР === */
.main {
    padding: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* === ТАБЫ === */
.tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-secondary);
    padding: 0.4rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    flex-wrap: wrap;
    overflow-x: auto;
}

.tab {
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    border: none;
    background: transparent;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.tab.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* === КАРТОЧКИ === */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: border-color var(--transition-fast);
}

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

.card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* === СТАТИСТИКА === */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform var(--transition-normal);
}

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

.stat:hover::before {
    transform: scaleX(1);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
}

.stat-value.green { color: var(--success); }
.stat-value.red { color: var(--danger); }
.stat-value.blue { color: var(--accent); }

.stat-change {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

/* === КНОПКИ === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

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

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

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

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

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

.btn-success:hover {
    background: #0d9668;
}

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

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* === ТУЛБАР === */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.toolbar-left, .toolbar-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* === ПОИСК === */
.search-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 240px;
    transition: border-color var(--transition-fast);
}

.search-box:focus-within {
    border-color: var(--accent);
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 100%;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* === ФИЛЬТРЫ === */
.filter-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* === ТАБЛИЦЫ === */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th {
    background: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
}

tr:hover td {
    background: var(--bg-tertiary);
}

tr.selected td {
    background: var(--accent-light);
}

/* === ЧЕКБОКСЫ === */
.checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* === РЕДАКТИРУЕМЫЕ ЯЧЕЙКИ === */
.editable {
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    min-width: 50px;
    transition: all var(--transition-fast);
}

.editable:hover {
    background: var(--bg-secondary);
    outline: 2px solid var(--accent);
}

.edit-input {
    background: var(--bg-primary);
    border: 2px solid var(--accent);
    color: var(--text-primary);
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    font-family: inherit;
    font-size: inherit;
    width: 100%;
    outline: none;
}

/* === СУММЫ === */
.amount {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.amount.pos { color: var(--success); }
.amount.neg { color: var(--danger); }

/* === ТЕГИ === */
.tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.tag-green { background: var(--success-light); color: var(--success); }
.tag-red { background: var(--danger-light); color: var(--danger); }
.tag-blue { background: var(--accent-light); color: var(--accent); }
.tag-yellow { background: var(--warning-light); color: var(--warning); }

/* === МОДАЛЬНЫЕ ОКНА === */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-box {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    width: 95%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    transform: scale(0.95);
    transition: transform var(--transition-normal);
    box-shadow: var(--shadow-lg);
}

.modal.show .modal-box {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color var(--transition-fast);
    line-height: 1;
}

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

/* === ФОРМЫ === */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

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

/* === УВЕДОМЛЕНИЯ (TOAST) === */
/* ── Toast notifications — edge-slide style ───────────────────────────────── */

.toast-container {
    position: fixed;
    top: 5rem;
    right: 0;
    z-index: 9500;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
    padding: 0;
}

.toast {
    background: var(--bg-secondary, #1a1d23);
    border: 1px solid var(--border, #2a2d35);
    border-right: none;
    border-radius: 10px 0 0 10px;
    padding: 12px 18px 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 320px;
    box-shadow: -4px 4px 24px rgba(0, 0, 0, 0.45);
    animation: toastEdgeIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    pointer-events: all;
    position: relative;
    overflow: hidden;
}

/* Accent left bar */
.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    border-radius: 10px 0 0 10px;
}

.toast.success::before { background: var(--success, #22c55e); }
.toast.error::before   { background: var(--danger,  #ef4444); }
.toast.warning::before { background: var(--warning, #f59e0b); }
.toast.info::before    { background: var(--accent,  #6366f1); }

/* Progress bar that shrinks to 0 over the toast lifetime */
.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 100%;
    transform-origin: left;
    animation: toastProgress var(--toast-duration, 5s) linear forwards;
}

.toast.success::after { background: var(--success, #22c55e); }
.toast.error::after   { background: var(--danger,  #ef4444); }
.toast.warning::after { background: var(--warning, #f59e0b); }
.toast.info::after    { background: var(--accent,  #6366f1); }

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

@keyframes toastEdgeOut {
    from { transform: translateX(0);    opacity: 1;   max-height: 80px; margin-bottom: 6px; }
    to   { transform: translateX(110%); opacity: 0;   max-height: 0;    margin-bottom: 0; }
}

@keyframes toastProgress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

.toast-icon {
    font-size: 16px;
    flex-shrink: 0;
    line-height: 1;
}

.toast-text {
    flex: 1;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text, #e4e6ea);
    word-break: break-word;
}

.toast-btn {
    cursor: pointer;
    font-weight: 600;
    color: var(--accent);
    background: none;
    border: none;
    font-size: 0.8rem;
    flex-shrink: 0;
    padding: 0;
}

.toast-btn:hover { text-decoration: underline; }

.toast-undo {
    cursor: pointer;
    font-weight: 700;
    color: var(--accent);
    background: none;
    border: 1px solid var(--accent);
    border-radius: 4px;
    font-size: 0.75rem;
    padding: 2px 7px;
    margin-right: 4px;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.toast-undo:hover { background: var(--accent); color: #fff; }

.toast-close {
    cursor: pointer;
    color: var(--text-muted, #6b7280);
    background: none;
    border: none;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
    padding: 0;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.toast-close:hover { opacity: 1; }

/* === ПРОГРЕСС-БАР === */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    transition: width 0.3s ease;
}

/* === ЛОГ ИМПОРТА === */
.import-log {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    margin-top: 1rem;
}

.log-line {
    margin: 0.25rem 0;
}

.log-line.error { color: var(--danger); }
.log-line.success { color: var(--success); }
.log-line.info { color: var(--text-muted); }

/* === КОШЕЛЬКИ === */
.wallets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.wallet-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.wallet-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.wallet-card.active {
    border-color: var(--accent);
    background: var(--accent-light);
}

.wallet-name {
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.wallet-balance {
    font-size: 1.25rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}

/* === СВОДНАЯ ТАБЛИЦА === */
.pivot {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.pivot th, .pivot td {
    padding: 0.6rem;
    border: 1px solid var(--border);
    text-align: right;
}

.pivot th {
    background: var(--bg-tertiary);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.pivot th:first-child, .pivot td:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--bg-secondary);
    z-index: 5;
}

.pivot tr:hover td {
    background: var(--bg-tertiary);
}

.pivot .total-row {
    font-weight: 700;
    background: var(--bg-tertiary);
}

.drill-link {
    cursor: pointer;
    text-decoration: underline dotted;
    transition: color var(--transition-fast);
}

.drill-link:hover {
    color: var(--accent);
}

/* === СТРАНИЦА ВХОДА === */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-primary), #1a1a2e);
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.error-box {
    background: var(--danger-light);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* === СПИННЕР === */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* === СКЕЛЕТОН ЗАГРУЗКИ === */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === ГРАФИКИ === */
.card-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.card-title {
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* === ТУЛТИПЫ === */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 100;
    margin-bottom: 5px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

/* === ГОРЯЧИЕ КЛАВИШИ === */
.hotkey {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

/* === АДАПТИВНОСТЬ === */
@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-left, .toolbar-right { justify-content: center; }
    .search-box { width: 100%; }
    .navbar { padding: 0.75rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
    .nav-links { order: 3; width: 100%; justify-content: center; }
    .stats { grid-template-columns: repeat(2, 1fr); }
}


/* ═══ Adosha Guide (floating onboarding tour) ═══ */
.adosha-guide {
    position: fixed; bottom: 1.5rem; left: 1.5rem; z-index: 9999;
    font-family: inherit;
}
.adosha-guide-card {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 16px; width: 340px; overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
    animation: fadeInUp 0.4s ease;
}
@keyframes fadeInUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }

.adosha-guide-header {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    padding: 0.75rem 1rem; display: flex; align-items: center; gap: 0.6rem;
}
.adosha-guide-avatar {
    width: 36px; height: 36px; background: rgba(255,255,255,0.15);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.adosha-guide-title { font-weight: 700; color: #fff; font-size: 0.88rem; }
.adosha-guide-subtitle { font-size: 0.72rem; color: rgba(255,255,255,0.7); }
.adosha-guide-close {
    background: none; border: none; color: rgba(255,255,255,0.6);
    font-size: 1.1rem; cursor: pointer; margin-left: auto;
}
.adosha-guide-body { padding: 1rem; }
.adosha-guide-message { font-size: 0.88rem; line-height: 1.6; color: var(--text-secondary); margin-bottom: 0.75rem; }
.adosha-guide-highlight { display: none; }
.adosha-guide-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 0.75rem; }
.adosha-guide-dots { display: flex; gap: 0.3rem; }
.adosha-guide-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
.adosha-guide-dot.active { background: #6366f1; }
.adosha-guide-btn {
    padding: 0.4rem 1rem; background: #6366f1; color: white;
    border: none; border-radius: 8px; font-weight: 600; font-size: 0.82rem;
    cursor: pointer; transition: all 0.2s;
}
.adosha-guide-btn:hover { background: #4f46e5; transform: translateY(-1px); }
.adosha-guide-btn.secondary { background: var(--bg-tertiary); color: var(--text-muted); }

/* ═══════════════════════════════════════════════════
   RESTORED: Kanban Board, Deal Modal, Timeline, Forms
   These were accidentally removed during cab-* cleanup
   ═══════════════════════════════════════════════════ */

/* ═══ Kanban Board — Modern Design ═══ */
.kanban-board { display: flex; gap: 0.75rem; overflow-x: auto; padding-bottom: 1rem; min-height: 500px; scroll-snap-type: x mandatory; }
.kanban-board::-webkit-scrollbar { height: 6px; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.kanban-col { flex: 0 0 260px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; max-height: calc(100vh - 200px); scroll-snap-align: start; transition: box-shadow 0.3s; }
.kanban-col:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.15); }
.kanban-col.drag-over { border-color: var(--accent); box-shadow: 0 0 20px rgba(220,38,38,0.15); }

/* Column status top border colors */
.col-status-new { border-top: 3px solid #6366f1; }
.col-status-contacted { border-top: 3px solid #3b82f6; }
.col-status-contact { border-top: 3px solid #3b82f6; }
.col-status-negotiation { border-top: 3px solid #f59e0b; }
.col-status-decision { border-top: 3px solid #f97316; }
.col-status-won { border-top: 3px solid #22c55e; }
.col-status-lost { border-top: 3px solid #ef4444; }

.col-header { padding: 0.85rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.col-title { font-weight: 700; font-size: 0.88rem; display: flex; align-items: center; gap: 0.35rem; }
.col-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }
.col-cards { flex: 1; overflow-y: auto; padding: 0.5rem; display: flex; flex-direction: column; gap: 0.5rem; min-height: 60px; }
.col-cards::-webkit-scrollbar { width: 4px; }
.col-cards::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Add button — subtle, not ugly */
.col-add { background: none; border: none; width: 28px; height: 28px; border-radius: 8px; color: var(--text-muted); cursor: pointer; font-size: 0.85rem; transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.col-add:hover { background: var(--bg-tertiary); color: var(--accent); }

/* Deal cards — premium look */
.deal-card { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem; cursor: grab; transition: all 0.2s; animation: cardIn 0.3s ease; }
.deal-card:hover { border-color: rgba(99,102,241,0.4); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.2); }
.deal-card:active { cursor: grabbing; transform: scale(0.98); }
.deal-card.dragging { opacity: 0.4; transform: rotate(2deg); }
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.deal-empty { padding: 2rem 1rem; text-align: center; color: var(--text-muted); font-size: 0.78rem; opacity: 0.5; }

.dc-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.3rem; }
.dc-name { font-weight: 600; font-size: 0.85rem; line-height: 1.3; }
.dc-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 0.35rem; }
.dc-dot.p-high { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.4); }
.dc-dot.p-medium { background: #f59e0b; }
.dc-dot.p-low { background: #22c55e; }
.dc-row { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; display: flex; align-items: center; gap: 0.3rem; }
.dc-budget { font-weight: 700; color: #22c55e; font-size: 0.82rem; margin-top: 0.2rem; }
.dc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; padding-top: 0.4rem; border-top: 1px solid rgba(255,255,255,0.04); }
.dc-tag { font-size: 0.65rem; padding: 0.12rem 0.45rem; background: rgba(99,102,241,0.12); color: #818cf8; border-radius: 4px; font-weight: 500; }
.dc-days { font-size: 0.68rem; color: var(--text-muted); }
.dc-assigned { display: flex; align-items: center; gap: 0.3rem; font-size: 0.7rem; color: var(--text-muted); margin-top: 0.3rem; }
.dc-assigned-avatar { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: white; display: flex; align-items: center; justify-content: center; font-size: 0.55rem; font-weight: 700; }

/* Board header / stats */
.board-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.board-stats { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.board-stat { text-align: center; }
.board-stat-label { font-size: 0.72rem; color: var(--text-muted); }
.board-stat-val { font-size: 1.1rem; font-weight: 700; }

/* Deal modal layout */
.dm-box { max-width: 800px; }
.dm-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.dm-left, .dm-right { display: flex; flex-direction: column; gap: 1rem; }
.dm-section { margin-bottom: 0.75rem; }
.dm-stitle { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.5rem; }
.dm-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.dm-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }

/* Timeline / comments */
.tl { margin-top: 1rem; }
.tl-body { max-height: 300px; overflow-y: auto; }
.tl-item { display: flex; gap: 0.6rem; padding: 0.5rem 0; animation: cardIn 0.3s ease; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 0.3rem; }
.tl-dot.green { background: #22c55e; }
.tl-dot.blue { background: #3b82f6; }
.tl-dot.yellow { background: #f59e0b; }
.tl-dot.red { background: #ef4444; }
.tl-dot.gray { background: var(--text-muted); }
.tl-text { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.4; }
.tl-date { font-size: 0.68rem; color: var(--text-muted); }
.tl-input { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.tl-input input { flex: 1; }

/* Loss modal */
.loss-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 1000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.loss-bg.show { display: flex; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.loss-box { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 16px; padding: 1.5rem; width: 420px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }

@media (max-width: 768px) {
    .kanban-board { flex-direction: column; }
    .kanban-col { flex: none; width: 100%; max-height: none; }
    .dm-layout { grid-template-columns: 1fr; }
}

/* Nav user link (profile) — full name, no truncation */
.nav-user-link { white-space: nowrap; }
.nav-username-text { font-size: 0.78rem; }

/* Logout button — compact icon style with tooltip */
.nav-logout-btn { padding: 0.3rem 0.55rem !important; font-size: 0.75rem !important; border-radius: 8px !important; position: relative; }
.nav-logout-btn::after {
    content: 'Выйти';
    position: absolute;
    top: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid var(--border);
    white-space: nowrap;
    pointer-events: none;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.15s !important;
}
.nav-logout-btn:hover::after { opacity: 1; }

/* Theme toggle button */
.theme-toggle { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 0.3rem 0.45rem; cursor: pointer; font-size: 0.95rem; line-height: 1; transition: all 0.2s; color: var(--text-primary); }
.theme-toggle:hover { border-color: var(--accent); transform: scale(1.05); }

/* ═══════════════════════════════════════════════════════════
   IMPERSONATE — banner + red aura
   ═══════════════════════════════════════════════════════════ */

/* Pulsing red screen-edge aura */
body[data-impersonating="true"]::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9990;
    box-shadow: inset 0 0 70px 18px rgba(220, 38, 38, 0.18);
    animation: impersonateAura 4s ease-in-out infinite;
    border-radius: 0;
}
@keyframes impersonateAura {
    0%, 100% { box-shadow: inset 0 0 70px 18px rgba(220, 38, 38, 0.14); }
    50%       { box-shadow: inset 0 0 110px 36px rgba(220, 38, 38, 0.26); }
}

/* Top banner */
.impersonate-banner {
    background: linear-gradient(90deg, #450a0a 0%, #7f1d1d 40%, #991b1b 60%, #7f1d1d 80%, #450a0a 100%);
    border-bottom: 1px solid rgba(239, 68, 68, 0.4);
    padding: 7px 1rem;
    position: sticky;
    top: 0;
    z-index: 101;
    animation: impersonateBannerIn 0.35s cubic-bezier(.23,1,.32,1);
}
@keyframes impersonateBannerIn {
    from { opacity: 0; transform: translateY(-100%); }
    to   { opacity: 1; transform: translateY(0); }
}

.impersonate-banner-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 1600px;
    margin: 0 auto;
    font-size: 0.8rem;
    color: #fca5a5;
    flex-wrap: wrap;
}
.impersonate-eye  { font-size: 1rem; animation: eyePulse 2s ease-in-out infinite; }
@keyframes eyePulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}
.impersonate-role {
    opacity: 0.7;
    font-size: 0.75rem;
}
.impersonate-stop-btn {
    margin-left: auto;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #fca5a5;
    padding: 4px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    letter-spacing: 0.02em;
}
.impersonate-stop-btn:hover {
    background: rgba(239, 68, 68, 0.45);
    color: #fff;
    border-color: rgba(239, 68, 68, 0.8);
}
