:root {
    --bg: #0b0c0f;
    --panel: #121418;
    --panel-2: #181b21;
    --panel-3: #1f232b;
    --line: #2a2f3b;
    --line-2: #3a4150;
    --text: #e9ebf1;
    --text-2: #a3a9b8;
    --text-3: #6d7383;
    --accent: #7f8cff;
    --accent-2: #aab3ff;
    --accent-ink: #0c0f24;
    --accent-soft: rgba(127, 140, 255, 0.16);
    --green: #35d07f;
    --green-soft: rgba(53, 208, 127, 0.14);
    --red: #f25c5c;
    --red-soft: rgba(242, 92, 92, 0.14);
    --blue: #5b9cff;
    --blue-soft: rgba(91, 156, 255, 0.14);
    --violet: #a78bfa;
    --violet-soft: rgba(167, 139, 250, 0.14);
    --font: 'Onest', 'Segoe UI', system-ui, sans-serif;
    --mono: 'JetBrains Mono', 'Consolas', monospace;
    --radius: 8px;
    --radius-l: 12px;
    --sidebar: 228px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.03) inset;
    --t: 160ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
    margin: 0;
    background:
        radial-gradient(1100px 520px at 8% -8%, rgba(127, 140, 255, 0.14), transparent 62%),
        radial-gradient(800px 480px at 104% 104%, rgba(53, 208, 127, 0.05), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font: 14px/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-2); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
small { color: var(--text-3); }
b { font-weight: 600; }
::selection { background: var(--accent-soft); }

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.ok { color: var(--green); }
.bad { color: var(--red); }
.warn { color: var(--accent); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }

/* ---------- сетка приложения ---------- */

.app { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 6;
    width: var(--sidebar);
    transition: width 220ms var(--t);
    display: flex;
    flex-direction: column;
    padding: 18px 12px;
    background: var(--panel);
    border-right: 1px solid var(--line);
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 18px;
    font-weight: 600;
    font-size: 15px;
}

.sidebar__mark {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(160deg, #aab3ff, #5f6ee6);
    color: var(--accent-ink);
    box-shadow: 0 6px 18px rgba(127, 140, 255, 0.35);
}

.sidebar__mark svg { width: 18px; height: 18px; }
.sidebar__name { font-size: 15px; }
.sidebar__name small { display: block; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); line-height: 1; margin-top: 2px; }

.sidebar__toggle {
    position: absolute;
    top: 22px;
    right: -13px;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--line-2);
    border-radius: 50%;
    background: var(--panel-2);
    color: var(--text-3);
    cursor: pointer;
    transition: color var(--t), background var(--t), transform var(--t);
}
.sidebar__toggle:hover { color: var(--text); background: var(--panel-3); }
.sidebar__toggle .icon { width: 14px; height: 14px; }

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.sidebar__section {
    padding: 14px 10px 6px;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    color: var(--text-2);
    transition: background var(--t), color var(--t);
}

.sidebar__link:hover { background: var(--panel-2); color: var(--text); }
.sidebar__link--active { background: var(--panel-3); color: var(--text); }
.sidebar__link--active .icon { color: var(--accent); }

.sidebar__count {
    margin-left: auto;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font: 600 11px/1.5 var(--mono);
}

.sidebar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 8px 4px;
    border-top: 1px solid var(--line);
}

.sidebar__avatar {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--panel-3);
    font-weight: 600;
}

.sidebar__who { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar__who small { font-size: 11px; }
.sidebar__logout { margin-left: auto; }

.main { margin-left: var(--sidebar); min-height: 100vh; position: relative; transition: margin-left 220ms var(--t); }

.nav-closed { --sidebar: 64px; }
.nav-closed .sidebar { padding-left: 8px; padding-right: 8px; }
.nav-closed .sidebar__name, .nav-closed .sidebar__link span, .nav-closed .sidebar__section, .nav-closed .sidebar__who { display: none; }
.nav-closed .sidebar__link { justify-content: center; padding: 10px; }
.nav-closed .sidebar__count { position: absolute; margin: -22px 0 0 18px; }
.nav-closed .sidebar__user { justify-content: center; }
.nav-closed .sidebar__logout { margin: 0; }
.nav-closed .sidebar__brand { justify-content: center; padding-bottom: 14px; }
.nav-closed .sidebar__toggle { transform: rotate(180deg); }
.main::before { content: ''; position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(180deg, rgba(0,0,0,0.9), transparent 70%); }
.topbar, .content { position: relative; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 58px;
    padding: 0 28px;
    background: rgba(11, 12, 15, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.topbar__title { font-size: 17px; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }

.content { padding: 24px 28px 60px; }
.app--wide .content { padding: 18px 20px 40px; }

/* ---------- иконки, кнопки, поля ---------- */

.icon { flex: none; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    background: var(--panel-2);
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--t), border-color var(--t), transform var(--t), color var(--t);
}

.btn:hover { background: var(--panel-3); border-color: var(--text-3); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn--primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-ink); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--panel-2); }
.btn--danger { color: var(--red); }
.btn--danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn--ok { color: var(--green); }
.btn--ok:hover { background: var(--green-soft); border-color: var(--green); }
.btn--sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn--xs { height: 24px; padding: 0 8px; font-size: 12px; }
.btn--wide { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: default; }

