/* ==========================================================================
   ZHASSTAT — Чистый, сбалансированный дизайн личного кабинета продавца Kaspi
   ========================================================================== */

:root {
  --bg-sidebar: #ffffff;
  --bg-main: #f4f6f8;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-input: #b8c3d3;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #4b5872;
  --text-link: #2563eb;

  --brand-orange: #0f172a;
  --brand-orange-light: #f1f5f9;
  --brand-orange-border: #b8c3d3;

  --brand-green: #059669;
  --brand-green-hover: #047857;
  --brand-green-soft: #ecfdf5;
  --brand-green-pill: #ecfdf5;
  --brand-green-text: #065f46;

  --hover-gray: #f8fafc;
  --avatar-gray: #e2e8f0;

  --sidebar-width: 260px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background-color: var(--bg-main);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ==========================================================================
   Каркас приложения
   ========================================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ==========================================================================
   Левая боковая панель (Sidebar)
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  user-select: none;
  transition: width 0.2s ease, min-width 0.2s ease;
  z-index: 20;
}

.app-layout.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-right: none;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 14px 14px;
  border-bottom: 1px solid #f1f5f9;
}

.profile-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background-color: #0f172a;
  flex-shrink: 0;
}

.profile-name {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-logout-btn {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  transition: background-color 0.15s ease;
  flex-shrink: 0;
}

.profile-logout-btn:hover {
  background-color: var(--hover-gray);
  color: #0f172a;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: #b8c3d3;
  border-radius: 4px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7a90;
  padding: 16px 10px 5px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: #475569;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.nav-item:hover {
  background-color: #f8fafc;
  color: #0f172a;
}

.nav-item.active {
  background-color: #f1f5f9;
  color: #0f172a;
  font-weight: 600;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: #4b5872;
  flex-shrink: 0;
}

.nav-item.active .nav-icon {
  color: #0f172a;
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  font-size: 12px;
  font-weight: 500;
  color: #4b5872;
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 6px;
  background-color: #f1f5f9;
}

.nav-badge:empty {
  display: none;
}

.nav-item.active .nav-badge,
.nav-subitem.active .nav-badge {
  background-color: #e2e8f0;
  color: #0f172a;
  font-weight: 600;
}

.nav-group {
  display: flex;
  flex-direction: column;
}

.nav-subitems {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 1px;
}

.nav-subitem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px 7px 42px;
  border-radius: 8px;
  color: #475569;
  font-size: 13.2px;
  font-weight: 500;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.nav-subitem:hover {
  background-color: #f8fafc;
  color: #0f172a;
}

.nav-subitem.active {
  background-color: #f1f5f9;
  color: #0f172a;
  font-weight: 600;
}

.sidebar-footer {
  padding: 14px 18px 18px 18px;
  border-top: 1px solid #f1f5f9;
  background-color: var(--bg-sidebar);
}

.wonder-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.wonder-logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wonder-logo-text {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #0f172a;
}

/* ==========================================================================
   Основная рабочая область (Main Area)
   ========================================================================== */
.main-area {
  flex: 1;
  min-width: 0;
  background-color: var(--bg-main);
  display: flex;
  flex-direction: column;
}

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

.sidebar-toggle-btn {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  transition: background-color 0.15s ease;
}

.sidebar-toggle-btn:hover {
  background-color: #e5e7eb;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: #6b7280;
}

.page-container {
  padding: 10px 28px 56px 28px;
  max-width: 100%;
  width: 100%;
  margin: 0;
}

/* ==========================================================================
   Верхние 4 карточки сводки (Точно как на скриншоте Упаковки)
   ========================================================================== */
.summary-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.03);
}

.summary-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 24, 40, 0.06);
}

.summary-card.active-card {
  border-color: #0f172a;
  box-shadow: 0 0 0 1px #0f172a;
}

.summary-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.summary-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background-color: #f1f5f9;
  color: #334155;
}

.summary-icon-box.green,
.summary-icon-box.purple,
.summary-icon-box.amber,
.summary-icon-box.red {
  background-color: #f1f5f9;
  color: #334155;
}

.summary-card-title {
  font-size: 13.5px;
  font-weight: 500;
  color: #374151;
}

.summary-card-number-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.summary-card-number {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  line-height: 1.1;
}

.summary-card-unit {
  font-size: 13px;
  color: #6b7280;
}

.summary-card-sub {
  font-size: 12.5px;
  color: #6b7280;
}

/* ==========================================================================
   Инфо-строка под карточками (Самый старый в работе + Выручка + Кнопка Kaspi)
   ========================================================================== */
.work-info-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 2px 14px 2px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 14px;
}

.work-info-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 22px;
  font-size: 13px;
  color: #6b7280;
}

.work-info-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.work-info-item strong {
  color: #111827;
  font-weight: 600;
}

.work-info-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kaspi-sync-pill {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #0f172a;
  background-color: #0f172a;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
}

.kaspi-sync-pill:hover:not(:disabled) {
  background-color: #1e293b;
  border-color: #1e293b;
}

.kaspi-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: #4b5563;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.kaspi-icon-btn:hover {
  background-color: #f3f4f6;
  color: #111827;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinning {
  animation: spin 0.9s linear infinite;
}

/* ==========================================================================
   Вкладки фильтрации (Обычные 10 | Завтра 10 | Самовывоз 20 | Своя доставка 8)
   ========================================================================== */
.clean-tabs-row {
  display: flex;
  align-items: center;
  gap: 22px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
  overflow-x: auto;
}

.clean-tab-btn {
  padding: 10px 4px 11px 4px;
  font-size: 13.8px;
  font-weight: 500;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.clean-tab-btn:hover {
  color: #111827;
}

.clean-tab-btn.active {
  color: #111827;
  font-weight: 600;
  border-bottom-color: var(--brand-green);
}

.clean-tab-count {
  font-size: 13px;
  font-weight: 500;
  color: #9ca3af;
}

.clean-tab-btn.active .clean-tab-count {
  color: var(--brand-green);
  font-weight: 600;
}

/* ==========================================================================
   Панель заголовка списка ("Упаковка 10 заказов" + Поиск + "Снять все")
   и зеленая кнопка "Все в передачу (10)"
   ========================================================================== */
.section-action-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}

.section-action-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.section-action-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #111827;
}

.section-action-count {
  font-size: 13px;
  color: #6b7280;
}

.section-action-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.compact-search {
  height: 32px;
  width: 240px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: 7px;
  font-size: 13px;
  color: #111827;
  background: #f9fafb;
  outline: none;
}

.compact-search:focus {
  background: #ffffff;
  border-color: var(--brand-green);
}

.toggle-select-btn {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

.toggle-select-btn:hover {
  color: #111827;
}

.batch-green-btn {
  width: 100%;
  height: 42px;
  border-radius: 9px;
  background-color: var(--brand-green);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
  transition: background-color 0.15s ease;
  box-shadow: 0 1px 2px rgba(15, 122, 74, 0.2);
}

.batch-green-btn:hover {
  background-color: var(--brand-green-hover);
}

/* ==========================================================================
   Сгруппированные по товарам карточки заказов (БЕЗ картинок товаров)
   ========================================================================== */
.product-groups-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.product-group-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.02);
}

.product-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}

.product-group-header:hover {
  background-color: #fafbfc;
}

.product-group-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.check-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #b8c3d3;
  background-color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all 0.14s ease;
  cursor: pointer;
}

.check-circle.checked {
  background-color: var(--brand-green);
  border-color: var(--brand-green);
  color: #ffffff;
}

.product-group-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
}

.product-group-meta {
  font-size: 12.5px;
  color: #6b7280;
  margin-top: 3px;
}

/* Строка отдельного заказа внутри группы товара */
.order-item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 16px 26px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.12s ease;
}

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

.order-item-row:hover {
  background-color: #fafbfc;
}

.order-item-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.order-item-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.order-code-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-code-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #111827;
  cursor: pointer;
}

.order-code-title:hover {
  color: var(--brand-green);
  text-decoration: underline;
}

.order-customer-city {
  font-size: 13px;
  color: #4b5563;
}

.order-product-name {
  font-size: 13px;
  color: #374151;
}

.order-tags-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 3px;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid transparent;
}

.badge-pill.green {
  background-color: #ecfdf5;
  color: #047857;
  border-color: #d1fae5;
}

.badge-pill.blue {
  background-color: #f1f5f9;
  color: #334155;
  border-color: #e2e8f0;
}

.badge-pill.amber {
  background-color: #fffbeb;
  color: #b45309;
  border-color: #fef3c7;
}

.badge-pill.red {
  background-color: #fef2f2;
  color: #b91c1c;
  border-color: #fee2e2;
}

.badge-pill.gray {
  background-color: #f8fafc;
  color: #475569;
  border-color: #e2e8f0;
}

.order-deadline-line {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: #6b7280;
  margin-top: 2px;
}

.order-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.order-price {
  font-size: 14.5px;
  font-weight: 700;
  color: #111827;
}

.order-qty {
  font-size: 13px;
  color: #4b5563;
}

.order-age {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: #6b7280;
}

.order-action-btn {
  margin-top: 6px;
  padding: 6px 14px;
  border-radius: 7px;
  background-color: var(--brand-green-soft);
  color: var(--brand-green);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background-color 0.14s ease;
}

.order-action-btn:hover {
  background-color: #d1fae5;
}

/* ==========================================================================
   Таблицы для Остатков, Товаров и Складов (Без картинок товаров)
   ========================================================================== */
.clean-card-table {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

.clean-table {
  width: 100%;
  border-collapse: collapse;
}

.clean-table th {
  background-color: #f9fafb;
  text-align: left;
  padding: 12px 18px;
  font-size: 12.5px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--border-color);
}

.clean-table td {
  padding: 14px 18px;
  font-size: 13.8px;
  color: #111827;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.clean-table tbody tr:last-child td {
  border-bottom: none;
}

.clean-table tbody tr:hover {
  background-color: #fafbfc;
}

/* ==========================================================================
   Страница "Склады и магазины" (Реальные points из Kaspi GraphQL)
   ========================================================================== */
.warehouse-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.warehouse-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.warehouse-row:hover {
  border-color: #b8c3d3;
  box-shadow: 0 3px 10px rgba(16, 24, 40, 0.04);
}

.warehouse-pp {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
}

.warehouse-address {
  font-size: 14.5px;
  font-weight: 500;
  color: #1f2937;
}

.warehouse-sub {
  font-size: 12.5px;
  color: #6b7280;
  margin-top: 3px;
}

.warehouse-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   Модальное окно (детали заказа / настройки Kaspi)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 20px;
}

.modal-card {
  background: #ffffff;
  border-radius: 14px;
  width: 100%;
  max-width: 660px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border-color);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 16.5px;
  font-weight: 700;
  color: #111827;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 18px;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background-color: #f3f4f6;
}

.modal-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.steps-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.step-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: #f9fafb;
}

.step-row.CURRENT {
  background-color: #ecfdf5;
  border-color: #a7f3d0;
}

.step-row.PASSED {
  background-color: #f8fafc;
  border-color: #e2e8f0;
}

.step-row.ABORTED {
  background-color: #fef2f2;
  border-color: #fecaca;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.search-input {
  width: 100%;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-primary);
  background-color: #ffffff;
  outline: none;
}

.form-textarea {
  width: 100%;
  min-height: 95px;
  padding: 10px 12px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  font-family: monospace;
  font-size: 12.5px;
  color: #1f2937;
  resize: vertical;
}

.btn-primary {
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  background-color: var(--brand-green);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn-primary:hover {
  background-color: var(--brand-green-hover);
}

.btn-outline {
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border-input);
  background-color: #ffffff;
  color: #374151;
  font-size: 13.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-outline:hover {
  background-color: #f9fafb;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #111827;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 9px;
  font-size: 13.5px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   РАЗДЕЛ "ИНФОРМАЦИЯ И АНАЛИТИКА" (Когда покупают / Где покупают / ABC / SLA)
   ========================================================================== */
.info-page-wrapper {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.info-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.info-top-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.info-mode-switch {
  display: inline-flex;
  align-items: center;
  background-color: #f1f4f6;
  border: 1px solid #e3e7ea;
  border-radius: 11px;
  padding: 3px;
  gap: 2px;
}

.info-mode-btn {
  padding: 7px 15px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: #4b5563;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.info-mode-btn:hover {
  color: #111827;
}

.info-mode-btn.active {
  background-color: #ffffff;
  color: #0f172a;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.info-section-heading {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 500;
  color: #111827;
}

.info-help-circle {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid #9ca3af;
  color: #6b7280;
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
}

.info-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #6b7280;
}

.info-period-select {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background-color: #ffffff;
  color: #374151;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.info-filter-card {
  background-color: #ffffff;
  border: 1px solid #e6e9ec;
  border-radius: 14px;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.02);
}

.info-filter-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.info-product-select {
  min-width: 245px;
  max-width: 360px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #e2e6ea;
  background-color: #ffffff;
  color: #111827;
  font-size: 13.5px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.info-product-select:focus {
  border-color: #0b7a53;
}

.info-divider {
  width: 1px;
  height: 24px;
  background-color: #e5e7eb;
}

.info-metric-switch {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
  background-color: #f3f5f7;
  border: 1px solid #e5e8eb;
  border-radius: 10px;
  padding: 3px;
}

.info-metric-btn {
  padding: 5px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: #4b5563;
  transition: all 0.14s ease;
}

.info-metric-btn.active {
  background-color: #ffffff;
  color: #0f172a;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

.info-filter-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #6b7280;
}

/* ГЛАВНОЕ — Hero Card */
.info-hero-card {
  background-color: #ffffff;
  border: 1px solid #e6e9ec;
  border-radius: 16px;
  padding: 22px 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.025);
}

.info-hero-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: #e5f6ef;
  color: #0b7a53;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.info-hero-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}

.info-hero-title {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin: 3px 0 6px 0;
  letter-spacing: -0.015em;
}

.info-hero-sub {
  font-size: 13.8px;
  color: #4b5563;
  line-height: 1.45;
}

.info-hero-sub strong {
  color: #111827;
  font-weight: 600;
}

/* Двухколоночный ряд: Лучшие часы + Спокойное время */
.info-two-col {
  display: grid;
  grid-template-columns: 1.75fr 1fr;
  gap: 16px;
}

.info-card {
  background-color: #ffffff;
  border: 1px solid #e6e9ec;
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.025);
}

.info-card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.info-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-card-desc {
  font-size: 13px;
  color: #6b7280;
  margin-top: 4px;
  line-height: 1.45;
}

/* Лучшие часы (полосы) */
.top-hours-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.top-hour-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-hour-rank {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background-color: #e2f5ec;
  color: #0b7a53;
}

.top-hour-rank.rank-1 {
  background-color: #0b7a53;
  color: #ffffff;
}

.top-hour-time {
  width: 92px;
  font-size: 14px;
  font-weight: 500;
  color: #111827;
  flex-shrink: 0;
}

.top-hour-bar-track {
  flex: 1;
  height: 10px;
  background-color: #f3f5f7;
  border-radius: 999px;
  overflow: hidden;
}

.top-hour-bar-fill {
  height: 100%;
  background-color: #129a68;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.top-hour-stat {
  min-width: 96px;
  text-align: right;
  font-size: 13.5px;
  color: #111827;
  font-weight: 500;
  white-space: nowrap;
}

/* Спокойное время */
.quiet-time-big {
  font-size: 30px;
  font-weight: 700;
  color: #096947;
  margin-top: 26px;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.quiet-time-sub {
  font-size: 13px;
  color: #6b7280;
}

/* Легенда карты недели */
.heatmap-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #6b7280;
  flex-shrink: 0;
}

.heatmap-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

/* Карта недели: день x час */
.week-heatmap-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
}

