/* ==========================================================================
   Тема v2 — загальні стилі
   Стилі конкретної сторінки: css/style_v2/pages/<page>.css
   ========================================================================== */

:root {
    --ink: #1C2333;
    --muted: #6B7487;
    --faint: #9AA1AE;
    --line: #E5E9F0;
    --bg: #F4F6FA;
    --surface: #FFFFFF;
    --soft: #F9FAFC;
    --row-hover: #EEF3FF;
    --primary: #E5484D;
    --primary-h: #CF3A3F;
    --dark: #232B3D;
    --shadow: 0 1px 3px rgba(20, 30, 60, .08), 0 4px 14px rgba(20, 30, 60, .05);
    --side: #2C3E5A;
    --side-ink: #CFD8E8;
    --accent: #3B82F6;
    --accent-bg: #EAF1FD;
    --ok: #1F8A5B;
    --ok-bg: #E6F5EE;
    --warn: #B7791F;
    --warn-bg: #FDF3E1;
    --danger: #C8372D;
    --danger-bg: #FCECEA;
    --violet: #6D4BD8;
    --violet-bg: #EFEBFC;
    --r: 12px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ink: #E6E9F2;
        --muted: #8C96AD;
        --faint: #6B7690;
        --line: #26304A;
        --bg: #0F1420;
        --surface: #171E2E;
        --soft: #1A2236;
        --row-hover: #212C47;
        --dark: #2E3852;
        --shadow: 0 1px 3px rgba(0, 0, 0, .4);
        --accent-bg: #1E2D4D;
        --ok-bg: #14532D;
        --warn-bg: #78350F;
        --danger-bg: #7F1D1D;
        --violet-bg: #4C1D95;
        --ok: #BBF7D0;
        --warn: #FDE68A;
        --danger: #FECACA;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.hidden-el {
    display: none;
}

.app {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    min-height: 100vh;
}

/* ===== Сайдбар ===== */
.side {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: var(--side);
    color: var(--side-ink);
    padding: 0 12px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 6px;
    color: #fff;
    font-weight: 600;
    font-size: 22px;
}

.brand-mark {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
}

.brand-name-accent {
    color: #60A5FA;
}

.side-label {
    font-size: 12px;
    color: #8FA0BD;
    padding: 14px 6px 6px;
}

.nav {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
    font-weight: 500;
}

.nav a:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.nav a.active {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.nav .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4E5C68;
    flex: none;
}

.nav a.active .dot {
    background: #4FC3A1;
}

.nav .badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    background: #2DD4BF;
    color: #fff;
    border-radius: 999px;
    padding: 1px 7px;
}

.nav .caret {
    flex: none;
    transition: transform .2s;
}

.nav .nav-toggle .badge {
    margin-left: auto;
}

.nav .nav-toggle[aria-expanded="true"] .caret {
    transform: rotate(180deg);
}

.nav-sub {
    display: none;
    flex-direction: column;
    padding-left: 16px;
}

.nav-group.open .nav-sub {
    display: flex;
}

.side-bottom {
    margin-top: auto;
}

/* ===== Верхняя панель ===== */
.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 60px;
    padding: 0 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
}

.top-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    display: grid;
    place-items: center;
}

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

.user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.ava {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #D7DCE4;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    color: #4A5260;
    flex: none;
    overflow: hidden;
}

.ava img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Уведомления (Vue-компонент <message>) */
.top-message .container {
    padding: 0;
    margin: 0;
    width: auto;
    max-width: none;
    position: relative;
}

.top-message .main-message {
    position: relative;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
}

.top-message .main-message:hover {
    background: var(--soft);
    color: var(--ink);
}

.top-message .main-message .material-icons {
    font-size: 22px;
}

