:root {
    --color-bg: #eef4f0;
    --color-surface: #ffffff;
    --color-border: #d4e6da;
    --color-primary: #1a7a42;
    --color-primary-dark: #0d3b20;
    --color-text: #1a2e1d;
    --color-text-muted: #5c7a62;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07), 0 2px 5px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.09), 0 6px 12px rgba(0, 0, 0, 0.05);
    --radius: 0.875rem;
}

/* ── Глобальный шрифт ── */
*, *::before, *::after {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    background-color: var(--color-bg);
    padding-bottom: 30px;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Числа в таблице — tabular для ровного выравнивания */
#orders-table tbody td {
    font-variant-numeric: tabular-nums;
}

/* Bootstrap-компоненты — принудительно переопределяем */
button, input, select, textarea, .btn, .form-control, .form-select,
.modal, .modal-content, .badge, .card, .card-header, .card-body,
.table, .dropdown-menu {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

/* Моноширинный шрифт для телефонов — оставляем */

/* ===== МОДАЛКА ЗАКАЗА — современный стиль ===== */
.order-modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
    overflow: hidden;
}
.order-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.1rem 1.5rem; border-bottom: 1px solid #f1f5f9; background: #fff;
}
.order-modal-title {
    display: flex; align-items: center; gap: .7rem;
    font-weight: 700; font-size: 1rem; color: #1e293b;
}
.order-modal-icon {
    width: 34px; height: 34px; border-radius: 9px; background: #ede9fe;
    display: inline-flex; align-items: center; justify-content: center;
    color: #6366f1; font-size: .95rem; flex-shrink: 0;
}
.order-modal-body {
    padding: 1.1rem 1.5rem; display: flex; flex-direction: column; gap: 1.1rem;
    max-height: 72vh; overflow-y: auto;
}
.order-modal-footer {
    display: flex; align-items: center;
    padding: .9rem 1.5rem; border-top: 1px solid #f1f5f9; background: #fafafa;
}
.order-modal-section {
    display: flex; flex-direction: column; gap: .55rem;
}
.order-section-label {
    font-size: .73rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: #94a3b8; display: flex; align-items: center; gap: .35rem;
}
.order-fields-row {
    display: flex; gap: .85rem; flex-wrap: wrap;
}
.order-field {
    display: flex; flex-direction: column; gap: .3rem; flex: 1; min-width: 130px;
}
.order-field-grow { flex: 2; }
.order-auto-hint { font-weight: 400; color: #94a3b8; font-size: .75rem; text-transform: none; letter-spacing: 0; }

/* Строка ввода товара */
.order-product-inputs {
    display: flex; gap: .7rem; align-items: flex-end; flex-wrap: wrap;
}
.order-product-name-wrap { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: .3rem; }

/* (shipment picker removed — per-product toggle used instead) */

/* Пилюли выбора статуса в модалке заказа */
.order-status-pills {
    display: flex; flex-wrap: wrap; gap: .35rem;
}
.osp-pill {
    display: inline-flex; align-items: center;
    padding: .3rem .75rem; border-radius: 20px;
    border: 1.5px solid #e0e3ea; background: none;
    font-size: .78rem; font-weight: 500; color: #64748b;
    cursor: pointer; transition: all .15s; white-space: nowrap;
}
.osp-pill:hover { border-color: #c4b5fd; background: #faf9ff; color: #5b21b6; }
.osp-pill[data-status="Новый"].osp-active         { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
.osp-pill[data-status="В обработке"].osp-active   { background: #fef3c7; border-color: #fcd34d; color: #b45309; }
.osp-pill[data-status="Оплачен"].osp-active       { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.osp-pill[data-status="Доставляется"].osp-active  { background: #ede9fe; border-color: #c4b5fd; color: #5b21b6; }
.osp-pill[data-status="Выполнен"].osp-active      { background: #dcfce7; border-color: #86efac; color: #14532d; }
.osp-pill[data-status="Отменен"].osp-active       { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }

/* Кнопка удалить в футере */
.order-delete-btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .45rem .9rem; border-radius: 8px; border: 1.5px solid #fca5a5;
    background: none; color: #b91c1c; font-size: .85rem; font-weight: 500; cursor: pointer; transition: all .15s;
}
.order-delete-btn:hover { background: #fef2f2; border-color: #f87171; }

/* ===== СПИСОК ТОВАРОВ В ЗАКАЗЕ ===== */
.order-products-list {
    border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; background: #fff;
    margin-top: .3rem;
}
.opl-empty {
    padding: .85rem 1rem; font-size: .8rem; color: #94a3b8; font-style: italic; text-align: center;
}
.opl-row {
    display: flex; align-items: center; gap: .75rem;
    padding: .6rem 1rem; border-bottom: 1px solid #f1f5f9;
    transition: background .12s;
}
.opl-row:last-of-type { border-bottom: none; }
.opl-row:hover { background: #f8fafc; }
.opl-name {
    flex: 1; font-weight: 500; font-size: .875rem; color: #1e293b;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.opl-meta {
    display: flex; align-items: center; gap: .35rem;
    font-size: .8rem; color: #64748b; white-space: nowrap;
}
.opl-sep  { color: #cbd5e1; }
.opl-total { font-weight: 700; color: #1e293b; }
.opl-actions {
    display: flex; align-items: center; gap: .25rem;
}

/* В списке товаров заказа кнопки всегда видны */
.opl-actions .wh-action-btn { opacity: 1; color: #cbd5e1; }
.opl-actions .wh-action-btn:hover { opacity: 1; }
.opl-row:hover .opl-actions .wh-edit-btn { color: #94a3b8; }
.opl-row:hover .opl-actions .wh-del-btn  { color: #94a3b8; }

/* Кнопка «Со склада» на товаре */
.opl-wh-btn {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .22rem .55rem; border-radius: 6px; border: 1.5px solid #e0e3ea;
    background: none; font-size: .75rem; font-weight: 600; cursor: pointer;
    color: #94a3b8; transition: all .15s; white-space: nowrap;
}
.opl-wh-btn:hover { border-color: #c4b5fd; background: #ede9fe; color: #5b21b6; }
.opl-wh-btn.opl-wh-active {
    border-color: #6366f1; background: #ede9fe; color: #4f46e5;
    opacity: 1 !important;
}
/* Активная кнопка всегда видна, даже без hover на строке */
.opl-row .opl-wh-active { opacity: 1; }
.opl-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: .5rem 1rem; background: #f8fafc;
    font-size: .8rem; color: #64748b; font-weight: 600; border-top: 1px solid #e2e8f0;
}
.opl-footer-total { font-weight: 700; color: #1e293b; }

/* ===== СКЛАД — современная таблица ===== */
.wh-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wh-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #fff;
}

.wh-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.wh-table thead th {
    padding: .7rem 1rem;
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.wh-row td { border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.wh-row:last-child td { border-bottom: none; }
.wh-row:hover td { background: #f8fafc; }

.wh-td-title { padding: .7rem 1rem; }
.wh-td-sku   { padding: .7rem 1rem; white-space: nowrap; }
.wh-td-desc  { padding: .7rem 1rem; max-width: 220px; }
.wh-desc-text { font-size: .8rem; color: #64748b; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-td-qty   { padding: .7rem 1rem; text-align: center; }
.wh-td-price   { padding: .7rem 1rem; white-space: nowrap; }
.wh-td-actions { padding: .7rem .75rem; white-space: nowrap; width: 72px; }

.wh-item-title { display: block; font-weight: 500; color: #1e293b; }
.wh-item-desc  { display: block; font-size: .75rem; color: #94a3b8; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }

/* Source badges */
.wh-source-badge {
    display: inline-flex; align-items: center; gap: .3rem;
    font-size: .72rem; font-weight: 600; padding: .25rem .6rem;
    border-radius: 20px; white-space: nowrap;
}
.wh-src-stock  { background: #d1fae5; color: #065f46; }
.wh-src-orders { background: #dbeafe; color: #1d4ed8; }
.wh-src-both   { background: #ede9fe; color: #5b21b6; }

/* Quantity control */
.wh-qty-ctrl {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border: 1.5px solid #e0e3ea;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.wh-qty-btn {
    background: none;
    border: none;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6366f1;
    transition: background .15s, color .15s;
    padding: 0;
    font-size: .9rem;
    font-weight: 700;
    flex-shrink: 0;
}
.wh-qty-btn:hover { background: #ede9fe; color: #5b21b6; }
.wh-qty-btn:active { background: #ddd6fe; }
.wh-qty-divider {
    width: 1px;
    background: #e0e3ea;
    align-self: stretch;
}
.wh-qty-val {
    display: inline-block;
    min-width: 2.2rem;
    text-align: center;
    font-weight: 700;
    font-size: .82rem;
    color: #1e293b;
    padding: 0 .25rem;
    line-height: 30px;
}
.wh-qty-ok   { color: #065f46; }
.wh-qty-zero { color: #b45309; }
.wh-qty-detail { font-size: .7rem; color: #94a3b8; margin-top: .2rem; text-align: center; }

/* Price cell */
.wh-price { font-weight: 600; color: #1e293b; }
.wh-cur   { font-size: .75rem; color: #94a3b8; margin-left: .25rem; }
.wh-price-none { color: #cbd5e1; }

/* SKU cell */
.wh-td-sku { padding: .75rem 1rem; }
.wh-sku      { font-size: .78rem; font-weight: 600; color: #64748b; font-family: ui-monospace, monospace; letter-spacing: .02em; }
.wh-sku-none { color: #e2e8f0; font-size: .8rem; }

/* Action buttons — появляются при hover строки */
.wh-actions {
    display: flex; gap: .3rem; justify-content: flex-end;
    opacity: 0; transition: opacity .15s;
}
.wh-row:hover .wh-actions { opacity: 1; }
.wh-action-btn {
    background: none; border: 1px solid transparent; border-radius: 7px;
    width: 28px; height: 28px; display: inline-flex; align-items: center;
    justify-content: center; cursor: pointer; font-size: .82rem; transition: all .15s;
}
.wh-edit-btn { color: #94a3b8; }
.wh-edit-btn:hover { border-color: #c4b5fd; background: #ede9fe; color: #5b21b6; }
.wh-del-btn  { color: #94a3b8; }
.wh-del-btn:hover  { border-color: #fca5a5; background: #fef2f2; color: #b91c1c; }
.wh-lock { color: #e2e8f0; }

/* Empty state */
.wh-empty { text-align: center; padding: 3rem 1rem; color: #94a3b8; font-size: .9rem; }

/* Inline edit row */
.wh-edit-row .wh-edit-cell { padding: 0; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.wh-edit-form { padding: 1rem 1.25rem; }
.wh-edit-grid { display: flex; gap: .85rem; flex-wrap: wrap; align-items: flex-end; }
.wh-edit-field { display: flex; flex-direction: column; gap: .3rem; flex: 1; min-width: 120px; }
.wh-edit-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: .85rem; }

/* ===== WAREHOUSE MODAL — современный стиль ===== */
.wh-modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
    overflow: hidden;
}
.wh-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.5rem; border-bottom: 1px solid #f1f5f9;
    background: #fff;
}
.wh-modal-title {
    display: flex; align-items: center; gap: .7rem;
    font-weight: 700; font-size: 1rem; color: #1e293b;
}
.wh-modal-icon {
    width: 36px; height: 36px; border-radius: 10px; background: #ede9fe;
    display: inline-flex; align-items: center; justify-content: center;
    color: #6366f1; font-size: 1rem;
}
.wh-modal-body { padding: 1.25rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.wh-modal-footer {
    display: flex; justify-content: flex-end; gap: .6rem;
    padding: 1rem 1.5rem; border-top: 1px solid #f1f5f9; background: #fafafa;
}
.wh-field-group { display: flex; flex-direction: column; gap: .3rem; }
.wh-label { font-size: .8rem; font-weight: 600; color: #475569; }
.wh-hint  { font-size: .75rem; color: #94a3b8; }
.wh-price-wrap { position: relative; }
.wh-price-wrap .settings-input { padding-right: 3rem; }
.wh-currency {
    position: absolute; right: .85rem; top: 50%; transform: translateY(-50%);
    font-size: .78rem; font-weight: 600; color: #94a3b8; pointer-events: none;
}

/* ===== Стили для редактируемой цены на складе ===== */
.editable-price {
    cursor: pointer;
    transition: all 0.2s ease;
}

.editable-price:hover {
    background-color: #e3f2fd !important;
    color: #1976d2;
}

.editable-price i {
    transition: opacity 0.2s ease;
}

.editable-price:hover i {
    opacity: 1 !important;
}

/* Стили для кликабельных строк таблицы расхождения цен */
#prices-table .price-row {
    cursor: pointer;
    transition: all 0.2s ease;
}

#prices-table .price-row:hover {
    background-color: #e3f2fd !important;
    transform: scale(1.005);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#prices-table .price-row:active {
    background-color: #bbdefb !important;
}

.card {
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    border-radius: var(--radius);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.card-header {
    background: #fff;
    font-weight: 600;
    border-top-left-radius: var(--radius) !important;
    border-top-right-radius: var(--radius) !important;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #f0f2f5;
}

/* Поиск в шапке таблицы */
.table-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.table-search-icon {
    position: absolute;
    left: 10px;
    color: #94a3b8;
    font-size: 0.8rem;
    pointer-events: none;
}

.table-search-input {
    border: 1.5px solid #e8eaed;
    border-radius: 8px;
    padding: 0 12px 0 30px;
    height: 36px;
    font-size: 0.82rem;
    width: 220px;
    outline: none;
    background: #f8fafc;
    color: #374151;
    transition: border-color 0.15s, box-shadow 0.15s, width 0.2s;
}

.table-search-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
    background: #fff;
    width: 260px;
}

.table-search-input::placeholder {
    color: #94a3b8;
}

/* ── Шапка таблицы заказов ── */
.ch-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    min-width: 190px; /* фиксирует ширину — кнопки не прыгают при смене заголовка */
}

.ch-divider {
    width: 1px;
    height: 20px;
    background: #e5e7eb;
    flex-shrink: 0;
    margin: 0 8px; /* чуть больше отступ от заголовка */
}

.ch-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 16px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.13s, box-shadow 0.13s, opacity 0.13s;
    font-family: inherit;
}

.ch-btn-primary {
    background: #6366f1;
    color: #fff;
    box-shadow: 0 1px 4px rgba(99,102,241,0.25);
}
.ch-btn-primary:hover { background: #4f46e5; }

.ch-btn-success {
    background: #059669;
    color: #fff;
    box-shadow: 0 1px 4px rgba(5,150,105,0.2);
}
.ch-btn-success:hover { background: #047857; }

.ch-btn-ghost {
    background: transparent;
    color: #64748b;
    border: 1.5px solid #e2e8f0;
}
.ch-btn-ghost:hover { background: #f1f5f9; color: #1e293b; }
.ch-btn-ghost.active { background: #ede9fe; color: #7C3AED; border-color: #c4b5fd; }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin .6s linear; }

table {
    font-size: 0.875rem;
    position: relative;
}

#orders-table {
    table-layout: auto;
    width: 100%;
    min-width: max(100%, 900px);
    font-size: 0.9rem;
    border-collapse: separate !important;
    border-spacing: 0 3px !important;
}

.table {
    margin-bottom: 0;
}

/* Контейнер таблицы с горизонтальной прокруткой */
.table-responsive-adaptive {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

/* Строки таблицы — современный стиль «карточки» */
#orders-table tbody tr {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.15s ease, transform 0.12s ease;
}

#orders-table tbody tr:hover {
    background: #ffffff !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.09) !important;
    transform: translateY(-1px);
    position: relative;
    z-index: 5;
}

#orders-table tbody tr.row-editing {
    background: #fffbeb !important;
    box-shadow: 0 0 0 2px #f59e0b, 0 4px 16px rgba(245,158,11,0.15) !important;
    transform: none !important;
}

#orders-table tbody td {
    padding: 0.8rem 0.75rem !important;
    vertical-align: middle;
    border: none !important;
    color: #374151;
    font-size: inherit;
}

#orders-table tbody td:first-child { border-radius: 8px 0 0 8px; }
#orders-table tbody td:last-child  { border-radius: 0 8px 8px 0; }

.table td, .table th {
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Заголовки таблицы переносятся на малых экранах */
#orders-table thead th {
    white-space: nowrap;
}

/* Ширины колонок заданы через <colgroup> в HTML.
   Здесь только поведение содержимого. */

/* Колонка "Товар" — tooltip и обрезка (5-я позиция после переноса даты) */
#orders-table td:nth-child(5) {
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#orders-table td:nth-child(5):hover::after {
    content: attr(data-full-text);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: normal;
    z-index: 9999;
    max-width: 350px;
    word-wrap: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    line-height: 1.4;
    pointer-events: none;
}

#orders-table td:nth-child(5):hover::before {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid rgba(0, 0, 0, 0.9);
    z-index: 10000;
    pointer-events: none;
}

@media (max-width: 1023.98px) {
    #orders-table td:nth-child(5):hover::after,
    #orders-table td:nth-child(5):hover::before {
        display: none;
    }
}

/* Центрирование статуса (теперь 10-я колонка) */
@media (min-width: 1024px) {
    #orders-table th:nth-child(10),
    #orders-table td:nth-child(10) {
        text-align: center;
    }
}

/* Колонка действий */
#orders-table th:nth-child(12),
#orders-table td:nth-child(12) {
    overflow: visible;
    padding: 0.4rem 0.25rem;
    text-align: center;
}

.actions {
    padding: 0 !important;
    text-align: center !important;
    vertical-align: middle !important;
}

.actions-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
}

/* Компактные стили для кнопок в столбце действий */
.actions .btn {
    margin: 0 !important;
    font-size: 0.6rem !important;
    padding: 0.15rem 0.25rem !important;
    white-space: nowrap !important;
    min-width: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 0.2rem !important;
    line-height: 1 !important;
    width: 24px !important;
    height: 24px !important;
}

/* Компактные размеры для иконок в кнопках */
.actions .btn i {
    font-size: 0.6rem !important;
    margin: 0 !important;
}

/* Ghost-кнопки действий */
.actions .edit-btn {
    background: transparent !important;
    border: 1.5px solid #e0e3ea !important;
    color: #6366f1 !important;
}
.actions .edit-btn:hover {
    background: #ebe9ff !important;
    border-color: #c7d2fe !important;
}

.actions .delete-btn {
    background: transparent !important;
    border: 1.5px solid #e0e3ea !important;
    color: #ef4444 !important;
}
.actions .delete-btn:hover {
    background: #fff0f0 !important;
    border-color: #ffd0d0 !important;
}

.actions .save-btn {
    background: transparent !important;
    border: 1.5px solid #e0e3ea !important;
    color: #059669 !important;
}
.actions .save-btn:hover {
    background: #f0fdf4 !important;
    border-color: #a7f3d0 !important;
}

.actions .cancel-btn {
    background: transparent !important;
    border: 1.5px solid #e0e3ea !important;
    color: #94a3b8 !important;
}
.actions .cancel-btn:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
}

/* Мобильная адаптация для действий */
@media (max-width: 1023.98px) {
    #orders-table th:nth-child(12),
    #orders-table td:nth-child(12) {
        width: 50px !important;
        min-width: 50px !important;
        max-width: 50px !important;
    }
    
    .actions .btn {
        font-size: 0.5rem !important;
        padding: 0.1rem 0.2rem !important;
        width: 18px !important;
        height: 18px !important;
    }
    
    .actions .btn i {
        font-size: 0.5rem !important;
    }
}

/* 1600px */
@media (min-width: 1024px) and (max-width: 1600px) {
    #orders-table,
    #orders-table th,
    #orders-table td,
    #orders-table tbody td,
    #orders-table thead th {
        font-size: 0.78rem !important;
    }
    #orders-table th,
    #orders-table td {
        padding: 0.4rem 0.35rem !important;
    }
}

/* 1440px */
@media (min-width: 1024px) and (max-width: 1460px) {
    #orders-table,
    #orders-table th,
    #orders-table td,
    #orders-table tbody td,
    #orders-table thead th {
        font-size: 0.72rem !important;
    }
    #orders-table th,
    #orders-table td {
        padding: 0.35rem 0.28rem !important;
    }
}

/* 1280px */
@media (min-width: 1024px) and (max-width: 1280px) {
    #orders-table,
    #orders-table th,
    #orders-table td,
    #orders-table tbody td,
    #orders-table thead th {
        font-size: 0.67rem !important;
    }
    #orders-table th,
    #orders-table td {
        padding: 0.28rem 0.22rem !important;
    }
}

#search-orders {
    width: 210px;
    border-radius: 2rem;
    padding-left: 1rem;
    border: 1px solid #d4e6da;
    background-color: #f7faf8;
    transition: all 0.2s ease;
}

#search-orders:focus {
    background-color: #fff;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem rgba(26, 122, 66, 0.15);
}

.badge {
    padding: 0.45em 0.8em;
    border-radius: 0.5rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.form-control, .form-select {
    border-radius: 0.5rem;
    border-color: #d4e6da;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem rgba(26, 122, 66, 0.15);
}

.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
}

header.bg-primary {
    border-radius: 0 0 1rem 1rem;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

/* Кастомный стиль для заголовка */
.bg-custom-green {
    background: linear-gradient(135deg, #0c3820 0%, #185c36 55%, #1f7843 100%) !important;
}

header.bg-custom-green {
    border-radius: 0 0 1.25rem 1.25rem;
    box-shadow: 0 6px 24px rgba(12, 56, 32, 0.28), 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Стили для дашборда */
#dashboard .card {
    border-radius: 1.125rem;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
    border: none;
}

#dashboard .card.bg-success {
    background: linear-gradient(135deg, #14532d 0%, #16a34a 100%) !important;
}

#dashboard .card.bg-warning {
    background: linear-gradient(135deg, #78350f 0%, #b45309 100%) !important;
    color: white !important;
}

#dashboard .card.bg-warning .text-dark,
#dashboard .card.bg-warning .card-title {
    color: rgba(255, 255, 255, 0.95) !important;
}

#dashboard .card.bg-primary {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%) !important;
}

#dashboard .card.bg-info {
    background: linear-gradient(135deg, #164e63 0%, #0891b2 100%) !important;
    color: white !important;
}

#dashboard .card.bg-info .text-dark,
#dashboard .card.bg-info .card-title {
    color: rgba(255, 255, 255, 0.95) !important;
}

#dashboard .card:hover {
    transform: translateY(-4px);
    box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.2);
}

#dashboard .card.dashboard-active {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%) !important;
    color: white;
    transform: translateY(-4px);
    box-shadow: 0 0.75rem 1.5rem rgba(79, 70, 229, 0.4);
}

#dashboard .card.dashboard-active .text-muted,
#dashboard .card.dashboard-active .text-dark,
#dashboard .card.dashboard-active .card-title {
    color: rgba(255, 255, 255, 0.9) !important;
}

#dashboard .card-body {
    padding: 1.4rem 1.5rem;
}

#dashboard h2 {
    font-size: 2.1rem;
    font-weight: 700;
    margin-top: 0.4rem;
    margin-bottom: 0;
    letter-spacing: -0.02em;
}

/* ── Бейджи статусов (современный пилл с точкой) ── */
.status-badge {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    padding: 4px 10px !important;
    border-radius: 20px !important;
    font-size: inherit !important;
    font-weight: 600 !important;
    white-space: nowrap;
    width: auto !important;
    text-align: left !important;
    letter-spacing: 0.01em;
}

.status-badge::before {
    display: none;
}

/* Цвета бейджей по статусу */
.status-new        { background: #dbeafe !important; color: #1d4ed8 !important; }
.status-processing { background: #fef3c7 !important; color: #b45309 !important; }
.status-paid       { background: #d1fae5 !important; color: #065f46 !important; }
.status-shipping   { background: #ede9fe !important; color: #5b21b6 !important; }
.status-done       { background: #dcfce7 !important; color: #14532d !important; }
.status-cancelled  { background: #f1f5f9 !important; color: #64748b !important; }
.status-default    { background: #f1f5f9 !important; color: #64748b !important; }

/* Стили для inline-редактирования */
.editable-field {
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s ease;
}

.editable-field:hover {
    background-color: #f8f9fa;
}

/* Специальные стили для поля статуса */
.status-cell.editable-field:hover {
    background-color: #e3f2fd;
}

.status-cell.editable-field:hover .status-badge {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

.editable-field.editing {
    padding: 0;
    background-color: transparent;
    vertical-align: middle;
}

.editable-field.editing input,
.editable-field.editing select {
    margin: 0;
    line-height: 1.4;
    height: 34px;
    display: inline-block;
    vertical-align: middle;
}

.editable-field input,
.editable-field select {
    width: 100%;
    border: 2px solid var(--color-primary);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.9rem;
    background-color: #fff;
    vertical-align: middle;
    box-sizing: border-box;
    height: auto;
    min-height: 34px;
}

/* Специальные стили для селектора статуса */
.status-cell.editing select {
    font-size: 0.8rem;
    padding: 4px 6px;
}

.editable-field input:focus,
.editable-field select:focus {
    outline: none;
    border-color: var(--color-primary-dark);
    box-shadow: 0 0 0 0.2rem rgba(26, 122, 66, 0.2);
}

/* Кнопки в режиме редактирования */
/* По умолчанию кнопки сохранить и отмена скрыты */
tr .actions .save-btn,
tr .actions .cancel-btn,
.actions .save-btn,
.actions .cancel-btn {
    display: none !important;
}

/* При редактировании скрываем кнопки редактировать и удалить */
tr.row-editing .actions .edit-btn,
tr.row-editing .actions .delete-btn,
.row-editing .actions .edit-btn,
.row-editing .actions .delete-btn {
    display: none !important;
}

/* При редактировании показываем кнопки сохранить и отмена */
tr.row-editing .actions .save-btn,
tr.row-editing .actions .cancel-btn,
.row-editing .actions .save-btn,
.row-editing .actions .cancel-btn {
    display: inline-flex !important;
}

@media (max-width: 1023.98px) {
    .col-md-9, .col-md-3 {
        margin-bottom: 2rem;
    }
    
    #search-orders {
        width: 100%;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .card-header .form-group {
        width: 100%;
        margin-top: 10px;
    }
}

/* Стили для выбора менеджеров */
.manager-selection {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.5rem;
    background-color: #fff;
    max-height: 200px;
    overflow-y: auto;
}

.manager-item {
    padding: 0.75rem 1rem;
    margin: 0.25rem 0;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background-color: #f8f9fa;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.manager-item:hover {
    background-color: #edf5f0;
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(26, 122, 66, 0.18);
}

.manager-item.selected {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary-dark);
    box-shadow: 0 2px 10px rgba(26, 122, 66, 0.3);
}

.manager-item.selected:hover {
    background-color: var(--color-primary-dark);
    color: white;
    transform: translateY(-1px);
}

.manager-item i {
    font-size: 1.1em;
    min-width: 20px;
}

/* Стили для селектора отгрузки */
.shipment-item {
    padding: 0.75rem 1rem;
    margin: 0.25rem 0;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #dee2e6;
    background-color: #f8f9fa;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.shipment-item:hover {
    background-color: #edf5f0;
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(26, 122, 66, 0.15);
}

.shipment-item.selected {
    background-color: #f0f9f4;
    color: var(--color-primary);
    border-color: var(--color-primary);
    border-width: 2px;
    box-shadow: 0 0 0 0.2rem rgba(26, 122, 66, 0.18);
}

.shipment-item.selected:hover {
    background-color: #e5f3eb;
    color: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    transform: translateY(-1px);
}

.shipment-item i {
    font-size: 1.1em;
    min-width: 20px;
}

/* Стили для поля комментария */
.comment {
    max-width: 250px;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    font-size: 0.85rem;
    font-style: italic;
    color: #6c757d;
    padding: 0.5rem !important;
}

.comment:empty::before {
    content: "—";
    color: #dee2e6;
    font-style: italic;
}

.comment.editable-field:hover {
    background-color: #f8f9fa;
    color: #495057;
}

/* Стили для редактирования комментария */
.comment.editing input {
    min-height: 60px;
    resize: vertical;
}

/* Стили для узких колонок */
.price, .quantity {
    padding: 0.25rem 0.5rem !important;
}

.status-cell {
    padding: 0.25rem 0.5rem !important;
    min-width: 120px;
    text-align: center;
}

/* ── Типографика колонок ── */

/* Базовый размер и цвет для всех ячеек уже задан в #orders-table tbody td.
   Здесь — только отклонения от базы. */

/* Порядковый номер */
.row-number {
    font-size: inherit !important;
    color: #94a3b8 !important;
    font-weight: 500;
    text-align: center;
}

/* Телефон */
.customer-phone {
    font-size: inherit !important;
    color: #64748b !important;
    letter-spacing: 0.01em;
}

/* Имя клиента */
.customer-name {
    font-size: inherit !important;
    font-weight: 600 !important;
    color: #1e293b !important;
}

/* Товар */
.product-name {
    font-size: inherit;
    color: #374151;
}

/* Цена единицы */
.unit-price {
    font-size: inherit;
    color: #64748b;
    text-align: right;
}

/* Количество */
.quantity {
    font-size: inherit;
    color: #64748b;
    text-align: center;
}

/* Итоговая сумма */
td.total-price {
    font-size: inherit !important;
    font-weight: 700 !important;
    color: #059669 !important;
    white-space: nowrap;
    text-align: right;
}

/* Менеджер */
.manager {
    font-size: inherit !important;
    font-weight: 500 !important;
    color: #6366f1 !important;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Комментарий */
.comment {
    font-size: inherit !important;
    color: #94a3b8 !important;
    font-style: italic;
}

/* Дата */
.created-at {
    line-height: 1.25 !important;
    white-space: normal !important;
}
.date-main {
    display: block;
    font-size: inherit;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
}
.date-time {
    display: block;
    font-size: 0.85em;
    color: #94a3b8;
    margin-top: 1px;
    white-space: nowrap;
}

/* Компактные стили для таблицы */
.table td {
    padding: 0.5rem;
    vertical-align: middle;
}

/* Стили для мобильных устройств */
@media (max-width: 1023.98px) {
    .comment {
        max-width: 200px;
    }
    
    .price, .quantity {
        padding: 0.2rem 0.4rem !important;
    }
    
    .status-badge {
        font-size: 0.72rem;
        padding: 0.2em 0.5em;
    }
    
    .status-cell.editing select {
        font-size: 0.75rem;
        padding: 2px 4px;
    }
}

/* Product autocomplete styles */
.product-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.suggestion-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.15s ease-in-out;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background-color: #f8f9fa;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.suggestion-title {
    font-weight: 500;
    color: #212529;
    flex: 1;
}

.suggestion-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.suggestion-price {
    font-size: 0.875rem;
    color: #28a745;
    font-weight: 600;
}

.suggestion-brand {
    font-size: 0.75rem;
    color: #6c757d;
}

/* Метки источника товара */
.suggestion-source {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.suggestion-source.warehouse {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.suggestion-source.supplier {
    background-color: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
}

.suggestion-source.orders {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Стили для фиксированных колонок */
.table th:nth-child(2), /* Клиент */
.table td:nth-child(2) {
    width: 150px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table th:nth-child(3), /* Телефон */
.table td:nth-child(3) {
    width: 120px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table th:nth-child(4), /* Товар */
.table td:nth-child(4) {
    width: 200px;
    max-width: 200px;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    vertical-align: top;
    text-align: left;
    padding: 0.75rem 0.5rem;
    line-height: 1.2;
}

/* Добавляем tooltip для обрезанного текста */
.table td[title] {
    cursor: help;
}

/* Карточка общей суммы - она сбрасывает фильтры, но имеет другой стиль активации */
#dashboard .card:last-child.dashboard-active {
    outline-color: #17a2b8;
}

/* Компактные стили для формы добавления заказа */
.col-md-3 .card {
    font-size: 0.9rem;
}

.col-md-3 .card-header {
    padding: 0.75rem 1rem;
}

.col-md-3 .card-body {
    padding: 1rem;
}

.col-md-3 .mb-3 {
    margin-bottom: 0.75rem !important;
}

.col-md-3 .form-label {
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.col-md-3 .form-control,
.col-md-3 .form-select {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.col-md-3 .manager-selection {
    padding: 0.5rem;
    max-height: 150px;
}

.col-md-3 .manager-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

.col-md-3 .btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.col-md-3 h4 {
    font-size: 1.1rem;
    margin-bottom: 0;
}

/* Стили для тегов товаров */
.products-tags {
    min-height: 40px;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.5rem;
    background-color: #f8f9fa;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
}

.products-tags:empty::before {
    content: "Товары не добавлены";
    color: #6c757d;
    font-style: italic;
    font-size: 0.85rem;
}

.product-tag {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #185c36, #1a7a42);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    gap: 0.25rem;
    max-width: 100%;
    animation: fadeIn 0.3s ease-in-out;
    box-shadow: 0 1px 4px rgba(26, 122, 66, 0.25);
}

.product-tag .product-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.product-tag .product-name {
    font-weight: 600;
    line-height: 1;
}

.product-tag .product-details {
    font-size: 0.6rem;
    opacity: 0.9;
    line-height: 1;
}

.product-tag .remove-product {
    background: none;
    border: none;
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    margin-left: 0.25rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.product-tag .remove-product:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Адаптация для компактной колонки */
.col-md-3 .product-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
}

.col-md-3 .product-tag .product-details {
    font-size: 0.55rem;
}

.col-md-3 .product-tag .remove-product {
    width: 14px;
    height: 14px;
    font-size: 0.7rem;
}

/* Стили для декомпозированных строк заказов */
tr[data-is-decomposed="true"] {
    border-left: 3px solid var(--color-primary);
}

tr[data-is-decomposed="true"]:not([data-product-index="0"]) {
    border-top: 1px dashed #d4e6da;
}

tr[data-is-decomposed="true"]:not([data-product-index="0"]) td {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

tr[data-is-decomposed="true"][data-product-index="0"] {
    border-top: 2px solid var(--color-primary);
}

/* Визуальная группировка строк одного заказа */
tr[data-is-decomposed="true"] td:first-child::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--color-primary);
}

/* Стили для скрытых элементов в дополнительных строках товаров */
tr[data-is-decomposed="true"]:not([data-product-index="0"]) .row-number,
tr[data-is-decomposed="true"]:not([data-product-index="0"]) .customer-name,
tr[data-is-decomposed="true"]:not([data-product-index="0"]) .customer-phone,
tr[data-is-decomposed="true"]:not([data-product-index="0"]) .manager,
tr[data-is-decomposed="true"]:not([data-product-index="0"]) .status-badge,
tr[data-is-decomposed="true"]:not([data-product-index="0"]) .comment,
tr[data-is-decomposed="true"]:not([data-product-index="0"]) .created-at,
tr[data-is-decomposed="true"]:not([data-product-index="0"]) .actions {
    visibility: hidden;
}

/* Подсветка при наведении на группу декомпозированных строк */
tr[data-is-decomposed="true"]:hover ~ tr[data-original-order-id],
tr[data-is-decomposed="true"]:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

/* Стили для групповых заказов */
.grouped-order {
    background-color: #f7faf8;
    border-left: 4px solid var(--color-primary);
}

.grouped-order:hover {
    background-color: #eef5f1;
}

.product-row {
    background-color: #ffffff;
    border-left: 4px solid #16a34a;
    margin-left: 20px;
}

.product-row:hover {
    background-color: #f8f9fa;
}

.product-row td:first-child {
    padding-left: 30px;
}

.order-expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #6b7280;
    border-radius: 4px;
    padding: 0;
    margin-right: 6px;
    font-size: 0.7rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.order-expand-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
}

.order-expand-btn i {
    transition: transform 0.2s;
}

/* Анимация для разворачивания */
.product-row {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Стили для редактирования групповых строк */
.grouped-order.row-editing {
    background-color: #fef9e8;
    border-left-color: #d97706;
}

.product-row.row-editing {
    background-color: #e8f4f8;
    border-left-color: #0891b2;
}

/* ── Быстрые фильтры по дате ── */
.date-filters-container {
    background: #f8fafc;
    border-radius: 10px;
    padding: 5px 10px !important;
    border: 1px solid #f0f2f5;
    margin-bottom: 1rem !important;
    gap: 6px !important;
}

.date-filters-container > small {
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.07em !important;
    color: #94a3b8 !important;
    white-space: nowrap;
}

/* Убираем btn-group склейку */
.date-filters-container .btn-group {
    gap: 2px;
    flex-wrap: wrap;
    border: none !important;
    background: none !important;
}
.date-filters-container .btn-group > .btn:not(:last-child):not(.dropdown-toggle),
.date-filters-container .btn-group > .btn:not(:first-child) {
    border-radius: 6px !important;
    margin-left: 0 !important;
}

/* Базовый стиль кнопки-пилла */
.date-filter {
    background: transparent !important;
    border: none !important;
    color: #64748b !important;
    border-radius: 6px !important;
    padding: 4px 11px !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    line-height: 1.4;
    transition: background 0.13s, color 0.13s !important;
    box-shadow: none !important;
    transform: none !important;
    white-space: nowrap;
}

.date-filter:hover {
    background: #e9ecef !important;
    color: #374151 !important;
    transform: none !important;
    box-shadow: none !important;
}

.date-filter.active {
    background: #6366f1 !important;
    border-color: transparent !important;
    color: #fff !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(99,102,241,0.25) !important;
}

.date-filter.active:hover {
    background: #4f46e5 !important;
    border-color: transparent !important;
    color: #fff !important;
}

/* ══════════════════════════════════════════════════════
   DATE RANGE PICKER
   ══════════════════════════════════════════════════════ */
.drp-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

/* Trigger button */
.drp-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1.5px solid #e0e3ea;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}
.drp-trigger:hover,
.drp-trigger.drp-active {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.drp-trigger.drp-has-value {
    border-color: #6366f1;
    color: #4f46e5;
}
.drp-cal-icon {
    color: #94a3b8;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.drp-clear-x {
    background: none;
    border: none;
    padding: 0;
    margin-left: 2px;
    color: #94a3b8;
    font-size: 0.9rem;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    transition: color 0.12s;
}
.drp-clear-x:hover { color: #ef4444; }

/* Popup */
.drp-popup {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.13), 0 2px 8px rgba(0,0,0,0.07);
    border: 1px solid #f0f2f5;
    z-index: 1050;
    display: none;
    width: 560px;
    padding: 18px;
}
.drp-popup.drp-open {
    display: block;
    animation: drpFadeIn 0.12s ease;
}
@keyframes drpFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Two-month layout */
.drp-calendars {
    display: flex;
    gap: 0;
    align-items: flex-start;
}
.drp-cal { flex: 1; min-width: 0; }
.drp-col-divider {
    width: 1px;
    background: #f0f2f5;
    margin: 0 14px;
    align-self: stretch;
}

/* Month header */
.drp-month-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.drp-month-title {
    font-size: 0.83rem;
    font-weight: 700;
    color: #111827;
}
.drp-nav-btn {
    background: none;
    border: 1px solid #e0e3ea;
    border-radius: 7px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    color: #374151;
    transition: background 0.12s, border-color 0.12s;
    line-height: 1;
    padding: 0;
}
.drp-nav-btn:hover { background: #f1f5f9; border-color: #c7d2fe; }
.drp-nav-placeholder { width: 26px; }

/* Grid */
.drp-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
}
.drp-day-hdr {
    text-align: center;
    font-size: 0.62rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    padding: 3px 0 7px;
    letter-spacing: 0.04em;
}
.drp-day {
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    color: #374151;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.1s, color 0.1s;
    position: relative;
}
.drp-day:hover:not(.drp-sel-start):not(.drp-sel-end) {
    background: #ede9fe;
    color: #5b21b6;
}
.drp-today {
    font-weight: 700;
    color: #6366f1;
}
/* Range highlight */
.drp-in-range {
    background: #ede9fe;
    color: #4c1d95;
    border-radius: 0;
}
.drp-range-start {
    border-radius: 6px 0 0 6px !important;
}
.drp-range-end {
    border-radius: 0 6px 6px 0 !important;
}
/* Selected endpoints */
.drp-sel-start,
.drp-sel-end {
    background: #6366f1 !important;
    color: #fff !important;
    font-weight: 700;
    border-radius: 6px !important;
    z-index: 1;
}

/* Footer */
.drp-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #f0f2f5;
}
.drp-hint {
    font-size: 0.75rem;
    color: #64748b;
    font-style: italic;
}
.drp-actions { display: flex; gap: 8px; }
.drp-btn-cancel {
    background: transparent;
    border: 1px solid #e0e3ea;
    border-radius: 8px;
    padding: 5px 14px;
    font-size: 0.78rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: background 0.12s;
}
.drp-btn-cancel:hover { background: #f8fafc; }
.drp-btn-apply {
    background: #6366f1;
    border: none;
    border-radius: 8px;
    padding: 5px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: background 0.12s;
}
.drp-btn-apply:hover:not(:disabled) { background: #4f46e5; }
.drp-btn-apply:disabled { opacity: 0.38; cursor: default; }

/* Стили для нового блока товаров в форме */
.product-form-row {
    position: relative;
}

.product-form-row .col-6 {
    position: relative;
}

.product-form-row .product-suggestions {
    left: 15px;
    right: 15px;
    top: calc(100% + 5px);
}

/* Улучшенная мобильная адаптивность для формы товаров */
@media (max-width: 1023.98px) {
    .product-form-row .col-6,
    .product-form-row .col-3 {
        margin-bottom: 0.5rem;
    }
    
    .product-form-row .row.g-2 {
        margin-bottom: 0.5rem;
    }
}

/* Респонсивность для мобильных устройств */
@media (max-width: 1023.98px) {
    .date-filter {
        margin-bottom: 0.25rem;
        font-size: 0.75rem;
    }
    
    .date-filter .bi {
        margin-right: 0.25rem;
    }
    
    .btn-group {
        flex-wrap: wrap;
    }
}

/* Стили для кнопки удаления товара */
.product-delete-btn {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
}

.product-delete-btn:hover {
    background-color: #c82333 !important;
    border-color: #bd2130 !important;
    color: white !important;
}

/* Стили для автозаполнения клиента */
.customer-autofill-success {
    background-color: #e8f5e8 !important;
    border: 2px solid #28a745 !important;
    transition: all 0.3s ease;
}

.customer-autofill-loading {
    background-color: #f8f9fa !important;
    background-image: linear-gradient(90deg, #f8f9fa 25%, #e9ecef 50%, #f8f9fa 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

.customer-autofill-not-found {
    background-color: #fff3cd !important;
    border: 2px solid #ffc107 !important;
    transition: all 0.3s ease;
}

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

/* Улучшение подсказки */
.form-text.text-muted {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.form-text.text-muted i {
    margin-right: 0.25rem;
    color: #6c757d;
}

/* Мобильные стили для iPad и мобильных устройств */
@media (max-width: 1023.98px) {
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .card {
        margin-bottom: 1rem;
        border-radius: 0.25rem;
    }
    
    .card-header {
        padding: 0.75rem;
        font-size: 0.95rem;
    }
    
    /* Улучшенные поля ввода для мобильных */
    .form-control {
        font-size: 16px; /* Предотвращает зум на iOS */
        padding: 0.75rem;
        border-radius: 0.5rem;
        touch-action: manipulation;
    }
    
    /* Специальные стили для полей телефона и имени */
    #customer-phone, #customer-name {
        font-size: 16px;
        padding: 0.875rem;
        min-height: 48px; /* Рекомендуемый размер для сенсорных экранов */
        border-radius: 0.5rem;
        border: 2px solid #ced4da;
        transition: all 0.3s ease;
    }
    
    #customer-phone:focus, #customer-name:focus {
        border-color: #007bff;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
        transform: scale(1.02);
    }
    
    /* Улучшенные кнопки для мобильных */
    .btn {
        min-height: 44px;
        font-size: 16px;
        border-radius: 0.5rem;
        touch-action: manipulation;
    }
    
    .btn-sm {
        min-height: 36px;
        font-size: 14px;
        padding: 0.5rem 0.75rem;
    }
    
    /* Таблица товаров - горизонтальная прокрутка */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 0.8rem;
    }
    
    .table td, .table th {
        padding: 0.5rem;
        white-space: nowrap;
    }
    
    /* Модальные окна на мобильных */
    .modal-content {
        border-radius: 0.5rem;
        margin: 10px;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    /* Поля поиска */
    #search-orders {
        width: 100%;
        border-radius: 0.5rem;
        padding: 0.75rem 1rem;
        font-size: 16px;
    }
}

/* Стили для планшетов (мобильный вид с улучшенными элементами) */
@media (min-width: 768px) and (max-width: 1023.98px) {
    .container-fluid {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    /* Увеличенные поля ввода для удобства на планшетах */
    #customer-phone, #customer-name {
        font-size: 18px;
        padding: 1rem;
        min-height: 52px;
    }
    
    .btn {
        font-size: 16px;
        padding: 0.75rem 1.5rem;
    }
    
    /* Улучшенные карточки для планшетов */
    .card-view-item {
        padding: 20px;
    }
    
    .card-view-item .order-details-table td {
        padding: 0.5rem;
        font-size: 1rem;
    }
}

/* Улучшения для сенсорных устройств */
@media (hover: none) and (pointer: coarse) {
    /* Увеличиваем зоны касания */
    .btn, .form-control, .table td a {
        touch-action: manipulation;
    }
    
    /* Убираем hover эффекты на сенсорных устройствах */
    .btn:hover {
        transform: none;
    }
    
    /* Улучшенные состояния автозаполнения для сенсорных экранов */
    .customer-autofill-success {
        border-width: 3px !important;
    }
    
    .customer-autofill-not-found {
        border-width: 3px !important;
    }
    
    /* Анимация нажатия для кнопок */
    .btn:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* Ландшафтная ориентация на мобильных */
@media (max-width: 1023.98px) and (orientation: landscape) {
    .modal-dialog {
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .card-header {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
}

/* Высокие плотности пикселей (Retina дисплеи) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .btn, .form-control {
        border-width: 1px;
    }
}

/* Дополнительные стили для очень маленьких экранов */
@media (max-width: 576px) {
    /* Заголовок на очень маленьких экранах */
    header .container-fluid .row {
        flex-direction: column;
    }
    
    header h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem !important;
    }
    
    /* Кнопки в заголовке на маленьких экранах */
    header .d-flex {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    header .btn {
        width: 100% !important;
        justify-content: center;
        min-height: 38px;
    }
    
    /* Убираем скрытие текста на очень маленьких экранах */
    header .d-none.d-sm-inline {
        display: inline !important;
    }
}

/* Для экранов между 576px и 768px */
@media (min-width: 577px) and (max-width: 767px) {
    header .d-flex {
        flex-direction: row !important;
        justify-content: center;
    }
    
    header .btn {
        flex: 1;
        max-width: 150px;
    }
}

/* Стили для выравнивания полей товара в модальном окне */
.modal-body .row.g-2 {
    align-items: end;
    margin-bottom: 0;
}

.modal-body .row.g-2 .col-md-6,
.modal-body .row.g-2 .col-md-3 {
    margin-bottom: 0;
}

.modal-body .row.g-2 .form-label {
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.modal-body .row.g-2 .form-control {
    height: 38px;
    font-size: 0.875rem;
}

/* Обеспечиваем одинаковую высоту полей ввода */
.modal-body #product-name,
.modal-body #price,
.modal-body #quantity {
    height: 38px !important;
    line-height: 1.5;
}

/* Дополнительные отступы для кнопки добавления товара */
.modal-body .d-grid.mt-2 {
    margin-top: 0.75rem !important;
}

/* Улучшаем выравнивание в строке товаров */
.modal-body .position-relative .row.g-2 {
    --bs-gutter-x: 0.5rem;
}

/* Дополнительные стили для тегов товаров */
.products-tags .product-tag {
    display: inline-block;
    margin: 0.125rem;
}

/* Дополнительные стили для выравнивания в режиме редактирования */
tr.row-editing td {
    vertical-align: middle;
}

/* Обеспечиваем одинаковую высоту всех полей в режиме редактирования */
.editable-field.editing input,
.editable-field.editing select {
    height: 34px;
    display: inline-block;
    vertical-align: middle;
}

/* Специальное выравнивание для текстовых полей */
.editable-field.editing {
    position: relative;
    display: table-cell;
    vertical-align: middle;
}

/* Перенос текста для текстовых колонок ТОЛЬКО на десктопе */
@media (min-width: 1024px) {
    .table td.customer-phone,
    .table td.customer-name,
    .table td.product-name,
    .table td.comment {
        white-space: normal !important;
        word-wrap: break-word;
        word-break: break-word;
        overflow: visible;
        text-overflow: unset;
        hyphens: auto;
        vertical-align: top;
        line-height: 1.4;
    }

    /* Числовые и короткие поля оставляем без переноса */
    .table td.unit-price,
    .table td.quantity,
    .table td.total-price,
    .table td.created-at,
    .table td.manager,
    .table td.status-cell {
        white-space: nowrap;
        text-align: center;
        vertical-align: middle;
    }

    /* Для колонки действий тоже без переноса */
    .table td.actions {
        white-space: nowrap;
        text-align: center;
        vertical-align: middle;
    }

    /* Выравнивание по центру для всех ячеек таблицы */
    .table td {
        vertical-align: middle;
    }
}

/* На мобильных устройствах оставляем исходные стили */
@media (max-width: 1023.98px) {
    .table td {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: middle;
    }
}

/* Заголовки таблицы — только десктоп */
@media (min-width: 1024px) {
    #orders-table thead th {
        text-align: left !important;
        vertical-align: middle !important;
        font-weight: 700 !important;
        font-size: inherit !important;
        text-transform: uppercase !important;
        letter-spacing: 0.07em !important;
        background: #f8fafc !important;
        color: #94a3b8 !important;
        border: none !important;
        padding: 0.65rem 0.75rem !important;
    }

    #orders-table thead th:first-child { border-radius: 8px 0 0 8px; }
    #orders-table thead th:last-child  { border-radius: 0 8px 8px 0; }

    /* Числовые и центрируемые колонки */
    #orders-table th:nth-child(1),
    #orders-table th:nth-child(2),
    #orders-table th:nth-child(6),
    #orders-table th:nth-child(7),
    #orders-table th:nth-child(8),
    #orders-table th:nth-child(9),
    #orders-table th:nth-child(10),
    #orders-table th:nth-child(12) {
        text-align: center !important;
    }
}

/* Принудительное центрирование заголовка "Общая цена" (теперь 8-я) */
@media (min-width: 1024px) {
    #orders-table thead tr th:nth-child(8) {
        text-align: center !important;
        text-align-last: center !important;
    }

    /* Принудительное центрирование содержимого колонки "Статус" (теперь 10-я) */
    #orders-table td.status-cell,
    #orders-table td:nth-child(10) {
        text-align: center !important;
    }
    
    /* Убедимся, что бейджи статусов тоже центрированы */
    #orders-table td.status-cell .status-badge {
        display: inline-block;
        margin: 0 auto;
    }
}

/* На мобильных оставляем как есть */
@media (max-width: 1023.98px) {
    #orders-table thead th {
        text-align: left;
        font-size: 0.875rem;
    }
}

/* ── Hover-оверлей действий на строке таблицы ── */
#orders-table tbody tr {
    position: relative;
}
.row-actions-overlay {
    display: none;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    gap: 4px;
    align-items: center;
    background: linear-gradient(to right, transparent, #fff 20%);
    padding: 2px 0 2px 24px;
    border-radius: 0 8px 8px 0;
}
#orders-table tbody tr:hover .row-actions-overlay {
    display: flex;
}
#orders-table tbody tr.row-editing .row-actions-overlay {
    display: none !important;
}
.row-actions-overlay .btn-row-act {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.13s, color 0.13s, border-color 0.13s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.row-actions-overlay .btn-row-act:hover {
    background: #f1f5f9;
    color: #374151;
    border-color: #cbd5e1;
}
.row-actions-overlay .btn-row-act.btn-delete:hover {
    background: #fef2f2;
    color: #ef4444;
    border-color: #fca5a5;
}

/* Сортируемые заголовки */
#orders-table .th-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
#orders-table .th-sortable:hover {
    color: #6366f1 !important;
}
#orders-table .th-sort-active {
    color: #6366f1 !important;
}
#orders-table .sort-icon {
    font-style: normal;
    font-size: 0.75em;
    opacity: 0.8;
}

/* ── Фильтр по менеджеру ── */
.th-manager-col {
    white-space: nowrap;
}

.th-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0 2px;
    margin-left: 4px;
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.7rem;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    vertical-align: middle;
}
.th-filter-btn:hover { color: #6366f1; background: #f1f5f9; }
.th-filter-btn.active { color: #6366f1; }

.th-filter-dropdown {
    display: none;
    position: fixed;
    z-index: 1055;
    min-width: 200px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    padding: 6px 0 0;
    overflow: hidden;
}
.th-filter-dropdown.open { display: block; }

.th-filter-search-wrap {
    padding: 0 8px 6px;
    border-bottom: 1px solid #f1f5f9;
}
.th-filter-search {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 5px 9px;
    font-size: 0.78rem;
    outline: none;
    color: #374151;
    font-family: inherit;
}
.th-filter-search:focus { border-color: #6366f1; }

.th-filter-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    max-height: 200px;
    overflow-y: auto;
}
.th-filter-item {
    padding: 7px 14px;
    font-size: 0.82rem;
    color: #374151;
    cursor: pointer;
    transition: background 0.12s;
    font-family: inherit;
}
.th-filter-item:hover { background: #f8fafc; }
.th-filter-item.active {
    color: #6366f1;
    font-weight: 600;
    background: #eef2ff;
}

.th-filter-footer {
    border-top: 1px solid #f1f5f9;
    padding: 6px 8px;
    text-align: right;
}
.th-filter-clear {
    background: none;
    border: none;
    font-size: 0.75rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 5px;
    font-family: inherit;
    transition: color 0.13s, background 0.13s;
}
.th-filter-clear:hover { color: #ef4444; background: #fef2f2; }

/* Убираем текст из кнопок действий, оставляем только иконки на ПК */
@media (min-width: 1024px) {
    .actions .btn .btn-text,
    .actions .btn-sm .btn-text,
    .actions .save-btn .btn-text,
    .actions .cancel-btn .btn-text,
    .actions .edit-btn .btn-text,
    .actions .delete-btn .btn-text {
        display: none !important;
    }
    
    /* Убираем любой текстовый контент из кнопок, кроме иконок */
    .actions .btn {
        font-size: 0 !important; /* Скрываем весь текст */
    }
    
    .actions .btn i {
        font-size: 0.6rem !important; /* Возвращаем размер иконок */
    }
    
    /* Альтернативный способ - если используются spans или другие элементы с текстом */
    .actions .btn span:not(.icon):not([class*="bi"]):not([class*="fa"]) {
        display: none !important;
    }
    
    /* Компактные размеры кнопок только с иконками */
    .actions .btn {
        width: 28px !important;
        height: 28px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

/* На мобильных можно оставить текст или тоже убрать */
@media (max-width: 1023.98px) {
    .actions .btn {
        width: 24px !important;
        height: 24px !important;
        font-size: 0 !important;
    }
    
    .actions .btn i {
        font-size: 0.5rem !important;
    }
    
    .actions .btn .btn-text {
        display: none !important;
    }
}

/* ===== КАНБАН ДОСКА ===== */

#board-container {
    width: 100%;
}


.board-wrapper {
    width: 100%;
    overflow-x: auto;
    padding: 0.5rem 0 1rem;
    -webkit-overflow-scrolling: touch;
    display: flex;
    justify-content: center;
}

.kanban-board {
    display: flex;
    gap: 1rem;
    align-items: stretch;
    flex-wrap: nowrap;
    padding: 0 0.25rem;
}

.kanban-column {
    flex: 0 0 220px;
    width: 220px;
    background: #f1f4f2;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 220px);
    min-height: 300px;
}

.kanban-column-header {
    padding: 0.65rem 1rem;
    border-radius: 10px 10px 0 0;
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    color: #fff;
}

.kanban-column-header .col-icon {
    font-size: 1rem;
}

.kanban-column-count {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: 1px 9px;
    font-size: 0.8rem;
    font-weight: 700;
}

.kanban-column-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-radius: 0 0 10px 10px;
    transition: background 0.15s;
}

.kanban-column-body.drag-over {
    background: rgba(26, 122, 66, 0.08);
    outline: 2px dashed var(--color-primary);
    outline-offset: -3px;
}

.kanban-placeholder {
    margin: 4px 0;
    padding: 0.5rem 0.75rem;
    border: 2px dashed #7C3AED;
    border-radius: 8px;
    background: rgba(124, 58, 237, 0.06);
    color: #7C3AED;
    font-style: italic;
    font-size: 0.78rem;
    text-align: center;
    pointer-events: none;
}

.kanban-empty {
    text-align: center;
    color: #aaa;
    font-size: 0.8rem;
    padding: 1.5rem 0.5rem;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kanban-card {
    background: #fff;
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
    border: 1px solid rgba(0, 0, 0, 0.06);
    user-select: none;
}

.kanban-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.13);
    transform: translateY(-2px);
}

.kanban-card.dragging {
    opacity: 0.45;
    cursor: grabbing;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.kanban-card-name {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-card-phone {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: 0.3rem;
}

.kanban-card-products {
    font-size: 0.78rem;
    color: #555;
    margin-bottom: 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-card-price {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--color-primary);
}

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.4rem;
    gap: 0.25rem;
}

.kanban-card-manager {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50%;
}

.kanban-card-date {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.kanban-card-comment {
    font-size: 0.75rem;
    color: #888;
    font-style: italic;
    margin-top: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Цвета заголовков колонок по статусу */
.kanban-col-new        { background: #3b82f6; }
.kanban-col-processing { background: #f59e0b; }
.kanban-col-paid       { background: #10b981; }
.kanban-col-shipping   { background: #8b5cf6; }
.kanban-col-done       { background: #059669; }
.kanban-col-cancelled  { background: #ef4444; }

/* Скроллбар в колонке */
.kanban-column-body::-webkit-scrollbar {
    width: 4px;
}
.kanban-column-body::-webkit-scrollbar-track {
    background: transparent;
}
.kanban-column-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}
.kanban-column-body::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* ── Toast-уведомления ────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 300px;
}

.app-toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.35;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(16px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    border: 1px solid transparent;
}

.app-toast--in  { opacity: 1; transform: translateX(0); }
.app-toast--out { opacity: 0; transform: translateX(16px); }

.app-toast--success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.app-toast--info    { background: #f0f9ff; color: #075985; border-color: #bae6fd; }
.app-toast--warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.app-toast--danger,
.app-toast--error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

.app-toast__icon { font-size: 0.85rem; flex-shrink: 0; }
.app-toast__msg  { flex: 1; }

.app-toast__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    background: none;
    opacity: 0.5;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    font-size: 0.85rem;
    color: inherit;
    border-radius: 4px;
    transition: opacity 0.15s;
}
.app-toast__close:hover { opacity: 1; }

/* Настройки доски */
#board-statuses-list .table th,
#board-statuses-list .table td {
    vertical-align: middle;
    padding: 0.4rem 0.5rem;
}
#board-statuses-list .board-status-key {
    font-family: monospace;
    font-size: 0.82rem;
    color: #555;
}

/* ═══════════════════════════════════════════════════════════════
   НАСТРОЙКИ — MODERN SIDEBAR LAYOUT
   ═══════════════════════════════════════════════════════════════ */

/* Диалог — увеличенный, без скруглений снизу */
.settings-modal-dialog {
    max-width: 860px;
    height: calc(100vh - 80px);
    max-height: 700px;
    margin: 40px auto;
}

.settings-modal-content {
    display: flex;
    flex-direction: row;
    height: 100%;
    border-radius: 14px;
    overflow: visible;
    border: none;
    box-shadow: 0 24px 64px rgba(0,0,0,0.18);
}

/* ── Sidebar ── */
.settings-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #f7f8fa;
    border-right: 1px solid #e8eaed;
    display: flex;
    flex-direction: column;
    border-radius: 14px 0 0 14px;
    overflow: hidden;
}

.settings-sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 1.25rem 1.1rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: 0.02em;
    border-bottom: 1px solid #e8eaed;
}

.settings-sidebar-header i {
    font-size: 1rem;
    color: #6366f1;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0.6rem;
    gap: 2px;
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.8rem;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #555;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: left;
    width: 100%;
}

.settings-nav-item i {
    font-size: 1rem;
    opacity: 0.7;
    flex-shrink: 0;
}

.settings-nav-item:hover {
    background: #eff0f3;
    color: #1a1a2e;
}

.settings-nav-item.active {
    background: #ebe9ff;
    color: #4f46e5;
    font-weight: 600;
}

.settings-nav-item.active i {
    opacity: 1;
}

/* ── Body ── */
.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 2rem 1.5rem;
    position: relative;
    background: #fff;
    border-radius: 0 14px 14px 0;
}

.settings-close {
    position: absolute;
    top: 1.1rem;
    right: 1.1rem;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.settings-close:hover {
    opacity: 1;
}

/* ── Panes ── */
.settings-pane {
    display: none;
    animation: fadeInPane 0.18s ease;
}

.settings-pane.active {
    display: block;
}

@keyframes fadeInPane {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ── */
.settings-pane-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f0f0f3;
}

.settings-pane-header h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-pane-header h4 i {
    color: #6366f1;
    font-size: 1.05rem;
}

.settings-pane-header p {
    font-size: 0.8rem;
    color: #888;
    margin: 0;
}

/* ── Sections ── */
.settings-section {
    margin-bottom: 1.5rem;
}

.settings-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #aaa;
    margin-bottom: 0.75rem;
}

/* ── Add user button ── */
.btn-add-user {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    border: 1.5px dashed #c5c8d4;
    background: transparent;
    color: #5a5e72;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.btn-add-user:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: #f3f2ff;
}

/* ── Form card ── */
.settings-form-card {
    background: #f9fafb;
    border: 1px solid #e8eaed;
    border-radius: 10px;
    padding: 1.25rem;
}

.settings-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.3rem;
    display: block;
    letter-spacing: 0.01em;
}

.settings-input {
    display: block;
    width: 100%;
    padding: 0.45rem 0.75rem;
    border: 1.5px solid #e0e3ea;
    border-radius: 7px;
    font-size: 0.875rem;
    background: #fff;
    color: #1a1a2e;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.settings-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.settings-input.input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239,68,68,0.12) !important;
}

.field-hint {
    font-size: 0.72rem;
    min-height: 1rem;
    margin-top: 3px;
    line-height: 1.3;
}

.req-star {
    color: #ef4444;
    font-size: 0.75rem;
}

/* ── Buttons ── */
.btn-settings-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.btn-settings-primary:hover {
    background: #4f46e5;
}

.btn-settings-primary:active {
    transform: scale(0.97);
}

.btn-settings-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: transparent;
    color: #666;
    border: 1.5px solid #e0e3ea;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-settings-ghost:hover {
    background: #f4f5f8;
    border-color: #bcc0ce;
    color: #333;
}

/* ── Manager rows ── */
.manager-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.75rem;
    border-radius: 9px;
    border: 1px solid #f0f0f3;
    background: #fff;
    margin-bottom: 0.4rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.manager-row:hover {
    border-color: #e0e3ea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.manager-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: 0.03em;
}

.manager-info {
    flex: 1;
    min-width: 0;
}

.manager-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.manager-role {
    font-size: 0.72rem;
    color: #aaa;
    margin-top: 1px;
}

.manager-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2px;
    flex-wrap: wrap;
}

.manager-role-badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.manager-email {
    font-size: 0.72rem;
    color: #94a3b8;
}

.manager-actions {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}

.manager-delete-btn,
.manager-edit-btn {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    border: 1px solid transparent;
    background: transparent;
    color: #bbb;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.manager-delete-btn:hover {
    background: #fff0f0;
    border-color: #ffd0d0;
    color: #ef4444;
}

.manager-edit-btn:hover {
    background: #f0f4ff;
    border-color: #c7d2fe;
    color: #6366f1;
}

/* ── Inline edit form for manager ── */
.manager-edit-form {
    background: #f8f9fc;
    border: 1px solid #e8eaf0;
    border-radius: 9px;
    padding: 0.7rem 0.75rem 0.65rem;
    margin-bottom: 0.5rem;
    margin-top: -0.15rem;
}

.medit-fields {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.medit-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 130px;
}

.medit-col .settings-input {
    width: 100%;
}

.medit-btns {
    display: flex;
    gap: 0.5rem;
}

/* ── Stats ── */
.settings-stat-row {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0 0.25rem;
}

.settings-stat {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

.settings-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a2e;
}

.settings-stat-label {
    font-size: 0.78rem;
    color: #aaa;
}

/* ── Loading / empty ── */
.settings-loading {
    padding: 1.5rem;
    text-align: center;
    color: #aaa;
    font-size: 0.85rem;
}

.settings-empty {
    padding: 1.5rem;
    text-align: center;
    color: #bbb;
    font-size: 0.85rem;
}

/* ── Info grid (general tab) ── */
.settings-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.settings-info-item {
    background: #f7f8fa;
    border: 1px solid #ebebee;
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.settings-info-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #aaa;
    margin-bottom: 0.3rem;
}

.settings-info-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a2e;
}

/* ── Scrollbar in body ── */
.settings-body::-webkit-scrollbar {
    width: 5px;
}
.settings-body::-webkit-scrollbar-track {
    background: transparent;
}
.settings-body::-webkit-scrollbar-thumb {
    background: #e0e0e5;
    border-radius: 4px;
}

/* ── Board settings table ── */
#board-statuses-list table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

#board-statuses-list thead th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #aaa;
    font-weight: 700;
    padding: 0.4rem 0.6rem 0.7rem;
    border-bottom: 1px solid #f0f0f3;
    text-align: left;
}

#board-statuses-list tbody tr:hover {
    background: #fafbff;
}

#board-statuses-list tbody td {
    padding: 0.5rem 0.5rem;
    vertical-align: middle;
    border-bottom: 1px solid #f5f5f8;
}

#board-statuses-list .settings-input {
    padding: 0.35rem 0.6rem;
    font-size: 0.82rem;
}

#board-statuses-list .board-status-key {
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: #6366f1;
}

/* ── Dashboard settings table ── */
#dashboard-statuses-list table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

#dashboard-statuses-list thead th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #aaa;
    font-weight: 700;
    padding: 0.4rem 0.6rem 0.7rem;
    border-bottom: 1px solid #f0f0f3;
    text-align: left;
}

#dashboard-statuses-list tbody tr:hover {
    background: #fafbff;
}

#dashboard-statuses-list tbody td {
    padding: 0.5rem 0.5rem;
    vertical-align: middle;
    border-bottom: 1px solid #f5f5f8;
}

#dashboard-statuses-list .settings-input {
    padding: 0.35rem 0.6rem;
    font-size: 0.82rem;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .settings-modal-dialog {
        margin: 10px;
        max-width: 100%;
        height: calc(100vh - 20px);
        max-height: none;
    }
    .settings-sidebar {
        width: 52px;
    }
    .settings-sidebar-header span,
    .settings-nav-item span {
        display: none;
    }
    .settings-sidebar-header {
        justify-content: center;
        padding: 1rem 0.5rem;
    }
    .settings-nav-item {
        justify-content: center;
        padding: 0.6rem;
    }
    .settings-body {
        padding: 1.25rem 1rem;
    }
    .settings-info-grid {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════════════════
   APP HEADER — MODERN TOPBAR
   ═══════════════════════════════════════════════════════════════ */

.app-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: #fff;
    border-bottom: 1px solid #e8eaed;
    box-shadow: 0 1px 0 #e8eaed;
}

.app-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
}

/* Разделитель между логотипом и навигацией */
.hdr-separator {
    width: 1px;
    height: 22px;
    background: #e8eaed;
    flex-shrink: 0;
    margin: 0 0.25rem;
}

.app-header-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 56px;
    padding: 0 1.25rem;
}

/* Логотип */
.app-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 800;
    color: #1a1a2e;
    letter-spacing: -0.02em;
    flex-shrink: 0;
    text-decoration: none;
    margin-right: 0.5rem;
}

.app-logo i {
    color: #6366f1;
    font-size: 1.2rem;
}

/* Центральные действия */
.app-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

/* Обычная кнопка хедера */
.hdr-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.38rem 0.85rem;
    border-radius: 8px;
    border: 1.5px solid transparent;
    background: transparent;
    color: #555;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.13s, color 0.13s, border-color 0.13s;
    white-space: nowrap;
}

.hdr-btn:hover {
    background: #f3f4f6;
    color: #1a1a2e;
}

.hdr-btn.active {
    background: #ebe9ff;
    color: #4f46e5;
    border-color: #c7d2fe;
}

/* Кнопка «Новый заказ» — акцентная */
.hdr-btn-primary {
    background: #6366f1;
    color: #fff !important;
    border-color: #6366f1;
}

.hdr-btn-primary:hover {
    background: #4f46e5 !important;
    color: #fff !important;
    border-color: #4f46e5;
}

/* Правая часть */
.app-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

/* Поиск в хедере */
.hdr-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.hdr-search-icon {
    position: absolute;
    left: 0.6rem;
    color: #aaa;
    font-size: 0.8rem;
    pointer-events: none;
}

.hdr-search {
    padding: 0.38rem 0.75rem 0.38rem 1.9rem;
    border: 1.5px solid #e0e3ea;
    border-radius: 8px;
    font-size: 0.875rem;
    background: #f7f8fa;
    color: #1a1a2e;
    width: 200px;
    transition: border-color 0.15s, box-shadow 0.15s, width 0.2s;
    outline: none;
}

.hdr-search:focus {
    border-color: #6366f1;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
    width: 260px;
}

/* Тоггл «только мои записи» */
.hdr-my-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    user-select: none;
    padding: 4px 6px;
    border-radius: 8px;
    transition: background 0.13s;
}

.hdr-my-toggle:hover {
    background: #f3f4f6;
}

.hdr-my-toggle input {
    display: none;
}

.hdr-my-track {
    position: relative;
    width: 32px;
    height: 18px;
    background: #d1d5db;
    border-radius: 9px;
    flex-shrink: 0;
    transition: background 0.2s;
}

.hdr-my-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.hdr-my-toggle input:checked ~ .hdr-my-track {
    background: #6366f1;
}

.hdr-my-toggle input:checked ~ .hdr-my-track .hdr-my-thumb {
    transform: translateX(14px);
}

.hdr-my-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
    transition: color 0.15s;
}

.hdr-my-toggle:has(input:checked) .hdr-my-label {
    color: #4f46e5;
}

/* Вертикальный разделитель */
.hdr-separator-v {
    width: 1px;
    height: 28px;
    background: #e5e7eb;
    margin: 0 4px;
    flex-shrink: 0;
}

/* Профиль пользователя в хедере */
.hdr-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 10px;
    cursor: default;
    transition: background 0.13s;
}

.hdr-profile:hover {
    background: #f3f4f6;
}

.hdr-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hdr-profile-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1;
}

.hdr-profile-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hdr-profile-role {
    font-size: 0.67rem;
    color: #94a3b8;
    white-space: nowrap;
}

/* Иконочные кнопки справа */
.hdr-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1.5px solid transparent;
    background: transparent;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.13s, color 0.13s, border-color 0.13s;
    flex-shrink: 0;
}

.hdr-icon-btn:hover {
    background: #f3f4f6;
    color: #1a1a2e;
    border-color: #e0e3ea;
}

.hdr-icon-btn--danger:hover {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

/* ── Support button ─────────────────────────────────────── */
.hdr-support-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 32px;
    padding: 0 0.75rem;
    border-radius: 8px;
    border: 1.5px solid #ddd6fe;
    background: #f5f3ff;
    color: #6D28D9;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    flex-shrink: 0;
    white-space: nowrap;
}
.hdr-support-btn:hover {
    background: #ede9fe;
    border-color: #c4b5fd;
    color: #4C1D95;
}
.hdr-support-btn i { font-size: 0.85rem; }

/* ── Support modal ──────────────────────────────────────── */
.support-modal-content {
    border-radius: 16px;
    border: none;
    overflow: hidden;
}

.support-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 1rem;
    background: linear-gradient(135deg, #4C1D95 0%, #7C3AED 100%);
}

.support-modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.support-modal-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
}

.support-modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
}

