:root {
  --bg-main: #0f1117;
  --bg-sidebar: #101219;
  --bg-panel: rgba(255, 255, 255, 0.07);
  --bg-panel-soft: rgba(255, 255, 255, 0.055);
  --bg-input: rgba(15, 17, 23, 0.82);

  --text-main: #ffffff;
  --text-muted: #b7bdc9;
  --text-soft: #d7dce7;

  --accent: #2eea7a;
  --accent-2: #4da3ff;
  --accent-3: #00a846;

  --danger: #ff4d4d;
  --warning: #f5b84b;
  --success: #2eea7a;

  --border: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(46, 234, 122, 0.38);

  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(900px 500px at 90% 0%, rgba(46, 234, 122, 0.12), transparent 60%),
    radial-gradient(800px 500px at 0% 100%, rgba(77, 163, 255, 0.13), transparent 55%),
    linear-gradient(160deg, #0f1117, #171a24 60%, #101219);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}
body.demo-mode [data-admin-only="true"],
body.client-mode [data-admin-only="true"],
[hidden] {
  display: none !important;
}
.muted {
  color: var(--text-muted);
}

.tiny {
  font-size: 12px;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 20px;
  background:
    linear-gradient(180deg, rgba(16, 18, 25, 0.96), rgba(10, 12, 18, 0.98)),
    var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.logo-block {
  display: flex;
  align-items: center;
  gap: 13px;
}

.logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #06120b;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  box-shadow: 0 0 34px rgba(46, 234, 122, 0.22);
}

.logo-text {
  font-weight: 900;
  letter-spacing: 0.11em;
}

.logo-subtitle {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

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

.nav-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 12px 14px;
  text-align: left;
  color: var(--text-soft);
  background: transparent;
  transition: 0.18s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.055);
  border-color: var(--border);
}

.nav-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(46, 234, 122, 0.16), rgba(77, 163, 255, 0.12));
  border-color: rgba(46, 234, 122, 0.36);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.user-panel {
  min-width: 250px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.user-email,
.user-role {
  text-align: right;
}

.user-email {
  font-weight: 700;
}

.auth-wrap {
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
}

.auth-card,
.card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.065));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(520px, 100%);
  padding: 30px;
}

.card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  margin-bottom: 18px;
}

.card::before {
  content: "";
  position: absolute;
  inset: -90px -90px auto auto;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: rgba(46, 234, 122, 0.08);
  pointer-events: none;
}

.card > * {
  position: relative;
}

.auth-badge {
  display: inline-flex;
  padding: 7px 11px;
  border-radius: 999px;
  color: #d9ffe8;
  background: rgba(46, 234, 122, 0.08);
  border: 1px solid rgba(46, 234, 122, 0.35);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.auth-card h2,
.card h2 {
  margin: 0 0 10px;
  font-size: 21px;
  letter-spacing: -0.02em;
}

label {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 7px;
}

.field-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.product-collection-modal__card {
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  overflow-x: hidden;
}

.product-collection-modal__card .field-block,
.product-collection-modal__card .seller-picker,
.product-collection-modal__card .seller-picker-item,
.product-collection-modal__card .seller-picker-title {
  min-width: 0;
}

.product-collection-modal__card .seller-picker {
  overflow-y: auto;
  overflow-x: hidden;
}

.product-collection-modal__card .seller-picker-title {
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .collection-settings-layout {
    grid-template-columns: 1fr;
  }
}

input,
textarea,
select {
  width: 100%;
  color: var(--text-main);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 13px;
  outline: none;
  transition: 0.16s ease;
}

textarea {
  min-height: 135px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(46, 234, 122, 0.10);
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.actions.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.actions.compact {
  margin-top: 0;
  gap: 8px;
}

.btn {
  border: 1px solid rgba(46, 234, 122, 0.45);
  border-radius: 13px;
  padding: 11px 15px;
  color: #06120b;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  font-weight: 850;
  box-shadow: 0 14px 34px rgba(46, 234, 122, 0.14);
  transition: 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(77, 163, 255, 0.96), rgba(46, 234, 122, 0.72));
  border-color: rgba(77, 163, 255, 0.35);
}

.btn-ghost {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.10);
}

.row-action {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card,
.info-box,
.analytics-card,
.picker-block,
.product-picker-item,
.seller-picker,
.product-tree-picker {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.052));
  border: 1px solid var(--border);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.20);
}

.kpi-card {
  border-radius: var(--radius-lg);
  padding: 18px;
  background:
    radial-gradient(circle at top right, rgba(46, 234, 122, 0.12), transparent 42%),
    rgba(255, 255, 255, 0.06);
}

