/* CRM-админка: стиль перекликается с лендингом, но рассчитан на плотность данных. */
:root {
    --bg: #f5f5f7;
    --bg-card: #fff;
    --bg-soft: #fafafa;
    --bg-dark: #1d1d1f;

    --text: #1d1d1f;
    --text-soft: #515154;
    --text-mute: #86868b;
    --text-inv: #f5f5f7;

    --line: #e3e3e6;
    --line-soft: #ececef;

    --accent: #0066ff;
    --accent-soft: #e3f0ff;
    --danger: #d92d20;
    --warning: #b54708;
    --ok: #1e6e1e;

    --radius: 14px;
    --radius-sm: 10px;
    --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.005em;
}

a { color: inherit; text-decoration: none; transition: opacity .15s var(--ease), color .15s var(--ease); }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }

/* ===== App layout ===== */
.app {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.side {
    background: #fff;
    border-right: 1px solid var(--line);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.side__logo {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    padding: 4px 12px 24px;
}

.side__logo span {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--bg-dark);
    color: var(--text-inv);
    margin-left: 4px;
    vertical-align: 2px;
}

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

.side__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 500;
    color: var(--text-soft);
    transition: background .15s var(--ease), color .15s var(--ease);
}

.side__ico { font-size: 16px; width: 20px; text-align: center; }

.side__link:hover { background: var(--bg); color: var(--text); }
.side__link.is-active { background: var(--bg-dark); color: var(--text-inv); }

.side__foot {
    border-top: 1px solid var(--line);
    padding-top: 16px;
    margin-top: 16px;
}

.side__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
}

.side__avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6aa7ff, #c8a7ff);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 14px;
}

.side__name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.side__role { font-size: 11px; color: var(--text-mute); }

.side__logout {
    width: 100%;
    margin-top: 12px;
    padding: 8px;
    font-size: 13px;
    color: var(--text-mute);
    border-radius: 8px;
    transition: background .15s, color .15s;
}
.side__logout:hover { background: var(--bg); color: var(--danger); }

/* ===== Main ===== */
.main {
    padding: 32px 40px;
    min-width: 0;
}

.page__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page__head h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.page__count {
    font-size: 17px;
    font-weight: 500;
    color: var(--text-mute);
    margin-left: 8px;
    vertical-align: 3px;
}

.page__sub {
    color: var(--text-mute);
    margin-top: 6px;
    font-size: 14px;
}

.page__actions { display: flex; gap: 8px; }

.back {
    color: var(--accent);
    font-size: 13px;
    margin-bottom: 6px;
    display: inline-block;
}
.back:hover { opacity: 0.7; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: background .15s, transform .15s, opacity .15s;
    white-space: nowrap;
    border: 1px solid transparent;
}

.btn--primary {
    background: var(--bg-dark);
    color: var(--text-inv);
}
.btn--primary:hover { background: #2a2a2e; }

.btn--ghost {
    background: var(--bg-card);
    border-color: var(--line);
    color: var(--text);
}
.btn--ghost:hover { background: var(--bg-soft); }

.btn--text { background: transparent; color: var(--text-soft); padding: 9px 8px; }
.btn--text:hover { color: var(--text); }

.btn--danger {
    background: #fff;
    color: var(--danger);
    border-color: rgba(217, 45, 32, 0.3);
}
.btn--danger:hover { background: rgba(217, 45, 32, 0.06); }

.btn--block { width: 100%; }

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

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

.card__head h2 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card__meta {
    padding: 16px 24px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--text-mute);
    line-height: 1.6;
}

/* ===== Filters ===== */
.filters {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.chip {
    padding: 5px 12px;
    border-radius: 980px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-soft);
    transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { background: var(--bg-soft); }
.chip.is-active {
    background: var(--bg-dark);
    color: var(--text-inv);
    border-color: var(--bg-dark);
}

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

.filters__search {
    flex: 1;
    min-width: 240px;
}

.filters__search,
.filters__select,
.field input,
.field textarea,
.field select,
.auth__field input {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 12px;
    font: inherit;
    font-size: 13px;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}

.filters__search:focus,
.filters__select:focus,
.field input:focus,
.field textarea:focus,
.field select:focus,
.auth__field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.12);
}

/* ===== Table ===== */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th, .table td {
    padding: 14px 18px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--line-soft);
}