.support-modal-sub {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.65);
    margin-top: 1px;
}

.support-close-btn {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: background 0.15s;
    flex-shrink: 0;
}
.support-close-btn:hover { background: rgba(255,255,255,0.25); }

.support-contacts {
    display: flex;
    gap: 1rem;
    padding: 0.875rem 1.5rem 0;
}

.support-contact-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: #475569;
}

.support-contact-item i { color: #7C3AED; font-size: 0.9rem; }
.support-contact-item a { color: #7C3AED; font-weight: 600; text-decoration: none; }
.support-contact-item a:hover { text-decoration: underline; }

.support-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.72rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.support-divider::before,
.support-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.support-quiz {
    padding: 0 1.5rem 1.5rem;
}

.support-step-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.75rem;
}

/* Topic cards */
.support-topic-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.support-topic-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.875rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    background: white;
}

.support-topic-card:hover {
    border-color: #c4b5fd;
    background: #faf5ff;
}

.support-topic-card.selected {
    border-color: #7C3AED;
    background: #f5f3ff;
}

.support-topic-icon { font-size: 1.15rem; flex-shrink: 0; }

.support-topic-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
}

/* Subtopic list */
.support-subtopic-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.support-subtopic-item {
    padding: 0.6rem 0.875rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s;
    background: white;
}