.iconbtn {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    transition: background var(--t), color var(--t);
}

.iconbtn:hover { background: var(--panel-3); color: var(--text); }

.field { display: flex; flex-direction: column; gap: 5px; }
.field__label { font-size: 12px; color: var(--text-2); }
.field__hint { font-size: 12px; color: var(--text-3); }

.field__input,
.field__select,
.field__textarea {
    width: 100%;
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color var(--t), box-shadow var(--t);
}

.field__input:focus,
.field__select:focus,
.field__textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field__textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.field__select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.field--inline { flex-direction: row; align-items: center; gap: 8px; }
.field--inline .field__input, .field--inline .field__select { width: auto; }
.field__input--sm, .field__select--sm { min-height: 30px; padding: 4px 8px; font-size: 13px; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form__actions { display: flex; gap: 8px; align-items: center; padding-top: 4px; }
.form__actions .btn--danger { margin-left: auto; }

.inline-form { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- панели ---------- */

.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--main { grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); }
.grid--side { grid-template-columns: minmax(0, 1fr) 340px; }

.card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 40%), var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
}
.card__emoji { font-size: 16px; margin-right: 6px; }

.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.card__title { font-size: 14px; font-weight: 600; }
.card__title small { margin-left: 8px; font-weight: 400; }
.card__body { padding: 16px 18px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 12px 18px; border-top: 1px solid var(--line); }
.card--danger { border-color: rgba(242, 92, 92, 0.4); }
.card--accent { border-color: rgba(127, 140, 255, 0.5); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat__emoji { float: right; font-size: 22px; opacity: 0.9; }

.stats--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat {
    padding: 14px 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    transition: border-color var(--t);
}

.stat:hover { border-color: var(--line-2); }
.stat__label { font-size: 12px; color: var(--text-2); }
.stat__value { margin-top: 4px; font: 500 28px/1.15 var(--mono); letter-spacing: -0.02em; }
.stat__value small { font-size: 13px; color: var(--text-3); font-family: var(--mono); }
.stat__sub { margin-top: 4px; font-size: 12px; color: var(--text-3); }
.stat--bad { border-color: rgba(242, 92, 92, 0.5); background: linear-gradient(0deg, var(--red-soft), transparent 60%); }
.stat--bad .stat__value { color: var(--red); }
.stat--ok .stat__value { color: var(--green); }
.stat--accent .stat__value { color: var(--accent); }

.list { list-style: none; margin: 0; padding: 0; }

.list__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 18px;
    border-bottom: 1px solid var(--line);
    transition: background var(--t);
}

.list__item:last-child { border-bottom: 0; }
.list__item:hover { background: var(--panel-2); }
.list__item--focus { background: var(--accent-soft); }
.list__main { flex: 1; min-width: 0; }
.list__title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-weight: 500; }
.list__title a:hover { color: var(--accent); }
.list__sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__sub--wrap { white-space: normal; }
.footnote { font-size: 12px; }
.list__aside { display: flex; align-items: center; gap: 8px; flex: none; }

.empty { padding: 26px 18px; color: var(--text-3); text-align: center; font-size: 13px; }
.empty__emoji { display: block; font-size: 22px; margin-bottom: 4px; }