.table th {
    background: var(--bg-soft);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-mute);
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; transition: background .15s; }
.table tbody tr:hover td { background: var(--bg-soft); }
.table tbody tr[onclick]:hover { background: #fbfbfd; }

.num { color: var(--text-mute); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-mute); }
.empty {
    padding: 48px;
    text-align: center;
    color: var(--text-mute);
}

.lead__name { font-weight: 600; }
.lead__company { color: var(--text-soft); font-size: 12px; font-weight: 500; margin-top: 1px; }
.lead__contact { color: var(--text-mute); font-size: 12px; }
.lead__site { font-size: 11px; margin-top: 2px; }
.lead__site a {
    color: var(--accent);
    text-decoration: none;
}
.lead__site a:hover { text-decoration: underline; }
.lead__tags { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }

.tag {
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--bg);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-soft);
}

.next {
    margin-top: 4px;
    font-size: 12px;
}
.next__date {
    display: inline-block;
    margin-left: 8px;
    color: var(--accent);
    font-weight: 500;
}

/* ===== Badges (статусы и пр.) ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 980px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.badge--blue   { background: #e3f0ff; color: #0066cc; }
.badge--indigo { background: #e6e6ff; color: #4042b8; }
.badge--purple { background: #efdcff; color: #6e2db8; }
.badge--pink   { background: #ffdce8; color: #b81f6e; }
.badge--orange { background: #ffe3cf; color: #b8581f; }
.badge--amber  { background: #fff0c2; color: #8a5a00; }
.badge--green  { background: #d6f5d6; color: #1e6e1e; }
.badge--red    { background: #ffe0e0; color: #b00020; }
.badge--gray   { background: #ececef; color: #515154; }

/* ===== Pipeline (карточка заявки) ===== */
.pipe {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.pipe__row {
    display: flex;
    gap: 4px;
    flex: 1;
    flex-wrap: wrap;
}

.pipe__step {
    flex: 1;
    min-width: 110px;
    display: contents;
}

.pipe__btn {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-mute);
    background: var(--bg);
    transition: background .15s, color .15s, transform .15s;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.pipe__step { display: flex; flex: 1; min-width: 110px; }

.pipe__dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.4;
}

.pipe__step--done .pipe__btn {
    background: #d6f5d6;
    color: #1e6e1e;
}
.pipe__step--done .pipe__dot { opacity: 1; }

.pipe__step--current .pipe__btn {
    background: var(--bg-dark);
    color: var(--text-inv);
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.3);
}

.pipe__btn:hover { transform: translateY(-1px); }

.pipe__lost button {
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 600;
    transition: background .15s;
}
.pipe__lost button:hover { background: #ffe0e0; color: #b00020; border-color: #ffc0c0; }
.pipe__lost--active button { background: #ffe0e0; color: #b00020; border-color: #ffc0c0; }

/* ===== Lead detail layout ===== */
.detail {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
    align-items: flex-start;
}

@media (max-width: 1000px) {
    .detail { grid-template-columns: 1fr; }
}

/* ===== Timeline ===== */
.note-form {
    padding: 16px 24px;
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.note-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    font-size: 13px;
    resize: vertical;
    min-height: 60px;
}

.note-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.12);
}

.note-form button {
    align-self: flex-end;
}

.timeline {
    padding: 16px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline__empty {
    padding: 32px;
    text-align: center;
    color: var(--text-mute);
}

.event {
    padding: 12px 14px;
    border-left: 2px solid var(--line);
    background: var(--bg-soft);
    border-radius: 6px;
}
.event--note   { border-left-color: var(--accent); background: var(--accent-soft); }
.event--status { border-left-color: #b54708; background: #fff7ed; }
.event--meta   { border-left-color: var(--text-mute); }

.event__head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 11px;
}

.event__who { font-weight: 600; }
.event__when { color: var(--text-mute); }

.event__body { font-size: 13px; line-height: 1.5; white-space: pre-wrap; }

/* ===== Sidebar form (карточка заявки, правая колонка) ===== */
.sidebar-form { padding: 0 0 16px; margin-bottom: 12px; }

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 24px;
    margin-top: 14px;
}

.field span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-mute);
}

.field em { color: var(--danger); font-style: normal; }

.field__row {
    padding: 16px 24px 8px;
    border-top: 1px solid var(--line);
    margin-top: 20px;
}