.support-subtopic-item:hover {
    border-color: #c4b5fd;
    background: #faf5ff;
    color: #6D28D9;
}

.support-subtopic-item.selected {
    border-color: #7C3AED;
    background: #f5f3ff;
    color: #6D28D9;
}

/* Breadcrumb */
.support-breadcrumb {
    font-size: 0.75rem;
    color: #7C3AED;
    font-weight: 600;
    background: #f5f3ff;
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    margin-bottom: 0.75rem;
}

/* Textarea */
.support-textarea {
    width: 100%;
    min-height: 100px;
    max-height: 180px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: #1e293b;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    margin-bottom: 0.75rem;
}

.support-textarea:focus {
    border-color: #7C3AED;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}

/* Actions */
.support-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.support-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: #94a3b8;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
    transition: color 0.15s;
}
.support-back-btn:hover { color: #475569; }

.support-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 36px;
    padding: 0 1.25rem;
    background: linear-gradient(145deg, #4C1D95, #7C3AED);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
}
.support-submit-btn:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.support-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Done state */
.support-done {
    text-align: center;
    padding: 0.5rem 0 0.25rem;
}

.support-done-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.support-done-title { font-size: 1.1rem; font-weight: 700; color: #1e293b; margin-bottom: 0.4rem; }
.support-done-desc { font-size: 0.85rem; color: #475569; line-height: 1.55; }

/* ── Stat bar ── */
.stat-bar {
    display: flex;
    align-items: center;
    background: #fff;
    border-bottom: 1px solid #e8eaed;
    padding: 10px 1rem;
    gap: 0;
    min-height: 90px;
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
    margin-bottom: 0;
}

.stat-bar::-webkit-scrollbar {
    display: none;
}

.stat-bar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 10px 14px;
    cursor: default;
    flex-shrink: 0;
}

/* Кликабельные фильтр-элементы */
.stat-filter-item {
    cursor: pointer;
    border-radius: 10px;
    border: 2px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
    user-select: none;
    position: relative;
}

.stat-filter-item:hover {
    background: #f4f5f8;
}

.stat-filter-item.active {
    border-color: var(--stat-accent, #6366f1);
    background: color-mix(in srgb, var(--stat-accent, #6366f1) 8%, #ffffff);
}

/* Fallback для браузеров без color-mix */
@supports not (color: color-mix(in srgb, red 8%, white)) {
    .stat-filter-item.active {
        background: #eef0ff;
    }
}

.stat-filter-item.active .stat-bar-value {
    color: var(--stat-accent, #6366f1);
}

.stat-filter-item:active {
    transform: scale(0.97);
}

/* Отделяем сумму от фильтров */
.stat-bar-spacer {
    flex: 1;
    min-width: 12px;
}

.stat-bar-revenue {
    flex-shrink: 0;
}

.stat-bar-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 4px;
}

.stat-bar-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-bar-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.1;
    transition: color 0.15s;
}

.stat-bar-label {
    font-size: 0.68rem;
    color: #aaa;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* Мини-спарклайн под каждым статусом */
.stat-sparkline-wrap {
    margin-top: 5px;
    cursor: pointer;
    border-radius: 4px;
    transition: opacity 0.15s, transform 0.12s;
    opacity: 0.7;
    min-width: 64px;
    height: 20px;
    position: relative;
}

.stat-sparkline-wrap:hover {
    opacity: 1;
    transform: scaleY(1.1);
}

.stat-sparkline-wrap svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Tooltip на спарклайне */
.stat-sparkline-wrap::after {
    content: 'Подробный график';
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26,26,46,0.88);
    color: #fff;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.65rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 200;
}

.stat-sparkline-wrap:hover::after {
    opacity: 1;
}

.stat-bar-divider {
    width: 1px;
    height: 40px;
    background: #e8eaed;
    flex-shrink: 0;
    margin: 0 2px;
    align-self: center;
}

/* ══════════════════════════════════════════════════════════════
   МОДАЛКА ГРАФИКА СТАТУСА
   ══════════════════════════════════════════════════════════════ */

.status-chart-modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.status-chart-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid #f0f0f3;
}

.status-chart-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    margin: 0;
}

.status-chart-modal-body {
    padding: 1.5rem;
}

/* Кнопки периода */
.chart-period-group {
    display: flex;
    gap: 6px;
    margin-bottom: 1.25rem;
}

.chart-period-btn {
    padding: 5px 14px;
    border-radius: 20px;
    border: 1.5px solid #e0e3ea;
    background: transparent;
    color: #666;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    outline: none;
}

.chart-period-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: #f3f2ff;
}

.chart-period-btn.active {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

.status-chart-wrap {
    position: relative;
    height: 280px;
}

.status-chart-wrap canvas {
    width: 100% !important;
}

/* Статистика под графиком */
.status-chart-footer {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f3;
}

.chart-stat-item {
    font-size: 0.8rem;
    color: #888;
    font-weight: 500;
}

/* ── Responsive header ── */
@media (max-width: 900px) {
    .hdr-profile-info {
        display: none;
    }
    .hdr-profile {
        padding: 4px;
    }
    .hdr-separator-v {
        display: none;
    }
    .hdr-my-label {
        display: none;
    }
    .hdr-my-toggle {
        padding: 4px;
    }
    .hdr-btn span {
        display: none;
    }
    .hdr-btn {
        width: 36px;
        height: 36px;
        padding: 0;
        justify-content: center;
        border-radius: 8px;
    }
    .hdr-btn-primary {
        width: auto;
        padding: 0.38rem 0.75rem;
    }
    .hdr-btn-primary span {
        display: none;
    }
    .hdr-btn-primary {
        width: 36px;
        padding: 0;
        justify-content: center;
    }
    .hdr-search {
        width: 140px;
    }
    .hdr-search:focus {
        width: 180px;
    }
}

@media (max-width: 600px) {
    .app-header-inner {
        padding: 0 0.75rem;
        gap: 0.25rem;
    }
    .hdr-search-wrap {
        display: none;
    }
    .stat-bar {
        padding: 0 0.5rem;
        min-height: 80px;
    }
    .stat-bar-item {
        padding: 8px 10px;
        flex-shrink: 0;
    }
    .stat-bar-value {
        font-size: 1.05rem;
    }
    .stat-bar-icon {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }
    .stat-bar-label {
        display: none;
    }
    .stat-sparkline-wrap {
        min-width: 50px;
    }
}

/* Убираем старые стили хедера, добавляем отступ к контенту */
body > .container-fluid,
body .container-fluid:not(.modal .container-fluid) {
    padding-top: 1.75rem;
}

/* ── Футер таблицы (инфо + пагинация + выбор страницы) ── */
.tbl-footer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.25rem 0.4rem;
    gap: 12px;
    flex-wrap: wrap;
}

.tbl-footer-info {
    font-size: 0.78rem;
    color: #94a3b8;
    white-space: nowrap;
    min-width: 140px;
}

.tbl-footer-perpage {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 140px;
    justify-content: flex-end;
}

.tbl-footer-perpage-label {
    font-size: 0.78rem;
    color: #94a3b8;
    white-space: nowrap;
}

.tbl-footer-perpage-select {
    border: 1.5px solid #e2e8f0;
    border-radius: 7px;
    padding: 3px 8px;
    font-size: 0.78rem;
    color: #374151;
    background: #f8fafc;
    cursor: pointer;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s;
}
.tbl-footer-perpage-select:focus { border-color: #6366f1; }

/* ── Пагинация (заказы + склад) ── */
#pagination-container,
#wh-pagination-container {
    padding: 0;
}

#pagination,
#wh-pagination {
    gap: 3px;
    margin-bottom: 0;
}

