@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary:       #6366f1;
  --primary-dark:  #4f46e5;
  --primary-light: #e0e7ff;
  --sidebar-bg:    #1a1d2e;
  --sidebar-hover: #252840;
  --sidebar-text:  #a5a8c8;
  --sidebar-width: 220px;
  --bg:            #f4f5fb;
  --card:          #ffffff;
  --border:        #e5e7ef;
  --text:          #1a1c2e;
  --muted:         #6b7080;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --radius:        10px;
  --shadow:        0 1px 4px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.05);
  font-family: 'Inter', system-ui, sans-serif;
}
body { background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c5c8d8; border-radius: 3px; }

/* ─── App layout ────────────────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* ─── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-logo-icon {
  width: 32px; height: 32px; background: var(--primary);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff; flex-shrink: 0;
}
.sidebar-logo-text { font-size: 14px; font-weight: 600; color: #fff; }
.sidebar-logo-sub  { font-size: 10px; color: var(--sidebar-text); margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.sidebar-section {
  font-size: 10px; font-weight: 600; color: rgba(255,255,255,.3);
  text-transform: uppercase; letter-spacing: .08em;
  padding: 12px 8px 4px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 7px;
  color: var(--sidebar-text); text-decoration: none;
  font-size: 13px; font-weight: 500; margin-bottom: 2px;
  cursor: pointer; transition: background .15s, color .15s;
  border: none; background: none; width: 100%; text-align: left;
}
.sidebar-link:hover  { background: var(--sidebar-hover); color: #d4d6f0; }
.sidebar-link.active { background: rgba(99,102,241,.18); color: #a5a8ff; }
.sidebar-link i { font-size: 14px; width: 16px; text-align: center; flex-shrink: 0; }
.sidebar-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; border-radius: 10px;
  padding: 1px 6px; min-width: 18px; text-align: center;
}

.sidebar-footer { padding: 10px 8px; border-top: 1px solid rgba(255,255,255,.06); }
/* Имя пользователя в подвале сайдбара: разрешаем 2 строки вместо ellipsis */
#meSidebarName {
  white-space: normal !important;
  text-overflow: clip !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.2;
  word-break: break-word;
}
.sidebar-user  { display: flex; align-items: center; gap: 9px; padding: 8px 10px; }
.sidebar-avatar {
  width: 28px; height: 28px; background: var(--primary);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.sidebar-user-name  { font-size: 12.5px; font-weight: 500; color: #fff; }
.sidebar-user-email { font-size: 11px; color: var(--sidebar-text); }
.sidebar-logout {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 7px;
  color: var(--sidebar-text); background: none; border: none;
  font-size: 13px; font-weight: 500; cursor: pointer; width: 100%;
  transition: background .15s, color .15s; margin-top: 2px;
}
.sidebar-logout:hover { background: rgba(239,68,68,.12); color: #f87171; }

/* ─── Main content ──────────────────────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-width); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }
.page-header {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 12px 28px; min-height: 54px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 50;
}
.page-title { font-size: 15px; font-weight: 600; }
.page-body  { padding: 24px 28px; flex: 1; }

/* ─── Cards ─────────────────────────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title  { font-size: 14px; font-weight: 600; }
.card-body   { padding: 20px; }

/* ─── Stat cards ────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px,1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card  { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.stat-platform { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.stat-row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.stat-label { font-size: 11px; color: var(--muted); }
.stat-value { font-size: 13px; font-weight: 600; }
.stat-platform.instagram { color: #e1306c; }
.stat-platform.tiktok    { color: #6b7080; }
.stat-platform.youtube   { color: #ff0000; }
.stat-platform.vk        { color: #0077ff; }

/* ─── Tabs ───────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px; width: fit-content; }
.tab-btn {
  padding: 7px 16px; border-radius: 7px; border: none; background: none;
  font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer;
  transition: all .15s; display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.tab-btn:hover  { color: var(--text); }
.tab-btn.active { background: var(--primary); color: #fff; }

/* ─── Table ─────────────────────────────────────────────────────────────────── */
.table-wrap { overflow: hidden; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); box-shadow: var(--shadow); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { position: relative; z-index: 4; }
thead.is-sticky th { border-bottom-color: #6b7280; background: #eef0f6; }
th {
  background: #f8f9fc; color: var(--muted); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 10px 14px; text-align: left; border-bottom: 2px solid var(--border); white-space: nowrap;
}
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbff; }
th.center, td.center { text-align: center; }
th.num { text-align: right; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.muted { text-align: right; color: var(--text-muted); }
.th-instagram { color: #e1306c; }
.th-tiktok    { color: #555; }
.th-youtube   { color: #ff0000; }
.th-vk        { color: #0077ff; }
.totals-row td, .totals td { font-weight: 700; background: #f4f5f9 !important; border-top: 2px solid var(--border); }
.ww-badge { display: inline-block; font-family: monospace; font-size: 12px; background: #f0f0f8; color: #4F46E5; border-radius: 4px; padding: 1px 6px; }

/* ─── SKU cards (creator view) ───────────────────────────────────────────────── */
.sku-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.sku-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.sku-card-name { font-weight: 700; font-size: 15px; margin-bottom: 16px; color: var(--text); padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.sku-card-field { margin-bottom: 10px; }
.sku-card-field:last-child { margin-bottom: 0; }
.sku-card-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: block; margin-bottom: 5px; }
.sku-card-value { display: flex; align-items: center; gap: 6px; min-height: 26px; }
.sku-copy-btn { border: none; background: none; cursor: pointer; color: var(--muted); padding: 3px 6px; border-radius: 4px; font-size: 13px; flex-shrink: 0; line-height: 1; transition: all .15s; display: inline-flex; align-items: center; }
.sku-copy-btn:hover { background: #ededf8; color: var(--primary); }
.sku-copy-btn.copied { color: var(--success) !important; }
.sku-open-btn { border: none; background: none; cursor: pointer; color: var(--muted); padding: 3px 6px; border-radius: 4px; font-size: 13px; flex-shrink: 0; line-height: 1; text-decoration: none; display: inline-flex; align-items: center; transition: all .15s; }
.sku-open-btn:hover { background: #ededf8; color: var(--primary); }
.sku-link-preview { font-size: 12px; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: none;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all .15s; text-decoration: none; white-space: nowrap; font-family: inherit;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #f0f1f8; }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger    { background: transparent; color: var(--danger); border: 1px solid #fca5a5; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 5px; }

/* ─── Badges ─────────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-pending  { background: #fff7ed; color: #b45309; }
.badge-approved { background: #ecfdf5; color: #059669; }
.badge-admin    { background: var(--primary-light); color: var(--primary-dark); }

/* ─── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
label.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13.5px; font-family: inherit; color: var(--text); background: var(--card);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7080' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.input-num { width: 90px; text-align: center; }
.form-select-sm { padding: 6px 28px 6px 10px; font-size: 13px; }

/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal-content { border-radius: 12px; border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0,0,0,.15); }
.modal-header  { border-bottom: 1px solid var(--border); padding: 14px 20px; }
.modal-footer  { border-top: 1px solid var(--border); padding: 12px 20px; }
.modal-title   { font-size: 14px; font-weight: 600; }
.modal-body    { padding: 20px; }

/* ─── Alert ──────────────────────────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.alert-danger  { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.d-none { display: none !important; }

/* ─── Empty state ────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state i { font-size: 36px; margin-bottom: 10px; opacity: .35; display: block; }
.empty-state p { font-size: 13px; }

/* ─── Login page ─────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a1d2e 0%, #252840 50%, #1e1b4b 100%);
}
.login-card {
  background: #fff; border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0,0,0,.3);
  padding: 40px; width: 100%; max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon {
  width: 52px; height: 52px; background: var(--primary); border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff; margin-bottom: 14px;
}
.login-logo h1 { font-size: 20px; font-weight: 700; color: var(--text); }
.login-logo p  { font-size: 13px; color: var(--muted); margin-top: 3px; }
.btn-google {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px 16px; border: 1.5px solid var(--border); border-radius: 8px;
  background: #fff; font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all .15s; color: var(--text); font-family: inherit;
}
.btn-google:hover { background: #f8f9fc; border-color: #c5c8d8; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.btn-login { width: 100%; padding: 11px; font-size: 14px; font-weight: 600; }

/* Pending screen */
.pending-screen { text-align: center; padding: 8px 0 4px; }
.pending-icon {
  width: 64px; height: 64px; background: #fff7ed; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 30px; color: var(--warning); margin-bottom: 16px;
}
.pending-screen h2 { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.pending-screen p  { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ─── Period selector ────────────────────────────────────────────────────────── */
.period-selector { display: flex; align-items: center; gap: 8px; }

/* ─── Login wrapper ──────────────────────────────────────────────────────────── */
.login-wrapper { width: 100%; max-width: 400px; }

/* ─── Stat icon (in stat cards) ─────────────────────────────────────────────── */
.stat-icon {
  width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff; margin-bottom: 10px;
}
.bg-pink { background: #ec4899 !important; }

/* ─── Tab panels (sidebar nav) ───────────────────────────────────────────────── */
.tab-panel { display: none; flex: 1; flex-direction: column; overflow-y: auto; }
.tab-panel.active { display: flex; }
.tab-content { padding: 20px 28px; flex: 1; }

/* ─── VK icon (not in Bootstrap Icons) ──────────────────────────────────────── */
.bi-vk::before { content: none !important; }
.bi-vk { display: inline-flex; align-items: center; justify-content: center;
  font-style: normal; font-weight: 900; font-size: 0.7em; font-family: 'Inter', sans-serif;
  line-height: 1; width: 1.2em; height: 1em; }
.bi-vk::after { content: 'VK'; }

/* ─── SKU matrix table ───────────────────────────────────────────────────────── */
.sku-matrix-table { border-collapse: collapse; font-size: 12px; width: 100%; table-layout: fixed; }
.sku-matrix-table th { padding: 7px 8px; background: #f8f9fc; color: var(--muted); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-bottom: 2px solid var(--border); text-align: left; overflow: hidden; }
.sku-matrix-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; overflow: hidden; }
.sku-matrix-table tr:last-child td { border-bottom: none; }
.sku-matrix-table tr:hover td { background: #fafbff; }
.sku-creator-col { width: 110px; background: var(--card) !important; position: sticky; left: 0; z-index: 2; }
.sku-product-col { overflow: hidden; }
.sku-product-header { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.sku-del-product { background: none; border: none; cursor: pointer; color: var(--muted); padding: 0 2px; line-height: 1; border-radius: 3px; opacity: 0; transition: opacity .15s; flex-shrink: 0; }
.sku-matrix-table th:hover .sku-del-product { opacity: 1; }
.sku-del-product:hover { color: #dc3545; background: rgba(220,53,69,.08); }
.sku-creator-name { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--card) !important; position: sticky; left: 0; }
.sku-cell { vertical-align: middle; }
.sku-cell-inner { display: flex; flex-direction: column; gap: 2px; }
.sku-art-inp { border: 1px solid transparent; border-radius: 3px; padding: 2px 4px; font-size: 11px; font-family: 'SF Mono','Fira Code',monospace; background: transparent; width: 100%; }
.sku-art-inp:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 2px rgba(99,102,241,.1); }
.sku-art-inp:hover:not(:focus) { border-color: var(--border); background: #f8f9fc; }
.sku-link-inp { border: 1px solid transparent; border-radius: 3px; padding: 2px 4px; font-size: 11px; background: transparent; width: 100%; color: #4F46E5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sku-link-inp:focus { outline: none; border-color: var(--primary); background: #fff; white-space: normal; }
.sku-link-inp:hover:not(:focus) { border-color: var(--border); background: #f8f9fc; }
.sku-legacy { font-size: 10px; color: var(--muted); padding: 1px 4px; font-family: 'SF Mono','Fira Code',monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .75; }
.sku-autolink { display: block; font-size: 10px; color: #6366f1; padding: 1px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .7; text-decoration: none; cursor: pointer; }
.sku-autolink:hover { opacity: 1; text-decoration: underline; }
.sku-autolink:empty { display: none; }
/* Копирование артикула/ссылки по клику + всплывающая подсказка */
.ww-copyable { cursor: pointer; transition: filter .15s, box-shadow .15s; }
.ww-copyable:hover { filter: brightness(.96); box-shadow: 0 0 0 2px rgba(99,102,241,.15); }
.sku-link-copyable { cursor: pointer; transition: color .15s; }
.sku-link-copyable:hover { color: var(--primary); text-decoration: underline; }
.copy-toast { position: fixed; z-index: 9999; background: #1f2937; color: #fff; font-size: 12px; line-height: 1; padding: 6px 10px; border-radius: 6px; white-space: nowrap; pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .18s, transform .18s; box-shadow: 0 4px 12px rgba(0,0,0,.18); }
.copy-toast.show { opacity: 1; transform: translateY(0); }
.copy-toast .bi { color: #4ade80; }

/* ─── Sales table ────────────────────────────────────────────────────────────── */
.sales-table { font-size: 13px; min-width: 1100px; width: 100%; border-collapse: collapse; }
.sales-table th { padding: 10px 12px; white-space: normal; vertical-align: middle; line-height: 1.2; }
.sales-table td { padding: 10px 12px; border-bottom: 1px solid #f0f1f5; }
.sales-row-expandable:hover td { background: #f8f9fc; }
.sales-row-expandable .sales-chevron { transition: transform .15s ease; }
.sales-row-active td { background: #eef0fb !important; }

/* ─── Inline accordion detail row ───────────────────────────────────── */
.sales-detail-row > td {
  padding: 0 !important;
  background: #f8f9fc;
}
.sales-detail-stuck {
  width: calc(100vw - var(--sidebar-width) - 56px);
  max-width: 1080px;
  padding: 12px 18px 14px;
  box-sizing: border-box;
  will-change: transform;
}
.sales-detail-title { font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px; }
.sales-detail-title i { color: var(--primary); font-size: 13px; }

.sales-detail-table { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px;
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.sales-detail-table th { padding: 9px 14px; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .03em; color: var(--muted); border-bottom: 1px solid var(--border);
  white-space: nowrap; line-height: 1.2; background: #fcfcfd; vertical-align: middle; text-align: left; }
.sales-detail-table th.num, .sales-detail-table td.num { text-align: right; }
.sales-detail-table td { padding: 8px 14px; border-bottom: 1px solid #f0f1f5; white-space: nowrap; }
.sales-detail-table tbody tr:last-child td { border-bottom: none; }
.sales-detail-table tr.totals td { font-weight: 600; background: #f8f9fc; border-top: 2px solid var(--border); }
.inp-sales { border: 1px solid transparent; border-radius: 4px; padding: 3px 6px;
  font-size: 13px; background: transparent; width: 100%; min-width: 80px; font-family: inherit; text-align: right; }
.inp-sales:focus { outline: none; border-color: var(--primary); background: #fff; }
.inp-sales:hover:not(:focus) { border-color: var(--border); background: #f8f9fc; }

/* ─── Sales redesign ─────────────────────────────────────────────────────────── */
.sales-creator-block { margin-bottom: 28px; }
.sales-creator-header { font-size: 14px; font-weight: 700; color: var(--text);
  padding: 8px 12px; background: var(--sidebar-bg); border-radius: 8px 8px 0 0;
  border-bottom: 2px solid var(--primary); }
.sales-sku-table { font-size: 12px; width: 100%; min-width: 900px; border-collapse: collapse; }
.sales-sku-table th { padding: 6px 8px; font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted); border-bottom: 1px solid var(--border);
  white-space: nowrap; background: #f8f9fc; }
.sales-sku-table td { padding: 4px 6px; vertical-align: middle; border-bottom: 1px solid #f0f1f5; }
.sales-total-row td { background: #f4f5fb; font-weight: 600; font-size: 12px; border-top: 2px solid var(--border); }
.sales-metrics-row td { background: #eef0fb; padding: 8px 10px; }
.sales-metric { display: inline-flex; gap: 4px; align-items: baseline;
  margin-right: 20px; font-size: 12px; }
.sales-metric-label { color: var(--text-muted); font-size: 11px; }
.sales-metric-val { font-weight: 700; color: var(--text); }
.inp-sku-stat { border: 1px solid transparent; border-radius: 4px; padding: 3px 5px;
  font-size: 11px; background: transparent; width: 100%; font-family: inherit; min-width: 60px; }
.inp-sku-stat:focus { outline: none; border-color: var(--primary); background: #fff; }
.inp-sku-stat:hover:not(:focus) { border-color: var(--border); background: #f8f9fc; }
.inp-sku-stat[type="url"] { min-width: 120px; }

/* ─── SKU pills in summary table ─────────────────────────────────────────────── */
.sku-pills-wrap { display: flex; flex-wrap: wrap; gap: 3px; max-width: 180px; }
.sku-pill { display: inline-block; padding: 1px 7px; font-size: 10px; font-weight: 600;
  border-radius: 10px; background: #eef0fb; color: var(--primary); white-space: nowrap; }

/* ─── Creator SKUs dashboard block ──────────────────────────────────────────── */
.skus-dashboard-block { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); min-width: 300px; max-width: 560px; width: auto; box-sizing: border-box; flex: 1; }
.skus-db-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 12px; }
.skus-db-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.skus-db-item { display: flex; align-items: center; gap: 8px; background: #f8f9fc; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.skus-db-name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; flex-shrink: 0; }
.skus-db-row { display: flex; align-items: center; gap: 4px; margin-left: auto; }

/* ─── Sidebar aliases (extra classes used in HTML) ───────────────────────────── */
.sidebar-bottom { padding: 10px 8px; border-top: 1px solid rgba(255,255,255,.06); display: flex; align-items: center; gap: 4px; }
.sidebar-user-info { flex: 1; min-width: 0; overflow: hidden; }
.sidebar-logo-title { font-size: 14px; font-weight: 600; color: #fff; line-height: 1.2; }
.sidebar-user-avatar { width: 28px; height: 28px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: #fff; flex-shrink: 0; }
.sidebar-user-role { font-size: 11px; color: var(--sidebar-text); }
.page-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ─── Pulse panel (admin summary) ───────────────────────────────────────────── */
.pulse-panel { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; align-items: stretch; }
.pulse-kpi { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px 20px; min-width: 160px; width: fit-content; }
.pulse-kpi-target { font-size: 11px; color: var(--success); margin-top: 6px; font-weight: 500; }
tr.kpi-inactive td { opacity: .75; }

/* ─── KZ info icon + popover ─────────────────────────────────────────────────── */
/* Global tooltip icon — use class "info-badge" everywhere in this project.
   Always place as: <i class="bi bi-info-circle-fill info-badge"></i>        */
.info-badge {
  font-size: 15px; color: var(--primary);
  cursor: default; flex-shrink: 0; user-select: none;
  transition: color .15s; vertical-align: middle;
}
.info-badge:hover { color: var(--primary-dark); }

/* alias for existing kz-info-icon usage */
.kz-info-icon { font-size: 15px; color: var(--primary); cursor: default;
  flex-shrink: 0; user-select: none; transition: color .15s; vertical-align: middle; }
.kz-info-icon:hover { color: var(--primary-dark); }
.kz-popover {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 200;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 14px 16px; min-width: 240px;
}
.kz-popover.visible { display: block; }
.kz-popover-title {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px;
}
.kz-popover-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--text); padding: 4px 0;
}
.kz-popover-row span:first-child { color: var(--muted); }
.kz-popover-row span:last-child  { font-weight: 600; }
.kz-popover-divider { border-top: 1px solid var(--border); margin: 8px 0; }
.kz-popover-total { font-size: 14px; }
.kz-popover-total span:last-child { color: var(--primary); font-size: 15px; }
.pulse-kpi-label { font-size: 10px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.pulse-kpi-value { font-size: 24px; font-weight: 800; color: var(--text); line-height: 1; }
.pulse-costs { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px 20px; flex: 1; min-width: 320px; }
.pulse-costs-header { font-size: 10px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.pulse-costs-row { display: flex; gap: 14px; flex-wrap: wrap; }
.pulse-cost-item { display: flex; flex-direction: column; gap: 4px; }
.pulse-cost-item label { font-size: 11px; color: var(--text-secondary); }
.cost-inp { width: 110px; border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; font-size: 13px; font-family: inherit; }
.cost-inp:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(99,102,241,.1); }
.rate-inp { width: 90px; border: 1px solid var(--border); border-radius: 6px; padding: 4px 7px; font-size: 12px; font-family: inherit; }
.rate-inp:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(99,102,241,.1); }

/* ─── Creator salary block ───────────────────────────────────────────────────── */
.salary-sku-row { display: flex; gap: 16px; align-items: stretch; margin-bottom: 16px; }
.salary-sku-row #salaryBlock, .salary-sku-row #skusBlock { display: flex; }
.salary-block { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 16px 20px; min-width: 440px; max-width: 640px; width: auto; box-sizing: border-box; flex: 1; }
.salary-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.salary-breakdown { display: flex; gap: 24px; flex-wrap: wrap; }
.salary-item { display: flex; flex-direction: column; gap: 3px; }
.salary-item-label { font-size: 10px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.salary-item-value { font-size: 18px; font-weight: 700; color: var(--text); }

/* ─── KPI tooltip ────────────────────────────────────────────────────────────── */
.kpi-help-wrap { position: relative; display: inline-flex; align-items: center; }
.kpi-help-btn { width: 17px; height: 17px; border-radius: 50%; background: var(--primary); color: #fff; border: none; cursor: default; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; line-height: 1; flex-shrink: 0; }
.kpi-tooltip { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: #1e293b; color: #e2e8f0; border-radius: 10px; padding: 10px 12px; min-width: 230px; display: none; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.25); pointer-events: none; text-transform: none; letter-spacing: normal; font-weight: 400; }
.kpi-tooltip::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #1e293b; }
/* Right-anchored вариант — для элементов у правого края, чтобы тултип не выезжал за viewport */
.kpi-tooltip.kpi-tooltip-right { left: auto; right: -4px; transform: none; }
.kpi-tooltip.kpi-tooltip-right::after { left: auto; right: 8px; transform: none; }
.kpi-help-wrap:hover .kpi-tooltip { display: block; }

/* ─── Conversions popover (детализация заказов по артикулам) ───────────── */
.conv-cell { display: inline-block; padding: 4px 8px; margin: -4px -4px; border-radius: 4px; cursor: help; transition: background .12s; }
.conv-cell:hover { background: #f1f5f9; }
/* Singleton-tooltip в body, через position:fixed — не обрезается родительской таблицей */
#convFloatTooltip { position: fixed; background: #fff; color: #0f172a; border: 1px solid #e2e8f0; border-radius: 6px; padding: 6px 8px; min-width: 160px; max-width: 260px; display: none; z-index: 9999; box-shadow: 0 8px 24px rgba(15,23,42,.18); pointer-events: none; text-align: left; font-weight: 400; text-transform: none; letter-spacing: normal; line-height: 1.4; }
#convFloatTooltip.visible { display: block; }
#convFloatTooltip .conv-loading, #convFloatTooltip .conv-empty { font-size: 11px; color: #94a3b8; text-align: center; padding: 4px 0; }
#convFloatTooltip .conv-grid { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; row-gap: 2px; font-size: 11px; }
#convFloatTooltip .conv-h { color: #94a3b8; font-weight: 600; padding-bottom: 3px; border-bottom: 1px solid #f1f5f9; margin-bottom: 2px; }
#convFloatTooltip .conv-h.num, #convFloatTooltip .num { text-align: right; font-variant-numeric: tabular-nums; }
#convFloatTooltip .conv-bad { white-space: nowrap; }
#convFloatTooltip .conv-bad.unknown { color: #94a3b8; font-style: italic; }
#convFloatTooltip .conv-total { padding-top: 4px; margin-top: 2px; border-top: 1px solid #f1f5f9; font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE  (≤ 768px)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Sidebar backdrop */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 190; cursor: pointer;
}

/* Hamburger button (injected into .page-header via JS) */
.hamburger-btn {
  display: none; background: none; border: none;
  padding: 5px 6px; cursor: pointer; color: var(--text);
  align-items: center; justify-content: center;
  border-radius: 7px; flex-shrink: 0; transition: background .15s;
}
.hamburger-btn:hover { background: var(--bg); }
.hamburger-btn i { font-size: 22px; line-height: 1; display: block; }

/* Bottom navigation (creator panel) */
.mobile-bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--card); border-top: 1px solid var(--border);
  box-shadow: 0 -2px 16px rgba(0,0,0,.08); z-index: 150;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.mobile-bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 8px 4px 6px; text-decoration: none; color: var(--muted);
  gap: 3px; transition: color .15s; cursor: pointer;
  border: none; background: none; font-family: inherit;
}
.mobile-bottom-nav a i { font-size: 22px; line-height: 1; }
.mobile-bottom-nav a span { font-size: 10px; font-weight: 500; white-space: nowrap; }
.mobile-bottom-nav a.active { color: var(--primary); }

@media (max-width: 768px) {
  /* ── Sidebar: slide-in drawer ── */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4, 0, .2, 1);
    z-index: 200;
  }
  body.mob-open .sidebar         { transform: translateX(0); }
  body.mob-open .sidebar-backdrop { display: block; }

  /* ── Content full-width ── */
  .main-content { margin-left: 0; }

  /* ── Page header compact ── */
  .page-header {
    padding: 8px 12px;
    gap: 8px;
    min-height: 46px;
    flex-wrap: wrap;
  }
  .hamburger-btn { display: flex; }
  .hamburger-btn + div { flex: 1; min-width: 0; }
  .page-sub  { display: none; }
  .page-title { font-size: 14px; }

  /* ── Tab content padding ── */
  .tab-content { padding: 12px 12px; }

  /* ── Stats grid 2-col ── */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px; margin-bottom: 12px;
  }
  .stat-card { padding: 11px 12px; }

  /* ── Salary + SKU stacks vertically ── */
  .salary-sku-row { flex-direction: column; gap: 10px; }
  .salary-block { min-width: 0; max-width: 100%; }
  .skus-dashboard-block { min-width: 0; max-width: 100%; }
  .salary-breakdown { gap: 16px; }

  /* ── Pulse KPI panel ── */
  .pulse-panel { gap: 8px; }
  .pulse-kpi { min-width: 120px; flex: 1; padding: 10px 12px; }
  .pulse-kpi-value { font-size: 20px; }

  /* ── Touch table scroll ── */
  .table-scroll { -webkit-overflow-scrolling: touch; }

  /* ── Table-wrap: allow horizontal scroll ── */
  .table-wrap { overflow-x: auto; }

  /* Min-widths force horizontal scroll on wide tables */
  #tabSummary .table-wrap table,
  #tabSales   .table-wrap table            { min-width: 600px; }
  #tabSocial  .table-wrap table            { min-width: 500px; }
  #tabSkus    .table-wrap table            { min-width: 550px; }
  #tabCreators .table-wrap table           { min-width: 430px; }
  #tabPending  .table-wrap table           { min-width: 500px; }
  #creatorTablesContent .table-wrap table  { min-width: 650px; }

  /* Clip overflowing text in fixed-layout table headers */
  #creatorTablesContent thead th {
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  }

  /* ── Page header controls: full-width, scrollable ── */
  .page-header .d-flex.gap-2 {
    width: 100%; overflow-x: auto; padding-bottom: 2px; flex-shrink: 0;
  }
  /* Cap select widths so they don't overflow on small screens */
  .page-header select { max-width: 110px; }

  /* ── KZ popover: fit on screen ── */
  .kz-popover { min-width: 200px; max-width: calc(100vw - 24px); }

  /* ── Bottom nav ── */
  .mobile-bottom-nav { display: flex; }
  body.has-bottom-nav { padding-bottom: 64px; }
  /* У креатора нижняя нав-панель заменена плашкой аффирмации — скрываем сразу,
     до отработки JS, чтобы не было FOUC при рефреше. data-role выставляет
     inline-guard в head каждой страницы из sessionStorage.userRole. */
  html[data-role="creator"] .mobile-bottom-nav { display: none !important; }
  html[data-role="creator"] body.has-bottom-nav { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }

  /* ── Sales detail (гармошка по артикулам) ── */
  /* На десктопе блок прижат к viewport через JS translateX и width = 100vw - sidebar - 56.
     На мобильном sidebar — drawer (margin-left:0), а основная таблица скроллится горизонтально,
     поэтому JS-fixup не нужен. Прижимаем блок к левому краю viewport через position:sticky
     и ограничиваем шириной viewport — внутри даём горизонтальный скролл самой детализации. */
  .sales-detail-row > td { padding: 0 !important; }
  .sales-detail-stuck {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    padding: 10px 12px 12px !important;
    transform: none !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: sticky;
    left: 0;
  }
  .sales-detail-table { min-width: 540px; }
  .sales-detail-table th,
  .sales-detail-table td { padding: 8px 10px; font-size: 12px; }
  .sales-detail-title { padding-left: 2px; white-space: nowrap; }

  /* ── SKU grid ── */
  .skus-db-grid { grid-template-columns: 1fr; }

  /* ── Modal ── */
  .modal-dialog { margin: 8px; max-width: calc(100vw - 16px); }

  /* ── Login ── */
  .login-card { padding: 28px 20px; margin: 16px; max-width: calc(100vw - 32px); }

  /* ─────────────────────────────────────────────────────
     Bloggers page (bloggers.html) mobile
     ───────────────────────────────────────────────────── */

  /* Header controls: wrap to new line, scroll horizontally */
  .page-header > div:last-child {
    width: 100%; overflow-x: auto; padding-bottom: 2px;
    flex-shrink: 0;
  }

  /* Buttons: icon-only — hide text labels */
  .page-header .btn-text { display: none; }
  .page-header .btn .bi,
  .page-header label.btn .bi { margin-right: 0 !important; }

  /* Scout filter select: compact */
  #scoutFilterSelect { max-width: 90px; font-size: 12px !important; padding: 4px 6px !important; }

  /* Table: horizontal scroll */
  .bloggers-table-scroll { -webkit-overflow-scrolling: touch; }
  .bloggers-table { min-width: 680px; }

  /* Blogger history popup: fit on screen */
  #bloggerHistoryPopup {
    min-width: min(340px, calc(100vw - 16px));
    max-width: calc(100vw - 16px);
  }
}
