/* ═══════════════════════════════════════════════════════════════════
   MPBOT · Dark Design System v3.0
   ═══════════════════════════════════════════════════════════════════ */

/* Z-INDEX HIERARCHY
   1     base content
   5     sticky first column (td:first-child)
   20    sticky table headers (thead th)
   25    sticky corner cell (thead th:first-child)
   200   navbar
   250   mobile menu (.nav-links.mobile-open)
   1000  modal-overlay
   1500  dropdowns (TomSelect, custom selects, date-pickers)
   2000  toast/notifications
*/

:root {
  --primary:       #7c3aed;
  --primary-dark:  #6d28d9;
  --primary-light: #8b5cf6;
  --success:  #22c55e;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --info:     #3b82f6;

  --bg:           #0d0f17;
  --surface:      #161924;
  --surface-2:    #1c1f2e;
  --border:       #252840;
  --border-light: #1e2133;

  --text:   #e8eaf6;
  --text-2: #9499bb;
  --text-3: #555d80;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.25);
  --shadow:    0 4px 12px rgba(0,0,0,0.35), 0 2px 4px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.5), 0 4px 8px rgba(0,0,0,0.3);
  --shadow-xl: 0 20px 50px rgba(0,0,0,0.6), 0 8px 20px rgba(0,0,0,0.4);

  --radius:      12px;
  --radius-sm:   8px;
  --radius-xs:   6px;
  --radius-full: 9999px;

  --nav-h: 60px;
  --t: 0.18s ease;
}

/* ═══════════════════════════════════════════════════════════════════
   Светлая тема — data-theme="light"
   ═══════════════════════════════════════════════════════════════════ */
:root[data-theme="light"] {
  --bg:           #f7f8fa;
  --surface:      #ffffff;
  --surface-2:    #f1f3f7;
  --border:       #e5e7eb;
  --border-light: #edf0f4;

  --text:   #1a1a2e;
  --text-2: #4b5563;
  --text-3: #9ca3af;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow:    0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.06);
  --shadow-xl: 0 20px 50px rgba(0,0,0,0.12), 0 8px 20px rgba(0,0,0,0.07);
}