.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); border-bottom: 1px solid var(--line); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--t); }
.table tbody tr:hover { background: var(--panel-2); }
.table--wrap { overflow-x: auto; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 22px;
    padding: 0 8px;
    border-radius: 6px;
    background: var(--panel-3);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.badge--accent { background: var(--accent-soft); color: var(--accent); }
.badge--ok { background: var(--green-soft); color: var(--green); }
.badge--bad { background: var(--red-soft); color: var(--red); }
.badge--blue { background: var(--blue-soft); color: var(--blue); }
.badge--violet { background: var(--violet-soft); color: var(--violet); }
.badge--outline { background: transparent; border: 1px solid var(--line-2); }
.badge--dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.badge--lead, .badge--qualifying { background: var(--panel-3); color: var(--text-2); }
.badge--offer { background: var(--blue-soft); color: var(--blue); }
.badge--waiting_client { background: var(--violet-soft); color: var(--violet); }
.badge--ready { background: var(--green-soft); color: var(--green); }
.badge--in_progress { background: var(--accent-soft); color: var(--accent); }
.badge--done_waiting { background: rgba(127, 140, 255, 0.26); color: #c5cbff; }
.badge--delivered { background: var(--blue-soft); color: #9cc3ff; }
.badge--closed { background: var(--green-soft); color: var(--green); }
.badge--lost { background: var(--red-soft); color: var(--red); }

.badge--hot, .badge--handed { background: var(--red-soft); color: #ff8a8a; }
.badge--dialog { background: var(--blue-soft); color: var(--blue); }
.badge--replied, .badge--new { background: var(--panel-3); color: var(--text-2); }
.badge--won { background: var(--green-soft); color: var(--green); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 11px;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    color: var(--text-2);
    font-size: 13px;
    transition: background var(--t), color var(--t), border-color var(--t);
}

.chip:hover { color: var(--text); border-color: var(--text-3); }
.chip--active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip--active:hover { color: var(--bg); }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar__spacer { flex: 1; }
.toolbar .field__input { width: 240px; }

/* ---------- канбан ---------- */

.kanban { display: flex; align-items: stretch; gap: 10px; min-height: calc(100vh - 120px); overflow-x: auto; padding-bottom: 8px; }

.kcol { flex: 1 1 0; min-width: 214px; display: flex; flex-direction: column; gap: 8px; padding: 8px; background: rgba(255, 255, 255, 0.022); border: 1px solid var(--line); border-radius: var(--radius-l); }
.kcol--empty { flex: 0 0 150px; min-width: 150px; background: transparent; border-style: dashed; }
.kcol--empty .kcol__head { font-size: 11px; }
.kcol--empty .empty { padding: 18px 8px; }
.kcol__head { display: flex; flex-direction: column; gap: 2px; padding: 4px 6px 8px; border-bottom: 1px solid var(--line-2); font-size: 12px; font-weight: 600; color: var(--text); }
.kcol__count { font-family: var(--mono); color: var(--text-3); }
.kcol__sum { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--text-3); min-height: 14px; }

.kcard {
    display: block;
    padding: 12px 12px 10px;
    background: var(--panel);
    border: 1px solid var(--line-2);
    border-radius: 10px;
    animation: kcard-in 320ms var(--t) both;
    transition: border-color var(--t), background var(--t);
}

.kcard:nth-child(2) { animation-delay: 40ms; }
.kcard:nth-child(3) { animation-delay: 80ms; }
.kcard:nth-child(4) { animation-delay: 120ms; }
.kcard:nth-child(5) { animation-delay: 160ms; }
.kcard:nth-child(6) { animation-delay: 200ms; }
.kcard:nth-child(n+7) { animation-delay: 240ms; }

@keyframes kcard-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.kcard:hover { border-color: var(--accent); background: var(--panel-2); color: inherit; }
.kcard--alert { border-color: rgba(127, 140, 255, 0.7); }
.kcard--ready { border-color: rgba(53, 208, 127, 0.55); }
.kcard--late { border-color: rgba(242, 92, 92, 0.55); }
.kcard__client { font-size: 12px; color: var(--text-3); }
.kcard__title { margin-top: 2px; font-weight: 500; line-height: 1.35; font-size: 13.5px; }
.kcard__meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--text-3); }
.kcard__price { font-family: var(--mono); color: var(--text-2); }
.kcard__row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.kcard__blocker { margin-top: 6px; font-size: 12px; color: var(--violet); }

/* ---------- сделка ---------- */

.deal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.deal-head__client { font-size: 13px; color: var(--text-2); }
.deal-head__title { margin-top: 2px; font-size: 22px; }
.deal-head__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }

.stageline { display: flex; gap: 4px; margin-bottom: 20px; overflow-x: auto; }