.kpi-label {
  color: var(--text-muted);
  font-size: 13px;
}

.kpi-value {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.04em;
  margin-top: 8px;
}

.kpi-value.small {
  font-size: 15px;
  letter-spacing: 0;
  line-height: 1.35;
}

.filters {
  display: grid;
  gap: 14px;
}

.products-search-filters {
  grid-template-columns: minmax(260px, 420px);
  margin-bottom: 14px;
}

.upload-platform-row {
  grid-template-columns: minmax(220px, 320px) minmax(260px, 420px);
}

.table-wrap {
  width: 100%;
  overflow: auto;
  max-height: 620px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(15, 17, 23, 0.52);
}

.table-wrap.large {
  max-height: 680px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 1080px;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(15, 17, 23, 0.96);
  color: var(--text-muted);
  font-weight: 750;
}

.product-sort-btn {
  width: 100%;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
}

.product-sort-btn:hover,
.product-sort-btn.active {
  color: var(--text-main);
}

td {
  color: var(--text-soft);
}

tr:hover td {
  background: rgba(46, 234, 122, 0.035);
}

.product-title {
  font-weight: 800;
  color: #ffffff;
}

.product-url,
.product-picker-meta {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 3px;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.message {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  white-space: pre-wrap;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text-soft);
}

.message.ok {
  border-color: rgba(46, 234, 122, 0.38);
  background: rgba(46, 234, 122, 0.08);
}

.message.warn {
  border-color: rgba(245, 184, 75, 0.38);
  background: rgba(245, 184, 75, 0.08);
}

.message.err {
  border-color: rgba(255, 77, 77, 0.38);
  background: rgba(255, 77, 77, 0.08);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text-soft);
}

.badge.good {
  color: var(--success);
  border-color: rgba(46, 234, 122, 0.35);
  background: rgba(46, 234, 122, 0.08);
}

.badge.bad {
  color: var(--danger);
  border-color: rgba(255, 77, 77, 0.35);
  background: rgba(255, 77, 77, 0.08);
}
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-actions .btn {
  min-height: 34px;
  padding: 8px 10px;
  font-size: 12px;
}
.demo-mode-badge {
  color: var(--accent);
  border-color: rgba(46, 234, 122, 0.35);
  background: rgba(46, 234, 122, 0.08);
}
.page-section {
  display: none;
}

.page-section.active-section {
  display: block;
}

/* compact filters */
.filters-compact {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.filters-compact__period {
  max-width: 360px;
}

.filters-compact__grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr);
  gap: 16px;
  align-items: start;
}

.filters-compact__col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.filters-compact__stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.filters-compact__stack .field-block {
  margin: 0;
}

.filters-compact__city-search {
  margin-top: 2px;
}

.filters-compact .field-block .seller-picker {
  height: 260px;
  min-height: 260px;
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
}

.filters-compact__period label,
.filters-compact__col label {
  margin-bottom: 6px;
}

.filters-compact__search,
.filters-compact__bottom-select,
.date-range-input {
  min-height: 42px;
}

.filters-compact__middle {
  min-width: 0;
}

.filters-compact__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.filters-compact__actions .btn {
  min-height: 42px;
}

.picker-block {
  margin: 0;
  padding: 12px;
  border-radius: var(--radius-lg);
}

.picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.actions.compact .btn {
  padding: 7px 9px;
  font-size: 12px;
  border-radius: 10px;
}

.product-picker,
.seller-picker {
  height: 260px;
  min-height: 260px;
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(15, 17, 23, 0.76);
}

.product-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-picker-item,
.seller-picker-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  user-select: none;
}

.product-picker-item:hover,
.seller-picker-item:hover {
  background: rgba(46, 234, 122, 0.055);
  border-color: rgba(46, 234, 122, 0.22);
}

.seller-picker-item input,
.product-picker-item input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.product-picker-title,
.seller-picker-title {
  color: var(--text-main);
  line-height: 1.25;
}

.collection-city-item-meta,
.city-filter-meta {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
}

/* product tree */
.product-tree-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-tree-node {
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  overflow: hidden;
}

.product-tree-node[data-level="group"] > .product-tree-row {
  background: rgba(46, 234, 122, 0.045);
}

.product-tree-node[data-level="category"] > .product-tree-row {
  background: rgba(77, 163, 255, 0.045);
}

.product-tree-node[data-level="type"] > .product-tree-row {
  background: rgba(255, 255, 255, 0.03);
}

.product-tree-row {
  display: grid;
  grid-template-columns: 24px 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 11px;
  color: var(--text-main);
}