/* Навбар — светлая тема */
:root[data-theme="light"] .navbar {
  background: linear-gradient(135deg, #4c1d95 0%, #5b21b6 55%, #7c3aed 100%);
  box-shadow: 0 4px 20px rgba(124,58,237,0.25);
}

/* Мобильное меню — светлая тема */
:root[data-theme="light"] .nav-links {
  background: linear-gradient(180deg, #5b21b6 0%, #4c1d95 100%);
}

/* Скроллбар — светлая тема */
:root[data-theme="light"] ::-webkit-scrollbar-thumb { background: #c7cde0; }
:root[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #a0a9c5; }

/* Инпуты и селекты — светлая тема */
:root[data-theme="light"] input,
:root[data-theme="light"] textarea,
:root[data-theme="light"] select {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
:root[data-theme="light"] option { background: #fff; color: var(--text); }
:root[data-theme="light"] input::placeholder,
:root[data-theme="light"] textarea::placeholder { color: var(--text-3); }

/* Toggle slider — светлая тема */
:root[data-theme="light"] .toggle-slider { background: #d1d5db; }

/* Archive row hover — светлая тема */
:root[data-theme="light"] .archive-row:hover td { background: #f3f0ff; }

/* stat-card.white — адаптация */
:root[data-theme="light"] .stat-card.white { background: #fff; }

/* Metric row highlight — светлая тема */
:root[data-theme="light"] .metric-row.highlight {
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
}

/* Kanban done/rejected — светлая тема */
:root[data-theme="light"] .kanban-col[data-status="done"] { background: rgba(34,197,94,.04); }
:root[data-theme="light"] .kanban-col[data-status="rejected"] { background: rgba(239,68,68,.03); }

/* btn-sync hover — светлая тема */
:root[data-theme="light"] .btn-sync:hover { background: #f0f0fe; }

/* Flatpickr — светлая тема переопределяет тёмные overrides */
:root[data-theme="light"] .flatpickr-calendar { background: #fff !important; border-color: var(--border) !important; }
:root[data-theme="light"] .flatpickr-calendar .flatpickr-month,
:root[data-theme="light"] .flatpickr-calendar .flatpickr-weekdays,
:root[data-theme="light"] .flatpickr-calendar .flatpickr-weekday { background: #fff !important; color: #4b5563 !important; }
:root[data-theme="light"] .flatpickr-calendar .flatpickr-day { color: #1a1a2e !important; }
:root[data-theme="light"] .flatpickr-calendar .flatpickr-day:hover { background: #f1f3f7 !important; border-color: var(--primary) !important; }
:root[data-theme="light"] .flatpickr-calendar .flatpickr-day.flatpickr-disabled { color: #9ca3af !important; }
:root[data-theme="light"] .flatpickr-calendar .flatpickr-months .flatpickr-prev-month,
:root[data-theme="light"] .flatpickr-calendar .flatpickr-months .flatpickr-next-month { fill: #4b5563 !important; color: #4b5563 !important; }
:root[data-theme="light"] .flatpickr-calendar .flatpickr-current-month input.cur-year,
:root[data-theme="light"] .flatpickr-calendar .flatpickr-current-month .flatpickr-monthDropdown-months { color: #1a1a2e !important; }

/* Choices.js — светлая тема */
:root[data-theme="light"] .choices-dark .choices__inner { background: #fff; border-color: var(--border); color: #1a1a2e; }
:root[data-theme="light"] .choices-dark .choices__input { color: #1a1a2e; }
:root[data-theme="light"] .choices-dark .choices__list--dropdown { background: #fff; border-color: var(--border); }
:root[data-theme="light"] .choices-dark .choices__list--dropdown .choices__item { color: #1a1a2e; }
:root[data-theme="light"] .choices-dark .choices__item--selectable { color: #1a1a2e; }

/* Переключатель темы */
.theme-toggle-btn {
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.28);
  color: white;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t);
  flex-shrink: 0;
  backdrop-filter: blur(4px);
  font-family: inherit;
  line-height: 1;
  padding: 0;
}
.theme-toggle-btn:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
html { overflow-x: hidden; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2d3154; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4a4f73; }

/* ── Navbar ──────────────────────────────────────────────────── */
.navbar {
  background: linear-gradient(135deg, #0d0f17 0%, #161336 55%, #2d1b69 100%);
  color: white;
  padding: 0 28px;
  display: flex;
  align-items: center;
  height: var(--nav-h);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(67,56,202,0.4);
  gap: 0;
}

.nav-brand {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin-right: 32px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-brand-text {
  background: linear-gradient(90deg, #a5b4fc, #e0e7ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links { display: flex; gap: 2px; align-items: center; }

.nav-link {
  color: rgba(255,255,255,0.68);
  text-decoration: none;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--t);
  white-space: nowrap;
}
.nav-link:hover { color: white; background: rgba(255,255,255,0.13); }
.nav-link.active { color: white; background: rgba(255,255,255,0.2); }
.nav-link.has-pending { color: #fff !important; background: #d93025 !important; animation: navPendingPulse 2s ease-in-out infinite; }
.nav-link.has-pending:hover { background: #b5271d !important; }
.nav-link.has-pending .nav-badge { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 10px; background: #fff; color: #d93025; font-size: 11px; font-weight: 700; text-align: center; line-height: 16px; }
@keyframes navPendingPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(217,48,37,0.6); } 50% { box-shadow: 0 0 0 6px rgba(217,48,37,0); } }

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-user {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 1.5px solid rgba(255,255,255,0.3);
}
.nav-logout {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  padding: 5px 11px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255,255,255,0.15);
  transition: all var(--t);
}
.nav-logout:hover { color: white; background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.25); }

/* Create task button */
.btn-create {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1.5px solid rgba(255,255,255,0.28);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
  backdrop-filter: blur(4px);
  font-family: inherit;
}
.btn-create:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.45);
  transform: translateY(-1px);
}

/* ── Page Layout ──────────────────────────────────────────────── */
.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 20px 24px;
}

h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text);
  line-height: 1.2;
}
h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

/* ── Stat Cards ───────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  border-radius: var(--radius);
  padding: 22px 20px;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: transform var(--t), box-shadow var(--t);
  cursor: default;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: -30%;
  right: -15%;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255,255,255,0.09);
}
.stat-card::before {
  content: '';
  position: absolute;
  bottom: -25%;
  left: -10%;
  width: 85px;
  height: 85px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-xl); }

/* Gradient presets */
.stat-card.purple { background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%); }
.stat-card.green  { background: linear-gradient(135deg, #059669 0%, #10b981 100%); }
.stat-card.blue   { background: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%); }
.stat-card.yellow { background: linear-gradient(135deg, #d97706 0%, #fbbf24 100%); }
.stat-card.red    { background: linear-gradient(135deg, #dc2626 0%, #f87171 100%); }
/* Keep white style for generic use */
.stat-card.white  { background: white; color: var(--text); box-shadow: var(--shadow-sm); border: 1px solid var(--border); border-top: 4px solid var(--primary); }

.stat-icon { font-size: 22px; margin-bottom: 10px; opacity: 0.9; position: relative; z-index: 1; }
.stat-num  { font-size: 38px; font-weight: 800; letter-spacing: -1.5px; line-height: 1; position: relative; z-index: 1; }
.stat-label { font-size: 12px; font-weight: 500; opacity: 0.88; margin-top: 6px; position: relative; z-index: 1; }

/* ── Section Card ─────────────────────────────────────────────── */
.section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

/* ── Status bars ──────────────────────────────────────────────── */
.status-bars { display: flex; flex-direction: column; gap: 12px; }
.status-row { display: flex; align-items: center; gap: 14px; }
.status-row .status-label { width: 195px; font-size: 13px; color: var(--text-2); font-weight: 500; }
.bar-wrap { flex: 1; background: var(--border-light); border-radius: var(--radius-full); height: 8px; overflow: hidden; }
.bar { background: linear-gradient(90deg, var(--primary), #818cf8); height: 100%; border-radius: var(--radius-full); min-width: 6px; transition: width 0.6s cubic-bezier(0.4,0,0.2,1); }
.status-cnt { width: 32px; text-align: right; font-size: 13px; font-weight: 700; color: var(--text); }

/* ── Tables ───────────────────────────────────────────────────── */
/* .data-table — семантический алиас для .task-table; новые страницы используют его */
.data-table, .task-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th, .task-table th {
  background: var(--surface-2);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  border-bottom: 2px solid var(--border);
}
.data-table td, .task-table td { padding: 11px 14px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.data-table tr:last-child td, .task-table tr:last-child td { border-bottom: none; }
.data-table tbody tr, .task-table tbody tr { transition: background var(--t); }
.data-table tbody tr:hover td, .task-table tbody tr:hover td { background: var(--surface-2); }
.data-table a, .task-table a { color: var(--primary); text-decoration: none; font-weight: 500; }
.data-table a:hover, .task-table a:hover { text-decoration: underline; }
.overdue-row td { background: rgba(239,68,68,.08) !important; }

/* ── Page loader / inline loading indicator ──────────────────── */
#page-loader {
  display: none;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
  font-size: 13px;
}
#page-loader .loader-spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* Reuse for existing #db-loading / #aa-loading in metrics */
#db-loading, #aa-loading {
  display: none;
  text-align: center;
  padding: 32px 24px;
  color: var(--text-3);
  font-size: 13px;
}
#db-loading::before, #aa-loading::before {
  content: '';
  display: block;
  width: 26px;
  height: 26px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 10px;
}

/* ── Badges ───────────────────────────────────────────────────── */
.badge {
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  display: inline-block;
  white-space: nowrap;
}
/* Унифицированные badge-модификаторы (новые страницы используют эти классы) */
.badge-success { background: rgba(34,197,94,.15);  color: var(--success, #22c55e); }
.badge-danger  { background: rgba(239,68,68,.15);  color: var(--danger,  #ef4444); }
.badge-warning { background: rgba(245,158,11,.15); color: var(--warning, #f59e0b); }
.badge-info    { background: rgba(59,130,246,.15); color: var(--info,    #3b82f6); }
.badge-neutral { background: var(--surface-2);     color: var(--text-2); }
/* Платформенные маркеры */
.badge-wb   { background: #cb11ab; color: #fff; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; display: inline-block; }
.badge-ozon { background: #005bff; color: #fff; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; display: inline-block; }
.status-new              { background: #dbeafe; color: #1e40af; }
.status-in_progress      { background: #fef3c7; color: #92400e; }
.status-review           { background: #ede9fe; color: #5b21b6; }
.status-done             { background: #dcfce7; color: #14532d; }
.status-revision         { background: #ffedd5; color: #9a3412; }
.status-rejected         { background: #fee2e2; color: #991b1b; }
.status-pending_approval { background: #fce7f3; color: #831843; }
.prio-low    { background: #dcfce7; color: #14532d; }
.prio-medium { background: #fef9c3; color: #713f12; }
.prio-high   { background: #fee2e2; color: #991b1b; }

/* ── Season badges ────────────────────────────────────────────── */
.badge-season {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-season-peak {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}
.badge-season-approaching {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}
.badge-season-off {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
@media (max-width: 640px) {
  .badge-season { font-size: 10px; padding: 2px 6px; gap: 2px; }
}

/* ── Page header / Filters ────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select,
.filters input {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
  font-family: inherit;
  color: var(--text);
  transition: border-color var(--t), box-shadow var(--t);
}
.filters select:focus,
.filters input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

/* ── Kanban ───────────────────────────────────────────────────── */
.kanban {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: flex-start;
}

.kanban-col {
  min-width: 272px;
  max-width: 310px;
  min-height: 80px;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 14px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.kanban-empty {
  text-align: center;
  color: var(--text-3);
  padding: 20px 0;
  font-size: .85rem;
}
.kanban-col[data-status="new"]              { border-top: 3px solid #3b82f6; }
.kanban-col[data-status="in_progress"]      { border-top: 3px solid #f59e0b; }
.kanban-col[data-status="review"]           { border-top: 3px solid #8b5cf6; }
.kanban-col[data-status="pending_approval"] { border-top: 3px solid #ec4899; }
.kanban-col[data-status="revision"]         { border-top: 3px solid #f97316; }
.kanban-col[data-status="done"]             { border-top: 3px solid #22c55e; background: rgba(34,197,94,.06); }
.kanban-col[data-status="rejected"]         { border-top: 3px solid #ef4444; background: rgba(239,68,68,.05); opacity: .85; }

.kanban-header {
  font-weight: 700;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kanban-header .cnt {
  background: var(--border);
  border-radius: var(--radius-full);
  padding: 2px 9px;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 700;
}

.task-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  cursor: pointer;
  transition: all var(--t);
}
.task-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: #d1d5db;
}
.prio-border-low    { border-left-color: #22c55e !important; }
.prio-border-medium { border-left-color: #f59e0b !important; }
.prio-border-high   { border-left-color: #ef4444 !important; }

.task-card-id    { font-size: 11px; color: var(--text-3); margin-bottom: 5px; font-weight: 600; }
.task-card-title { font-size: 13.5px; font-weight: 600; margin-bottom: 10px; line-height: 1.4; color: var(--text); }
.task-card-meta  { display: flex; gap: 7px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.deadline        { font-size: 11.5px; color: var(--text-3); }
.deadline.overdue { color: #dc2626; font-weight: 600; }

.task-card-assignees { display: flex; align-items: center; gap: 6px; }
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.assignee-names { font-size: 11.5px; color: var(--text-3); }

.hidden { display: none !important; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t);
  box-shadow: 0 2px 8px rgba(99,102,241,0.35);
  font-family: inherit;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(99,102,241,0.45); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
  background: var(--surface);
  color: var(--text-2);
  border: 1.5px solid var(--border);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
  font-family: inherit;
}
.btn-secondary:hover { background: var(--surface-2); border-color: #cbd5e1; }

.btn-sm {
  padding: 5px 12px;
  font-size: .8rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--t);
  font-family: inherit;
  white-space: nowrap;
}
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.export-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.btn-full { width: 100%; justify-content: center; }

/* ── Login ────────────────────────────────────────────────────── */
.login-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - var(--nav-h));
  padding: 40px 16px;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(139,92,246,0.1) 0%, transparent 50%),
    #f1f5f9;
}
.login-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 44px 48px;
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(99,102,241,0.08);
  width: 100%;
  max-width: 420px;
  animation: fadeUp 0.3s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.login-logo  { font-size: 52px; text-align: center; margin-bottom: 16px; }
.login-title { font-size: 24px; font-weight: 800; text-align: center; margin-bottom: 6px; letter-spacing: -0.5px; }
.login-sub   { text-align: center; color: var(--text-3); font-size: 14px; margin-bottom: 32px; }

/* ── Forms ────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-2); }

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group textarea,
.form-group select {
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--t), box-shadow var(--t);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.form-group small { font-size: 12px; color: var(--text-3); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.req { color: var(--danger); }

.assignee-checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.check-item { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check-item input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }
.check-item em { color: var(--text-3); font-style: normal; font-size: 12px; margin-left: 4px; }

.radio-group { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-item  { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13.5px; }
.radio-item input[type="radio"] { accent-color: var(--primary); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.alert-error {
  background: #fff1f2;
  color: #9f1239;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid #fca5a5;
}

/* ── Modals ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}
.modal-box {
  background: var(--surface);
  border-radius: 18px;
  padding: 32px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(0,0,0,0.06);
  animation: modalIn 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(-10px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
.modal-wide { max-width: 720px; }

.modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  width: 30px;
  height: 30px;
  cursor: pointer;
  color: var(--text-3);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t);
  line-height: 1;
  font-family: inherit;
}
.modal-close:hover { background: var(--border); color: var(--text); }

.modal-title { font-size: 19px; font-weight: 700; margin-bottom: 20px; letter-spacing: -0.3px; }

/* Detail modal */
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.detail-meta-item {
  font-size: 13px;
  color: var(--text-3);
  background: var(--surface-2);
  padding: 5px 11px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
}
.detail-meta-item b { color: var(--text); font-weight: 600; }

.detail-desc {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-2);
  margin-bottom: 16px;
  white-space: pre-wrap;
  border: 1px solid var(--border);
}

.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.btn-action {
  padding: 7px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--t);
  font-family: inherit;
}
.btn-action:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-action.approve { background: #dcfce7; color: #14532d; }
.btn-action.reject  { background: #fee2e2; color: #991b1b; }
.btn-action.status  { background: #ede9fe; color: #5b21b6; }

.comments-section h3 {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 12px;
}
.comment-item {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
}
.comment-author { font-weight: 700; color: var(--text); }
.comment-at     { font-size: 11px; color: var(--text-3); margin-left: 6px; }
.comment-text   { margin-top: 5px; color: var(--text-2); line-height: 1.5; }

.comment-form { display: flex; gap: 8px; }
.comment-form textarea {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  resize: none;
  transition: border-color var(--t);
}
.comment-form textarea:focus { outline: none; border-color: var(--primary); }
.comment-form button {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(99,102,241,0.3);
  transition: all var(--t);
  font-family: inherit;
}
.comment-form button:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.4); }

/* ── Archive ──────────────────────────────────────────────────── */
.archive-table { font-size: 13px; }
.archive-row { cursor: pointer; }
.archive-row:hover td { background: #faf7ff; }
.archive-id    { color: var(--text-3); width: 52px; font-weight: 600; }
.archive-title { font-weight: 500; max-width: 300px; }
.archive-assignees { color: var(--text-2); }
.archive-date  { color: var(--text-3); white-space: nowrap; }

/* ── Metrics page ─────────────────────────────────────────────── */
.btn-period {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-2);
  background: var(--surface);
  border: 1.5px solid var(--border);
  transition: all var(--t);
  display: inline-block;
}
.btn-period:hover { background: var(--surface-2); border-color: #cbd5e1; }
.btn-period.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(99,102,241,0.35);
}

.btn-sync {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-2);
  border: 1.5px solid var(--border);
  transition: all var(--t);
  font-family: inherit;
}
.btn-sync:hover { background: #f0f0fe; border-color: var(--primary); color: var(--primary-dark); }
.btn-sync:disabled { opacity: 0.5; cursor: not-allowed; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  transition: all var(--t);
}
.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.metric-card.role-manager  { border-top-color: #6366f1; }
.metric-card.role-designer { border-top-color: #f59e0b; }
.metric-card.role-content  { border-top-color: #22c55e; }
.metric-card.role-analyst  { border-top-color: #3b82f6; }

.metric-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.metric-name { font-size: 15px; font-weight: 700; color: var(--text); }
.metric-date { font-size: 11.5px; color: var(--text-3); margin-bottom: 14px; }

.role-badge-manager  { background: #ede9fe; color: #5b21b6; padding: 3px 9px; border-radius: var(--radius-full); font-size: 11.5px; font-weight: 600; }
.role-badge-designer { background: #fef3c7; color: #92400e; padding: 3px 9px; border-radius: var(--radius-full); font-size: 11.5px; font-weight: 600; }
.role-badge-content  { background: #dcfce7; color: #14532d; padding: 3px 9px; border-radius: var(--radius-full); font-size: 11.5px; font-weight: 600; }
.role-badge-analyst  { background: #dbeafe; color: #1e40af; padding: 3px 9px; border-radius: var(--radius-full); font-size: 11.5px; font-weight: 600; }

.metric-rows { display: flex; flex-direction: column; gap: 0; }
.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}
.metric-row:last-child { border-bottom: none; }
.metric-row span { color: var(--text-3); }
.metric-row b    { color: var(--text); font-weight: 700; }
.metric-row.highlight {
  background: linear-gradient(135deg, #faf7ff, #f0f0fe);
  margin: 2px -12px;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  border-bottom: none;
}
.metric-row.positive b { color: #16a34a; }
.metric-row.negative b { color: #dc2626; }

.metrics-summary { font-size: 13px; color: var(--text-2); }

/* ── Empty state ──────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-3);
}
.empty-state-icon { font-size: 52px; margin-bottom: 16px; opacity: 0.6; }
.empty-state p    { font-size: 15px; color: var(--text-2); }
.empty-state code { font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); padding: 3px 8px; border-radius: 4px; }

/* ── Logs ─────────────────────────────────────────────────────── */
.log-action { color: var(--text-2); font-size: 13px; }

/* ── Burger Menu Button (hidden on desktop) ──────────────────── */
.burger-btn {
  display: none;
  background: none; border: none; cursor: pointer;
  padding: 6px; margin-left: auto;
  flex-direction: column; gap: 4px;
}
.burger-btn span {
  display: block; width: 22px; height: 2px;
  background: rgba(255,255,255,0.8); border-radius: 2px;
  transition: all 0.3s ease;
}
.burger-btn.open span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.burger-btn.open span:nth-child(2) { opacity: 0; }
.burger-btn.open span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

/* ── Responsive: Desktop (>1200px) ───────────────────────────── */
@media (min-width: 1201px) {
  .navbar { flex-wrap: nowrap; }
  .nav-links { flex-wrap: wrap; }
  .nav-link { font-size: 13px; padding: 6px 10px; }
}

/* ── Responsive: Tablet (769-1200px) ─────────────────────────── */
@media (max-width: 1200px) {
  .nav-link { font-size: 12px; padding: 5px 8px; }
  .nav-brand { margin-right: 16px; }
  .nav-right { gap: 6px; }
  .btn-create { font-size: 12px; padding: 6px 10px; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Responsive: Nav horizontal scroll (769-900px) ───────────── */
@media (max-width: 900px) and (min-width: 769px) {
  .nav-links { overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .nav-links .nav-link { flex-shrink: 0; }
}

/* ── Responsive: Mobile (<769px) ─────────────────────────────── */
@media (max-width: 768px) {
  .container { padding: 12px; }
  .nav-brand-text { display: none; }

  /* Burger visible */
  .burger-btn { display: flex; }

  /* Nav links — slide-down panel */
  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: linear-gradient(180deg, #161336 0%, #0d0f17 100%);
    flex-direction: column;
    padding: 12px 16px;
    gap: 4px;
    z-index: 250;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    max-height: calc(100vh - var(--nav-h));
    overflow-y: auto;
  }
  .nav-links.mobile-open { display: flex; }

  .nav-link {
    font-size: 14px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    width: 100%;
  }
  .nav-link:hover { background: rgba(255,255,255,0.1); }

  /* Nav right — in navbar, compact */
  .nav-right { gap: 6px; }
  .btn-create { font-size: 11px; padding: 5px 8px; }
  .nav-user span { display: none; }
  .nav-logout { font-size: 11px; }

  /* KPI grid */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi-val { font-size: 18px; }
  .kpi-label { font-size: 11px; }

  /* Charts */
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card.chart-wide { grid-column: 1; }

  /* Stats */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-num { font-size: 24px; }

  /* Page header */
  .page-header { flex-direction: column; gap: 8px; }
  .page-header h1 { font-size: 18px; }

  /* Filters */
  .filter-row { flex-direction: column; }
  .filter-group { width: 100%; }
  .art-filters { padding: 12px; }

  /* Tables — horizontal scroll */
  .section { border-radius: 8px; }

  /* Modal */
  .modal-box { padding: 16px; max-width: 95vw; margin: 10px; }
  .modal-wide { max-width: 95vw; }

  .form-row { grid-template-columns: 1fr; }
  .login-card { padding: 24px 20px; }

  /* Footer */
  .site-footer { font-size: 11px; }
}

/* ── Responsive: Small mobile (<480px) ───────────────────────── */
@media (max-width: 480px) {
  .container { padding: 8px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .navbar { padding: 0 12px; }
  .nav-brand { font-size: 14px; margin-right: 8px; }
}

/* ── Upload page ─────────────────────────────────────────── */
.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.upload-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.upload-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.upload-card-title { font-weight: 600; font-size: 15px; color: var(--text); }
.upload-hint { font-size: 12px; color: var(--text-3); margin-bottom: 14px; line-height: 1.5; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.drop-zone:hover, .drop-zone.uploading { border-color: var(--primary); background: var(--primary-light)22; }
.drop-icon { font-size: 28px; margin-bottom: 6px; }
.drop-text { font-size: 13px; color: var(--text-2); margin-bottom: 10px; }

.btn-upload-file {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background .2s;
}
.btn-upload-file:hover { background: var(--primary-dark); }

.upload-result { margin-top: 12px; font-size: 13px; }
.upload-success { color: #16a34a; background: #dcfce7; border-radius: 8px; padding: 8px 12px; }
.upload-error   { color: #dc2626; background: #fee2e2; border-radius: 8px; padding: 8px 12px; }
.upload-warn    { color: #d97706; background: #fef9c3; border-radius: 8px; padding: 6px 12px; margin-top: 4px; }
.upload-info    { color: #2563eb; background: #eff6ff; border-radius: 8px; padding: 6px 12px; margin-top: 4px; }
.upload-progress { color: var(--text-2); font-style: italic; }

/* Catalog card */
.upload-card-catalog { border-top: 3px solid #8b5cf6; }
.platform-badge.catalog { background: #8b5cf622; color: #7c3aed; font-size: 11px; }
.catalog-selects { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.catalog-select-group { flex: 1; min-width: 120px; }
.catalog-label { font-size: 12px; color: var(--text-3); font-weight: 600; display: block; margin-bottom: 4px; }
.catalog-select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

/* ── Platform badges ─────────────────────────────────────── */
.platform-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.platform-badge.wb   { background: #4f46e522; color: #4f46e5; }
.platform-badge.ozon { background: #0ea5e922; color: #0ea5e9; }

/* ── KPI grid ────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .15s;
}
.kpi-card:hover { transform: translateY(-2px); }
.kpi-icon  { font-size: 24px; margin-bottom: 6px; }
.kpi-val   { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.kpi-label { font-size: 12px; color: var(--text-2); font-weight: 500; }

.kpi-card.purple { border-top: 3px solid var(--primary); }
.kpi-card.blue   { border-top: 3px solid var(--info); }
.kpi-card.green  { border-top: 3px solid var(--success); }
.kpi-card.yellow { border-top: 3px solid var(--warning); }
.kpi-card.red    { border-top: 3px solid var(--danger); }

/* ── KPI Delta (comparison) ──────────────────────────────── */
.kpi-delta {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  display: inline-block;
}
.kpi-delta.delta-up   { color: #22c55e; background: rgba(34,197,94,.12); }
.kpi-delta.delta-down { color: #ef4444; background: rgba(239,68,68,.12); }
.kpi-delta.delta-zero { color: var(--text-3); background: rgba(85,93,128,.12); }

/* ── Period presets ──────────────────────────────────────── */
.period-presets {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* ── Flatpickr dark theme override ───────────────────────── */
.flatpickr-calendar {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-lg) !important;
}
.flatpickr-calendar .flatpickr-month,
.flatpickr-calendar .flatpickr-weekdays,
.flatpickr-calendar .flatpickr-weekday {
  background: var(--surface) !important;
  color: var(--text-2) !important;
}
.flatpickr-calendar .flatpickr-day {
  color: var(--text) !important;
  border-radius: var(--radius-xs) !important;
}
.flatpickr-calendar .flatpickr-day:hover {
  background: var(--surface-2) !important;
  border-color: var(--primary) !important;
}
.flatpickr-calendar .flatpickr-day.selected,
.flatpickr-calendar .flatpickr-day.startRange,
.flatpickr-calendar .flatpickr-day.endRange {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}
.flatpickr-calendar .flatpickr-day.flatpickr-disabled {
  color: var(--text-3) !important;
  opacity: 0.3;
}
.flatpickr-calendar .flatpickr-months .flatpickr-prev-month,
.flatpickr-calendar .flatpickr-months .flatpickr-next-month {
  fill: var(--text-2) !important;
  color: var(--text-2) !important;
}
.flatpickr-calendar .flatpickr-current-month input.cur-year,
.flatpickr-calendar .flatpickr-current-month .flatpickr-monthDropdown-months {
  color: var(--text) !important;
  background: transparent !important;
}
.flatpickr-calendar .numInputWrapper span {
  border-color: var(--border) !important;
}
.flatpickr-calendar .numInputWrapper span::after {
  border-top-color: var(--text-2) !important;
  border-bottom-color: var(--text-2) !important;
}

/* ── Charts grid ─────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.chart-card h3 { font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 16px; }
.chart-wide { grid-column: 1 / -1; }
@media (max-width: 768px) { .charts-grid { grid-template-columns: 1fr; } }

/* ── Filter groups ───────────────────────────────────────── */
.filter-group {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}

/* ── Article autocomplete ────────────────────────────────── */
.autocomplete-wrap { position: relative; }
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  max-height: 280px;
  overflow-y: auto;
  margin-top: 4px;
}
.ac-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  transition: background .1s;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover { background: var(--bg); }
.ac-sku  { font-weight: 700; color: var(--text); }
.ac-name { color: var(--text-2); flex: 1; }
.ac-tag  { font-size: 11px; padding: 1px 7px; border-radius: 999px; font-weight: 600; }
.ac-tag.wb   { background: #4f46e522; color: #4f46e5; }
.ac-tag.ozon { background: #0ea5e922; color: #0ea5e9; }

.article-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  margin-top: 6px;
}
.article-tag button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary-dark);
  font-size: 14px;
  padding: 0;
  line-height: 1;
}
.article-tag button:hover { color: var(--danger); }

/* ── Articles table ──────────────────────────────────────── */
.row-inactive { opacity: 0.5; }
.row-inactive td { background: var(--surface-2); }

/* ── Admin / Toggle switch ───────────────────────────────── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #cbd5e1;
  border-radius: 24px;
  transition: .25s;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .25s;
  box-shadow: 0 1px 3px #00000033;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }
.toggle-slider { background: #2d3154; }

/* ── Dark-mode input/select tweaks ──────────────────────────── */
input, textarea, select {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
option { background: var(--surface-2); color: var(--text); }

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 18px 0 12px;
  font-size: 12px;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.site-footer a { color: var(--primary-light); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ── Articles page ───────────────────────────────────────────── */
.art-filters { padding: 16px; margin-bottom: 0; }
.filter-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-search { flex: 2; min-width: 200px; }
.filter-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; }
.filter-input, .filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  min-width: 130px;
}
.filter-input:focus, .filter-select:focus { outline: none; border-color: var(--primary); }
.filter-group-wide { flex: 0 1 auto; max-width: 420px; }
.season-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.season-chip {
  padding: 4px 10px;
  font-size: 11px; font-weight: 600;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--t), border-color var(--t), color var(--t);
  white-space: nowrap;
}
.season-chip:hover { border-color: var(--primary); color: var(--primary); }
.season-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.art-table { width: 100%; }
.art-table th { padding: 8px 10px; font-size: 13px; white-space: nowrap; }
.art-table td { padding: 8px 10px; font-size: 13px; white-space: normal; word-wrap: break-word; overflow-wrap: anywhere; vertical-align: middle; }
/* Колонки с короткими данными оставляем однострочными: */
.art-table td.art-photo-cell,
.art-table td.art-actions,
.art-table td:first-child { white-space: nowrap; }
.art-photo-cell { padding: 4px 6px !important; width: 110px; min-width: 110px; }
.art-photos-mini {
  display: flex; flex-wrap: wrap; gap: 3px;
  width: 100px;
}
.art-thumb-mini {
  width: 46px; height: 46px;
  object-fit: cover;
  border-radius: 5px;
  border: 1.5px solid var(--border);
  transition: border-color .15s;
  cursor: pointer;
}
.art-photo-cell:hover .art-thumb-mini { border-color: var(--primary); }
/* Hover zoom via fixed overlay — created by JS */
#art-zoom-overlay {
  position: fixed; pointer-events: none; z-index: 99999;
  border-radius: 10px; box-shadow: 0 8px 40px rgba(0,0,0,.7);
  border: 2px solid var(--primary);
  object-fit: cover; display: none;
}
.art-photo-more {
  width: 46px; height: 46px;
  background: var(--surface-2);
  border-radius: 5px;
  border: 1.5px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-3); font-weight: 600;
}
/* Legacy single thumb (kept for compatibility) */
.art-thumb {
  width: 44px; height: 44px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: border-color var(--t), transform var(--t);
}
.art-thumb:hover { border-color: var(--primary); transform: scale(1.08); }
.art-no-photo {
  width: 44px; height: 44px;
  background: var(--surface-2);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text-3);
  border: 1px dashed var(--border);
}
.art-name { max-width: 280px; white-space: normal; word-wrap: break-word; }
.art-sku-col { max-width: 95px; white-space: nowrap; }
.art-sku-oz-col { max-width: 100px; white-space: nowrap; font-size: 12px; color: var(--text-3); }
.art-actions { white-space: nowrap; }
.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 3px 6px;
  border-radius: 6px;
  transition: background var(--t);
}
.btn-icon:hover { background: var(--border); }
.btn-icon-danger:hover { background: rgba(239,68,68,.15); }

/* Category badges */
.art-cat {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.art-cat-игрушки  { background: #fef08a22; color: #fde047; border: 1px solid #fde04733; }
.art-cat-ккм      { background: #bfdbfe22; color: #93c5fd; border: 1px solid #93c5fd33; }
.art-cat-одежда   { background: #fbcfe822; color: #f9a8d4; border: 1px solid #f9a8d433; }

/* Article status badges */
.art-status {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.art-status-ok       { color: var(--success); }
.art-status-forbidden { background: rgba(239,68,68,.15); color: #ef4444; border: 1px solid rgba(239,68,68,.3); }
.art-status-local    { background: rgba(59,130,246,.15); color: #60a5fa; border: 1px solid rgba(59,130,246,.25); }

/* Forbidden rows — subtle red tint */
tr.row-forbidden td { background: rgba(239,68,68,.04); }

/* Photo gallery modal */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
}
.photo-gallery-item {
  position: relative;
}
.photo-num {
  position: absolute;
  top: 4px; left: 4px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  pointer-events: none;
}
.photo-gallery-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform var(--t), border-color var(--t);
}
.photo-gallery-img:hover { transform: scale(1.03); border-color: var(--primary); }

/* ── Priority blocks (РНП) ──────────────────────────────────── */
.priority-block { margin-bottom: 32px; }
.priority-block-header {
  padding: 16px 20px;
  border-radius: var(--radius) var(--radius) 0 0;
  border-left: 4px solid;
}
.priority-block-header h2 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.priority-block-desc { font-size: 13px; color: var(--text-3); line-height: 1.4; }
.priority-block-header.red    { border-color: var(--danger);  background: rgba(239,68,68,.06); }
.priority-block-header.orange { border-color: #f97316;        background: rgba(249,115,22,.06); }
.priority-block-header.blue   { border-color: var(--info);    background: rgba(59,130,246,.06); }
.priority-block-header.yellow { border-color: var(--warning);  background: rgba(245,158,11,.06); }
.priority-block-header.purple { border-color: var(--primary);  background: rgba(124,58,237,.06); }

/* Priority table — full width, no horizontal cut-off */
.priority-table { width: max-content; min-width: 100%; }
.priority-table td { font-size: 12px; padding: 6px 8px; vertical-align: middle; white-space: nowrap; }
.priority-table th[data-sort] { cursor: pointer; user-select: none; }
.priority-table th[data-sort]:hover { color: var(--primary); }
.priority-table th[data-dir="asc"]::after { content: " ▲"; font-size: 9px; }
.priority-table th[data-dir="desc"]::after { content: " ▼"; font-size: 9px; }

/* Photo hover zoom — all tables */
.photo-thumb {
  width: 40px; height: 40px; object-fit: cover; border-radius: 4px;
  border: 1px solid var(--border); transition: transform 0.2s ease;
  cursor: pointer; position: relative; z-index: 1;
  transform-origin: left top;
}
.photo-thumb:hover {
  transform: scale(4);
  z-index: 100;
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

/* Photo lightbox — click to view half-screen */
.photo-lightbox {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85); z-index: 1000;
  align-items: center; justify-content: center; cursor: pointer;
}
.photo-lightbox.active { display: flex; }
.photo-lightbox img {
  max-width: 50vw; max-height: 85vh; object-fit: contain;
  border-radius: var(--radius); box-shadow: var(--shadow-xl);
}

.indicator {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}
.ind-red    { background: rgba(239,68,68,.15); color: #ef4444; }
.ind-yellow { background: rgba(245,158,11,.15); color: #f59e0b; }
.ind-green  { background: rgba(34,197,94,.15);  color: #22c55e; }
.ind-grey   { background: rgba(85,93,128,.15);  color: var(--text-3); }

.issue-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  margin: 1px 2px;
}
.issue-tag.danger  { background: rgba(239,68,68,.15); color: #ef4444; }
.issue-tag.warning { background: rgba(245,158,11,.15); color: #f59e0b; }

.action-cell { white-space: nowrap; }
.action-cell .btn-action {
  padding: 4px 8px;
  font-size: 14px;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  background: var(--surface-2);
  transition: transform var(--t);
}
.action-cell .btn-action:hover { transform: scale(1.15); }
.action-cell .btn-action:disabled { opacity: 0.4; cursor: default; transform: none; }

.text-muted { color: var(--text-3); }

/* ── Multi-dropdown (collection filter) ──────────────────── */
.multi-dropdown { position: relative; }
.multi-dropdown-trigger {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xs);
  padding: 7px 10px; font-size: 13px; color: var(--text); cursor: pointer;
  min-height: 34px; gap: 4px;
}
.multi-dropdown-trigger:hover { border-color: var(--primary); }
.multi-dropdown-trigger span:first-child {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.multi-dropdown-panel {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xs);
  box-shadow: var(--shadow-lg); z-index: 50; max-height: 240px; overflow-y: auto;
  padding: 4px;
}
.multi-dropdown-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; font-size: 13px; color: var(--text); cursor: pointer;
  border-radius: 4px;
}
.multi-dropdown-item:hover { background: var(--surface-2); }
.multi-dropdown-item input[type="checkbox"] {
  accent-color: var(--primary); width: 14px; height: 14px;
}

/* ═══ Global: Sticky table headers (consolidated — см. также блок Sprint 2 ниже) ═══ */

/* ═══ Tasks: adaptive width ═══ */
.kanban-board { width: 100%; overflow-x: auto; }
.kanban-column { min-width: 260px; flex: 1; }
@media (max-width: 1200px) {
  .kanban-board { flex-wrap: wrap; }
  .kanban-column { min-width: 100%; }
}

/* ═══ Diff viewer: тема-совместимые цвета ═══ */
.diff-del { color: #f87171; text-decoration: line-through; }
.diff-ins { color: #4ade80; }
.diff-ctx { color: var(--text-3); }
.diff-block {
  font-family: monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px;
  background: var(--surface-2);
}
:root[data-theme="light"] .diff-del { color: #dc2626; }
:root[data-theme="light"] .diff-ins { color: #16a34a; }
:root[data-theme="light"] .diff-block { background: #fafafa; border-color: #dde1e9; }

/* ═══════════════════════════════════════════════════════════════════
   Sprint 1 UX-фиксы
   ═══════════════════════════════════════════════════════════════════ */

/* ── Fix: Dropdown прозрачность (TomSelect, flatpickr, кастомные) ── */
.ts-dropdown {
  background-color: var(--surface) !important;
  opacity: 1 !important;
  z-index: 1500 !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18) !important;
  border: 1px solid var(--border) !important;
}
.ts-control {
  background-color: var(--surface) !important;
  opacity: 1 !important;
}
.ts-dropdown .option {
  background-color: var(--surface) !important;
  color: var(--text) !important;
}
.ts-dropdown .option:hover,
.ts-dropdown .option.active {
  background-color: var(--primary) !important;
  color: #fff !important;
}

.flatpickr-calendar {
  z-index: 1500 !important;
  opacity: 1 !important;
  background-color: var(--surface) !important;
}

.ms2-drop {
  background-color: var(--surface) !important;
  opacity: 1 !important;
  z-index: 1500 !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18) !important;
  border: 1px solid var(--border) !important;
}

.multi-dropdown-panel {
  background-color: var(--surface) !important;
  opacity: 1 !important;
  z-index: 1500 !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18) !important;
}

.autocomplete-dropdown {
  background-color: var(--surface) !important;
  opacity: 1 !important;
  z-index: 1500 !important;
}

/* Светлая тема — явные фоны для dropdown */
:root[data-theme="light"] .ts-dropdown {
  background-color: #ffffff !important;
  border-color: var(--border) !important;
}
:root[data-theme="light"] .ts-dropdown .option {
  background-color: #ffffff !important;
  color: #1a1a2e !important;
}
:root[data-theme="light"] .ms2-drop {
  background-color: #ffffff !important;
  border-color: var(--border) !important;
}
:root[data-theme="light"] .multi-dropdown-panel {
  background-color: #ffffff !important;
  border-color: var(--border) !important;
}
:root[data-theme="light"] .autocomplete-dropdown {
  background-color: #ffffff !important;
  border-color: var(--border) !important;
}

/* ── Table scroll wrapper ────────────────────────────────────────── */
.table-scroll {
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  max-height: 75vh;
}
.table-scroll table {
  min-width: 100%;
}

/* ── Touch targets ≥ 44px (мобилка) ─────────────────────────────── */
@media (max-width: 768px) {
  .btn-primary,
  .btn-secondary,
  .btn-create,
  .btn-outline {
    min-height: 44px;
    padding: 12px 18px;
  }

  .btn-action {
    min-width: 40px;
    min-height: 40px;
    padding: 8px 12px;
  }

  .btn-sm {
    min-height: 36px;
  }

  .nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

/* ── Полноэкранные модалки на мобилке ────────────────────────────── */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 0;
    align-items: stretch;
  }

  .modal-box {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    margin: 0;
    overflow-y: auto;
  }
}

/* ══════════════════════════════════════════════════════════════════
   Sprint 2 UX improvements
   ══════════════════════════════════════════════════════════════════ */

/* ── 1. Burger-меню: скрываем лишнее из .nav-right на мобилке ──── */
@media (max-width: 768px) {
  /* Уведомления и кнопка "Создать задачу" — убираем из хедера */
  .nav-right .btn-create { display: none; }
  .nav-right .nav-notif-wrap { display: none !important; }
  .hide-on-mobile { display: none !important; }

  /* Аватар и выход — оставляем компактными */
  .nav-user { gap: 4px; }
  .nav-logout { display: none; }
}

/* Пункты бургер-меню: "Создать задачу" и "Уведомления" */
.nav-link-create,
.nav-link-notif {
  display: none; /* скрыты на десктопе */
}
@media (max-width: 768px) {
  .nav-link-create,
  .nav-link-notif {
    display: flex;
    align-items: center;
    color: rgba(255,255,255,0.68);
    text-decoration: none;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    width: 100%;
    min-height: 44px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--t);
  }
  .nav-link-create:hover,
  .nav-link-notif:hover { color: white; background: rgba(255,255,255,0.1); }
}

/* ── 2. Collapse-фильтры на мобилке ──────────────────────────────── */
.btn-toggle-filters {
  display: none; /* скрыта на десктопе */
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--t);
  min-height: 44px;
  width: 100%;
  margin-bottom: 8px;
}
.btn-toggle-filters:hover { border-color: var(--primary); color: var(--primary); }
.btn-toggle-filters .badge-count {
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 768px) {
  .btn-toggle-filters { display: flex; }
  /* Панель фильтров: скрыта по умолчанию на мобилке */
  .filters-collapsible { display: none; }
  .filters-collapsible.filters-open { display: block; }
}
@media (min-width: 769px) {
  /* На планшете и выше — всегда показываем, игнорируем collapse-класс */
  .filters-collapsible { display: block !important; }
  .btn-toggle-filters { display: none !important; }
}

/* ── 3. Toast component ───────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  color: var(--text);
  padding: 14px 20px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  border-left: 4px solid var(--primary);
  min-width: 280px;
  max-width: 420px;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease;
  pointer-events: auto;
  font-size: 13px;
  line-height: 1.4;
}
.toast-show { opacity: 1; transform: translateX(0); }
.toast-success { border-left-color: #22c55e; }
.toast-error   { border-left-color: #ef4444; }
.toast-warning { border-left-color: #f59e0b; }
@media (max-width: 768px) {
  #toast-container { top: auto; bottom: 20px; left: 20px; right: 20px; }
  .toast { min-width: 0; max-width: 100%; transform: translateY(100px); }
  .toast-show { transform: translateY(0); }
}

/* ── 4. Sticky table headers + sticky first column ──────────────── */

/* Универсальный контейнер для горизонтального и вертикального скролла */
.table-scroll-container {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  max-height: 75vh;
}

/* Sticky thead — все таблицы внутри любого overflow-контейнера */
.table-scroll-container thead th,
.table-scroll thead th,
.art-table thead th,
.priority-table thead th,
.task-table thead th,
.att-table thead th,
.settings-table thead th,
.sp-thead th,
.pp-table th,
.des-table thead th,
.metrics-table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
}

/* Sticky first column — th */
.table-scroll-container thead th:first-child,
.table-scroll-container tbody td:first-child,
.table-scroll thead th:first-child,
.table-scroll tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--surface);
}

/* Угловая ячейка (thead th:first-child) — наивысший z-index среди sticky */
.table-scroll-container thead th:first-child,
.table-scroll thead th:first-child {
  z-index: 25;
}

/* Фон td первого столбца совпадает с фоном строки при hover */
.table-scroll-container tbody tr:hover td:first-child,
.table-scroll tbody tr:hover td:first-child {
  background: var(--surface-2);
}

/* ── 5. Loading spinner ───────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}
.spinner-dark {
  border-color: rgba(0,0,0,0.1);
  border-top-color: var(--primary);
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

/* ── 6. Breakpoints 600 и 1024 (placeholders) ────────────────────── */
/* Tablet landscape: 1025–1200px (было 1200, дополняем 1024) */
@media (max-width: 1024px) {
  /* placeholder — tablet landscape breakpoint */
}

/* Small mobile: ширина до 600px */
@media (max-width: 600px) {
  /* placeholder — small mobile breakpoint */
}

/* ══════════════════════════════════════════════════════════════════════
   SPRINT 3 UX — Dashboard KARI
   ══════════════════════════════════════════════════════════════════════ */

/* ── 1. Mobile card-view для таблиц (<768px) ─────────────────────────
   Класс table-cards-mobile: thead скрыт, строки → карточки,
   ячейки → строки label: value через data-label атрибут.
   ──────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .table-cards-mobile,
  .table-cards-mobile thead,
  .table-cards-mobile tbody,
  .table-cards-mobile th,
  .table-cards-mobile td,
  .table-cards-mobile tr {
    display: block;
  }
  .table-cards-mobile thead { display: none; }
  .table-cards-mobile tr {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--surface);
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  }
  .table-cards-mobile td {
    border: none;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    text-align: right;
    min-height: auto;
  }
  .table-cards-mobile td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-2);
    text-align: left;
    flex: 0 0 40%;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }
  .table-cards-mobile td:first-child:not(.no-label) {
    font-weight: 600;
    font-size: 15px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 6px;
  }
  .table-cards-mobile td.no-label::before { display: none; }
  .table-cards-mobile td.no-label { justify-content: flex-start; }
  /* sticky thead и sticky first-column override для card-view */
  .table-cards-mobile thead th,
  .table-cards-mobile tbody td:first-child {
    position: static;
  }
}

/* ── 2. A11y: focus-visible для клавиатурной навигации ───────────────── */
button:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-action:focus-visible,
.btn-create:focus-visible,
.nav-link:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── 2b. Контраст nav-link: 0.68 → 0.88 ────────────────────────────── */
/* (переопределяет строку в основном блоке .nav-link) */
.nav-link { color: rgba(255,255,255,0.88); }

/* ── 3. Empty state — дополнительные классы для макроса ──────────────── */
/* Базовый .empty-state уже определён выше (строка ~948).
   Добавляем новые классы для макроса _macros/empty_state.html */
.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--text);
}
.empty-state-hint {
  font-size: 13px;
  margin: 0;
  color: var(--text-2);
}

/* ── 4. Цветовые индикаторы — дополнительные классы ─────────────────── */
/* .ind-red/.ind-yellow/.ind-green уже определены как badge (~строка 1622).
   Добавляем только отсутствующие варианты: */
.ind-gray   { color: #94a3b8; }
.ind-bg-red    { background: rgba(239,68,68,0.1);  color: #ef4444; padding: 2px 8px; border-radius: 4px; }
.ind-bg-yellow { background: rgba(245,158,11,0.1); color: #f59e0b; padding: 2px 8px; border-radius: 4px; }
.ind-bg-green  { background: rgba(34,197,94,0.1);  color: #22c55e; padding: 2px 8px; border-radius: 4px; }

/* ── 5. Breadcrumbs компонент ─────────────────────────────────────────── */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.breadcrumbs a { color: var(--text-2); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs .sep { opacity: 0.5; }
.breadcrumbs .current { color: var(--text); font-weight: 500; }

/* ── 6. Рыночные бенчмарки — бейдж дельты ────────────────────────────── */
.market-delta {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 5px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
    cursor: help;
    vertical-align: middle;
}
.market-delta-up      { background: #d4edda; color: #155724; }
.market-delta-down    { background: #f8d7da; color: #721c24; }
.market-delta-neutral { background: #e2e3e5; color: #383d41; }
@media (max-width: 768px) {
    .market-delta { font-size: 9px; padding: 1px 4px; }
}