/* Все элементы */
#pagination .page-item .page-link,
#pagination .page-item span.page-link,
#wh-pagination .page-item .page-link,
#wh-pagination .page-item span.page-link {
    border: none !important;
    border-radius: 8px !important;
    min-width: 34px;
    height: 34px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 500;
    color: #374151;
    background: transparent;
    padding: 0 8px;
    transition: background 0.13s, color 0.13s;
    line-height: 1;
    box-shadow: none !important;
}

/* Hover */
#pagination .page-item:not(.active):not(.disabled) .page-link:hover,
#wh-pagination .page-item:not(.active):not(.disabled) .page-link:hover {
    background: #f1f5f9;
    color: #1e1b4b;
}

/* Активная страница */
#pagination .page-item.active .page-link,
#wh-pagination .page-item.active .page-link {
    background: #6366f1 !important;
    color: #fff !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(99,102,241,0.28) !important;
}

/* Многоточие и disabled */
#pagination .page-item.disabled span.page-link,
#pagination .page-item.disabled .page-link,
#wh-pagination .page-item.disabled span.page-link,
#wh-pagination .page-item.disabled .page-link {
    color: #cbd5e1 !important;
    background: transparent !important;
    cursor: default;
}

/* Стрелки чуть крупнее */
#pagination .page-item:first-child .page-link,
#pagination .page-item:last-child .page-link,
#wh-pagination .page-item:first-child .page-link,
#wh-pagination .page-item:last-child .page-link {
    font-size: 1rem;
    font-weight: 400;
    color: #6b7280;
}
#pagination .page-item:first-child:not(.disabled) .page-link:hover,
#pagination .page-item:last-child:not(.disabled) .page-link:hover,
#wh-pagination .page-item:first-child:not(.disabled) .page-link:hover,
#wh-pagination .page-item:last-child:not(.disabled) .page-link:hover {
    background: #ede9fe;
    color: #4f46e5;
}