.product-tree-row:hover {
  background: rgba(46, 234, 122, 0.055);
}

.product-tree-toggle {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.065);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.product-tree-toggle:hover {
  background: rgba(46, 234, 122, 0.12);
  color: #fff;
}

.product-tree-node.is-collapsed > .product-tree-row .product-tree-toggle {
  transform: rotate(-90deg);
}

.product-tree-checkbox,
.product-tree-product-checkbox {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
}

.product-tree-label {
  min-width: 0;
  font-weight: 850;
  font-size: 13px;
  line-height: 1.25;
  color: #fff;
  overflow-wrap: anywhere;
}

.product-tree-label small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.product-tree-count {
  min-width: 26px;
  padding: 3px 7px;
  border-radius: 999px;
  text-align: center;
  font-size: 11px;
  font-weight: 850;
  color: #d9ffe8;
  background: rgba(46, 234, 122, 0.09);
  border: 1px solid rgba(46, 234, 122, 0.22);
}

.product-tree-children {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 9px 10px 30px;
  border-left: 1px dashed rgba(255, 255, 255, 0.12);
  margin-left: 19px;
}

.product-tree-node.is-collapsed > .product-tree-children {
  display: none;
}

.product-tree-product,
.product-tree-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.product-tree-product:hover,
.product-tree-item:hover {
  background: rgba(46, 234, 122, 0.06);
  border-color: rgba(46, 234, 122, 0.22);
}

.product-tree-product-title,
.product-tree-title {
  display: block;
  color: #fff;
  font-size: 12.8px;
  font-weight: 750;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.product-tree-product-meta,
.product-tree-meta {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.product-tree-empty,
.city-filter-empty {
  padding: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.product-tree-search-note {
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(77, 163, 255, 0.07);
  border: 1px solid rgba(77, 163, 255, 0.18);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.product-search-results {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.product-search-result-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 10px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.product-search-result-item:hover {
  background: rgba(46, 234, 122, 0.065);
  border-color: rgba(46, 234, 122, 0.24);
}

.product-search-result-title {
  display: block;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.product-search-result-meta {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.product-search-result-badge {
  display: inline-flex;
  margin-top: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #d9ffe8;
  background: rgba(46, 234, 122, 0.08);
  border: 1px solid rgba(46, 234, 122, 0.22);
  font-size: 11px;
  font-weight: 750;
}

/* analytics */
.analytics-grid {
  display: grid;
  gap: 14px;
}

.analytics-card {
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.035);
}

.analytics-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.analytics-number {
  font-size: 26px;
  font-weight: 900;
  margin: 6px 0;
}

.analytics-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.analytics-section {
  min-width: 0;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(circle at top right, rgba(46, 234, 122, 0.07), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.045));
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
}

.analytics-section.wide {
  grid-column: 1 / -1;
}

.analytics-section-head {
  margin-bottom: 12px;
}

.analytics-section-head h3 {
  margin: 0 0 5px;
  font-size: 18px;
  font-weight: 950;
  line-height: 1.2;
  color: var(--text-main);
}

.analytics-section-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.35;
}

.analytics-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.analytics-section.wide .analytics-mini-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.analytics-mini-card {
  min-height: 122px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.105);
  background:
    radial-gradient(circle at top right, rgba(46, 234, 122, 0.075), transparent 40%),
    rgba(13, 17, 31, 0.58);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.analytics-mini-card.good {
  border-color: rgba(46, 234, 122, 0.28);
}

.analytics-mini-card.warn {
  border-color: rgba(245, 184, 75, 0.34);
}

.analytics-mini-card.bad {
  border-color: rgba(255, 77, 77, 0.34);
}

.analytics-mini-title {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.22;
}

.analytics-mini-number {
  color: var(--text-main);
  font-size: 26px;
  font-weight: 950;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.analytics-mini-text {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.analytics-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.analytics-chart-card {
  min-height: 210px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.105);
  background: rgba(13, 17, 31, 0.58);
}

.analytics-chart-title {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 850;
}

.analytics-chart-card canvas {
  width: 100% !important;
  height: 165px !important;
}

.coverage-table-wrap {
  margin-top: 14px;
  overflow: auto;
  max-height: 420px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(13, 17, 31, 0.58);
}

.coverage-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: 12.5px;
}

.coverage-table th,
.coverage-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
}

.coverage-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(15, 17, 23, 0.98);
  color: var(--text-muted);
  font-weight: 850;
}

.coverage-seller-name {
  font-weight: 850;
  color: var(--text-main);
  white-space: nowrap;
}

.coverage-table tr.has-products td {
  background: rgba(46, 234, 122, 0.025);
}

.coverage-table tr.no-products td {
  background: rgba(255, 255, 255, 0.012);
}

.coverage-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
}

.coverage-badge.exists {
  color: #d9ffe8;
  background: rgba(46, 234, 122, 0.11);
  border: 1px solid rgba(46, 234, 122, 0.28);
}

.coverage-badge.missing {
  color: #ffd4d4;
  background: rgba(255, 77, 77, 0.09);
  border: 1px solid rgba(255, 77, 77, 0.25);
}

.coverage-cell-meta {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11.5px;
}

/* modal */
.product-collection-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(6px);
}