.week-heatmap-grid {
  min-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.week-heatmap-row {
  display: grid;
  grid-template-columns: 30px repeat(24, 1fr);
  gap: 4px;
  align-items: center;
}

.week-heatmap-day {
  font-size: 12px;
  color: #6b7280;
}

.week-heatmap-cell {
  height: 26px;
  border-radius: 5px;
  position: relative;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  cursor: pointer;
}

.week-heatmap-cell:hover {
  transform: scale(1.08);
  z-index: 5;
  box-shadow: 0 2px 8px rgba(11, 122, 83, 0.28);
}

.week-heatmap-hours-axis {
  display: grid;
  grid-template-columns: 30px repeat(24, 1fr);
  gap: 4px;
  margin-top: 4px;
}

.week-heatmap-hour-lbl {
  text-align: center;
  font-size: 10.5px;
  color: #6b7280;
}

/* Уровни зеленого цвета (0..5) как на скриншоте */
.hm-lvl-0 { background-color: #eef8f3; }
.hm-lvl-1 { background-color: #cceee0; }
.hm-lvl-2 { background-color: #9ce0c4; }
.hm-lvl-3 { background-color: #5bc79b; }
.hm-lvl-4 { background-color: #21ab75; }
.hm-lvl-5 { background-color: #0c8d5b; }

/* По времени суток — 24 вертикальных столбика */
.hourly-bars-wrap {
  margin-top: 18px;
  padding-top: 14px;
}

.hourly-bars-grid {
  height: 155px;
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 6px;
  align-items: end;
  border-bottom: 1px solid #f1f3f5;
  padding-bottom: 6px;
  background-image: linear-gradient(to bottom, #f4f6f8 1px, transparent 1px);
  background-size: 100% 38px;
}

.hourly-bar-col {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  cursor: pointer;
}

.hourly-bar-rect {
  width: 100%;
  min-height: 4px;
  border-radius: 5px;
  background-color: #3dbb8a;
  transition: all 0.16s ease;
}

.hourly-bar-rect.low {
  background-color: #84dbb8;
}

.hourly-bar-rect.mid {
  background-color: #20ae78;
}

.hourly-bar-rect.high {
  background-color: #129a67;
}

.hourly-bar-rect.peak {
  background-color: #08724b;
}

.hourly-bar-col:hover .hourly-bar-rect {
  filter: brightness(0.92);
}

/* Черный всплывающий тултип как на скрине ("0 - 64 зак.") */
.bar-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background-color: #111827;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 7px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
  z-index: 20;
}

.hourly-bar-col:hover .bar-tooltip,
.week-heatmap-cell:hover .bar-tooltip,
.month-day-cell:hover .bar-tooltip {
  opacity: 1;
}

.hourly-axis-row {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.hourly-axis-lbl {
  text-align: center;
  font-size: 11px;
  color: #6b7280;
}

/* По дням недели — 7 карточек */
.weekday-cards-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-top: 14px;
  margin-bottom: 6px;
}

.weekday-col-lbl {
  text-align: center;
  font-size: 12px;
  color: #6b7280;
}

.weekday-cards-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

.weekday-card {
  height: 82px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: transform 0.12s ease;
}

.weekday-card:hover {
  transform: translateY(-2px);
}

.weekday-card-val {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

.weekday-card-pct {
  font-size: 12px;
  color: #374151;
}

.weekday-footer-note {
  margin-top: 14px;
  font-size: 13px;
  color: #6b7280;
}

/* По числам месяца — календарная сетка 7 колонок */
.month-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.month-day-empty {
  height: 58px;
  border-radius: 9px;
  background-color: transparent;
}

.month-day-cell {
  height: 58px;
  border-radius: 9px;
  padding: 7px 11px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.month-day-cell:hover {
  transform: translateY(-1px);
}

.month-day-cell.zero {
  background-color: #f8fafb;
  border: 1px solid #f1f3f5;
}

.month-day-num {
  font-size: 11.5px;
  color: #4b5563;
}

.month-day-val {
  font-size: 15.5px;
  font-weight: 700;
  color: #111827;
}

.month-day-cell.zero .month-day-val {
  color: #6b7280;
}

/* ABC-группы и дополнительные аналитические блоки */
.abc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.abc-badge.group-A {
  background-color: #dcfce7;
  color: #0b7a53;
}

.abc-badge.group-B {
  background-color: #fef3c7;
  color: #b45309;
}

.abc-badge.group-C {
  background-color: #f3f4f6;
  color: #4b5563;
}

.insight-advice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.insight-advice-box {
  background-color: #f8fbf9;
  border: 1px solid #d9efe5;
  border-radius: 12px;
  padding: 14px 16px;
}

.insight-advice-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #096947;
  margin-bottom: 5px;
}

.insight-advice-text {
  font-size: 12.8px;
  color: #374151;
  line-height: 1.45;
}

/* ==========================================================================
   3-КОЛОНОЧНАЯ СЕТКА КАРТОЧЕК ЗАКАЗОВ С РЕАЛЬНЫМИ ФОТО KASPI (КАК НА СКРИНЕ)
   ========================================================================== */
.kaspi-delivery-tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 16px;
}

.kaspi-delivery-tabs-left {
  display: flex;
  align-items: center;
  gap: 22px;
  overflow-x: auto;
}

.kaspi-dtab-btn {
  padding: 10px 2px;
  font-size: 13.5px;
  font-weight: 400;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.14s ease, border-color 0.14s ease;
}

.kaspi-dtab-btn:hover {
  color: #111827;
}

.kaspi-dtab-btn.active {
  color: #0f172a;
  font-weight: 600;
  border-bottom-color: #0f172a;
}

/* "Самовывоз": вкладки по городам точек выдачи — переносятся на несколько строк */
.kaspi-delivery-tabs-left.cities {
  flex-wrap: wrap;
  gap: 0 18px;
  overflow: visible;
}

.kaspi-dtab-btn.empty {
  color: #6b7a90;
}

.kaspi-dtab-btn.empty.active {
  color: #0f172a;
}

.kaspi-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.kaspi-order-card {
  background-color: #ffffff;
  border: 1px solid #b8c3d3;
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.14s ease, border-color 0.14s ease;
}

.kaspi-order-card:hover {
  border-color: #6b7a90;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.koc-top {
  padding: 12px 15px 10px 15px;
}

.koc-row-1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.koc-code {
  font-size: 16.5px;
  font-weight: 500;
  color: #0284c7;
  cursor: pointer;
}

.koc-code:hover {
  text-decoration: underline;
}

.koc-price-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.koc-price {
  font-size: 15.5px;
  font-weight: 700;
  color: #111827;
}

.koc-checkbox {
  width: 15px;
  height: 15px;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  cursor: pointer;
  accent-color: #0284c7;
}

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

.koc-carrier-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 11px;
  border: 1px solid #334155;
  border-radius: 5px;
  font-size: 11.5px;
  color: #334155;
  background-color: #ffffff;
}

.koc-status {
  font-size: 11.5px;
  font-weight: 500;
  color: #1e40af;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.koc-status.cancelled {
  color: #dc2626;
}

.koc-status.shipped {
  color: #0b7a53;
}

.koc-row-3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  font-size: 11px;
  color: #4b5563;
}

.koc-date {
  white-space: nowrap;
}

.koc-address {
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.koc-bottom {
  border-top: 1px solid #e5e7eb;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background-color: #ffffff;
}

.koc-prod-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.koc-prod-img {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  object-fit: contain;
  background-color: #ffffff;
  border: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.koc-prod-texts {
  min-width: 0;
  flex: 1;
}

.koc-prod-title {
  font-size: 12px;
  color: #0284c7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  text-decoration: none;
  cursor: pointer;
}

.koc-prod-title:hover {
  text-decoration: underline;
}

.koc-prod-sku {
  font-size: 11.5px;
  color: #374151;
  margin-top: 2px;
}

.koc-qty-box {
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  color: #374151;
  background-color: #ffffff;
  flex-shrink: 0;
}

.koc-pagination-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 18px;
}

.koc-page-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 13px;
  color: #374151;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: transparent;
}

.koc-page-btn:hover:not(:disabled) {
  background-color: #f3f4f6;
}

.koc-page-btn:disabled {
  color: #b8c3d3;
  cursor: default;
}

.koc-page-btn.active {
  border-color: #f59e0b;
  color: #f59e0b;
  font-weight: 600;
  background-color: #ffffff;
}

.koc-pagesize-select {
  height: 30px;
  padding: 0 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background-color: #ffffff;
  font-size: 13px;
  color: #374151;
  margin-left: 8px;
  outline: none;
  cursor: pointer;
}

.real-prod-thumb {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: contain;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  flex-shrink: 0;
}

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

@media (max-width: 720px) {
  .kaspi-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   ГЛАВНАЯ СТРАНИЦА (ФИНАНСОВЫЙ И ОПЕРАЦИОННЫЙ ДАШБОРД В НОВОМ ДИЗАЙНЕ)
   ========================================================================== */
.home-dash-wrap {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.home-top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.home-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.home-main-title {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.home-main-sub {
  font-size: 13px;
  color: #4b5872;
}

.home-controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.home-period-pills {
  display: inline-flex;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.home-period-btn {
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  transition: all 0.14s ease;
}

.home-period-btn:hover {
  color: #0f172a;
}

.home-period-btn.active {
  background-color: #ffffff;
  color: #0f172a;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* Верхний двухколоночный блок: Слева Выручка + Воронка в пути, Справа Чистая прибыль и Водопад */
.home-hero-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 18px;
}

.home-revenue-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
  position: relative;
  overflow: hidden;
}

.home-rev-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.home-rev-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background-color: #f1f5f9;
  color: #334155;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.home-rev-amount-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.home-rev-big-number {
  font-size: 38px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.home-delta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}

.home-delta-pill.up {
  background-color: #ecfdf5;
  color: #047857;
}

.home-delta-pill.down {
  background-color: #fef2f2;
  color: #b91c1c;
}

/* 3 плашки денег в пути / в работе / в предзаказе */
.home-pipeline-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.home-pipe-item {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}

.home-pipe-item:hover {
  transform: translateY(-1px);
  border-color: #b8c3d3;
  background-color: #ffffff;
}

.home-pipe-label {
  font-size: 11.5px;
  color: #4b5872;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.home-pipe-sum {
  font-size: 15.5px;
  font-weight: 700;
  color: #0f172a;
}

.home-pipe-sub {
  font-size: 11.5px;
  color: #4b5872;
  font-weight: 500;
  margin-top: 2px;
}

/* Правая карточка: Чистая прибыль и Водопад расходов */
.home-profit-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

.home-profit-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background-color: #f1f5f9;
  color: #334155;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.home-profit-number {
  font-size: 32px;
  font-weight: 800;
  color: #059669;
  letter-spacing: -0.025em;
  margin-top: 6px;
}

.home-waterfall-mini {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
}

.home-wf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: #475569;
}

.home-wf-row strong {
  color: #0f172a;
  font-weight: 600;
}

.home-wf-row.minus strong {
  color: #475569;
}

/* Ряд из 4 операционных карточек (Осталось отправить, Средний чек, Выкуп/Отмены, Рейтинг) */
.home-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.home-stat-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}

.home-stat-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.home-stat-card::before {
  display: none;
}

.home-stat-lbl {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4b5872;
}

.home-stat-val {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.home-stat-meta {
  font-size: 12.5px;
  color: #4b5872;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.home-stat-link {
  font-size: 12.5px;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.home-stat-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

/* Нижний ряд на Главной: График выручки по часам + Топ товаров с реальными фото */
.home-bottom-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
}

/* ==========================================================================
   РАЗДЕЛ "СВОДКА" (Сводные таблицы + Круговая диаграмма по всем параметрам)
   ========================================================================== */
.pivot-page-wrap {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pivot-sheet-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 5px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}

.pivot-tab-btn {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.14s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pivot-tab-btn:hover {
  color: #0f172a;
  background-color: #f8fafc;
}

.pivot-tab-btn.active {
  background-color: #0f172a;
  color: #ffffff;
  font-weight: 600;
}

/* Единый сегментированный переключатель фильтров (Опубликованные / Не опубликованные / Все) */
.seg-filter-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 4px;
  border-radius: 10px;
}

.seg-filter-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: #475569;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.14s ease;
  white-space: nowrap;
}

.seg-filter-btn:hover {
  color: #0f172a;
}

.seg-filter-btn.active {
  background-color: #ffffff;
  color: #0f172a;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.seg-filter-count {
  font-size: 11.5px;
  font-weight: 600;
  color: #4b5872;
  background-color: #e2e8f0;
  padding: 1px 6px;
  border-radius: 5px;
}

.seg-filter-btn.active .seg-filter-count {
  background-color: #f1f5f9;
  color: #0f172a;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.pub {
  background-color: #10b981;
}

.status-dot.unpub {
  background-color: #6b7a90;
}

.pivot-toolbar-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.pivot-db-range-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 8px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 12.5px;
  font-weight: 500;
}

.pivot-date-input {
  height: 32px;
  padding: 0 10px;
  border: 1px solid #b8c3d3;
  border-radius: 8px;
  font-size: 12.5px;
  color: #0f172a;
  background-color: #ffffff;
  font-weight: 500;
  outline: none;
}

.pivot-date-input:focus {
  border-color: #0f172a;
}

.pivot-main-split {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 16px;
  align-items: start;
}

.pivot-table-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}

.pivot-table-scroll {
  max-height: calc(100vh - 235px);
  min-height: 520px;
  overflow-y: auto;
  overflow-x: auto;
}

.pivot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pivot-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background-color: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 11px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4b5872;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.pivot-table thead th:hover {
  color: #0f172a;
  background-color: #f1f5f9;
}

.pivot-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

.pivot-table tbody tr:hover {
  background-color: #f8fafc;
}

.pivot-table tr.pivot-total-row td {
  background-color: #f8fafc;
  font-weight: 700;
  color: #0f172a;
  border-top: 1px solid #b8c3d3;
  border-bottom: 2px solid #b8c3d3;
}

.pivot-chart-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pivot-pie-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.pivot-pie-wrap {
  position: relative;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1 / 1;
  margin: 4px auto 0;
}

.pivot-pie-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.pivot-pie-slice {
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linejoin: round;
  cursor: pointer;
  transform-box: view-box;
  transform-origin: 50% 50%;
  transition: opacity 0.18s ease, transform 0.18s ease, filter 0.18s ease;
}

.pivot-pie-svg.has-hover .pivot-pie-slice:not(.hover) {
  opacity: 0.32;
}

.pivot-pie-slice.hover {
  transform: scale(1.04);
  filter: drop-shadow(0 4px 10px rgba(15, 23, 42, 0.18));
}

.pivot-pie-pct {
  font-size: 11px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  letter-spacing: 0.01em;
  transition: opacity 0.18s ease;
}

.pivot-pie-svg.has-hover .pivot-pie-pct {
  opacity: 0.35;
}

.pivot-pie-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.pivot-pie-center-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #4b5872;
  line-height: 1.3;
}

.pivot-pie-wrap.is-hover .pivot-pie-center-label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 11.5px;
  color: #334155;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pivot-pie-center-value {
  margin-top: 3px;
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
  word-break: break-word;
}

.pivot-pie-center-sub {
  margin-top: 3px;
  font-size: 11px;
  color: #4b5872;
  font-weight: 500;
}

.pivot-pie-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 20;
  min-width: 190px;
  max-width: 260px;
  padding: 10px 12px;
  border-radius: 10px;
  background-color: #0f172a;
  color: #f8fafc;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  will-change: transform;
}

.pivot-pie-tooltip.visible {
  opacity: 1;
}

.pivot-pie-tooltip-title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 7px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(248, 250, 252, 0.14);
}

.pivot-pie-tooltip-title .pivot-color-dot {
  margin-top: 3px;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.pivot-pie-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 12px;
  line-height: 1.6;
  color: #b8c3d3;
}

.pivot-pie-tooltip-row b {
  color: #ffffff;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pivot-legend-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pivot-legend-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  padding: 7px 10px 8px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: default;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.pivot-legend-row:hover,
.pivot-legend-row.hover {
  background-color: #f8fafc;
  border-color: #e2e8f0;
}

.pivot-legend-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pivot-legend-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}

.pivot-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.pivot-legend-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #1e293b;
  font-weight: 500;
}

.pivot-legend-val {
  display: flex;
  align-items: baseline;
  gap: 10px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pivot-legend-pct {
  font-weight: 700;
  color: #0f172a;
  min-width: 46px;
  text-align: right;
}

.pivot-legend-amount {
  font-size: 12px;
  font-weight: 500;
  color: #4b5872;
  min-width: 84px;
  text-align: right;
}

.pivot-legend-bar {
  height: 3px;
  border-radius: 999px;
  background-color: #f1f5f9;
  overflow: hidden;
}

.pivot-legend-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  opacity: 0.9;
}

.cogs-input {
  width: 92px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid #b8c3d3;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #0f172a;
  background-color: #ffffff;
  outline: none;
}

.cogs-input:focus {
  border-color: #0b7a53;
  box-shadow: 0 0 0 2px rgba(11, 122, 83, 0.12);
}

@media (max-width: 1024px) {
  .home-hero-grid,
  .home-bottom-grid,
  .pivot-main-split {
    grid-template-columns: 1fr;
  }
  .home-kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .home-pipeline-grid,
  .home-kpi-row {
    grid-template-columns: 1fr;
  }
}
.reviews-page-wrap {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reviews-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.reviews-kpi-card {
  background-color: #ffffff;
  border: 1px solid #e6e9ec;
  border-radius: 16px;
  padding: 18px 22px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.02);
}

.reviews-kpi-label {
  font-size: 12.5px;
  color: #6b7280;
  margin-bottom: 6px;
}

.reviews-kpi-val {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}

.reviews-kpi-val.red {
  color: #dc2626;
}

.reviews-kpi-val.green {
  color: #0b7a53;
}

.reviews-kpi-sub {
  font-size: 12px;
  color: #6b7280;
  margin-top: 6px;
}

.reviews-done-analysis-card {
  background-color: #ffffff;
  border: 1px solid #e6e9ec;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.02);
}

.reviews-done-header {
  padding: 13px 20px;
  border-bottom: 1px solid #f1f3f5;
  font-size: 13px;
  color: #6b7280;
}

.reviews-done-body {
  padding: 15px 20px;
}

.reviews-done-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.reviews-done-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.reviews-done-meta {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

.reviews-done-text {
  font-size: 13.5px;
  color: #4b5563;
  line-height: 1.45;
}

.reviews-split-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 18px;
  align-items: start;
}

/* Левая колонка: Список товаров с отзывами */
.reviews-products-card {
  background-color: #ffffff;
  border: 1px solid #e6e9ec;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.02);
}

.reviews-prod-header {
  padding: 16px 18px 14px 18px;
  border-bottom: 1px solid #f1f3f5;
}

.reviews-prod-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.reviews-prod-count-lbl {
  font-size: 13.5px;
  color: #6b7280;
}

.reviews-pill-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.reviews-pill-btn {
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid #e5e7eb;
  background-color: #ffffff;
  color: #374151;
  cursor: pointer;
  transition: all 0.14s ease;
}

.reviews-pill-btn:hover {
  background-color: #f9fafb;
}

.reviews-pill-btn.active {
  background-color: #111827;
  border-color: #111827;
  color: #ffffff;
}

.reviews-prod-desc {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
}

.reviews-prod-list {
  max-height: 760px;
  overflow-y: auto;
}

.review-prod-row {
  padding: 13px 18px;
  border-bottom: 1px solid #f1f3f5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.review-prod-row:hover {
  background-color: #f8fafc;
}

.review-prod-row.selected {
  background-color: #f0fdf7;
  border-left: 3px solid #0b7a53;
}

.review-prod-left {
  min-width: 0;
  flex: 1;
}

.review-prod-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-prod-sub {
  font-size: 12px;
  color: #6b7280;
  margin-top: 3px;
}

.review-prod-right {
  text-align: right;
  flex-shrink: 0;
}

.review-prod-rate {
  font-size: 13.5px;
  font-weight: 600;
  color: #111827;
}

.review-prod-neg {
  font-size: 12px;
  color: #dc2626;
  margin-top: 3px;
}

.review-prod-neg.zero {
  color: #9ca3af;
}