/* ── Справочники: сетка валют ── */
.settings-section-desc {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-bottom: 0.75rem;
    margin-top: -0.25rem;
}

.ref-currency-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ref-currency-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 88px;
    padding: 10px 8px;
    border: 1.5px solid #e0e3ea;
    border-radius: 10px;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.13s, background 0.13s, box-shadow 0.13s;
    user-select: none;
}

.ref-currency-card:hover {
    border-color: #a5b4fc;
    background: #f5f3ff;
}

.ref-currency-card.active {
    border-color: #6366f1;
    background: #eef2ff;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.ref-currency-symbol {
    font-size: 1.2rem;
    font-weight: 700;
    color: #4f46e5;
    line-height: 1;
    margin-bottom: 3px;
}

.ref-currency-card.active .ref-currency-symbol { color: #4338ca; }

.ref-currency-code {
    font-size: 0.78rem;
    font-weight: 700;
    color: #374151;
    letter-spacing: 0.04em;
}

.ref-currency-name {
    font-size: 0.62rem;
    color: #94a3b8;
    text-align: center;
    margin-top: 2px;
    line-height: 1.2;
}

/* Пресеты телефона */
.ref-phone-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 0.5rem;
}

.ref-phone-preset {
    background: transparent;
    border: 1.5px solid #e0e3ea;
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 0.78rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: background 0.13s, border-color 0.13s, color 0.13s;
}