.stageline__step {
    flex: 1;
    min-width: 96px;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: var(--panel);
    color: var(--text-3);
    font-size: 12px;
    text-align: left;
    cursor: pointer;
    transition: background var(--t), color var(--t);
}

.stageline__step:hover { background: var(--panel-2); color: var(--text); }
.stageline__step--done { color: var(--text-2); background: var(--panel-2); }
.stageline__step--current { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.stageline__step--lost { color: var(--red); }

.timer { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.timer__cell { padding: 10px 12px; background: var(--panel-2); border-radius: var(--radius); }
.timer__label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.timer__value { margin-top: 3px; font-family: var(--mono); font-size: 15px; }

.timeline { list-style: none; margin: 0; padding: 0; }

.timeline__item { position: relative; display: grid; grid-template-columns: 90px 1fr; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.timeline__item:last-child { border-bottom: 0; }
.timeline__time { font-family: var(--mono); font-size: 12px; color: var(--text-3); padding-top: 2px; }
.timeline__type { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.timeline__text { white-space: pre-wrap; margin-top: 2px; }
.timeline__item--draft { background: var(--accent-soft); }
.timeline__item--approved .timeline__type { color: var(--green); }
.timeline__item--rejected .timeline__type { color: var(--red); }
.timeline__actions { display: flex; gap: 6px; margin-top: 8px; }

.event-form { display: grid; grid-template-columns: 1fr; gap: 8px; }
.event-form__row { display: flex; gap: 8px; align-items: center; }

/* ---------- дашборд ---------- */

.agenda { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.calendar { display: flex; align-items: flex-end; gap: 6px; height: 64px; padding: 0 2px; }
.calendar__day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.calendar__bar { width: 100%; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--panel-3); transition: background var(--t); }
.calendar__bar--ok { background: var(--green); }
.calendar__bar--some { background: var(--accent); }
.calendar__bar--today { outline: 1px solid var(--text-3); outline-offset: 1px; }
.calendar__label { font-size: 10px; color: var(--text-3); font-family: var(--mono); }

/* ---------- клиент ---------- */

.profile { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.profile__cell { padding: 10px 12px; background: var(--panel-2); border-radius: var(--radius); }
.profile__label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.profile__value { margin-top: 2px; }
.prose { white-space: pre-wrap; line-height: 1.55; }

/* ---------- лиды ---------- */

.funnel { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; }
.funnel__day { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; background: var(--panel-2); border-radius: var(--radius); }
.funnel__n { font: 500 16px/1.1 var(--mono); }
.funnel__n--low { color: var(--red); }
.funnel__n--ok { color: var(--green); }
.funnel__sub { font-size: 10px; color: var(--text-3); font-family: var(--mono); }
.funnel__label { font-size: 10px; color: var(--text-3); }

.lead { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, auto); gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); transition: background var(--t); }
.lead:last-child { border-bottom: 0; }
.lead:hover { background: var(--panel-2); }
.lead--focus { background: var(--accent-soft); }
.lead__title { display: flex; align-items: center; gap: 8px; font-weight: 500; flex-wrap: wrap; }
.lead__meta { margin-top: 3px; font-size: 12px; color: var(--text-3); display: flex; flex-wrap: wrap; gap: 10px; }
.lead__notes { margin-top: 6px; font-size: 13px; color: var(--text-2); white-space: pre-wrap; }
.lead__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-content: flex-start; gap: 6px; max-width: 420px; }
.lead__actions .inline-form { justify-content: flex-end; }

/* ---------- заказы ---------- */

.order { padding: 12px 18px; border-bottom: 1px solid var(--line); }
.order:last-child { border-bottom: 0; }
.order__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.order__title { font-weight: 500; }
.order__price { font-family: var(--mono); color: var(--accent); margin-left: auto; }
.order__text { margin-top: 4px; font-size: 13px; color: var(--text-2); line-height: 1.45; max-height: 4.4em; overflow: hidden; }
.order--open .order__text { max-height: none; }
.order__foot { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.order__foot .btn { margin-left: auto; }

/* ---------- правила ---------- */

.rules { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; }
.rules__nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 78px; align-self: start; }
.rules__link { padding: 8px 10px; border-radius: var(--radius); color: var(--text-2); transition: background var(--t), color var(--t); }
.rules__link:hover { background: var(--panel-2); color: var(--text); }
.rules__link--active { background: var(--panel-3); color: var(--text); }

.md { line-height: 1.6; max-width: 820px; }
.md h2 { margin: 22px 0 8px; font-size: 16px; }
.md h3 { margin: 16px 0 6px; font-size: 14px; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 20px; }
.md li { margin: 3px 0; }
.md table { width: 100%; margin: 8px 0 14px; border-collapse: collapse; font-size: 13px; }
.md th, .md td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.md th { color: var(--text-3); font-weight: 500; font-size: 12px; }
.md code { padding: 1px 5px; background: var(--panel-3); border-radius: 4px; font-family: var(--mono); font-size: 12px; }
.md strong { color: var(--text); }
.md blockquote { margin: 0 0 12px; padding: 8px 14px; border-left: 2px solid var(--accent); color: var(--text-2); }

/* ---------- входящие ---------- */

.inbox-item { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.inbox-item:last-child { border-bottom: 0; }
.inbox-item__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }
.inbox-item__text { margin-top: 6px; white-space: pre-wrap; }
.inbox-item__result { margin-top: 8px; font-size: 12px; color: var(--text-2); }
.inbox-item__result li { margin: 2px 0; }
.inbox-item__actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.inbox-item__actions textarea { min-height: 60px; }

/* ---------- логин ---------- */

.app--login { display: grid; place-items: center; }
.login__mark { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(160deg, #aab3ff, #5f6ee6); box-shadow: 0 10px 30px rgba(127, 140, 255, 0.35); }
.login__mark svg { width: 24px; height: 24px; color: var(--accent-ink); }

.login {
    width: 340px;
    padding: 28px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login__brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.login__title { font-size: 20px; }
.login__error { padding: 8px 10px; border-radius: var(--radius); background: var(--red-soft); color: var(--red); font-size: 13px; }

/* ---------- тост, модалка ---------- */

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 50;
    padding: 10px 14px;
    background: var(--panel-3);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: toast-in 240ms var(--t);
    transition: opacity 240ms, transform 240ms;
}

.toast--error { border-color: var(--red); color: var(--red); }
.toast--hide { opacity: 0; transform: translateY(8px); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.modal { border: 1px solid var(--line-2); border-radius: 14px; background: var(--panel); color: var(--text); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal__body { padding: 18px; }

.details > summary { cursor: pointer; list-style: none; color: var(--text-2); font-size: 13px; }
.details > summary::-webkit-details-marker { display: none; }
.details > summary:hover { color: var(--text); }
.details[open] > summary { margin-bottom: 10px; }

.pill-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.progress { height: 4px; background: var(--panel-3); border-radius: 2px; overflow: hidden; }
.progress__bar { height: 100%; background: var(--accent); transition: width 300ms var(--t); }

.divider { height: 1px; background: var(--line); margin: 14px 0; }

/* ---------- адаптив ---------- */

@media (max-width: 1601px) {
    .stats, .stats--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1281px) {
    .grid--main { grid-template-columns: 1fr; }
    .grid--side { grid-template-columns: 1fr; }
    .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kcol { min-width: 200px; }
    .content { padding: 20px 20px 60px; }
    .topbar { padding: 0 20px; }
}

@media (max-width: 991px) {
    :root { --sidebar: 64px; }
    .sidebar { padding: 14px 8px; }
    .sidebar__name, .sidebar__link span, .sidebar__section, .sidebar__who, .sidebar__toggle { display: none; }
    .sidebar__link { justify-content: center; padding: 10px; }
    .sidebar__count { position: absolute; margin: -22px 0 0 18px; }
    .sidebar__user { justify-content: center; }
    .sidebar__logout { margin: 0; }
    .sidebar__brand { justify-content: center; padding-bottom: 14px; }
    .kanban { min-height: 0; }
    .kcol { flex: 0 0 230px; }
    .stats, .stats--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid--2, .grid--3 { grid-template-columns: 1fr; }
    .rules { grid-template-columns: 1fr; }
    .rules__nav { position: static; flex-direction: row; flex-wrap: wrap; }
    .timer { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .profile { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .funnel { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
    .topbar { height: auto; padding: 12px 16px; flex-wrap: wrap; }
    .content { padding: 16px 16px 60px; }
    .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat__value { font-size: 20px; }
    .deal-head { flex-direction: column; }
    .timeline__item { grid-template-columns: 1fr; gap: 2px; }
    .lead { grid-template-columns: 1fr; }
    .lead__actions { align-items: flex-start; }
    .toolbar .field__input { width: 100%; }
    .profile { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
    .stats { grid-template-columns: 1fr; }
    .timer { grid-template-columns: 1fr; }
    .funnel { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
