/* === TOKENS === */
:root {
  --color-primary: #2563EB;
  --color-primary-dark: #1D4ED8;
  --color-primary-light: #DBEAFE;
  --color-success: #10B981;
  --color-danger: #EF4444;
  --color-warning: #F59E0B;
  --color-text: #0F172A;
  --color-text-muted: #64748B;
  --color-bg: #F1F5F9;
  --color-surface: #FFFFFF;
  --color-border: #E2E8F0;

  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-size-page-title: 24px;
  --font-size-section-title: 18px;
  --font-size-body: 14px;
  --font-size-caption: 13px;
  --font-size-label: 11px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  background: var(--color-primary);
  color: #fff;
}
.btn:hover { background: var(--color-primary-dark); }
.btn-outline {
  background: var(--color-surface);
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
  padding: 8px 18px;
}
.btn-outline:hover { background: var(--color-primary-light); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-ghost { background: var(--color-bg); color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-border); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: var(--font-size-caption); }

/* === TRANSITIONS & ANIMATIONS === */
.card, .quick-action-card, .product-card {
  transition: all 0.15s ease;
}

/* Toast animation */
.toast {
  animation: slideUpFade 0.3s ease;
}
@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tab switch animation */
.tab-section {
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Active tab indicator */
.btn-ghost.active-nav {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 700;
}

/* === INPUTS === */
.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  color: var(--color-text);
  background: var(--color-surface);
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.input-error { border-color: var(--color-danger); background: #FEF2F2; }

/* === CARDS === */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-lg);
}

/* === TABLES === */
table { width: 100%; border-collapse: collapse; margin-top: var(--space-md); }
th {
  text-align: left;
  font-size: var(--font-size-caption);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 2px solid var(--color-border);
}
td {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-body);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #F8FAFC; }

/* === TOAST === */
.toast {
  position: fixed;
  right: var(--space-lg);
  bottom: 80px;
  background: var(--color-text);
  color: #fff;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: var(--font-size-body);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
}

/* === HEADER (Enhanced) === */
.header {
  background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
  color: #fff;
  padding: var(--space-md) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header h1 {
  font-size: var(--font-size-section-title);
  font-weight: 700;
  margin: 0;
}
.header-subtitle {
  font-size: var(--font-size-caption);
  opacity: 0.85;
}
.header-stats {
  display: flex;
  gap: var(--space-lg);
  margin-top: var(--space-xs);
}
.header-stat {
  text-align: center;
}
.header-stat-value {
  font-size: 16px;
  font-weight: 700;
}
.header-stat-label {
  font-size: 11px;
  opacity: 0.8;
}
.header .auth-status {
  font-size: var(--font-size-caption);
  opacity: 0.85;
  align-self: flex-start;
}

@media (min-width: 768px) {
  .header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  .header-stats {
    margin-top: 0;
  }
  .header-stat-value {
    font-size: 18px;
  }
}

/* === MAIN CONTENT === */
.main-content {
  padding: var(--space-lg);
  padding-bottom: 80px;
  max-width: 960px;
  margin: 0 auto;
}

/* === AUTH CARDS === */
.auth-card { max-width: 400px; margin: var(--space-2xl) auto; }
.auth-card h2 { font-size: var(--font-size-page-title); margin-bottom: var(--space-lg); text-align: center; }
.auth-card form { display: flex; flex-direction: column; gap: var(--space-md); }
/* Шаги визарда — та же вертикальная раскладка, чтобы поля не слипались */
.auth-card form > div { display: flex; flex-direction: column; gap: var(--space-md); }
.auth-card .hint { text-align: center; font-size: var(--font-size-caption); color: var(--color-text-muted); margin-top: var(--space-md); }
.auth-card .hint a { color: var(--color-primary); text-decoration: none; font-weight: 600; }

/* === TAB SECTIONS === */
.tab-section { margin-bottom: var(--space-lg); }
.tab-section h2 { font-size: var(--font-size-page-title); font-weight: 700; margin-bottom: var(--space-lg); }
.tab-section h3 { font-size: var(--font-size-section-title); font-weight: 600; margin: var(--space-lg) 0 var(--space-md); }

/* === TAB FORMS === */
.tab-form { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-bottom: var(--space-lg); align-items: flex-end; }
.tab-form .input { flex: 1; min-width: 120px; }
.tab-form[hidden] { display: none; }

/* === SEARCH & FILTERS === */
.search-bar .input {
  padding-left: 40px;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%2364748B" stroke-width="2"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/></svg>') no-repeat 12px center;
}

.filter-chips {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--font-size-caption);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.chip:hover {
  background: var(--color-bg);
}
.chip-active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* Sort selector */
.sort-selector {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.sort-selector select {
  flex: 1;
}
.sort-label {
  font-size: var(--font-size-caption);
  color: var(--color-text-muted);
}

/* === QUICK ACTIONS === */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.quick-action-card {
  background: linear-gradient(135deg, var(--color-primary), #3B82F6);
  color: #fff;
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}
.quick-action-card:active {
  transform: scale(0.98);
}
.quick-action-card.secondary {
  background: linear-gradient(135deg, var(--color-success), #34D399);
}
.quick-action-card.tertiary {
  background: linear-gradient(135deg, var(--color-warning), #FBBF24);
}
.quick-action-icon {
  font-size: 24px;
}
.quick-action-label {
  font-size: var(--font-size-caption);
  font-weight: 600;
}

/* === MINI DASHBOARD === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}
.stat-label {
  font-size: var(--font-size-label);
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
}
.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 2px;
}
.stat-change {
  font-size: var(--font-size-label);
  color: var(--color-text-muted);
}
.stat-change.positive {
  color: var(--color-success);
}
.stat-change.negative {
  color: var(--color-danger);
}
.stat-change-action {
  color: var(--color-primary);
  font-weight: 600;
}

@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .stat-card {
    padding: var(--space-lg);
  }
}

/* === ORDER ITEMS === */
.item-row { display: flex; gap: var(--space-sm); align-items: center; margin-bottom: var(--space-sm); }
.item-row select, .item-row input { flex: 1; padding: 8px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-family: var(--font-family); font-size: var(--font-size-body); }
.item-row .line-total { min-width: 60px; text-align: right; font-weight: 600; color: var(--color-primary); }

/* === BOTTOM NAV === */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--color-surface);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
  display: none;
  justify-content: space-around;
  align-items: flex-end;
  padding: var(--space-sm) 0;
  z-index: 100;
  height: 56px;
}
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10px; color: var(--color-text-muted);
  background: none; border: none; cursor: pointer;
  padding: var(--space-xs); font-family: var(--font-family);
}
.bottom-nav-item.active { color: var(--color-primary); font-weight: 600; }
.bottom-nav-item .icon { font-size: 20px; }
.bottom-nav-fab {
  width: 48px; height: 48px;
  background: var(--color-primary); border-radius: 50%; border: none;
  color: #fff; font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  margin-top: -20px;
  box-shadow: 0 4px 12px rgba(37,99,235,0.35);
  cursor: pointer;
}
.bottom-nav-fab:hover { background: var(--color-primary-dark); }

/* === DESKTOP NAV === */
.desktop-nav {
  display: none;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  flex-wrap: wrap;
}

/* === BADGES === */
.badge { display: inline-block; padding: 2px 8px; border-radius: var(--radius-full); font-size: var(--font-size-label); font-weight: 600; }
.badge-new { background: var(--color-primary-light); color: var(--color-primary); }
.badge-progress { background: #FEF3C7; color: #92400E; }
.badge-completed { background: #D1FAE5; color: #065F46; }

/* === MODERN PRODUCT CARDS === */
.products-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-md);
  align-items: center;
  transition: box-shadow 0.15s;
}
.product-card:hover {
  box-shadow: var(--shadow-md);
}
.product-card-main {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-xs);
}
.product-card-name {
  font-size: var(--font-size-body);
  font-weight: 600;
  color: var(--color-text);
}
.product-card-sku {
  font-size: var(--font-size-caption);
  color: var(--color-text-muted);
  font-family: monospace;
}
.product-card-stock {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-label);
  font-weight: 600;
}
.stock-badge-ok {
  background: #DCFCE7;
  color: #166534;
}
.stock-badge-low {
  background: #FEF3C7;
  color: #92400E;
}
.stock-badge-critical {
  background: #FEE2E2;
  color: #991B1B;
}
.stock-badge-none {
  background: var(--color-bg);
  color: var(--color-text-muted);
}
.product-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-sm);
}
.product-card-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
}
.product-card-actions {
  display: flex;
  gap: var(--space-xs);
}