.ref-phone-preset:hover {
    background: #f5f3ff;
    border-color: #a5b4fc;
}

.ref-phone-preset.active {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

/* ── Попап профиля ── */
.profile-popup {
    position: fixed;
    top: 58px;
    right: 12px;
    width: 280px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    z-index: 2000;
    overflow: hidden;
    animation: ppFadeIn 0.15s ease;
}

@keyframes ppFadeIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.profile-popup-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px 14px;
}

.profile-popup-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

.profile-popup-meta {
    min-width: 0;
}

.profile-popup-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-popup-sub {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-popup-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 0;
}

.profile-popup-body {
    padding: 14px 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pp-field-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pp-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pp-input {
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 0.875rem;
    color: #1e293b;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
    width: 100%;
}

.pp-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.profile-popup-footer {
    display: flex;
    gap: 8px;
    padding: 10px 16px 14px;
}

.pp-btn-primary {
    flex: 1;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: background 0.13s;
    font-family: inherit;
}

.pp-btn-primary:hover { background: #4f46e5; }

.pp-btn-ghost {
    background: transparent;
    color: #64748b;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.13s, border-color 0.13s;
    font-family: inherit;
}

.pp-btn-ghost:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* ── Футер ── */
.app-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 1.5rem;
    font-size: 0.72rem;
    color: #94a3b8;
    border-top: 1px solid #f0f2f5;
    background: #fff;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    text-align: center;
}

.app-footer strong {
    color: #6366f1;
    font-weight: 600;
}

.app-footer-sep {
    color: #cbd5e1;
    font-size: 0.8rem;
}

/* ── Business-type selector (Общие настройки) ── */
.ref-business-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ref-business-card {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 10px 16px;
    border: 1.5px solid #e0e3ea;
    border-radius: 10px;
    cursor: pointer;
    background: #fff;
    min-width: 150px;
    transition: border-color 0.13s, background 0.13s, box-shadow 0.13s;
    user-select: none;
}

.ref-business-card:hover {
    border-color: #a5b4fc;
    background: #f5f3ff;
}

.ref-business-card.active {
    border-color: #7C3AED;
    background: #f5f3ff;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}

/* Read-only state — no hover, no pointer */
.ref-business-card--readonly {
    cursor: default;
    pointer-events: none;
    opacity: 0.72;
}

.ref-business-card--readonly.active {
    opacity: 1;
}

/* ── Billing / Subscription pane ── */
.billing-plan-card {
    border: 1.5px solid #e0e3ea;
    border-radius: 12px;
    padding: 1rem 1.1rem;
    background: linear-gradient(135deg, #f8f5ff 0%, #fff 100%);
    margin-bottom: 1.25rem;
}

.billing-plan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.billing-plan-name {
    font-size: 1rem;
    font-weight: 700;
    color: #1e1b4b;
    text-transform: capitalize;
}

.billing-plan-trial {
    font-size: 0.78rem;
    color: #7C3AED;
    margin-top: 2px;
    font-weight: 500;
}

.billing-plan-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    background: #dcfce7;
    color: #15803d;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid #bbf7d0;
}

.billing-limits {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.billing-limit-row {}

.billing-limit-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.billing-limit-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #374151;
}

.billing-limit-value {
    font-size: 0.78rem;
    font-weight: 600;
    color: #6366f1;
}

.billing-limit-bar {
    height: 6px;
    background: #f1f5f9;
    border-radius: 99px;
    overflow: hidden;
}

.billing-limit-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.4s ease;
}

.billing-contact {
    font-size: 0.78rem;
    color: #94a3b8;
    border-top: 1px solid #f0f2f5;
    padding-top: 0.75rem;
}

.billing-contact a {
    color: #7C3AED;
    text-decoration: none;
    font-weight: 500;
}

.billing-contact a:hover { text-decoration: underline; }

/* ── Billing redesign ── */
.billing-current-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border: 1.5px solid #e8eaf0;
    border-radius: 12px;
    background: linear-gradient(135deg,#f8f5ff 0%,#fff 100%);
    margin-bottom: 1rem;
}

.billing-current-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.billing-current-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.billing-current-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e1b4b;
}

