html { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }

:root {
    --sidebar-width: 260px;
    --topbar-height: 56px;
    --color-bg: #f1f5f9;
    --color-sidebar: #1e293b;
    --color-sidebar-text: #cbd5e1;
    --color-sidebar-active: #3b82f6;
    --color-text: #0f172a;
    --color-text-muted: #3d4759;
    --color-border: #e2e8f0;
    --color-card: #ffffff;
    --color-success: #16a34a;
    --color-warning: #d97706;
    --color-danger: #dc2626;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
    --color-green-soft: #dcfce7;
    --color-red-soft: #fef2f2;
}

/* Accent: Blue (default) */
[data-accent="blue"], [data-accent=""] { --color-primary: #3b82f6; --color-primary-hover: #2563eb; --color-blue: #3b82f6; }
/* Accent: Orange */
[data-accent="orange"] { --color-primary: #f97316; --color-primary-hover: #ea580c; --color-blue: #f97316; }
/* Accent: Green */
[data-accent="green"] { --color-primary: #22c55e; --color-primary-hover: #16a34a; --color-blue: #22c55e; }
/* Accent: Purple */
[data-accent="purple"] { --color-primary: #a855f7; --color-primary-hover: #9333ea; --color-blue: #a855f7; }
/* Accent: Red */
[data-accent="red"] { --color-primary: #ef4444; --color-primary-hover: #dc2626; --color-blue: #ef4444; }

[data-theme="dark"] {
    --color-bg: #0f172a;
    --color-sidebar: #020617;
    --color-sidebar-text: #cbd5e1;
    --color-text: #e2e8f0;
    --color-text-muted: #c2cbda;
    --color-border: #1e293b;
    --color-card: #1e293b;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.4);
    --color-green-soft: #064e3b;
    --color-red-soft: #450a0a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

small { font-size: 14px; }

.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-sidebar);
    color: var(--color-sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar__logo { padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar__logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
}

.sidebar__nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar__section { padding: 0 12px; margin-bottom: 16px; }
.sidebar__section-title { font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; padding: 4px 8px; margin-bottom: 4px; }

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-sidebar-text);
    font-size: 14px;
    text-decoration: none;
    transition: all 0.15s;
}
.sidebar__link:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.sidebar__link--active { background: rgba(59,130,246,0.2); color: #60a5fa; }

.sidebar__link--dash {
    margin-bottom: 4px;
    font-weight: 700;
    border: 1px solid rgba(59,130,246,0.4);
    background: rgba(59,130,246,0.12);
    color: #93c5fd;
}
.sidebar__link--dash:hover { background: rgba(59,130,246,0.2); color: #bfdbfe; }
.sidebar__link--dash.sidebar__link--active { background: rgba(59,130,246,0.28); color: #bfdbfe; }

.sidebar__footer { padding: 12px 20px; border-top: 1px solid rgba(255,255,255,0.08); font-size: 14px; }
.sidebar__version { color: #cbd5e1; display: block; }
.sidebar__version:hover { color: #ffffff; text-decoration: none; }
.sidebar__copyright { display: block; color: #cbd5e1; font-size: 14px; margin-top: 4px; }

/* Main */
.main { flex: 1; margin-left: var(--sidebar-width); display: flex; flex-direction: column; }

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: var(--color-card);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar__title { font-size: 18px; font-weight: 600; }
.topbar__actions { display: flex; align-items: center; gap: 16px; }

.topbar__search { display: flex; align-items: center; }
.topbar__search-input {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 14px;
    width: 200px;
    outline: none;
}
.topbar__search-input:focus { border-color: var(--color-primary); }
.topbar__search-btn { background: none; border: none; cursor: pointer; color: var(--color-text-muted); padding: 6px; }

.topbar__user { display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* Theme toggle */
.topbar__theme-group { display: flex; align-items: center; gap: 4px; position: relative; }
.topbar__theme-btn {
    background: none; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    cursor: pointer; padding: 6px; line-height: 1; display: flex;
    color: var(--color-text-muted); transition: all 0.15s;
}
.topbar__theme-btn:hover { background: var(--color-bg); color: var(--color-text); }
[data-theme="light"] .theme-icon--dark { display: none; }
[data-theme="dark"] .theme-icon--light { display: none; }
.topbar__logout button { background: none; border: none; cursor: pointer; color: var(--color-text-muted); padding: 4px; }
.topbar__logout button:hover { color: var(--color-danger); }

/* Accent color picker */
.topbar__accent-btn {
    background: none; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    cursor: pointer; padding: 6px; line-height: 1; display: flex; align-items: center; justify-content: center;
    color: var(--color-text-muted); transition: all 0.15s; width: 32px; height: 32px;
}
.topbar__accent-btn:hover { background: var(--color-bg); }
.accent-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--color-primary); display: block; flex-shrink: 0; }
.accent-menu {
    position: absolute; top: 100%; left: 0; margin-top: 8px;
    background: var(--color-card); border: 1px solid var(--color-border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 200;
    padding: 12px; display: none; min-width: 180px;
}
.accent-menu--open { display: block; }
.accent-menu__title { font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); margin-bottom: 8px; font-weight: 600; }
.accent-menu__grid { display: flex; gap: 8px; }
.accent-option {
    width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent;
    cursor: pointer; transition: all 0.15s; padding: 0;
}
.accent-option:hover { transform: scale(1.15); }
.accent-option--active { border-color: var(--color-text); box-shadow: 0 0 0 2px var(--color-card); }

/* Theme transition overlay */
.theme-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 9999; pointer-events: none;
    background: var(--color-bg);
    animation: themeReveal 0.5s ease-in-out forwards;
}
@keyframes themeReveal {
    from { clip-path: circle(0% at var(--click-x, 50%) var(--click-y, 50%)); }
    to { clip-path: circle(150% at var(--click-x, 50%) var(--click-y, 50%)); }
}

/* Version link */
.version-link { color: var(--color-text-muted); text-decoration: none; }
.version-link:hover { color: var(--color-primary); text-decoration: underline; }

/* Auth logo */
.auth-logo { margin-bottom: 4px; display: flex; justify-content: center; }
.auth-logo svg { display: block; }

/* Content */
.content { padding: 24px; flex: 1; }

/* Toast-уведомления: стек в правом верхнем углу, плавное появление/исчезновение */
.toaster {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.45;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toastIn 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
}
.toast--dismissing {
    animation: toastOut 0.28s ease-in forwards;
}
.toast--success {
    background: #fff;
    color: #14532d;
    border: 1px solid #bbf7d0;
    border-left: 4px solid var(--color-success, #16a34a);
}
.toast--error {
    background: #fff;
    color: #7f1d1d;
    border: 1px solid #fecaca;
    border-left: 4px solid var(--color-danger, #dc2626);
}
.toast--warning {
    background: #fff;
    color: #78350f;
    border: 1px solid #fde68a;
    border-left: 4px solid var(--color-warning, #d97706);
}
.toast__icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    margin-top: 1px;
}
.toast--success .toast__icon { color: var(--color-success, #16a34a); }
.toast--error .toast__icon { color: var(--color-danger, #dc2626); }
.toast--warning .toast__icon { color: var(--color-warning, #d97706); }
.toast__text {
    flex: 1;
    word-break: break-word;
}
.toast__close {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    opacity: 0.6;
}
.toast__close:hover { opacity: 1; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(120%); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(120%); }
}

/* Cards */
.card { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.card__header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--color-border); }
.card__subtitle { margin-top: 2px; font-size: 14px; color: var(--color-text-muted); }
.card__title { font-size: 15px; font-weight: 600; }
.card__body { padding: 16px 20px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px; text-align: center; box-shadow: var(--shadow); }
.stat-card__value { font-size: 28px; font-weight: 700; color: var(--color-text); }
.stat-card__label { font-size: 14px; color: var(--color-text-muted); margin-top: 4px; }
.stat-card--green .stat-card__value { color: var(--color-success); }
.stat-card--blue .stat-card__value { color: var(--color-blue); }
.stat-card--yellow .stat-card__value { color: var(--color-warning); }
.stat-card--red .stat-card__value { color: var(--color-danger); }
.stat-card.stat-card--ghost { color: inherit; }
.stat-card, .stats-grid .stat-card { text-decoration: none; color: inherit; }
.stat-card:hover, .stats-grid .stat-card:hover { text-decoration: none; color: inherit; border-color: var(--color-primary); }
.stat-card:hover .stat-card__label, .stats-grid .stat-card:hover .stat-card__label { color: var(--color-primary); }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 14px; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.03em; padding: 10px 12px; border-bottom: 2px solid var(--color-border); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--color-border); font-size: 14px; vertical-align: middle; }
.table--full { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.table--full th { background: #f8fafc; }
.table--full tr:hover td { background: #f1f5f9; }
.table--full td a { font-weight: 500; }

.row--overdue td { background: #fef2f2 !important; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background: #6b7280;
    white-space: nowrap;
}
.badge--sm { padding: 1px 8px; font-size: 14px; }

/* Progress bar */
.progress-bar { position: relative; height: 20px; background: #e2e8f0; border-radius: 10px; overflow: hidden; min-width: 80px; }
.progress-bar--lg { height: 28px; }
.progress-bar__fill { height: 100%; background: linear-gradient(90deg, var(--color-success), #16a34a); border-radius: 10px; transition: width 0.3s; }
.progress-bar__text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 14px; font-weight: 600; color: var(--color-text); }
/* Светофор прогресса: красный <33%, жёлтый 33–66%, зелёный >66% */
.progress-bar__fill--low { background: linear-gradient(90deg, #f87171, #dc2626); }
.progress-bar__fill--mid { background: linear-gradient(90deg, #fbbf24, #d97706); }
.progress-bar__fill--high { background: linear-gradient(90deg, #4ade80, #16a34a); }
.progress-bar__fill--none { background: #94a3b8; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: var(--color-card);
    color: var(--color-text);
    text-decoration: none;
    transition: all 0.15s;
}
.btn:hover { background: #f1f5f9; text-decoration: none; }
.btn--primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn--primary:hover { background: var(--color-primary-hover); }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: #f1f5f9; }
.btn--danger { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn--danger:hover { background: #dc2626; }
.btn--sm { padding: 4px 10px; font-size: 14px; }
.btn--full { width: 100%; justify-content: center; }
.btn--disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

.btn-icon { background: none; border: none; cursor: pointer; color: var(--color-text-muted); font-size: 14px; padding: 2px 6px; }
.btn-icon:hover { color: var(--color-danger); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 4px; color: var(--color-text); }
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--color-card);
    outline: none;
    transition: border-color 0.15s;
}
.form-control:focus { border-color: var(--color-primary); }
.form-control--sm { padding: 6px 10px; font-size: 14px; }
.form-control--lg { padding: 12px 16px; font-size: 16px; }
.form-control--color { width: 60px; height: 36px; padding: 2px; cursor: pointer; }
textarea.form-control { resize: vertical; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-actions { display: flex; gap: 12px; margin-top: 20px; }

/* Page header */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.page-header h2 { font-size: 22px; font-weight: 700; }
.page-header__actions { display: flex; gap: 8px; }
.page-header__badges { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.breadcrumb { display: inline-block; font-size: 14px; color: var(--color-text-muted); margin-bottom: 8px; }
.breadcrumb:hover { color: var(--color-primary); }

/* Direction rows */
.direction-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--color-border); text-decoration: none; color: var(--color-text); }
.direction-row:hover { background: #f8fafc; text-decoration: none; }
.direction-row__color { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.direction-row__name { flex: 1; font-weight: 500; }
.direction-row__count { font-size: 14px; color: var(--color-text-muted); }

/* Directions grid */
.directions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.direction-card { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.direction-card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.direction-card__name { font-size: 16px; font-weight: 600; }
.direction-card__name a { color: var(--color-text); }
.direction-card__desc { font-size: 14px; color: var(--color-text-muted); margin-bottom: 12px; }
.direction-card__stats { display: flex; gap: 16px; font-size: 14px; color: var(--color-text-muted); margin-bottom: 12px; }
.direction-card__actions { display: flex; gap: 8px; }

/* Detail table */
.detail-table { width: 100%; }
.detail-table td { padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px; vertical-align: top; }
.detail-label { font-weight: 500; color: var(--color-text-muted); width: 200px; white-space: nowrap; }

/* Detail grid */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }

/* Project detail */
.project-detail__progress { margin-bottom: 20px; }
.project-detail__progress label { font-size: 14px; font-weight: 500; display: block; margin-bottom: 6px; }

/* Notes */
.note-item { padding: 12px 0; border-bottom: 1px solid #f1f5f9; }
.note-item__header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.note-item__content { font-size: 14px; }
.note-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--color-border); }

/* Activity */
.activity-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.activity-row__action { font-weight: 500; min-width: 80px; }
.activity-row__action--created { color: var(--color-success); }
.activity-row__action--updated { color: var(--color-blue); }
.activity-row__action--completed { color: var(--color-primary); }
.activity-row__action--deleted { color: var(--color-danger); }
.activity-row__action--archived { color: var(--color-text-muted); }
.activity-row__name { flex: 1; }
.activity-row__time { color: var(--color-text-muted); font-size: 14px; }

/* Filters */
.filters-bar { margin-bottom: 16px; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Search */
.search-form { display: flex; gap: 12px; }
.search-form .form-control { flex: 1; }

/* Empty state */
.empty { text-align: center; color: var(--color-text-muted); padding: 24px; font-size: 14px; }
.empty-state { text-align: center; padding: 48px; color: var(--color-text-muted); }
.empty-state p { margin-bottom: 16px; }

/* Text helpers */
.text-muted { color: var(--color-text-muted); }
.text-red { color: var(--color-danger) !important; }
.text-sm { font-size: 14px; }
.text-mono { font-family: 'SF Mono', 'Consolas', monospace; font-size: 14px; }
.font-bold { font-weight: 600; }
.d-block { display: block; }
.mt-lg { margin-top: 24px; }
.text-pre { white-space: pre-wrap; font-size: 14px; }

/* Dashboard grid */
.dashboard__grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 16px; }
.dashboard__col { min-width: 0; }

/* Auth page (login) */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--color-bg); padding: 20px; }
.auth-card { background: var(--color-card); border: 1px solid var(--color-border); border-radius: 14px; padding: 40px; box-shadow: var(--shadow-lg); text-align: center; max-width: 400px; width: 100%; }
.auth-card__header { margin-bottom: 24px; }
.auth-card__header h1 { font-size: 22px; margin-top: 12px; font-weight: 700; }
.auth-card__subtitle { font-size: 14px; color: var(--color-text-muted); margin-top: 4px; }
.auth-card__desc { font-size: 14px; color: var(--color-text-muted); margin-top: 8px; line-height: 1.4; }
.auth-card__footer { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--color-border); font-size: 14px; color: var(--color-text-muted); }
.auth-card__footer strong { color: var(--color-text); }

.alert { padding: 10px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.alert--error { background: var(--color-red-soft); color: var(--color-danger); border: 1px solid var(--color-danger); }
.alert--success { background: var(--color-green-soft); color: var(--color-success); border: 1px solid var(--color-success); }
.alert--warning { background: #fffbeb; color: #92400e; border: 1px solid #f59e0b; }
.alert--danger { background: #fef2f2; color: #b91c1c; border: 1px solid #ef4444; }
.alert--info { background: #ecfeff; color: #155e75; border: 1px solid #06b6d4; }
.alert__title { font-weight: 600; margin-bottom: 2px; }
.alert__message { font-size: 14px; opacity: 0.92; }

/* Client ecosystem (people / LPR cards) */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.person-card { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.person-card__header { padding: 16px 20px; border-bottom: 1px solid var(--color-border); display: flex; gap: 14px; align-items: center; }
.person-card__body { padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.person-card__footer { padding: 12px 20px; border-top: 1px solid var(--color-border); display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.avatar--lg { width: 64px; height: 64px; font-size: 22px; }
.kv-row { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; }
.kv-row__key { color: var(--color-text-muted); min-width: 120px; flex-shrink: 0; }
.kv-row__value { min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; padding: 2px 10px; border-radius: 999px; background: #f1f5f9; color: var(--color-text-muted); }
.chip--primary { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }
.money-highlight { font-size: 15px; font-weight: 700; color: var(--color-success); }
.msg-item { padding: 12px 0; border-bottom: 1px solid #f1f5f9; }
.msg-item:last-child { border-bottom: none; }
.msg-item__header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.msg-item__content { font-size: 14px; line-height: 1.5; }
.msg-bubble { background: #f1f5f9; border-radius: 12px; padding: 10px 14px; max-width: 520px; }
.msg-bubble--in { background: #eff6ff; border-left: 3px solid #3b82f6; }
.msg-bubble--out { background: #f0fdf4; border-left: 3px solid #22c55e; }
.ai-prompt-box { background: #0f172a; color: #e2e8f0; border-radius: var(--radius-sm); padding: 14px 16px; font-family: 'SF Mono', 'Consolas', monospace; font-size: 14px; line-height: 1.55; white-space: pre-wrap; max-height: 320px; overflow: auto; }

/* Auth state (already logged in) */
.auth-state { margin-top: 8px; text-align: center; }
.auth-state-avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; margin: 0 auto 10px; }
.auth-state-label { font-size: 14px; color: var(--color-text-muted); margin-bottom: 2px; }
.auth-state-name { font-weight: 600; font-size: 16px; }
.auth-state-role { font-size: 14px; color: var(--color-text-muted); margin-bottom: 16px; }
.auth-state-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.auth-state__logout-all { text-align: center; margin-top: 12px; }

/* Account list (login page) */
.account-list { text-align: left; }
.account-list__title { font-size: 14px; font-weight: 600; color: var(--color-text-muted); margin-bottom: 12px; text-align: center; }
.account-item-form { margin-bottom: 4px; }
.account-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-card);
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    transition: all 0.15s;
    margin-bottom: 4px;
}
.account-item:hover { background: var(--color-bg); border-color: var(--color-primary); }
.account-item--add { border: 1px dashed var(--color-border); background: transparent; margin-top: 0; }
.account-item--add:hover { border-color: var(--color-primary); }
.account-item__avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 17px; flex-shrink: 0;
}
.account-item__avatar--add { background: transparent; color: var(--color-text-muted); border: 2px dashed var(--color-text-muted); }
.account-item__info { display: flex; flex-direction: column; flex: 1; min-width: 0; overflow: hidden; }
.account-item__name { font-weight: 500; font-size: 14px; }
.account-item__email { font-size: 14px; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-item__role { font-size: 14px; color: var(--color-text-muted); white-space: nowrap; padding-left: 8px; }
.login-back-btn {
    display: inline-flex; align-items: center; gap: 4px;
    background: none; border: none; cursor: pointer;
    color: var(--color-primary); font-size: 14px; padding: 0; margin-bottom: 16px;
}
.login-back-btn:hover { color: var(--color-primary-hover); }
.login-form-wrapper { text-align: left; }

/* Form checkbox */
.form-check { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; }
.form-check input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--color-primary); }
.form-check label { color: var(--color-text-muted); font-size: 14px; cursor: pointer; }

/* User avatars */
.user-avatar-xs {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}
.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

/* Account switcher (topbar) */
.topbar__user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 4px 8px 4px 4px;
    cursor: pointer;
    font-size: 14px;
    color: var(--color-text);
    transition: all 0.15s;
}
.topbar__user-btn:hover { background: #f1f5f9; }

/* Account menu dropdown */
.account-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    display: none;
    margin-top: 8px;
}
.account-menu--open { display: block; }
.account-menu__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}
.account-menu__name { font-weight: 600; font-size: 14px; }
.account-menu__email { font-size: 14px; color: var(--color-text-muted); }
.account-menu__divider { height: 1px; background: var(--color-border); margin: 0; }
.account-menu__section { padding: 8px 0; }
.account-menu__section-title { font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); padding: 4px 16px; font-weight: 600; }
.account-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    font-size: 14px;
    color: var(--color-text);
    text-decoration: none;
    transition: background 0.1s;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
}
.account-menu__item:hover { background: #f1f5f9; text-decoration: none; }
.account-menu__item--add { color: var(--color-primary); }
.account-menu__item--danger { color: var(--color-danger); }
.account-menu__footer { padding: 8px 0; }

/* User cell */
.user-cell { display: flex; align-items: center; gap: 8px; }

/* Card danger */
.card--danger { border-color: var(--color-danger); }
.card--danger .card__header h3 { color: var(--color-danger); }

/* Inline form */
.inline-form { display: inline; }

/* Table actions */
.table-actions { display: flex; gap: 4px; flex-wrap: wrap; }

/* Table empty */
.table-empty { text-align: center; color: var(--color-text-muted); padding: 24px; font-size: 14px; }
.table-scroll { overflow-x: auto; }

/* Margin helper */
.mt-1 { margin-top: 12px; }

/* Auth state (already logged in on login page) */
.auth-state { margin-top: 16px; padding: 16px; background: #f8fafc; border: 1px solid var(--color-border); border-radius: 12px; text-align: center; }
.auth-state-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; margin: 0 auto 10px; }
.auth-state-label { font-size: 14px; color: var(--color-text-muted); margin-bottom: 2px; }
.auth-state-name { font-weight: 600; font-size: 15px; }
.auth-state-email { font-size: 14px; color: var(--color-text-muted); margin-bottom: 12px; }
.auth-state-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.auth-state-logout-all { text-align: center; margin-top: 12px; }

.btn--outline { background: transparent; }
.btn--danger-text { color: var(--color-danger); border-color: var(--color-danger); }
.btn--danger-text:hover { background: #fef2f2; }

.btn--link-danger { border: none; background: none; cursor: pointer; color: var(--color-danger); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; padding: 0; }
.btn--link-danger:hover { color: #dc2626; }

.btn--secondary { background: #f1f5f9; border-color: var(--color-border); color: var(--color-text); }
.btn--secondary:hover { background: #e2e8f0; }

.hidden { display: none !important; }

.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger) !important; }

/* Switch toggle */
.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
}
.switch-row:last-child { border-bottom: none; }
.switch-text { flex: 1; }
.switch-text strong { display: block; font-size: 14px; margin-bottom: 2px; }
.switch-text span { display: block; font-size: 14px; color: var(--color-text-muted); }
.switch {
    width: 48px;
    height: 26px;
    background: #cbd5e0;
    border-radius: 13px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.switch.on { background: var(--color-primary); }
.switch::after {
    content: '';
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.switch.on::after { transform: translateX(22px); }

/* Page header tabs */
.page-header__tabs { display: flex; gap: 4px; margin: 12px 0; }
.tab-link {
    padding: 6px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: all 0.15s;
}
.tab-link:hover { background: #f1f5f9; text-decoration: none; }
.tab-link--active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.tab-link--active:hover { background: var(--color-primary-hover); }

/* Exchange tabs */
.exchange-tabs { display: flex; gap: 4px; margin-bottom: 0; background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 4px; }
.exchange-tab {
    display: flex; align-items: center; gap: 6px; padding: 10px 20px;
    border: none; background: transparent; cursor: pointer; font-size: 14px; font-weight: 500;
    color: var(--color-text-muted); border-radius: var(--radius-sm); transition: all 0.15s;
}
.exchange-tab:hover { background: var(--color-bg); color: var(--color-text); }
.exchange-tab--active { background: var(--color-primary); color: #fff; }
.exchange-tab--active:hover { background: var(--color-primary-hover); }
.exchange-content { margin-top: 16px; }
.exchange-pane { display: none; }
.exchange-pane--active { display: block; }

/* Import upload zone */
.upload-zone {
    border: 2px dashed var(--color-border); border-radius: var(--radius);
    padding: 32px; text-align: center; cursor: pointer; transition: all 0.15s;
    background: var(--color-bg);
}
.upload-zone:hover { border-color: var(--color-primary); background: var(--color-card); }

/* Sync platform card */
.sync-platform-card {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border: 1px solid var(--color-border);
    border-radius: var(--radius); background: var(--color-card);
}
.sync-platform-info { display: flex; flex-direction: column; gap: 2px; }
.sync-platform-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* Import stats */
.import-stats .info-row { padding: 8px 0; }

/* Checkbox inline */
.checkbox-group { display: flex; gap: 20px; flex-wrap: wrap; }
.checkbox-inline { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.checkbox-inline input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--color-primary); }

/* Code block */
.code-block {
    background: var(--color-sidebar); color: #e2e8f0; padding: 16px;
    border-radius: var(--radius-sm); font-family: 'SF Mono', 'Consolas', monospace;
}

/* Social cards */
.social-card {
    background: var(--color-card); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 10px;
    border-top: 3px solid var(--color-border);
}
.social-card.status-green { border-top-color: var(--color-success); }
.social-card.status-blue { border-top-color: var(--color-blue); }
.social-card.status-red { border-top-color: var(--color-danger); }
.social-card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.social-card__name { font-size: 16px; font-weight: 600; }
.social-card__name a { color: var(--color-text); }
.social-card__tags { display: flex; gap: 4px; flex-wrap: wrap; }
.social-card__desc { font-size: 14px; color: var(--color-text-muted); }
.social-card__result { font-size: 14px; }
.social-card__meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: 14px; color: var(--color-text-muted); }
.social-card__meta span {
    background: var(--color-bg); border-radius: 4px; padding: 2px 8px;
}
.social-card__status {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 14px; border-top: 1px solid var(--color-border); padding-top: 10px;
}
.status-label { color: var(--color-text-muted); }
.status-date { font-weight: 600; }
.status-date.status-green { color: var(--color-success); }
.status-date.status-blue { color: var(--color-blue); }
.status-date.status-red { color: var(--color-danger); }
.social-card__actions { display: flex; gap: 8px; align-items: center; margin-top: auto; }

/* Notifications bell + dropdown */
.topbar__notif { position: relative; }
.topbar__notif-btn {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    background: none; border: 1px solid var(--color-border);
    border-radius: var(--radius); cursor: pointer;
    color: var(--color-text); transition: all 0.15s;
}
.topbar__notif-btn:hover { background: #f1f5f9; }
.notif-badge {
    position: absolute; top: -6px; right: -6px;
    min-width: 18px; height: 18px; padding: 0 4px;
    background: var(--color-danger); color: #fff;
    border-radius: 9px; font-size: 14px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
}
.notif-menu {
    position: absolute; top: 100%; right: 0;
    width: 340px; max-height: 480px;
    background: var(--color-card); border: 1px solid var(--color-border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    z-index: 200; display: none; margin-top: 8px;
    overflow: hidden; flex-direction: column;
}
.notif-menu--open { display: flex; }
.notif-menu__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--color-border);
}
.notif-menu__title { font-weight: 600; font-size: 14px; }
.notif-menu__read-all { border: none; background: none; cursor: pointer; color: var(--color-primary); font-size: 14px; padding: 0; }
.notif-menu__list { overflow-y: auto; }
.notif-menu__group-title { padding: 8px 16px 4px; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--color-text-muted); border-bottom: 1px solid var(--color-border); background: rgba(0,0,0,.02); }
.notif-menu__item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; border-bottom: 1px solid var(--color-border);
    text-decoration: none; color: var(--color-text); transition: background 0.1s;
}
.notif-menu__item:hover { background: #f1f5f9; text-decoration: none; }
.notif-menu__item--read { opacity: 0.65; }
.notif-menu__dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.notif-menu__text { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.notif-menu__body { font-size: 14px; color: var(--color-text-muted); }
.notif-menu__time { font-size: 14px; color: var(--color-text-muted); }
.notif-menu__empty { padding: 24px 16px; text-align: center; color: var(--color-text-muted); font-size: 14px; }
.notif-menu__footer {
    display: block; text-align: center; padding: 12px 16px;
    border-top: 1px solid var(--color-border);
    font-size: 14px; color: var(--color-primary); text-decoration: none;
}
.notif-menu__footer:hover { background: #f1f5f9; text-decoration: none; }

/* Sidebar badge */
.sidebar__badge {
    margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
    background: var(--color-danger); color: #fff;
    border-radius: 10px; font-size: 14px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}

/* Notifications page */
.notif-row {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 16px; border-bottom: 1px solid var(--color-border);
    border-left: 3px solid transparent;
}
.notif-row:last-child { border-bottom: none; }
.notif-row--unread { background: rgba(59, 130, 246, 0.04); }
.notif-row--read { opacity: 0.7; }
.notif-row__icon {
    width: 28px; height: 28px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.notif-row__content { flex: 1; min-width: 0; }
.notif-row__title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notif-row__body { font-size: 14px; color: var(--color-text-muted); margin-top: 2px; }
.notif-row__meta { display: flex; gap: 8px; align-items: center; margin-top: 6px; font-size: 14px; color: var(--color-text-muted); }
.notif-row__link { color: var(--color-primary); }
.notif-row__actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.notif-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--color-primary); display: inline-block;
}
.notif-type-badge {
    font-size: 14px; padding: 2px 8px; border-radius: 4px;
    background: var(--color-bg); color: var(--color-text-muted); font-weight: 600;
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard__grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; gap: 0; }
    .page-header { flex-direction: column; gap: 12px; }
    .directions-grid { grid-template-columns: 1fr; }
    .social-card { padding: 16px; }
}

/* Задание 9: Светофор ситуаций */
.signal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    white-space: nowrap;
    cursor: help;
}
.signal__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.signal--red { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.35); color: #dc2626; }
.signal--yellow { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.35); color: #d97706; }
.signal--green { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.35); color: #16a34a; }
.signal--gray { background: var(--color-bg); border-color: var(--color-border); color: var(--color-text-muted); }
[data-theme="dark"] .signal--red { color: #f87171; }
[data-theme="dark"] .signal--yellow { color: #fbbf24; }
[data-theme="dark"] .signal--green { color: #4ade80; }
.signal-reason { font-size: 14px; color: var(--color-text); }

/* Задание 9: Компании */
.companies-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.company-card { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.company-card__header { padding: 16px 20px; border-bottom: 1px solid var(--color-border); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.company-card__body { padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.company-card__footer { padding: 12px 20px; border-top: 1px solid var(--color-border); display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }

/* Задание 9: Сырые данные / вложения */
.attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.attachment { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.attachment__icon { font-size: 18px; line-height: 1.2; }
.attachment__title { font-size: 14px; font-weight: 600; color: var(--color-text-muted); }
.attachment__content { font-size: 14px; white-space: pre-wrap; }

/* ===== Kebab menu (вертикальное меню ⋮) — Задание 24 ===== */
.kb { position: relative; display: inline-block; }
.kb__btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--color-border); background: var(--color-card); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--color-text-muted); transition: all .15s; flex-shrink: 0; }
.kb__btn:hover { background: var(--color-bg); color: var(--color-text); border-color: var(--color-primary); }
.kb__menu { position: absolute; right: 0; top: 40px; min-width: 200px; max-width: 260px; background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 100; display: none; padding: 4px; text-align: left; }
.kb__menu.show { display: block; }
.kb__menu--left { right: auto; left: 0; }
.kb__item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: none; background: none; border-radius: 4px; font-size: 14px; font-weight: 500; color: var(--color-text); cursor: pointer; transition: background .1s; text-decoration: none; box-sizing: border-box; }
.kb__item:hover { background: var(--color-bg); text-decoration: none; }
.kb__item--danger { color: var(--color-danger); }
.kb__item--danger:hover { background: var(--color-red-soft); }
.kb__item--success { color: #15803d; }
.kb__divider { height: 1px; background: var(--color-border); margin: 4px 0; }
.kb__label { display: block; padding: 6px 12px 2px; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-muted); }
.kb__btn svg { pointer-events: none; }
[data-theme="dark"] .kb__item:hover { background: rgba(148,163,184,0.12); }

/* ===== SVG icons (глобально) ===== */
.ico{width:16px;height:16px;stroke:currentColor;stroke-width:2;fill:none;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.ico--sm{width:14px;height:14px}
.ico--xs{width:12px;height:12px}
.ico-circle{width:34px;height:34px;border-radius:9px;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.ico-circle--sm{width:28px;height:28px;border-radius:7px}

/* ===== Hero лида (страница лида + контекст в рекомендации) ===== */
.lh{background:var(--color-card);border:1px solid var(--color-border);border-radius:var(--radius);padding:28px 32px;margin-bottom:20px;box-shadow:var(--shadow)}
.lh__top{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap}
.lh__id{display:flex;align-items:center;gap:16px}
.lh__avatar{width:56px;height:56px;border-radius:14px;display:flex;align-items:center;justify-content:center;font-size:22px;font-weight:700;color:#fff;flex-shrink:0}
.lh__name{font-size:22px;font-weight:700;color:var(--color-text);line-height:1.2}
.lh__sub{display:flex;align-items:center;gap:8px;margin-top:4px;flex-wrap:wrap}
.lh__sub a.badge,.lh__sub a.tag{transition:filter .15s,opacity .15s;filter:brightness(1)}
.lh__sub a.badge:hover,.lh__sub a.tag:hover{filter:brightness(0.94);opacity:.9}
.lh__acts{display:flex;gap:8px;flex-wrap:wrap}
.ig{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:10px;margin-top:20px;padding-top:20px;border-top:1px solid var(--color-border)}
.ig__item{display:flex;align-items:flex-start;gap:10px;padding:10px 12px;border-radius:var(--radius-sm);background:var(--color-bg);transition:background .15s}
.ig__item:hover{background:var(--color-border)}
.ig__label{font-size:14px;color:var(--color-text-muted);line-height:1.3}
.ig__value{font-size:14px;font-weight:500;color:var(--color-text);line-height:1.3;word-break:break-word}
.ig__value a{color:var(--color-primary)}

/* ===== Кликабельная строка реестра «Счета к оплате» — Задание 25 ===== */
.reminder-row { cursor: pointer; }
.reminder-row__link { color: inherit; text-decoration: none; }
.reminder-row__link:hover { color: var(--color-primary); }
.reminder-row:hover td { background: rgba(59, 130, 246, 0.05); }

/* ===== Markdown в переписке/сообщениях — Задание 53 ===== */
.md-h1, .md-h2, .md-h3 { margin: 10px 0 6px; font-weight: 700; line-height: 1.3; color: var(--color-text); }
.md-h1 { font-size: 17px; }
.md-h2 { font-size: 16px; }
.md-h3 { font-size: 15px; }
.md-p { margin: 6px 0; }
.md-ul, .md-ol { margin: 6px 0; padding-left: 20px; display: block; }
.md-ul li, .md-ol li { margin: 3px 0; }
.md-inline-code, .md-code code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; background: rgba(148,163,184,0.18); border-radius: 4px; padding: 1px 5px; color: var(--color-text); }
.md-code { background: rgba(148,163,184,0.12); border-radius: 6px; padding: 10px; margin: 8px 0; overflow-x: auto; }
.md-code code { background: none; padding: 0; white-space: pre; }
.md-quote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--color-primary); color: var(--color-text-muted); }
.md-hr { border: none; border-top: 1px solid var(--color-border); margin: 10px 0; }

/* ===== Markdown внутри пузырей сообщений лида ===== */
.chat-msg__bubble p { margin: 6px 0; }
.chat-msg__bubble p:first-child { margin-top: 0; }
.chat-msg__bubble p:last-child { margin-bottom: 0; }
.chat-msg__bubble .md-ul, .chat-msg__bubble .md-ol { margin: 6px 0; }

/* ===== Timeline продаж — Задание 53 ===== */
.tl-day { margin-bottom: 20px; }
.tl-day__header { font-weight: 700; font-size: 14px; color: var(--color-text-muted); margin-bottom: 8px; padding-left: 24px; display: flex; align-items: center; gap: 6px; }
.tl-day__items { position: relative; padding-left: 20px; }
.tl-day__items::before { content: ''; position: absolute; left: 5px; top: 0; bottom: 0; width: 2px; background: var(--color-border); }
.tl-step { position: relative; padding: 0 0 16px 20px; }
.tl-step:last-child { padding-bottom: 0; }
.tl-step__dot { position: absolute; left: -20px; top: 6px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--color-card); z-index: 1; }
.tl-step--out .tl-step__dot { box-shadow: 0 0 0 2px rgba(34,197,94,0.25); }
.tl-step--in .tl-step__dot { box-shadow: 0 0 0 2px rgba(59,130,246,0.25); }
.tl-step__body { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 10px 14px; }
.tl-step--out .tl-step__body { border-left: 3px solid rgba(34,197,94,0.6); }
.tl-step--in .tl-step__body { border-left: 3px solid rgba(59,130,246,0.6); }
.tl-step__meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.tl-step__subject { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.tl-step__content { font-size: 14px; line-height: 1.5; }
.tl-step__content p { margin: 4px 0; }
.tl-step__followup { font-size: 14px; color: var(--color-warning); margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.chip--sm { font-size: 14px; padding: 1px 6px; }

/* ===== Системы коммуникаций и уведомлений — Задание 56 ===== */
.systems-stat { display: flex; flex-direction: column; align-items: center; min-width: 84px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--color-bg); border: 1px solid var(--color-border); }
.systems-stat__value { font-size: 18px; font-weight: 700; color: var(--color-text); line-height: 1.2; }
.systems-stat__label { font-size: 14px; color: var(--color-text-muted); margin-top: 2px; }
.systems-hist { border-top: 1px solid var(--color-border); padding-top: 10px; }
.systems-hist__title { font-size: 14px; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 6px; }
.systems-hist__row { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--color-border); }
.systems-hist__row:last-child { border-bottom: none; }
.systems-hist__dir { flex-shrink: 0; font-size: 14px; font-weight: 600; padding: 1px 7px; border-radius: 999px; margin-top: 1px; }
.systems-hist__body { flex: 1; min-width: 0; }
.systems-hist__who { font-size: 14px; font-weight: 600; color: var(--color-text); text-decoration: none; }
.systems-hist__who:hover { text-decoration: underline; }
.systems-hist__what { font-size: 14px; color: var(--color-text-muted); line-height: 1.4; }
.systems-hist__text { display: block; }
.systems-hist__at { flex-shrink: 0; font-size: 14px; color: var(--color-text-muted); padding-top: 2px; }
.ico--lg { width: 24px; height: 24px; }

/* ===== Мягкие AJAX-переходы («Сделано») — Задание 58 ===== */
.soft-item {
    transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1), margin 0.45s ease;
    overflow: hidden;
}
.soft-item--leaving {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    max-height: 0 !important;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-width: 0 !important;
}
.soft-item--flash {
    animation: softFlash 0.6s ease-out;
}
@keyframes softFlash {
    0% { box-shadow: inset 0 0 0 2px rgba(34, 197, 94, 0.7), 0 0 0 4px rgba(34, 197, 94, 0.25); background: rgba(34, 197, 94, 0.12); }
    100% { box-shadow: inset 0 0 0 2px rgba(34, 197, 94, 0), 0 0 0 4px rgba(34, 197, 94, 0); background: transparent; }
}
.btn--busy {
    pointer-events: none;
    opacity: 0.55;
    transform: scale(0.97);
}
.soft-btn {
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.soft-btn:active {
    transform: scale(0.93);
    box-shadow: none;
}
