:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --border: #e3e6eb;
  --text: #1f2328;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #16a34a;
  --warning: #d97706;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --radius: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.loading {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; color: var(--text-muted);
}

/* ----- Layout ----- */
.shell { display: flex; height: 100vh; }
.sidebar {
  width: 220px; background: #111827; color: #d1d5db;
  display: flex; flex-direction: column;
  padding: 16px 0;
  height: 100vh;
}
/* Скроллится ТОЛЬКО nav, user-блок прибит к низу. */
.sidebar-brand, .sidebar-search, .sidebar-bell { flex-shrink: 0; }
.sidebar-nav { flex: 1 1 0; overflow-y: auto; min-height: 0; }
.sidebar-user { flex-shrink: 0; }
.sidebar-brand {
  padding: 0 20px 16px; font-weight: 700; font-size: 16px; color: #fff;
  border-bottom: 1px solid #1f2937; margin-bottom: 12px;
}
.sidebar-group-title {
  padding: 14px 20px 4px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px; color: #6b7280;
}
.sidebar-nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 8px 20px; color: #d1d5db;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: #1f2937; text-decoration: none; color: #fff; }
.sidebar-nav a.active { background: #1f2937; border-left-color: var(--primary); color: #fff; }
/* Тонкий тёмный скроллбар для nav */
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: #4b5563; }
.sidebar-user {
  padding: 12px 20px; border-top: 1px solid #1f2937;
  font-size: 12px; color: #9ca3af;
}
.sidebar-user .name { color: #fff; font-weight: 600; }
.sidebar-user button {
  margin-top: 6px; background: transparent; color: #9ca3af;
  border: 1px solid #374151; padding: 4px 8px;
  border-radius: 4px; cursor: pointer; font-size: 12px;
}
.sidebar-user button:hover { background: #1f2937; color: #fff; }
.role-switcher { margin-top: 8px; }
.role-switch-select {
  width: 100%; background: #1f2937; color: #d1d5db;
  border: 1px solid #374151; border-radius: 4px;
  padding: 5px 6px; font-size: 12px; cursor: pointer;
}
.role-impersonating { color: #fbbf24; font-weight: 600; margin-bottom: 4px; }
.role-back-btn { width: 100%; }
/* Плавающая панель имперсонации — всегда доступна вверху */
.impersonation-bar {
  position: fixed; top: 10px; right: 10px; z-index: 250;
  display: flex; align-items: center; gap: 10px;
  background: #d97706; color: #fff; padding: 6px 12px;
  border-radius: 8px; font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25); max-width: calc(100vw - 80px);
}
.impersonation-bar button {
  background: #fff; color: #d97706; border: none; min-height: 0;
  padding: 4px 10px; border-radius: 6px; font-weight: 600;
  cursor: pointer; font-size: 12px; white-space: nowrap;
}

.main {
  flex: 1; overflow-y: auto;
  padding: 24px;
}

.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.page-title { font-size: 20px; font-weight: 700; margin: 0; }
.page-subtitle { color: var(--text-muted); margin-top: 2px; font-size: 13px; }

/* ----- Cards ----- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow);
}
.cards-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat-card .label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat-card .sub { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* ----- Buttons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #f9fafb; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { filter: brightness(0.92); }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.split-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.split-row { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.split-row:hover { background: var(--bg); }
.split-name { font-weight: 500; }
.split-meta { color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.btn-sm { padding: 3px 8px; font-size: 12px; }
.btn-xs { padding: 2px 6px; font-size: 11px; min-width: 0; }
.item-actions { white-space: nowrap; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: #f3f4f6; }

/* ----- Table ----- */
.toolbar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-bottom: 12px;
}
.toolbar input, .toolbar select {
  padding: 5px 8px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px;
}
.toolbar .spacer { flex: 1; }

.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td {
  padding: 8px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
}
table.data th { background: #f9fafb; font-weight: 600; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
table.data tbody tr:hover { background: #f9fafb; cursor: pointer; }
table.data tbody tr:last-child td { border-bottom: none; }

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

.pagination {
  display: flex; gap: 6px; align-items: center; justify-content: flex-end;
  margin-top: 12px; font-size: 12px; color: var(--text-muted);
}

/* ----- Badges ----- */
.badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 600;
  background: #e5e7eb; color: #374151;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.badge.new { background: #dbeafe; color: #1e40af; }
.badge.contacted { background: #e0e7ff; color: #3730a3; }
.badge.qualified { background: #c7d2fe; color: #3730a3; }
.badge.unqualified { background: #fee2e2; color: #991b1b; }
.badge.converted { background: #d1fae5; color: #065f46; }
.badge.proposal { background: #fef3c7; color: #92400e; }
.badge.negotiation { background: #fed7aa; color: #9a3412; }
.badge.won { background: #d1fae5; color: #065f46; }
.badge.lost { background: #fee2e2; color: #991b1b; }
.badge.reserved { background: #fef3c7; color: #92400e; }
.badge.shipped { background: #c7d2fe; color: #3730a3; }
.badge.completed { background: #d1fae5; color: #065f46; }
.badge.cancelled { background: #e5e7eb; color: #4b5563; }
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.confirmed { background: #d1fae5; color: #065f46; }
.badge.rejected { background: #fee2e2; color: #991b1b; }

/* Order items editor */
.items-editor { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; margin-top: 6px; }
.items-editor table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.items-editor th, .items-editor td { padding: 4px 6px; vertical-align: top; }
.items-editor th { color: var(--text-muted); font-weight: 600; text-align: left; }
.items-editor td input { width: 100%; padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; box-sizing: border-box; }
.items-editor td input[type="number"]::-webkit-outer-spin-button,
.items-editor td input[type="number"]::-webkit-inner-spin-button { margin: 0; }
.items-editor .remove-btn { background: transparent; border: none; color: var(--danger); cursor: pointer; font-size: 16px; }
.items-editor tfoot td { padding-top: 8px; font-weight: 600; }

.balance-cards { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.balance-cards .balance-card { flex: 1; min-width: 220px; margin-bottom: 0; }
.balance-card.confirmed { background: linear-gradient(135deg, #16a34a, #15803d); }
.balance-card.pending { background: linear-gradient(135deg, #d97706, #b45309); }
.balance-card {
  background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff;
  padding: 24px; border-radius: var(--radius); margin-bottom: 16px;
}
.balance-card .label { font-size: 12px; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.5px; }
.balance-card .value { font-size: 32px; font-weight: 700; margin-top: 6px; }
.balance-card .sub { font-size: 12px; opacity: 0.85; margin-top: 6px; }

/* ----- Modal ----- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--surface); border-radius: var(--radius);
  width: 100%; max-width: 600px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.modal-header {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-title { font-size: 16px; font-weight: 700; margin: 0; }
.modal-close { background: transparent; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 12px 18px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ----- Forms ----- */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-weight: 600; font-size: 12px; margin-bottom: 4px; color: var(--text); }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-family: inherit;
}
.form-row textarea { min-height: 70px; resize: vertical; }
.form-row .hint { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ----- Toast ----- */
#toast-root {
  position: fixed; top: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: #111827; color: #fff;
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; min-width: 200px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ----- Login ----- */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
.login-box {
  background: var(--surface); padding: 32px;
  border-radius: var(--radius); box-shadow: var(--shadow);
  width: 100%; max-width: 380px;
}
.login-box h1 { margin-top: 0; font-size: 22px; }
.login-box .hint { font-size: 12px; color: var(--text-muted); margin-top: 12px; }

/* ----- Pipeline (kanban) ----- */
.pipeline {
  display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 8px; align-items: start; overflow-x: auto;
}
.pipeline-column {
  background: #f1f3f5; border-radius: var(--radius);
  padding: 8px; min-height: 200px; min-width: 150px;
}
.pipeline-column-header {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.2px; margin-bottom: 8px;
  display: flex; justify-content: space-between; gap: 6px;
}
.pipeline-column-header > span:first-child { flex: 1; min-width: 0; }
.pipeline-column-header > span:last-child { white-space: nowrap; font-size: 10px; }
.pipeline-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 8px;
  margin-bottom: 6px; cursor: pointer;
  font-size: 11px;
}
.pipeline-card:hover { border-color: var(--primary); }
.pipeline-card .title { font-weight: 600; font-size: 12px; margin-bottom: 2px; }
.pipeline-card .meta { color: var(--text-muted); font-size: 10px; line-height: 1.3; }
.pipeline-card .order-card-items {
  color: var(--text-muted); font-size: 10px; line-height: 1.25;
  margin-top: 3px; overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.pipeline-card .order-card-split {
  margin-top: 3px; font-size: 10px; font-weight: 600;
  color: #7c3aed; background: #ede9fe; padding: 1px 6px;
  border-radius: 4px; display: inline-block;
}
.order-card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.order-card-thumb { width: 28px; height: 28px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.order-card-thumb.empty { background: #eef0f3; display: flex; align-items: center; justify-content: center; font-size: 14px; }

.dashboard-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 20px;
}
.dashboard-section { margin-bottom: 24px; }
.dashboard-section h3 { font-size: 14px; font-weight: 700; margin: 0 0 10px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); }

.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.bar-row .name { width: 100px; }
.bar-row .bar {
  flex: 1; height: 8px; background: #e5e7eb; border-radius: 4px;
  overflow: hidden;
}
.bar-row .bar > div {
  height: 100%; background: var(--primary);
}
.bar-row .count { width: 40px; text-align: right; color: var(--text-muted); }

.detail-grid { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; font-size: 13px; }
.detail-grid .k { color: var(--text-muted); }

.notes-list { display: flex; flex-direction: column; gap: 8px; }
.note-item {
  background: #f9fafb; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px;
}
.note-item .meta { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }

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

/* ===== Канбан: drag-and-drop ===== */
.pipeline.orders-kanban { grid-template-columns: repeat(6, minmax(150px, 1fr)); }
.pipeline-cards { min-height: 120px; }
.pipeline-empty {
  font-size: 11px; color: #9ca3af; text-align: center;
  padding: 12px 0; border: 1px dashed #d1d5db; border-radius: var(--radius);
}
.pipeline-card[draggable="true"] { transition: transform 0.1s, box-shadow 0.1s, opacity 0.1s; }
.pipeline-card[draggable="true"]:active { cursor: grabbing; }
.pipeline-card[draggable="true"].dragging { opacity: 0.4; transform: scale(0.97); }
.pipeline-column.drop-target {
  background: #e0f2fe;
  outline: 2px dashed var(--primary);
  outline-offset: -4px;
}
.pipeline-totals { margin-top: 16px; }

/* ===== Help-баннер ===== */
.help-banner {
  background: #fffbeb; border: 1px solid #fde68a; color: #78350f;
  border-radius: var(--radius); padding: 10px 14px;
  margin-bottom: 14px; font-size: 13px; line-height: 1.5;
}

/* ===== Empty state ===== */
.empty-state {
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius); padding: 36px 24px;
  text-align: center;
}
.empty-state .empty-icon { font-size: 36px; line-height: 1; }
.empty-state .empty-title { font-weight: 700; font-size: 16px; margin-top: 12px; }
.empty-state .empty-desc {
  color: var(--text-muted); margin-top: 6px; max-width: 520px;
  margin-left: auto; margin-right: auto; line-height: 1.5;
}
.empty-state .btn { margin-top: 14px; }

/* ===== Приветствие на дашборде ===== */
.greeting-card {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff; border-radius: var(--radius);
  padding: 20px 24px; margin-bottom: 20px;
}
.greeting-text { font-size: 22px; font-weight: 700; }
.greeting-sub { opacity: 0.85; margin-top: 6px; font-size: 13px; line-height: 1.5; }

.today-card { margin-bottom: 16px; }
.today-card h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); }
.today-list { padding: 0; margin: 0; list-style: none; }
.today-list li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.today-list li:last-child { border-bottom: none; }

/* ===== Переключатель вид «список ↔ канбан» ===== */
.view-toggle { display: inline-flex; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.view-toggle .btn { border: none; border-radius: 0; }
.view-toggle .btn.active { background: var(--primary); color: #fff; }

/* ===== Sidebar расширения: поиск и колокольчик ===== */
.sidebar-search, .sidebar-bell {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 20px; color: #9ca3af; font-size: 12px;
  background: transparent; border: none; cursor: pointer; text-decoration: none;
  text-align: left;
}
.sidebar-search:hover, .sidebar-bell:hover { background: #1f2937; color: #fff; text-decoration: none; }
.sidebar-search kbd {
  font-family: inherit; font-size: 10px;
  background: #1f2937; color: #d1d5db;
  padding: 2px 5px; border-radius: 3px;
  border: 1px solid #374151;
}
.sidebar-bell { position: relative; }
.bell-counter {
  background: var(--danger); color: #fff;
  border-radius: 999px; padding: 1px 7px;
  font-size: 10px; font-weight: 700;
}
.nav-counter {
  background: var(--danger); color: #fff;
  border-radius: 999px; padding: 1px 7px;
  font-size: 10px; font-weight: 700;
}

/* ===== Дропдаун уведомлений ===== */
.notif-dropdown {
  position: fixed; z-index: 2000;
  width: 340px; max-height: 480px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.notif-header {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.notif-empty { padding: 32px 16px; text-align: center; color: var(--text-muted); }
.notif-item {
  display: block; padding: 10px 14px; border-bottom: 1px solid var(--border);
  color: var(--text); text-decoration: none;
}
.notif-item:hover { background: #f9fafb; text-decoration: none; }
.notif-item.unread { background: #eff6ff; }
.notif-item.unread:hover { background: #dbeafe; }
.notif-title { font-weight: 600; font-size: 13px; }
.notif-body { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.notif-time { color: var(--text-muted); font-size: 11px; margin-top: 4px; }

/* ===== Глобальный поиск Ctrl+K ===== */
.search-modal {
  background: var(--surface); border-radius: var(--radius);
  width: 90%; max-width: 640px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  display: flex; flex-direction: column;
  max-height: 70vh;
}
.search-input {
  padding: 16px 20px; font-size: 16px;
  border: none; border-bottom: 1px solid var(--border);
  outline: none; width: 100%;
}
.search-help { padding: 8px 20px; font-size: 11px; border-bottom: 1px solid var(--border); }
.search-results { overflow-y: auto; max-height: 50vh; padding: 8px 0; }
.search-hint { padding: 16px 20px; color: var(--text-muted); font-size: 13px; }
.search-group-label {
  padding: 8px 20px 4px;
  font-size: 11px; text-transform: uppercase; color: var(--text-muted);
  letter-spacing: 0.4px; font-weight: 700;
}
.search-row {
  display: block; padding: 8px 20px;
  color: var(--text); text-decoration: none; font-size: 13px;
}
.search-row:hover { background: #eff6ff; text-decoration: none; }

/* ===== Страница интеграций ===== */
.integration-section { margin-bottom: 32px; }
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.section-header h2 { margin: 0; font-size: 16px; }
.token-display {
  background: #111827; color: #f3f4f6;
  padding: 14px; border-radius: var(--radius);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px; word-break: break-all;
  margin: 12px 0;
}
.code-block {
  background: #f3f4f6; padding: 12px; border-radius: var(--radius);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px; overflow-x: auto;
  white-space: pre; margin: 8px 0;
}
.docs-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px; margin-top: 12px;
}
.docs-grid h3 { margin: 0 0 8px; font-size: 14px; }
.docs-grid p { color: var(--text-muted); font-size: 13px; line-height: 1.5; }
@media (max-width: 900px) {
  .docs-grid { grid-template-columns: 1fr; }
  .pipeline.orders-kanban { grid-template-columns: 1fr 1fr; }
}

/* ===== Каталог товаров ===== */
.product-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.product-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; cursor: pointer;
  display: flex; flex-direction: column; position: relative;
  transition: border-color 0.1s, transform 0.1s;
}
.product-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.product-card-image {
  width: 100%; height: 140px; background: #f3f4f6;
  border-radius: var(--radius); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.product-card-image img { width: 100%; height: 100%; object-fit: cover; }
.product-card-image-empty { font-size: 40px; opacity: 0.5; }
.product-card-name {
  font-weight: 600; font-size: 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 38px;
}
.product-card-sku { color: var(--text-muted); font-size: 11px; margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.ms-badge { background: #c7d2fe; color: #3730a3; font-size: 9px; }
.product-card-prices { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 12px; }
.product-card-cost { display: flex; justify-content: space-between; color: var(--text-muted); }
.product-card-pricelists { margin-top: 4px; color: var(--primary); font-size: 11px; font-weight: 600; }
.product-card-pricelists .no-prices { color: var(--warning); }
.product-inactive-badge {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.6); color: #fff;
  padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
}

/* ===== Изображение товара в превью формы ===== */
.image-preview { margin-top: 8px; }
.image-preview img {
  max-width: 120px; max-height: 120px; border-radius: var(--radius);
  border: 1px solid var(--border);
}
.image-preview-empty {
  width: 120px; height: 120px; background: #f3f4f6;
  border-radius: var(--radius); border: 1px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: var(--text-muted);
}

/* ===== Редактор прайсов ===== */
.prices-editor { background: #f9fafb; border-radius: var(--radius); padding: 12px; }
.prices-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.price-row {
  display: flex; align-items: center; gap: 12px;
  background: #fff; padding: 8px 12px; border-radius: var(--radius);
  border: 1px solid var(--border);
}
.price-marketplace { font-weight: 600; flex: 1; }
.price-value { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.price-add-row { display: flex; gap: 8px; align-items: center; }
.price-add-row select, .price-add-row input { flex: 1; }

/* ===== Иконка товара в позициях заказа ===== */
.item-image-cell { width: 50px; padding-right: 0 !important; }
.item-thumb {
  width: 40px; height: 40px; object-fit: cover;
  border-radius: 4px; border: 1px solid var(--border);
  display: block;
}
.item-thumb-empty {
  background: #f3f4f6; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 11px;
}

/* ===== Подсказка цены в редакторе позиций ===== */
.price-hint { font-size: 10px; margin-top: 2px; line-height: 1.2; }
.price-hint.match { color: var(--success); }
.price-hint.diff { color: var(--warning); font-weight: 600; }

/* ===== Пикер товара ===== */
.product-picker-modal { max-width: 640px; }
.picker-marketplace-tag {
  background: #dbeafe; color: #1e40af;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  margin-left: 8px;
}
.product-picker-search {
  width: 100%; padding: 14px 18px; font-size: 15px;
  border: none; border-bottom: 1px solid var(--border);
  outline: none; box-sizing: border-box;
}
.product-picker-list { overflow-y: auto; max-height: 50vh; padding: 4px 0; }
.product-picker-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 18px; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.product-picker-item:hover { background: #eff6ff; }
.product-picker-thumb {
  width: 48px; height: 48px; border-radius: 4px;
  background: #f3f4f6; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.product-picker-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-picker-thumb-empty { font-size: 22px; opacity: 0.6; }
.product-picker-info { flex: 1; min-width: 0; }
.product-picker-name { font-weight: 600; font-size: 13px; }
.product-picker-meta { color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.product-picker-price { font-weight: 700; font-size: 14px; color: var(--primary); }
.product-picker-price .no-price { color: var(--warning); font-size: 11px; font-weight: 600; }

.import-status { margin-top: 12px; padding: 10px; background: #f9fafb; border-radius: var(--radius); font-size: 13px; }

.order-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.order-card-thumb {
  width: 36px; height: 36px; object-fit: cover;
  border-radius: 4px; flex-shrink: 0;
  border: 1px solid var(--border);
}
.order-card-thumb.empty {
  background: #f3f4f6; display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text-muted);
}
.order-card-head .title { flex: 1; min-width: 0; }

/* ===== Быстрое добавление позиции: autocomplete + популярные ===== */
.quick-add-box {
  background: #f9fafb; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
  margin-bottom: 10px;
}
.quick-add-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 12px; }
.quick-add-input-wrap { flex: 1; position: relative; }
.quick-add-search {
  width: 100%; padding: 9px 12px; padding-left: 32px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 10px center;
  font-size: 14px; box-sizing: border-box;
}
.quick-add-search:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.quick-add-suggestions {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  max-height: 320px; overflow-y: auto;
  z-index: 50;
}
.quick-add-suggestion {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.quick-add-suggestion:last-child { border-bottom: none; }
.quick-add-suggestion.highlighted, .quick-add-suggestion:hover { background: #eff6ff; }
.qa-thumb {
  width: 36px; height: 36px; object-fit: cover;
  border-radius: 4px; flex-shrink: 0;
  border: 1px solid var(--border);
}
.qa-thumb.empty {
  background: #f3f4f6; display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.qa-info { flex: 1; min-width: 0; }
.qa-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qa-meta { color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.qa-price { font-weight: 700; font-size: 13px; color: var(--primary); white-space: nowrap; }
.qa-price .qa-no-price { color: var(--warning); font-weight: 600; font-size: 11px; }
.quick-add-empty { padding: 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

.popular-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.popular-hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-muted); font-size: 11px; }
.popular-strip {
  display: flex; gap: 8px; overflow-x: auto;
  padding-bottom: 6px; scrollbar-width: thin;
}
.popular-strip::-webkit-scrollbar { height: 6px; }
.popular-strip::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.popular-empty {
  padding: 20px; color: var(--text-muted);
  font-size: 13px; flex: 1; text-align: center;
}
.popular-card {
  flex-shrink: 0; width: 120px; min-height: 140px;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px;
  cursor: pointer; display: flex; flex-direction: column;
  align-items: center; text-align: center;
  position: relative; font-family: inherit;
  transition: border-color 0.1s, transform 0.1s;
}
.popular-card:hover {
  border-color: var(--primary); transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}
.popular-card:active { transform: translateY(0); }
.popular-card-img {
  width: 56px; height: 56px; object-fit: cover;
  border-radius: 4px; margin-bottom: 6px;
}
.popular-card-img.empty {
  background: #f3f4f6; display: flex;
  align-items: center; justify-content: center; font-size: 22px;
}
.popular-card-name {
  font-size: 11px; font-weight: 500; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 28px; margin-bottom: 4px;
}
.popular-card-price { font-weight: 700; font-size: 12px; color: var(--primary); margin-top: auto; }
.popular-no-price { color: var(--warning); font-size: 10px; font-weight: 600; }
.popular-card-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--primary); color: #fff;
  font-size: 9px; font-weight: 700;
  padding: 2px 6px; border-radius: 999px;
}

/* ===== Аналитика ===== */
.chart-card { padding: 20px; }
.revenue-chart {
  display: flex; align-items: flex-end;
  gap: 4px; height: 180px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.revenue-bar {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  min-width: 0; gap: 4px;
}
.revenue-bar-fill {
  width: 100%; max-width: 32px;
  background: linear-gradient(180deg, var(--primary), #1d4ed8);
  border-radius: 4px 4px 0 0; min-height: 2px;
}
.revenue-bar-label {
  font-size: 10px; color: var(--text-muted);
  writing-mode: vertical-rl; transform: rotate(180deg);
  white-space: nowrap;
}
@media (max-width: 700px) {
  .revenue-bar-label { display: none; }
}

.manager-row {
  display: grid; grid-template-columns: 1fr 2fr 130px;
  align-items: center; gap: 12px; padding: 8px 0;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.manager-row:last-child { border-bottom: none; }
.manager-name { font-weight: 600; }
.manager-bar {
  height: 8px; background: #f3f4f6;
  border-radius: 4px; overflow: hidden;
}
.manager-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #1d4ed8);
}
.manager-stats { text-align: right; }
@media (max-width: 700px) {
  .manager-row { grid-template-columns: 1fr; gap: 4px; padding: 12px 0; }
  .manager-stats { text-align: left; }
}

/* ===== Расписание отгрузок ===== */
.shipping-days {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px;
}
.shipping-day {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  font-size: 13px; font-weight: 600;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
}
.shipping-day:has(input:checked) {
  background: #eff6ff;
  border-color: var(--primary);
  color: var(--primary);
}
.shipping-day input { margin: 0; cursor: pointer; }

/* Каталог: переключатель «Плитки / Список» (#2) */
.view-toggle { display: inline-flex; gap: 4px; }
.btn-view { padding: 6px 10px; line-height: 1; }
.btn-view.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.data tr.row-clickable { cursor: pointer; }
.data tr.row-clickable:hover { background: #f3f4f6; }
.data td .muted { opacity: 0.55; }
.product-card-stock { font-size: 12px; color: var(--text-muted, #6b7280); margin-top: 2px; }
.product-card-stores { font-size: 11px; color: var(--text-muted, #6b7280); margin-top: 2px; line-height: 1.3; }
.stores-cell { font-size: 12px; color: var(--text-muted, #6b7280); }
.pagination .page-info { display: inline-flex; align-items: center; gap: 4px; }
.page-jump { width: 58px; padding: 2px 6px; text-align: center; }

/* Правила цен (#3): строки настроек способов оплаты и порогов */
.pricing-settings .pricing-h3 { font-size: 14px; margin: 0 0 4px; }
.pricing-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.pricing-row { display: flex; align-items: center; gap: 8px; }
.pricing-row .pricing-label { min-width: 230px; font-size: 13px; }
.pricing-row .pricing-suffix { font-size: 13px; color: var(--text-muted, #6b7280); }
.pricing-row input { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius); }
.pricing-row .remove-btn { margin-left: auto; }

/* Прайс в форме заказа: панель «ваша сумма / по прайсу / отклонение» */
.order-pricing-panel { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius);
  background: #f8fafc; border: 1px solid var(--border); font-size: 13px; }
.order-pricing-panel:empty { display: none; }
.order-pricing-panel .opp-row { display: flex; justify-content: space-between; }
.order-pricing-panel .opp-hint { color: var(--text-muted, #6b7280); }
.order-pricing-panel .opp-dev { margin-top: 4px; font-weight: 600; }
.order-pricing-panel .opp-dev.match { color: #16a34a; }
.order-pricing-panel .opp-dev.diff { color: #d97706; }
/* Отклонение от прайса в воронке/деталях заказа */
.order-card-dev { font-size: 11px; font-weight: 600; margin-top: 2px; }
.order-card-dev.up { color: #16a34a; }
.order-card-dev.down { color: #d97706; }
.dev-up { color: #16a34a; font-weight: 600; }
.dev-down { color: #d97706; font-weight: 600; }

/* Настройка видимости складов (Интеграции) */
.warehouse-toggle-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px; margin: 12px 0;
}
.warehouse-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; font-size: 13px;
  background: var(--surface);
}
.warehouse-toggle:hover { background: #f9fafb; }
.warehouse-toggle input { width: auto; margin: 0; flex-shrink: 0; }
.warehouse-toggle-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.save-status { font-size: 13px; color: var(--text-muted); }
.product-card-reserve { color: var(--warning); font-size: 12px; font-weight: 600; }
.help-row { margin-bottom: 12px; }
.help-btn { color: var(--primary); border: 1px solid var(--border); }
.help-steps { margin: 0; padding-left: 22px; line-height: 1.7; }
.help-steps li { margin-bottom: 8px; }
.help-modal { font-size: 14px; }
.stores-hint { font-size: 11px; color: #16a34a; margin-top: 2px; }
.stores-hint.warn { color: var(--danger); font-weight: 600; }
.popular-card-stock { font-size: 11px; color: #16a34a; margin-top: 2px; }
.popular-card-stock.out { color: var(--danger); }
.qr-preview { margin-top: 8px; }
.qr-preview img { border: 1px solid var(--border); }
.opp-discount {
  margin-top: 8px; padding: 8px 10px; border-radius: var(--radius);
  background: #fffbeb; border: 1px solid #fde68a;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13px; font-weight: 600; color: #92400e; flex-wrap: wrap;
}

/* Управление площадками */
.marketplace-list { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; }
.marketplace-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.marketplace-add { display: flex; gap: 8px; margin: 8px 0; }
.marketplace-add input { flex: 1; }

/* Прайсы по каналам в каталоге */
.price-channel { font-size: 12px; color: var(--text); }
.prices-cell { font-size: 12px; max-width: 240px; }

/* Остатки по складам в форме товара */
.product-stores-table {
  display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px; max-height: 260px; overflow-y: auto;
}
.product-store-row {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px; font-size: 13px; border-bottom: 1px solid #f3f4f6;
}
.product-store-row:last-child { border-bottom: none; }
.product-store-row .store-name { flex: 1; }
.product-store-row .store-stock { font-weight: 600; }
.product-store-row .store-reserve { color: var(--warning); font-size: 12px; }

/* Кнопка-гамбургер (видна только на мобильном) */
.mobile-menu-btn { display: none; }
.sidebar-overlay { display: none; }

/* ===== МОБИЛЬНЫЙ АДАПТИВНЫЙ ДИЗАЙН ===== */
@media (max-width: 768px) {
  /* Бургер-меню: sidebar выезжает слева, по умолчанию скрыт */
  .shell { flex-direction: row; height: 100vh; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
    width: 260px; max-width: 80vw; height: 100vh;
    transform: translateX(-100%); transition: transform 0.25s ease;
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.3); }
  .sidebar-overlay {
    display: block; position: fixed; inset: 0; z-index: 199;
    background: rgba(0,0,0,0.5); opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .sidebar-overlay.open { opacity: 1; pointer-events: auto; }

  .mobile-menu-btn {
    display: flex; align-items: center; justify-content: center;
    position: fixed; top: 10px; left: 10px; z-index: 150;
    width: 44px; height: 44px; border-radius: 8px;
    background: #111827; color: #fff; border: none;
    font-size: 22px; cursor: pointer; box-shadow: var(--shadow);
  }

  /* Main content */
  .main { width: 100%; height: 100vh; overflow-y: auto; flex: 1; padding: 16px 12px 12px; }
  .page-header { gap: 8px; margin-bottom: 12px; padding-left: 52px; min-height: 44px; }
  .page-title { font-size: 18px; margin-bottom: 4px; }

  /* Forms & Inputs */
  input, select, textarea { font-size: 16px; padding: 10px; }
  button, .btn { padding: 10px 14px; font-size: 14px; min-height: 44px; }
  .form-row { flex-direction: column; gap: 8px; }
  .form-row label { font-size: 12px; }

  /* Tables */
  .table { font-size: 12px; }
  table { width: 100%; }
  th, td { padding: 8px 6px; }

  /* Cards & Modals */
  .card { padding: 12px; margin-bottom: 12px; border-radius: 6px; }
  .modal { max-width: 100% !important; width: 90% !important; max-height: 90vh; border-radius: 12px; }
  .modal-footer { gap: 8px; padding: 12px; }
  .modal-footer button { flex: 1; }

  /* Grid layouts */
  .grid { grid-template-columns: 1fr !important; gap: 12px; }
  .grid-2 { grid-template-columns: 1fr !important; }
  .grid-3 { grid-template-columns: 1fr !important; }
  .grid-4 { grid-template-columns: 1fr !important; }

  /* Catalog/Products */
  .products-grid { grid-template-columns: 1fr; gap: 8px; }
  .product-item { padding: 8px; }
  .product-card { padding: 12px; }
  .product-image { height: 120px; }

  /* Dialogs */
  .filter-dialog { max-width: 100%; width: 100%; }

  /* Flexbox stacks */
  .flex { flex-direction: column; }
  .flex-row { flex-direction: column; }

  /* Hide desktop elements */
  .desktop-only { display: none !important; }

  /* Touch-friendly spacing */
  button, .btn, input, select { min-height: 44px; }
  a.btn, a.link { min-height: 44px; display: inline-flex; align-items: center; }

  /* Pagination */
  .pagination { gap: 4px; font-size: 12px; }
  .pagination input { width: 50px; padding: 6px; }

  /* Lists */
  .list-item { padding: 12px 8px; }
}

@media (max-width: 480px) {
  /* Extra small devices */
  .page { padding: 8px; }
  .sidebar { flex-wrap: wrap; }
  .sidebar-nav a { padding: 6px 10px; font-size: 11px; }
  button, .btn { padding: 8px 12px; font-size: 13px; }
  input, select { font-size: 16px; padding: 8px; }
  .modal { width: 95% !important; }
  .card { padding: 8px; margin-bottom: 8px; }
  .page-title { font-size: 16px; }
  table { font-size: 11px; }
  th, td { padding: 6px 4px; }
  .product-image { height: 100px; }
}

/* ===== Дополнительная мобильная адаптация (от 768 и ниже) ===== */
@media (max-width: 768px) {
  /* Footer модалки — sticky внизу, всегда виден submit. */
  .modal { display: flex; flex-direction: column; }
  .modal-body { -webkit-overflow-scrolling: touch; }
  .modal-footer {
    position: sticky; bottom: 0; background: var(--surface);
    border-top: 1px solid var(--border); padding: 10px 12px;
  }
  .modal-footer button { min-height: 44px; flex: 1; font-weight: 600; }
  /* Шапка модалки — sticky сверху, чтобы кнопка закрытия всегда была видна. */
  .modal-header {
    position: sticky; top: 0; z-index: 5;
    background: var(--surface); padding: 12px 14px;
  }
  /* Кнопка закрытия — крупная и заметная на телефоне. */
  .modal-close {
    width: 40px; height: 40px; min-width: 40px;
    border-radius: 50%; background: #f3f4f6; color: #111827;
    font-size: 24px; line-height: 1; display: flex;
    align-items: center; justify-content: center;
    border: 1px solid var(--border);
  }
  .modal-close:active { background: #e5e7eb; }

  /* Любая таблица .data — горизонтальный скролл вместо обрезания. */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.data { min-width: 480px; }

  /* Items-editor (позиции заказа) — таблица не вмещается, делаем карточки. */
  .items-editor table, .items-editor thead, .items-editor tbody,
  .items-editor tfoot, .items-editor th, .items-editor td, .items-editor tr {
    display: block; width: 100%;
  }
  .items-editor thead { display: none; }
  .items-editor tbody tr {
    border: 1px solid var(--border); border-radius: 8px;
    padding: 10px; margin-bottom: 10px;
    background: #fff;
  }
  .items-editor td { padding: 4px 0 !important; }
  .items-editor td::before {
    content: attr(data-label);
    display: block; font-size: 11px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 2px;
  }
  .items-editor td.item-image-cell { width: auto; }
  .items-editor td input { width: 100%; }
  .items-editor tfoot td { text-align: right !important; padding: 8px 0 !important; }
  .items-editor tfoot td::before { display: none; }

  /* Kanban: на маленьких — узкая горизонтальная лента, перетаскивать сложно,
     но видно весь поток. По клику открываются детали. */
  .pipeline.orders-kanban {
    grid-template-columns: repeat(6, 80vw) !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .pipeline.orders-kanban .pipeline-column {
    scroll-snap-align: start;
    min-width: 80vw;
  }

  /* Тулбары и фильтры — двухколонные на узких; кнопки шире. */
  .toolbar { gap: 6px; }
  .toolbar input, .toolbar select { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .filter-bar { gap: 6px; }
  .filter-bar > * { flex: 1 1 calc(50% - 6px); }

  /* Page header — без огромной padding'и слева под бургер: 52px достаточно. */
  .page-header h1, .page-title { word-break: break-word; }

  /* Карта grid — продукт-карт сетка адаптивная (уже есть, но усилим). */
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important; gap: 10px; }
  .product-card-image { height: 110px; }

  /* Help-banner короче. */
  .help-banner { font-size: 12px; padding: 8px 10px; }

  /* Сократить page padding для большего полезного пространства. */
  .main { padding: 14px 10px 10px; }

  /* Bell counter — поменьше */
  .bell-counter { font-size: 9px; padding: 1px 5px; }

  /* Detail-grid в деталях заказа — стопкой, не двумя колонками. */
  .detail-grid { grid-template-columns: 1fr !important; gap: 4px 0; }
  .detail-grid .k {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px;
    margin-top: 8px;
  }

  /* Form-grid (две колонки в форме) — одна колонка. */
  .form-grid { grid-template-columns: 1fr !important; }

  /* Pipeline cards стянуть. */
  .pipeline-card { padding: 8px 10px; }
  .pipeline-card .title { font-size: 13px; }
  .pipeline-card .meta { font-size: 11px; }

  /* Дашборд — карточки 2 колонки на phone, 1 на extra-small. */
  .dashboard-grid { grid-template-columns: 1fr 1fr; }

  /* Item-actions в строке позиции — кнопки видны полностью. */
  .item-actions { display: flex; gap: 4px; flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .pipeline.orders-kanban {
    grid-template-columns: repeat(6, 90vw) !important;
  }
  .pipeline.orders-kanban .pipeline-column { min-width: 90vw; }
  /* Совсем узкие — одна колонка таблицы данных, ширина 100%. */
  table.data { min-width: 100%; font-size: 11px; }
}

/* === Баннеры уведомлений сверху страницы === */
.notice-bar { position: sticky; top: 0; z-index: 100; }
.notice-banner {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 10px 16px; font-size: 14px; font-weight: 500;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.notice-banner .notice-text { flex: 1; max-width: 1100px; text-align: center; }
.notice-banner .notice-close {
  background: rgba(0,0,0,0.08); border: 0; color: inherit;
  width: 28px; height: 28px; border-radius: 50%; font-size: 18px;
  cursor: pointer; padding: 0; line-height: 1; flex-shrink: 0;
}
.notice-banner .notice-close:hover { background: rgba(0,0,0,0.16); }
.notice-info    { background: #dbeafe; color: #1e3a8a; }
.notice-warning { background: #fef3c7; color: #78350f; }
.notice-success { background: #dcfce7; color: #14532d; }
.notice-error   { background: #fee2e2; color: #991b1b; }
@media (max-width: 768px) {
  .notice-banner { padding: 8px 10px; font-size: 13px; }
}