/* === ФОТО ТОВАРА (спека 2026-10-23) === */
.product-card-info { display: flex; flex-direction: column; gap: var(--space-xs); min-width: 0; }
.product-card-photo {
  width: 48px; height: 48px; border-radius: var(--radius-sm); object-fit: cover; flex: none;
  background: var(--color-bg);
}
.product-card-photo-empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; border: 1px solid var(--color-border);
}
.product-thumb {
  width: 28px; height: 28px; border-radius: var(--radius-sm); object-fit: cover;
  vertical-align: middle; margin-right: 6px;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.15s;
}
.icon-btn:hover {
  background: var(--color-bg);
}
.icon-btn.danger:hover {
  background: #FEE2E2;
  color: var(--color-danger);
  border-color: var(--color-danger);
}

/* === HIDDEN === */
.hidden { display: none !important; }

/* === RESPONSIVE === */
@media (min-width: 768px) {
  .bottom-nav { display: none !important; }
  .desktop-nav { display: flex; }
  .main-content { padding-bottom: var(--space-2xl); }
  .products-cards { display: none !important; }
  .desktop-only { display: table; }
}

@media (max-width: 767px) {
  .desktop-nav { display: none !important; }
  .bottom-nav { display: flex; }
  .tab-form { flex-direction: column; }
  .tab-form .input { min-width: 100%; }
  .main-content { padding: var(--space-md); padding-bottom: 72px; }
  .desktop-only { display: none !important; }
}

/* === PRICE INTELLIGENCE === */

/* Dumping Rule Cards */
.dumping-rule-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  transition: box-shadow 0.15s;
}
.dumping-rule-card:hover {
  box-shadow: var(--shadow-sm);
}
.dumping-rule-card.enabled {
  border-left: 3px solid var(--color-success);
}
.dumping-rule-card.disabled {
  border-left: 3px solid var(--color-text-muted);
  opacity: 0.8;
}

/* === Гейт «сначала подключите Kaspi» во вкладке «Бот» === */
.bot-gate { padding: var(--space-xl) var(--space-md); display: flex; justify-content: center; }
.bot-gate-card {
  max-width: 460px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
}
.bot-gate-card h3 { margin: 0 0 var(--space-sm); font-size: 18px; }
.bot-gate-card p { margin: 0 0 var(--space-lg); font-size: 14px; color: var(--color-text-muted); }