.collection-disabled {
  opacity: 0.55;
}

.product-collection-seller-empty {
  padding: 10px;
}

/* date picker */
.date-range-input {
  cursor: pointer;
  min-width: 260px;
}

.litepicker {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(46, 234, 122, 0.26);
  box-shadow: var(--shadow);
}

.litepicker .container__main,
.litepicker .container__months,
.litepicker .container__footer {
  background: #070b1d;
  color: #f7f8ff;
}

.litepicker .container__months .month-item-header {
  color: #f7f8ff;
  font-weight: 800;
}

.litepicker .container__months .month-item-weekdays-row > div {
  color: #9aa3bc;
}

.litepicker .container__days .day-item {
  color: #d7def5;
  border-radius: 8px;
}

.litepicker .container__days .day-item:hover {
  box-shadow: inset 0 0 0 1px rgba(46, 234, 122, 0.55);
  color: #ffffff;
}

.litepicker .container__days .day-item.is-start-date,
.litepicker .container__days .day-item.is-end-date {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06120b;
}

.litepicker .container__days .day-item.is-in-range {
  background: rgba(46, 234, 122, 0.18);
  color: #ffffff;
}

.litepicker .container__days .day-item.is-today {
  color: var(--accent);
  font-weight: 900;
}

.litepicker .container__footer .button-apply {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #06120b;
  border: 0;
  border-radius: 10px;
  font-weight: 800;
}

.litepicker .container__footer .button-cancel {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: #f7f8ff;
  border-radius: 10px;
}

/* scrollbars */
.table-wrap::-webkit-scrollbar,
.product-picker::-webkit-scrollbar,
.seller-picker::-webkit-scrollbar,
.product-collection-modal__card::-webkit-scrollbar,
.coverage-table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.table-wrap::-webkit-scrollbar-track,
.product-picker::-webkit-scrollbar-track,
.seller-picker::-webkit-scrollbar-track,
.product-collection-modal__card::-webkit-scrollbar-track,
.coverage-table-wrap::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.045);
}

.table-wrap::-webkit-scrollbar-thumb,
.product-picker::-webkit-scrollbar-thumb,
.seller-picker::-webkit-scrollbar-thumb,
.product-collection-modal__card::-webkit-scrollbar-thumb,
.coverage-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(46, 234, 122, 0.45);
  border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-thumb:hover,
.product-picker::-webkit-scrollbar-thumb:hover,
.seller-picker::-webkit-scrollbar-thumb:hover,
.product-collection-modal__card::-webkit-scrollbar-thumb:hover,
.coverage-table-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(46, 234, 122, 0.65);
}

@media (max-width: 1280px) {
  .analytics-sections {
    grid-template-columns: 1fr;
  }

  .analytics-section.wide .analytics-mini-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .user-panel {
    min-width: unset;
  }

  .filters-compact__period {
    max-width: none;
  }

  .picker-head {
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 16px;
  }

  .topbar,
  .section-head {
    flex-direction: column;
  }

  .nav {
    grid-template-columns: 1fr;
  }

  .kpi-grid,
  .form-grid,
  .actions.two,
  .analytics-mini-grid,
  .analytics-section.wide .analytics-mini-grid {
    grid-template-columns: 1fr;
  }

  .upload-platform-row,
  .products-search-filters {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .user-panel {
    width: 100%;
    justify-content: space-between;
  }

  .product-collection-modal {
    padding: 12px;
  }

  .product-tree-row {
    grid-template-columns: 22px 18px minmax(0, 1fr) auto;
    padding: 8px;
  }

  .product-tree-children {
    padding-left: 18px;
    margin-left: 14px;
  }
}

/* Уже и аккуратнее колонка товара */
#overviewSection table th:nth-child(3),
#overviewSection table td:nth-child(3),
#dailySection table th:nth-child(2),
#dailySection table td:nth-child(2),
#reportSection table th:nth-child(1),
#reportSection table td:nth-child(1) {
  min-width: 220px;
  max-width: 220px;
  white-space: normal;
}