/* Правая колонка: Лента отзывов */
.reviews-feed-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.reviews-banner-card {
  background-color: #ffffff;
  border: 1px solid #e6e9ec;
  border-radius: 16px;
  padding: 18px 22px;
  font-size: 13.5px;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reviews-filter-bar-card {
  background-color: #ffffff;
  border: 1px solid #e6e9ec;
  border-radius: 16px;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.review-item-card {
  background-color: #ffffff;
  border: 1px solid #e6e9ec;
  border-radius: 16px;
  padding: 18px 22px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.02);
}

.review-item-prod-name {
  font-size: 12.5px;
  color: #6b7280;
  margin-bottom: 5px;
}

.review-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.review-author-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.review-author-name {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.review-stars {
  color: #f59e0b;
  font-size: 14px;
  letter-spacing: 1px;
}

.review-stars-muted {
  color: #e5e7eb;
}

.review-date {
  font-size: 12px;
  color: #6b7280;
}

.review-comment-text {
  font-size: 14px;
  color: #111827;
  line-height: 1.5;
  margin-bottom: 12px;
}

.review-gallery-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.review-photo-thumb {
  width: 66px;
  height: 66px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.review-photo-thumb:hover {
  transform: scale(1.04);
}

.review-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}

.review-order-link {
  font-size: 12.5px;
  font-weight: 500;
  color: #0b7a53;
  cursor: pointer;
}

.review-order-link:hover {
  text-decoration: underline;
}

.review-contact-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background-color: #ffffff;
  font-size: 12.5px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.review-contact-btn:hover {
  background-color: #f9fafb;
}

/* ==========================================================================
   КАЛЕНДАРЬ ВЫПЛАТ KASPI PAY (CASHFLOW) & ПРОГНОЗ ОСТАТКОВ (OUT-OF-STOCK)
   ========================================================================== */
.cashflow-kpi-grid,
.oos-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.cashflow-kpi-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.cashflow-kpi-card:hover {
  transform: translateY(-1px);
  border-color: #b8c3d3;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.cashflow-kpi-card.active {
  border-color: #0f172a;
  box-shadow: 0 0 0 1px #0f172a;
}

.cashflow-kpi-card.green-accent,
.cashflow-kpi-card.blue-accent,
.cashflow-kpi-card.amber-accent,
.cashflow-kpi-card.red-accent {
  background: #ffffff;
  border-color: #e2e8f0;
}

.cashflow-kpi-card.active.green-accent,
.cashflow-kpi-card.active.blue-accent,
.cashflow-kpi-card.active.amber-accent,
.cashflow-kpi-card.active.red-accent {
  border-color: #0f172a;
  box-shadow: 0 0 0 1px #0f172a;
}

.cashflow-kpi-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4b5872;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cashflow-kpi-net {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.cashflow-kpi-sub {
  font-size: 12px;
  color: #4b5872;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cashflow-days-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
}

.cashflow-day-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.cashflow-day-card:hover {
  border-color: #b8c3d3;
  background-color: #f8fafc;
}

.cashflow-day-card.active {
  border-color: #0f172a;
  background-color: #f8fafc;
  box-shadow: 0 0 0 1px #0f172a;
}

.cashflow-day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.cashflow-day-date {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.cashflow-day-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background-color: #f1f5f9;
  color: #475569;
}

.cashflow-day-tag.today {
  background-color: #ecfdf5;
  color: #047857;
}

.cashflow-day-tag.tomorrow {
  background-color: #f1f5f9;
  color: #334155;
}

.cashflow-day-tag.after {
  background-color: #f1f5f9;
  color: #475569;
}

.cashflow-day-tag.later {
  background-color: #f1f5f9;
  color: #4b5872;
}

.cashflow-day-net {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
}

.cashflow-day-bar {
  width: 100%;
  height: 5px;
  background-color: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}

.cashflow-day-bar-fill {
  height: 100%;
  background-color: #334155;
  border-radius: 99px;
}

.oos-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.oos-status-pill.critical {
  background-color: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.oos-status-pill.warning {
  background-color: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.oos-status-pill.normal {
  background-color: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.oos-status-pill.idle {
  background-color: #f8fafc;
  color: #4b5872;
  border: 1px solid #e2e8f0;
}

.stock-edit-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stock-step-btn {
  width: 24px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #b8c3d3;
  background-color: #f8fafc;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.stock-step-btn:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

.stock-qty-input {
  width: 64px;
  height: 28px;
  text-align: center;
  border: 1px solid #b8c3d3;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  background-color: #ffffff;
  outline: none;
}

.stock-qty-input:focus {
  border-color: #0f172a;
  background-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.08);
}

/* ==========================================================================
   ЕЖЕМЕСЯЧНЫЙ И ПОСУТОЧНЫЙ P&L-ОТЧЕТ (ОТЧЕТ О ПРИБЫЛЯХ, УБЫТКАХ И РАСХОДАХ)
   ========================================================================== */
.pnl-split-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
  align-items: start;
}

.pnl-cascade-card,
.pnl-expenses-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pnl-cascade-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pnl-cascade-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 13px;
  border-radius: 8px;
  font-size: 13px;
  background-color: #f8fafc;
  border: 1px solid #f1f5f9;
}

.pnl-cascade-row.subtotal {
  background-color: #f1f5f9;
  border-color: #b8c3d3;
  font-weight: 700;
  color: #0f172a;
}

.pnl-cascade-row.deduct .pnl-cascade-val {
  color: #475569;
  font-weight: 600;
}

.pnl-cascade-row.net-final {
  background-color: #0f172a;
  border: 1px solid #0f172a;
  padding: 14px 16px;
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
}

.pnl-cascade-row.net-final.loss {
  background-color: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.pnl-quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pnl-preset-btn {
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px dashed #b8c3d3;
  background-color: #f8fafc;
  font-size: 11.5px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.12s ease;
}

.pnl-preset-btn:hover {
  border-color: #0b7a53;
  color: #0b7a53;
  background-color: #ecfdf5;
}

.pnl-add-form {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  background-color: #f8fafc;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.pnl-input {
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid #b8c3d3;
  background-color: #ffffff;
  font-size: 12.5px;
  color: #0f172a;
  outline: none;
  width: 100%;
}

.pnl-input:focus {
  border-color: #0b7a53;
  box-shadow: 0 0 0 2px rgba(11, 122, 83, 0.12);
}

.pnl-expense-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
}

.pnl-expense-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background-color: #ffffff;
}

.pnl-expense-del-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  color: #6b7a90;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.pnl-expense-del-btn:hover {
  background-color: #fee2e2;
  color: #dc2626;
}

@media (max-width: 960px) {
  .summary-cards-grid,
  .cashflow-kpi-grid,
  .oos-kpi-grid,
  .reviews-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .info-two-col,
  .insight-advice-grid,
  .reviews-split-layout,
  .pnl-split-grid,
  .pnl-add-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .summary-cards-grid,
  .cashflow-kpi-grid,
  .oos-kpi-grid {
    grid-template-columns: 1fr;
  }
  .weekday-cards-grid,
  .month-calendar-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .page-container {
    padding: 10px 16px 40px 16px;
  }
}


/* ==========================================================================
   КАЛЬКУЛЯТОР АКЦИЙ И РАССРОЧКИ (Kaspi Жұма · 0-0-12 · 0-0-24)
   ========================================================================== */
.promo-split-grid {
  display: grid;
  grid-template-columns: 1fr 1.7fr;
  gap: 14px;
  align-items: start;
}

.promo-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.promo-param-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px 12px;
}

.promo-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.promo-field label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4b5872;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.promo-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.promo-input {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #b8c3d3;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  background-color: #ffffff;
  outline: none;
  font-family: inherit;
}

.promo-input:focus {
  border-color: #0f172a;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.08);
}

.promo-input:disabled {
  background-color: #f8fafc;
  color: #6b7a90;
  cursor: not-allowed;
}

.promo-unit {
  font-size: 12px;
  font-weight: 600;
  color: #4b5872;
  flex-shrink: 0;
}

.promo-hint {
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
}

.promo-verdict {
  background-color: #0f172a;
  color: #e2e8f0;
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.promo-verdict-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7a90;
}

.promo-verdict-text {
  font-size: 14px;
  line-height: 1.55;
  color: #f1f5f9;
}

.promo-verdict-text strong {
  color: #ffffff;
}

.promo-verdict-note {
  font-size: 12px;
  color: #b8c3d3;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  padding-top: 8px;
  margin-top: 2px;
}

.promo-quick-table tbody tr.promo-row-active td {
  background-color: #f8fafc;
}

@media (max-width: 1100px) {
  .promo-split-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   ФИНАНСЫ ИЗ XLSX (выгрузка Kaspi / Kaspi Pay)
   ========================================================================== */
.page-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fin-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.fin-head-left {
  flex: 1;
  min-width: 0;
}

.fin-head-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.fin-head-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  width: 360px;
  flex-shrink: 0;
}

.fin-dropzone {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px dashed #6b7a90;
  border-radius: 14px;
  background-color: #f8fafc;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.fin-dropzone:hover,
.fin-dropzone.over {
  border-color: #2563eb;
  background-color: #eff6ff;
}

.fin-dropzone.busy {
  opacity: 0.7;
  pointer-events: none;
}

.fin-drop-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background-color: #0f172a;
  color: #ffffff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.fin-basis {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: #4b5872;
  font-weight: 600;
}

.fin-basis > span {
  white-space: nowrap;
}

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

.fin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.fin-kpi {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
  border-top: 3px solid #b8c3d3;
}

.fin-kpi.red { border-top-color: #fca5a5; }
.fin-kpi.green { border-top-color: #6ee7b7; }
.fin-kpi.blue { border-top-color: #93c5fd; }

.fin-kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #4b5872;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fin-kpi-value {
  font-size: 21px;
  font-weight: 800;
  color: #0f172a;
  margin-top: 6px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.fin-kpi.red .fin-kpi-value { color: #b91c1c; }
.fin-kpi.green .fin-kpi-value { color: #065f46; }
.fin-kpi.blue .fin-kpi-value { color: #1e3a8a; }

.fin-kpi-sub {
  font-size: 12px;
  color: #4b5872;
  margin-top: 5px;
  line-height: 1.4;
}

.fin-active-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid #bfdbfe;
  background-color: #eff6ff;
  border-radius: 12px;
  font-size: 12.5px;
  color: #1e3a8a;
  line-height: 1.5;
}

.fin-active-note .badge-pill {
  flex-shrink: 0;
  margin-top: 1px;
}

.fin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  background-color: #f8fafc;
}

.fin-tab {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
}

.fin-tab:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.fin-tab.active {
  background-color: #0f172a;
  color: #ffffff;
}

.pivot-table.fin-table {
  font-size: 12.5px;
}

.pivot-table.fin-table thead th {
  padding: 9px 9px;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  white-space: normal;
  line-height: 1.25;
  vertical-align: bottom;
  cursor: default;
}

.pivot-table.fin-table thead th:hover {
  background-color: #f8fafc;
  color: #4b5872;
}

.pivot-table.fin-table tbody td {
  padding: 9px 9px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pivot-table.fin-table thead th:first-child,
.pivot-table.fin-table tbody td:first-child {
  padding-left: 14px;
}

.pivot-table.fin-table thead th:last-child,
.pivot-table.fin-table tbody td:last-child {
  padding-right: 14px;
}

.pivot-table.fin-table tbody td:first-child {
  white-space: normal;
}

.fin-table tr[data-fin-month]:hover td {
  background-color: #eff6ff;
}

.fin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
}

.fin-toolbar .reviews-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fin-costs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  background-color: #f8fafc;
}

.fin-costs-bar-text {
  min-width: 0;
  flex: 1;
}

.fin-costs-bar .reviews-pill-btn {
  flex-shrink: 0;
}

.fin-table tr.fin-row-muted td {
  background-color: #fcfcfd;
}

.fin-table tr.fin-row-muted td:first-child > div:first-child {
  color: #475569;
}

@media (max-width: 900px) {
  .fin-costs-bar {
    flex-direction: column;
    align-items: stretch;
  }
}

.fin-defaults {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid #e2e8f0;
  background-color: #ffffff;
}

.fin-default-field label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: #4b5872;
  margin-bottom: 5px;
}

.fin-default-field .pnl-input {
  width: 100%;
}

.fin-default-note {
  grid-column: 1 / -1;
  font-size: 12.5px;
  color: #475569;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  line-height: 1.5;
}

.fin-share-bar {
  width: 70px;
  height: 5px;
  border-radius: 5px;
  background-color: #f1f5f9;
  overflow: hidden;
}

.fin-share-bar span {
  display: block;
  height: 100%;
  border-radius: 5px;
  background-color: #2563eb;
}

.fin-expenses {
  padding: 14px;
}

.fin-exp-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.fin-exp-summary div {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
}

.fin-exp-summary span {
  display: block;
  font-size: 11.5px;
  color: #4b5872;
  font-weight: 600;
}

.fin-exp-summary b {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  margin-top: 3px;
}

.fin-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

@media (max-width: 1280px) {
  .fin-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fin-defaults { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .fin-head { flex-direction: column; }
  .fin-head-right { width: 100%; }
  .fin-exp-summary { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .fin-kpi-grid { grid-template-columns: 1fr; }
  .fin-defaults { grid-template-columns: 1fr; }
}

/* ===== Финансы → Расходы по дням (статьи × дни) ===== */
.fin-exp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 14px 10px;
}
.fin-exp-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fin-exp-nav .reviews-pill-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  font-size: 18px;
  line-height: 1;
}
.fin-exp-nav .reviews-pill-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.fin-exp-stats {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
.fin-exp-stats div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fin-exp-stats span {
  font-size: 11px;
  color: #4b5872;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
}
.fin-exp-stats b {
  font-size: 15px;
  color: #0f172a;
  font-weight: 800;
}
.fin-exp-scroll {
  overflow: auto;
  border-top: 1px solid #e2e8f0;
}
.fin-exp-table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 100%;
  font-size: 12px;
}
.fin-exp-table thead th,
.fin-exp-table tbody td,
.fin-exp-table tfoot td {
  border-bottom: 1px solid #eef2f7;
  border-right: 1px solid #f1f5f9;
  padding: 0;
  white-space: nowrap;
}
.fin-exp-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f8fafc;
  padding: 6px 4px;
  text-align: center;
  font-weight: 700;
  color: #334155;
  font-size: 12px;
  line-height: 1.15;
  text-transform: none;
  letter-spacing: 0;
}
.fin-exp-table thead th:hover {
  background: #f8fafc;
  color: #334155;
}
.fin-exp-table tbody tr:hover {
  background: transparent;
}
.fin-exp-table thead th .fin-exp-wd {
  font-size: 10px;
  font-weight: 600;
  color: #6b7a90;
  text-transform: lowercase;
}
.fin-exp-table .fin-exp-name {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  min-width: 210px;
  max-width: 260px;
  text-align: left;
  padding: 0 10px;
  font-weight: 600;
  color: #0f172a;
  box-shadow: 2px 0 0 #e2e8f0;
}
.fin-exp-table thead th.fin-exp-name {
  z-index: 6;
  background: #f8fafc;
  padding: 6px 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  color: #4b5872;
}
.fin-exp-table thead th.fin-exp-name:hover {
  background: #f8fafc;
  color: #4b5872;
}
.fin-exp-name-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 34px;
}
.fin-exp-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fin-exp-actions {
  display: inline-flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.12s;
}
.fin-exp-table tr:hover .fin-exp-actions {
  opacity: 1;
}
.fin-exp-icon {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #4b5872;
  border-radius: 6px;
  width: 22px;
  height: 22px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.fin-exp-icon:hover {
  color: #0f172a;
  border-color: #b8c3d3;
  background: #f8fafc;
}
.fin-exp-table .fin-exp-cell {
  width: 58px;
  min-width: 58px;
  max-width: 58px;
  background: #fff;
  padding: 0;
}
.fin-exp-table .fin-exp-day {
  width: 58px;
  min-width: 58px;
  max-width: 58px;
}
.fin-exp-cell.we,
.fin-exp-table th.we,
.fin-exp-table td.fin-exp-total.we {
  background: #f8fafc;
}
.fin-exp-cell.today,
.fin-exp-table th.today,
.fin-exp-table td.fin-exp-total.today {
  background: #eff6ff;
}
.fin-exp-table th.today div:first-child {
  color: #1d4ed8;
}
.fin-exp-input {
  width: 100%;
  height: 34px;
  border: 0;
  background: transparent;
  text-align: right;
  padding: 0 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  outline: none;
  -moz-appearance: textfield;
}
.fin-exp-input::-webkit-outer-spin-button,
.fin-exp-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.fin-exp-input::placeholder {
  color: #e2e8f0;
  font-weight: 400;
}
.fin-exp-input:focus {
  box-shadow: inset 0 0 0 2px #0f766e;
  background: #fff;
  border-radius: 4px;
}
.fin-exp-input.saving {
  opacity: 0.6;
}
.fin-exp-input.error {
  box-shadow: inset 0 0 0 2px #dc2626;
}
.fin-exp-table tbody td.fin-exp-total,
.fin-exp-table thead th.fin-exp-total {
  text-align: right;
  padding: 0 10px;
  font-weight: 800;
  color: #0f172a;
  background: #fbfcfe;
  min-width: 90px;
}
.fin-exp-table thead th.fin-exp-total {
  padding: 6px 10px;
}
.fin-exp-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 3;
  background: #f1f5f9;
  font-weight: 800;
  color: #0f172a;
  height: 36px;
  border-top: 2px solid #b8c3d3;
  text-align: right;
  padding: 0 10px;
}
.fin-exp-table tfoot td.fin-exp-name {
  z-index: 6;
  background: #f1f5f9;
  text-align: left;
}
.fin-exp-table tfoot td.fin-exp-total {
  background: #f1f5f9;
  padding: 0 6px;
}
.fin-exp-table tfoot td.fin-exp-total.we,
.fin-exp-table tfoot td.fin-exp-total.today {
  background: #f1f5f9;
}
.fin-exp-add {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px 14px;
  border-top: 1px solid #e2e8f0;
}
.fin-exp-add .pnl-input {
  height: 36px;
  flex: 1;
  min-width: 220px;
}

/* ===== Финансы → Юнитка (показатели × периоды) ===== */
.fin-unit-scroll {
  overflow: auto;
  border-top: 1px solid #e2e8f0;
}
.fin-unit-table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 100%;
  font-size: 12.5px;
}
.fin-unit-table thead th,
.fin-unit-table tbody td {
  border-bottom: 1px solid #eef2f7;
  border-right: 1px solid #f1f5f9;
  padding: 7px 10px;
  white-space: nowrap;
  text-align: right;
}
.fin-unit-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f8fafc;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.15;
  min-width: 104px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12.5px;
}
.fin-unit-table thead th:hover {
  background: #f8fafc;
  color: #0f172a;
}
.fin-unit-table tbody tr:hover {
  background: transparent;
}
.fin-unit-colsub {
  font-size: 10.5px;
  font-weight: 600;
  color: #6b7a90;
}
.fin-unit-table .fin-unit-label {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  text-align: left;
  min-width: 290px;
  font-weight: 600;
  color: #334155;
  box-shadow: 2px 0 0 #e2e8f0;
}
.fin-unit-table thead th.fin-unit-label {
  z-index: 6;
  background: #f8fafc;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  color: #4b5872;
}
.fin-unit-table th.we,
.fin-unit-table td.we {
  background: #fafbfd;
}
.fin-unit-val {
  font-variant-numeric: tabular-nums;
  color: #0f172a;
}
.fin-unit-val.neg {
  color: #b91c1c;
}
.fin-unit-row.muted td {
  color: #4b5872;
  font-weight: 500;
}
.fin-unit-row.muted .fin-unit-label {
  color: #4b5872;
}
.fin-unit-row.strong td,
.fin-unit-row.sub td {
  font-weight: 800;
  background: #f8fafc;
}
.fin-unit-row.strong .fin-unit-label,
.fin-unit-row.sub .fin-unit-label {
  color: #0f172a;
  background: #f8fafc;
}
.fin-unit-row.section td {
  border-top: 2px solid #e2e8f0;
}
.fin-unit-row.indent .fin-unit-label {
  padding-left: 26px;
  font-weight: 500;
  color: #4b5872;
}
.fin-unit-row.indent td {
  font-weight: 500;
  font-size: 12px;
}
.fin-unit-row.final td {
  font-weight: 900;
  font-size: 13px;
  background: #f0fdf4;
  border-top: 2px solid #bbf7d0;
}
.fin-unit-row.final .fin-unit-label {
  color: #0f172a;
  background: #f0fdf4;
}
.fin-unit-val.pos {
  color: #15803d;
}
.fin-unit-val.warn {
  color: #b45309;
}
.fin-unit-val.loss {
  color: #b91c1c;
}
.fin-unit-row.pctstrong td {
  font-weight: 800;
}
.fin-unit-total {
  background: #fbfcfe !important;
  font-weight: 800;
}
.fin-unit-table thead th.fin-unit-total {
  background: #f1f5f9 !important;
}
.fin-unit-note {
  font-size: 10px;
  color: #b45309;
  font-weight: 500;
  white-space: nowrap;
}
@media (max-width: 768px) {
  .fin-exp-table .fin-exp-name {
    min-width: 150px;
    max-width: 170px;
  }
  .fin-unit-table .fin-unit-label {
    min-width: 200px;
    white-space: normal;
  }
}

/* Столбец «Итого» закреплён справа */
.fin-exp-table thead th.fin-exp-sum,
.fin-exp-table tbody td.fin-exp-sum,
.fin-exp-table tfoot td.fin-exp-sum {
  position: sticky;
  right: 0;
  z-index: 4;
  background: #f8fafc;
  box-shadow: -2px 0 0 #e2e8f0;
}
.fin-exp-table thead th.fin-exp-sum {
  z-index: 6;
}
.fin-exp-table tfoot td.fin-exp-sum {
  z-index: 6;
  background: #f1f5f9;
}
.fin-unit-table thead th.fin-unit-total,
.fin-unit-table tbody td.fin-unit-total {
  position: sticky;
  right: 0;
  z-index: 4;
  box-shadow: -2px 0 0 #e2e8f0;
  background: #f8fafc !important;
}
.fin-unit-table thead th.fin-unit-total {
  z-index: 6;
  background: #f1f5f9 !important;
}
.fin-unit-row.final td.fin-unit-total {
  background: #ecfdf5 !important;
}

/* ===== Юнитка → большой график оборота ===== */
.fin-chart-card {
  margin: 12px;
  border-radius: 16px;
  background: radial-gradient(120% 140% at 0% 0%, #16224a 0%, #0b1229 55%, #0a0f24 100%);
  color: #e2e8f0;
  padding: 18px 18px 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.fin-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.fin-chart-title {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}
.fin-chart-sub {
  font-size: 12px;
  color: #6b7a90;
  margin-top: 3px;
}
.fin-chart-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.fin-chart-seg {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.fin-chart-seg button {
  border: 0;
  background: transparent;
  color: #b8c3d3;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.fin-chart-seg button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}
.fin-chart-seg button.active {
  background: linear-gradient(90deg, #3b82f6, #22d3ee);
  color: #0b1229;
  font-weight: 800;
}
.fin-chart-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 4px;
}
.fin-chart-stats div {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.fin-chart-stats span {
  font-size: 11px;
  color: #6b7a90;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.fin-chart-stats b {
  font-size: 17px;
  font-weight: 800;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}
.fin-chart-stats b.up {
  color: #34d399;
}
.fin-chart-stats b.down {
  color: #fb7185;
}
.fin-chart-stats i {
  font-style: normal;
  font-size: 11.5px;
  color: #4b5872;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fin-chart-body {
  width: 100%;
  min-height: 320px;
}
.fin-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: inherit;
  cursor: crosshair;
}
.fin-chart-grid {
  stroke: rgba(148, 163, 184, 0.12);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}
.fin-chart-grid.zero {
  stroke: rgba(148, 163, 184, 0.3);
  stroke-dasharray: none;
}
.fin-chart-ytick {
  fill: #4b5872;
  font-size: 11px;
  text-anchor: end;
  font-variant-numeric: tabular-nums;
}
.fin-chart-xtick {
  fill: #6b7a90;
  font-size: 11.5px;
  font-weight: 600;
  text-anchor: middle;
  transition: fill 0.12s;
}
.fin-chart-xtick.active {
  fill: #ffffff;
  font-weight: 800;
}
.fin-chart-xsub {
  fill: #4b5872;
  font-size: 10px;
  text-anchor: middle;
}
.fin-chart-mline {
  stroke: rgba(226, 232, 240, 0.35);
  stroke-width: 1.2;
}
.fin-chart-mdot {
  fill: #ffffff;
  stroke: #22d3ee;
  stroke-width: 3;
}
.fin-chart-mdot-glow {
  fill: rgba(34, 211, 238, 0.22);
}
.fin-chart-mlabel rect {
  fill: rgba(15, 23, 42, 0.92);
  stroke: rgba(34, 211, 238, 0.45);
  stroke-width: 1;
}
.fin-chart-mval {
  fill: #5eead4;
  font-size: 13px;
  font-weight: 800;
  text-anchor: middle;
  font-variant-numeric: tabular-nums;
}
.fin-chart-mper {
  fill: #b8c3d3;
  font-size: 10.5px;
  text-anchor: middle;
}
.fin-chart-bar {
  opacity: 0.95;
  transition: opacity 0.12s;
}
.fin-chart-bar:hover {
  opacity: 1;
}
.fin-chart-barval {
  fill: #ffffff;
  font-size: 13px;
  font-weight: 800;
  text-anchor: middle;
  font-variant-numeric: tabular-nums;
}
.fin-chart-empty {
  padding: 60px 20px;
  text-align: center;
  color: #6b7a90;
}
@media (max-width: 900px) {
  .fin-chart-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ==========================================================================
   THEME v32 — ZHASSTAT Fresh: светлый интерфейс, зелёный бренд, градиентные KPI,
   мягкие карточки (в духе современных admin-дашбордов)
   ========================================================================== */
:root {
  --font-sans: "Manrope", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bg-main: #f3f6fb;
  --bg-sidebar: #ffffff;
  --border-color: #e6ebf2;
  --border-subtle: #eef2f7;
  --text-primary: #1b2540;
  --text-secondary: #46536e;
  --text-muted: #7b879d;

  --brand: #22c55e;
  --brand-600: #16a34a;
  --brand-700: #15803d;
  --brand-soft: #e9fbf0;
  --brand-ring: rgba(34, 197, 94, 0.22);
  --grad-brand: linear-gradient(135deg, #4ade80 0%, #22c55e 55%, #16a34a 100%);
  --grad-red: linear-gradient(135deg, #fb7185 0%, #f43f5e 100%);
  --grad-green: linear-gradient(135deg, #4ade80 0%, #16a34a 100%);
  --grad-blue: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
  --grad-purple: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  --grad-orange: linear-gradient(135deg, #fbbf24 0%, #f97316 100%);
  --grad-dark: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);

  --radius-card: 18px;
  --shadow-card: 0 1px 2px rgba(27, 37, 64, 0.03), 0 14px 34px -18px rgba(27, 37, 64, 0.16);
  --shadow-card-hover: 0 2px 4px rgba(27, 37, 64, 0.04), 0 22px 44px -18px rgba(27, 37, 64, 0.22);
  --shadow-brand: 0 10px 22px -10px rgba(34, 197, 94, 0.65);
}

html, body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  background-color: var(--bg-main);
  background-image: radial-gradient(900px 420px at 100% -10%, rgba(34, 197, 94, 0.07), transparent 60%),
    radial-gradient(700px 380px at -10% 20%, rgba(59, 130, 246, 0.06), transparent 60%);
  background-attachment: fixed;
}
.main-area {
  background: transparent;
}
h1, h2, h3, h4, .page-title {
  letter-spacing: -0.015em;
}
button, input, select, textarea {
  font-family: inherit;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 268px;
  min-width: 268px;
  border-right: 0;
  box-shadow: 1px 0 0 rgba(27, 37, 64, 0.05), 12px 0 40px -28px rgba(27, 37, 64, 0.18);
}
.sidebar-brand {
  padding: 20px 20px 12px;
}
.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--grad-brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-brand);
}
.brand-text {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--brand-600);
  line-height: 1;
}
.brand-text b {
  color: #1b2540;
  font-weight: 800;
}
.sidebar-nav {
  padding: 6px 14px 12px;
}
.nav-section-title {
  color: #9aa5ba;
  font-size: 11px;
  letter-spacing: 0.08em;
  margin: 16px 10px 6px;
}
.nav-item {
  padding: 10px 12px;
  border-radius: 12px;
  color: #4b5873;
  font-size: 13.5px;
  font-weight: 600;
  gap: 11px;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.nav-item:hover {
  background-color: #f1f6fb;
  color: #1b2540;
}
.nav-item.active {
  background: var(--grad-brand);
  color: #ffffff;
  box-shadow: var(--shadow-brand);
}
.nav-icon {
  width: 22px;
  height: 22px;
  color: #8a95ab;
}
.nav-item:hover .nav-icon {
  color: var(--brand-600);
}
.nav-item.active .nav-icon {
  color: #ffffff;
}
.nav-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: #5b6882;
  padding: 2px 8px;
  border-radius: 999px;
  background-color: #eef2f7;
}
.nav-item.active .nav-badge,
.nav-subitem.active .nav-badge {
  background-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}
.nav-subitems {
  gap: 2px;
  margin: 2px 0 4px;
}
.nav-subitem {
  padding: 7px 12px 7px 45px;
  border-radius: 10px;
  color: #5b6882;
  font-weight: 500;
  position: relative;
}
.nav-subitem::before {
  content: "";
  position: absolute;
  left: 23px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: #b8c3d3;
  transition: background 0.15s, transform 0.15s;
}
.nav-subitem:hover {
  background-color: #f1f6fb;
  color: #1b2540;
}
.nav-subitem:hover::before {
  background: var(--brand);
}
.nav-subitem.active {
  background-color: var(--brand-soft);
  color: var(--brand-700);
  font-weight: 700;
}
.nav-subitem.active::before {
  background: var(--brand);
  transform: scale(1.25);
}
.nav-subitem.active .nav-badge {
  background: rgba(34, 197, 94, 0.18);
  color: var(--brand-700);
}
.sidebar-footer {
  border-top: 0;
  padding: 10px 14px 16px;
  background: transparent;
}
.sidebar-promo {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 16px 16px 14px;
  background: var(--grad-orange);
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 12px 26px -14px rgba(249, 115, 22, 0.7);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.sidebar-promo:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px -14px rgba(249, 115, 22, 0.8);
}
.sidebar-promo::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -34px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}
.sidebar-promo-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.sidebar-promo-title {
  font-size: 14px;
  font-weight: 800;
}
.sidebar-promo-text {
  font-size: 11.5px;
  opacity: 0.92;
  margin-top: 2px;
  line-height: 1.35;
}
.sidebar-promo-link {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 800;
}
.app-layout.sidebar-collapsed .sidebar {
  box-shadow: none;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  gap: 14px;
  padding: 12px 28px;
  background: rgba(243, 246, 251, 0.82);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid rgba(27, 37, 64, 0.05);
}
.sidebar-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: #4b5873;
  box-shadow: 0 1px 2px rgba(27, 37, 64, 0.04);
}
.sidebar-toggle-btn:hover {
  color: var(--brand-600);
  border-color: #cfe9d9;
  background: #ffffff;
}
.breadcrumbs {
  font-size: 13.5px;
  color: #7b879d;
  font-weight: 500;
}
.breadcrumb-current {
  color: #1b2540;
  font-weight: 700;
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-date {
  font-size: 12.5px;
  font-weight: 600;
  color: #5b6882;
  text-transform: capitalize;
  padding: 0 4px;
}
.topbar-sync {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-700);
}
.topbar-sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
  animation: finPulse 2.2s ease-in-out infinite;
}
@keyframes finPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.08); }
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 12px 0 6px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 2px rgba(27, 37, 64, 0.04);
}
.topbar .profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: #ffffff;
  font-weight: 800;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-brand);
}
.topbar-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.topbar .profile-name {
  font-size: 13px;
  font-weight: 800;
  color: #1b2540;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-user-role {
  font-size: 11px;
  color: #7b879d;
  font-weight: 600;
}
.topbar .profile-logout-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: #6b7891;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.topbar .profile-logout-btn:hover {
  color: #e11d48;
  border-color: #fecdd3;
  background: #fff1f2;
}
.page-container {
  padding: 18px 28px 64px;
}

/* ---------- Карточки ---------- */
.summary-card, .section-action-bar, .product-group-card, .clean-card-table, .warehouse-row, .modal-card,
.info-filter-card, .info-product-select, .info-hero-card, .info-card, .home-revenue-card, .home-profit-card,
.home-stat-card, .pivot-sheet-tabs, .pivot-toolbar-card, .pivot-table-card, .pivot-chart-card,
.reviews-kpi-card, .reviews-done-analysis-card, .reviews-products-card, .reviews-banner-card,
.reviews-filter-bar-card, .review-item-card, .cashflow-kpi-card, .cashflow-day-card, .pnl-cascade-card,
.pnl-expenses-card, .promo-card, .fin-kpi {
  border: 1px solid rgba(27, 37, 64, 0.06);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  background-color: #ffffff;
}
.pivot-table-card, .clean-card-table {
  overflow: hidden;
}
.info-card-title, .pivot-card-title, .home-card-title, .summary-card-title {
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #1b2540;
}
.info-card-desc {
  color: #7b879d;
}