.billing-current-sub {
    font-size: 0.75rem;
    color: #7C3AED;
    font-weight: 500;
    margin-top: 1px;
}

.billing-usage-block {
    background: #f8f9fc;
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    margin-bottom: 1.25rem;
}

.billing-usage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.billing-usage-label { font-size: 0.78rem; color: #64748b; }
.billing-usage-val   { font-size: 0.78rem; font-weight: 600; color: #7C3AED; }

.billing-plans-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.65rem;
}

.billing-plans-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.billing-plan-tile {
    position: relative;
    border: 1.5px solid #e8eaf0;
    border-radius: 12px;
    padding: 0.85rem 0.9rem 0.8rem;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.billing-plan-tile.current {
    border-color: #7C3AED;
    background: #faf8ff;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.08);
}

.billing-plan-tile.popular {
    border-color: #a78bfa;
}

.billing-popular-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg,#7C3AED,#6366f1);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: 0.04em;
}

.billing-tile-icon {
    font-size: 1.3rem;
    line-height: 1;
    margin-bottom: 2px;
}

.billing-tile-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e1b4b;
}

.billing-tile-tagline {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-bottom: 0.35rem;
}

.billing-tile-features {
    list-style: none;
    padding: 0;
    margin: 0 0 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.billing-tile-features li {
    display: flex;
    align-items: baseline;
    gap: 5px;
    font-size: 0.72rem;
    color: #475569;
}

.billing-tile-features li i {
    color: #7C3AED;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.billing-tile-current-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #7C3AED;
    margin-top: auto;
}

.billing-tile-upgrade-btn {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    padding: 5px 10px;
    border: 1.5px solid #e8eaf0;
    border-radius: 7px;
    background: #f8f9fc;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: not-allowed;
}

.billing-tile-contact-btn {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    padding: 5px 10px;
    border: 1.5px solid #7C3AED;
    border-radius: 7px;
    background: transparent;
    color: #7C3AED;
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.13s;
}

.billing-tile-contact-btn:hover {
    background: #f5f3ff;
    color: #7C3AED;
}

/* ── Workspace pane ── */
.ws-info-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border: 1.5px solid #e8eaf0;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8f5ff 0%, #fff 100%);
    margin-bottom: 1.5rem;
}