/* === Единая таблица «Товары и правила» (цены + предзаказ) === */
.bot-table { display: flex; flex-direction: column; gap: 8px; }
.bot-head {
  display: grid;
  grid-template-columns: minmax(180px, 2.2fr) repeat(5, minmax(88px, 1fr)) minmax(70px, auto);
  gap: 8px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.bot-row {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.bot-row-main {
  display: grid;
  grid-template-columns: minmax(180px, 2.2fr) repeat(5, minmax(88px, 1fr)) minmax(70px, auto);
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 10px;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.bot-row-main:hover { background: #F9FAFB; }
.bot-cell { font-size: 14px; min-width: 0; }
.bot-cell-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bot-chevron { color: var(--color-text-muted); flex: none; }
.bot-name { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-sku { display: block; font-size: 12px; color: var(--color-text-muted); }
.bot-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #F3F4F6;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.bot-chip.on { background: #E8F5E9; color: #1B5E20; border-color: #A5D6A7; }
.bot-chip-btn { cursor: pointer; font: inherit; font-size: 12px; }
.bot-row-expand {
  border-top: 1px solid var(--color-border);
  padding: 12px 14px;
  background: #FAFAFB;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bot-editor-hint { margin: 0; font-size: 13px; color: #B45309; }
.bot-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.bot-editor-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--color-text-muted); }
.bot-editor-grid input { width: 100%; }
.bot-editor-stores { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bot-editor-label { font-size: 13px; color: var(--color-text-muted); }
.bot-checks { display: flex; flex-wrap: wrap; gap: 14px; }
.bot-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.bot-editor-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 720px) {
  .bot-head { display: none; }
  .bot-row-main {
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
  }
  .bot-cell-name { grid-column: 1 / -1; }
  .bot-cell-auto { grid-column: 1 / -1; }
}

/* Alert Cards */
.alert-card.unresolved {
  border-left: 3px solid var(--color-warning);
  background: #FFF8E1;
}
.alert-card.resolved {
  border-left: 3px solid var(--color-success);
  background: #F5F5F5;
}

/* Price History Chart Container */
#price-history-chart {
  position: relative;
  min-height: 200px;
}
#price-history-chart canvas {
  max-height: 200px;
}

/* Status Banner for Price Intel */
#price-intel-status-banner {
  display: none;
}
#price-intel-status-banner.active {
  display: block;
}
#price-intel-status-banner.success {
  background: #E8F5E9;
  color: #1B5E20;
}
#price-intel-status-banner.warning {
  background: #FFF8E1;
  color: #8D6E00;
}
#price-intel-status-banner.error {
  background: #FFEBEE;
  color: #C62828;
}

/* Competitor Price Item */
.competitor-price-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-xs);
  background: var(--color-surface);
}
.competitor-price-item.cheaper {
  background: #FFEBEE;
  border-color: #FFCDD2;
}
.competitor-price-item.cheaper .competitor-price {
  color: var(--color-danger);
}

/* Price History Table */
.price-history-table {
  width: 100%;
  font-size: var(--font-size-caption);
  border-collapse: collapse;
}
.price-history-table th,
.price-history-table td {
  padding: var(--space-xs) var(--space-sm);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.price-history-table th {
  font-weight: 600;
  color: var(--color-text-muted);
}
.price-history-item.price-drop {
  background: #FFEBEE;
}
.price-history-item.price-rise {
  background: #E8F5E9;
}

/* Alert badge on nav button */
.price-intel-alert-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--color-danger);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 700;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Manual Scan Result */
#manual-scan-result {
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  margin-top: var(--space-sm);
  font-size: var(--font-size-caption);
}
#manual-scan-result.success {
  background: #E8F5E9;
  color: #1B5E20;
}
#manual-scan-result.error {
  background: #FFEBEE;
  color: #C62828;
}

/* Price Intel Details */
.details-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-caption);
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}
.details-value {
  font-weight: 600;
  color: var(--color-text);
}

/* Price History Table */
.price-history-table {
  width: 100%;
  font-size: var(--font-size-caption);
  border-collapse: collapse;
  margin-top: var(--space-sm);
}
.price-history-table th,
.price-history-table td {
  padding: var(--space-xs) var(--space-sm);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.price-history-table th {
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-bg);
}
.price-history-item.price-drop {
  background: #FFEBEE;
}
.price-history-item.price-rise {
  background: #E8F5E9;
}

/* === 2FA Settings === */
.recovery-code {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: 13px;
  background: #F9FAFB;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #E5E7EB;
  text-align: center;
  letter-spacing: 1px;
  color: #374151;
  user-select: all;
}

.recovery-modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

/* === ANALYTICS TABLE === */
/* Make analytics section full width, ignoring main-content max-width */
body[data-active-tab="analytics"] .main-content {
  max-width: 100% !important;
  padding: var(--space-lg);
}

/* На мобиле клиренс под fixed bottom-nav терялся из-за padding-shorthand выше — пагинация пряталась под навом */
@media (max-width: 767px) {
  body[data-active-tab="analytics"] .main-content { padding-bottom: 72px; }
}

/* Analytics mode switch (Актуальная | За полгода) */
.analytics-mode-switch {
  display: inline-flex;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  overflow: hidden;
  background: #F9FAFB;
}