/* ---------- Градиентные KPI-плитки ---------- */
.home-kpi-row .home-stat-card,
.fin-kpi-grid .fin-kpi:nth-child(-n + 4),
.summary-cards-grid .summary-card,
.cashflow-kpi-grid .cashflow-kpi-card,
.reviews-kpi-grid .reviews-kpi-card,
.info-hero-card,
.oos-kpi-grid > * {
  position: relative;
  overflow: hidden;
  border: 0;
  color: #ffffff;
  background: var(--grad-blue);
  box-shadow: 0 16px 30px -16px rgba(37, 99, 235, 0.55);
  isolation: isolate;
}
.home-kpi-row .home-stat-card::before,
.fin-kpi-grid .fin-kpi:nth-child(-n + 4)::before,
.summary-cards-grid .summary-card::before,
.cashflow-kpi-grid .cashflow-kpi-card::before,
.reviews-kpi-grid .reviews-kpi-card::before,
.info-hero-card::before,
.oos-kpi-grid > *::before {
  content: "";
  position: absolute;
  right: -34px;
  top: -44px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  pointer-events: none;
  z-index: -1;
}
.home-kpi-row .home-stat-card::after,
.fin-kpi-grid .fin-kpi:nth-child(-n + 4)::after,
.summary-cards-grid .summary-card::after,
.cashflow-kpi-grid .cashflow-kpi-card::after,
.reviews-kpi-grid .reviews-kpi-card::after,
.info-hero-card::after,
.oos-kpi-grid > *::after {
  content: "";
  position: absolute;
  right: 26px;
  bottom: -58px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
  z-index: -1;
}
/* порядок цветов: красный → зелёный → синий → фиолетовый (как в референсе) */
.home-kpi-row .home-stat-card:nth-child(4n + 1),
.summary-cards-grid .summary-card:nth-child(4n + 1),
.cashflow-kpi-grid .cashflow-kpi-card:nth-child(4n + 1),
.reviews-kpi-grid .reviews-kpi-card:nth-child(4n + 1),
.oos-kpi-grid > *:nth-child(4n + 1) {
  background: var(--grad-red);
  box-shadow: 0 16px 30px -16px rgba(244, 63, 94, 0.6);
}
.home-kpi-row .home-stat-card:nth-child(4n + 2),
.summary-cards-grid .summary-card:nth-child(4n + 2),
.cashflow-kpi-grid .cashflow-kpi-card:nth-child(4n + 2),
.reviews-kpi-grid .reviews-kpi-card:nth-child(4n + 2),
.oos-kpi-grid > *:nth-child(4n + 2) {
  background: var(--grad-green);
  box-shadow: 0 16px 30px -16px rgba(22, 163, 74, 0.6);
}
.home-kpi-row .home-stat-card:nth-child(4n + 3),
.summary-cards-grid .summary-card:nth-child(4n + 3),
.cashflow-kpi-grid .cashflow-kpi-card:nth-child(4n + 3),
.reviews-kpi-grid .reviews-kpi-card:nth-child(4n + 3),
.oos-kpi-grid > *:nth-child(4n + 3) {
  background: var(--grad-blue);
  box-shadow: 0 16px 30px -16px rgba(37, 99, 235, 0.6);
}
.home-kpi-row .home-stat-card:nth-child(4n + 4),
.summary-cards-grid .summary-card:nth-child(4n + 4),
.cashflow-kpi-grid .cashflow-kpi-card:nth-child(4n + 4),
.reviews-kpi-grid .reviews-kpi-card:nth-child(4n + 4),
.oos-kpi-grid > *:nth-child(4n + 4) {
  background: var(--grad-purple);
  box-shadow: 0 16px 30px -16px rgba(124, 58, 237, 0.6);
}
/* Финансы: Выручка — зелёная, Комиссии — красная, Акции — фиолетовая, Доставка — синяя */
.fin-kpi-grid .fin-kpi:nth-child(1) { background: var(--grad-green); box-shadow: 0 16px 30px -16px rgba(22, 163, 74, 0.6); }
.fin-kpi-grid .fin-kpi:nth-child(2) { background: var(--grad-red); box-shadow: 0 16px 30px -16px rgba(244, 63, 94, 0.6); }
.fin-kpi-grid .fin-kpi:nth-child(3) { background: var(--grad-purple); box-shadow: 0 16px 30px -16px rgba(124, 58, 237, 0.6); }
.fin-kpi-grid .fin-kpi:nth-child(4) { background: var(--grad-blue); box-shadow: 0 16px 30px -16px rgba(37, 99, 235, 0.6); }
/* Информация: карточки-герои по цветам */
.info-hero-card:nth-child(4n + 1) { background: var(--grad-green); box-shadow: 0 16px 30px -16px rgba(22, 163, 74, 0.6); }
.info-hero-card:nth-child(4n + 2) { background: var(--grad-blue); box-shadow: 0 16px 30px -16px rgba(37, 99, 235, 0.6); }
.info-hero-card:nth-child(4n + 3) { background: var(--grad-purple); box-shadow: 0 16px 30px -16px rgba(124, 58, 237, 0.6); }
.info-hero-card:nth-child(4n + 4) { background: var(--grad-red); box-shadow: 0 16px 30px -16px rgba(244, 63, 94, 0.6); }

/* Всё содержимое плиток — белое (перебивает inline-цвета) */
.home-kpi-row .home-stat-card *,
.fin-kpi-grid .fin-kpi:nth-child(-n + 4) *,
.summary-cards-grid .summary-card *,
.cashflow-kpi-grid .cashflow-kpi-card *,
.reviews-kpi-grid .reviews-kpi-card *,
.info-hero-card *,
.oos-kpi-grid > * * {
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.28) !important;
}
.home-kpi-row .home-stat-card .home-stat-lbl,
.home-kpi-row .home-stat-card .home-stat-meta,
.fin-kpi-grid .fin-kpi:nth-child(-n + 4) .fin-kpi-label,
.fin-kpi-grid .fin-kpi:nth-child(-n + 4) .fin-kpi-sub,
.summary-cards-grid .summary-card .summary-card-title,
.summary-cards-grid .summary-card .summary-card-sub,
.cashflow-kpi-grid .cashflow-kpi-card .cashflow-kpi-title,
.cashflow-kpi-grid .cashflow-kpi-card .cashflow-kpi-sub,
.reviews-kpi-grid .reviews-kpi-card .reviews-kpi-label,
.reviews-kpi-grid .reviews-kpi-card .reviews-kpi-sub,
.info-hero-card .info-hero-label,
.info-hero-card .info-hero-sub {
  opacity: 0.9;
}
.home-kpi-row .home-stat-card .home-stat-val,
.fin-kpi-grid .fin-kpi:nth-child(-n + 4) .fin-kpi-value,
.summary-cards-grid .summary-card .summary-card-number,
.cashflow-kpi-grid .cashflow-kpi-card .cashflow-kpi-net,
.reviews-kpi-grid .reviews-kpi-card .reviews-kpi-val,
.info-hero-card .info-hero-title {
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
/* бейджи, пилюли и ссылки внутри плиток */
.home-kpi-row .home-stat-card [class*="badge"],
.home-kpi-row .home-stat-card [class*="pill"],
.home-kpi-row .home-stat-card [class*="delta"],
.home-kpi-row .home-stat-card [class*="trend"],
.fin-kpi-grid .fin-kpi:nth-child(-n + 4) [class*="badge"],
.fin-kpi-grid .fin-kpi:nth-child(-n + 4) [class*="pill"],
.summary-cards-grid .summary-card [class*="badge"],
.summary-cards-grid .summary-card [class*="pill"],
.summary-cards-grid .summary-card [class*="delta"],
.cashflow-kpi-grid .cashflow-kpi-card [class*="badge"],
.cashflow-kpi-grid .cashflow-kpi-card [class*="pill"],
.reviews-kpi-grid .reviews-kpi-card [class*="badge"],
.reviews-kpi-grid .reviews-kpi-card [class*="pill"],
.info-hero-card [class*="badge"],
.info-hero-card [class*="pill"],
.oos-kpi-grid > * [class*="badge"],
.oos-kpi-grid > * [class*="pill"] {
  background: rgba(255, 255, 255, 0.2) !important;
  border-color: transparent !important;
}
.home-kpi-row .home-stat-card a,
.home-kpi-row .home-stat-card .home-stat-link,
.summary-cards-grid .summary-card a,
.cashflow-kpi-grid .cashflow-kpi-card a,
.reviews-kpi-grid .reviews-kpi-card a,
.info-hero-card a {
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.5);
  text-underline-offset: 3px;
}
.info-hero-icon {
  background: rgba(255, 255, 255, 0.22) !important;
  border-radius: 12px;
}
/* прогресс-полоски и спарклайны внутри плиток */
.home-kpi-row .home-stat-card [style*="background"]:not(svg):not(path),
.summary-cards-grid .summary-card [style*="background"]:not(svg):not(path) {
  filter: saturate(0.2) brightness(1.6);
}

/* ---------- Кнопки, вкладки, переключатели → зелёный бренд ---------- */
.kaspi-sync-pill {
  border: 0;
  border-radius: 12px;
  background: var(--grad-brand);
  color: #ffffff;
  font-weight: 700;
  box-shadow: var(--shadow-brand);
  height: 36px;
}
.kaspi-sync-pill:hover:not(:disabled) {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  transform: translateY(-1px);
}
.kaspi-sync-pill:disabled {
  opacity: 0.65;
}
.btn-primary, .batch-green-btn {
  border-radius: 12px;
  background: var(--grad-brand);
  box-shadow: var(--shadow-brand);
  font-weight: 700;
}
.btn-primary:hover, .batch-green-btn:hover {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}
.pivot-tab-btn, .fin-tab, .reviews-pill-btn, .info-metric-btn {
  border-radius: 10px;
  font-weight: 600;
}
.pivot-tab-btn.active, .fin-tab.active, .reviews-pill-btn.active {
  background: var(--grad-brand);
  color: #ffffff;
  border-color: transparent;
  box-shadow: var(--shadow-brand);
  font-weight: 700;
}
.pivot-tab-btn:hover:not(.active), .fin-tab:hover:not(.active), .reviews-pill-btn:hover:not(.active) {
  background-color: var(--brand-soft);
  color: var(--brand-700);
  border-color: #cfe9d9;
}
.reviews-pill-btn {
  border-radius: 999px;
}
.info-metric-switch, .seg-filter-group {
  background-color: #eef2f7;
  border-color: transparent;
  border-radius: 12px;
  padding: 3px;
}
.info-metric-btn.active {
  background: #ffffff;
  color: var(--brand-700);
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(27, 37, 64, 0.1);
  border-radius: 9px;
}
.fin-tabs {
  gap: 6px;
  padding: 10px 12px;
}
.pnl-cascade-row.net-final, .promo-verdict {
  background: linear-gradient(135deg, #0f172a 0%, #14532d 100%);
  border-radius: 14px;
}
.fin-drop-icon {
  background: var(--grad-brand);
  box-shadow: var(--shadow-brand);
}
.fin-dropzone {
  border-color: #bfe8cf;
  background-color: #f3fcf6;
  border-radius: 16px;
}
.fin-dropzone:hover {
  border-color: var(--brand);
  background-color: #e9fbf0;
}
.toast {
  border-radius: 14px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  box-shadow: 0 18px 40px -16px rgba(15, 23, 42, 0.6);
}

/* ---------- Поля ввода ---------- */
.pnl-input, .cogs-input, input[type="date"], input[type="text"], input[type="number"], input[type="search"], select {
  border-radius: 10px;
}
.pnl-input:focus, .cogs-input:focus, input[type="date"]:focus, input[type="text"]:focus, input[type="number"]:focus, input[type="search"]:focus, select:focus {
  outline: none;
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px var(--brand-ring);
}

/* ---------- Таблицы ---------- */
.pivot-table thead th {
  background-color: #f6f8fc;
  color: #7b879d;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.pivot-table thead th:hover {
  background-color: #eef2f8;
  color: #1b2540;
}
.pivot-table tbody tr:hover {
  background-color: #f6fbf8;
}
.pivot-table tr.pivot-total-row td {
  background-color: #f3fcf6;
  border-top-color: #bfe8cf;
  border-bottom-color: #bfe8cf;
}
.badge-pill {
  border-radius: 999px;
  font-weight: 700;
}
.status-dot.pub {
  background-color: var(--brand);
}

/* ---------- Финансы: KPI 2-го ряда и Юнитка ---------- */
.fin-kpi-grid .fin-kpi:nth-child(n + 5) {
  border-top-width: 1px;
  border-top-color: rgba(27, 37, 64, 0.06);
  position: relative;
}
.fin-kpi-grid .fin-kpi:nth-child(n + 5)::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: 0;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--grad-brand);
}
.fin-kpi-grid .fin-kpi.red:nth-child(n + 5)::before { background: var(--grad-red); }
.fin-kpi-grid .fin-kpi.blue:nth-child(n + 5)::before { background: var(--grad-blue); }
.fin-kpi-grid .fin-kpi.green:nth-child(n + 5)::before { background: var(--grad-green); }
.fin-chart-card {
  border-radius: 18px;
}
.fin-exp-input:focus {
  box-shadow: inset 0 0 0 2px var(--brand);
}
.fin-unit-row.final td {
  background: #f0fdf4;
}

/* ---------- Главная: hero-карточки ---------- */
.home-revenue-card {
  background-image: radial-gradient(420px 200px at 100% 0%, rgba(34, 197, 94, 0.1), transparent 60%);
}
.home-profit-card {
  background-image: radial-gradient(420px 200px at 100% 0%, rgba(59, 130, 246, 0.1), transparent 60%);
}

/* ---------- Прокрутка ---------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: #d6dde8;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: #b9c3d3;
  background-clip: padding-box;
  border: 2px solid transparent;
}
::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 1100px) {
  .topbar-date, .topbar-user-role { display: none; }
}
@media (max-width: 768px) {
  .topbar { padding: 10px 14px; }
  .topbar-sync { display: none; }
  .page-container { padding: 12px 14px 48px; }
}

/* ---------- THEME v32: доработки ---------- */
/* Topbar: длинные заголовки не ломают строку */
.breadcrumbs {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.breadcrumb-current {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 100%;
  vertical-align: bottom;
}
.topbar-right {
  flex: 0 0 auto;
  white-space: nowrap;
}
/* Компактная промо-карточка внизу меню */
.sidebar-promo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}
.sidebar-promo-icon {
  margin: 0;
  flex-shrink: 0;
}
.sidebar-promo-body {
  min-width: 0;
}
.sidebar-promo-text {
  display: none;
}
.sidebar-promo-title {
  font-size: 13px;
}
.sidebar-promo-link {
  margin-top: 1px;
  font-size: 11.5px;
  opacity: 0.95;
}
@media (min-height: 980px) {
  .sidebar-promo {
    display: block;
    padding: 16px 16px 14px;
  }
  .sidebar-promo-icon {
    margin-bottom: 10px;
  }
  .sidebar-promo-text {
    display: block;
  }
  .sidebar-promo-title {
    font-size: 14px;
  }
  .sidebar-promo-link {
    margin-top: 8px;
    font-size: 12px;
  }
}
/* Карточки заказов */
.kaspi-order-card {
  border: 1px solid rgba(27, 37, 64, 0.06);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
}
.kaspi-order-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(34, 197, 94, 0.35);
}
.koc-code {
  color: #2563eb;
  font-weight: 700;
}
.koc-page-btn {
  border-radius: 9px;
}
.koc-page-btn.active {
  border-color: transparent;
  color: #ffffff;
  background: var(--grad-brand);
  box-shadow: var(--shadow-brand);
}
/* Вкладки списков заказов */
.clean-tabs-row {
  border-bottom-color: rgba(27, 37, 64, 0.08);
}
.clean-tab-btn {
  font-weight: 600;
  color: #7b879d;
}
.clean-tab-btn.active {
  color: var(--brand-700);
  border-bottom-color: var(--brand);
}
.clean-tab-btn.active .clean-tab-count {
  color: var(--brand-600);
}
/* Прогресс-полоски */
.cashflow-day-bar-fill {
  background: var(--grad-brand);
}
.cashflow-day-bar {
  background-color: #e9eef5;
}
/* Инпуты поиска / селекты */
.search-input, .clean-search, .pnl-input, select.pnl-input {
  border-radius: 10px;
}
/* Заголовки страниц */
.page-container > h1:first-child,
.page-container h1.page-title,
.page-title {
  font-weight: 800;
}
/* Остатки: «Внимание» — оранжевая плитка */
.oos-kpi-grid > *:nth-child(4n + 2) {
  background: var(--grad-orange);
  box-shadow: 0 16px 30px -16px rgba(249, 115, 22, 0.6);
}
/* Главная: мини-график выручки по дням */
.home-mini-chart {
  margin: 6px 0 4px;
}
.home-mini-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #5b6882;
  margin-bottom: 6px;
}
.home-mini-chart-meta {
  font-weight: 500;
  color: #7b879d;
  white-space: nowrap;
}
.home-mini-chart-meta b {
  color: #1b2540;
  font-weight: 800;
}
.home-mini-chart-svg {
  display: block;
  width: 100%;
  height: 92px;
}
.home-mini-chart-svg rect {
  transition: opacity 0.12s;
}
.home-mini-chart-svg g:hover rect {
  opacity: 0.75;
}
.home-mini-chart-labels {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  font-size: 10.5px;
  color: #9aa5ba;
  font-weight: 600;
  text-align: center;
  margin-top: 4px;
}

/* ---------- Индикатор синхронизации в шапке ---------- */
.topbar-sync.is-syncing {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}
.topbar-sync-spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-top-color: #2563eb;
  animation: topbarSpin 0.9s linear infinite;
}
@keyframes topbarSpin {
  to { transform: rotate(360deg); }
}
body.zl-loading { overflow: hidden; }

/* ---------- THEME v37: контраст и фон (чтобы тексты не сливались) ---------- */
:root {
  --bg-main: #e1e8f1;
  --border-color: #d9e1ec;
  --border-subtle: #e3e9f1;
  --text-primary: #141c33;
  --text-secondary: #3f4b66;
  --text-muted: #6b7a90;
  --shadow-card: 0 1px 2px rgba(20, 28, 51, 0.06), 0 10px 28px -16px rgba(20, 28, 51, 0.22);
  --shadow-card-hover: 0 2px 4px rgba(20, 28, 51, 0.06), 0 22px 44px -18px rgba(20, 28, 51, 0.26);
}
body {
  background-color: var(--bg-main);
  background-image:
    radial-gradient(1100px 520px at 88% -8%, rgba(34, 197, 94, 0.20), transparent 62%),
    radial-gradient(900px 480px at -8% 28%, rgba(59, 130, 246, 0.16), transparent 60%),
    radial-gradient(700px 420px at 60% 110%, rgba(167, 139, 250, 0.14), transparent 60%),
    linear-gradient(180deg, #dde5ef 0%, #e6ecf5 100%);
  background-attachment: fixed;
  color: var(--text-primary);
}
.sidebar {
  border-right: 1px solid rgba(20, 28, 51, 0.08);
  box-shadow: 10px 0 36px -26px rgba(20, 28, 51, 0.28);
}
.topbar {
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid rgba(20, 28, 51, 0.08);
}
/* Карточки: белые, с чётким контуром на тонированном фоне */
.info-card,
.pivot-table-card,
.pivot-toolbar-card,
.home-revenue-card,
.home-pipeline-card,
.home-side-card,
.fin-card,
.fin-head,
.card,
.product-card,
.order-card,
.summary-card,
.kpi-card,
.stat-card,
.analytics-card,
.review-card,
.promo-card,
.oos-card,
.cashflow-card {
  background-color: #ffffff;
  border-color: var(--border-color);
  box-shadow: var(--shadow-card);
}
/* Заголовки таблиц и подписи — темнее и разборчивее */
.pivot-table thead th,
.fin-exp-table thead th,
table thead th {
  color: #3f4b66;
  background-color: #f3f6fa;
  border-bottom: 1px solid #d9e1ec;
}
.pivot-table tbody td,
.fin-exp-table tbody td {
  border-bottom: 1px solid #e6ecf3;
  color: #1f2a44;
}
.pivot-table tbody tr:nth-child(even) td {
  background-color: #fafbfd;
}
.pivot-table tbody tr:hover td {
  background-color: #f1f7f3;
}
.info-card-desc,
.page-subtitle,
.home-subtitle,
.muted,
.text-muted {
  color: #4b5872;
}
.info-card-title,
.page-title,
.pivot-table-card h3 {
  color: #141c33;
}
/* Сегменты и фильтры: неактивные кнопки читаемые */
.seg-filter-btn,
.pivot-tab-btn,
.scope-btn,
.fin-tab-btn {
  color: #3f4b66;
}
.seg-filter-btn .seg-filter-count {
  color: #3f4b66;
  background: #e9eef5;
}
.pivot-date-input,
.compact-search,
input[type="text"],
input[type="date"],
input[type="number"],
select {
  color: #141c33;
  border-color: #cfd8e5;
}
::placeholder {
  color: #7f8ca3;
  opacity: 1;
}
/* Главная: строки водопада не ломаются и не наезжают друг на друга */
.home-wf-row {
  gap: 12px;
  align-items: flex-start;
  line-height: 1.35;
}
.home-wf-row > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
}
.home-wf-row strong {
  flex: 0 0 auto;
  white-space: nowrap;
}
.home-waterfall-mini {
  background-color: #f6f8fb;
  border-color: #dfe6ef;
}
/* Бейджи и пилюли: чуть плотнее фон, темнее текст */
.badge-pill.gray {
  background: #e9eef5;
  color: #3f4b66;
}
.badge-pill.amber {
  background: #fdf1d6;
  color: #8a5a00;
}
.sidebar .nav-item {
  color: #2a3550;
}
.sidebar .nav-section-title {
  color: #6b7a90;
}
.sidebar .nav-badge {
  background: #e9eef5;
  color: #3f4b66;
}
.breadcrumbs,
.breadcrumbs a {
  color: #4b5872;
}
/* Сводка: таблица получает свою долю ширины, легенда диаграммы не распирает колонку */
.pivot-main-split {
  grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
}
.pivot-main-split > * {
  min-width: 0;
}