.top-message .label {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

.top-message .dropdown-menu {
    right: 0;
    left: auto;
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: 0 8px 24px rgba(30, 36, 48, .12);
}

.top-message .dropdown-menu {
    width: 320px;
    max-height: 320px;
    overflow-y: auto;
    padding: 0;
}

.top-message .notif-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.top-message .notif-row p {
    margin: 0;
    font-size: 13px;
    color: var(--ink);
}

.top-message .notif-row a {
    font-size: 13px;
    color: var(--ink);
    text-decoration: underline;
}

.top-message .notif-empty {
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

[x-cloak] {
    display: none !important;
}

/* ===== Страница ===== */
.page {
    width: 100%;
    min-width: 0;
    max-width: 1320px;
    margin: 0 auto;
    padding: 24px 16px 48px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.page-head {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.page-sub {
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

.page-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.app .v2-card {
    background: var(--surface);
    border-radius: var(--r);
    box-shadow: var(--shadow);
    margin: 0;
}

.card-h {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
}

.card-h h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.card-h .count {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    background: var(--soft);
    border-radius: 999px;
    padding: 2px 8px;
}

/* ===== Кнопки ===== */
.app .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    line-height: 1;
    border: 1px solid transparent;
    box-shadow: none;
    text-decoration: none;
    white-space: nowrap;
}

.app .btn:focus, .app .btn.focus, .app .btn:active:focus, .app .btn:active.focus,
.app .btn.active:focus, .app .btn.active.focus {
    outline: none;
    outline-offset: 0;
}

.app .btn-sm {
    height: 30px;
    padding: 0 10px;
    font-size: 13px;
}


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

.app .btn-primary:hover, .app .btn-primary:focus {
    background: var(--primary-h);
    border-color: var(--primary-h);
    color: #fff;
}

.app .btn-dark {
    background: var(--accent-bg);
    border-color: var(--accent-bg);
    color: var(--accent);
}

.app .btn-dark:hover, .app .btn-dark:focus {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
}

.app .btn-ghost, .app .btn-secondary {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
}

.app .btn-ghost:hover, .app .btn-secondary:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--surface);
}

.app .btn-info {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.app .btn-danger {
    background: var(--surface);
    border-color: var(--primary);
    color: var(--primary);
}

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

.app .btn-blue {
    background: var(--surface);
    border-color: var(--accent);
    color: var(--accent);
}

.app .btn-blue:hover, .app .btn-blue:focus {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
}

.app .btn-violet {
    background: var(--surface);
    border-color: #5b21b6;
    color: #5b21b6;
}

.app .btn-violet:hover, .app .btn-violet:focus {
    background: #ede9fe;
    border-color: #5b21b6;
    color: #5b21b6;
}

/* ===== Поля формы ===== */
.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.field label {
    margin: 0;
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
}

/* select2 ховає оригінальний select класом .select2-hidden-accessible — його не чіпаємо */
.app .input, .app .field select:not(.select2-hidden-accessible), .app .field .input-group {
    height: 40px;
    width: 100%;
}

.app .input, .app .field select:not(.select2-hidden-accessible) {
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    font-variant-numeric: tabular-nums;
}

.input::placeholder {
    color: var(--faint);
}

.app .input:hover, .app .field select:not(.select2-hidden-accessible):hover {
    border-color: #CDD2DB;
}

.app .input:focus, .app .field select:not(.select2-hidden-accessible):focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.with-icon {
    position: relative;
}

.with-icon .input {
    padding-right: 40px;
}

.with-icon svg {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--faint);
    pointer-events: none;
}

/* select2 (theme bootstrap) под размеры темы */
.app .select2-container--bootstrap .select2-selection {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: none;
    background: var(--surface);
}

.app .select2-container--bootstrap .select2-selection--single {
    height: 40px;
    padding: 9px 12px;
}

/* multiple: поле пошуку по центру по вертикалі (мін. висота 40px − рамка 2px = 38px) */
.app .select2-container--bootstrap .select2-selection--multiple {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.app .select2-container--bootstrap .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    flex: 0 1 auto;
    width: auto;
    max-width: 100%;
    padding: 0;
}

/* Вибрані значення (select2 4.1: li > button.remove + span.display) */
.app .select2-container--bootstrap .select2-selection--multiple .select2-selection__choice {
    display: inline-flex;
    flex-direction: row-reverse;
    align-items: center;
    float: none;
    position: relative;
    gap: 4px;
    margin: 3px 0 3px 6px;
    padding: 0 8px;
    height: 28px;
    max-width: 100%;
    border: 0;
    border-radius: 6px;
    background: var(--accent-bg);
    color: var(--accent);
    font-size: 13px;
    line-height: 28px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app .select2-container--bootstrap .select2-selection--multiple .select2-selection__choice__display {
    padding: 0;
    cursor: default;
}

.app .select2-container--bootstrap .select2-selection--multiple .select2-selection__choice__remove {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    opacity: .7;
}

.app .select2-container--bootstrap .select2-selection--multiple .select2-selection__choice__remove:hover,
.app .select2-container--bootstrap .select2-selection--multiple .select2-selection__choice__remove:focus {
    background: transparent;
    color: var(--danger);
    opacity: 1;
    outline: none;
}

.app .select2-container--bootstrap .select2-selection--multiple .select2-search--inline {
    flex: 1 1 5em;
    float: none;
    margin: 0;
    padding: 0;
    min-width: 5em;
}

.app .select2-container--bootstrap .select2-selection--multiple .select2-search--inline .select2-search__field {
    display: block;
    width: 100% !important;
    max-width: 100%;
    text-indent: 0;
    height: 38px;
    margin: 0;
    padding: 10px 12px;
    font: inherit;
    line-height: 18px;
    text-align: left;
    vertical-align: middle;
}

/* select2 4.1: у плейсхолдера свій line-height: normal — через це текст піднімався вгору */
.app .select2-container--bootstrap .select2-selection--multiple .select2-search--inline .select2-search__field::placeholder {
    line-height: 18px;
}

.app .select2-container--bootstrap.select2-container--focus .select2-selection,
.app .select2-container--bootstrap.select2-container--open .select2-selection {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

/* тільки контейнер select2: оригінальний <select class="select2"> лишається прихованим (1px) */
.select2.select2-container {
    width: 100% !important;
}

/* ===== Чекбоксы (md-check из строк таблицы) ===== */
.md-check {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 18px;
    padding: 0;
    margin: 0;
    cursor: pointer;
    vertical-align: middle;
}

.md-check input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    z-index: 1;
    cursor: pointer;
}

.md-check i {
    position: absolute;
    inset: 0;
    border: 2px solid #CDD2DB;
    border-radius: 5px;
    background: var(--surface);
    transition: .12s;
}

.md-check:hover i {
    border-color: var(--accent);
}

.md-check input:checked + i {
    background: var(--accent);
    border-color: var(--accent);
}

.md-check input:checked + i::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 0;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ===== Пилюли статусов ===== */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.pill-new {
    background: var(--accent-bg);
    color: var(--accent);
}

.pill-call {
    background: var(--warn-bg);
    color: var(--warn);
}

.pill-ok {
    background: var(--ok-bg);
    color: var(--ok);
}

.pill-no {
    background: var(--danger-bg);
    color: var(--danger);
}

.pill-plain {
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--muted);
}

/* Цвета статусов (salestatus.color) */
.b-new {
    background: #dbeafe;
    color: #1d4ed8;
}

.b-call {
    background: #fef3c7;
    color: #92400e;
}

.b-no {
    background: #fee2e2;
    color: #b91c1c;
}

.b-ok {
    background: #dcfce7;
    color: #166534;
}

.b-think {
    background: #ede9fe;
    color: #5b21b6;
}

/* Цвета треков лида (раньше в assets/styles/app.css) */
.track-lead {
    background-color: #9561e2 !important;
    color: #fff;
}

.track-big-money {
    background-color: #fff000 !important;
    color: #000;
}

.track-recovery {
    background-color: #ff0000 !important;
    color: #fff;
}

/* ===== Таблица (DataTables) ===== */
#table_id, #table_id_wrapper table {
    width: 100%;
    border-collapse: collapse;
}

#table_id {
    min-width: 880px;
}