.analytics-mode-switch button {
  padding: 8px 18px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.analytics-mode-switch button:hover {
  color: #2563EB;
}

.analytics-mode-switch button.active {
  background: #2563EB;
  color: #fff;
}

#tab-analytics {
  width: 100%;
  max-width: 100%;
  padding: 0;
  margin: 0;
}
#analytics-results {
  width: 100%;
  max-width: 100%;
  padding: 0;
  margin: 0;
}
.desktop-only {
  width: 100%;
}
#analytics-table {
  table-layout: fixed;
  width: 100% !important;
  max-width: 100vw !important;
}
#analytics-table th {
  padding: 8px 4px;
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#analytics-table td {
  padding: 6px 4px;
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#analytics-table td:first-child,
#analytics-table th:first-child {
  text-align: left;
  padding-left: 4px;
}
#analytics-table td:nth-child(2),
#analytics-table th:nth-child(2) {
  text-align: left;
  padding-left: 4px;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.3;
  height: auto;
}
#analytics-table td:nth-child(3),
#analytics-table th:nth-child(3) {
  text-align: left;
  padding-left: 4px;
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.2;
}
#analytics-table td:nth-child(4),
#analytics-table th:nth-child(4) {
  text-align: left;
  padding-left: 4px;
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.2;
}
#analytics-table td:nth-child(5),
#analytics-table th:nth-child(5) {
  text-align: left;
  padding-left: 4px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* === МОБИЛЬНЫЕ КАРТОЧКИ: заказы/топ/аналитика (спека 2026-10-23) === */