/* ---------- Отмена / Возврат: причина, где товар, когда забрать ---------- */
.koc-return {
  margin: 0 14px 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e3e9f1;
  background: #f6f8fb;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  line-height: 1.4;
  color: #2a3550;
}
.koc-return.modal {
  margin: 0;
  padding: 14px 16px;
  font-size: 13.5px;
}
.koc-return.transit {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.koc-return.pickup {
  background: #fff7ed;
  border-color: #fdba74;
}
.koc-return.urgent {
  background: #fef2f2;
  border-color: #fca5a5;
}
.koc-return.request {
  background: #f5f3ff;
  border-color: #ddd6fe;
}
.koc-return.done {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.koc-return-head {
  font-weight: 800;
  color: #141c33;
  font-size: 13px;
}
.koc-return.modal .koc-return-head {
  font-size: 15px;
}
.koc-return.pickup .koc-return-head { color: #9a3412; }
.koc-return.urgent .koc-return-head { color: #b91c1c; }
.koc-return.transit .koc-return-head { color: #1d4ed8; }
.koc-return.request .koc-return-head { color: #6d28d9; }
.koc-return.done .koc-return-head { color: #15803d; }
.koc-return-detail {
  color: #3f4b66;
}
.koc-return-reason span {
  font-weight: 700;
  color: #4b5872;
}
.koc-return-reason em {
  font-style: normal;
  color: #6b7a90;
}
.koc-return-link {
  align-self: flex-start;
  font-weight: 700;
  color: #1d4ed8;
  text-decoration: none;
  font-size: 12px;
}
.koc-return-link:hover { text-decoration: underline; }
.koc-return-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 16px;
  margin-top: 4px;
}
.koc-return-lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7a90;
}
.koc-return-val {
  font-weight: 600;
  color: #141c33;
  margin-top: 2px;
}
.koc-return-reqs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.koc-return-req {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  color: #2a3550;
}
.badge-pill.blue { background: #dbeafe; color: #1d4ed8; }
.koc-status.returning { color: #1d4ed8; }
.koc-status.pickup-needed { color: #c2410c; font-weight: 800; }
.koc-status.returned { color: #15803d; }
.kaspi-dtab-btn.attention:not(.active) {
  color: #c2410c;
  box-shadow: inset 0 0 0 1px #fdba74;
  background: #fff7ed;
}

/* Трекинг Kaspi Доставки в модальном окне заказа */
.order-track-block {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #e3e9f1;
  background: #ffffff;
}
.order-track-title {
  font-weight: 800;
  color: #141c33;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.order-track-title span {
  font-weight: 600;
  color: #4b5872;
  font-size: 12.5px;
}
.order-track-loading,
.order-track-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4b5872;
  font-size: 13px;
}
.order-track-list {
  display: flex;
  flex-direction: column;
  position: relative;
}
.order-track-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 8px 10px;
  padding: 7px 0;
  position: relative;
  font-size: 13px;
}
.order-track-row + .order-track-row::before {
  content: "";
  position: absolute;
  left: 8px;
  top: -8px;
  height: 14px;
  width: 2px;
  background: #d9e1ec;
}
.order-track-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid #d9e1ec;
  background: #ffffff;
  justify-self: center;
}
.order-track-row.done .order-track-dot {
  background: #22c55e;
  border-color: #bbf7d0;
}
.order-track-row.done + .order-track-row::before {
  background: #86efac;
}
.order-track-name {
  font-weight: 700;
  color: #141c33;
}
.order-track-row.plan .order-track-name {
  color: #6b7a90;
  font-weight: 600;
}
.order-track-time {
  font-size: 12.5px;
  color: #4b5872;
  white-space: nowrap;
}
.order-track-time strong {
  color: #141c33;
}
.order-track-time span {
  color: #6b7a90;
}

/* ---------- Заявки на возврат (Kaspi Refund API) ---------- */
.refunds-block {
  background: #ffffff;
  border: 1px solid #d9e1ec;
  border-radius: var(--radius-card, 18px);
  padding: 18px 20px 14px;
  margin-bottom: 18px;
  box-shadow: 0 6px 20px rgba(20, 28, 51, 0.05);
}
.refunds-head {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.refunds-title {
  font-size: 17px;
  font-weight: 800;
  color: #141c33;
}
.refunds-sub {
  font-size: 12px;
  color: #6b7a90;
  margin-top: 2px;
}
.refunds-kpis {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}
.refunds-kpi {
  min-width: 112px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #f3f6fa;
  border: 1px solid #e3e9f1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.refunds-kpi b {
  font-size: 17px;
  font-weight: 800;
  color: #141c33;
  line-height: 1.15;
}
.refunds-kpi span {
  font-size: 11px;
  color: #6b7a90;
  font-weight: 600;
}
.refunds-kpi.red { background: #fef2f2; border-color: #fecaca; }
.refunds-kpi.red b { color: #b91c1c; }
.refunds-kpi.amber { background: #fffbeb; border-color: #fde68a; }
.refunds-kpi.amber b { color: #b45309; }
.refunds-kpi.orange { background: #fff7ed; border-color: #fdba74; }
.refunds-kpi.orange b { color: #c2410c; }
.refunds-kpi.blue { background: #eff6ff; border-color: #bfdbfe; }
.refunds-kpi.blue b { color: #1d4ed8; }
.refunds-sync-btn {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  margin-left: auto;
  align-self: center;
  margin-bottom: 4px;
}
.refunds-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: flex-end;
  border-bottom: 1px solid #e3e9f1;
  margin-bottom: 10px;
}
.refunds-empty {
  padding: 18px 6px;
  color: #6b7a90;
  font-size: 13.5px;
}
.refunds-table-wrap {
  overflow-x: auto;
}
.refunds-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.refunds-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7a90;
  background: #f3f6fa;
  padding: 9px 10px;
  border-bottom: 1px solid #e3e9f1;
  white-space: nowrap;
}
.refunds-table thead th:first-child { border-radius: 10px 0 0 10px; }
.refunds-table thead th:last-child { border-radius: 0 10px 10px 0; }
.refunds-table tbody td {
  padding: 11px 10px;
  border-bottom: 1px solid #eef2f7;
  vertical-align: top;
  color: #2a3550;
}
.refunds-table tbody tr:last-child td { border-bottom: none; }
.refunds-table tbody tr:hover td { background: #f8fafc; }
.refunds-table tbody tr.overdue td { background: #fff5f5; }
.refunds-table tbody tr.overdue:hover td { background: #ffecec; }
.refunds-table tbody tr.soon td { background: #fffdf4; }
.refunds-table th.num, .refunds-table td.num { text-align: right; white-space: nowrap; }
.refunds-table td.deadline { width: 168px; }
.refunds-table td.action { width: 210px; }
.refunds-table td.codes { width: 120px; }
.refunds-table td.reason { width: 210px; }
.refunds-table td.cust { white-space: nowrap; width: 90px; }
.refunds-table td.more { width: 92px; text-align: right; }
.refund-chip.red, .refund-chip.amber, .refund-chip.green { white-space: normal; line-height: 1.3; }
.refund-chip {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: #eef2f7;
  color: #3f4b66;
}
.refund-chip.red { background: #fee2e2; color: #b91c1c; }
.refund-chip.amber { background: #fef3c7; color: #b45309; }
.refund-chip.green { background: #dcfce7; color: #15803d; }
.refund-chip.blue { background: #dbeafe; color: #1d4ed8; }
.refund-chip.gray { background: #eef2f7; color: #4b5872; }
.refund-action { font-weight: 700; color: #141c33; }
.refund-addr { margin-top: 3px; color: #c2410c; font-weight: 600; font-size: 12.5px; }
.refund-note { margin-top: 3px; color: #6b7a90; font-size: 12px; }
.refund-app { font-weight: 700; color: #141c33; white-space: nowrap; }
.refund-order { font-size: 12px; color: #6b7a90; white-space: nowrap; }
.refund-order a { color: #1d4ed8; font-weight: 600; text-decoration: none; }
.refund-order a:hover { text-decoration: underline; }
.refund-prod { display: flex; gap: 10px; align-items: center; min-width: 180px; }
.refund-prod img, .refund-prod-ph {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: contain;
  background: #f3f6fa;
  border: 1px solid #e3e9f1;
  flex: 0 0 42px;
}
.refund-prod-name {
  font-weight: 600;
  color: #141c33;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}
.refund-prod-sku { font-size: 12px; color: #6b7a90; }
.refund-reason { font-weight: 600; color: #141c33; }
.refund-comment {
  margin-top: 3px;
  font-size: 12px;
  color: #4b5872;
  font-style: italic;
  line-height: 1.35;
}
.btn-xs { height: 28px; padding: 0 10px; font-size: 12px; white-space: nowrap; }
.refunds-cards-title {
  font-size: 15px;
  font-weight: 800;
  color: #141c33;
  margin: 4px 0 10px;
}
.refund-modal-comment {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed #d9e1ec;
  color: #2a3550;
  font-size: 13px;
  line-height: 1.45;
}
.refund-modal-prod {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border-color, #d9e1ec);
  border-radius: 10px;
}
.refund-modal-prod img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: contain;
  background: #f3f6fa;
  border: 1px solid #e3e9f1;
}
.refund-photos { display: flex; gap: 8px; flex-wrap: wrap; }
.refund-photos img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #e3e9f1;
  background: #f3f6fa;
}
.order-track-row.neg .order-track-dot { background: #ef4444; border-color: #fecaca; }
.order-track-row.cur .order-track-dot { background: #f59e0b; border-color: #fde68a; }
.order-track-row.cur .order-track-name { color: #b45309; }
@media (max-width: 1100px) {
  .refunds-kpis { margin-left: 0; }
}

/* Предупреждения по срокам заявок на возврат */
.refunds-warn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  background: linear-gradient(90deg, #fef2f2, #fff7f7);
  border: 1px solid #fca5a5;
  margin: 2px 0 12px;
  color: #7f1d1d;
  font-size: 13px;
  line-height: 1.45;
}
.refunds-warn-ic {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #dc2626;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  flex: 0 0 34px;
}
.refunds-warn-text { flex: 1; }
.refunds-warn-text b { color: #b91c1c; }
.refunds-warn-btn {
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 10px;
  background: #dc2626;
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
  text-decoration: none;
}
.refunds-warn-btn:hover { background: #b91c1c; }
.refund-loss {
  margin-top: 5px;
  font-size: 12px;
  color: #6b7a90;
  font-weight: 600;
  line-height: 1.3;
}
.refund-loss.hot {
  color: #b91c1c;
  font-weight: 800;
}
.refunds-table tbody tr.overdue td.deadline .refund-chip.red {
  box-shadow: 0 0 0 2px #fecaca;
}
.refunds-kpi.red.pulse b { animation: none; }

/* ---------- v42: разделы «Отмена» и «Возврат» — блок процента отмен / возвратов ---------- */
.rate-block {
  background: #ffffff;
  border: 1px solid #d9e1ec;
  border-radius: var(--radius-card, 18px);
  padding: 18px 20px 16px;
  margin-bottom: 14px;
  box-shadow: 0 6px 20px rgba(20, 28, 51, 0.05);
}
.rate-head {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
}
.rate-kpis {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}
.rate-kpi {
  min-width: 150px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #f3f6fa;
  border: 1px solid #e3e9f1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.rate-kpi-val {
  font-size: 20px;
  font-weight: 800;
  color: #141c33;
  line-height: 1.15;
}
.rate-kpi-lbl {
  font-size: 11.5px;
  font-weight: 600;
  color: #3f4b66;
}
.rate-kpi-sub {
  font-size: 11px;
  color: #6b7a90;
}
.rate-kpi.main {
  min-width: 190px;
  border-width: 1px;
}
.rate-kpi.main .rate-kpi-val {
  font-size: 28px;
}
.rate-kpi.green { background: linear-gradient(135deg, #dcfce7, #f0fdf4); border-color: #bbf7d0; }
.rate-kpi.green .rate-kpi-val { color: #15803d; }
.rate-kpi.amber { background: linear-gradient(135deg, #fef3c7, #fffbeb); border-color: #fde68a; }
.rate-kpi.amber .rate-kpi-val { color: #b45309; }
.rate-kpi.red { background: linear-gradient(135deg, #fee2e2, #fef2f2); border-color: #fecaca; }
.rate-kpi.red .rate-kpi-val { color: #b91c1c; }
.rate-kpi.blue { background: linear-gradient(135deg, #dbeafe, #eff6ff); border-color: #bfdbfe; }
.rate-kpi.blue .rate-kpi-val { color: #1d4ed8; }
.rate-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 16px;
  margin-top: 16px;
}
@media (max-width: 1100px) {
  .rate-cols { grid-template-columns: 1fr; }
}
.rate-col {
  background: #fafbfd;
  border: 1px solid #e3e9f1;
  border-radius: 14px;
  padding: 12px 14px;
}
.rate-col-title {
  font-size: 12px;
  font-weight: 700;
  color: #3f4b66;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.rate-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  padding: 4px 0;
}
.rate-bar-name {
  color: #141c33;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rate-bar-track {
  height: 8px;
  background: #e3e9f1;
  border-radius: 99px;
  overflow: hidden;
}
.rate-bar-fill {
  height: 100%;
  border-radius: 99px;
}
.rate-bar-val {
  color: #3f4b66;
  font-weight: 600;
  white-space: nowrap;
  min-width: 80px;
  text-align: right;
}
.rate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.rate-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7a90;
  padding: 4px 8px 8px;
  border-bottom: 1px solid #e3e9f1;
}
.rate-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #eef2f7;
  color: #141c33;
  vertical-align: middle;
}
.rate-table tr:last-child td { border-bottom: 0; }
.rate-table .num { text-align: right; white-space: nowrap; }
.rate-prod {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.rate-prod span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
  display: inline-block;
}
.rate-empty {
  padding: 14px;
  color: #6b7a90;
  font-size: 12.5px;
  text-align: center;
}
.kaspi-dtab-static {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: #141c33;
}

/* Главная: плитки отмен / возвратов */
.home-rate-tile {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  transition: box-shadow 0.14s ease, transform 0.14s ease;
}
.home-rate-tile:hover {
  box-shadow: 0 6px 16px rgba(20, 28, 51, 0.08);
  transform: translateY(-1px);
}
.home-rate-tile.green { background: linear-gradient(135deg, #dcfce7, #f0fdf4); border-color: #bbf7d0; }
.home-rate-tile.amber { background: linear-gradient(135deg, #fef3c7, #fffbeb); border-color: #fde68a; }
.home-rate-tile.red { background: linear-gradient(135deg, #fee2e2, #fef2f2); border-color: #fecaca; }
.home-rate-lbl {
  font-size: 11px;
  font-weight: 700;
  color: #4b5872;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.home-rate-val {
  font-size: 22px;
  font-weight: 800;
  color: #141c33;
  margin-top: 4px;
  line-height: 1.1;
}
.home-rate-tile.green .home-rate-val { color: #15803d; }
.home-rate-tile.amber .home-rate-val { color: #b45309; }
.home-rate-tile.red .home-rate-val { color: #b91c1c; }
.home-rate-sub {
  font-size: 11.5px;
  color: #4b5872;
  margin-top: 3px;
}

/* Главная: выбор месяца и произвольного периода */
.home-period-select {
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f1f5f9;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}
.home-period-select.active {
  background: #ffffff;
  color: #0f172a;
  font-weight: 600;
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14);
}
.home-period-range {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 3px 4px 3px 8px;
  font-size: 12.5px;
  color: #64748b;
}
.home-period-range.active {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14);
}
.home-period-range input[type="date"] {
  height: 28px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #ffffff;
  padding: 0 6px;
  font-size: 12.5px;
  font-family: inherit;
  color: #0f172a;
}
.home-period-range .home-period-btn {
  padding: 5px 11px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
}
.home-period-range .home-period-btn.active {
  background: #22c55e;
  color: #ffffff;
  border-color: #22c55e;
}

/* Логистика и клиенты: повторные покупки */
.repeat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
@media (max-width: 1200px) {
  .repeat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.repeat-tile {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: box-shadow 0.14s ease, transform 0.14s ease, border-color 0.14s ease;
}
.repeat-tile:hover {
  box-shadow: 0 6px 16px rgba(20, 28, 51, 0.08);
  transform: translateY(-1px);
}
.repeat-tile.active {
  border-color: #22c55e;
  background: linear-gradient(135deg, #dcfce7, #f0fdf4);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14);
}
.repeat-tile.once {
  opacity: 0.92;
}
.repeat-tile-lbl {
  font-size: 11px;
  font-weight: 700;
  color: #4b5872;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.repeat-tile-val {
  font-size: 24px;
  font-weight: 800;
  color: #141c33;
  margin-top: 4px;
  line-height: 1.1;
}
.repeat-tile.active .repeat-tile-val { color: #15803d; }
.repeat-tile-sub {
  font-size: 11.5px;
  color: #4b5872;
  margin-top: 3px;
}
.repeat-tile-sum {
  font-size: 12.5px;
  font-weight: 700;
  color: #0b7a53;
  margin-top: 4px;
}
.repeat-tile-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}
.repeat-tile-bar > div {
  height: 100%;
  background: #22c55e;
  border-radius: 99px;
}
.repeat-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: #141c33;
}
.repeat-list-hint {
  font-size: 12px;
  font-weight: 500;
  color: #6b7a90;
}

/* Отзывы: рейтинг с учётом продаж */
.reviews-rating-note {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  font-size: 12px;
  color: #166534;
  line-height: 1.45;
}
.reviews-sort-lbl {
  font-size: 12px;
  color: #6b7a90;
  font-weight: 600;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
}
.review-prod-thumb {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.review-prod-thumb-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #6b7a90;
}
.review-prod-rate-sub {
  display: block;
  font-size: 10.5px;
  font-weight: 500;
  color: #6b7a90;
}

/* Товары: поставщик (Местный / Китай) и фильтры */
.supplier-switch {
  display: inline-flex;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}
.supplier-opt {
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  transition: all 0.12s ease;
}
.supplier-opt:hover {
  color: #0f172a;
  background: #ffffff;
}
.supplier-switch.local .supplier-opt.active {
  background: #22c55e;
  color: #ffffff;
}
.supplier-switch.china .supplier-opt.active {
  background: #ef4444;
  color: #ffffff;
}
.supplier-bulk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #4b5872;
}
.supplier-bulk-btn {
  height: 26px;
  padding: 0 9px;
  font-size: 11.5px;
}
.info-period-select.is-set {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14);
}

.home-stat-link { white-space: nowrap; }
.home-controls-right { margin-left: auto; justify-content: flex-end; }

/* ==========================================================================
   v43 — Авторизация по номеру телефона, роли и права доступа
   ========================================================================== */
body.auth-open { overflow: hidden; }
body.auth-open .app-layout { visibility: hidden; }

.auth-screen {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: #e1e8f1;
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}
.auth-screen[hidden] { display: none; }
.auth-bg {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  background:
    radial-gradient(640px 420px at 12% 18%, rgba(34, 197, 94, 0.22), transparent 62%),
    radial-gradient(560px 380px at 88% 84%, rgba(22, 163, 74, 0.16), transparent 60%),
    radial-gradient(420px 300px at 70% 10%, rgba(255, 255, 255, 0.6), transparent 60%);
}
.auth-card {
  position: relative; width: 100%; max-width: 440px;
  background: #fff; border-radius: 22px; padding: 30px 32px 26px;
  box-shadow: 0 24px 60px rgba(20, 28, 51, 0.16), 0 2px 6px rgba(20, 28, 51, 0.06);
  border: 1px solid rgba(217, 225, 236, 0.9);
  animation: authIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes authIn { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.auth-brand .brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #22c55e, #15803d); box-shadow: 0 6px 16px rgba(34, 197, 94, 0.35);
}
.auth-brand .brand-text { font-size: 20px; font-weight: 800; letter-spacing: 0.04em; color: #141c33; }
.auth-brand .brand-text b { color: #16a34a; }
.auth-title { font-size: 22px; font-weight: 800; color: #141c33; margin: 0 0 6px; letter-spacing: -0.01em; }
.auth-sub { font-size: 13.5px; color: #6b7a90; margin: 0 0 18px; line-height: 1.45; }
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  background: #f3f6fa; border-radius: 12px; margin-bottom: 18px;
}
.auth-tabs[hidden] { display: none; }
.auth-tab {
  border: 0; background: transparent; border-radius: 9px; padding: 9px 10px; font: inherit;
  font-size: 13.5px; font-weight: 700; color: #6b7a90; cursor: pointer; transition: all 0.18s ease;
}
.auth-tab.active { background: #fff; color: #141c33; box-shadow: 0 2px 8px rgba(20, 28, 51, 0.08); }
.auth-form { display: flex; flex-direction: column; gap: 13px; }
.auth-form[hidden] { display: none; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field[hidden] { display: none; }
.auth-label { font-size: 12px; font-weight: 700; color: #3f4b66; letter-spacing: 0.02em; }
.auth-input {
  width: 100%; height: 46px; border-radius: 12px; border: 1.5px solid #d9e1ec; background: #fff;
  padding: 0 14px; font: inherit; font-size: 15px; color: #141c33; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-input:focus { border-color: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14); }
.auth-input-phone { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; font-weight: 600; }
.auth-pass-wrap { position: relative; display: block; }
.auth-pass-wrap .auth-input { padding-right: 46px; }
.auth-eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; border-radius: 8px;
  background: transparent; color: #6b7a90; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.auth-eye:hover, .auth-eye.active { background: #f1f7f3; color: #16a34a; }
.auth-help { font-size: 11.5px; color: #6b7a90; line-height: 1.4; }
.auth-error {
  background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 10px; padding: 9px 12px; font-size: 13px; font-weight: 600;
}
.auth-error[hidden] { display: none; }
.auth-submit {
  height: 48px; border: 0; border-radius: 12px; font: inherit; font-size: 15px; font-weight: 800; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, #22c55e, #16a34a); box-shadow: 0 8px 18px rgba(34, 197, 94, 0.3); transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
  margin-top: 2px;
}
.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(34, 197, 94, 0.36); }
.auth-submit:disabled { opacity: 0.7; cursor: progress; transform: none; }
.auth-submit-outline { background: #fff; color: #3f4b66; border: 1.5px solid #d9e1ec; box-shadow: none; }
.auth-submit-outline:hover { background: #f3f6fa; box-shadow: none; }
.auth-note { font-size: 12px; color: #6b7a90; line-height: 1.5; margin: 4px 0 0; text-align: center; }
.auth-pending { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 8px 0 4px; }
.auth-pending[hidden] { display: none; }
.auth-pending-icon {
  width: 60px; height: 60px; border-radius: 18px; background: #fff7ed; color: #d97706; display: inline-flex; align-items: center; justify-content: center;
}
.auth-pending-title { font-size: 17px; font-weight: 800; color: #141c33; }
.auth-pending-text { font-size: 13.5px; color: #6b7a90; line-height: 1.5; }
.auth-pending .auth-submit { width: 100%; margin-top: 10px; }

/* Шапка: меню пользователя */
.topbar-user { position: relative; }
.topbar-user.is-clickable { cursor: pointer; }
.topbar-user-caret { color: #6b7a90; margin-left: 2px; transition: transform 0.18s; }
.topbar-user.open .topbar-user-caret { transform: rotate(180deg); }
.user-menu {
  position: absolute; top: calc(100% + 10px); right: 0; width: 260px; z-index: 300; cursor: default;
  background: #fff; border: 1px solid #d9e1ec; border-radius: 14px; box-shadow: 0 18px 44px rgba(20, 28, 51, 0.16); padding: 8px; text-align: left;
}
.user-menu[hidden] { display: none; }
.user-menu-head { padding: 10px 10px 12px; border-bottom: 1px solid #edf1f6; margin-bottom: 6px; }
.user-menu-name { font-weight: 800; color: #141c33; font-size: 14px; }
.user-menu-phone { font-size: 12.5px; color: #3f4b66; margin-top: 2px; font-variant-numeric: tabular-nums; }
.user-menu-role { font-size: 11.5px; color: #16a34a; font-weight: 700; margin-top: 4px; }
.user-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; border-radius: 9px; padding: 9px 10px;
  font: inherit; font-size: 13px; font-weight: 600; color: #3f4b66; cursor: pointer; text-align: left;
}
.user-menu-item:hover { background: #f1f7f3; color: #141c33; }
.user-menu-item[hidden] { display: none; }
.user-menu-item-danger { color: #b91c1c; }
.user-menu-item-danger:hover { background: #fef2f2; color: #991b1b; }
.nav-badge-alert { background: #f59e0b !important; color: #fff !important; }

/* Нет доступа */
.no-access-card {
  max-width: 560px; margin: 60px auto; background: #fff; border-radius: 18px; padding: 36px 32px; text-align: center;
  border: 1px solid #d9e1ec; box-shadow: 0 10px 30px rgba(20, 28, 51, 0.06);
}
.no-access-icon { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px; background: #f3f6fa; color: #6b7a90; display: flex; align-items: center; justify-content: center; }
.no-access-title { font-size: 19px; font-weight: 800; color: #141c33; margin-bottom: 8px; }
.no-access-text { font-size: 13.5px; color: #6b7a90; line-height: 1.5; margin-bottom: 18px; }
.no-access-btn { display: inline-flex; text-decoration: none; }

/* Страница «Пользователи и доступ» */
.users-page { display: flex; flex-direction: column; gap: 16px; }
.users-loading { padding: 40px; text-align: center; color: #6b7a90; }
.users-page .page-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.users-page .page-title { font-size: 22px; font-weight: 800; color: #141c33; margin: 0 0 4px; }
.users-page .page-subtitle { font-size: 13.5px; color: #6b7a90; margin: 0; }
.users-kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.users-kpi { background: #fff; border: 1px solid #d9e1ec; border-radius: 14px; padding: 14px 16px; }
.users-kpi-val { font-size: 24px; font-weight: 800; color: #141c33; line-height: 1.1; }
.users-kpi-lbl { font-size: 12px; color: #6b7a90; margin-top: 4px; font-weight: 600; }
.users-kpi.is-alert { border-color: #fcd34d; background: #fffbeb; }
.users-kpi.is-alert .users-kpi-val { color: #b45309; }
.users-pending-banner { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; border-radius: 12px; padding: 12px 16px; font-size: 13px; line-height: 1.5; }
.users-card { background: #fff; border: 1px solid #d9e1ec; border-radius: 18px; padding: 18px 20px; box-shadow: 0 6px 20px rgba(20, 28, 51, 0.04); }
.users-card[hidden] { display: none; }
.users-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.users-card-title { font-size: 16px; font-weight: 800; color: #141c33; }
.users-card-sub { font-size: 12.5px; color: #6b7a90; margin-top: 3px; }
.users-count { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: #f3f6fa; color: #3f4b66; font-size: 12px; }
.users-form { display: flex; flex-direction: column; gap: 14px; }
.users-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.users-form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.users-form .form-group, .user-edit-card .form-group { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.users-form .form-label, .user-edit-card .form-label, .perm-head .form-label { font-size: 12px; font-weight: 700; color: #3f4b66; }
.form-hint { font-weight: 500; color: #6b7a90; }
.input-with-btn { display: flex; gap: 8px; align-items: center; }
.input-with-btn .search-input { flex: 1 1 auto; min-width: 0; }
.btn-sm { padding: 7px 12px !important; font-size: 12.5px !important; border-radius: 9px !important; white-space: nowrap; }
.btn-danger-outline { color: #b91c1c !important; border-color: #fecaca !important; }
.btn-danger-outline:hover { background: #fef2f2 !important; }
.link-btn { border: 0; background: transparent; color: #16a34a; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.link-btn:hover { background: #e9fbf0; }
.perm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.perm-head-actions { display: flex; gap: 4px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.perm-item {
  position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1.5px solid #d9e1ec; border-radius: 12px; cursor: pointer;
  background: #fff; transition: border-color 0.15s, background 0.15s;
}
.perm-item:hover { border-color: #a7f3c4; }
.perm-item.checked { border-color: #22c55e; background: #f1fdf5; }
.perm-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.perm-box { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 1px; border-radius: 6px; border: 1.5px solid #c3ccd9; background: #fff; position: relative; transition: all 0.15s; }
.perm-item.checked .perm-box { background: #22c55e; border-color: #22c55e; }
.perm-item.checked .perm-box::after { content: ""; position: absolute; left: 5px; top: 1.5px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.perm-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.perm-title { font-size: 13px; font-weight: 700; color: #141c33; }
.perm-desc { font-size: 11.5px; color: #6b7a90; line-height: 1.35; }
.perm-item-edit { margin-top: 4px; border-style: dashed; }
.perm-item-edit.checked { border-style: solid; background: #fff7ed; border-color: #f59e0b; }
.perm-item-edit.checked .perm-box { background: #f59e0b; border-color: #f59e0b; }
.users-form-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 10px; padding: 9px 12px; font-size: 13px; font-weight: 600; }
.users-form-error[hidden] { display: none; }
.users-form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.users-form-note { font-size: 12.5px; color: #3f4b66; background: #f3f6fa; border-radius: 10px; padding: 10px 12px; margin: 12px 0 4px; }
.users-table th:last-child, .users-table td:last-child { text-align: right; }
.users-table td { vertical-align: middle; }
.users-table tr.is-off td { opacity: 0.55; }
.users-table tr.is-pending td { background: #fffbeb; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; color: #fff; background: #94a3b8; flex: 0 0 36px; }
.user-avatar.role-owner { background: linear-gradient(135deg, #22c55e, #15803d); }
.user-avatar.role-manager { background: linear-gradient(135deg, #38bdf8, #2563eb); }
.user-avatar.role-pending { background: linear-gradient(135deg, #fbbf24, #d97706); }
.user-cell-name { font-weight: 700; color: #141c33; font-size: 13.5px; }
.user-cell-phone { font-size: 12.5px; color: #6b7a90; font-variant-numeric: tabular-nums; white-space: nowrap; }
.users-table th:first-child, .users-table td:first-child { min-width: 240px; }
.users-table .user-cell-name { white-space: nowrap; }
.user-me { font-size: 11px; font-weight: 700; color: #16a34a; background: #e9fbf0; padding: 1px 7px; border-radius: 999px; margin-left: 4px; }
.role-badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; margin-right: 4px; white-space: nowrap; }
.role-badge.role-owner { background: #e9fbf0; color: #15803d; }
.role-badge.role-manager { background: #e0f2fe; color: #1d4ed8; }
.role-badge.role-pending { background: #fef3c7; color: #b45309; }
.role-badge.role-off { background: #fee2e2; color: #b91c1c; }
.perm-cell { max-width: 420px; }
.perm-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #f3f6fa; color: #3f4b66; font-size: 11.5px; font-weight: 600; margin: 2px 3px 2px 0; white-space: nowrap; }
.perm-chip-all { background: #e9fbf0; color: #15803d; }
.perm-chip-edit { background: #fff7ed; color: #c2410c; }
.perm-chip-muted { background: #f3f6fa; color: #94a3b8; }
.user-date { font-size: 12.5px; color: #3f4b66; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* v62: персональная сессия Kaspi пользователя */
.user-kaspi-cell { white-space: nowrap; }
.user-kaspi { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.user-kaspi::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.user-kaspi.is-on { background: #dcfce7; color: #15803d; }
.user-kaspi.is-warn { background: #fef3c7; color: #b45309; }
.user-kaspi.is-off { background: #eef2f7; color: #6b7a90; }
.user-kaspi-sub { font-size: 11.5px; color: #6b7a90; margin-top: 3px; }
.user-actions { white-space: nowrap; }
.user-actions .btn-sm + .btn-sm { margin-left: 6px; }
.users-empty { text-align: center; padding: 28px !important; color: #6b7a90; }
.users-help { background: #fff; border: 1px dashed #c3ccd9; border-radius: 14px; padding: 14px 18px; font-size: 12.5px; color: #3f4b66; }
.users-help-title { font-weight: 800; color: #141c33; margin-bottom: 6px; }
.users-help ul { margin: 0; padding-left: 18px; line-height: 1.6; }
.user-edit-card { max-width: 760px; width: min(760px, 94vw); }
.user-edit-card .modal-body { display: flex; flex-direction: column; gap: 12px; max-height: 76vh; overflow: auto; }
@media (max-width: 900px) {
  .users-form-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 24px 20px; }
}

/* Режим «только просмотр» для менеджеров без права редактирования */
/* v57 — права по кнопкам: body.no-act-<действие> скрывает/блокирует конкретные кнопки.
   Класс is-readonly-user оставлен для совместимости (ставится, когда нет ни одного права на изменение). */
/* finance.upload — загрузка XLSX и режим «Заменить / Дополнить» */
body.no-act-finance-upload .fin-dropzone,
body.no-act-finance-upload .fin-basis,
/* finance.delete — удаление файлов */
body.no-act-finance-delete [data-fin-file-del],
body.no-act-finance-delete #finDeleteAllBtn,
/* finance.costs — шаблон и загрузка себестоимости */
body.no-act-finance-costs .fin-costs-bar .reviews-pill-btn,
/* finance.expenses — статьи расходов */
body.no-act-finance-expenses .fin-exp-add,
body.no-act-finance-expenses [data-exp-del],
/* products.supplier — переключатель поставщика и массовое назначение */
body.no-act-products-supplier .supplier-switch [data-supval],
body.no-act-products-supplier .supplier-bulk,
/* remains.stock — кнопки − / + */
body.no-act-remains-stock [data-stock-step],
/* common.sync — кнопки «Обновить Kaspi» */
body.no-act-common-sync #liveSyncKaspiBtn,
body.no-act-common-sync #cardsSyncKaspiBtn,
body.no-act-common-sync #syncRemainsBtn,
body.no-act-common-sync #syncCashflowBtn,
body.no-act-common-sync #syncProductsBtn,
body.no-act-common-sync #syncWarehousesBtn,
body.no-act-common-sync #syncReviewsBtn,
body.no-act-common-sync #homeLiveSyncBtn,
body.no-act-common-sync #syncPnlBtn,
/* common.export — кнопки «Скачать CSV» */
body.no-act-common-export #exportReturnsCsvBtn,
body.no-act-common-export #exportPnlCsvBtn,
body.no-act-common-export #exportPivotCsvBtn,
body.no-act-common-export #exportCashflowCsvBtn { display: none !important; }
/* Поля ввода без права — только чтение */
body.no-act-finance-expenses .fin-exp-input,
body.no-act-finance-costs [data-fin-cost-key],
body.no-act-finance-rates #finTaxPct,
body.no-act-finance-rates [data-fin-default],
body.no-act-finance-rates [data-fin-cat-comm],
body.no-act-finance-rates [data-fin-cat-vat],
body.no-act-remains-stock [data-stock-input],
body.no-act-pnl-settings #pnlTaxSelect { pointer-events: none; background: #f3f6fa !important; color: #6b7a90 !important; }
body.no-act-products-supplier .supplier-switch::after { content: attr(data-supplier-label); font-size: 12px; color: #3f4b66; font-weight: 600; }

/* v57 — редактор прав: раздел + кнопки внутри раздела */
.perm-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 12px; background: #f3f6fa; border: 1px solid #e3e9f1; margin-bottom: 8px; }
.perm-toolbar-text { font-size: 12px; color: #3f4b66; line-height: 1.4; }
.perm-toolbar-actions { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.perm-dot { color: #c3ccd9; }
.perm-grid-v57 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
.perm-sec { display: flex; flex-direction: column; border: 1.5px solid #d9e1ec; border-radius: 14px; background: #fff; overflow: hidden; transition: border-color 0.15s, box-shadow 0.15s; }
.perm-sec.checked { border-color: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.08); }
.perm-sec > .perm-item { border: none; border-radius: 0; }
.perm-sec.checked > .perm-item { background: #f1fdf5; }
.perm-item-static { cursor: default; background: #f8fafc; }
.perm-box-static { background: #94a3b8 !important; border-color: #94a3b8 !important; }
.perm-item-static .perm-box-static::after { content: ""; position: absolute; left: 5px; top: 1.5px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.perm-actions { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px 10px; border-top: 1px dashed #e3e9f1; background: #fff; transition: opacity 0.15s; }
.perm-sec:not(.checked) .perm-actions { opacity: 0.42; pointer-events: none; }
.perm-actions-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 2px 4px; }
.perm-actions-title { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7a90; }
.perm-actions-tools { display: inline-flex; align-items: center; gap: 4px; }
.perm-actions-tools .link-btn { font-size: 11.5px; padding: 0 2px; }
.perm-actions-none { padding: 8px 12px 10px; font-size: 11.5px; color: #94a3b8; border-top: 1px dashed #e3e9f1; }
.perm-act { position: relative; display: flex; align-items: flex-start; gap: 9px; padding: 7px 9px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.perm-act:hover { background: #f8fafc; border-color: #e3e9f1; }
.perm-act.checked { background: #fff7ed; border-color: #fed7aa; }
.perm-act input { position: absolute; opacity: 0; width: 0; height: 0; }
.perm-box-sm { flex: 0 0 16px; width: 16px; height: 16px; border-radius: 5px; margin-top: 1px; }
.perm-act.checked .perm-box-sm { background: #f59e0b; border-color: #f59e0b; }
.perm-act.checked .perm-box-sm::after { content: ""; position: absolute; left: 4.5px; top: 1px; width: 4px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.perm-act .perm-title { font-size: 12.5px; font-weight: 600; }
.perm-act .perm-desc { font-size: 11px; }
.perm-sec-common { border-style: dashed; }
.perm-sec-common.checked { border-color: #c3ccd9; box-shadow: none; }
@media (max-width: 700px) {
  .perm-grid-v57 { grid-template-columns: 1fr; }
  .perm-toolbar { flex-direction: column; }
}

/* v44 — подключение магазина Kaspi (мультитенантность) */
.auth-screen.is-wide .auth-card { max-width: 500px; }
.store-connect { display: flex; flex-direction: column; gap: 14px; }
.store-connect[hidden] { display: none; }
.store-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 4px; }
/* v62: подсказка менеджеру — к какому магазину он подключает свой аккаунт Kaspi */
.store-connect-note { margin: 2px 0 8px; padding: 10px 14px; border-radius: 12px; background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; font-size: 13px; line-height: 1.45; }
.store-connect-note[hidden] { display: none !important; }
.store-step { font-size: 11.5px; font-weight: 700; color: #94a3b8; padding: 8px 6px; border-radius: 9px; background: #f3f6fa; text-align: center; border: 1px solid transparent; }
.store-step.active { color: #15803d; background: #e9fbf0; border-color: #a7f3c4; }
.store-step.done { color: #3f4b66; background: #eef2f7; }
.store-sent { font-size: 13px; color: #3f4b66; background: #f3f6fa; border-radius: 10px; padding: 10px 12px; line-height: 1.45; }
.auth-input-code { font-size: 22px; letter-spacing: 0.35em; text-align: center; font-weight: 800; }
.auth-textarea { height: 110px; padding: 10px 14px; resize: vertical; font-size: 12.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.4; }
.auth-alt-link { align-self: center; margin-top: 2px; }
.auth-row-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.auth-row-links-bottom { border-top: 1px solid #edf1f6; padding-top: 10px; margin-top: 2px; }
.store-options { display: flex; flex-direction: column; gap: 8px; }
.store-option { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid #d9e1ec; border-radius: 12px; background: #fff; font: inherit; cursor: pointer; text-align: left; transition: border-color 0.15s, background 0.15s; }
.store-option:hover { border-color: #22c55e; background: #f1fdf5; }
.store-option-name { font-weight: 700; color: #141c33; font-size: 14px; }
.store-option-uid { font-size: 12px; color: #6b7a90; white-space: nowrap; }
.auth-pending-icon.is-ok { background: #e9fbf0; color: #16a34a; }
.store-status { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 12px; border: 1px solid #d9e1ec; background: #f8fafc; }
.store-status-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; flex: 0 0 12px; background: #94a3b8; box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.18); }
.store-status.is-on .store-status-dot { background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18); }
.store-status.is-off .store-status-dot { background: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.16); }
.store-status-title { font-weight: 800; color: #141c33; font-size: 14px; }
.store-status-sub { font-size: 12.5px; color: #6b7a90; margin-top: 2px; }
.users-kpi-val-sm { font-size: 16px; line-height: 1.25; padding-top: 4px; }
.users-kpi-store { border-color: #a7f3c4; background: #f1fdf5; }

/* v45 — состояние сессии Kaspi и автообновление */
.topbar-sync.is-warn { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.topbar-sync.is-warn .topbar-sync-dot { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18); animation: none; }
.topbar-sync.is-error { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
.topbar-sync.is-error .topbar-sync-dot { background: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.16); animation: none; }
.topbar-sync.is-clickable { cursor: pointer; }
.topbar-sync.is-clickable:hover { filter: brightness(0.97); }
.store-status.is-warn { border-color: #fde68a; background: #fffbeb; }
.store-status.is-warn .store-status-dot { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18); }
.auth-check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 10px 12px; border: 1px solid #d9e1ec; border-radius: 12px; background: #f8fafc; font-size: 12.5px; line-height: 1.45; color: #3f4b66; }
.auth-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.auth-check-box { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 1px; border-radius: 5px; border: 1.5px solid #b6c2d3; background: #fff; position: relative; transition: background 0.15s, border-color 0.15s; }
.auth-check input:checked + .auth-check-box { background: #22c55e; border-color: #22c55e; }
.auth-check input:checked + .auth-check-box::after { content: ""; position: absolute; left: 5px; top: 1.5px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.auth-check input:focus-visible + .auth-check-box { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25); }
.auth-check-text b { color: #141c33; }

/* v46 — магазин не подключён: разделы «под замком» */
.sidebar .nav-item.is-locked,
.sidebar .nav-subitem.is-locked { opacity: 0.72; }
.sidebar .nav-item.is-locked:hover,
.sidebar .nav-subitem.is-locked:hover { opacity: 1; }
.sidebar .nav-item.is-locked .nav-badge { display: none; }
.nav-lock { margin-left: auto; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 6px; background: rgba(20, 28, 51, 0.06); color: #6b7a90; flex: 0 0 20px; }
.nav-subitem .nav-lock { width: 18px; height: 18px; flex-basis: 18px; }
.nav-item.active.is-locked .nav-lock { background: rgba(255, 255, 255, 0.22); color: #fff; }
.sidebar-promo.is-locked { opacity: 0.75; }
.store-lock-card {
  max-width: 620px; margin: 48px auto; background: #fff; border-radius: 20px; padding: 38px 36px; text-align: center;
  border: 1px solid #d9e1ec; box-shadow: 0 12px 34px rgba(20, 28, 51, 0.07);
}
.store-lock-icon { width: 68px; height: 68px; border-radius: 22px; margin: 0 auto 16px; background: #e9fbf0; color: #16a34a; display: flex; align-items: center; justify-content: center; }
.store-lock-title { font-size: 21px; font-weight: 800; color: #141c33; margin-bottom: 8px; letter-spacing: -0.01em; }
.store-lock-text { font-size: 14px; color: #6b7a90; line-height: 1.55; margin-bottom: 18px; }
.store-lock-steps { text-align: left; margin: 0 auto 20px; padding: 0; list-style: none; display: grid; gap: 8px; max-width: 460px; counter-reset: sls; }
.store-lock-steps li { counter-increment: sls; display: flex; gap: 12px; align-items: center; font-size: 13.5px; color: #3f4b66; background: #f8fafc; border: 1px solid #edf1f6; border-radius: 12px; padding: 10px 12px; }
.store-lock-steps li::before { content: counter(sls); flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%; background: #22c55e; color: #fff; font-weight: 800; font-size: 12.5px; display: inline-flex; align-items: center; justify-content: center; }
.store-lock-steps b { color: #141c33; }
.store-lock-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.store-lock-actions .btn-outline { text-decoration: none; display: inline-flex; align-items: center; }
.store-lock-note { font-size: 12px; color: #94a3b8; margin-top: 16px; line-height: 1.5; }


/* ---------- v48: переключатель языка RU | ҚАЗ ---------- */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: #eef2f7;
  border: 1px solid var(--border, #d9e1ec);
}
.lang-btn {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #6b7a90;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.lang-btn:hover { color: #141c33; }
.lang-btn.active {
  background: #ffffff;
  color: var(--brand-700, #15803d);
  box-shadow: 0 1px 3px rgba(20, 28, 51, 0.12);
}
.auth-card { position: relative; }
.auth-card > .lang-switch { position: absolute; top: 18px; right: 18px; }
@media (max-width: 720px) {
  .topbar-right .lang-switch { display: none; }
}

/* ==========================================================================
   Предзаказ → В передачу: панель выбора, карточки с выбором, модальные окна
   ========================================================================== */
.preorder-action-bar {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 10px 14px 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 12px;
  box-shadow: 0 1px 2px rgba(20, 28, 51, 0.04);
}
.preorder-action-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.preorder-select-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 12px 0 8px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: #f8fafc;
  font-size: 13.5px;
  font-weight: 600;
  color: #141c33;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}
.preorder-select-toggle:hover { background: #eef2f7; border-color: #c8d2e0; }
.preorder-select-toggle:disabled { opacity: 0.55; cursor: default; }
.preorder-select-toggle .check-circle { margin-top: 0; width: 20px; height: 20px; }
.preorder-select-toggle .check-circle.partial {
  border-color: var(--brand-green);
  background: linear-gradient(to bottom, #fff 0 46%, var(--brand-green) 46% 54%, #fff 54%);
}
.preorder-selected-count { font-size: 13.5px; color: #3f4b66; }
.preorder-selected-count b { color: #141c33; }
.preorder-clear-btn {
  font-size: 13px;
  color: #6b7a90;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  background: none;
  border: 0;
}
.preorder-clear-btn:hover { color: #141c33; }
.preorder-readonly-hint { font-size: 12.5px; color: #6b7a90; }
.preorder-action-bar .batch-green-btn.preorder-transmit-btn {
  width: auto;
  min-width: 220px;
  margin: 0;
  padding: 0 20px;
  height: 40px;
}
.batch-green-btn.preorder-transmit-btn:disabled {
  background: #cbd5e1;
  box-shadow: none;
  cursor: default;
  color: #fff;
}
.batch-green-btn.preorder-transmit-btn.one { width: auto; margin: 0; height: 38px; padding: 0 18px; }
.kaspi-order-card.selectable { cursor: pointer; transition: border-color 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease; }
.kaspi-order-card.selectable:hover { border-color: #b7e4c7; }
.kaspi-order-card.selectable.selected {
  border-color: var(--brand-green);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.18);
  background: #f6fdf8;
}
.kaspi-order-card.selectable .koc-checkbox { width: 18px; height: 18px; accent-color: #16a34a; }
.order-modal-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid #b7e4c7;
  background: #f0fdf4;
  border-radius: 12px;
}
.order-modal-actions-hint { font-size: 12.5px; color: #3f4b66; flex: 1; min-width: 200px; }
.preorder-transmit-card { max-width: 620px; }
.preorder-transmit-note {
  font-size: 13.5px;
  line-height: 1.5;
  color: #3f4b66;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 10px 12px;
}
.preorder-transmit-list {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}
.preorder-transmit-row {
  display: grid;
  grid-template-columns: 110px 1fr 110px 100px;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  font-size: 13px;
  border-bottom: 1px solid #eef2f7;
}
.preorder-transmit-row:last-child { border-bottom: 0; }
.preorder-transmit-row.failed { grid-template-columns: 110px 1fr; }
.ptr-code { font-weight: 700; color: #141c33; }
.ptr-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #3f4b66; }
.ptr-city { color: #6b7a90; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptr-price { text-align: right; font-weight: 600; color: #141c33; }
.ptr-error { color: #b91c1c; }
.preorder-transmit-more { padding: 8px 12px; font-size: 12.5px; color: #6b7a90; }
.preorder-transmit-total { font-size: 13.5px; color: #3f4b66; }
.preorder-transmit-comment { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: #6b7a90; }
.preorder-transmit-comment input {
  height: 38px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 13.5px;
  color: #141c33;
  background: #f9fafb;
  outline: none;
}
.preorder-transmit-comment input:focus { background: #fff; border-color: var(--brand-green); }
.preorder-transmit-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.preorder-transmit-actions .btn-outline { height: 40px; padding: 0 16px; }
.preorder-transmit-actions .batch-green-btn.preorder-transmit-btn.confirm { width: auto; margin: 0; height: 40px; padding: 0 20px; }
.preorder-transmit-progress { font-size: 13px; color: #15803d; }
.preorder-result-summary { display: flex; gap: 8px; }
@media (max-width: 720px) {
  .preorder-action-bar .batch-green-btn.preorder-transmit-btn { width: 100%; }
  .preorder-transmit-row { grid-template-columns: 90px 1fr 80px; }
  .preorder-transmit-row .ptr-city { display: none; }
}

/* ===== «Отмена» / «Возврат»: список заказов таблицей (в стиле каталога «Товары») ===== */
.returns-table-card { margin-bottom: 4px; }
.returns-table th[data-rsort] { cursor: pointer; user-select: none; }
.returns-table th[data-rsort]:hover { color: #141c33; }
.returns-table td { vertical-align: middle; }
.returns-table thead th { padding: 10px 8px; }
.returns-table tbody td { padding: 9px 8px; }
.returns-table tr.rt-pickup td { background: #fffbeb; }
.returns-table tr.rt-urgent td { background: #fef2f2; }
.rt-order-code {
  display: inline-block;
  font-weight: 700;
  color: #1d4ed8;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.rt-order-code:hover { text-decoration: underline; }
.rt-sub { font-size: 11.5px; color: #4b5872; margin-top: 2px; line-height: 1.35; }
.rt-reason { font-size: 12.5px; color: #141c33; line-height: 1.35; }
.rt-deadline { font-size: 12.5px; font-weight: 700; color: #b45309; line-height: 1.35; }
.rt-deadline.urgent { color: #b91c1c; }
.rt-link { display: inline-block; margin-top: 4px; font-size: 12px; color: #1d4ed8; text-decoration: none; }
.rt-link:hover { text-decoration: underline; }

/* ===== «Отмена» / «Возврат» (v54): хронология обратной доставки, срок на складе, обращение о потере, деньги ===== */
/* Таблица умещается в ширину экрана без горизонтальной прокрутки: фиксированная раскладка колонок (colgroup) и переносы */
.returns-table { table-layout: fixed; width: 100%; min-width: 1000px; }
.returns-table thead th { white-space: normal; line-height: 1.25; letter-spacing: 0.02em; font-size: 11px; vertical-align: bottom; }
.returns-table td { font-size: 12px; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
.returns-table td .rt-order-code, .returns-table td a { hyphens: manual; -webkit-hyphens: manual; }
.returns-table .rt-prod-cell > div { gap: 9px; }
.returns-table .rt-prod-cell > div > div { max-width: none; }
.returns-table tr.rt-lost td { background: #fff7ed; }
.rt-thumb { width: 36px; height: 36px; flex: 0 0 36px; }
.rt-title { font-weight: 600; color: #0f172a; font-size: 12.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rt-strong { font-size: 12px; font-weight: 600; color: #141c33; line-height: 1.35; }
.rt-ok { display: inline-block; font-size: 12px; font-weight: 700; color: #15803d; }
.rt-late { font-size: 12px; font-weight: 700; color: #b91c1c; }
.rt-dash { color: #94a3b8; }
.rt-sub-red { color: #b91c1c; font-weight: 600; }
.rt-addr { white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rt-warn { margin-top: 4px; font-size: 11px; font-weight: 600; color: #b91c1c; line-height: 1.3; }
.rt-deadline { white-space: nowrap; font-size: 12px; }
.rt-sub { font-size: 11px; }
.rt-reason { font-size: 12px; }
.returns-table .badge-pill { font-size: 11px; padding: 2px 8px; white-space: normal; line-height: 1.3; text-align: left; }
.returns-table .rt-btn { height: auto; min-height: 28px; padding: 4px 9px; font-size: 11.5px; white-space: normal; line-height: 1.25; text-align: left; hyphens: auto; -webkit-hyphens: auto; }
/* «Деньги поступили»: кнопки друг под другом — колонка узкая, таблица без прокрутки */
.returns-table .rt-money { flex-direction: column; width: 100%; max-width: 104px; }
.returns-table .rt-money-btn { height: 26px; padding: 0 8px; font-size: 11.5px; text-align: left; width: 100%; }
.returns-table .rt-money-btn + .rt-money-btn { border-left: 0; border-top: 1px solid #d9e1ec; }
@keyframes rt-blink {
  0%, 100% { color: #b91c1c; background: #fee2e2; box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
  50% { color: #ffffff; background: #dc2626; box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.18); }
}
.rt-deadline.rt-blink {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  color: #b91c1c;
  background: #fee2e2;
  animation: rt-blink 1.1s ease-in-out infinite;
}
.rt-blink-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #dc2626;
  margin-right: 6px;
  animation: rt-blink 1.1s ease-in-out infinite;
}
.rt-alert { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.rt-alert-red { color: #b91c1c; background: #fee2e2; }
.rt-alert-amber { color: #b45309; background: #fef3c7; }
.rt-btn {
  height: 30px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.rt-btn:hover { background: #e0e7ff; }
.rt-btn.rt-btn-red { border-color: #fecaca; background: #fee2e2; color: #b91c1c; }
.rt-btn.rt-btn-red:hover { background: #fecaca; }
.rt-link-btn { border: 0; background: none; padding: 0; margin-top: 3px; font-size: 11.5px; color: #1d4ed8; cursor: pointer; }
.rt-link-btn:hover { text-decoration: underline; }
.rt-money { display: inline-flex; border: 1px solid #d9e1ec; border-radius: 8px; overflow: hidden; }
.rt-money-btn {
  height: 28px;
  padding: 0 10px;
  border: 0;
  background: #ffffff;
  color: #3f4b66;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.rt-money-btn + .rt-money-btn { border-left: 1px solid #d9e1ec; }
.rt-money-btn:hover { background: #f1f5f9; }
.rt-money-btn:disabled { opacity: 0.6; cursor: default; }
.rt-money-btn.is-on-green { background: #16a34a; color: #ffffff; }
.rt-money-btn.is-on-red { background: #dc2626; color: #ffffff; }
.rt-legend {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 18px 12px;
  border-top: 1px solid #e2e8f0;
  font-size: 11.5px;
  color: #6b7a90;
  line-height: 1.4;
}

/* Модальное окно «Обращение в Kaspi: товар не вернулся» */
.lost-claim-card { max-width: 680px; }
.lost-claim-card .modal-body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.lost-claim-note { font-size: 12.5px; color: #3f4b66; line-height: 1.45; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; }
.lost-claim-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.lost-claim-grid > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.lost-claim-grid .lc-k { font-size: 11px; color: #6b7a90; text-transform: uppercase; letter-spacing: 0.03em; }
.lost-claim-grid .lc-v { font-size: 13px; color: #141c33; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.lost-claim-grid .lc-red { color: #b91c1c; }
.lost-claim-field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: #3f4b66; }
.lost-claim-field textarea,
.lost-claim-field input {
  width: 100%;
  border: 1px solid #d9e1ec;
  border-radius: 10px;
  padding: 9px 11px;
  font: inherit;
  font-size: 13px;
  color: #141c33;
  background: #ffffff;
  box-sizing: border-box;
}
.lost-claim-field textarea { resize: vertical; line-height: 1.45; }
.lost-claim-tools { display: flex; gap: 10px; flex-wrap: wrap; }
.lost-claim-link { text-decoration: none; color: #1d4ed8; border-color: #c7d2fe; background: #eef2ff; }
.lost-claim-link:hover { background: #e0e7ff; }
.lost-claim-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.lost-claim-unmark { color: #b91c1c; border-color: #fecaca; }
.batch-green-btn.lost-claim-save { width: auto; margin: 0; height: 38px; padding: 0 18px; }
.batch-green-btn.lost-claim-save:disabled { opacity: 0.6; cursor: default; }
@media (max-width: 720px) {
  .lost-claim-grid { grid-template-columns: 1fr; }
}

/* ===== «Предзаказ» (v55): кнопки-даты — фильтр по дате передачи ===== */
.preorder-date-bar {
  background: #ffffff;
  border: 1px solid #d9e1ec;
  border-radius: 14px;
  padding: 12px 16px 14px;
  margin-bottom: 14px;
}
.preorder-date-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.preorder-date-title { font-size: 13px; font-weight: 700; color: #141c33; }
.preorder-date-sub { font-size: 11.5px; color: #6b7a90; }
.preorder-date-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.preorder-date-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 112px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid #d9e1ec;
  background: #f8fafc;
  color: #141c33;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.preorder-date-chip:hover { background: #f1f5f9; border-color: #c3cedd; }
.preorder-date-chip .pdc-date { font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.preorder-date-chip .pdc-count { font-size: 11.5px; color: #4b5872; line-height: 1.2; }
.preorder-date-chip .pdc-hint { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7a90; line-height: 1.2; margin-top: 1px; }
.preorder-date-chip.today { border-color: #86efac; background: #f0fdf4; }
.preorder-date-chip.today .pdc-hint { color: #15803d; }
.preorder-date-chip.tomorrow { border-color: #fcd34d; background: #fffbeb; }
.preorder-date-chip.tomorrow .pdc-hint { color: #b45309; }
.preorder-date-chip.overdue { border-color: #fecaca; background: #fef2f2; }
.preorder-date-chip.overdue .pdc-date,
.preorder-date-chip.overdue .pdc-hint { color: #b91c1c; }
.preorder-date-chip.active {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(22, 163, 74, 0.25);
}
.preorder-date-chip.active .pdc-date,
.preorder-date-chip.active .pdc-count,
.preorder-date-chip.active .pdc-hint { color: #ffffff; }
.preorder-date-chip.active .pdc-count { opacity: 0.9; }
@media (max-width: 720px) {
  .preorder-date-chip { min-width: calc(50% - 4px); }
}

/* v58 — подключение магазина Kaspi по номеру телефона (SMS) или e-mail: переключатель способа */
.store-method-tabs { margin-bottom: 2px; }
.store-method-tabs .auth-tab { font-size: 13px; padding: 8px 8px; }
#storePhoneFields, #storeEmailFields { display: flex; flex-direction: column; gap: 13px; }
#storePhoneFields[hidden], #storeEmailFields[hidden] { display: none; }
#storeResend:disabled { color: #94a3b8; cursor: default; text-decoration: none; }

/* ==========================================================================
   v59 — раздел «Чат» (чат с покупателями Kaspi)
   ========================================================================== */
.chat-page { display: flex; flex-direction: column; gap: 14px; min-height: calc(100vh - 150px); }
.chat-page .page-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.chat-page .page-title { font-size: 22px; font-weight: 800; color: #141c33; margin: 0 0 4px; }
.chat-page .page-subtitle { font-size: 13.5px; color: #6b7a90; margin: 0; }
.chat-page .page-subtitle b { color: #141c33; font-weight: 700; }
.chat-head-actions { display: flex; gap: 8px; align-items: center; }
.chat-refresh-btn { width: 36px; padding: 0; justify-content: center; }
.chat-refresh-btn.is-spinning svg { animation: chatSpin 0.9s linear infinite; }
@keyframes chatSpin { to { transform: rotate(360deg); } }
#chatAutoBtn .chat-auto-dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; display: inline-block; }
#chatAutoBtn.is-on { border-color: #86efac; background: #f0fdf4; color: #15803d; }
#chatAutoBtn.is-on .chat-auto-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
.nav-badge-chat.is-unread { background: #22c55e; color: #fff; font-weight: 700; }
.chat-loading { padding: 28px; text-align: center; color: #6b7a90; font-size: 13.5px; }
.chat-loading.is-error { color: #b91c1c; }

/* каркас: список слева, диалог справа */
.chat-shell { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 14px; flex: 1; min-height: 560px; height: calc(100vh - 215px); }
.chat-list-pane, .chat-thread-pane { background: #fff; border: 1px solid #d9e1ec; border-radius: 18px; box-shadow: 0 10px 30px rgba(20, 28, 51, 0.05); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.chat-list-top { padding: 12px 12px 8px; border-bottom: 1px solid #edf1f6; display: flex; flex-direction: column; gap: 8px; }
.chat-search-wrap { position: relative; }
.chat-search-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.chat-search { width: 100%; height: 38px; border: 1px solid #d9e1ec; border-radius: 10px; padding: 0 12px 0 34px; font-size: 13.5px; background: #f8fafc; color: #141c33; outline: none; }
.chat-search:focus { border-color: #86efac; background: #fff; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14); }
.chat-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-filter { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid #e2e8f0; background: #fff; color: #3f4b66; font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.chat-filter:hover { background: #f8fafc; }
.chat-filter.active { background: #141c33; border-color: #141c33; color: #fff; }
.chat-filter-n { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 999px; background: #eef2f7; color: #3f4b66; min-width: 18px; text-align: center; }
.chat-filter.active .chat-filter-n { background: rgba(255, 255, 255, 0.2); color: #fff; }
.chat-filter.has-unread:not(.active) .chat-filter-n { background: #22c55e; color: #fff; }
.chat-list { flex: 1; overflow-y: auto; min-height: 0; }
.chat-list-empty { padding: 36px 18px; text-align: center; color: #6b7a90; font-size: 13.5px; }
.chat-list-foot { padding: 8px 12px; border-top: 1px solid #edf1f6; text-align: center; }
.chat-list-foot:empty { display: none; }

.chat-item { display: flex; gap: 11px; padding: 11px 12px; border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: background 0.12s; align-items: flex-start; }
.chat-item:hover { background: #f8fafc; }
.chat-item.active { background: #f0fdf4; box-shadow: inset 3px 0 0 #22c55e; }
.chat-item.is-unread .chat-item-name { font-weight: 800; }
.chat-item.is-unread .chat-item-preview { color: #141c33; font-weight: 600; }
.chat-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-item-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.chat-item-name { font-size: 14px; font-weight: 700; color: #141c33; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-time { font-size: 11.5px; color: #94a3b8; white-space: nowrap; }
.chat-item-subject { font-size: 12px; color: #6b7a90; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-item-preview { font-size: 12.5px; color: #4b5872; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.chat-preview-me { color: #15803d; font-weight: 600; }
.chat-preview-empty { color: #94a3b8; font-style: italic; }
.chat-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #22c55e; color: #fff; font-size: 11.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.chat-waiting-dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; flex: none; }
.chat-item-tags { display: flex; gap: 6px; margin-top: 2px; }
.chat-tag { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: #eef2f7; color: #3f4b66; white-space: nowrap; }
.chat-tag.is-order { background: #e0f2fe; color: #075985; }
.chat-tag.is-product { background: #ede9fe; color: #5b21b6; }
.chat-tag.is-refund { background: #fee2e2; color: #991b1b; }

.chat-avatar { position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, #22c55e, #15803d); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; }
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.chat-avatar.is-product { border-radius: 10px; background: #f1f5f9; color: #3f4b66; }
.chat-avatar.is-product img { object-fit: contain; background: #fff; }
.chat-avatar span { position: relative; z-index: 0; }
.chat-avatar img + span { visibility: hidden; }
.chat-avatar.is-fallback span { visibility: visible; }
.chat-avatar-lg { width: 46px; height: 46px; }

/* диалог */
.chat-thread-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; color: #6b7a90; gap: 8px; }
.chat-thread-empty-icon { width: 68px; height: 68px; border-radius: 20px; background: #f0fdf4; color: #16a34a; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.chat-thread-empty-title { font-size: 17px; font-weight: 800; color: #141c33; }
.chat-thread-empty-text { font-size: 13.5px; max-width: 360px; line-height: 1.5; }
.chat-thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #edf1f6; }
.chat-thread-meta { flex: 1; min-width: 0; }
.chat-thread-name { font-size: 15.5px; font-weight: 800; color: #141c33; }
.chat-thread-sub { font-size: 12.5px; color: #6b7a90; display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: 2px; }
.chat-thread-sub > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-thread-actions { display: flex; gap: 8px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px 18px; background: #f6f8fb; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.chat-day { text-align: center; margin: 10px 0 6px; }
.chat-day span { font-size: 11.5px; font-weight: 700; color: #6b7a90; background: #e8edf4; padding: 3px 10px; border-radius: 999px; }
.chat-more-wrap { text-align: center; margin-bottom: 6px; }
.chat-msg { display: flex; }
.chat-msg.is-me { justify-content: flex-end; }
.chat-bubble { max-width: min(72%, 620px); padding: 9px 12px 6px; border-radius: 16px; font-size: 14px; line-height: 1.45; color: #141c33; background: #fff; border: 1px solid #e3e9f1; box-shadow: 0 1px 2px rgba(20, 28, 51, 0.04); word-wrap: break-word; overflow-wrap: anywhere; }
.chat-msg.is-them .chat-bubble { border-bottom-left-radius: 6px; }
.chat-msg.is-me .chat-bubble { background: #dcfce7; border-color: #bbf7d0; border-bottom-right-radius: 6px; }
.chat-msg-sender { font-size: 11.5px; font-weight: 700; color: #15803d; margin-bottom: 2px; }
.chat-msg-text a { color: #0369a1; text-decoration: underline; }
.chat-msg-meta { font-size: 11px; color: #94a3b8; text-align: right; margin-top: 3px; display: flex; justify-content: flex-end; gap: 5px; }
.chat-msg-status { color: #94a3b8; letter-spacing: -2px; }
.chat-msg-status.is-read { color: #16a34a; }
.chat-att { display: block; margin-top: 4px; }
.chat-att-img img { max-width: 320px; max-height: 320px; border-radius: 10px; display: block; }
.chat-att-audio audio { width: 280px; max-width: 100%; height: 40px; display: block; }
.chat-att-video video { min-width: 220px; max-width: 320px; max-height: 360px; border-radius: 10px; display: block; background: #0f172a; }
.chat-att-label { font-size: 12px; color: #6b7a90; margin-bottom: 4px; }
.chat-att-fallback { font-size: 12px; color: #92400e; margin-top: 4px; }
.chat-att.is-failed audio, .chat-att.is-failed video { opacity: 0.55; }
.chat-att-dl { color: #0369a1; text-decoration: underline; font-weight: 600; }
.chat-att-file { font-size: 13px; color: #0369a1; text-decoration: underline; }

.chat-composer { border-top: 1px solid #edf1f6; padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.chat-composer-locked { color: #6b7a90; font-size: 13px; text-align: center; padding: 16px; }
.chat-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.chat-quick-chip { height: 26px; padding: 0 10px; border-radius: 999px; border: 1px dashed #cbd5e1; background: #fff; color: #3f4b66; font-size: 12px; cursor: pointer; white-space: nowrap; }
.chat-quick-chip:hover { border-color: #22c55e; color: #15803d; background: #f0fdf4; }
.chat-composer-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-composer-row textarea { flex: 1; min-height: 40px; max-height: 160px; resize: none; border: 1px solid #d9e1ec; border-radius: 12px; padding: 10px 12px; font-size: 14px; font-family: inherit; line-height: 1.4; color: #141c33; outline: none; background: #f8fafc; }
.chat-composer-row textarea:focus { border-color: #86efac; background: #fff; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14); }
.chat-send-btn { height: 40px; padding: 0 16px; border-radius: 12px; display: inline-flex; align-items: center; gap: 7px; }
.chat-composer-hint { font-size: 11.5px; color: #94a3b8; }

/* нет доступа */
.chat-noaccess { max-width: 640px; margin: 24px auto; background: #fff; border: 1px solid #d9e1ec; border-radius: 18px; padding: 34px 34px 28px; text-align: center; box-shadow: 0 10px 30px rgba(20, 28, 51, 0.05); }
.chat-noaccess-icon { width: 64px; height: 64px; border-radius: 20px; background: #fff7ed; color: #ea580c; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.chat-noaccess-title { font-size: 19px; font-weight: 800; color: #141c33; margin-bottom: 10px; }
.chat-noaccess-text { font-size: 14px; color: #3f4b66; line-height: 1.55; }
.chat-noaccess-hint { margin-top: 12px; font-size: 13.5px; color: #15803d; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 12px; padding: 12px 14px; line-height: 1.5; text-align: left; }
.chat-noaccess-actions { margin-top: 18px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; align-items: center; }
.chat-noaccess-manager { font-size: 13px; color: #6b7a90; max-width: 420px; }

/* автоответ */
.chat-auto-card { max-width: 680px; }
.chat-auto-subtitle { font-size: 12.5px; color: #6b7a90; margin-top: 2px; }
.chat-auto-body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.chat-auto-body .form-group { display: flex; flex-direction: column; gap: 6px; }
.chat-auto-body [hidden] { display: none !important; }
.chat-auto-body textarea { width: 100%; border: 1px solid #d9e1ec; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; font-family: inherit; line-height: 1.45; color: #141c33; resize: vertical; background: #f8fafc; }
.chat-auto-body textarea:focus { outline: none; border-color: #86efac; background: #fff; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14); }
.chat-auto-vars { font-size: 12px; color: #6b7a90; }
.chat-auto-vars code { background: #eef2f7; border-radius: 5px; padding: 1px 5px; font-size: 11.5px; color: #141c33; }
.chat-auto-preview { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 12px; padding: 10px 12px; font-size: 13.5px; color: #141c33; display: flex; gap: 10px; align-items: flex-start; }
.chat-auto-preview-lbl { font-size: 11px; font-weight: 800; color: #15803d; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; margin-top: 2px; }
.chat-switch-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.chat-switch-row > input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.chat-switch { flex: none; width: 40px; height: 22px; border-radius: 999px; background: #cbd5e1; position: relative; transition: background 0.15s; margin-top: 1px; }
.chat-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.chat-switch-row input:checked + .chat-switch { background: #22c55e; }
.chat-switch-row input:checked + .chat-switch::after { left: 21px; }
.chat-switch-row input:disabled + .chat-switch { opacity: 0.6; }
.chat-switch-text { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; color: #141c33; }
.chat-switch-text small { font-size: 12px; color: #6b7a90; }
.chat-switch-row-sm .chat-switch-text { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
.chat-hours { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #3f4b66; }
.chat-hours input[type="time"] { width: 108px; height: 30px; border: 1px solid #d9e1ec; border-radius: 8px; padding: 0 6px; font-size: 13px; font-family: inherit; }
.chat-radio-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #141c33; cursor: pointer; }
.chat-radio-row input[type="radio"] { accent-color: #16a34a; width: 16px; height: 16px; }
.chat-inline-num { width: 58px; height: 28px; border: 1px solid #d9e1ec; border-radius: 8px; padding: 0 6px; font-size: 13px; text-align: center; font-family: inherit; }
.chat-auto-readonly { font-size: 12.5px; color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 8px 12px; }
.chat-auto-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chat-auto-status { font-size: 12.5px; color: #6b7a90; }
.chat-auto-log { border-top: 1px solid #edf1f6; padding-top: 12px; }
.chat-auto-log-empty { font-size: 13px; color: #94a3b8; padding: 6px 0; }
.chat-auto-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.chat-auto-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7a90; padding: 6px 8px; border-bottom: 1px solid #edf1f6; }
.chat-auto-table td { padding: 7px 8px; border-bottom: 1px solid #f1f5f9; vertical-align: top; color: #141c33; }
.chat-auto-table td:last-child { color: #3f4b66; }

@media (max-width: 1100px) {
  .chat-shell { grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .chat-shell { grid-template-columns: 1fr; height: auto; }
  .chat-list-pane { max-height: 50vh; }
  .chat-thread-pane { min-height: 60vh; }
  .chat-bubble { max-width: 88%; }
}

/* ===== v61: вкладки чата, автоматизация, журнал ===== */
.chat-tabs { display: inline-flex; background: #fff; border: 1px solid #d9e1ec; border-radius: 12px; padding: 3px; gap: 2px; }
.chat-tab { height: 30px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: #3f4b66; font-size: 13px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-family: inherit; transition: background 0.15s, color 0.15s; }
.chat-tab:hover { background: #f1f5f9; }
.chat-tab.active { background: #141c33; color: #fff; }
.chat-tab.active .chat-filter-n { background: rgba(255, 255, 255, 0.2); color: #fff; }
.chat-page [hidden] { display: none !important; }

.cau-wrap { display: flex; flex-direction: column; gap: 14px; padding-bottom: 80px; }
.cau-card { background: #fff; border: 1px solid #d9e1ec; border-radius: 18px; padding: 16px 18px; box-shadow: 0 1px 2px rgba(20, 28, 51, 0.04); }
.cau-master { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 18px; align-items: center; background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%); border: 1px solid #bbf7d0; border-radius: 18px; padding: 18px 20px; }
.cau-master-left { display: flex; flex-direction: column; gap: 10px; }
.cau-master .chat-switch-text b { font-size: 15px; }
.cau-master .chat-switch-text small { font-size: 12.5px; line-height: 1.45; }
.cau-master-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: #6b7a90; padding-left: 50px; }
.cau-master-meta .cau-warn { color: #b45309; font-weight: 600; }
.cau-master-meta .cau-err { color: #b91c1c; font-weight: 600; }
.cau-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cau-stats-inline { grid-template-columns: repeat(3, minmax(110px, 1fr)); flex: 1; }
.cau-stat { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 10px 12px; min-width: 0; }
.cau-stat-v { font-size: 20px; font-weight: 800; color: #141c33; line-height: 1.1; }
.cau-stat-l { font-size: 11px; color: #6b7a90; margin-top: 3px; line-height: 1.25; }
.cau-stat.is-green .cau-stat-v { color: #15803d; }
.cau-stat.is-amber .cau-stat-v { color: #b45309; }
.cau-params-row { display: flex; flex-wrap: wrap; gap: 12px 26px; align-items: center; }
.cau-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #3f4b66; white-space: nowrap; }
.cau-select { height: 30px; border: 1px solid #d9e1ec; border-radius: 8px; padding: 0 8px; font-size: 13px; font-family: inherit; background: #fff; color: #141c33; }
.cau-section { margin-top: 6px; }
.cau-section h3 { margin: 0; font-size: 15px; font-weight: 800; color: #141c33; }
.cau-section p { margin: 3px 0 0; font-size: 12.5px; color: #6b7a90; }
.cau-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 12px; }
.cau-scn { background: #fff; border: 1px solid #d9e1ec; border-radius: 16px; overflow: hidden; transition: border-color 0.15s, box-shadow 0.15s; }
.cau-scn.is-on { border-color: #bbf7d0; }
.cau-scn.is-open { grid-column: 1 / -1; box-shadow: 0 8px 24px rgba(20, 28, 51, 0.08); }
.cau-scn-head { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; }
.cau-scn-switch { margin-top: 2px; }
.cau-scn-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; }
.cau-scn-title b { font-size: 13.5px; color: #141c33; }
.cau-scn-title small { font-size: 12px; color: #6b7a90; line-height: 1.4; }
.cau-scn:not(.is-on) .cau-scn-title b { color: #6b7a90; }
.cau-scn-right { display: flex; align-items: center; gap: 8px; color: #94a3b8; }
.cau-chevron { font-size: 14px; transition: transform 0.15s; }
.cau-scn.is-open .cau-chevron { transform: rotate(180deg); }
.cau-badge { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.cau-scn-body { border-top: 1px solid #edf1f6; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: #fbfcfe; }
.cau-scn-body .form-group { display: flex; flex-direction: column; gap: 6px; }
.cau-scn-body .form-label, .cau-params .form-label { font-size: 12px; font-weight: 700; color: #3f4b66; }
.cau-scn-body textarea, .cau-scn-body input[type="text"] { width: 100%; border: 1px solid #d9e1ec; border-radius: 10px; padding: 9px 12px; font-size: 13.5px; font-family: inherit; line-height: 1.45; color: #141c33; resize: vertical; background: #fff; box-sizing: border-box; }
.cau-scn-body textarea:focus, .cau-scn-body input[type="text"]:focus { outline: none; border-color: #86efac; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14); }
.cau-extra { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.cau-note { font-size: 12.5px; color: #6b7a90; line-height: 1.45; }
.cau-faq { display: flex; flex-direction: column; gap: 10px; }
.cau-rule { border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.cau-rule-head { display: flex; align-items: center; gap: 10px; }
.cau-rule-head .cau-rule-title { flex: 1; font-weight: 700; }
.cau-rule-del { width: 28px; height: 28px; border-radius: 8px; border: 1px solid #e2e8f0; background: #fff; color: #94a3b8; cursor: pointer; font-size: 12px; }
.cau-rule-del:hover { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.cau-faq-add { align-self: flex-start; }
.cau-faq-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cau-default { background: none; border: 0; padding: 0; margin-left: 8px; font-size: 11.5px; font-weight: 600; color: #15803d; cursor: pointer; font-family: inherit; text-transform: none; }
.cau-default:hover { text-decoration: underline; }
.cau-savebar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(6px); border: 1px solid #d9e1ec; border-radius: 14px; padding: 10px 14px; box-shadow: 0 -4px 20px rgba(20, 28, 51, 0.06); }
.cau-reset { color: #6b7a90; }
.cau-journal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.cau-journal-filters { display: flex; gap: 8px; align-items: center; }
.cau-journal td { font-size: 12.5px; }
.cau-journal-text { max-width: 520px; white-space: pre-wrap; }
.cau-journal tr.is-failed td { background: #fff7f7; }
.cau-journal tr.is-pending td { background: #fffdf5; }
.cau-journal-err { font-size: 11px; color: #b45309; margin-top: 3px; }
.cau-order-link { color: #15803d; font-weight: 700; text-decoration: none; }
.cau-order-link:hover { text-decoration: underline; }
.cau-status { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.cau-status-sent { background: #f0fdf4; color: #15803d; }
.cau-status-pending { background: #fffbeb; color: #b45309; }
.cau-status-failed { background: #fef2f2; color: #b91c1c; }
.cau-status-skipped { background: #f1f5f9; color: #6b7a90; }
@media (max-width: 1000px) {
  .cau-master { grid-template-columns: 1fr; }
  .cau-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cau-grid { grid-template-columns: 1fr; }
  .cau-master-meta { padding-left: 0; }
}

/* v62: от имени какой сессии Kaspi работает автоматизация чата */
.cau-runas { margin: 0 0 12px; padding: 9px 14px; border-radius: 12px; background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; font-size: 13px; }
.cau-runas.is-warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* ==========================================================================
   v66: МОБИЛЬНАЯ АДАПТАЦИЯ КАБИНЕТА (телефоны и планшеты до 900px)
   — боковое меню становится выдвижной панелью, верхняя панель компактная и
   липкая, сетки сворачиваются в 1–2 колонки, широкие таблицы прокручиваются
   по горизонтали, модальные окна занимают весь экран.
   ========================================================================== */
.sidebar-mobile-tools { display: none; }
.sidebar-backdrop { display: none; }
.m-scroll { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.m-scroll > table { min-width: 100%; }

@media (max-width: 900px) {
  html, body { overflow-x: hidden; max-width: 100vw; }
  body { -webkit-text-size-adjust: 100%; }

  /* ---------- Каркас ---------- */
  .app-layout { display: block; }
  .main-area { width: 100%; min-width: 0; min-height: 100vh; min-height: 100dvh; }

  /* ---------- Выдвижное меню ---------- */
  .sidebar,
  .app-layout.sidebar-collapsed .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    height: 100vh; height: 100dvh;
    width: min(86vw, 300px); min-width: 0;
    transform: translateX(-104%);
    transition: transform 0.22s ease;
    z-index: 1000; overflow: hidden; border-right: 0;
    box-shadow: 24px 0 60px -20px rgba(20, 28, 51, 0.35);
  }
  .app-layout.mobile-nav-open .sidebar { transform: none; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 999; background: rgba(15, 23, 42, 0.46); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
  .sidebar-backdrop:not([hidden]) { display: block; }
  body.mobile-nav-open { overflow: hidden; }
  .sidebar-nav { padding-bottom: 12px; }
  .sidebar-nav .nav-item, .sidebar-nav .nav-subitem { min-height: 42px; }
  .sidebar-footer { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .sidebar-promo { display: none; }
  .sidebar-mobile-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px 4px; }
  .sidebar-mobile-date { font-size: 12px; color: #6b7a90; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* ---------- Верхняя панель ---------- */
  .topbar {
    position: sticky; top: 0; z-index: 40;
    background: var(--bg-main);
    padding: 8px 12px; gap: 8px; flex-wrap: nowrap;
    border-bottom: 1px solid var(--border-color);
    padding-top: calc(8px + env(safe-area-inset-top));
  }
  .sidebar-toggle-btn { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px; background: #fff; border: 1px solid var(--border-color); }
  .breadcrumbs { flex: 1 1 auto; min-width: 0; gap: 6px; }
  .breadcrumb-muted, .breadcrumb-sep { display: none; }
  .breadcrumb-current { font-size: 15px; font-weight: 800; color: #141c33; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 100%; }
  .topbar-right { flex: 0 1 auto; min-width: 0; gap: 6px; margin-left: auto; }
  .topbar-right .lang-switch, .topbar-date, .profile-logout-btn { display: none !important; }
  /* Статус Kaspi: «онлайн» на телефоне не показываем, а предупреждения/ошибки — обязательно (это вход в переподключение) */
  .topbar-sync { display: none; }
  .topbar-sync.is-warn, .topbar-sync.is-error { display: inline-flex; max-width: 46vw; font-size: 11.5px; padding: 4px 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-sync .topbar-sync-dot { flex: 0 0 auto; }
  .topbar-user { padding: 2px; gap: 0; border: 0; background: transparent; box-shadow: none; }
  .topbar-user-meta, .topbar-user-caret { display: none; }
  .profile-avatar { width: 36px; height: 36px; }
  .user-menu { right: 0; left: auto; min-width: 230px; max-width: calc(100vw - 24px); }

  /* ---------- Контент ---------- */
  .page-container { padding: 12px 12px 48px; }
  #pageContainer { min-width: 0; }
  #pageContainer img, #pageContainer svg, #pageContainer canvas, #pageContainer video { max-width: 100%; }
  #pageContainer canvas { height: auto; }
  #pageContainer input, #pageContainer select, #pageContainer textarea,
  .modal-card input, .modal-card select, .modal-card textarea { font-size: 16px; } /* iOS не приближает экран */
  #pageContainer h1, #pageContainer .page-title, #pageContainer .home-main-title { font-size: 20px; line-height: 1.2; }
  .page-subtitle { font-size: 12.5px; }

  /* Шапки страниц: заголовок + действия переносятся вниз */
  .home-top-header, .info-top, .fin-head, .chat-head, .page-head, .page-header, .section-head-row,
  .reviews-head, .users-head, .pivot-head, .pnl-head, .cashflow-head, .remains-head, .products-head, .warehouse-head,
  .koc-pagination-row, .order-modal-actions, .cau-journal-head { flex-wrap: wrap; gap: 10px; }
  .home-controls-right, .info-top-right, .chat-head-actions, .fin-head-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }

  /* Ряды вкладок/фильтров/переключателей: горизонтальная прокрутка вместо переноса */
  .home-period-pills, .info-metric-switch, .info-mode-switch, .pivot-tabs, .kaspi-dtabs, .kaspi-dtab-row,
  .reviews-pill-group, .chat-tabs, .clean-tabs, .fin-tabs, .pnl-tabs, .orders-tabs, .products-tabs, .cau-journal-filters {
    display: flex; flex-wrap: nowrap; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; -ms-overflow-style: none; padding-bottom: 2px;
  }
  .home-period-pills::-webkit-scrollbar, .info-metric-switch::-webkit-scrollbar, .info-mode-switch::-webkit-scrollbar, .pivot-tabs::-webkit-scrollbar,
  .kaspi-dtabs::-webkit-scrollbar, .kaspi-dtab-row::-webkit-scrollbar, .reviews-pill-group::-webkit-scrollbar,
  .chat-tabs::-webkit-scrollbar, .clean-tabs::-webkit-scrollbar, .fin-tabs::-webkit-scrollbar, .pnl-tabs::-webkit-scrollbar, .orders-tabs::-webkit-scrollbar,
  .products-tabs::-webkit-scrollbar, .cau-journal-filters::-webkit-scrollbar { display: none; }
  .home-period-pills > *, .info-metric-switch > *, .info-mode-switch > *, .pivot-tabs > *, .kaspi-dtabs > *, .kaspi-dtab-row > *,
  .reviews-pill-group > *, .chat-tabs > *, .clean-tabs > *, .fin-tabs > *, .pnl-tabs > *, .orders-tabs > *, .products-tabs > * { flex: 0 0 auto; white-space: nowrap; }

  /* Поиск и кнопки действий — на всю ширину */
  .compact-search, .search-input, .toolbar-search { width: 100% !important; max-width: 100%; }
  .batch-green-btn, .preorder-transmit-btn { max-width: 100%; }

  /* Сетки: 2 колонки */
  .summary-cards-grid, .home-kpi-row, .home-pipeline-grid, .kaspi-cards-grid, .rate-kpis, .users-kpis, .cau-stats, .fin-kpis, .pnl-kpis,
  .remains-kpis, .cashflow-kpis, .reviews-kpis, .products-kpis, .info-kpis, .summary-kpis, .warehouse-grid, .orders-grid, .preorder-grid,
  .home-hero-grid, .home-bottom-grid, .pivot-main-split, .info-two-col, .fin-two-col, .pnl-two-col, .reviews-grid, .reviews-layout,
  .cashflow-layout, .remains-layout, .users-layout, .chat-shell, .cau-master, .analytics-grid, .info-grid, .cards-grid, .products-grid, .product-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .home-hero-grid, .home-bottom-grid, .pivot-main-split, .info-two-col, .fin-two-col, .pnl-two-col, .reviews-layout, .cashflow-layout, .remains-layout,
  .users-layout, .chat-shell, .cau-master, .analytics-grid, .info-grid, .orders-grid, .preorder-grid, .kaspi-cards-grid, .warehouse-grid, .cards-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }


  /* Сетки и флекс-ряды не должны растягиваться под содержимое */
  #pageContainer [class*="grid"], #pageContainer [class*="layout"], #pageContainer [class*="split"], #pageContainer [class*="cols"],
  #pageContainer [class*="row"], #pageContainer [class*="card"], #pageContainer [class*="wrap"], #pageContainer [class*="head"],
  #pageContainer [class*="toolbar"], #pageContainer [class*="panel"] { min-width: 0; max-width: 100%; }
  #pageContainer [class*="grid"] > *, #pageContainer [class*="layout"] > *, #pageContainer [class*="split"] > *, #pageContainer [class*="cols"] > *,
  #pageContainer [class*="row"] > *, #pageContainer [class*="toolbar"] > * { min-width: 0; }
  #pageContainer [style*="display:flex"], #pageContainer [style*="display: flex"] { flex-wrap: wrap; min-width: 0; max-width: 100%; }
  .reviews-split-layout, .rate-cols, .info-two-col, .pnl-split-grid, .insight-advice-grid, .pnl-add-form, .reviews-split-layout > *,
  .pivot-main-split, .home-hero-grid, .home-bottom-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .seg-filter-group { display: flex; flex-wrap: wrap; max-width: 100%; }
  .home-period-range { flex-wrap: wrap; }
  .pivot-toolbar-card { flex-wrap: wrap; }
  .week-heatmap-wrap, .heatmap-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .warehouse-row { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 14px; }
  .warehouse-meta { flex-wrap: wrap; }

  /* Чат: одна панель на экране — список диалогов или открытый диалог */
  .chat-page { min-height: 0; gap: 10px; }
  .chat-shell { display: block; height: auto; min-height: 0; }
  .chat-list-pane { max-height: none; height: calc(100dvh - 180px); min-height: 320px; }
  .chat-thread-pane { display: none; min-height: 0; }
  .chat-shell.is-thread .chat-list-pane { display: none; }
  .chat-shell.is-thread .chat-thread-pane { display: flex; height: calc(100dvh - 76px); min-height: 360px; border-radius: 14px; }
  .chat-page.is-thread .page-header-row { display: none; }
  .chat-back-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; border: 1px solid #d9e1ec; background: #fff; color: #141c33; flex: 0 0 auto; cursor: pointer; }
  .chat-thread-head { padding: 10px 12px; gap: 10px; }
  .chat-thread-actions .btn-outline { padding: 0 10px; font-size: 12px; }
  .chat-messages { padding: 12px 10px; }
  .chat-bubble { max-width: 90%; }
  .chat-quick { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
  .chat-quick::-webkit-scrollbar { display: none; }
  .chat-composer { padding: 8px 10px 10px; }
  .chat-composer-hint { display: none; }
  .chat-send-btn span { display: none; }
  .chat-send-btn { width: 42px; padding: 0; justify-content: center; }

  /* Таблицы */
  .m-scroll { margin: 0 -12px; padding: 0 12px; width: calc(100% + 24px); max-width: none; }
  .m-scroll > table { min-width: 560px; }
  .m-scroll-native { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #pageContainer table th, #pageContainer table td { white-space: nowrap; }
  #pageContainer table th:first-child, #pageContainer table td:first-child { white-space: normal; max-width: 240px; min-width: 150px; }
  #pageContainer table td:first-child img { max-width: 40px; }

  /* Модальные окна — во весь экран */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-card { max-width: 100%; width: 100%; max-height: 94vh; max-height: 94dvh; border-radius: 18px 18px 0 0; border: 0; }
  .modal-header { padding: 14px 16px; position: sticky; top: 0; background: #fff; z-index: 2; }
  .modal-body { padding: 14px 16px; gap: 12px; }
  .modal-close { width: 36px; height: 36px; }

  /* Экран входа и мастер подключения магазина */
  .auth-screen { padding: 12px; align-items: flex-start; overflow-y: auto; }
  .auth-card { width: 100%; max-width: 100%; padding: 20px 16px; margin: 8px 0; }
  .auth-input, .auth-submit { min-height: 46px; }
  .auth-input { font-size: 16px; }

  /* Карточки заказов / товаров */
  .koc-top, .koc-bottom { flex-wrap: wrap; gap: 8px; }
  .koc-address { white-space: normal; }
  .koc-prod-title { white-space: normal; }

  /* Всплывающее уведомление */
  .toast { left: 12px; right: 12px; max-width: none; bottom: calc(12px + env(safe-area-inset-bottom)); }
}

@media (max-width: 640px) {
  .page-container { padding: 10px 10px 48px; }
  .m-scroll { margin: 0 -10px; padding: 0 10px; width: calc(100% + 20px); }
  .summary-cards-grid, .home-kpi-row, .home-pipeline-grid, .rate-kpis, .users-kpis, .cau-stats, .fin-kpis, .pnl-kpis, .remains-kpis,
  .cashflow-kpis, .reviews-kpis, .products-kpis, .info-kpis, .summary-kpis, .products-grid, .product-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .cashflow-kpi-grid, .oos-kpi-grid, .fin-kpi-grid, .reviews-kpi-grid, .pnl-kpi-grid, [class*="kpi-grid"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .cashflow-kpi-grid > *, .oos-kpi-grid > *, .fin-kpi-grid > *, .reviews-kpi-grid > *, [class*="kpi-grid"] > * { padding: 14px 14px; min-width: 0; }
  [class*="kpi-grid"] > * [class*="val"], [class*="kpi-grid"] > * [class*="value"], [class*="kpi-grid"] > * b { font-size: 20px; }
  .summary-card, .home-kpi, .rate-kpi, .users-kpi, .cau-stat { padding: 12px 12px; min-width: 0; }
  .info-metric-switch { flex: 1 1 100%; width: 100%; }
  .summary-card-value, .home-kpi-value, .rate-kpi-val, .users-kpi-val, .cau-stat-v { font-size: 18px; word-break: break-word; }
  .cau-stats-inline { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .cau-grid { grid-template-columns: 1fr; }
}
/* Кнопка «назад» в шапке диалога — только на мобильных */
@media (min-width: 901px) { .chat-back-btn { display: none !important; } }