#table_id_wrapper .dataTables_scrollHead table,
#table_id thead th {
    background: var(--surface);
}

#table_id thead th {
    text-align: left;
    font-size: 12px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    padding: 10px 14px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

#table_id tbody td {
    padding: 11px 14px;
    border-top: 0;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
}

#table_id tbody td a.customer_cart {
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
}

#table_id tbody td a.customer_cart:hover {
    color: var(--accent);
}

#table_id tbody tr:nth-child(even) {
    background-color: var(--soft);
}

#table_id tbody tr:hover {
    background-color: var(--row-hover);
}

/* статус-бейдж (leadgen-redesign.html): select у вигляді пілюлі, колір — клас b-* зі статусу */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.b-new { background: #dbeafe; color: #1d4ed8; }
.b-call { background: #fef3c7; color: #92400e; }
.b-no { background: #fee2e2; color: #b91c1c; }
.b-ok { background: #dcfce7; color: #166534; }
.b-think { background: #ede9fe; color: #5b21b6; }

@media (prefers-color-scheme: dark) {
    .b-new { background: #1e3a8a; color: #bfdbfe; }
    .b-call { background: #78350f; color: #fde68a; }
    .b-no { background: #7f1d1d; color: #fecaca; }
    .b-ok { background: #14532d; color: #bbf7d0; }
    .b-think { background: #4c1d95; color: #ddd6fe; }
}

#table_id select.status-badge {
    width: auto;
    min-width: 110px;
    height: auto;
    padding: 2px 10px;
    border: 0;
    border-radius: 999px;
    box-shadow: none;
    outline: 0;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    text-align: center;
    text-align-last: center;
    /* фон і колір беруться з класу b-* (salestatus.color); тут — лише запасні */
    background-color: var(--soft);
    color: var(--ink);
}


#table_id select.status-badge.b-new { background-color: #dbeafe; color: #1d4ed8; }
#table_id select.status-badge.b-call { background-color: #fef3c7; color: #92400e; }
#table_id select.status-badge.b-no { background-color: #fee2e2; color: #b91c1c; }
#table_id select.status-badge.b-ok { background-color: #dcfce7; color: #166534; }
#table_id select.status-badge.b-think { background-color: #ede9fe; color: #5b21b6; }

@media (prefers-color-scheme: dark) {
    #table_id select.status-badge.b-new { background-color: #1e3a8a; color: #bfdbfe; }
    #table_id select.status-badge.b-call { background-color: #78350f; color: #fde68a; }
    #table_id select.status-badge.b-no { background-color: #7f1d1d; color: #fecaca; }
    #table_id select.status-badge.b-ok { background-color: #14532d; color: #bbf7d0; }
    #table_id select.status-badge.b-think { background-color: #4c1d95; color: #ddd6fe; }
}

#table_id select.status-badge:disabled {
    cursor: default;
    opacity: 1;
}

#table_id select.status-badge option {
    background: var(--surface);
    color: var(--ink);
}

#table_id .default-status-table {
    background-color: var(--surface);
}

#table_id .new-status-table {
    background-color: var(--ok-bg);
}

#table_id .callAgain-status-table {
    background-color: var(--warn-bg);
}

#table_id .default-status-table .select2-selection__rendered,
#table_id .new-status-table .select2-selection__rendered,
#table_id .callAgain-status-table .select2-selection__rendered {
    background-color: transparent;
}

#table_id tr.selected,
#table_id .default-status-table.selected,
#table_id .new-status-table.selected,
#table_id .callAgain-status-table.selected {
    background-color: var(--accent-bg);
}

#table_id tr.selected .select2-selection__rendered {
    background-color: transparent;
}

#table_id .status-block .select2-container--bootstrap .select2-selection {
    min-height: 34px;
    height: 34px;
    padding: 6px 10px;
    background: transparent;
}