.ws-info-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #7C3AED 0%, #6366f1 100%);
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.03em;
}

.ws-info-main {
    flex: 1;
    min-width: 0;
}

.ws-info-name {
    font-size: 1rem;
    font-weight: 700;
    color: #1e1b4b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ws-info-slug {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 2px;
    font-family: 'Courier New', monospace;
}

.ws-info-status {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.ws-info-status.active {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.ws-info-status.inactive {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.ws-details-grid {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ws-detail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0;
    border-bottom: 1px solid #f8f9fc;
}

.ws-detail-item:last-child { border-bottom: none; }

.ws-detail-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    color: #64748b;
}

.ws-detail-label i { font-size: 0.85rem; color: #94a3b8; }

.ws-detail-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e1b4b;
}

.ws-add-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border: 1.5px solid #e8eaf0;
    border-radius: 10px;
    background: #fafbfc;
    flex-wrap: wrap;
}

.ws-add-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e1b4b;
    margin-bottom: 2px;
}

.ws-add-desc {
    font-size: 0.75rem;
    color: #94a3b8;
    max-width: 280px;
    line-height: 1.4;
}

.ws-add-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Icon Picker ── */
.icon-picker-modal-content {
    border: none;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.18);
}

.icon-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.85rem;
    border-bottom: 1px solid #f0f2f5;
    background: #fafbfc;
}

.icon-picker-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e1b4b;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.icon-picker-title i {
    color: #7C3AED;
}

.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 1rem 1.1rem 1.25rem;
    max-height: 360px;
    overflow-y: auto;
}

.icon-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px 6px;
    border: 1.5px solid transparent;
    border-radius: 9px;
    background: transparent;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    color: #374151;
}

.icon-picker-item i {
    font-size: 1.25rem;
    line-height: 1;
}

.icon-picker-item span {
    font-size: 0.55rem;
    color: #94a3b8;
    text-align: center;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 48px;
}

.icon-picker-item:hover {
    background: #f5f3ff;
    border-color: #ddd6fe;
    color: #7C3AED;
}

.icon-picker-item.active {
    background: #ede9fe;
    border-color: #7C3AED;
    color: #7C3AED;
}

/* Кнопка-триггер иконки в таблице */
.icon-picker-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1.5px solid #e8eaf0;
    background: #f8f9fc;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.icon-picker-trigger:hover {
    background: #f0ecff;
    border-color: #c4b5fd;
}

/* Таблица дашборда настроек */
.dash-settings-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.dash-settings-table th {
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 0.5rem 0.6rem;
    border-bottom: 1.5px solid #f0f2f5;
}

.dash-settings-table td {
    padding: 0.5rem 0.5rem;
    vertical-align: middle;
    border-bottom: 1px solid #f8f9fc;
}

/* ── Workspace Switcher (header) ── */
.ws-switcher {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 6px;
}

.ws-dot {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 2px solid transparent;
    background: #f0f1f5;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .13s, border-color .13s, box-shadow .13s;
    padding: 0;
    flex-shrink: 0;
}

.ws-dot:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(124,58,237,.2);
}

.ws-dot--active {
    border-color: #7C3AED;
    box-shadow: 0 0 0 2px rgba(124,58,237,.2);
    cursor: default;
}

.ws-dot--active:hover {
    transform: none;
}

.ws-dot--add {
    background: #f5f3ff;
    border-color: #e9e4fb;
    border-style: dashed;
}

.ws-dot--add:hover {
    background: #ede9fe;
    border-color: #7C3AED;
}

/* ── Workspace settings: logo upload ── */
.ws-logo-upload-wrap {
    position: relative;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
}

.ws-logo-upload-wrap .ws-info-avatar {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: opacity .15s;
    overflow: hidden;
}

.ws-logo-upload-wrap:hover .ws-info-avatar {
    opacity: .75;
}

.ws-logo-overlay {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: rgba(124,58,237,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .9rem;
    opacity: 0;
    transition: opacity .15s;
    pointer-events: none;
}

.ws-logo-upload-wrap:hover .ws-logo-overlay {
    opacity: 1;
}

/* ── Workspace name inline edit ── */
.ws-name-edit-row {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.ws-name-input {
    font-size: .95rem;
    font-weight: 700;
    color: #1e293b;
    border: 1.5px solid transparent;
    border-radius: 7px;
    padding: .25rem .5rem;
    background: transparent;
    outline: none;
    min-width: 0;
    flex: 1;
    transition: border-color .15s, background .15s;
}

.ws-name-input:focus {
    border-color: #7C3AED;
    background: #faf8ff;
}

.ws-name-save-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: none;
    background: #f0eeff;
    color: #7C3AED;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    flex-shrink: 0;
    transition: background .13s;
}

.ws-name-save-btn:hover:not(:disabled) {
    background: #7C3AED;
    color: #fff;
}

.ws-name-save-btn:disabled {
    opacity: .5;
    cursor: default;
}

/* ── Workspace name: display + pencil edit ── */
.ws-name-display-row {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.ws-name-edit-icon-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    flex-shrink: 0;
    transition: background .13s, color .13s;
}

.ws-name-edit-icon-btn:hover {
    background: #f0eeff;
    color: #7C3AED;
}

.ws-name-cancel-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: none;
    background: #fee2e2;
    color: #dc2626;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    flex-shrink: 0;
    transition: background .13s;
}

.ws-name-cancel-btn:hover {
    background: #fecaca;
}

/* ── API settings panel ── */
.api-upsell-card {
    text-align: center;
    padding: 3rem 2rem;
    border: 1.5px dashed #e2e8f0;
    border-radius: 12px;
    background: #fafbfc;
}

.api-upsell-icon {
    font-size: 2.5rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

.api-upsell-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: .5rem;
}

.api-upsell-desc {
    font-size: .875rem;
    color: #64748b;
    max-width: 380px;
    margin: 0 auto;
    line-height: 1.65;
}

.api-key-block {
    background: #fafbfc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: .85rem 1rem;
}

.api-key-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.api-key-code {
    font-family: 'Courier New', monospace;
    font-size: .8rem;
    color: #7C3AED;
    background: #f0eeff;
    padding: .3rem .65rem;
    border-radius: 6px;
    border: 1px solid #ede9fe;
    word-break: break-all;
    flex: 1;
    min-width: 0;
}

.api-copy-btn {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    flex-shrink: 0;
    transition: border-color .13s, color .13s;
}

.api-copy-btn:hover { border-color: #7C3AED; color: #7C3AED; }

.api-regen-btn {
    display: flex;
    align-items: center;
    gap: .3rem;
    padding: .3rem .75rem;
    border-radius: 7px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .13s, color .13s;
}

.api-regen-btn:hover { border-color: #f59e0b; color: #d97706; }
.api-regen-btn:disabled { opacity: .5; cursor: default; }

.api-key-hint {
    margin-top: .6rem;
    font-size: .76rem;
    color: #94a3b8;
    line-height: 1.5;
}

.api-key-hint code {
    font-family: monospace;
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: .74rem;
    color: #475569;
}

.api-example-label {
    font-size: .75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: .35rem;
}

.api-code-block {
    background: #0f172a;
    border-radius: 8px;
    padding: .85rem 1rem;
    overflow-x: auto;
    font-size: 0;
}

.api-code-block code {
    font-family: 'Courier New', monospace;
    font-size: .75rem;
    color: #e2e8f0;
    line-height: 1.6;
    white-space: pre;
}

.api-endpoints-list {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.api-endpoint-row {
    display: flex;
    align-items: baseline;
    gap: .6rem;
    padding: .45rem 0;
    border-bottom: 1px solid #f8f9fc;
    flex-wrap: wrap;
}

.api-endpoint-row:last-child { border-bottom: none; }

.api-method {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: .65rem;
    font-weight: 700;
    flex-shrink: 0;
    font-family: monospace;
    letter-spacing: .02em;
}

.api-method.get  { background: #dcfce7; color: #15803d; }
.api-method.post { background: #dbeafe; color: #1d4ed8; }
.api-method.put  { background: #fef3c7; color: #b45309; }
.api-method.del  { background: #fee2e2; color: #dc2626; }

.api-endpoint-row > code {
    font-family: 'Courier New', monospace;
    font-size: .78rem;
    color: #1e293b;
    flex-shrink: 0;
}

.api-ep-desc {
    font-size: .78rem;
    color: #64748b;
    flex: 1;
}

.api-ep-desc code {
    font-family: monospace;
    background: #f1f5f9;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: .72rem;
    color: #475569;
}