/* Денежные и числовые колонки - не переносим */
#overviewSection table th:nth-child(8),
#overviewSection table td:nth-child(8),
#overviewSection table th:nth-child(11),
#overviewSection table td:nth-child(11),

#dailySection table th:nth-child(10),
#dailySection table td:nth-child(10),
#dailySection table th:nth-child(11),
#dailySection table td:nth-child(11),
#dailySection table th:nth-child(12),
#dailySection table td:nth-child(12),

#reportSection table th:nth-child(9),
#reportSection table td:nth-child(9),
#reportSection table th:nth-child(10),
#reportSection table td:nth-child(10),
#reportSection table th:nth-child(11),
#reportSection table td:nth-child(11),
#reportSection table th:nth-child(14),
#reportSection table td:nth-child(14),
#reportSection table th:nth-child(15),
#reportSection table td:nth-child(15),
#reportSection table th:nth-child(16),
#reportSection table td:nth-child(16) {
  white-space: nowrap;
  min-width: 105px;
}

.product-tree-picker {
  min-height: 0;
}

.collection-settings-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1.2fr) minmax(360px, 0.95fr);
  gap: 24px;
  align-items: start;
}

.collection-settings-layout__left {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.collection-settings-layout__right {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.collection-settings-layout__toggles {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.collection-settings-layout__toggles .seller-picker-item {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
}

.collection-settings-layout__actions {
  margin-top: 2px;
}

.collection-settings-layout__actions .btn {
  min-width: 280px;
}

.collection-settings-layout__left .filters-compact__search {
  width: 100%;
  min-height: 44px;
}

#collectionDefaultCitiesSearch,
#productCollectionCitiesSearch {
  width: 100%;
}
#collectionDefaultCitiesSearch + .search-clear-btn,
#productCollectionCitiesSearch + .search-clear-btn {
  margin-left: 0;
}


.collection-settings-layout__left .seller-picker {
  width: 100%;
  height: 220px;
  min-height: 220px;
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
}

@media (max-width: 980px) {
  .collection-settings-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .collection-settings-layout__actions .btn {
    width: 100%;
    min-width: 0;
  }
}


/* ============================================================
   Fix: product tree scrolling in all product pickers
   Applies to: Overview, Dynamics, Report, Analytics
   ============================================================ */

#overviewProductFilter,
#dailyProductFilter,
#reportProductPicker,
#analyticsProductPicker {
  height: 260px;
  min-height: 260px;
  max-height: 260px;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
}

#overviewProductFilter.product-tree-picker,
#dailyProductFilter.product-tree-picker,
#reportProductPicker.product-tree-picker,
#analyticsProductPicker.product-tree-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 260px;
  max-height: 260px;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

#overviewProductFilter .product-tree-node,
#dailyProductFilter .product-tree-node,
#reportProductPicker .product-tree-node,
#analyticsProductPicker .product-tree-node {
  flex: 0 0 auto;
}

#overviewProductFilter .product-tree-children,
#dailyProductFilter .product-tree-children,
#reportProductPicker .product-tree-children,
#analyticsProductPicker .product-tree-children {
  flex: 0 0 auto;
  overflow: visible;
}

/* ============================================================
   Выравнивание таблиц: начиная с "Город / города" вправо
   ============================================================ */

/* Обзор:
   1 Выбор
   2 Дата
   3 Товар
   4 Продавец
   5 Город / города и дальше - вправо */
#overviewSection table th:nth-child(n+6),
#overviewSection table td:nth-child(n+6) {
  text-align: right;
}

/* Динамика:
   1 Дата
   2 Товар
   3 Продавец
   4 Город / города и дальше - вправо */
#dailySection table th:nth-child(n+5),
#dailySection table td:nth-child(n+5) {
  text-align: right;
}

/* Отчет:
   1 Товар
   2 Kaspi ID
   3 Продавец
   4 Город / города и дальше - вправо */
#reportSection table th:nth-child(n+5),
#reportSection table td:nth-child(n+5) {
  text-align: right;
}

/* ============================================================
   Метрика 7: Покрытие выбранных товаров продавцами
   Все колонки кроме первой - вправо
   ============================================================ */

.coverage-table th:not(:first-child),
.coverage-table td:not(:first-child) {
  text-align: right;
}

.coverage-table th:first-child,
.coverage-table td:first-child {
  text-align: left;
}

.search-clear-btn {
  margin-left: -34px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #6b7280;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}

.search-clear-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.search-clear-btn.hidden {
  display: none;
}
.search-clear-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.search-clear-wrap input {
  padding-right: 44px;
}
.search-clear-wrap .search-clear-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  margin-left: 0;
}