.mobile-cards { display: flex; flex-direction: column; gap: var(--space-sm); }
.order-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex; flex-direction: column; gap: 6px;
}
.order-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.order-card-id { font-weight: 700; color: var(--color-text-muted); font-size: 13px; }
.order-card-customer { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.order-card-phone { font-size: var(--font-size-caption); color: var(--color-text-muted); }
.order-card-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.order-card-amount { font-weight: 700; font-size: 16px; white-space: nowrap; }
.order-card-title {
  font-weight: 600; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

@media (min-width: 768px) {
  .mobile-cards { display: none !important; }
}

/* === ДИАЛОГИ + СТРАХОВКА ГОРИЗОНТАЛЬНОГО СКРОЛЛА (спека 2026-10-23) === */
dialog { max-height: calc(100vh - 32px); }
dialog { max-height: calc(100dvh - 32px); overflow-y: auto; }
dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
html, body { overflow-x: clip; }
/* Product workspace: recognizable photos and clearly labelled fields. */
.product-table-identity { display:flex; align-items:center; gap:16px; min-width:240px; }
.product-table-name { font-weight:600; line-height:1.5; overflow-wrap:anywhere; }
.product-photo-button { display:inline-flex; padding:0; border:1px solid var(--color-border); border-radius:12px; background:#fff; cursor:zoom-in; flex:none; overflow:hidden; }
.product-photo-button:hover { border-color:var(--color-primary); box-shadow:0 0 0 3px var(--color-primary-light); }
.product-photo-button:focus-visible { outline:3px solid var(--color-primary); outline-offset:3px; }
.product-thumb { width:88px; height:88px; object-fit:contain; padding:6px; margin:0; background:#F8FAFC; border-radius:10px; display:block; }
.product-photo-empty { display:flex; flex-direction:column; align-items:center; justify-content:center; font-size:24px; color:var(--color-text-muted); flex:none; }
.product-photo-empty small { font-size:11px; margin-top:4px; }
.product-row-actions { display:flex; align-items:center; gap:8px; }
#products-table { background:#fff; border:1px solid var(--color-border); border-radius:12px; border-spacing:0; }
#products-table td { padding:16px 12px; vertical-align:middle; }
#products-table td:nth-child(n+4) { white-space:nowrap; font-variant-numeric:tabular-nums; }
.product-create-form { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); padding:20px; background:#fff; border:1px solid var(--color-border); border-radius:14px; gap:16px; align-items:start; }
.product-form-heading { grid-column:1/-1; display:flex; flex-wrap:wrap; align-items:center; gap:8px 20px; }
.product-form-heading h3 { margin:0; }
.product-form-heading span { color:var(--color-text-muted); font-size:13px; }
.product-field { display:flex; flex-direction:column; gap:7px; font-size:13px; font-weight:600; min-width:0; }
.product-field-wide { grid-column:span 2; }
#product-form .input { min-width:0; width:100%; }
.product-form-footer { grid-column:1/-1; display:flex; flex-wrap:wrap; justify-content:space-between; gap:12px; align-items:center; }
.product-photo-upload { display:flex; align-items:center; gap:12px; }
#product-photo-preview { width:72px; height:72px; object-fit:contain; border:1px solid var(--color-border); border-radius:10px; }
#product-photo-dialog { width:min(720px,calc(100vw - 32px)); margin:auto; padding:20px; border:0; border-radius:16px; box-shadow:0 20px 80px #0f172a40; }
.photo-dialog-header { display:flex; gap:16px; align-items:center; justify-content:space-between; margin-bottom:16px; }
.photo-dialog-header h2 { font-size:18px; overflow-wrap:anywhere; }
#product-photo-large { display:block; width:100%; max-height:70dvh; object-fit:contain; background:#F8FAFC; border-radius:12px; }

/* Analytics keeps full numeric values; wide tables scroll inside the workspace. */
.analytics-table-scroll { display:block; width:100%; max-width:100%; overflow:auto; max-height:72vh; border:1px solid var(--color-border); border-radius:12px; background:#fff; scrollbar-gutter:stable; }
#analytics-table, #hy-table { table-layout:auto; width:100% !important; max-width:none !important; min-width:1750px; border-collapse:separate; border-spacing:0; }
#hy-table { min-width:1560px; }
#analytics-table th, #hy-table th { position:sticky; top:0; z-index:2; padding:14px 16px; background:#F1F5F9; font-size:12px; text-align:right; white-space:nowrap; overflow:visible; }
#analytics-table td, #hy-table td { padding:14px 16px; font-size:13px; text-align:right; white-space:nowrap; overflow:visible; text-overflow:clip; font-variant-numeric:tabular-nums; }
#analytics-table th:first-child, #analytics-table td:first-child, #hy-table th:first-child, #hy-table td:first-child { position:sticky; left:0; min-width:260px; width:280px; max-width:320px; text-align:left; background:#fff; z-index:1; box-shadow:2px 0 0 #E2E8F0; }
#analytics-table th:first-child, #hy-table th:first-child { z-index:3; background:#F1F5F9; }
#analytics-table td:nth-child(2), #hy-table td:nth-child(2) { white-space:nowrap; text-align:left; min-width:110px; }
#analytics-table td:nth-child(3), #analytics-table td:nth-child(4), #analytics-table td:nth-child(5), #hy-table td:nth-child(3), #hy-table td:nth-child(4), #hy-table td:nth-child(5) { white-space:normal; text-align:left; min-width:150px; max-width:210px; }
.analytics-card-metrics { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; border-top:1px solid var(--color-border); padding-top:12px; margin-top:4px; }
.analytics-card-metrics dt { color:var(--color-text-muted); font-size:12px; margin-bottom:4px; }
.analytics-card-metrics dd { font-size:14px; font-weight:600; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
#analytics-pagination, #hy-pagination { flex-wrap:wrap; }
#tab-analytics .order-card-title { white-space:normal; overflow:visible; }
#tab-analytics .order-card-top, #tab-analytics .order-card-bottom { flex-wrap:wrap; }
#tab-analytics .order-card-phone { overflow-wrap:anywhere; }
#tab-analytics input { min-width:0; }
@media (min-width:768px) {
  .main-content { max-width:1440px; padding:24px 32px; }
  #tab-products { display:grid; grid-template-columns:minmax(0,1fr) auto; column-gap:24px; }
  #tab-products > * { grid-column:1/-1; min-width:0; }
  #tab-products > h2 { grid-column:1; grid-row:1; align-self:center; margin:0 0 20px; }
  #tab-products > .quick-actions { grid-column:2; grid-row:1; display:flex; }
  #tab-products .quick-action-card { flex-direction:row; padding:10px 16px; }
  #tab-products .quick-action-icon { font-size:18px; }
  #products-dashboard { grid-row:2; }
  #tab-products .search-bar { grid-column:1; }
  #tab-products .sort-selector { max-width:380px; }
  #tab-products .filter-chips { margin-top:0; }
  .analytics-table-scroll { display:block; }
}
@media (max-width:767px) {
  .product-create-form { grid-template-columns:repeat(2,minmax(0,1fr)); padding:16px; }
  .product-field-wide { grid-column:1/-1; }
  .product-form-footer > .btn { width:100%; }
  .product-card { grid-template-columns:minmax(0,1fr); gap:12px; }
  .product-card-main { gap:12px; min-width:0; }
  .product-card-photo { width:76px; height:76px; object-fit:contain; padding:4px; }
  .product-card-name { overflow-wrap:anywhere; }
  .product-card-right { flex-direction:row; align-items:center; justify-content:space-between; padding-top:10px; border-top:1px solid var(--color-border); }
  .product-card-sku { overflow-wrap:anywhere; }
  #tab-analytics .order-card-amount { white-space:normal; overflow-wrap:anywhere; }
}
.product-create-panel { margin-bottom:20px; }
.product-create-panel > summary { padding:16px 20px; border:1px solid var(--color-border); border-radius:12px; background:#fff; font-weight:600; cursor:pointer; }
.product-create-panel > summary span { margin-left:12px; font-size:13px; font-weight:400; color:var(--color-text-muted); }
.product-create-panel[open] > summary { margin-bottom:12px; }
.analytics-filter-panel { padding:14px; border:1px solid var(--color-border); border-radius:12px; background:#fff; margin-bottom:16px; }
.analytics-filter-panel > summary { cursor:pointer; font-weight:600; }
.analytics-filter-panel[open] > summary { margin-bottom:16px; }
.analytics-scroll-hint { color:var(--color-text-muted); font-size:12px; margin:12px 0 8px; }
#analytics-table td:first-child, #hy-table td:first-child { white-space:normal; }
@media(min-width:768px) { .product-create-panel { max-width:100%; } }
@media(max-width:767px) {
  .product-create-panel > summary span { display:block; margin:6px 0 0; }
  .analytics-scroll-hint { display:none; }
  #tab-analytics .analytics-filter-panel input { min-height:44px; }
}
@media (min-width:768px) and (max-width:999px) {
  #products-table { display:none; }
  #products-cards { display:flex !important; flex-direction:column; gap:12px; }
  .product-card-main { gap:12px; }
  .product-card-photo { width:76px; height:76px; object-fit:contain; }
  #tab-products { display:block; }
  #tab-products > .quick-actions { display:flex; flex-wrap:wrap; }
}

/* Focused column groups reduce horizontal navigation. */
.analytics-table-tools { margin:12px 0; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px 24px; }
.analytics-table-tools > label { display:flex; align-items:center; gap:12px; font-weight:600; font-size:13px; }
.analytics-table-tools select { width:auto; min-width:190px; }
.analytics-top-scroll { display:flex; align-items:center; gap:12px; flex:1; max-width:540px; min-width:260px; }
.analytics-top-scroll[hidden] { display:none; }
.analytics-top-scroll > span { color:var(--color-text-muted); font-size:12px; white-space:nowrap; }
.analytics-scroll-range { flex:1; width:100%; min-width:80px; accent-color:var(--color-primary); cursor:ew-resize; height:32px; }
.analytics-top-scroll button { padding:6px 10px; }
#analytics-table[data-columns="overview"] { min-width:1050px; }
#analytics-table[data-columns="prices"] { min-width:950px; }
#analytics-table[data-columns="demand"] { min-width:1400px; }
#hy-table[data-columns="overview"] { min-width:1050px; }
#hy-table[data-columns="prices"] { min-width:900px; }
#hy-table[data-columns="demand"] { min-width:1150px; }
@media (min-width:768px) { .analytics-table-tools { display:flex; } }
#analytics-table[data-columns="overview"] th:nth-child(3),
#analytics-table[data-columns="overview"] td:nth-child(3),
#analytics-table[data-columns="overview"] th:nth-child(4),
#analytics-table[data-columns="overview"] td:nth-child(4),
#analytics-table[data-columns="overview"] th:nth-child(5),
#analytics-table[data-columns="overview"] td:nth-child(5),
#analytics-table[data-columns="overview"] th:nth-child(9),
#analytics-table[data-columns="overview"] td:nth-child(9),
#analytics-table[data-columns="overview"] th:nth-child(10),
#analytics-table[data-columns="overview"] td:nth-child(10),
#analytics-table[data-columns="overview"] th:nth-child(14),
#analytics-table[data-columns="overview"] td:nth-child(14) { display:none; }
#analytics-table[data-columns="prices"] th:nth-child(4),
#analytics-table[data-columns="prices"] td:nth-child(4),
#analytics-table[data-columns="prices"] th:nth-child(7),
#analytics-table[data-columns="prices"] td:nth-child(7),
#analytics-table[data-columns="prices"] th:nth-child(8),
#analytics-table[data-columns="prices"] td:nth-child(8),
#analytics-table[data-columns="prices"] th:nth-child(9),
#analytics-table[data-columns="prices"] td:nth-child(9),
#analytics-table[data-columns="prices"] th:nth-child(11),
#analytics-table[data-columns="prices"] td:nth-child(11),
#analytics-table[data-columns="prices"] th:nth-child(12),
#analytics-table[data-columns="prices"] td:nth-child(12),
#analytics-table[data-columns="prices"] th:nth-child(13),
#analytics-table[data-columns="prices"] td:nth-child(13),
#analytics-table[data-columns="prices"] th:nth-child(14),
#analytics-table[data-columns="prices"] td:nth-child(14) { display:none; }
#analytics-table[data-columns="demand"] th:nth-child(3),
#analytics-table[data-columns="demand"] td:nth-child(3),
#analytics-table[data-columns="demand"] th:nth-child(4),
#analytics-table[data-columns="demand"] td:nth-child(4),
#analytics-table[data-columns="demand"] th:nth-child(5),
#analytics-table[data-columns="demand"] td:nth-child(5),
#analytics-table[data-columns="demand"] th:nth-child(6),
#analytics-table[data-columns="demand"] td:nth-child(6),
#analytics-table[data-columns="demand"] th:nth-child(10),
#analytics-table[data-columns="demand"] td:nth-child(10) { display:none; }
#hy-table[data-columns="overview"] th:nth-child(3),
#hy-table[data-columns="overview"] td:nth-child(3),
#hy-table[data-columns="overview"] th:nth-child(4),
#hy-table[data-columns="overview"] td:nth-child(4),
#hy-table[data-columns="overview"] th:nth-child(5),
#hy-table[data-columns="overview"] td:nth-child(5),
#hy-table[data-columns="overview"] th:nth-child(9),
#hy-table[data-columns="overview"] td:nth-child(9),
#hy-table[data-columns="overview"] th:nth-child(12),
#hy-table[data-columns="overview"] td:nth-child(12) { display:none; }
#hy-table[data-columns="prices"] th:nth-child(4),
#hy-table[data-columns="prices"] td:nth-child(4),
#hy-table[data-columns="prices"] th:nth-child(7),
#hy-table[data-columns="prices"] td:nth-child(7),
#hy-table[data-columns="prices"] th:nth-child(8),
#hy-table[data-columns="prices"] td:nth-child(8),
#hy-table[data-columns="prices"] th:nth-child(9),
#hy-table[data-columns="prices"] td:nth-child(9),
#hy-table[data-columns="prices"] th:nth-child(10),
#hy-table[data-columns="prices"] td:nth-child(10),
#hy-table[data-columns="prices"] th:nth-child(11),
#hy-table[data-columns="prices"] td:nth-child(11),
#hy-table[data-columns="prices"] th:nth-child(12),
#hy-table[data-columns="prices"] td:nth-child(12) { display:none; }
#hy-table[data-columns="demand"] th:nth-child(3),
#hy-table[data-columns="demand"] td:nth-child(3),
#hy-table[data-columns="demand"] th:nth-child(4),
#hy-table[data-columns="demand"] td:nth-child(4),
#hy-table[data-columns="demand"] th:nth-child(5),
#hy-table[data-columns="demand"] td:nth-child(5),
#hy-table[data-columns="demand"] th:nth-child(6),
#hy-table[data-columns="demand"] td:nth-child(6) { display:none; }

.analytics-card-details { display:grid; gap:8px; margin:4px 0; padding:12px; background:#F8FAFC; border-radius:8px; }
.analytics-card-details > div { display:grid; grid-template-columns:100px minmax(0,1fr); gap:12px; align-items:baseline; }
.analytics-card-details dt { color:var(--color-text-muted); font-size:12px; }
.analytics-card-details dd { font-size:13px; line-height:1.45; overflow-wrap:anywhere; }
.analytics-sku { font-family:ui-monospace,Consolas,monospace; color:var(--color-text); }
.product-card-sku span { font-family:var(--font-family); font-size:12px; }

.merchant-editor { flex-basis:100%; min-width:0; padding:16px; border:1px solid var(--color-border); background:#fff; border-radius:12px; }
.merchant-editor > label { font-weight:600; display:block; margin-bottom:6px; }
.merchant-editor p { color:var(--color-text-muted); font-size:12px; line-height:1.5; margin:6px 0 12px; }
.merchant-name-tags { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }
.merchant-name-tag { display:inline-flex; align-items:center; gap:8px; max-width:100%; padding:5px 6px 5px 12px; border:1px solid #BFDBFE; border-radius:8px; background:#EFF6FF; color:#1E40AF; }
.merchant-name-tag > span { overflow-wrap:anywhere; min-width:0; }
.merchant-name-tag button { background:transparent; border:0; color:inherit; font-size:22px; cursor:pointer; width:32px; height:32px; flex:none; border-radius:6px; }
.merchant-name-tag button:hover { background:#DBEAFE; }
.merchant-empty { font-size:13px; color:var(--color-text-muted); }
.merchant-entry-row { display:flex; gap:8px; }
.merchant-entry-row .input { min-width:0; }
.merchant-editor #merchant-entry-help { margin-bottom:0; }
@media(max-width:767px) { .merchant-editor { width:100%; } .merchant-entry-row .btn { padding:8px 12px; } }

.invoice-upload-control { position:relative; overflow:hidden; }
.invoice-upload-control input[type="file"] { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; }
.invoice-upload-control:focus-within { outline:3px solid var(--color-primary); outline-offset:3px; }
#invoice-drop-area { display:block; }
/* Shared visual system: calm surfaces and clear, consistent controls. */
:root { --color-primary:#2563eb; --color-primary-dark:#1d4ed8; --color-primary-light:#dbeafe; --color-bg:#f1f5f9; --color-border:#e2e8f0; --color-text:#0f172a; --color-text-muted:#64748b; --color-success:#2563eb; --shadow-md:0 3px 16px rgba(23,43,37,.035); }
.ui-icon { display:inline-block; width:20px; height:20px; flex-shrink:0; vertical-align:middle; }
.brand { display:flex; gap:10px; align-items:center; color:inherit; text-decoration:none; }
.brand-mark { display:inline-flex; justify-content:center; align-items:center; width:34px; height:34px; background:#2563eb; color:white; border-radius:10px; }
.brand-mark .ui-icon { width:22px; height:22px; }
.brand-dot { color:#3b82f6; }
.header { background:#fff; color:var(--color-text); border-bottom:1px solid var(--color-border); padding:16px 24px; min-height:72px; flex-direction:row; justify-content:space-between; align-items:center; }
.header h1 { font-size:21px; letter-spacing:-.8px; }
.header .auth-status { align-self:center; color:var(--color-text-muted); font-size:12px; padding:7px 11px; background:#f1f5f9; border-radius:30px; opacity:1; }
.main-content { width:100%; min-width:0; }
.tab-section h2 { letter-spacing:-.8px; font-size:28px; line-height:1.25; }
.tab-section h2 > .ui-icon { display:none; }
.btn { border-radius:9px; min-height:40px; font-weight:600; box-shadow:none; }
.btn-outline { border:1px solid var(--color-border); color:var(--color-text); padding:9px 19px; }
.btn-outline:hover { background:#eff6ff; border-color:#bfdbfe; }
.input { min-height:42px; border-radius:9px; padding:11px 13px; }
.input:focus { box-shadow:0 0 0 3px #2563eb14; border-color:#2563eb; }
.card,.product-card,.order-card { border:1px solid var(--color-border); box-shadow:var(--shadow-md); }
.quick-action-card,.quick-action-card.secondary,.quick-action-card.tertiary { background:#fff; color:var(--color-text); border:1px solid var(--color-border); border-radius:10px; flex-direction:row; justify-content:center; gap:8px; padding:12px 16px; min-height:44px; }
.quick-action-card[data-action="add-product"],.invoice-upload-control { background:var(--color-primary); color:#fff; border-color:var(--color-primary); }
.quick-action-card:hover { box-shadow:0 3px 10px #0f172a10; border-color:#bfdbfe; }
.quick-action-icon { font-size:0; display:flex; }
.quick-action-icon .ui-icon { width:19px; height:19px; }
.quick-action-label { font-size:13px; }
.stat-card { padding:20px; border-radius:13px; background:#fff; box-shadow:0 2px 6px #0f172a03; }
.stat-label { font-size:12px; color:#64748b; margin-bottom:12px; }
.stat-value { font-size:28px; font-weight:600; letter-spacing:-1px; font-variant-numeric:tabular-nums; }
.stat-change { margin-top:8px; font-size:12px; }
.stats-grid { gap:16px; }
#products-table { background:#fff; border:1px solid var(--color-border); border-collapse:separate; border-spacing:0; border-radius:13px; overflow:hidden; }
th { background:#f8faf9; font-size:11px; padding:14px 16px; border-bottom:1px solid var(--color-border); }
td { padding:14px 16px; }
.product-table-name { font-weight:600; }
.product-row-actions .btn:first-child { background:#eff6ff; color:var(--color-primary); }
.product-row-actions .btn { min-height:34px; }
.product-photo-empty,.product-card-photo-empty { color:#94a3b8; background:#f8fafc; }
.product-photo-empty .ui-icon,.product-card-photo-empty .ui-icon { width:28px; height:28px; }
.filter-chip { border-radius:8px; }
.filter-chip.active { background:#dbeafe; color:#1d4ed8; border-color:#bfdbfe; }
.auth-card { max-width:440px; padding:36px; margin:64px auto; border:1px solid var(--color-border); box-shadow:0 12px 48px #0f172a07; border-radius:20px; }
.auth-eyebrow { color:var(--color-primary); font-size:10px; letter-spacing:1.5px; font-weight:700; text-align:center; margin-bottom:14px; }
.auth-card h2 { font-size:30px; letter-spacing:-1px; margin-bottom:10px; }
.auth-intro { text-align:center; color:var(--color-text-muted); margin-bottom:28px; font-size:13px; }
.auth-card .input { min-height:48px; }
.auth-card .btn { min-height:46px; }
#invoice-drop-area { border-color:#bfdbfe !important; background:#f8fafc !important; border-radius:16px !important; padding:48px 20px !important; }
#invoice-drop-area > div:first-child { color:var(--color-primary); }
#invoice-drop-area > div:first-child .ui-icon { width:36px; height:36px; margin-bottom:10px; }
#tab-invoices .quick-actions { display:flex; }
#tab-invoices .invoice-upload-control { min-width:210px; }
.analytics-table-scroll { border-color:var(--color-border); box-shadow:0 3px 16px #0f172a03; }
.bottom-nav { height:70px; padding:8px 8px max(8px,env(safe-area-inset-bottom)); border-top:1px solid var(--color-border); box-shadow:0 -4px 20px #0f172a05; align-items:center; }
.bottom-nav-item { gap:5px; min-height:44px; min-width:44px; }
.bottom-nav-item .icon { line-height:1; display:flex; }
.bottom-nav-item .ui-icon { width:21px; height:21px; }
.bottom-nav-fab { width:42px; height:42px; margin:0; border-radius:13px; box-shadow:none; }
@media(min-width:1100px) {
 .is-authenticated .header { position:fixed; left:0; top:0; width:224px; z-index:101; border-right:1px solid var(--color-border); border-bottom:0; height:100px; display:block; padding:25px 20px; }
 .is-authenticated .header .auth-status { display:block; width:fit-content; margin:11px 0 0 44px; padding:0; background:none; font-size:10px; }
 .is-authenticated #app { padding-left:224px; }
 .desktop-nav { position:fixed; top:100px; left:0; bottom:0; width:224px; background:#fff; border-right:1px solid var(--color-border); padding:18px 14px; flex-direction:column; flex-wrap:nowrap; gap:6px; z-index:100; }
 .desktop-nav::before { content:'РАБОЧЕЕ ПРОСТРАНСТВО'; font-size:9px; letter-spacing:1.4px; color:#94a3b8; margin:0 12px 14px; font-weight:600; }
 .desktop-nav .btn { justify-content:flex-start; padding:12px 14px; background:transparent; color:#64748b; font-size:13px; min-height:45px; font-weight:500; }
 .desktop-nav .btn:hover { background:#f8fafc; color:#0f172a; }
 .desktop-nav .btn.active-nav { background:#dbeafe; color:#1d4ed8; font-weight:600; }
 .desktop-nav [data-tab="create-order"] { order:20; margin-top:14px; background:#2563eb; color:#fff; justify-content:center; }
 .desktop-nav #logout-btn-desktop { order:21; margin-top:auto; border-top:1px solid var(--color-border); border-radius:0; }
 .main-content,body[data-active-tab="analytics"] .main-content { max-width:1600px; padding:38px 36px; }
 #tab-products > h2 { margin-bottom:24px; }
 #tab-products > .quick-actions { margin-bottom:24px; }
 .stats-grid { margin-bottom:28px; }
}
@media(min-width:768px) and (max-width:1099px) {
 .desktop-nav { gap:4px; padding:12px 20px; border-bottom:1px solid var(--color-border); background:#fff; }
 .desktop-nav .btn { padding:10px 12px; font-size:12px; }
 .desktop-nav .ui-icon { width:16px; height:16px; }
 #tab-products { display:block; }
}
@media(max-width:767px) {
 .header { min-height:64px; padding:12px 18px; }
 .header h1 { font-size:19px; }
 .header .auth-status { font-size:10px; }
 .main-content,body[data-active-tab="analytics"] .main-content { padding:24px 16px 98px; }
 .tab-section h2 { font-size:26px; margin-bottom:20px; }
 .auth-card { margin:40px 16px; padding:28px 24px; max-width:440px; }
 .quick-actions { gap:8px; }
 .quick-action-card { flex-direction:column; padding:12px 6px; }
 .quick-action-label { font-size:11px; }
 .stats-grid { gap:10px; }
 .stat-card { padding:16px; }
 .stat-value { font-size:24px; }
 .stat-label { font-size:11px; margin-bottom:8px; }
 .stat-change { font-size:10px; }
 .product-card { border-radius:14px; padding:16px; }
 .product-card-name { line-height:1.45; font-size:14px; }
 #tab-invoices .invoice-upload-control { flex-direction:row; width:100%; }
 .toast { bottom:86px; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; } }
.analytics-mode-switch button.active { background:var(--color-primary); color:#fff; }
.analytics-mode-switch button:hover { color:var(--color-primary); }
.analytics-mode-switch button.active:hover { color:#fff; }

.analytics-product-link { color:#2563eb; text-decoration:underline; text-underline-offset:3px; }
.analytics-product-link:hover { color:#1d4ed8; }
.analytics-product-link:focus-visible { outline:2px solid #2563eb; outline-offset:3px; border-radius:2px; }