#table_id_wrapper .row:nth-child(3) {
    display: none;
}

.table-wrap {
    overflow: auto;
    max-width: 100%;
}

/* scrollX у DataTables задає inline-ширину — не даємо їй розпирати сторінку */
#table_id_wrapper,
#table_id_wrapper .dataTables_scroll {
    max-width: 100%;
    overflow: hidden;
}

/* Пагинация (layouts/pagination.blade.php) */
.pagination {
    display: flex;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pagination li {
    display: block;
}

.pagination li a {
    display: grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
}

.pagination li a:hover {
    background: var(--soft);
    color: var(--ink);
}

.pagination li.active a {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.pagination li.disabled a {
    opacity: .45;
    pointer-events: none;
}

/* ===== Спиннер загрузки таблицы (.overlay использует lead.js) ===== */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 1020;
    display: none;
    background-color: rgba(20, 24, 33, .55);
    cursor: default;
}

.lds-spinner {
    display: inline-block;
    position: fixed;
    top: 50%;
    left: 50%;
    width: 64px;
    height: 64px;
    z-index: 1030;
}

.lds-spinner div {
    transform-origin: 4px 64px;
    animation: lds-spinner 1.2s linear infinite;
}

.lds-spinner div:after {
    content: " ";
    display: block;
    position: absolute;
    top: 3px;
    left: 29px;
    width: 5px;
    height: 14px;
    border-radius: 20%;
    background: #fff;
}

.lds-spinner div:nth-child(1) { transform: rotate(0deg); animation-delay: -1.1s; }
.lds-spinner div:nth-child(2) { transform: rotate(30deg); animation-delay: -1s; }
.lds-spinner div:nth-child(3) { transform: rotate(60deg); animation-delay: -0.9s; }
.lds-spinner div:nth-child(4) { transform: rotate(90deg); animation-delay: -0.8s; }
.lds-spinner div:nth-child(5) { transform: rotate(120deg); animation-delay: -0.7s; }
.lds-spinner div:nth-child(6) { transform: rotate(150deg); animation-delay: -0.6s; }
.lds-spinner div:nth-child(7) { transform: rotate(180deg); animation-delay: -0.5s; }
.lds-spinner div:nth-child(8) { transform: rotate(210deg); animation-delay: -0.4s; }
.lds-spinner div:nth-child(9) { transform: rotate(240deg); animation-delay: -0.3s; }
.lds-spinner div:nth-child(10) { transform: rotate(270deg); animation-delay: -0.2s; }
.lds-spinner div:nth-child(11) { transform: rotate(300deg); animation-delay: -0.1s; }
.lds-spinner div:nth-child(12) { transform: rotate(330deg); animation-delay: 0s; }

@keyframes lds-spinner {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* ===== Модалки (добавление лида) ===== */
.wrap-error-add-lead {
    display: none;
}

.wrap-image img {
    width: 48px;
    height: 48px;
}

.wrap-image-name {
    height: 48px;
    word-break: break-all;
    overflow: hidden;
}

.wrap-prew-delete {
    padding-top: 5px;
}

.preview {
    padding-bottom: .5rem;
}

.modal-v2 .modal-content {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(20, 30, 60, .25);
    overflow: hidden;
}

.modal-v2 .modal-dialog {
    max-width: 560px;
}

.modal-v2 .modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--line);
}