.danger-form { margin-top: 8px; }
.danger-form button { width: 100%; }

/* ===== New / form pages ===== */
.form-page { padding: 24px; }

.form__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form__grid .field { padding: 0; margin-top: 0; }
.field--wide { grid-column: 1 / -1; }

.form__actions {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

@media (max-width: 700px) { .form__grid { grid-template-columns: 1fr; } }

.inline-form { display: inline-block; }
.actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ===== KPI dashboard ===== */
.kpi {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 1100px) { .kpi { grid-template-columns: repeat(2, 1fr); } }

.kpi__card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
}

.kpi__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-mute);
    margin-bottom: 8px;
}

.kpi__value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}

.kpi__value span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-mute);
    margin-left: 4px;
}

.kpi__sub {
    font-size: 12px;
    color: var(--text-mute);
    margin-top: 8px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: flex-start;
}

@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.funnel {
    padding: 16px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.funnel__row {
    display: grid;
    grid-template-columns: 140px 1fr 100px;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.funnel__bar {
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    color: #fff;
    font-weight: 600;
    font-size: 12px;
    transition: width .35s var(--ease);
}

.funnel__bar--blue   { background: #0066cc; }
.funnel__bar--indigo { background: #4042b8; }
.funnel__bar--purple { background: #6e2db8; }
.funnel__bar--pink   { background: #b81f6e; }
.funnel__bar--orange { background: #b8581f; }
.funnel__bar--amber  { background: #b58a00; }
.funnel__bar--green  { background: #1e8a1e; }
.funnel__bar--red    { background: #b00020; }
.funnel__bar--gray   { background: #515154; }

.funnel__amount { text-align: right; color: var(--text-mute); font-size: 12px; }

/* ===== Login ===== */
.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f5f7 0%, #e8e8ec 100%);
}

.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth__card {
    background: var(--bg-card);
    border-radius: 22px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow:
        0 30px 80px -20px rgba(0, 0, 0, 0.15),
        0 1px 2px rgba(0, 0, 0, 0.05);
}

.auth__logo {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-mute);
    margin-bottom: 8px;
}

.auth__title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.auth__sub {
    color: var(--text-mute);
    margin-bottom: 24px;
    font-size: 13px;
}

.auth__error {
    background: #ffe0e0;
    color: #b00020;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}

.auth__form { display: flex; flex-direction: column; gap: 12px; }

.auth__field { display: flex; flex-direction: column; gap: 6px; }
.auth__field span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-soft);
}

.auth__back {
    display: block;
    margin-top: 20px;
    text-align: center;
    color: var(--text-mute);
    font-size: 12px;
}

.auth__back:hover { color: var(--text); }

/* ===== Сегменты (сохранённые фильтры) ===== */
.filters__after {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.filters__after .segs { margin-bottom: 0; }

.seg-save { margin-left: auto; }

.segs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
}

.segs__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-mute);
    margin-right: 4px;
}

.seg {
    display: inline-flex;
    align-items: stretch;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 980px;
    overflow: hidden;
    transition: border-color .15s, background .15s;
}
.seg:hover { background: var(--bg-soft); border-color: #cdd3dd; }

.seg__name {
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-soft);
    border-right: 1px solid var(--line);
}
.seg:hover .seg__name { color: var(--text); }

.seg__del { display: inline-flex; }
.seg__del button {
    padding: 0 10px;
    font-size: 14px;
    line-height: 1;
    color: var(--text-mute);
    transition: color .15s, background .15s;
}
.seg__del button:hover { color: var(--danger); background: rgba(217, 45, 32, 0.06); }

/* ===== История контакта (правая колонка карточки) ===== */
.history-card { padding: 0; }
.history {
    display: flex;
    flex-direction: column;
}
.history__row {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13px;
    transition: background .15s;
}
.history__row:hover { background: var(--bg-soft); }
.history__row:last-child { border-bottom: 0; }
.history__num { color: var(--text-mute); font-variant-numeric: tabular-nums; }
.history__date { color: var(--text-mute); font-size: 12px; }
.history__amount { color: var(--text-soft); font-weight: 500; font-size: 12px; text-align: right; }

.claim-form { margin-bottom: 12px; }

/* ===== Канбан ===== */
.page--wide { max-width: none; }

.kanban {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 12px;
    /* Карточки могут уезжать за экран — даём горизонтальный скролл. */
}

.kcol {
    flex: 0 0 280px;
    min-width: 280px;
    background: var(--bg);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 240px);
}

.kcol__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px 8px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 8px;
}

.kcol__head h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
}

/* Левая цветная полоска вместо «акцента» для каждого этапа. */
.kcol--blue   .kcol__head { border-bottom-color: #0066cc; }
.kcol--indigo .kcol__head { border-bottom-color: #4042b8; }
.kcol--purple .kcol__head { border-bottom-color: #6e2db8; }
.kcol--pink   .kcol__head { border-bottom-color: #b81f6e; }
.kcol--orange .kcol__head { border-bottom-color: #b8581f; }
.kcol--amber  .kcol__head { border-bottom-color: #b58a00; }
.kcol--green  .kcol__head { border-bottom-color: #1e8a1e; }
.kcol--red    .kcol__head { border-bottom-color: #b00020; }

.kcol__meta {
    font-size: 11px;
    color: var(--text-mute);
    font-weight: 500;
}

.kcol__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding: 4px;
    border-radius: 8px;
    transition: background .15s, outline .15s;
}

.kcol__body.is-over {
    background: var(--accent-soft);
    outline: 2px dashed var(--accent);
    outline-offset: -4px;
}

.kcol__empty {
    text-align: center;
    color: var(--text-mute);
    padding: 24px;
    font-size: 12px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: transparent;
}

.kcard {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    cursor: grab;
    display: block;
    color: var(--text);
    transition: transform .12s var(--ease), box-shadow .12s var(--ease), border-color .12s;
    position: relative;
}

.kcard:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.15);
    border-color: #cdd3dd;
}

.kcard.is-dragging {
    opacity: 0.4;
    cursor: grabbing;
}

.kcard__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 11px;
}

.kcard__num { color: var(--text-mute); font-variant-numeric: tabular-nums; }
.kcard__amount { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

.kcard__name {
    font-weight: 600;
    font-size: 13px;
    line-height: 1.3;
    color: var(--text);
}

.kcard__contact {
    font-size: 12px;
    color: var(--text-mute);
    margin-top: 2px;
}

.kcard__tags {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.kcard__next {
    margin-top: 6px;
    padding: 4px 8px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.3;
}

.kcard__next-date {
    margin-left: 4px;
    color: var(--accent-strong, #003fb8);
    font-weight: 600;
}

.kcard__owner {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--line-soft);
    font-size: 11px;
    color: var(--text-mute);
}

.kcard--muted { opacity: 0.6; }
.kcard--muted .kcard__name { text-decoration: line-through; }

.kcard__flash {
    position: absolute;
    bottom: -32px;
    left: 0;
    right: 0;
    background: #b00020;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    text-align: center;
    box-shadow: 0 8px 20px -6px rgba(176, 0, 32, 0.4);
    z-index: 5;
}

/* ===== Календарь ===== */
.cal__section {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.cal__section-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--line);
    background: var(--bg-soft);
}

.cal__section-head h2 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.cal__section--red    .cal__section-head { background: #fff0f0; color: #b00020; border-bottom-color: #ffd0d0; }
.cal__section--blue   .cal__section-head { background: #eaf3ff; color: #0066cc; border-bottom-color: #cfe0ff; }
.cal__section--indigo .cal__section-head { background: #ededff; color: #4042b8; border-bottom-color: #d8d8f0; }
.cal__section--purple .cal__section-head { background: #f5eaff; color: #6e2db8; border-bottom-color: #e3d0f0; }
.cal__section--gray   .cal__section-head { background: var(--bg-soft); color: var(--text-soft); }

.cal__section-count {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 980px;
    background: rgba(0, 0, 0, 0.06);
}
.cal__section--red    .cal__section-count { background: rgba(176, 0, 32, 0.12); }
.cal__section--blue   .cal__section-count { background: rgba(0, 102, 204, 0.12); }
.cal__section--indigo .cal__section-count { background: rgba(64, 66, 184, 0.12); }
.cal__section--purple .cal__section-count { background: rgba(110, 45, 184, 0.12); }

.cal__group {
    border-bottom: 1px solid var(--line-soft);
}
.cal__group:last-child { border-bottom: 0; }

.cal__date {
    padding: 10px 24px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-mute);
    background: var(--bg-soft);
    border-bottom: 1px solid var(--line-soft);
}

.cal__items { display: flex; flex-direction: column; }

.cal__row {
    display: grid;
    grid-template-columns: 1.5fr 1.6fr auto;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--line-soft);
    transition: background .15s;
}
.cal__row:last-child { border-bottom: 0; }
.cal__row:hover { background: var(--bg-soft); }

.cal__action {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    line-height: 1.3;
}

.cal__lead {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cal__name {
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal__contact {
    font-size: 12px;
    color: var(--text-mute);
}

.cal__meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cal__owner {
    font-size: 12px;
    color: var(--text-mute);
}

@media (max-width: 720px) {
    .cal__row { grid-template-columns: 1fr; gap: 6px; }
    .cal__meta { justify-content: flex-start; }
}

/* ===== Рассылки ===== */
.warning {
    background: #fff3d6;
    color: #8a5a00;
    border: 1px solid #ffd884;
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.5;
}
.warning code {
    background: rgba(0, 0, 0, 0.08);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.hint {
    font-size: 12px;
    color: var(--text-mute);
    margin-top: -8px;
    margin-bottom: 8px;
    padding: 0 24px;
}
.hint code {
    background: var(--bg);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--text);
}

.preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    margin-top: 12px;
    background: var(--bg-soft);
    border-radius: 10px;
    font-size: 13px;
}
.preview b { font-size: 16px; font-weight: 700; color: var(--text); }

.preview-out {
    margin-top: 16px;
    padding: 16px 20px;
    background: var(--bg-soft);
    border-radius: 10px;
    font-size: 13px;
}
.preview-out h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-mute);
    margin-bottom: 10px;
}
.preview-out__head { margin-bottom: 4px; }
.preview-out__head span { color: var(--text-mute); margin-right: 4px; }
.preview-out__body {
    white-space: pre-wrap;
    margin-top: 10px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    line-height: 1.5;
    color: var(--text);
}

.m-prog {
    height: 6px;
    background: var(--bg-soft);
    border-radius: 980px;
    overflow: hidden;
    min-width: 100px;
}
.m-prog__bar {
    height: 100%;
    background: linear-gradient(90deg, #0066ff, #34c759);
    transition: width 0.35s var(--ease);
}

.event--email { border-left-color: #0066cc; background: #eaf3ff; }
.event--unsub { border-left-color: var(--text-mute); background: var(--bg-soft); opacity: 0.75; }

/* ===== Шаблоны: редактор с превью ===== */
.tpl-editor {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: flex-start;
}
@media (max-width: 1100px) { .tpl-editor { grid-template-columns: 1fr; } }

.tpl-preview-wrap { padding: 0; position: sticky; top: 24px; }
.tpl-preview {
    width: 100%;
    min-height: 640px;
    border: 0;
    background: #f5f5f7;
}

textarea.mono {
    font-family: 'SF Mono', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-size: 12.5px;
    line-height: 1.5;
    tab-size: 2;
}

.send-tpl { margin-bottom: 12px; }
.send-tpl .field { padding: 0; margin: 0; }

/* ===== Mobile ===== */
@media (max-width: 760px) {
    .app { grid-template-columns: 1fr; }
    .side {
        position: static;
        height: auto;
        flex-direction: row;
        align-items: center;
        padding: 12px 16px;
        gap: 12px;
        overflow-x: auto;
    }
    .side__logo { padding: 0; flex-shrink: 0; }
    .side__nav { flex-direction: row; flex: 1; overflow-x: auto; }
    .side__foot { display: none; }
    .main { padding: 16px; }
    .table th, .table td { padding: 10px; }
}

/* ===== Страница инструкции для менеджеров ===== */
.page--help { max-width: 880px; }

.help-toc ol {
    list-style: none;
    padding: 16px 24px 20px;
    margin: 0;
    columns: 2;
    column-gap: 32px;
}
.help-toc li {
    padding: 6px 0;
    break-inside: avoid;
    counter-increment: toc;
    font-size: 14px;
}
.help-toc li::before {
    content: counter(toc, decimal-leading-zero) ".";
    color: var(--text-mute);
    font-variant-numeric: tabular-nums;
    margin-right: 10px;
    font-size: 12px;
    font-weight: 600;
}
.help-toc { counter-reset: toc; }
.help-toc a {
    color: var(--text);
    border-bottom: 1px dashed transparent;
    transition: border-color 0.15s var(--ease), color 0.15s;
}
.help-toc a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
@media (max-width: 720px) { .help-toc ol { columns: 1; } }

.help-section { scroll-margin-top: 24px; }
.help-section .card__head h2 {
    display: flex;
    align-items: baseline;
    gap: 14px;
    font-size: 18px;
}
.help-num {
    display: inline-block;
    min-width: 28px;
    font-size: 13px;
    color: var(--text-mute);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.help-body {
    padding: 18px 28px 24px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
}
.help-body p { margin: 0 0 14px; }
.help-body p:last-child { margin-bottom: 0; }
.help-body h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 22px 0 10px;
    color: var(--text);
    letter-spacing: -0.01em;
}
.help-body h3:first-child { margin-top: 0; }
.help-body b { font-weight: 600; }
.help-body a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
}
.help-body a:hover { border-bottom-style: solid; }

.help-list {
    margin: 0 0 14px;
    padding-left: 0;
    list-style: none;
}
.help-list li {
    padding: 4px 0 4px 22px;
    position: relative;
}
.help-list li::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 14px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-mute);
}
ol.help-list { counter-reset: li; }
ol.help-list li::before {
    content: counter(li) '.';
    counter-increment: li;
    background: none;
    width: auto;
    height: auto;
    top: 5px;
    left: 0;
    color: var(--text-mute);
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    font-weight: 600;
}
ol.help-list li { padding-left: 26px; }

.help-list--bad li::before { background: var(--danger); }

.help-key {
    display: inline-block;
    padding: 1px 8px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
    font-size: 12.5px;
    color: var(--text);
    vertical-align: 1px;
}

.help-note {
    padding: 14px 18px;
    background: rgba(0, 102, 255, 0.06);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    margin: 14px 0;
}
.help-note--warn {
    background: rgba(181, 71, 8, 0.07);
    border-left-color: #b54708;
}

.help-pipeline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: 10px;
    font-size: 13px;
    margin: 0 0 16px;
}

.help-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px 32px;
}
@media (max-width: 720px) { .help-grid { grid-template-columns: 1fr; } }

.help-faq {
    margin: 0;
}
.help-faq dt {
    font-weight: 600;
    color: var(--text);
    margin: 18px 0 6px;
    font-size: 14.5px;
}
.help-faq dt:first-of-type { margin-top: 0; }
.help-faq dd {
    margin: 0 0 8px;
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.55;
}

.help-section--warn { border-color: rgba(181, 71, 8, 0.3); }
.help-section--warn .card__head { background: rgba(181, 71, 8, 0.05); }

.help-footer {
    margin-top: 8px;
    padding: 18px 24px;
    text-align: center;
    color: var(--text-mute);
    font-size: 13px;
    line-height: 1.6;
}
.help-footer a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* Массовое назначение в списке заявок (только админ) */
.bulk-bar {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-soft);
}
.bulk-bar__count b { color: var(--text); font-weight: 600; }
.bulk-bar__sep { color: var(--text-mute); }
.bulk-bar__quick { display: flex; gap: 6px; align-items: center; }
.bulk-bar__num {
    width: 78px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 10px;
    font: inherit;
    font-size: 13px;
    color: var(--text);
}
.bulk-bar__spacer { flex: 1 1 auto; min-width: 0; }
.btn--small { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.table th.check, .table td.check {
    width: 28px;
    padding-left: 14px;
    padding-right: 0;
    text-align: center;
    cursor: default;
}
.table input.bulk-cb, .table #bulkAll { cursor: pointer; width: 16px; height: 16px; }

/* Быстрая кнопка «Перезвонить» в строке заявки */
.table th.recall-cell, .table td.recall-cell {
    text-align: right;
    white-space: nowrap;
    cursor: default;
    padding-right: 16px;
}
.btn-recall {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 15px;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #fff;
    background: linear-gradient(180deg, #1a78ff 0%, var(--accent) 100%);
    border: none;
    border-radius: 9px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 64, 160, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    transition: filter .15s, box-shadow .15s, transform .04s;
}
.btn-recall__icon {
    font-size: 14px;
    line-height: 1;
}
.btn-recall:hover {
    filter: brightness(1.08);
    box-shadow: 0 3px 10px rgba(0, 64, 160, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-recall:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 64, 160, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-recall:disabled {
    opacity: .5;
    cursor: default;
    box-shadow: none;
    filter: none;
}