.modal-v2 .modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--ink);
}

.modal-v2 .modal-sub {
    margin-top: 2px;
    font-size: 13px;
    color: var(--muted);
}

.modal-v2 .close {
    width: 32px;
    height: 32px;
    margin: 0 0 0 auto;
    padding: 0;
    flex-shrink: 0;
    float: none;
    border-radius: 8px;
    font-size: 22px;
    line-height: 1;
    color: var(--muted);
    opacity: 1;
    text-shadow: none;
}

.modal-v2 .close:hover {
    background: var(--soft);
    color: var(--ink);
}

.modal-v2 .modal-body {
    padding: 20px 24px;
}

.modal-v2 .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 24px;
    background: var(--soft);
    border-top: 1px solid var(--line);
}

.modal-v2 .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}

.modal-v2 .span-2 {
    grid-column: 1 / -1;
}

.modal-v2 .field label {
    font-size: 12px;
    font-weight: 500;
}

.modal-v2 .textarea {
    height: auto;
    min-height: 96px;
    padding: 10px 12px;
    resize: vertical;
}

.modal-v2 .input-static {
    display: flex;
    align-items: center;
    margin: 0;
}

.modal-v2 .select2.select2-container {
    width: 100% !important;
}

.modal-v2 .dropzone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 56px;
    margin: 0;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: var(--bg);
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}

.modal-v2 .dropzone:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.modal-v2 #preview_list {
    margin-top: 8px;
}

.modal-v2 #preview_list .fm-file {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 6px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--soft);
}

.modal-v2 .fm-icon {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg);
    color: var(--muted);
    display: grid;
    place-items: center;
    overflow: hidden;
    font-size: 11px;
    font-weight: 700;
}

.modal-v2 .fm-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-v2 .fm-icon.is-mp3 { background: var(--warn-bg); color: var(--warn); }
.modal-v2 .fm-icon.is-pdf { background: var(--danger-bg); color: var(--danger); }
.modal-v2 .fm-icon.is-doc { background: var(--accent-bg); color: var(--accent); }
.modal-v2 .fm-icon.is-img { background: var(--ok-bg); color: var(--ok); }

.modal-v2 .fm-info {
    min-width: 0;
    flex: 1;
}

.modal-v2 .fm-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-v2 .fm-meta {
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
}

.modal-v2 .fm-delete {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: color .15s, background .15s, border-color .15s;
}

.modal-v2 .fm-delete:hover,
.modal-v2 .fm-delete:focus {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: transparent;
}

@media (max-width: 480px) {
    .modal-v2 .fm-delete span { display: none; }
    .modal-v2 .fm-delete { padding: 0 9px; }
}

.modal-v2 #modal-add-message {
    display: none;
}

@media (max-width: 575px) {
    .modal-v2 .form-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Бургер и выезжающее меню ===== */
.burger, .side-close {
    display: none;
}

.menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(20, 24, 33, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, visibility .2s;
}

/* Планшет и мобильный: меню уходит в бургер */
@media (max-width: 900px) {
    .app {
        grid-template-columns: minmax(0, 1fr);
    }

    .burger {
        display: grid;
        margin-left: -8px;
    }

    .side {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 50;
        width: min(300px, 85vw);
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 0 0 40px rgba(0, 0, 0, .25);
    }

    .side-close {
        display: grid;
        margin-left: auto;
        color: var(--side-ink);
    }

    .side-close:hover {
        background: rgba(255, 255, 255, .08);
        color: #fff;
    }

    .nav a {
        padding: 12px 10px;
    }

    body.menu-open {
        overflow: hidden;
    }

    body.menu-open .side {
        transform: none;
    }

    body.menu-open .menu-overlay {
        opacity: 1;
        visibility: visible;
    }

    .top {
        position: sticky;
        top: 0;
        z-index: 30;
    }
}

@media (max-width: 900px) {
    .top {
        padding-left: 16px;
        padding-right: 16px;
    }

    .top {
        gap: 8px;
    }

    .page-actions {
        margin-left: 0;
    }

    .user span {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .side, .menu-overlay, .nav .caret {
        transition: none;
    }
}
