:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #dfe4ea;
  --line-strong: #cbd5e1;
  --text: #252a31;
  --muted: #687282;
  --muted-2: #8b95a3;
  --green: #64c800;
  --green-dark: #4da200;
  --blue: #1f7ae0;
  --blue-soft: #e8f2ff;
  --amber: #f59e0b;
  --amber-soft: #fff7e7;
  --red: #d93025;
  --red-soft: #fff0ef;
  --purple: #7c3aed;
  --shadow: 0 8px 24px rgba(30, 41, 59, 0.08);
  --radius: 8px;
}

/* Reviews, questions and buyer chats MVP. */
.communications-toolbar {
  margin-bottom: 10px;
}

.communications-toolbar-actions,
.communications-marketplace-switch {
  display: flex;
  align-items: center;
}

.communications-toolbar-actions {
  gap: 10px;
}

.communications-marketplace-switch {
  gap: 4px;
  padding: 4px;
  color: #dce7f5;
  background: #172234;
  border-radius: 8px;
}

.communications-marketplace-switch > span {
  padding: 0 8px 0 6px;
  color: #aebed2;
  font-size: 12px;
  font-weight: 700;
}

.communications-marketplace-switch button {
  min-height: 34px;
  padding: 7px 12px;
  color: #c7d4e4;
  background: transparent;
  border-radius: 6px;
  font-weight: 800;
}

.communications-marketplace-switch button.active {
  color: #172234;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.24);
}

.communications-marketplace-switch button:disabled:not(.active) {
  opacity: 0.48;
}

.communications-training-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 11px 14px;
  color: #275a17;
  background: #f2fae9;
  border: 1px solid #cce8b4;
  border-radius: var(--radius);
}

.communications-training-banner strong,
.communications-training-banner span,
.communications-training-card strong,
.communications-training-card span {
  display: block;
}

.communications-training-banner span,
.communications-training-card span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.communications-training-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin: 0 !important;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(100, 200, 0, 0.14);
}

.nav-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  color: #ffffff;
  background: var(--green-dark);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
}

.communications-tabs,
.communications-filters {
  display: flex;
  align-items: center;
  gap: 6px;
}

.communications-tabs {
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.communications-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  border-bottom: 2px solid transparent;
}

.communications-tabs button.active {
  color: var(--text);
  border-color: var(--green);
  font-weight: 700;
}

.communications-tabs button span,
.communications-filter span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  color: #4d5968;
  background: #edf1f5;
  border-radius: 10px;
  font-size: 12px;
}

.communications-message,
.communications-source-warning {
  margin-bottom: 12px;
}

.communications-filters {
  margin-bottom: 10px;
  overflow-x: auto;
}

.communications-scope {
  display: flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 10px;
  padding: 3px;
  background: #edf1f5;
  border-radius: 10px;
}

.communications-scope button {
  min-height: 32px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
  white-space: nowrap;
}

.communications-scope button.active {
  color: var(--text);
  background: #fff;
  box-shadow: 0 1px 3px rgba(25, 38, 55, 0.12);
  font-weight: 750;
}

.communications-scope > span {
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.communications-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 11px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  white-space: nowrap;
}

.communications-filter.active {
  color: #235b08;
  background: #f2fae9;
  border-color: #a9d681;
  font-weight: 700;
}

.communications-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(460px, 1.28fr);
  gap: 12px;
  align-items: start;
}

.communications-list,
.communications-detail,
.communications-settings-card {
  overflow: hidden;
}

.communications-list-head,
.communications-detail-head,
.communications-draft-head,
.communications-send-row,
.communications-settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.communications-list-head {
  min-height: 52px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.communications-list-head > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.communications-list-head > div span {
  color: var(--muted);
  font-size: 13px;
}

.communications-rows {
  max-height: min(650px, calc(100vh - 300px));
  overflow-y: auto;
}

.communications-row {
  display: grid;
  width: 100%;
  gap: 6px;
  padding: 13px 14px;
  color: var(--text);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.communications-row:hover,
.communications-row.active {
  background: #f7fbf3;
}

.communications-row.active {
  box-shadow: inset 3px 0 0 var(--green);
}

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

.communications-row-top small,
.communications-row > small,
.communications-preview,
.communications-detail-head p,
.communications-draft-head p,
.communications-send-row > span {
  color: var(--muted);
  font-size: 12px;
}

.communications-preview {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.4;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.communications-kind {
  display: inline-flex;
  width: fit-content;
  min-height: 22px;
  align-items: center;
  padding: 0 8px;
  color: #425066;
  background: #edf1f5;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 750;
}

.communications-kind.kind-review { color: #6b4c00; background: #fff3cf; }
.communications-kind.kind-question { color: #145e9d; background: #e7f3ff; }
.communications-kind.kind-chat { color: #376818; background: #eaf8dd; }

.communications-stars,
.communications-rating span {
  color: #e8a100;
  letter-spacing: 1px;
}

.communications-detail {
  min-height: 440px;
}

.communications-detail-head,
.communications-context,
.communications-draft-head,
.communications-send-row {
  padding: 14px 16px;
}

.communications-detail-head,
.communications-context,
.communications-draft-head {
  border-bottom: 1px solid var(--line);
}

.communications-detail-head {
  align-items: flex-start;
}

.communications-detail-head h2,
.communications-draft-head h3 {
  margin: 7px 0 3px;
}

.communications-detail-head h2 { font-size: 18px; }
.communications-draft-head h3 { font-size: 15px; }
.communications-detail-head p,
.communications-draft-head p { margin: 0; }

.communications-rating {
  display: grid;
  gap: 3px;
  justify-items: end;
}

.communications-rating strong {
  font-size: 22px;
}

.communications-context {
  background: var(--surface-soft);
}

.communications-context p {
  margin: 0 0 8px;
  white-space: pre-wrap;
  line-height: 1.5;
}

.communications-context small {
  color: var(--muted);
}

.communications-conversation {
  display: grid;
  gap: 7px;
  max-height: 420px;
  overflow-y: auto;
  padding: 2px;
}

.communications-conversation > div {
  width: min(88%, 620px);
  padding: 9px 11px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px 8px 8px 2px;
}

.communications-conversation > div.seller {
  justify-self: end;
  background: #eef7e6;
  border-radius: 8px 8px 2px 8px;
}

.communications-conversation > div > strong {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}

.communications-conversation p {
  margin-bottom: 3px;
}

.communications-history-status,
.communications-history-more {
  margin: 0 auto 9px;
}

.communications-history-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.communications-message-media {
  display: flex;
  gap: 6px;
  margin: 6px 0;
  overflow-x: auto;
}

.communications-message-media img {
  display: block;
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
}

.communications-load-more {
  display: block;
  width: calc(100% - 24px);
  min-height: 38px;
  margin: 10px 12px;
  color: #376818;
  background: #f2fae9;
  border: 1px solid #b9dc9b;
  border-radius: 8px;
  font-weight: 750;
}

.communications-media {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
}

.communications-media img {
  display: block;
  width: 92px;
  height: 92px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.communications-reply {
  display: block;
  min-height: 150px;
  width: calc(100% - 32px);
  margin: 14px 16px 0;
  line-height: 1.5;
}

.communications-send-row {
  align-items: center;
}

.communications-empty,
.communications-loading {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 250px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.communications-empty p {
  max-width: 360px;
  margin: 0;
  line-height: 1.45;
}

.communications-empty-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #376818;
  background: #eaf8dd;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 800;
}

.communications-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 12px;
}

.communications-knowledge-card {
  grid-column: 1 / -1;
}

.communications-knowledge-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.communications-knowledge-actions > span {
  color: var(--muted);
  font-size: 12px;
}

.communications-answer-source {
  margin: 12px 16px 0;
  padding: 10px 12px;
  color: #3d4b5e;
  background: #f2f7ec;
  border: 1px solid #cfe3bc;
  border-radius: 8px;
  font-size: 12px;
}

.communications-answer-source a {
  color: #2f6b12;
  text-decoration: underline;
}

.communications-answer-source span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.communications-settings-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.communications-settings-body .form-grid {
  margin: 0;
}

.communications-training-card {
  padding: 12px;
  color: #275a17;
  background: #f2fae9;
  border: 1px solid #cce8b4;
  border-radius: 7px;
}

.communications-settings-actions {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.communications-settings-actions span {
  color: var(--muted);
  font-size: 13px;
}

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

  .communications-rows {
    max-height: 380px;
  }
}

@media (max-width: 620px) {
  .communications-toolbar,
  .communications-toolbar-actions,
  .communications-detail-head,
  .communications-draft-head,
  .communications-send-row,
  .communications-knowledge-actions,
  .communications-settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .communications-marketplace-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .communications-marketplace-switch > span {
    grid-column: 1 / -1;
  }

  .communications-reply {
    min-height: 180px;
  }

  .communications-send-row .btn,
  .communications-settings-actions .btn {
    width: 100%;
  }
}

.stock-sync-mode-banner {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid #c9d9e8;
  border-left: 4px solid #4f81b3;
  border-radius: 7px;
  background: #f3f7fa;
}

.stock-sync-mode-banner.write-enabled {
  border-color: #dfc49b;
  border-left-color: #a86d24;
  background: #fff8ed;
}

.stock-sync-mode-banner strong,
.stock-sync-mode-banner span {
  display: block;
}

.stock-sync-mode-banner span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.stock-sync-surface {
  margin-bottom: 12px;
  overflow: hidden;
}

.stock-sync-head {
  align-items: center;
}

.stock-sync-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  justify-content: flex-end;
}

.stock-sync-settings-actions .switch {
  min-height: 38px;
}

.stock-sync-write-switch {
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.compact-field {
  min-width: 118px;
}

.stock-sync-warehouse-list {
  border-top: 1px solid var(--line);
}

.stock-sync-warehouse-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px 170px;
  gap: 16px;
  align-items: center;
  min-height: 62px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.stock-sync-warehouse-row:last-child {
  border-bottom: 0;
}

.stock-sync-warehouse-row.linked {
  background: #f7faf8;
}

.stock-sync-warehouse-head {
  min-height: 38px;
  color: var(--muted);
  background: #f7f8fa;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.stock-sync-warehouse-name strong,
.stock-sync-warehouse-name span {
  display: block;
}

.stock-sync-warehouse-name span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.stock-sync-primary-choice {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  color: #42546a;
  font-size: 13px;
  font-weight: 700;
}

.stock-sync-primary-choice input {
  width: 17px;
  height: 17px;
  accent-color: #315d9c;
}

.stock-sync-switch {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
}

.stock-sync-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.stock-sync-summary .stat strong {
  font-size: 20px;
  overflow-wrap: anywhere;
}

.stock-sync-plan-wrap {
  border-top: 1px solid var(--line);
}

.stock-sync-plan-table {
  min-width: 720px;
}

.stock-sync-plan-table th:nth-child(n + 3),
.stock-sync-plan-table td:nth-child(n + 3) {
  width: 120px;
  text-align: right;
}

.stock-sync-plan-table .negative {
  color: #9b433d;
}

.stock-sync-plan-table .positive {
  color: #317056;
}

.stock-sync-journal {
  border-top: 1px solid var(--line);
}

.stock-sync-journal-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.stock-sync-journal-row:last-child {
  border-bottom: 0;
}

.stock-sync-journal-row time {
  color: var(--muted);
}

.stock-sync-journal-row.error span {
  color: #a13f38;
}

.stock-sync-journal-row.warning span {
  color: #85651f;
}

.stock-sync-execution {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.stock-sync-execution.verified {
  color: #2f6f4e;
  background: #f2f8f4;
}

.stock-sync-execution.failed,
.stock-sync-execution.partial_failed,
.stock-sync-execution.verification_failed {
  color: #8f3f39;
  background: #fff3f2;
}

@media (max-width: 900px) {
  .stock-sync-head {
    align-items: stretch;
  }

  .stock-sync-settings-actions {
    justify-content: flex-start;
  }

  .stock-sync-warehouse-head {
    display: none;
  }

  .stock-sync-warehouse-row {
    grid-template-columns: minmax(0, 1fr) 145px;
  }

  .stock-sync-warehouse-name {
    grid-column: 1 / -1;
  }

  .stock-sync-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .stock-sync-mode-banner,
  .stock-sync-settings-actions {
    align-items: stretch;
  }

  .stock-sync-settings-actions,
  .stock-sync-mode-banner {
    flex-direction: column;
  }

  .stock-sync-warehouse-row,
  .stock-sync-summary,
  .stock-sync-journal-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .stock-sync-warehouse-name {
    grid-column: auto;
  }
}

.profitability-marketplace-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 4px;
  color: #dce7f5;
  background: #172234;
  border-radius: 8px;
}

.profitability-marketplace-switch > span {
  padding: 0 10px 0 8px;
  color: #aebed2;
  font-size: 12px;
  font-weight: 700;
}

.profitability-marketplace-switch button {
  min-width: 72px;
  min-height: 34px;
  padding: 7px 14px;
  color: #c7d4e4;
  background: transparent;
  border-radius: 6px;
  font-weight: 800;
}

.profitability-marketplace-switch button.active {
  color: #172234;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.24);
}

.profit-settings-panel.ozon-profit-source {
  align-items: center;
}

.profit-settings-panel.ozon-profit-source strong {
  white-space: nowrap;
}

.profitability-view-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 12px;
  padding: 3px;
  overflow-x: auto;
  background: #e9edf2;
  border-radius: 7px;
}

.profitability-view-tab {
  min-height: 34px;
  padding: 7px 14px;
  white-space: nowrap;
  color: var(--muted);
  background: transparent;
  border-radius: 5px;
  font-weight: 700;
}

.profitability-view-tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(30, 41, 59, 0.12);
}

.profitability-daily-controls {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(160px, 220px) auto auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px;
}

.profitability-daily-presets {
  display: flex;
  gap: 6px;
  min-width: 0;
}

.profitability-daily-presets .btn {
  min-width: 44px;
  padding-inline: 10px;
}

.profitability-daily-validity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 8px 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.profitability-daily-validity strong {
  white-space: nowrap;
}

.profitability-daily-validity.valid {
  color: #28620b;
  border-color: #b9dd9e;
  background: #f1faeb;
}

.profitability-daily-validity.provisional {
  color: #7b4f00;
  border-color: #e7bd65;
  background: #fff7df;
}

.profitability-daily-validity.invalid {
  color: #922c27;
  border-color: #e5a49f;
  background: #fff0ef;
}

.profitability-daily-source-groups {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 10px;
  margin: 0 0 10px;
}

.profitability-daily-source-group {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.profitability-daily-source-group.required {
  border-left: 4px solid #d59a22;
}

.profitability-daily-source-group.optional {
  background: #f8fafc;
}

.profitability-daily-source-group-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.profitability-daily-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profitability-daily-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.profitability-daily-source strong {
  font-weight: 800;
}

.profitability-daily-source.ok {
  color: #28620b;
  border-color: #b9dd9e;
  background: #f1faeb;
}

.profitability-daily-source.partial {
  color: #8a5700;
  border-color: #f0ce8a;
  background: #fff8e8;
}

.profitability-daily-source.missing {
  color: #9d302a;
  border-color: #efb7b3;
  background: #fff3f2;
}

@media (max-width: 900px) {
  .profitability-daily-validity {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .profitability-daily-validity strong {
    white-space: normal;
  }

  .profitability-daily-source-groups {
    grid-template-columns: 1fr;
  }
}

.profitability-daily-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  min-height: 620px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.profitability-daily-selector {
  min-width: 0;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: #fbfcfd;
}

.profitability-daily-selector.collapsed {
  width: 58px;
  padding: 10px 8px;
}

.profitability-daily-selector-head,
.profitability-daily-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profitability-daily-selector-head > div {
  display: grid;
  min-width: 0;
}

.profitability-daily-selector-head small {
  margin-top: 2px;
  color: var(--muted);
}

.profitability-daily-selector.collapsed .profitability-daily-selector-head > div {
  display: none;
}

.profitability-daily-selector-actions {
  display: flex;
  justify-content: flex-end;
  margin: 10px 0 8px;
}

.profitability-daily-selector > .input {
  width: 100%;
  margin-bottom: 8px;
}

.profitability-daily-product-list {
  max-height: 650px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.profitability-daily-list-label {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 4px 6px;
  color: var(--muted);
  background: #fbfcfd;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.profitability-daily-product-option {
  display: grid;
  grid-template-columns: 22px auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 7px 5px;
  overflow: hidden;
  text-align: left;
  background: transparent;
  border-bottom: 1px solid #edf0f3;
}

.profitability-daily-product-option:hover,
.profitability-daily-product-option.selected {
  background: #eef7f5;
}

.profitability-daily-product-option .thumb {
  width: 34px;
  height: 42px;
  object-fit: contain;
  border-radius: 4px;
}

.profitability-daily-product-option > span:last-child {
  display: grid;
  min-width: 0;
}

.profitability-daily-product-option strong,
.profitability-daily-product-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profitability-daily-product-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.profitability-daily-product-option small[data-product-drr] {
  white-space: normal;
  overflow: visible;
  line-height: 1.4;
}

.profitability-daily-check {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: #ffffff;
  background: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.profitability-daily-product-option.selected .profitability-daily-check {
  border-color: #0f766e;
  background: #0f766e;
}

.profitability-daily-glue-option {
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  min-height: 84px;
  padding-top: 9px;
  padding-bottom: 9px;
}

.profitability-daily-glue-content {
  display: grid;
  min-width: 0;
}

.profitability-daily-glue-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 7px;
}

.profitability-daily-glue-product-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 38px;
  padding: 1px;
  overflow: hidden;
  background: #ffffff;
  border: 2px solid transparent;
  border-radius: 5px;
}

.profitability-daily-glue-product-icon.has-ads {
  background: rgba(22, 163, 74, var(--ad-fill-alpha));
  border-color: rgba(22, 163, 74, var(--ad-border-alpha));
  box-shadow: 0 0 0 1px rgba(22, 163, 74, var(--ad-glow-alpha));
}

.profitability-daily-glue-product-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.profitability-daily-glue-product-placeholder {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.profitability-daily-list-empty {
  padding: 18px 6px;
  color: var(--muted);
}

.profitability-daily-content {
  min-width: 0;
  overflow: hidden;
}

.profitability-daily-chart {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.profitability-daily-section-head h2 {
  margin: 0;
  font-size: 18px;
}

.profitability-daily-section-head p {
  margin: 3px 0 0;
  color: var(--muted);
}

.profitability-daily-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 10px 0 3px;
  color: var(--muted);
  font-size: 12px;
}

.profitability-daily-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.profitability-daily-chart-legend i {
  width: 18px;
  height: 3px;
  border-radius: 2px;
}

.profitability-daily-chart-scroll {
  width: 100%;
  overflow-x: auto;
}

.profitability-daily-chart-svg {
  display: block;
  width: 100%;
  min-width: 720px;
  height: 230px;
}

.profitability-daily-chart-grid {
  stroke: #e5e9ee;
  stroke-width: 1;
}

.profitability-daily-chart-svg text {
  fill: var(--muted);
  font-size: 11px;
}

.profitability-daily-pivot-wrap {
  max-height: 720px;
  overflow: auto;
  overscroll-behavior: contain;
}

.profitability-daily-pivot {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.profitability-daily-pivot th,
.profitability-daily-pivot td {
  width: 116px;
  min-width: 116px;
  height: 44px;
  padding: 8px 10px;
  text-align: right;
  white-space: nowrap;
  background: var(--surface);
  border-right: 1px solid #edf0f3;
  border-bottom: 1px solid #edf0f3;
}

.profitability-daily-pivot thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 52px;
  color: var(--muted);
  background: #f5f7fa;
  font-size: 12px;
  font-weight: 800;
}

.profitability-daily-pivot thead th small {
  display: block;
  margin-top: 2px;
  color: #9a6100;
  font-size: 9px;
}

.profitability-daily-pivot thead th small.missing {
  color: #b42318;
}

.profitability-daily-pivot .profitability-daily-metric-column {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 330px;
  min-width: 330px;
  max-width: 330px;
  text-align: left;
  box-shadow: 6px 0 10px rgba(30, 41, 59, 0.05);
}

.profitability-daily-pivot thead .profitability-daily-metric-column {
  z-index: 6;
  background: #f5f7fa;
}

.profitability-daily-pivot .profitability-daily-group-row th,
.profitability-daily-pivot .profitability-daily-group-row td {
  height: 40px;
  background: #edf8f6;
}

.profitability-daily-group-row button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  color: #0f766e;
  background: transparent;
  font-weight: 800;
  text-align: left;
}

.profitability-daily-group-row button span {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  color: #ffffff;
  background: #0f766e;
  border-radius: 50%;
}

.profitability-daily-metric-column label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.profitability-daily-metric-column label span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.profitability-daily-metric-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profitability-daily-pivot td[class*="daily-percent-heat-"] {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.profitability-daily-pivot td.daily-percent-heat-low {
  background: #f7ead5;
}

.profitability-daily-pivot td.daily-percent-heat-low-mid {
  background: #f4f0c3;
}

.profitability-daily-pivot td.daily-percent-heat-mid {
  background: #e9f2b9;
}

.profitability-daily-pivot td.daily-percent-heat-high {
  background: #ccefae;
}

.profitability-daily-pivot td.daily-percent-heat-best {
  background: #8ee6af;
}

.profitability-daily-pivot td.daily-percent-trend-good {
  color: #16823b;
}

.profitability-daily-pivot td.daily-percent-trend-bad {
  color: #d4382b;
}

.btn.disabled {
  pointer-events: none;
  opacity: 0.55;
}

@media (max-width: 980px) {
  .profitability-daily-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profitability-daily-layout {
    grid-template-columns: 1fr;
  }

  .profitability-daily-selector,
  .profitability-daily-selector.collapsed {
    width: auto;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .profitability-daily-selector.collapsed .profitability-daily-selector-head > div {
    display: grid;
  }

  .profitability-daily-product-list {
    max-height: 300px;
  }

  .profitability-daily-pivot .profitability-daily-metric-column {
    width: 250px;
    min-width: 250px;
    max-width: 250px;
  }
}

@media (max-width: 620px) {
  .profitability-marketplace-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .profitability-marketplace-switch > span {
    grid-column: 1 / -1;
    padding: 4px 6px 2px;
  }

  .profitability-view-tabs {
    width: 100%;
    overflow: visible;
  }

  .profitability-view-tab {
    flex: 1 1 0;
    min-width: 0;
    min-height: 46px;
    padding: 6px 4px;
    white-space: normal;
    font-size: 12px;
    line-height: 1.2;
  }

  .profitability-daily-controls {
    grid-template-columns: 1fr;
  }

  .profitability-daily-presets {
    width: 100%;
  }

  .profitability-daily-presets .btn {
    flex: 1;
  }

  .profitability-daily-pivot .profitability-daily-metric-column {
    width: 210px;
    min-width: 210px;
    max-width: 210px;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 15px;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app {
  min-height: 100vh;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(0, 1fr);
  grid-template-areas:
    "brand actions"
    "nav nav";
  align-items: center;
  gap: 8px 16px;
  min-height: 52px;
  padding: 8px 18px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 180px;
}

.brand-image {
  display: block;
  width: 168px;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.nav {
  grid-area: nav;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  width: 100%;
  overflow: visible;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 12px;
  color: #3d4653;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px 7px 0 0;
  line-height: 1.15;
  white-space: nowrap;
}

.nav-button.active {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--text);
}

.top-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}

.account-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
}

.logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  color: #b42318;
  background: #fff5f5;
  border: 1px solid #ffd1d1;
  border-radius: var(--radius);
  font-weight: 700;
  white-space: nowrap;
}

.logout-button:hover {
  background: #ffe8e8;
}

.account-menu {
  position: relative;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: grid;
  min-width: 220px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.account-dropdown-head {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.account-dropdown-head small {
  color: var(--muted);
}

.account-dropdown button {
  display: flex;
  justify-content: flex-start;
  padding: 11px 14px;
  background: var(--surface);
  color: var(--text);
}

.account-dropdown button:hover {
  background: var(--surface-soft);
}

.shop-select {
  flex: 1 1 220px;
  width: min(320px, 28vw);
  min-width: 180px;
  max-width: 360px;
  height: 34px;
  padding: 0 32px 0 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 10px;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.add-shop-link {
  white-space: nowrap;
}

.codex-connect-link {
  color: #40513b;
  background: #f1f6ed;
  border-color: #cfdcc6;
  white-space: nowrap;
}

.notice-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.login-card {
  width: min(460px, 100%);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 22px;
}

.login-brand .brand-image {
  width: min(300px, 100%);
  border-radius: 8px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.15;
}

.login-card p {
  margin: 0 0 22px;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-card .api-form {
  margin-top: 16px;
}

.login-card .form-grid.two {
  grid-template-columns: 1fr;
}

.soft-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #334155;
  font-weight: 700;
  font-size: 12px;
}

.page {
  position: relative;
  padding: 18px;
}

@keyframes page-loading-reveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes page-loading-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.9; }
}

.page-loading-visual,
.session-loading-card {
  opacity: 0;
  animation: page-loading-reveal 160ms ease 650ms forwards;
}

.page-loading-visual.is-initial {
  position: absolute;
  inset: 0;
  z-index: 24;
  min-height: calc(100vh - 96px);
  padding: 22px 18px;
  background: var(--bg);
}

.page-loading-title,
.session-loading-copy,
.page-loading-visual.is-refresh {
  display: flex;
  align-items: center;
  gap: 11px;
}

.page-loading-title {
  min-height: 52px;
  margin-bottom: 18px;
}

.page-loading-first-warning {
  max-width: 760px;
  margin: -6px 0 18px;
  padding: 11px 13px;
  color: #7a4b00;
  background: #fff4d8;
  border: 1px solid #f0c36a;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}

.page-loading-title > div,
.session-loading-copy > div {
  display: grid;
  gap: 3px;
}

.page-loading-title strong,
.session-loading-copy strong {
  color: var(--text);
  font-size: 16px;
}

.page-loading-title span,
.session-loading-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.page-loading-spinner {
  display: inline-block;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--green-dark);
  border-radius: 50%;
  animation: page-loading-spin 700ms linear infinite;
}

.page-loading-skeleton {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(110px, 0.7fr));
  gap: 10px;
  padding: 16px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.page-loading-skeleton span,
.session-loading-lines span {
  height: 38px;
  background: #e8ebef;
  border-radius: 5px;
  animation: page-loading-pulse 1.2s ease-in-out infinite;
}

.page-loading-skeleton-heading {
  width: min(280px, 75%);
  height: 22px !important;
}

.page-loading-skeleton-action {
  grid-column: 4;
  justify-self: end;
  width: 110px;
  height: 34px !important;
}

.page-loading-skeleton-table {
  grid-column: 1 / -1;
  height: 320px !important;
}

.page-loading-visual.is-refresh {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  max-width: min(420px, calc(100vw - 36px));
  min-height: 44px;
  padding: 10px 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(30, 41, 59, 0.14);
  pointer-events: none;
}

.page-loading-visual.is-refresh::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  content: "";
  background: var(--green);
  transform-origin: left;
  animation: page-loading-pulse 1.2s ease-in-out infinite;
}

.page-loading-visual.is-initial.is-profitability {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg);
  opacity: 1;
  animation: none;
}

.page-loading-visual.is-profitability .page-loading-title {
  flex-direction: column;
  gap: 22px;
  margin: 0;
  text-align: center;
}

.page-loading-visual.is-profitability .page-loading-title > div {
  gap: 8px;
}

.page-loading-visual.is-profitability .page-loading-spinner {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

.page-loading-visual.is-profitability .page-loading-first-warning {
  margin: 22px 0 0;
  text-align: center;
}

.page-loading-visual.is-profitability .page-loading-skeleton {
  display: none;
}

.session-loading-card {
  min-height: 230px;
}

.session-loading-card .login-brand {
  margin-bottom: 28px;
}

.session-loading-lines {
  display: grid;
  gap: 9px;
  margin-top: 28px;
}

.session-loading-lines span {
  height: 12px;
}

.session-loading-lines span:nth-child(2) {
  width: 82%;
}

.session-loading-lines span:nth-child(3) {
  width: 64%;
}

@media (max-width: 760px) {
  .page-loading-visual.is-initial {
    min-height: calc(100vh - 130px);
    padding: 18px 12px;
  }

  .page-loading-skeleton {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-loading-skeleton-action {
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-loading-spinner,
  .page-loading-skeleton span,
  .session-loading-lines span,
  .page-loading-visual.is-refresh::after {
    animation: none;
  }
}

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 48px;
  margin-bottom: 14px;
  padding: 10px 16px;
  border: 1px solid var(--amber);
  background: var(--amber-soft);
  border-radius: var(--radius);
  color: #4c3a16;
}

.notice-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.info-dot {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 1px solid var(--amber);
  border-radius: 50%;
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
}

.link-button {
  color: var(--blue);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.title-block h1,
.title-block h2,
.title-block p {
  margin: 0;
}

.title-block h1 {
  font-size: 24px;
  line-height: 1.2;
}

.title-block h2 {
  font-size: 20px;
  line-height: 1.25;
}

.title-block p {
  margin-top: 5px;
  color: var(--muted);
}

.title-block .error-text {
  color: #c2410c;
  font-weight: 650;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 6px;
  background: #edf2f7;
  color: var(--text);
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn.primary {
  background: var(--green);
  color: #ffffff;
}

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

.btn.tiny {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.btn.danger-lite {
  color: var(--red);
  background: var(--red-soft);
  border-color: #fecaca;
}

.btn.blue {
  background: var(--blue);
  color: #ffffff;
}

.btn.ghost {
  background: var(--surface);
  border-color: var(--line);
}

.btn.warning {
  background: var(--amber);
  color: #ffffff;
}

.btn.danger {
  background: var(--red-soft);
  color: var(--red);
  border-color: #ffd0cc;
}

.btn.full-width {
  width: 100%;
  margin-top: 12px;
}

.compact-btn {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}

.surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 16px;
}

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

.metric {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

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

.metric-value {
  margin-top: 8px;
  font-size: 26px;
  font-weight: 800;
}

.impact-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.impact-card > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.impact-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.impact-card strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
}

.impact-note {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.35;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow-x: auto;
}

.tab {
  position: relative;
  min-height: 48px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
}

.tab.active {
  color: var(--text);
}

.tab.active::after {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 3px;
  background: var(--blue);
  content: "";
}

.filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 220px auto;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

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

.field label {
  color: var(--muted);
  font-size: 12px;
}

.field small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.input,
.select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.input:focus,
.select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 122, 224, 0.12);
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap,
.price-scenario-table-wrap,
.process-table-wrap,
.rounds-table-wrap {
  overflow-anchor: none;
  scroll-behavior: auto;
  scrollbar-gutter: stable;
}

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

.table th {
  height: 42px;
  color: var(--muted);
  background: #fbfcfe;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}

.table td,
.table th {
  padding: 9px 8px;
  border-right: 1px solid #eef1f5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table td {
  border-bottom: 1px solid #eef1f5;
  vertical-align: middle;
}

.table tr:hover td {
  background: #fafcff;
}

.clickable-row {
  cursor: pointer;
}

.test-link {
  max-width: 100%;
  overflow: hidden;
  color: #1f579d;
  font-weight: 700;
  background: transparent;
  padding: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.product-cell > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repricer-product-link {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repricer-product-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.dashboard-table th:nth-child(1),
.dashboard-table td:nth-child(1) {
  width: 10%;
}

.dashboard-table th:nth-child(2),
.dashboard-table td:nth-child(2) {
  width: 18%;
}

.dashboard-table th:nth-child(3),
.dashboard-table td:nth-child(3),
.dashboard-table th:nth-child(8),
.dashboard-table td:nth-child(8) {
  width: 7%;
}

.dashboard-table th:nth-child(4),
.dashboard-table td:nth-child(4),
.dashboard-table th:nth-child(9),
.dashboard-table td:nth-child(9),
.dashboard-table th:nth-child(10),
.dashboard-table td:nth-child(10),
.dashboard-table th:nth-child(11),
.dashboard-table td:nth-child(11) {
  width: 9%;
}

.dashboard-table th:nth-child(5),
.dashboard-table td:nth-child(5) {
  width: 14%;
}

.dashboard-table th:nth-child(6),
.dashboard-table td:nth-child(6) {
  width: 10%;
}

.dashboard-table th:nth-child(7),
.dashboard-table td:nth-child(7) {
  width: 9%;
}

.dashboard-table th:nth-child(12),
.dashboard-table td:nth-child(12) {
  width: 10%;
}

.module-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
}

.module-grid > .surface {
  min-width: 0;
}

.module-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.module-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.module-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.ads-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.ads-layout {
  display: grid;
  grid-template-columns: minmax(520px, 0.95fr) minmax(560px, 1.05fr);
  gap: 16px;
  align-items: start;
}

.ads-list-page,
.ads-detail-page {
  display: grid;
  gap: 16px;
}

.ads-list-full,
.ads-detail-full {
  width: 100%;
  min-width: 0;
}

.ads-detail-full {
  min-height: calc(100vh - 180px);
  overflow: visible;
}

.ads-list,
.ads-detail {
  min-width: 0;
}

.ads-controls {
  display: grid;
  grid-template-columns: 135px 135px 230px 170px 150px minmax(220px, 1fr) auto;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.ads-search-field {
  min-width: 0;
}

.ads-table-wrap,
.ads-keyword-wrap {
  max-height: calc(100vh - 320px);
  overflow: auto;
}

.ads-list-page .ads-table-wrap {
  max-height: calc(100vh - 395px);
}

.ads-campaign-table th,
.ads-campaign-table td,
.ads-keyword-table th,
.ads-keyword-table td {
  padding: 8px 9px;
  vertical-align: middle;
  white-space: nowrap;
}

.ads-campaign-table {
  min-width: 1595px;
}

.ads-campaign-table .ads-col-campaign { width: 360px; }
.ads-campaign-table .ads-col-type { width: 140px; }
.ads-campaign-table .ads-col-status { width: 110px; }
.ads-campaign-table .ads-col-zones { width: 150px; }
.ads-campaign-table .ads-col-products { width: 70px; }
.ads-campaign-table .ads-col-stock { width: 130px; }
.ads-campaign-table .ads-col-bid { width: 115px; }
.ads-campaign-table .ads-col-views { width: 90px; }
.ads-campaign-table .ads-col-ctr { width: 100px; }
.ads-campaign-table .ads-col-atbs { width: 115px; }
.ads-campaign-table .ads-col-orders { width: 115px; }
.ads-campaign-table .ads-col-action { width: 82px; }
.ads-campaign-table .ads-col-drr { width: 80px; }

.ads-campaign-table tbody td {
  padding-top: 6px;
  padding-bottom: 6px;
}

.ads-campaign-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fbfcfe;
}

.ads-campaign-table .table-refreshing {
  opacity: 1;
}

.ads-campaign-table td:first-child {
  white-space: normal;
}

.ads-campaign-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.ads-campaign-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ads-campaign-meta {
  display: grid;
  flex: 1 1 auto;
  gap: 4px;
  min-width: 0;
}

.ads-campaign-meta .table-link {
  display: -webkit-box;
  max-width: 100%;
  max-height: 2.4em;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.2;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ads-campaign-meta small {
  margin-top: 0;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ads-campaign-metric {
  font-weight: 700;
  text-align: right;
}

.ads-campaign-metric small {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.1;
}

.ads-stock-cell {
  display: inline-grid;
  gap: 2px;
  min-width: 112px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.ads-stock-cell strong {
  font-size: 15px;
  line-height: 1;
}

.ads-stock-cell small {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.ads-stock-cell.stock-ok {
  border-color: #b7dfc4;
  background: #f0faf3;
  color: #176339;
}

.ads-stock-cell.stock-empty {
  border-color: #f0c2bd;
  background: #fff4f2;
  color: #a2392f;
}

.ads-period-field {
  min-width: 0;
}

.ads-campaign-thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
}

.ads-campaign-table .ads-campaign-thumb {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
}

.ads-campaign-thumb.large {
  width: 72px;
  height: 72px;
  flex-basis: 72px;
  border-radius: 8px;
}

.ads-campaign-thumb > img,
.ads-campaign-thumb > .pack-visual {
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

.ads-campaign-thumb > img {
  object-fit: contain;
  object-position: center;
  background: #ffffff;
}

.ads-campaign-extra {
  position: absolute;
  top: -8px;
  right: -10px;
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: #3d4052;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.16);
}

.ads-detail-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.ads-detail-title > div:last-child {
  min-width: 0;
}

.table-link {
  padding: 0;
  color: #255aa5;
  background: transparent;
  font-weight: 750;
  text-align: left;
}

.selected-row {
  background: #f1f7ff;
}

.muted-row {
  background: #fafafa;
  color: var(--muted);
}

.inline-field {
  min-width: 170px;
  margin: 0;
}

.ads-detail-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.ads-detail-stats > div,
.state-grid > div {
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.ads-detail-stats span,
.state-grid > div span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.ads-detail-stats strong,
.state-grid > div strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}

.ads-product-stock-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.ads-product-stock-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.ads-product-stock-card.stock-ok {
  border-color: #c9e8d2;
}

.ads-product-stock-card.stock-empty {
  border-color: #f1c4bf;
  background: #fff8f7;
}

.ads-product-stock-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ads-product-stock-main > img,
.ads-product-stock-main > .pack-visual {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
}

.ads-product-stock-main > img {
  object-fit: contain;
  object-position: center;
}

.ads-product-stock-main > div {
  min-width: 0;
}

.ads-product-stock-main strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ads-product-stock-main small,
.ads-product-stock-value small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.ads-product-stock-value {
  flex: 0 0 auto;
  min-width: 86px;
  text-align: right;
}

.ads-product-stock-value strong {
  display: block;
  color: var(--text);
  font-size: 18px;
}

.ads-keyword-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #f4f6fa;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.ads-key-tabs,
.ads-keyword-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ads-key-tab {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 36px;
  padding: 0 16px;
  border-radius: 5px;
  color: #667085;
  background: #eef2f7;
  font-weight: 700;
}

.ads-key-tab.active {
  color: #252a31;
  background: #f8b53d;
}

.ads-key-tab strong {
  font-size: 14px;
}

.ads-keyword-actions .input {
  height: 36px;
}

.ads-mode-pill,
.ads-campaign-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: #475467;
  font-weight: 700;
}

.ads-period-presets {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
}

.ads-period-chip {
  min-height: 28px;
  padding: 0 9px;
  border-radius: 4px;
  color: #667085;
  background: transparent;
  font-weight: 750;
}

.ads-period-chip.active {
  color: #20252c;
  background: #f8b53d;
}

.switch-dot {
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #46b172;
  position: relative;
}

.switch-dot::after {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  content: "";
}

.ads-keyword-subbar {
  display: grid;
  grid-template-columns: auto minmax(220px, 0.35fr) auto minmax(220px, 1fr) minmax(200px, 0.8fr);
  gap: 10px;
  align-items: center;
  padding: 8px 12px 10px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
}

.ads-keyword-subbar span {
  color: var(--muted);
  font-size: 13px;
}

.ads-keyword-bulkbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.ads-keyword-bulkbar.active {
  background: #f0f7ff;
}

.ads-keyword-bulkbar strong {
  display: block;
  font-size: 14px;
}

.ads-keyword-bulkbar span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.ads-bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ads-key-search {
  height: 36px;
}

.ads-keyword-wrap {
  max-height: calc(100vh - 420px);
  overflow: auto;
}

.ads-strategy-page {
  display: grid;
  gap: 16px;
}

.ads-strategy-section {
  min-width: 0;
  overflow: visible;
}

.ads-strategy-detail-head {
  min-width: 0;
}

.ads-strategy-pools-section {
  min-width: 0;
}

.ads-strategy-pool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.ads-strategy-pool-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.ads-strategy-pool-card.active {
  border-color: #94b9ff;
  background: #f6f9ff;
}

.ads-strategy-pool-main {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.ads-strategy-pool-main span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.ads-strategy-pool-name {
  height: 34px;
  font-weight: 700;
}

.ads-strategy-pool-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.ads-strategy-empty-pools {
  margin: 14px;
}

.ads-strategy-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.ads-strategy-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1.1fr) 130px 95px 130px 130px minmax(220px, 1fr) auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.ads-strategy-control-actions {
  display: flex;
  align-items: end;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 230px;
}

.compact-number {
  max-width: 130px;
}

.ads-strategy-hint {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.ads-strategy-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #c9ddff;
  border-radius: 8px;
  background: #f3f8ff;
}

.ads-strategy-next.ready {
  border-color: #cdeabf;
  background: #f4fbef;
}

.ads-strategy-next strong {
  flex: 0 0 auto;
  font-size: 14px;
}

.ads-strategy-next span {
  flex: 1 1 auto;
  color: var(--muted);
  font-size: 13px;
}

.ads-strategy-table-wrap,
.ads-strategy-key-wrap {
  max-height: max(420px, calc(100vh - 380px));
  overflow: auto;
}

.ads-strategy-table {
  min-width: 1320px;
}

.ads-strategy-key-table {
  min-width: 980px;
}

.ads-strategy-table th,
.ads-strategy-table td,
.ads-strategy-key-table th,
.ads-strategy-key-table td {
  padding: 8px 9px;
  vertical-align: middle;
  white-space: nowrap;
}

.ads-strategy-table th,
.ads-strategy-key-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fbfcfe;
}

.ads-strategy-table td:nth-child(2),
.ads-strategy-table td:nth-child(3),
.ads-strategy-key-table td:nth-child(2) {
  white-space: normal;
}

.ads-strategy-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.ads-strategy-key-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.ads-strategy-key-head span {
  color: var(--muted);
  font-size: 13px;
}

.ads-strategy-plan {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.ads-strategy-plan-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.ads-strategy-plan-summary > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.ads-strategy-plan-summary.over-budget > div:last-child,
.ads-strategy-plan-summary.over-budget > div:nth-child(4) {
  border-color: #f1b84b;
  background: #fff8e8;
}

.ads-strategy-plan-summary span,
.ads-strategy-role-item span:last-child {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.ads-strategy-plan-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}

.ads-strategy-launch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.ads-strategy-launch.running {
  border-color: #cdeabf;
  background: #f4fbef;
}

.ads-strategy-launch strong {
  display: block;
  font-size: 14px;
}

.ads-strategy-launch span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.ads-strategy-run-journal {
  display: grid;
  gap: 2px;
  margin-top: 8px;
}

.ads-strategy-run-journal span {
  margin-top: 0;
  color: #475569;
}

.ads-strategy-position-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.ads-strategy-position-head strong {
  display: block;
  font-size: 14px;
}

.ads-strategy-position-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.ads-strategy-position-wrap {
  max-height: max(360px, calc(100vh - 430px));
  overflow: auto;
}

.ads-strategy-position-table {
  min-width: 1080px;
  table-layout: fixed;
}

.ads-strategy-position-table th,
.ads-strategy-position-table td {
  width: 128px;
  padding: 8px 9px;
  vertical-align: middle;
}

.ads-strategy-position-table th:first-child,
.ads-strategy-position-table td:first-child {
  width: 260px;
  position: sticky;
  left: 0;
  z-index: 3;
  background: #ffffff;
}

.ads-strategy-position-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #fbfcfe;
}

.ads-strategy-position-table th:first-child {
  z-index: 5;
  background: #fbfcfe;
}

.ads-strategy-position-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  white-space: normal;
}

.ads-position-cell {
  display: grid;
  gap: 2px;
  min-height: 54px;
  align-content: center;
}

.ads-position-cell strong {
  font-size: 13px;
}

.ads-position-cell small,
.ads-position-empty,
.ads-position-loading {
  color: var(--muted);
  font-size: 11px;
}

.ads-position-loading {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
}

.ads-strategy-pool-products-wrap,
.ads-strategy-history-wrap {
  max-height: 360px;
  overflow: auto;
}

.ads-strategy-pool-products-table {
  min-width: 920px;
}

.ads-strategy-pool-products-table small,
.ads-strategy-history-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.ads-strategy-history {
  border-top: 1px solid var(--line);
}

.ads-strategy-history-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #ffffff;
}

.ads-strategy-history-head strong {
  font-size: 14px;
}

.ads-strategy-history-head span {
  color: var(--muted);
  font-size: 12px;
}

.ads-strategy-history-table {
  min-width: 980px;
}

.ads-strategy-role-list {
  display: grid;
  gap: 8px;
}

.ads-strategy-role-item {
  display: grid;
  grid-template-columns: 130px 120px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.ads-detail-page .ads-keyword-wrap {
  max-height: max(520px, calc(100vh - 300px));
}

.ads-keyword-table {
  table-layout: fixed;
  min-width: 2430px;
  border-collapse: separate;
  border-spacing: 0;
}

.ads-keyword-table col.check-col-width {
  width: 38px;
}

.ads-keyword-table col.keyword-col-width {
  width: 430px;
}

.ads-keyword-table col.bid-col-width {
  width: 92px;
}

.ads-keyword-table col.position-col-width {
  width: 104px;
}

.ads-keyword-table col.metric-col-width {
  width: 90px;
}

.ads-keyword-table col.action-col-width {
  width: 104px;
}

.ads-keyword-table thead th {
  position: sticky;
  z-index: 2;
  background: #f8fafc;
  color: #687282;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.ads-keyword-table thead tr:first-child th {
  top: 0;
  height: 58px;
  padding-top: 5px;
  padding-bottom: 5px;
}

.ads-keyword-table thead tr.filter-row th {
  top: 58px;
  background: #ffffff;
}

.ads-keyword-table .check-col,
.ads-keyword-table td:first-child {
  text-align: center;
}

.ads-keyword-table .wide-col,
.ads-keyword-table td.keyword-name-cell {
  width: 430px;
}

.ad-column-head {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.ads-keyword-table th[draggable="true"] {
  cursor: grab;
}

.ads-keyword-table th[draggable="true"]:active {
  cursor: grabbing;
}

.ads-keyword-table th.ad-column-drop-over {
  box-shadow: inset 3px 0 0 var(--blue);
}

.sort-head {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 13px;
  align-items: center;
  justify-items: start;
  gap: 1px;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  color: inherit;
  background: transparent;
  font-weight: 750;
  line-height: 1.08;
  text-align: left;
  white-space: normal;
}

.sort-head .sort-label {
  display: block;
  min-width: 0;
  width: 100%;
  overflow: visible;
  color: inherit;
  font-size: 13px;
  line-height: 1.08;
  text-align: left;
  white-space: normal;
}

.sort-head .sort-arrow {
  display: block;
  width: 100%;
  color: #7a8595;
  font-size: 14px;
  line-height: 1;
  text-align: center;
}

.sort-head.active .sort-arrow {
  color: var(--blue);
}

.filter-row th {
  padding-top: 6px;
  padding-bottom: 6px;
}

.column-filter {
  display: block;
  width: 100%;
  height: 30px;
  margin: 3px 0;
  padding: 0 7px;
  border: 1px solid #d6dbe3;
  border-radius: 5px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

.column-filter:focus {
  border-color: var(--blue);
}

.fake-checkbox,
.keyword-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid #b8c0cc;
  border-radius: 4px;
  background: #ffffff;
}

.keyword-checkbox {
  cursor: pointer;
}

.keyword-checkbox.checked {
  border-color: var(--blue);
  background: var(--blue);
}

.keyword-checkbox.checked::after {
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  content: "✓";
}

.keyword-checkbox.partial {
  border-color: var(--blue);
  background: #dbeafe;
}

.keyword-checkbox.partial::after {
  width: 9px;
  height: 2px;
  border-radius: 999px;
  background: var(--blue);
  content: "";
}

.keyword-checkbox:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.keyword-name-cell {
  white-space: normal;
}

.keyword-name-cell > div,
.keyword-search-link {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.keyword-search-link {
  max-width: 100%;
  color: inherit;
  text-decoration: none;
}

.keyword-search-link:hover strong {
  color: var(--blue);
  text-decoration: underline;
}

.keyword-name-cell strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.keyword-name-cell .chevron {
  flex: 0 0 auto;
  color: #3d4653;
  font-size: 28px;
  line-height: 0.8;
}

.bid-pill {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 78px;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: #20252c;
}

.bid-input {
  width: 82px;
  min-height: 30px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: #20252c;
  font: inherit;
  font-weight: 650;
  text-align: right;
}

.bid-input:focus {
  outline: 2px solid rgba(47, 109, 246, 0.24);
  border-color: #2f6df6;
}

.bid-input.default-bid {
  border-style: dashed;
  background: #f8fafc;
  color: var(--muted);
}

.bid-input.default-bid:focus {
  border-style: solid;
  background: #ffffff;
  color: #20252c;
}

.bid-input:disabled {
  background: #f5f7fa;
  color: var(--muted);
  cursor: not-allowed;
}

.bid-input::-webkit-outer-spin-button,
.bid-input::-webkit-inner-spin-button {
  margin: 0;
}

.position-cell strong,
.position-cell small {
  display: block;
}

.position-cell small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.live-position-cell strong {
  color: #255aa5;
}

.frequency-cell strong,
.frequency-cell small {
  display: block;
}

.frequency-cell strong {
  color: #255aa5;
}

.frequency-cell small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.position-loading {
  color: var(--muted);
  font-weight: 800;
}

.active-key-row {
  background: #ffffff;
}

.excluded-key-row,
.disabled-key-row {
  background: #fde2df;
}

.keyword-selected-row {
  background: #eaf4ff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.excluded-key-row.keyword-selected-row {
  background: #f8d8d5;
}

.ads-total-row {
  position: sticky;
  bottom: 0;
  z-index: 1;
  background: #ffffff;
  font-weight: 800;
  box-shadow: 0 -1px 0 var(--line);
}

.source-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.source-pill {
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.source-pill.ready {
  border-color: #b7e892;
  background: #f1fbe9;
  color: #336b14;
}

.source-pill.failed {
  border-color: #ffd0cc;
  background: var(--red-soft);
  color: var(--red);
}

.warning-message {
  margin: 12px 16px 0;
  color: #8a5a00;
  background: var(--amber-soft);
}

.economics-stats .metric-value {
  font-size: 24px;
}

/* The page has one layout before/after the saved snapshot arrives. Status
   polls update their own non-interactive islands, not the complete page. */
.profitability-table-frame {
  overflow-anchor: none;
}

.profitability-table-frame .toolbar .title-block p {
  block-size: 4.5em;
  line-height: 1.5;
  overflow: auto;
  scrollbar-width: thin;
}

.profitability-table-frame .economics-stats .metric {
  block-size: 100px;
  padding: 8px 10px;
  min-inline-size: 0;
  overflow: auto;
  scrollbar-width: thin;
}

.profitability-table-frame .economics-native-reporting > p {
  block-size: 3em;
  line-height: 1.5;
  overflow: auto;
}

.profitability-placeholder {
  display: block;
  inline-size: min(140px, 70%);
  block-size: 29px;
  border-radius: 5px;
  background: #eaf0f5;
}

.profitability-coverage-slot {
  block-size: 40px;
  overflow: auto;
  scrollbar-width: thin;
}

.profitability-coverage-slot .form-message {
  margin-block: 0 8px;
}

.profitability-table-frame .module-head > div:first-child > p {
  block-size: 4.5em;
  line-height: 1.5;
  overflow: auto;
}

.profitability-table-frame [data-profitability-sources] {
  block-size: 84px;
  overflow: auto;
  align-content: start;
  scrollbar-width: thin;
}

.profitability-table-frame .profitability-tariff-settings {
  block-size: 84px;
  align-content: center;
  overflow: auto;
}

.profitability-table-frame .profit-settings-panel > p {
  flex-basis: 100%;
  block-size: 3em;
  margin: 0;
  line-height: 1.5;
  overflow: auto;
  scrollbar-width: thin;
}

.source-pill.source-pending {
  color: var(--muted);
  border-color: var(--line);
  background: #f4f7fa;
}

.profitability-errors-slot {
  block-size: 40px;
  overflow: auto;
  scrollbar-width: thin;
}

.profitability-errors-slot .warning-message {
  margin-block: 8px;
}

.profitability-forecast-slot.is-forecast {
  block-size: 128px;
  overflow: auto;
  scrollbar-width: thin;
}

.profitability-forecast-slot.is-forecast:empty {
  display: none;
}

.profitability-forecast-info {
  border-bottom: 1px solid var(--line);
}

.profitability-forecast-info > summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  min-block-size: 36px;
  padding: 8px 16px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  list-style: none;
}

.profitability-forecast-info > summary::-webkit-details-marker {
  display: none;
}

.profitability-forecast-info > summary::before { content: "▸"; }
.profitability-forecast-info[open] > summary::before { content: "▾"; }
.profitability-forecast-info > summary:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -3px;
}

.profitability-forecast-info > summary > small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.profitability-table-frame .profitability-forecast-info .module-head {
  display: block;
  padding: 10px 16px;
}

.profitability-table-frame .profitability-forecast-info .module-head > div:first-child > p {
  block-size: auto;
  margin: 6px 0 0;
  overflow: visible;
}

.profitability-table-frame .profitability-forecast-info [data-profitability-sources] {
  block-size: auto;
  margin-top: 10px;
  overflow: visible;
}

.profitability-table-frame .profitability-forecast-info .profitability-tariff-settings {
  block-size: auto;
  padding: 10px 16px;
  overflow: visible;
}

.profitability-forecast-info .profitability-forecast-explanation {
  padding: 10px 16px;
  font-size: 12px;
}

.profitability-forecast-slot .notice {
  margin: 0 16px 12px;
}

.profitability-forecast-explanation {
  padding: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.profitability-table-placeholder {
  min-block-size: 520px;
  padding: 16px;
}

.profitability-table-placeholder p {
  min-block-size: 3em;
  margin: 0 0 16px;
  line-height: 1.5;
  color: var(--muted);
}

.profitability-table-placeholder > p {
  position: sticky;
  top: 12px;
  z-index: 1;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.profitability-table-placeholder > div {
  display: grid;
  gap: 14px;
}

.profitability-table-placeholder span {
  display: block;
  block-size: 40px;
  border-radius: 4px;
  background: #edf2f6;
}

@media (max-width: 700px) {
  .profitability-table-frame .economics-stats .metric {
    block-size: 100px;
  }
  .profitability-table-frame .profitability-tariff-settings {
    block-size: 144px;
  }
}

.profitability-metric-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  margin: 0 0 0 6px;
  padding: 0;
  vertical-align: middle;
  flex: 0 0 auto;
  border: 1px solid #9aa8bb;
  border-radius: 50%;
  background: transparent;
  color: #60738e;
  font: italic 700 12px/1 Georgia, serif;
  cursor: help;
  touch-action: manipulation;
}

.profitability-metric-help:hover,
.profitability-metric-help:focus-visible {
  color: #0f766e;
  border-color: #0f766e;
  background: #e9f7f5;
}

.profitability-metric-help:focus-visible {
  outline: 2px solid #0f766e;
  outline-offset: 3px;
}

/* One body-level popup: table overflow and sticky headers cannot clip it. */
.profitability-metric-tooltip {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 20000;
  box-sizing: border-box;
  width: 320px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow: auto;
  padding: 13px 15px;
  border: 1px solid #dce3ec;
  border-radius: 10px;
  color: #45556d;
  background: #ffffff;
  box-shadow: 0 8px 28px rgb(23 40 66 / 16%);
  text-align: left;
  font: 400 12px/1.5 system-ui, sans-serif;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.profitability-metric-tooltip strong {
  display: block;
  margin-bottom: 7px;
  color: #26364d;
  font-size: 13px;
  font-weight: 700;
}

.economics-stats .metric-detail {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: normal;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}

.economics-stats .profitability-metric-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  row-gap: 2px;
  min-inline-size: 0;
}

.economics-stats .metric-detail + .metric-detail {
  margin-top: 4px;
}

.economics-stats .profitability-metric-amount {
  min-inline-size: 0;
  font-variant-numeric: tabular-nums;
}

.economics-stats :is(.profitability-metric-share, .profitability-metric-buyout-rate) {
  color: #5267a2;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: normal;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.economics-stats .profitability-metric-buyout-rate { color: #246c6e; }

.profitability-table-frame .economics-stats {
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.profitability-table-frame .economics-stats .metric-label {
  margin-bottom: 2px;
  font-size: 11px;
  line-height: 1.3;
}

.profitability-table-frame .economics-stats .metric-value {
  margin-top: 0;
  font-size: 20px;
  line-height: 1.2;
}

.profitability-table-frame .economics-stats :is(.profitability-metric-share, .profitability-metric-buyout-rate) {
  font-size: 11px;
}

.profitability-table-frame .economics-stats .metric-detail {
  margin-top: 2px;
  font-size: 10.5px;
  line-height: 1.35;
}

.profitability-metric-notes {
  margin-top: 4px;
  color: var(--muted);
  font: 400 10.5px/1.35 system-ui, sans-serif;
  letter-spacing: normal;
}

.profitability-metric-notes > summary {
  cursor: pointer;
  width: fit-content;
}

.profitability-metric-notes > summary:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.profitability-metric-notes-warning > summary {
  color: #956000;
}

.profitability-table-frame .economics-stats .metric:has(.profitability-metric-notes[open]) {
  block-size: auto;
  min-block-size: 100px;
}

:root[data-theme="dark"] .profitability-table-frame .economics-stats .profitability-metric-share { color: #9cadde; }
:root[data-theme="dark"] .economics-stats .profitability-metric-buyout-rate { color: #83c6c4; }
:root[data-theme="dark"] .profitability-metric-notes-warning > summary { color: #edc472; }

@media (min-width: 1280px) {
  .profitability-table-frame .economics-stats {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 999px) {
  .profitability-table-frame .economics-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .profitability-table-frame .economics-stats {
    grid-template-columns: minmax(0, 1fr);
  }
}

.economics-controls {
  display: grid;
  grid-template-columns: 130px 120px 120px auto 1.1fr 1fr 1fr 1fr auto;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.compact-select,
.compact-date {
  height: 34px;
  padding: 0 9px;
  font-size: 13px;
}

.period-btn {
  align-self: end;
  min-height: 34px;
  padding: 0 12px;
}

.filtered-count {
  display: grid;
  align-content: end;
  gap: 3px;
  min-width: 82px;
}

.filtered-count span {
  color: var(--muted);
  font-size: 12px;
}

.filtered-count strong {
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.economics-table th,
.economics-table td {
  height: 46px;
  padding: 5px 7px;
  font-size: 13px;
}

.economics-table th:nth-child(1),
.economics-table td:nth-child(1) {
  width: 22%;
}

.economics-table th:nth-child(2),
.economics-table td:nth-child(2),
.economics-table th:nth-child(3),
.economics-table td:nth-child(3),
.economics-table th:nth-child(12),
.economics-table td:nth-child(12),
.economics-table th:nth-child(13),
.economics-table td:nth-child(13) {
  width: 7%;
}

.economics-table th:nth-child(4),
.economics-table td:nth-child(4),
.economics-table th:nth-child(5),
.economics-table td:nth-child(5),
.economics-table th:nth-child(6),
.economics-table td:nth-child(6),
.economics-table th:nth-child(7),
.economics-table td:nth-child(7),
.economics-table th:nth-child(8),
.economics-table td:nth-child(8),
.economics-table th:nth-child(9),
.economics-table td:nth-child(9),
.economics-table th:nth-child(10),
.economics-table td:nth-child(10),
.economics-table th:nth-child(11),
.economics-table td:nth-child(11) {
  width: 5.5%;
}

.economics-table th:nth-child(14),
.economics-table td:nth-child(14) {
  width: 10%;
}

.elasticity-table {
  min-width: 1420px;
}

.elasticity-table th:nth-child(1),
.elasticity-table td:nth-child(1) {
  width: 300px;
}

.elasticity-table th:nth-child(8),
.elasticity-table td:nth-child(8) {
  width: 140px;
}

.elasticity-table th:nth-child(9),
.elasticity-table td:nth-child(9),
.elasticity-table th:nth-child(10),
.elasticity-table td:nth-child(10) {
  width: 155px;
}

.elasticity-table th:nth-child(11),
.elasticity-table td:nth-child(11) {
  width: 220px;
}

.elasticity-table-wrap {
  max-height: calc(100vh - 385px);
}

.readiness-meter {
  position: relative;
  display: grid;
  align-items: center;
  width: 100%;
  height: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.readiness-meter span {
  position: absolute;
  inset: 0 auto 0 0;
  background: #b7ddff;
}

.readiness-meter strong {
  position: relative;
  padding: 0 8px;
  text-align: right;
  font-size: 13px;
}

.muted-cell {
  color: var(--muted);
}

.repricer-grid {
  grid-template-columns: minmax(0, 1fr) 380px;
}

.repricer-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.repricer-worker-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-top: -4px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}

.repricer-worker-status strong {
  color: var(--text);
}

.repricer-worker-status.is-ok {
  border-color: #bfe8ab;
  background: #ecfbe3;
}

.repricer-worker-status.is-error {
  border-color: #f5b8b8;
  background: #fff1f1;
}

.repricer-worker-status.is-ok strong {
  color: #2f6f1e;
}

.repricer-worker-status.is-error strong {
  color: #b3261e;
}

.repricer-form {
  display: grid;
  gap: 12px;
}

.repricer-settings {
  display: grid;
  gap: 10px;
}

.repricer-import {
  display: grid;
  gap: 8px;
}

.repricer-import input {
  display: none;
}

.repricer-import small {
  color: var(--muted);
  line-height: 1.35;
}

.repricer-form .form-grid {
  margin-bottom: 0;
}

.form-grid.three {
  display: grid;
  grid-template-columns: 1fr 90px 92px;
  gap: 12px;
}

.check-field {
  justify-content: end;
}

.check-field input {
  width: 22px;
  height: 22px;
}

.repricer-selected-product {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
}

.repricer-selected-product div {
  min-width: 0;
}

.repricer-selected-product strong,
.repricer-selected-product span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repricer-selected-product span {
  color: var(--muted);
  font-size: 12px;
}

.repricer-table-wrap {
  max-height: calc(100vh - 360px);
}

.repricer-table {
  min-width: 1260px;
}

.repricer-table th,
.repricer-table td {
  height: 44px;
  padding: 6px 7px;
  font-size: 12px;
}

.repricer-table th:nth-child(1),
.repricer-table td:nth-child(1) {
  width: 230px;
}

.repricer-table th:nth-child(9),
.repricer-table td:nth-child(9) {
  width: 210px;
}

.repricer-table th:nth-child(10),
.repricer-table td:nth-child(10) {
  width: 240px;
}

.repricer-price-cell {
  display: grid;
  gap: 2px;
}

.repricer-price-cell small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.repricer-journal {
  display: grid;
  gap: 8px;
}

.journal-item {
  display: grid;
  gap: 3px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.journal-item strong {
  font-size: 13px;
}

.journal-item span,
.journal-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profitability-table {
  width: max-content;
  min-width: 2720px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}

.profitability-table-wrap {
  --profitability-product-column-width: 340px;
  --profitability-article-column-width: 130px;
  position: relative;
  isolation: isolate;
  max-width: 100%;
  max-height: max(320px, calc(100vh - 430px));
  overflow: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overscroll-behavior: contain;
}

.profitability-table th,
.profitability-table td {
  white-space: nowrap;
  min-width: 112px;
  max-width: none;
}

.profitability-table td {
  vertical-align: middle;
}

.cell-source {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
}

.order-source-breakdown {
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.economics-stats .metric-detail.order-source-breakdown {
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: normal;
  white-space: normal;
}

.commission-rate {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.buyout-forecast-cell {
  display: grid;
  gap: 5px;
  min-width: 132px;
}

.buyout-forecast-badge {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.25;
  white-space: normal;
}

.buyout-forecast-badge.decline {
  color: #9b3a3a;
  border-color: #efcaca;
  background: #fff1f1;
}

.buyout-forecast-badge.improvement {
  color: #31724a;
  border-color: #c5e4cf;
  background: #eef9f1;
}

.logistics-expectation {
  margin-top: 3px;
  font-weight: 600;
}

.logistics-expectation.higher {
  color: #9b3a3a;
}

.logistics-expectation.lower {
  color: #31724a;
}

.profitability-table th:nth-child(1),
.profitability-table td:nth-child(1) {
  min-width: var(--profitability-product-column-width);
  width: var(--profitability-product-column-width);
  white-space: normal;
}

.profitability-table th:nth-child(2),
.profitability-table td:nth-child(2) {
  min-width: var(--profitability-article-column-width);
  width: var(--profitability-article-column-width);
}

.profitability-table th:nth-child(3),
.profitability-table td:nth-child(3),
.profitability-table th:nth-child(5),
.profitability-table td:nth-child(5),
.profitability-table th:nth-child(10),
.profitability-table td:nth-child(10),
.profitability-table th:nth-child(11),
.profitability-table td:nth-child(11),
.profitability-table th:nth-child(12),
.profitability-table td:nth-child(12),
.profitability-table th:nth-child(13),
.profitability-table td:nth-child(13),
.profitability-table th:nth-child(14),
.profitability-table td:nth-child(14),
.profitability-table th:nth-child(15),
.profitability-table td:nth-child(15),
.profitability-table th:nth-child(16),
.profitability-table td:nth-child(16),
.profitability-table th:nth-child(17),
.profitability-table td:nth-child(17),
.profitability-table th:nth-child(18),
.profitability-table td:nth-child(18),
.profitability-table th:nth-child(19),
.profitability-table td:nth-child(19),
.profitability-table th:nth-child(20),
.profitability-table td:nth-child(20),
.profitability-table th:nth-child(21),
.profitability-table td:nth-child(21),
.profitability-table th:nth-child(22),
.profitability-table td:nth-child(22),
.profitability-table th:nth-child(23),
.profitability-table td:nth-child(23) {
  min-width: 124px;
  width: 124px;
}

.profitability-table th:nth-child(12),
.profitability-table td:nth-child(12) {
  min-width: 190px;
  width: 190px;
}

.profitability-table th:nth-child(4),
.profitability-table td:nth-child(4),
.profitability-table th:nth-child(6),
.profitability-table td:nth-child(6),
.profitability-table th:nth-child(7),
.profitability-table td:nth-child(7),
.profitability-table th:nth-child(8),
.profitability-table td:nth-child(8) {
  min-width: 96px;
  width: 96px;
}

.profitability-table th:nth-child(9),
.profitability-table td:nth-child(9) {
  min-width: 168px;
  width: 168px;
}

.profitability-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #fbfcfe;
  box-shadow: 0 1px 0 var(--line);
}

.profitability-table .profitability-sticky-product,
.profitability-table .profitability-sticky-article {
  position: sticky;
  z-index: 3;
  background: var(--surface);
  background-clip: padding-box;
}

.profitability-table .profitability-sticky-product {
  left: 0;
  max-width: var(--profitability-product-column-width);
  overflow: hidden;
}

.profitability-table .profitability-sticky-article {
  left: var(--profitability-product-column-width);
  max-width: var(--profitability-article-column-width);
  overflow: hidden;
  box-shadow: 8px 0 10px -10px rgba(31, 44, 61, 0.45);
}

.profitability-table tbody .profitability-sticky-product .row-select-btn {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.profitability-table tbody .profitability-sticky-product .row-select-btn > span:last-child {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profitability-table thead .profitability-sticky-product,
.profitability-table thead .profitability-sticky-article {
  z-index: 6;
  background: #fbfcfe;
}

.profitability-table tbody tr:hover > .profitability-sticky-product,
.profitability-table tbody tr:hover > .profitability-sticky-article {
  background: #fafcff;
}

.profitability-table tbody .selected-profit-row > .profitability-sticky-product,
.profitability-table tbody .selected-profit-row > .profitability-sticky-article {
  background: #eef6ff;
}

.row-select-btn {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.row-select-btn:hover span {
  color: var(--blue);
}

.selected-profit-row {
  background: #eef6ff;
}

.profitability-table tbody tr.profit-row-missing-cost > td {
  background: #fff2f2;
}

.profitability-table tbody tr.profit-row-missing-cost:hover > td {
  background: #fdeaea;
}

.profitability-cost-missing-note {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 7px;
  border: 1px solid #edcaca;
  border-radius: 999px;
  color: #704141;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
}

.profitability-table .profit-without-cost {
  color: var(--text);
}

.profitability-calculator-cost-warning {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #efcaca;
  border-radius: 8px;
  color: #713d3d;
  background: #fff2f2;
  font-size: 13px;
  line-height: 1.4;
}

.profitability-calculator-cost-warning.manual {
  border-color: #ead39c;
  color: #6f5515;
  background: #fff8e8;
}

.profit-calculator {
  align-self: start;
}

.profitability-calculator-view-switch {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #eef2f7;
}

.profitability-calculator-view-switch button {
  min-height: 38px;
  padding: 8px 18px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.profitability-calculator-view-switch button.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(31, 44, 61, 0.14);
}

.profitability-table-calculator-controls {
  margin-bottom: 14px;
  overflow: visible;
}

.profitability-table-calculator-actions {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.profitability-table-calculator-search {
  display: grid;
  gap: 5px;
  width: min(420px, 38vw);
  color: var(--muted);
  font-size: 12px;
}

.profitability-table-scenario-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) repeat(3, minmax(130px, 0.8fr)) minmax(180px, 1fr) minmax(150px, 0.8fr);
  align-items: end;
  gap: 12px;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
}

.profitability-table-scenario-controls .calculator-fbs-warehouse-control {
  grid-column: 1 / -1;
  max-width: 720px;
}

.profitability-table-scenario-field,
.profitability-table-extra-mode {
  min-width: 0;
}

.profitability-table-fallback-buyout small {
  min-height: 30px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.profitability-table-fallback-buyout.disabled {
  opacity: 0.72;
}

.profitability-calculator-help {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  color: #6d571c;
  background: #fff8e8;
}

.profitability-calculator-help-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  text-align: left;
  color: #6d571c;
}

.profitability-calculator-help-toggle:focus-visible {
  outline: 2px solid #8b691e;
  outline-offset: 3px;
}

.profitability-calculator-help-toggle-state {
  font-size: 12px;
  font-weight: 400;
}

.profitability-calculator-help-panel {
  font-size: 13px;
  line-height: 1.6;
}

.profitability-calculator-help-panel[hidden] {
  display: none;
}

.profitability-calculator-help-intro {
  max-width: 90ch;
  margin: 16px 0;
}

.profitability-calculator-help-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 40px;
  padding-left: 24px;
  margin: 0 0 8px;
}

.profitability-calculator-help-steps li {
  min-width: 0;
  padding-left: 4px;
}

.profitability-calculator-help-steps li::marker {
  font-weight: 700;
}

.profitability-calculator-help-steps h3 {
  margin: 0 0 8px;
  color: #574315;
  font-size: 14px;
}

.profitability-calculator-help-steps p {
  max-width: 80ch;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .profitability-calculator-help-steps {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.profitability-table-calculator-surface {
  min-width: 0;
}

.profitability-scenario-table-wrap {
  --profitability-product-column-width: 300px;
  --profitability-article-column-width: 132px;
  max-height: max(360px, calc(100vh - 455px));
}

.profitability-scenario-table {
  min-width: 2660px;
}

.profitability-scenario-table th,
.profitability-scenario-table td {
  min-width: 122px;
  width: 122px;
}

.profitability-scenario-table th:nth-child(1),
.profitability-scenario-table td:nth-child(1) {
  min-width: var(--profitability-product-column-width);
  width: var(--profitability-product-column-width);
}

.profitability-scenario-table th:nth-child(2),
.profitability-scenario-table td:nth-child(2) {
  min-width: var(--profitability-article-column-width);
  width: var(--profitability-article-column-width);
}

.profitability-scenario-table th:nth-child(11),
.profitability-scenario-table td:nth-child(11),
.profitability-scenario-table th:nth-child(12),
.profitability-scenario-table td:nth-child(12),
.profitability-scenario-table th:nth-child(13),
.profitability-scenario-table td:nth-child(13),
.profitability-scenario-table th:nth-child(5),
.profitability-scenario-table td:nth-child(5) {
  min-width: 190px;
  width: 190px;
}

.profitability-scenario-table .scenario-target-price-value {
  display: block;
  min-width: 0;
  width: 100%;
  min-height: 36px;
  padding: 6px 8px;
  color: var(--text);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1.25;
}

.scenario-target-price-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
}

.scenario-target-price-reset {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #f0b2ad;
  border-radius: 7px;
  color: #a6352e;
  background: #fff6f5;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.scenario-target-price-reset:hover {
  border-color: #d98179;
  background: #ffe9e7;
}

.profitability-price-select {
  position: absolute;
  top: 50%;
  left: 9px;
  z-index: 2;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  cursor: pointer;
}

.profitability-price-select input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.profitability-price-select span {
  display: block;
  width: 20px;
  height: 20px;
  border: 1px solid #b9c5d4;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(31, 44, 61, 0.08);
}

.profitability-price-select input:checked + span {
  border-color: var(--blue);
  background: var(--blue);
}

.profitability-price-select input:checked + span::after {
  content: "✓";
  display: grid;
  place-items: center;
  height: 100%;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.profitability-price-select.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.profitability-price-select input:indeterminate + span {
  border-color: var(--blue);
  background: var(--blue);
}

.profitability-price-select input:indeterminate + span::after {
  content: "−";
  display: grid;
  place-items: center;
  height: 100%;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
}

.profitability-price-select-all {
  left: 12px;
}

.profitability-scenario-table thead .profitability-sticky-product {
  padding-left: 42px;
}

.profitability-select-all-note {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.profitability-scenario-table .profitability-sticky-product .row-select-btn {
  padding-left: 30px;
}

.profitability-scenario-manual-price {
  background: #fff7f1;
}

.profitability-scenario-manual-price .scenario-target-price-value {
  border-color: #e5a76c;
  background: #fffdf9;
}

.profitability-table-export-error {
  margin: 12px 18px;
}

.profitability-scenario-table .row-select-btn {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.profitability-scenario-table .row-select-btn > span {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.profitability-scenario-table .row-select-btn strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profitability-scenario-table .profitability-cost-missing-note {
  width: fit-content;
  min-height: 20px;
  padding: 1px 6px;
  font-size: 10px;
}

.profitability-scenario-table tbody tr.profitability-scenario-no-movements > td {
  color: var(--muted);
}

/* Stable, semantic column grids: long content must not resize numeric columns. */
.profitability-table-wrap {
  --profitability-product-column-width: 320px;
  --profitability-article-column-width: 120px;
}

.profitability-scenario-table-wrap {
  --profitability-product-column-width: 300px;
  --profitability-article-column-width: 122px;
}

.profitability-table.profitability-main-table {
  width: 2695px;
  min-width: 2695px;
  table-layout: fixed;
}

.profitability-table.profitability-scenario-table {
  width: 2982px;
  min-width: 2982px;
  table-layout: fixed;
}

.profitability-table.profitability-main-table th,
.profitability-table.profitability-main-table td,
.profitability-table.profitability-scenario-table th,
.profitability-table.profitability-scenario-table td {
  width: auto;
  min-width: 0;
  max-width: none;
  padding: 8px 7px;
  border-right: 1px solid #e3e8ef;
  border-bottom: 1px solid #e3e8ef;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profitability-table.profitability-main-table thead th,
.profitability-table.profitability-scenario-table thead th {
  height: 60px;
  color: #5b6b82;
  background: #f7f9fc;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.15;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  vertical-align: middle;
}

.profitability-main-table col.profitability-col-product { width: 320px; }
.profitability-main-table col.profitability-col-article { width: 120px; }
.profitability-main-table col.profitability-col-price { width: 105px; }
.profitability-main-table col.profitability-col-orders { width: 72px; }
.profitability-main-table col.profitability-col-buyout-rate { width: 92px; }
.profitability-main-table col.profitability-col-buyouts { width: 78px; }
.profitability-main-table col.profitability-col-cancellations { width: 88px; }
.profitability-main-table col.profitability-col-returns { width: 82px; }
.profitability-main-table col.profitability-col-pending { width: 118px; }
.profitability-main-table col.profitability-col-gmv { width: 110px; }
.profitability-main-table col.profitability-col-realized-price { width: 138px; }
.profitability-main-table col.profitability-col-tax-base { width: 130px; }
.profitability-main-table col.profitability-col-cost { width: 110px; }
.profitability-main-table col.profitability-col-commission { width: 132px; }
.profitability-main-table col.profitability-col-logistics { width: 118px; }
.profitability-main-table col.profitability-col-storage { width: 105px; }
.profitability-main-table col.profitability-col-acquiring { width: 112px; }
.profitability-main-table col.profitability-col-other { width: 102px; }
.profitability-main-table col.profitability-col-ads { width: 105px; }
.profitability-main-table col.profitability-col-drr { width: 92px; }
.profitability-main-table col.profitability-col-taxes { width: 110px; }
.profitability-main-table col.profitability-col-profit-unit { width: 128px; }
.profitability-main-table col.profitability-col-profit-total { width: 128px; }

.profitability-scenario-table col.profitability-col-product { width: 300px; }
.profitability-scenario-table col.profitability-col-article { width: 122px; }
.profitability-scenario-table col.profitability-col-buyouts { width: 76px; }
.profitability-scenario-table col.profitability-col-live-price { width: 184px; }
.profitability-scenario-table col.profitability-col-target-price { width: 184px; }
.profitability-scenario-table col.profitability-col-buyout-rate { width: 100px; }
.profitability-scenario-table col.profitability-col-drr { width: 96px; }
.profitability-scenario-table col.profitability-col-acquiring { width: 118px; }
.profitability-scenario-table col.profitability-col-cost { width: 104px; }
.profitability-scenario-table col.profitability-col-fact-profit { width: 112px; }
.profitability-scenario-table col.profitability-col-fact-net-rate { width: 104px; }
.profitability-scenario-table col.profitability-col-commission { width: 136px; }
.profitability-scenario-table col.profitability-col-volume { width: 180px; }
.profitability-scenario-table col.profitability-col-warehouse { width: 112px; }
.profitability-scenario-table col.profitability-col-localization { width: 72px; }
.profitability-scenario-table col.profitability-col-logistics { width: 112px; }
.profitability-scenario-table col.profitability-col-extra { width: 112px; }
.profitability-scenario-table col.profitability-col-margin { width: 116px; }
.profitability-scenario-table col.profitability-col-net-profit { width: 116px; }
.profitability-scenario-table col.profitability-col-profit-unit { width: 126px; }
.profitability-scenario-table col.profitability-col-quality { width: 240px; }
.profitability-scenario-table col.profitability-col-scenario-storage { width: 160px; }
.profitability-scenario-table col.profitability-col-scenario-other { width: 180px; }

.profitability-main-table tbody .profitability-sticky-product .row-select-btn > span:last-child,
.profitability-scenario-table .row-select-btn strong {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.profitability-main-table td:nth-child(11) .cell-source,
.profitability-main-table td:nth-child(14) .cell-source,
.profitability-main-table td:nth-child(22) .cell-source,
.profitability-main-table td:nth-child(23) .cell-source,
.profitability-scenario-table td:nth-child(4) .cell-source,
.profitability-scenario-table td:nth-child(5) .cell-source,
.profitability-scenario-table td:nth-child(12) .cell-source,
.profitability-scenario-table td:nth-child(13) .cell-source,
.profitability-scenario-table td:nth-child(21) .cell-source {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.profitability-scenario-table td:nth-child(21) {
  line-height: 1.25;
  white-space: normal;
}

.profitability-heat-legend {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  color: #475569;
  font-size: 11px;
  line-height: 1.2;
}

.profitability-heat-legend > span {
  width: 18px;
  height: 12px;
  border: 1px solid rgba(71, 85, 105, 0.12);
  border-radius: 3px;
}

.profitability-heat-legend > span.positive { background: #c9e9d1; }
.profitability-heat-legend > span.negative { background: #f7cec8; }
.profitability-heat-legend strong { color: #334155; }
.profitability-heat-legend small { margin-left: 3px; }

.profitability-table td.profitability-heat-cell {
  color: #1f2937;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.profitability-table td.profitability-heat-positive {
  background-color: rgba(43, 166, 91, var(--profitability-heat-alpha));
  box-shadow: inset 3px 0 0 #269452;
}

.profitability-table td.profitability-heat-negative {
  background-color: rgba(223, 73, 65, var(--profitability-heat-alpha));
  box-shadow: inset 3px 0 0 #cf4039;
}

.profitability-table td.profitability-heat-neutral {
  background-color: #f7f8fa;
  box-shadow: inset 3px 0 0 #aeb7c4;
}

.profitability-table td.profitability-heat-cell .cell-source {
  color: #475569;
  font-weight: 600;
  opacity: 0.88;
}

.profitability-table td.profitability-heat-cell .profit-positive,
.profitability-table td.profitability-heat-cell .profit-negative {
  color: inherit;
}

@media (forced-colors: active) {
  .profitability-table td.profitability-heat-cell {
    background: Canvas;
    box-shadow: inset 3px 0 0 CanvasText;
    color: CanvasText;
  }
}

.profitability-main-layout,
.profit-calculator-workspace {
  min-width: 0;
}

.profit-calculator-workspace {
  overflow: visible;
}

.calculator-empty-picker {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.calculator-empty-picker > .calculator-product-select {
  width: 100%;
  max-width: 520px;
}

.profit-calculator-product-band {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.calculator-product-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.calculator-product-summary > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.calculator-product-summary strong,
.calculator-product-summary small {
  overflow-wrap: anywhere;
}

.calculator-product-select {
  width: min(520px, 48%);
  flex: 0 1 520px;
}

.calculator-compare-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.calculator-product-picker {
  position: relative;
}

.calculator-picker-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 6px;
}

.calculator-picker-filter-bar .btn {
  min-height: 30px;
  padding: 3px 0;
  border: 0;
  font-size: 12px;
}

.calculator-picker-filters {
  display: grid;
  gap: 12px;
  padding: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.calculator-picker-sort,
.calculator-picker-ranges {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.calculator-picker-ranges {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.calculator-picker-filters .field,
.calculator-picker-ranges fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.calculator-picker-filters .field > span,
.calculator-picker-ranges legend,
.calculator-picker-filters > small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.calculator-picker-ranges legend {
  margin-bottom: 5px;
}

.calculator-picker-ranges fieldset > div {
  display: grid;
  gap: 6px;
}

.calculator-picker-filters .input,
.calculator-picker-filters .select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 6px 8px;
  font-size: 13px;
}

.calculator-picker-filter-error {
  margin-top: 8px;
  color: #b42318;
  font-size: 12px;
}

.calculator-picker-result-count {
  padding: 6px 8px;
  color: var(--muted);
  font-size: 12px;
}

.calculator-picker-more {
  width: 100%;
  margin-top: 4px;
}

@media (max-width: 420px) {
  .calculator-picker-sort {
    grid-template-columns: minmax(0, 1fr);
  }
}

.calculator-product-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 6px;
}

.calculator-product-search-row .icon-btn {
  width: 38px;
  height: 38px;
  font-size: 20px;
}

.calculator-product-options {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 20;
  max-height: min(70vh, 600px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.calculator-product-option {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.calculator-product-option:hover,
.calculator-product-option.selected {
  background: #eef7ff;
}

.calculator-product-option > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.calculator-product-option strong,
.calculator-product-option small {
  overflow-wrap: anywhere;
}

.calculator-product-option small,
.calculator-product-empty {
  color: var(--muted);
  font-size: 12px;
}

.calculator-product-empty {
  padding: 14px;
  text-align: center;
}

.calculator-auto-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.calculator-auto-grid > div {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 94px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.calculator-auto-grid span,
.calculator-result-panel > span,
.calculator-result-stats span,
.calculator-breakdown-grid span {
  color: var(--muted);
  font-size: 12px;
}

.calculator-auto-grid strong {
  font-size: 16px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.calculator-auto-grid small,
.calculator-breakdown-grid small {
  color: var(--muted);
  line-height: 1.35;
}

.calculator-spp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: #f4f9f6;
}

.calculator-spp-grid > div {
  display: grid;
  gap: 4px;
  min-height: 92px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.calculator-spp-grid span,
.calculator-spp-grid small {
  color: var(--muted);
  font-size: 12px;
}

.calculator-spp-grid strong {
  font-size: 19px;
}

.calculator-auto-grid > .calculator-widget-is-loading,
.calculator-spp-grid > .calculator-widget-is-loading {
  background: #f8fbfa;
}

.calculator-auto-grid .calculator-widget-loader,
.calculator-spp-grid .calculator-widget-loader {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.calculator-widget-loader .page-loading-spinner {
  width: 18px;
  height: 18px;
}

.calculator-status {
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.calculator-status.error {
  color: #9b3a3a;
  background: #fff7f7;
}

.calculator-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  border-bottom: 1px solid var(--line);
}

.calculator-input-panel {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.calculator-scenario-inputs {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 14px;
  padding: 18px;
}

.calculator-scale-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 18px 0;
}

.calculator-storage-override {
  display: grid;
  gap: 7px;
  padding: 0 18px 18px;
}

.calculator-storage-override .field {
  width: min(100%, 280px);
}

.calculator-storage-override > small {
  color: var(--muted);
  line-height: 1.4;
}

.calculator-storage-override input[aria-invalid="true"] {
  border-color: #c73737;
}

.calculator-commission-control {
  display: grid;
  gap: 5px;
}

.calculator-commission-control > span,
.calculator-commission-control > small {
  color: var(--muted);
  font-size: 12px;
}

.calculator-fbs-warehouse-control {
  display: grid;
  flex: 1 1 360px;
  gap: 5px;
  min-width: min(360px, 100%);
  max-width: 620px;
}

.calculator-fbs-warehouse-control > label {
  display: grid;
  gap: 5px;
}

.calculator-fbs-warehouse-control span,
.calculator-fbs-warehouse-control > small {
  color: var(--muted);
  font-size: 12px;
}

.calculator-fbs-warehouse-control .select {
  width: 100%;
}

.calculator-fbs-warehouse-message {
  color: #9a5d00 !important;
}

.calculator-result-panel {
  display: grid;
  align-content: center;
  gap: 10px;
  min-width: 0;
  padding: 20px;
  background: #f7fafc;
}

.calculator-price-apply-action,
.calculator-price-apply-readonly {
  display: grid;
  gap: 7px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.calculator-price-apply-action small,
.calculator-price-apply-readonly small {
  color: var(--muted);
  line-height: 1.35;
}

.calculator-price-apply-readonly {
  padding: 12px;
  border: 1px solid #ecd49d;
  border-radius: 8px;
  background: #fff8e8;
}

.profitability-price-apply-modal {
  width: min(1120px, 100%);
}

.profitability-price-apply-modal .calculator-status {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 0;
  border: 0;
}

.price-apply-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: var(--surface-soft);
}

.price-apply-summary span,
.price-apply-more {
  color: var(--muted);
  font-size: 12px;
}

.price-apply-table-wrap {
  max-height: min(460px, calc(100vh - 330px));
  overflow: auto;
  border: 1px solid var(--line);
  border-top: 0;
}

.price-apply-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.price-apply-table th,
.price-apply-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.price-apply-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #fbfcfe;
  font-size: 12px;
}

.price-apply-table td {
  font-variant-numeric: tabular-nums;
}

.price-apply-table td:first-child {
  min-width: 240px;
}

.price-apply-table td strong,
.price-apply-table td small {
  display: block;
}

.price-apply-table td small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.3;
}

.price-apply-table .price-apply-blocked td {
  background: #fff4f3;
}

.price-apply-status {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 999px;
  color: #6a5318;
  background: #fff0c4;
  font-size: 11px;
  font-weight: 800;
}

.price-apply-status.submitted {
  color: #2d6b20;
  background: #e9f8e5;
}

.price-apply-more {
  margin: 8px 0 0;
}

.price-apply-confirmation {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid #efc2bf;
  border-radius: 8px;
  color: #7c2d28;
  background: #fff4f3;
}

.price-apply-confirmation span {
  font-size: 13px;
}

.price-apply-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.calculator-profit-value {
  font-size: 36px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.calculator-profit-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.calculator-profit-summary > div {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

.calculator-profit-summary span {
  color: var(--muted);
  font-size: 13px;
}

.calculator-profit-summary .calculator-profit-value {
  font-size: clamp(24px, 2.2vw, 36px);
}

.calculator-profit-percent {
  font-size: 18px;
}

.calculator-active-buyer-price {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, auto);
  align-items: end;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.calculator-active-buyer-price > div {
  display: grid;
  gap: 4px;
}

.calculator-active-buyer-price strong {
  font-size: 24px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.calculator-active-buyer-price small {
  color: var(--muted);
  text-align: right;
}

.calculator-result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.calculator-result-stats > div,
.calculator-breakdown-grid > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.calculator-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
}

.calculator-breakdown-grid > div {
  min-height: 78px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.calculator-breakdown-grid strong {
  font-size: 17px;
  overflow-wrap: anywhere;
}

.calculator-model-comparison {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.calculator-comparison-head {
  border-bottom: 1px solid var(--line);
}

.calculator-comparison-table-wrap {
  overflow-x: auto;
}

.calculator-comparison-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  table-layout: fixed;
}

.calculator-comparison-table th,
.calculator-comparison-table td {
  padding: 10px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
}

.calculator-comparison-table th:first-child,
.calculator-comparison-table td:first-child {
  width: 34%;
  color: var(--muted);
  text-align: left;
}

.calculator-comparison-table th {
  background: #f7fafc;
  color: var(--text);
  font-size: 13px;
}

.calculator-comparison-profit td {
  background: #f4f9f6;
  font-size: 17px;
  font-weight: 700;
}

.calculator-comparison-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 11px 16px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1180px) {
  .profitability-table-scenario-controls {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .calculator-auto-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .calculator-main-grid {
    grid-template-columns: 1fr;
  }

  .calculator-input-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .profitability-calculator-view-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .profitability-calculator-view-switch button {
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
  }

  .profitability-table-calculator-controls .module-head,
  .profitability-table-calculator-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .profitability-table-calculator-search {
    width: 100%;
  }

  .profitability-table-scenario-controls {
    grid-template-columns: 1fr;
  }

  .profitability-scenario-table-wrap {
    --profitability-product-column-width: 300px;
    --profitability-article-column-width: 122px;
  }

  .profit-calculator-product-band {
    align-items: stretch;
    flex-direction: column;
  }

  .calculator-compare-button {
    width: 100%;
  }

  .calculator-product-select {
    width: 100%;
  }

  .profit-scale-control,
  .calculator-scale-row .profit-scale-control {
    align-items: stretch;
    flex-direction: column;
  }

  .profit-mode-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .calculator-commission-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calculator-commission-control {
    width: 100%;
  }

  .calculator-fbs-warehouse-control {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .profit-mode-switch .ads-period-chip {
    min-width: 0;
    white-space: normal;
  }

  .profit-batch-field {
    width: 100% !important;
  }

  .calculator-auto-grid,
  .calculator-spp-grid,
  .calculator-scenario-inputs,
  .calculator-breakdown-grid {
    grid-template-columns: 1fr;
  }

  .calculator-result-stats {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
  }

  .calculator-active-buyer-price {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .calculator-active-buyer-price small {
    text-align: left;
  }

  .calculator-comparison-table {
    min-width: 0;
  }

  .calculator-comparison-table th,
  .calculator-comparison-table td {
    padding: 9px 8px;
    overflow-wrap: anywhere;
  }

  .calculator-comparison-table th:first-child,
  .calculator-comparison-table td:first-child {
    width: 38%;
  }

  .calculator-profit-value {
    font-size: 30px;
  }
}

.cost-upload-panel {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.cost-upload-panel input {
  display: none;
}

.cost-upload-panel span {
  color: var(--muted);
  font-size: 13px;
}

.compact-number-field {
  width: 130px;
}

.compact-number-field .input {
  height: 34px;
}

.profit-settings-panel {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.profit-settings-panel .field {
  width: 230px;
}

.profit-tax-control {
  display: flex;
  align-items: center;
  gap: 9px;
}

.profit-tax-control > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.profit-scale-control {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.profit-batch-field {
  width: 150px !important;
}

.calculator-scale-row .profit-scale-control {
  align-items: center;
}

.calculator-scale-row .profit-batch-field {
  margin: 0;
}

.profit-mode-switch {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.profit-settings-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.selected-profit-product {
  display: grid;
  gap: 4px;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--line);
}

.selected-profit-product span,
.selected-profit-product small,
.profit-note {
  color: var(--muted);
}

.selected-profit-product strong {
  line-height: 1.25;
}

.profit-source-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

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

.profit-field {
  min-width: 0;
}

.input-suffix {
  position: relative;
}

.input-suffix .input {
  width: 100%;
  height: 34px;
  padding-right: 34px;
}

.input-suffix em {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  pointer-events: none;
}

.profit-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.profit-result-grid div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.profit-result-grid span {
  color: var(--muted);
  font-size: 12px;
}

.profit-result-grid strong {
  font-size: 16px;
}

.price-test-box {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.price-test-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
  align-items: start;
}

.price-test-head h3 {
  margin: 0 0 4px;
}

.price-test-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.price-test-head .field {
  min-width: 0;
}

.price-scenario-table-wrap {
  overflow-x: auto;
}

.price-scenario-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 12px;
}

.price-scenario-table th,
.price-scenario-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.price-scenario-table th {
  color: var(--muted);
  font-weight: 700;
}

.price-scenario-table tr.current {
  background: #eef6ff;
}

.profit-positive {
  color: #34720f;
}

.profit-negative {
  color: var(--red);
}

.formula-box {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.formula-box span {
  color: var(--muted);
  line-height: 1.4;
}

.roadmap-panel {
  padding: 18px;
}

.roadmap-panel h2 {
  margin: 0 0 14px;
}

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

.roadmap-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.roadmap-item span {
  color: var(--muted);
  line-height: 1.4;
}

.redistribution-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  margin-bottom: 16px;
}

.redistribution-main,
.redistribution-side,
.redistribution-section {
  padding: 16px;
}

.redistribution-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.redistribution-search {
  grid-column: span 2;
}

.redistribution-span {
  grid-column: span 2;
}

.redistribution-form .field small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.redistribution-login-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #ffb52e;
  border-radius: 8px;
  background: #fff8e8;
}

.redistribution-login-card strong,
.redistribution-login-card span {
  display: block;
}

.redistribution-login-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.redistribution-login-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.redistribution-picker-placeholder {
  display: block;
  min-width: 0;
  min-height: 72px;
  padding: 10px 38px 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  position: relative;
}

.redistribution-picker-placeholder::after {
  content: "⌄";
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-55%);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.redistribution-picker-placeholder:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.redistribution-picker-placeholder span,
.redistribution-picker-placeholder strong {
  display: block;
}

.redistribution-picker-placeholder span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.redistribution-picker-placeholder strong {
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.redistribution-selected {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.redistribution-selected strong,
.redistribution-selected span {
  display: block;
}

.redistribution-selected span {
  color: var(--muted);
  font-size: 12px;
}

.redistribution-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 250px;
  overflow: auto;
  margin-top: 10px;
  padding-right: 4px;
}

.redistribution-result {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  text-align: left;
}

.redistribution-result.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.redistribution-result strong,
.redistribution-result small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.redistribution-result small {
  color: var(--muted);
  font-size: 12px;
}

.redistribution-result em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.redistribution-priority {
  align-self: end;
  min-height: 42px;
}

.redistribution-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.redistribution-side h2 {
  margin: 0 0 12px;
}

.redistribution-checklist {
  display: grid;
  gap: 8px;
}

.redistribution-journal-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.redistribution-journal-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.redistribution-journal-tab.active {
  background: #ffb52e;
  color: var(--text);
}

.redistribution-journal-tab strong {
  color: inherit;
}

.redistribution-queue {
  display: grid;
  gap: 8px;
}

.redistribution-request {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.redistribution-request strong,
.redistribution-request span,
.redistribution-request small {
  display: block;
}

.redistribution-request span,
.redistribution-request small {
  color: var(--muted);
  font-size: 12px;
}

.redistribution-debug-line {
  margin-top: 3px;
  color: #8a4b00 !important;
}

.redistribution-request-status {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.redistribution-section {
  margin-bottom: 16px;
}

.redistribution-table-wrap {
  max-height: 430px;
}

.redistribution-product {
  display: grid;
  grid-template-columns: 42px minmax(220px, 1fr);
  gap: 10px;
  align-items: center;
}

.small-thumb {
  width: 36px;
  height: 46px;
}

.redistribution-table th,
.redistribution-table td {
  white-space: nowrap;
}

.redistribution-table th:first-child,
.redistribution-table td:first-child {
  min-width: 330px;
  white-space: normal;
}

.redistribution-limit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.redistribution-limit-grid > div {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.redistribution-limit-grid span {
  color: var(--muted);
  line-height: 1.35;
}

.products-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.products-grid {
  grid-template-columns: minmax(720px, 1fr) 340px;
}

.products-controls {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 220px auto auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.products-section-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 12px;
  padding: 3px;
  overflow-x: auto;
  border-radius: 7px;
  background: #e9edf2;
}

.products-section-tab {
  min-height: 34px;
  padding: 7px 14px;
  color: var(--muted);
  background: transparent;
  border-radius: 5px;
  font-weight: 700;
  white-space: nowrap;
}

.products-section-tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(30, 41, 59, 0.12);
}

.price-index-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.price-index-ozon-widget {
  margin-bottom: 12px;
  border: 1px solid #cfd8e5;
  border-left: 4px solid #2f80d9;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.price-index-ozon-widget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid #e2e7ee;
}

.price-index-ozon-widget-head > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.price-index-ozon-widget-head strong {
  font-size: 16px;
}

.price-index-ozon-widget-head span,
.price-index-ozon-widget-head small {
  color: var(--muted);
  font-size: 12px;
}

.price-index-ozon-bands {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.price-index-ozon-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 10px;
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid #e2e7ee;
}

.price-index-ozon-band:last-child {
  border-right: 0;
}

.price-index-ozon-band span {
  overflow: hidden;
  color: #3b4553;
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.price-index-ozon-band b {
  display: grid;
  grid-row: span 2;
  justify-items: end;
  font-size: 22px;
}

.price-index-ozon-band b em {
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
}

.price-index-ozon-band small {
  color: var(--muted);
  font-size: 10px;
}

.price-index-ozon-band.super { background: #edf7f1; color: #236544; }
.price-index-ozon-band.favorable { background: #f3f8ed; color: #4b6f35; }
.price-index-ozon-band.moderate { background: #fbf8e9; color: #7a6219; }
.price-index-ozon-band.unfavorable { background: #fbefee; color: #8b433d; }
}

.price-index-job {
  display: grid;
  gap: 9px;
  margin-bottom: 12px;
  padding: 13px 14px;
  border: 1px solid #b8d1ed;
  border-radius: 8px;
  background: #f2f7fd;
}

.price-index-job.success {
  border-color: #bdddc7;
  background: #f2f9f4;
}

.price-index-job.error {
  border-color: #efc1bd;
  background: #fff4f3;
}

.price-index-job-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.price-index-job-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.price-index-job-head span,
.price-index-job small {
  color: var(--muted);
  font-size: 12px;
}

.price-index-surface {
  overflow: hidden;
}

.read-only-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid #b8d1ed;
  border-radius: 6px;
  color: #285f99;
  background: #eef6ff;
  font-size: 12px;
  font-weight: 800;
}

.price-index-controls {
  display: grid;
  grid-template-columns: minmax(230px, 1.6fr) repeat(4, minmax(135px, 0.7fr)) repeat(3, auto);
  gap: 10px;
  align-items: end;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.price-index-controls .field {
  min-width: 0;
}

.price-index-sync-button {
  min-height: 42px;
  white-space: nowrap;
}

.price-index-table-wrap {
  max-height: calc(100vh - 410px);
  min-height: 260px;
}

.price-index-table {
  min-width: 1700px;
}

.price-index-table th,
.price-index-table td {
  padding: 8px 9px;
  vertical-align: middle;
  white-space: nowrap;
}

.price-index-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fbfcfe;
}

.price-index-table th:nth-child(1),
.price-index-table td:nth-child(1) { width: 58px; }
.price-index-table th:nth-child(2),
.price-index-table td:nth-child(2) { width: 175px; }
.price-index-table th:nth-child(3),
.price-index-table td:nth-child(3) { width: 270px; max-width: 270px; }
.price-index-table th:nth-child(4),
.price-index-table td:nth-child(4),
.price-index-table th:nth-child(5),
.price-index-table td:nth-child(5) { width: 115px; }
.price-index-table th:nth-child(6),
.price-index-table td:nth-child(6) { width: 150px; }
.price-index-table th:nth-child(7),
.price-index-table td:nth-child(7),
.price-index-table th:nth-child(8),
.price-index-table td:nth-child(8) { width: 112px; }
.price-index-table th:nth-child(9),
.price-index-table td:nth-child(9),
.price-index-table th:nth-child(10),
.price-index-table td:nth-child(10) { width: 105px; text-align: right; }
.price-index-table th:nth-child(11),
.price-index-table td:nth-child(11),
.price-index-table th:nth-child(12),
.price-index-table td:nth-child(12) { width: 125px; text-align: right; }
.price-index-table th:nth-child(13),
.price-index-table td:nth-child(13) { width: 135px; }

.price-index-photo {
  width: 38px;
  height: 46px;
  object-fit: contain;
  background: #fff;
}

.price-index-match,
.price-index-source,
.price-index-margin small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.price-index-match.matched { color: #28704a; }
.price-index-match.conflict { color: #a13a31; }

.price-index-name {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.price-index-name > a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.price-index-name > span {
  display: flex;
  gap: 8px;
  font-size: 11px;
}

.price-index-name > span a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.price-index-links {
  display: grid;
  gap: 3px;
  max-height: 180px;
  max-width: 260px;
  overflow-y: auto;
  white-space: normal;
}

.price-index-links a {
  display: block;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-decoration: none;
  white-space: normal;
}

.price-index-links small {
  color: var(--muted);
  font-size: 10px;
}

.price-index-pi {
  display: inline;
  color: #626b78;
  font-size: 13px;
  font-weight: 800;
}

.price-index-pi.super { color: #1f6b47; }
.price-index-pi.favorable { color: #39754f; }
.price-index-pi.moderate { color: #806116; }
.price-index-pi.unfavorable { color: #93473f; }

.price-index-margin {
  font-weight: 800;
}

.price-index-margin.positive { color: #286344; }
.price-index-margin.negative { color: #a13a31; }

.price-index-unavailable,
.price-index-freshness {
  color: var(--muted);
  font-size: 12px;
}

.price-index-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.products-import {
  display: flex;
  align-items: center;
  gap: 8px;
}

.products-import input {
  display: none;
}

.products-full-index-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.products-full-index-panel strong,
.products-full-index-panel span {
  display: block;
}

.products-full-index-panel span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.products-glue-job-panel {
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.products-glue-job-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 14px;
}

.products-glue-job-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.products-glue-job-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.products-glue-job-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.products-glue-job-status.active {
  color: #285d87;
  background: #e7f2fb;
}

.products-glue-job-status.success {
  color: #336b14;
  background: #edf7e5;
}

.products-glue-job-status.warning {
  color: #7a4b00;
  background: #fff4d8;
}

.products-glue-job-status.error {
  color: #a33535;
  background: #fbe9e8;
}

.products-glue-progress {
  padding: 0 14px 14px;
}

.products-glue-progress .progress {
  height: 22px;
}

.products-glue-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.products-glue-metrics > div {
  min-width: 0;
  padding: 10px 14px;
  border-right: 1px solid var(--line);
}

.products-glue-metrics > div:last-child {
  border-right: 0;
}

.products-glue-metrics span,
.products-glue-metrics strong {
  display: block;
}

.products-glue-metrics span {
  color: var(--muted);
  font-size: 11px;
}

.products-glue-metrics strong {
  margin-top: 3px;
  font-size: 14px;
}

.products-glue-job-panel > .form-message {
  margin: 12px 14px 0;
}

.products-glue-verification {
  margin: 12px 14px 0;
  padding: 9px 10px;
  border-radius: 6px;
  color: #285d4b;
  background: #eaf5ef;
  font-size: 13px;
  font-weight: 650;
}

.products-glue-verification.mismatch,
.products-glue-verification.error {
  color: #7a4b00;
  background: #fff4d8;
}

.products-glue-journal {
  max-height: 190px;
  overflow: auto;
  padding: 8px 14px 12px;
}

.products-glue-log {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.products-glue-log:last-child {
  border-bottom: 0;
}

.products-glue-log span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.products-glue-log time {
  color: var(--muted);
  white-space: nowrap;
}

.products-glue-log.warning span {
  color: #7a4b00;
}

.products-glue-log.error span {
  color: var(--red);
}

.products-table-wrap {
  max-height: 590px;
}

.products-table th,
.products-table td {
  white-space: nowrap;
}

.products-table th:nth-child(1),
.products-table td:nth-child(1) {
  width: 280px;
}

.products-table th:nth-child(2),
.products-table td:nth-child(2),
.products-table th:nth-child(8),
.products-table td:nth-child(8),
.products-table th:nth-child(9),
.products-table td:nth-child(9),
.products-table th:nth-child(10),
.products-table td:nth-child(10),
.products-table th:nth-child(12),
.products-table td:nth-child(12) {
  width: 96px;
}

.products-table th:nth-child(5),
.products-table td:nth-child(5) {
  width: 160px;
  max-width: 180px;
}

.products-table th:nth-child(6),
.products-table td:nth-child(6) {
  width: 132px;
}

.products-table th:nth-child(7),
.products-table td:nth-child(7) {
  width: 136px;
}

.products-table th:nth-child(11),
.products-table td:nth-child(11) {
  width: 145px;
}

.products-table th:nth-child(13),
.products-table td:nth-child(13) {
  width: 260px;
}

.products-table tr.selected-row td {
  background: #f1f7ff;
}

.product-catalog-product {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.product-catalog-thumb-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 42px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
}

.product-catalog-thumb-button:hover .thumb {
  border-color: var(--accent);
}

.product-catalog-product span {
  min-width: 0;
}

.product-catalog-product strong,
.product-catalog-link,
.product-catalog-product small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-catalog-link {
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.product-catalog-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.product-catalog-product small {
  margin-top: 3px;
  color: var(--muted);
}

.product-campaign-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  padding: 5px 8px;
  border: 1px solid #d0d5dd;
  border-radius: 999px;
  background: #f4f5f7;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.product-campaign-status.none {
  border-color: #d6dbe3;
  background: #f5f6f8;
  color: #667085;
}

.product-campaign-status.stopped {
  border-color: #ecd59d;
  background: #fff7e6;
  color: #806000;
}

.product-campaign-status.running {
  border-color: #b9dfc8;
  background: #eaf7ef;
  color: #2f6b45;
}

.product-campaign-status.unknown {
  border-color: #d7d0df;
  background: #f5f2f8;
  color: #665b72;
}

.product-stock-cell {
  display: grid;
  gap: 3px;
  min-width: 112px;
  line-height: 1.12;
}

.product-stock-cell strong,
.product-stock-cell small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-stock-cell strong {
  font-size: 13px;
  font-weight: 800;
}

.product-stock-cell small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.product-stock-cell.stock-ok strong {
  color: #2f6b45;
}

.product-stock-cell.stock-empty strong {
  color: #b42318;
}

.product-stock-cell.stock-unknown strong {
  color: #667085;
}

.description-preview {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.products-editor {
  align-self: start;
}

.products-editor-head {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.products-editor-head strong,
.products-editor-head span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.products-editor-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.large-thumb {
  width: 52px;
  height: 68px;
}

.product-description-textarea {
  min-height: 170px;
  resize: vertical;
}

.products-group-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 10px 0 4px;
}

.product-table th:nth-child(1),
.product-table td:nth-child(1),
.campaign-table th:nth-child(1),
.campaign-table td:nth-child(1) {
  width: 42px;
}

.product-table th:nth-child(2),
.product-table td:nth-child(2) {
  width: 46%;
}

.campaign-table th:nth-child(4),
.campaign-table td:nth-child(4) {
  width: 32%;
}

.live-table th:nth-child(1),
.live-table td:nth-child(1) {
  width: 28%;
}

.empty-state {
  display: grid;
  gap: 5px;
  padding: 18px;
  text-align: center;
}

.empty-state span {
  color: var(--muted);
}

.action-empty {
  justify-items: center;
  gap: 10px;
}

.api-panel {
  display: grid;
  gap: 18px;
  width: 100%;
  min-width: 0;
  max-width: 1440px;
  padding: 22px;
}

.api-settings-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  max-width: 1440px;
  margin-bottom: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.api-settings-nav a {
  padding: 8px 10px;
  color: var(--text);
  text-decoration: none;
  border-radius: 4px;
}

.api-settings-nav a:hover,
.api-settings-nav a:focus-visible {
  background: var(--surface-soft);
  color: #2363a0;
}

.api-panel [id] {
  scroll-margin-top: 20px;
}

.api-panel > *,
.api-panel .settings-card,
.api-panel .api-form,
.api-panel .field,
.api-panel .summary-line > *,
.api-panel .user-card {
  min-width: 0;
  max-width: 100%;
}

.api-panel .settings-grid.api-access-sections {
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
}

.api-access-sections > .settings-card {
  padding: 20px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.api-marketplace-settings {
  display: grid;
  gap: 18px;
}

.api-panel .form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.api-panel .role-preset-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
}

.api-panel .check-pill {
  min-width: 0;
  max-width: 100%;
  padding-top: 6px;
  padding-bottom: 6px;
}

.api-panel .check-pill input {
  flex: 0 0 16px;
}

.api-panel .check-pill span,
.api-panel .summary-line strong,
.api-panel .btn,
.api-panel .user-access-summary dd,
.api-panel .user-identity {
  overflow-wrap: anywhere;
}

.api-panel .user-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: flex-start;
}

.user-identity {
  flex: 1 1 220px;
  min-width: 0;
}

.user-login {
  display: block;
  margin-top: 3px;
  font-size: 13px;
}

.user-account-status {
  display: grid;
  flex: 0 1 180px;
  gap: 4px;
  font-size: 13px;
}

.api-panel .user-actions {
  max-width: 100%;
  margin-left: auto;
}

.user-access-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 24px;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.user-access-summary > div {
  min-width: 0;
}

.user-access-summary dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.user-access-summary dd {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .api-panel .user-access-summary {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .api-panel .form-grid.two {
    grid-template-columns: minmax(0, 1fr);
  }

  .api-panel .user-actions {
    flex-basis: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
}

.marketplace-api-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
}

.wb-api-panel {
  border-left-color: #d883a6;
  background: #fff8fb;
}

.ozon-api-panel {
  border-left-color: #4e91dc;
  background: #f6faff;
}

.ozon-api-panel .api-status {
  border-color: #bad3ef;
  background: #edf5ff;
}

.ozon-api-panel .api-status.ready {
  border-color: #acd2bd;
  background: #eff9f2;
}

.ozon-credentials-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.6fr) minmax(320px, 1.4fr);
  gap: 12px;
}

.marketplace-credential-input {
  border-color: #afc9e7;
  background: #fff;
}

.ozon-api-panel .token-input.compact {
  min-height: 74px;
}

.ozon-performance-profitability-panel {
  margin-bottom: 12px;
}

.ozon-performance-profitability-panel .button-row > span,
.ozon-performance-profitability-panel > .muted-text {
  color: var(--muted);
  font-size: 13px;
}

.compact-summary {
  gap: 0;
}

.api-status {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  background: var(--amber-soft);
}

.api-status.ready {
  border-color: #b7e892;
  background: #f1fbe9;
}

.api-status.ready .info-dot {
  border-color: var(--green);
  color: var(--green);
}

.api-status p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.api-form {
  display: grid;
  gap: 14px;
}

.marketplace-credentials-group {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.marketplace-credentials-group legend {
  padding: 0 6px;
  color: var(--text);
  font-weight: 750;
}

.shop-marketplace-segment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.shop-marketplace-option {
  min-height: 42px;
  padding: 8px 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 700;
}

.shop-marketplace-option:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.shop-marketplace-option.active {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #b8d7fb;
}

.soft-note .error-text {
  color: var(--red);
  font-weight: 700;
}

.telegram-chat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.token-input.compact {
  min-height: 86px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr);
  gap: 18px;
}

.settings-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.security-card {
  margin: 18px 0;
}

.security-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
}

.modal-card {
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  overflow: auto;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.modal-head h2 {
  margin: 0 0 5px;
  font-size: 22px;
}

.modal-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.password-modal .api-form {
  margin: 0;
}

.codex-modal {
  width: min(680px, 100%);
}

.codex-security-note {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 12px 14px;
  color: #31442d;
  background: #f2f7ef;
  border-left: 3px solid #759b69;
}

.codex-security-note span,
.codex-restart-note {
  color: var(--muted);
  line-height: 1.4;
}

.codex-status-line {
  display: grid;
  grid-template-columns: minmax(120px, 0.35fr) minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.codex-status-line span {
  color: var(--muted);
}

.codex-status-line code {
  overflow-wrap: anywhere;
}

.codex-config-field {
  margin-top: 14px;
}

.codex-config {
  min-height: 220px;
  background: #f7f8fa;
}

.codex-access-field {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.seller-session-modal {
  width: min(820px, 100%);
}

.seller-session-modal .wb-session-card,
.seller-session-modal .helper-install-card {
  margin: 0;
}

.seller-session-modal .helper-install-card + .wb-session-card {
  margin-top: 14px;
}

.helper-install-steps {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.helper-install-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 38px;
  color: var(--text);
}

.helper-install-step-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #fff;
  background: var(--blue);
  border-radius: 50%;
  font-weight: 800;
}

.helper-folder-note {
  margin-bottom: 14px;
}

.helper-folder-note strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
}

.tax-settings-modal {
  width: min(680px, 100%);
}

.report-comparison-modal {
  width: min(760px, 100%);
}

.report-comparison-form {
  display: grid;
  gap: 14px;
}

.report-comparison-period {
  position: relative;
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 70px;
  padding: 13px 44px 13px 16px;
  color: var(--text);
  text-align: left;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-comparison-period.fixed {
  padding-right: 16px;
}

.report-comparison-period span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.report-comparison-period strong {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.report-comparison-period strong.placeholder {
  color: var(--muted-2);
  font-weight: 500;
}

.report-comparison-period i {
  position: absolute;
  top: 50%;
  right: 16px;
  color: var(--muted-2);
  font-size: 18px;
  font-style: normal;
  transform: translateY(-50%);
}

.report-comparison-selector.open > .report-comparison-period {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(31, 122, 224, 0.12);
}

.report-comparison-selector.open .report-comparison-period i {
  transform: translateY(-50%) rotate(180deg);
}

.report-comparison-options {
  max-height: 310px;
  margin-top: 6px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.report-comparison-options button {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 54px;
  padding: 10px 16px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border-bottom: 1px solid #eef1f5;
}

.report-comparison-options button:last-child {
  border-bottom: 0;
}

.report-comparison-options button:hover,
.report-comparison-options button.active {
  background: var(--blue-soft);
}

.report-comparison-options button span {
  color: var(--muted);
  font-size: 12px;
}

.report-comparison-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.tax-mode-segment {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.tax-settings-section {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.tax-settings-section > p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.tax-fixed-rates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.tax-fixed-rates > div {
  display: grid;
  gap: 4px;
  min-height: 82px;
  padding: 13px 14px;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
}

.tax-fixed-rates > div:last-child {
  border-right: 0;
}

.tax-fixed-rates span,
.tax-fixed-rates small {
  color: var(--muted);
}

.tax-fixed-rates strong {
  font-size: 19px;
}

.tax-expense-fieldset {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tax-expense-fieldset legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.tax-expense-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}

.tax-expense-grid .check-row {
  min-height: 36px;
  margin: 0;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--surface-soft);
}

.tax-settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

@media (max-width: 620px) {
  .tax-fixed-rates,
  .tax-expense-grid {
    grid-template-columns: 1fr;
  }

  .tax-fixed-rates > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .tax-fixed-rates > div:last-child {
    border-bottom: 0;
  }

  .tax-mode-segment {
    display: flex;
  }

  .tax-mode-segment .ads-period-chip {
    min-width: 0;
    flex: 1;
  }
}

.settings-card.highlight {
  border-color: #72c91f;
  background: #f7ffef;
  box-shadow: 0 0 0 4px rgba(114, 201, 31, 0.18);
}

.settings-card h2,
.settings-card h3 {
  margin: 0;
}

.settings-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.process-panel {
  margin: 18px 0;
}

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

.process-head p {
  margin-top: 4px;
}

.worker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}

.worker-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-weight: 650;
}

.worker-pill strong {
  color: #64748b;
  font-size: 12px;
}

.worker-pill.ok {
  border-color: #b6e89a;
  background: #f4fde9;
  color: #2f6d1e;
}

.worker-pill.ok strong {
  color: #3f8f22;
}

.worker-pill.bad {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

.process-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}

.process-summary div {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.process-summary span,
.process-job-row span,
.process-job-meta small {
  color: var(--muted);
}

.process-summary strong {
  font-size: 20px;
}

.observability-summary {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.process-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.process-run-btn {
  min-height: 36px;
}

.process-jobs {
  display: grid;
  gap: 8px;
}

.process-jobs h3 {
  margin: 0;
  font-size: 16px;
}

.process-observability,
.process-section {
  display: grid;
  gap: 10px;
}

.process-observability {
  margin-top: 4px;
}

.process-section h3 {
  margin: 0;
  font-size: 16px;
}

.process-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.process-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: auto;
}

.process-table.compact {
  min-width: 620px;
}

.process-table th,
.process-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  white-space: nowrap;
}

.process-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: rgba(241, 245, 249, 0.78);
}

.process-table tr:last-child td {
  border-bottom: 0;
}

.process-table .route-cell {
  max-width: 360px;
  white-space: normal;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  color: #334155;
}

.process-job-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.process-job-row > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.process-job-row strong,
.process-job-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-job-row.failed {
  border-color: #fecaca;
  background: #fff7f7;
}

.process-job-row.running,
.process-job-row.pending {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.process-job-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.warning-text {
  color: #b45309;
}

.shop-summary {
  display: grid;
  gap: 4px;
}

.shop-summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.shop-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-weight: 500;
}

.form-grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 7px;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 650;
}

.check-pill input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.role-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin-top: 7px;
}

.role-preset-card {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: start;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.role-preset-card:has(input:checked) {
  border-color: var(--green);
  background: #f3fce9;
}

.role-preset-card input {
  margin-top: 2px;
  accent-color: var(--green);
}

.role-preset-card strong {
  display: block;
  color: var(--text);
}

.role-preset-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.25;
}

.user-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.user-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.user-card.editing {
  border-color: #b7e892;
  background: #f8fff2;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(110px, 0.7fr) minmax(120px, 0.8fr) minmax(170px, 1.1fr) minmax(130px, 0.9fr) minmax(110px, 0.7fr) minmax(220px, auto);
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.user-row strong {
  display: block;
  color: var(--text);
}

.user-row small {
  display: block;
  margin-top: 2px;
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.user-edit-form {
  display: grid;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.write-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.write-guard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  background: #fffaf0;
}

.write-guard.enabled {
  border-color: #ffb4ad;
  background: var(--red-soft);
}

.write-guard p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.success-text {
  color: #336b14;
}

.token-input {
  width: 100%;
  min-height: 112px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
}

.token-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 122, 224, 0.12);
}

.form-message {
  padding: 10px 12px;
  border-radius: 6px;
  font-weight: 650;
}

.form-message.compact-message {
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.35;
}

.form-message.success {
  color: #336b14;
  background: #edfbdc;
}

.form-message.error {
  color: var(--red);
  background: var(--red-soft);
}

.form-message.warning {
  color: #7a4b00;
  background: #fff4d8;
  border: 1px solid #f0c36a;
}

.probe-box {
  padding: 14px;
  color: #1f579d;
  background: var(--blue-soft);
  border: 1px solid #bfdcff;
  border-radius: var(--radius);
  font-weight: 650;
}

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

.rounds-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.rounds-toggle {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.rounds-toggle span:last-child {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 0.15s ease;
}

.chevron.open {
  transform: rotate(90deg);
}

.rounds-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.rounds-summary span {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.confidence-explain {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #cfe0f5;
  border-radius: 6px;
  background: #f7fbff;
}

.confidence-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.confidence-title strong {
  font-size: 14px;
}

.confidence-title span,
.confidence-explain p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.confidence-grid div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.confidence-grid span {
  color: var(--muted);
  font-size: 12px;
}

.confidence-grid strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.formula-line {
  padding: 8px 10px;
  border-left: 3px solid var(--blue);
  color: #24435f;
  background: var(--surface);
  border-radius: 4px;
  font-size: 13px;
}

.rounds-table-wrap {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.rounds-table th,
.rounds-table td {
  font-size: 13px;
}

.rounds-table tr.round-isolated td {
  background: #fff8ec;
}

.rounds-table tr.round-isolated:hover td {
  background: #fff1d2;
}

.compact-empty {
  padding: 10px;
  text-align: left;
}

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

.probe-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.probe-card.ready {
  border-color: #b7e892;
  background: #f7fff2;
}

.probe-card.failed {
  border-color: #ffd0cc;
  background: var(--red-soft);
}

.probe-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.probe-card p {
  margin: 0;
  color: var(--muted);
}

.probe-sample {
  display: grid;
  gap: 8px;
}

.probe-row {
  display: grid;
  gap: 3px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.probe-row strong,
.probe-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.probe-row span {
  color: var(--muted);
  font-size: 13px;
}

.probe-error {
  max-height: 180px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--red);
  font-size: 12px;
  white-space: pre-wrap;
}

.compact-field {
  min-width: min(460px, 42vw);
}

.report-period-field {
  position: relative;
  z-index: 20;
}

.report-period-field.open::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  z-index: 0;
  height: 8px;
}

.report-period-select {
  min-width: min(520px, 46vw);
}

.report-period-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 8px;
  min-width: min(520px, 46vw);
  height: 44px;
  text-align: left;
}

.report-period-trigger strong,
.report-period-trigger em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-period-trigger strong {
  font-size: 14px;
  font-weight: 700;
}

.report-period-trigger em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.report-period-trigger > span {
  color: var(--muted);
  font-size: 16px;
  text-align: center;
  transition: transform 0.16s ease;
}

.report-period-trigger.open {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 122, 224, 0.12);
}

.report-period-trigger.open > span {
  transform: rotate(180deg);
}

.report-period-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 1;
  width: min(560px, 58vw);
  max-height: min(420px, 62vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 44px rgba(30, 41, 59, 0.16);
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.report-period-menu button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.report-period-menu button:hover,
.report-period-menu button.active {
  background: var(--surface-soft);
}

.report-period-menu button.active {
  box-shadow: inset 3px 0 0 var(--blue);
}

.report-period-menu strong,
.report-period-menu span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-period-menu strong {
  font-size: 14px;
}

.report-period-menu span {
  color: var(--muted);
  font-size: 12px;
}

.report-head-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 18px;
}

.report-head-panel > div:first-child {
  flex: 1 1 320px;
  min-width: 0;
}

.report-head-panel h2 {
  margin: 0 0 6px;
}

.report-head-panel p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
}

.report-source-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.report-source-pill.control {
  background: #f1ecff;
  color: var(--purple);
}

.report-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-tabs button {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.report-tabs button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(30, 41, 59, 0.08);
}

.report-items-toggle {
  min-width: 190px;
  justify-content: center;
}

.report-head-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.report-head-actions .btn.ghost.active {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #bfdbfe;
}

.report-items-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.report-items-mode {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
  padding: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-items-mode button {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.report-items-mode button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(30, 41, 59, 0.08);
}

.report-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.report-metric-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-height: 92px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.report-metric-card span,
.report-metric-card small,
.report-metric-card em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.report-metric-card strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
  line-height: 1.15;
}

.report-metric-card small {
  display: block;
  margin-top: 4px;
}

.report-focus-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(360px, 1.15fr);
  gap: 14px;
  margin-bottom: 14px;
}

.report-expense-breakdown {
  margin-bottom: 14px;
  padding-bottom: 16px;
}

.report-expense-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 10px;
  padding: 0 18px;
}

.report-expense-breakdown-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-expense-breakdown-item div {
  min-width: 0;
}

.report-expense-breakdown-item strong,
.report-expense-breakdown-item small {
  display: block;
}

.report-expense-breakdown-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-expense-breakdown-item small {
  margin-top: 2px;
  color: var(--muted);
}

.report-expense-breakdown-item em {
  color: var(--text);
  font-style: normal;
  font-weight: 750;
  white-space: nowrap;
}

.report-expense-breakdown-item.negative em {
  color: #4f7d19;
}

.report-focus-main,
.report-focus-bars {
  min-height: 180px;
  padding: 18px;
}

.report-focus-main {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

.report-focus-main span,
.report-focus-main small {
  color: var(--muted);
}

.report-focus-main strong {
  font-size: 34px;
  line-height: 1.1;
}

.report-focus-bars {
  display: grid;
  gap: 12px;
}

.report-focus-row {
  display: grid;
  grid-template-columns: 150px minmax(120px, 1fr) 110px;
  align-items: center;
  gap: 12px;
}

.report-focus-row span {
  color: var(--muted);
}

.report-focus-row div {
  height: 12px;
  overflow: hidden;
  background: var(--surface-soft);
  border-radius: 999px;
}

.report-focus-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.report-focus-row strong {
  text-align: right;
  white-space: nowrap;
}

.report-detail-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.report-detail-card {
  min-width: 0;
}

.report-detail-card > .report-stack {
  margin: 0 18px 18px;
}

.report-detail-card > .report-legend,
.report-detail-card > .report-donut-row {
  padding: 0 18px 18px;
}

.report-items-panel {
  margin-bottom: 14px;
}

.report-items-wrap {
  position: relative;
  width: calc(100% - 36px);
  max-height: min(72vh, 760px);
  margin: 0 18px 18px;
  padding: 0;
  overscroll-behavior: contain;
  scrollbar-color: #aeb8c6 #eef1f5;
}

.report-items-wrap:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.report-items-wrap::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.report-items-wrap::-webkit-scrollbar-track {
  background: #eef1f5;
}

.report-items-wrap::-webkit-scrollbar-thumb {
  border: 3px solid #eef1f5;
  border-radius: 8px;
  background: #aeb8c6;
}

.report-items-table {
  --report-photo-column-width: 72px;
  --report-name-column-width: 300px;
  --report-article-column-width: 160px;
  --report-table-width: 3500px;
  width: max(100%, var(--report-table-width));
  min-width: var(--report-table-width);
  table-layout: auto;
}

.report-items-table.is-osno {
  --report-table-width: 3920px;
}

.report-items-table.ozon-realization-table {
  --report-table-width: 4300px;
}

.report-items-table col.report-col-photo {
  width: var(--report-photo-column-width);
}

.report-items-table col.report-col-name {
  width: var(--report-name-column-width);
}

.report-items-table col.report-col-article {
  width: var(--report-article-column-width);
}

.report-items-table col.report-col-id {
  width: 112px;
}

.report-items-table col.report-col-category {
  width: 160px;
}

.report-items-table col.report-col-money {
  width: 132px;
}

.report-items-table col.report-col-count {
  width: 92px;
}

.report-items-table col.report-col-rate {
  width: 132px;
}

.report-items-table col.report-col-rate-compact {
  width: 118px;
}

.report-items-table col.report-col-logistics-wide {
  width: 210px;
}

.report-items-table col.report-col-logistics {
  width: 142px;
}

.report-items-table col.report-col-result,
.report-items-table col.report-col-tax {
  width: 142px;
}

.report-items-table col.report-col-profit {
  width: 150px;
}

.report-items-table th,
.report-items-table td {
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
  text-overflow: clip;
}

.report-items-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 68px;
  overflow: visible;
  background: #fbfcfe;
  line-height: 1.2;
  vertical-align: bottom;
  white-space: normal;
}

.report-items-table tbody td:hover {
  background: #eef6ff;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

.report-items-table th:nth-child(-n + 5),
.report-items-table td:nth-child(-n + 5) {
  text-align: left;
}

.report-items-table th.report-logistics-per-buyout {
  white-space: normal;
  line-height: 1.25;
}

.report-items-table th.report-logistics-per-buyout .report-inline-tooltip {
  white-space: normal;
}

.report-items-table .report-item-sticky {
  position: sticky;
  z-index: 3;
  background: var(--surface);
  background-clip: padding-box;
}

.report-items-table thead .report-item-sticky {
  z-index: 7;
  background: #fbfcfe;
}

.report-items-table tfoot .report-item-sticky {
  z-index: 6;
  background: var(--surface);
}

.report-items-table tbody tr:hover .report-item-sticky {
  background: #fafcff;
}

.report-items-table .report-item-sticky-photo {
  left: 0;
  width: var(--report-photo-column-width);
  min-width: var(--report-photo-column-width);
  max-width: var(--report-photo-column-width);
  text-align: center;
}

.report-items-table .report-item-sticky-name {
  left: var(--report-photo-column-width);
  width: var(--report-name-column-width);
  min-width: var(--report-name-column-width);
  max-width: var(--report-name-column-width);
}

.report-items-table .report-item-sticky-article {
  left: calc(var(--report-photo-column-width) + var(--report-name-column-width));
  width: var(--report-article-column-width);
  min-width: var(--report-article-column-width);
  max-width: var(--report-article-column-width);
  box-shadow: 8px 0 10px -10px rgba(31, 44, 61, 0.45);
}

.report-items-table tfoot th {
  position: sticky;
  bottom: 0;
  z-index: 5;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.report-items-table .report-cell-category,
.report-items-table .report-item-sticky-article {
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}

.report-items-table .report-cell-id {
  white-space: nowrap;
}

.report-items-table .report-item-sticky-article strong {
  white-space: normal;
  overflow-wrap: anywhere;
}

.report-inline-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  border-bottom: 1px dotted currentColor;
  cursor: help;
}

.report-inline-tooltip::after {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 20;
  display: none;
  width: 280px;
  padding: 10px 12px;
  color: var(--text);
  white-space: normal;
  text-align: left;
  line-height: 1.35;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  content: attr(data-tooltip);
}

.report-inline-tooltip:hover::after,
.report-inline-tooltip:focus-visible::after {
  display: block;
}

.report-item-cell {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 230px;
}

.report-item-thumb {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-item-thumb img,
.report-item-thumb svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.report-item-thumb.empty svg {
  width: 28px;
  height: 28px;
}

.report-item-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.report-item-title strong,
.report-item-title span {
  display: block;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}

.report-item-title span {
  color: var(--muted);
  font-size: 12px;
}

.report-logistics-context {
  display: grid;
  gap: 12px;
  padding: 0 18px 18px;
}

.report-logistics-context-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.report-logistics-context-grid > div {
  min-width: 0;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-logistics-context span,
.report-logistics-context small,
.report-logistics-context em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.report-logistics-context strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  line-height: 1.15;
}

.report-logistics-context small {
  display: block;
  margin-top: 4px;
}

.report-logistics-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.report-logistics-actions small {
  margin-top: 0;
}

.report-logistics-warehouses {
  display: grid;
  gap: 8px;
}

.report-logistics-warehouses > div {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  align-items: baseline;
  gap: 10px;
  min-height: 32px;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-logistics-warehouses span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-logistics-warehouses strong {
  margin: 0;
  font-size: 14px;
  white-space: nowrap;
}

.report-logistics-warehouses em {
  white-space: nowrap;
}

.report-logistics-tariff-period {
  color: var(--muted);
}

.report-stack {
  height: 28px;
  margin-bottom: 18px;
  background: var(--surface-soft);
  border-radius: 6px;
}

.report-legend {
  display: grid;
  gap: 11px;
}

.report-legend-row {
  display: grid;
  grid-template-columns: 10px minmax(120px, 1fr) auto auto;
  align-items: baseline;
  gap: 9px;
}

.report-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.report-legend-row strong,
.report-legend-row em {
  white-space: nowrap;
}

.report-legend-row em {
  color: var(--muted);
  font-style: normal;
}

.reports-expenses-cell {
  min-width: 210px;
}

.reports-expenses-cell strong,
.reports-expenses-cell span {
  display: block;
}

.reports-expenses-cell span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  white-space: normal;
}

.report-donut-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
}

.report-donut {
  position: relative;
  display: grid;
  place-items: center;
  width: 174px;
  aspect-ratio: 1;
  border-radius: 50%;
}

.report-donut::after {
  position: absolute;
  width: 132px;
  aspect-ratio: 1;
  background: var(--surface);
  border-radius: 50%;
  content: "";
}

.report-donut span {
  position: relative;
  z-index: 1;
  font-weight: 800;
}

.report-compare {
  margin-bottom: 20px;
}

.report-comparison-results {
  display: grid;
  gap: 14px;
  margin: 20px 0;
  scroll-margin-top: 16px;
}

.report-comparison-results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.report-comparison-results-head span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-comparison-results-head h2 {
  margin: 5px 0;
  font-size: 24px;
}

.report-comparison-results-head p {
  margin: 0;
  color: var(--muted);
}

.report-comparison-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
}

.report-comparison-summary-item {
  min-width: 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.report-comparison-summary-item > span,
.report-comparison-summary-item em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.report-comparison-summary-item strong {
  display: block;
  margin: 6px 0;
  overflow-wrap: anywhere;
  font-size: 20px;
}

.report-comparison-summary-item small {
  display: block;
  font-weight: 800;
}

.report-comparison-summary-item em {
  margin-top: 5px;
  line-height: 1.35;
}

.report-comparison-change.good,
.report-comparison-summary-item .good {
  color: #16856b;
}

.report-comparison-change.bad,
.report-comparison-summary-item .bad {
  color: var(--red);
}

.report-comparison-change.info,
.report-comparison-summary-item .info {
  color: var(--blue);
}

.report-comparison-change.flat,
.report-comparison-summary-item .flat {
  color: var(--muted-2);
}

.report-comparison-insight {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  background: #edf8f5;
  border: 1px solid #b9e2d8;
  border-radius: 8px;
}

.report-comparison-insight.warning {
  background: var(--amber-soft);
  border-color: #fbd38d;
}

.report-comparison-insight span {
  color: var(--muted);
  line-height: 1.45;
}

.report-comparison-block {
  overflow: hidden;
}

.report-comparison-table {
  min-width: 860px;
  table-layout: auto;
}

.report-comparison-table th,
.report-comparison-table td {
  min-width: 130px;
  white-space: nowrap;
  text-align: right;
}

.report-comparison-table th:first-child,
.report-comparison-table td:first-child {
  min-width: 230px;
  white-space: normal;
  text-align: left;
}

.report-comparison-table td:first-child strong,
.report-comparison-table td:first-child small {
  display: block;
}

.report-comparison-table td:first-child small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.report-comparison-change {
  font-weight: 800;
}

.reports-table th,
.reports-table td {
  white-space: nowrap;
}

.reports-table tr.selected td {
  background: #f4fbef;
}

@media (max-width: 760px) {
  .probe-grid {
    grid-template-columns: 1fr;
  }

  .wb-stats-box {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

.thumb {
  width: 32px;
  height: 40px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: #ffffff;
  object-fit: contain;
  object-position: center;
}

.thumb img,
.summary-thumb img,
.photo-frame img,
.mini-photo img,
.current-photo img,
.winner-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #ffffff;
}

.pack-visual {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 38%),
    linear-gradient(180deg, #b7efff 0%, #ffffff 48%, #15a0c7 100%);
}

.pack-visual.alt {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0) 35%),
    linear-gradient(180deg, #fef3c7 0%, #ffffff 50%, #f3b5c9 100%);
}

.pack-visual.third {
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0) 38%),
    linear-gradient(180deg, #d7f5c7 0%, #ffffff 52%, #2aa66a 100%);
}

.pack-visual::before {
  position: absolute;
  left: 21%;
  right: 18%;
  bottom: 13%;
  height: 40%;
  border-radius: 11px 11px 8px 8px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.18);
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.12);
  content: "";
}

.pack-visual::after {
  position: absolute;
  left: 25%;
  right: 22%;
  bottom: 35%;
  height: 13%;
  border-radius: 4px;
  background: #1288a7;
  content: "";
}

.pack-visual.alt::after {
  background: #f08b9b;
}

.pack-visual.third::after {
  background: #168253;
}

.pack-title {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 7%;
  padding: 3px 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.84);
  color: #0f4f68;
  font-size: 9px;
  font-weight: 800;
  text-align: center;
}

.pack-visual.alt .pack-title {
  color: #7f1d1d;
}

.pack-visual.third .pack-title {
  color: #14532d;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.status.done {
  background: #e6f7d7;
  color: #437a1c;
}

.status.running {
  background: var(--blue-soft);
  color: #1f579d;
}

.status.draft {
  background: #f0f2f5;
  color: #596273;
}

.status.archived {
  background: #eef0f3;
  color: #4b5563;
}

.status.paused {
  background: var(--amber-soft);
  color: #8a5a00;
}

.status.no-budget {
  background: var(--red-soft);
  color: var(--red);
}

.status.error {
  background: var(--red-soft);
  color: var(--red);
}

.progress {
  position: relative;
  width: 100%;
  min-width: 92px;
  height: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
}

.progress-fill {
  height: 100%;
  background: #add9fb;
}

.progress span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #4b5563;
}

.side-panel {
  padding: 16px;
}

.side-panel h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

.compact-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.compact-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.compact-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.muted {
  color: var(--muted);
}

.wizard-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
}

.wizard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 92px;
  margin-bottom: 14px;
  padding: 14px 20px;
}

.heading-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ab-icon {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  width: 44px;
  height: 58px;
  overflow: hidden;
  border: 3px solid var(--green);
  border-radius: 5px;
  color: var(--green);
  font-weight: 900;
}

.ab-icon span {
  display: grid;
  place-items: center;
  border-right: 1px solid #d9f6c4;
}

.ab-icon span:last-child {
  border-right: 0;
}

.back-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  font-size: 25px;
}

.wizard-body {
  min-height: 650px;
  padding: 22px 24px;
}

.wizard-body h2 {
  margin: 0 0 16px;
  font-size: 22px;
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 0 0;
}

.stepper {
  padding: 22px 22px 18px;
  align-self: start;
}

.step {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 48px;
}

.step:not(:last-child)::after {
  position: absolute;
  left: 13px;
  top: 34px;
  bottom: -14px;
  width: 2px;
  background: #d9dee6;
  content: "";
}

.step.done:not(:last-child)::after {
  background: var(--green);
}

.step-num {
  z-index: 1;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #555f6d;
  font-size: 13px;
  font-weight: 800;
}

.step.active .step-num {
  background: #2f343b;
  color: #ffffff;
}

.step.done .step-num {
  background: var(--green);
  color: #ffffff;
}

.step-title {
  font-weight: 650;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 0.55fr);
  gap: 14px;
  margin-bottom: 16px;
}

.switch-row,
.radio-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #3f4753;
}

.switch input {
  display: none;
}

.switch-ui {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: #e5e7eb;
}

.switch-ui::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #8ba0b8;
  content: "";
}

.switch input:checked + .switch-ui {
  background: #dcecfb;
}

.switch input:checked + .switch-ui::after {
  left: 20px;
  background: #315d9c;
}

.radio-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: #3d4653;
}

.radio-chip input {
  accent-color: var(--blue);
}

.warning-box {
  position: relative;
  margin-bottom: 16px;
  padding: 14px 44px 14px 16px;
  border: 1px solid var(--amber);
  background: var(--amber-soft);
  border-radius: var(--radius);
  color: #4c3a16;
}

.warning-box p {
  margin: 0 0 6px;
  font-weight: 700;
}

.warning-box ul {
  margin: 0;
  padding-left: 20px;
}

.campaign-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.product-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.summary-thumb {
  width: 46px;
  height: 60px;
  flex: 0 0 auto;
  border-radius: 5px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.summary-title {
  min-width: 0;
}

.summary-title h2 {
  margin: 0;
  font-size: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  color: var(--muted);
}

.campaign-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 360px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.play-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 5px;
  background: var(--green);
  color: #ffffff;
  font-size: 19px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.media-type-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 14px;
}

.ai-content-panel {
  display: grid;
  gap: 14px;
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

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

.ai-content-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.ai-content-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.ai-content-presets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ai-content-presets > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.ai-content-presets span,
.ai-content-rule-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.ai-content-presets strong {
  display: block;
  margin-top: 4px;
  line-height: 1.25;
}

.ai-content-prompt {
  display: grid;
  gap: 6px;
}

.textarea {
  width: 100%;
  min-height: 84px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  resize: vertical;
  outline: none;
}

.textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 122, 224, 0.12);
}

.ai-content-rule-list {
  display: grid;
  gap: 4px;
}

.photo-slot {
  position: relative;
  min-height: 0;
}

.photo-frame {
  display: grid;
  place-items: center;
  width: 100%;
  height: clamp(150px, 14vw, 220px);
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0;
  color: inherit;
}

.photo-frame.has-image {
  background: #f9fbff;
}

.upload-frame:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 122, 224, 0.1);
}

.photo-frame .pack-visual {
  width: 100%;
  height: 100%;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.photo-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #111827;
}

.video-preview {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #111827, #253246);
  color: #ffffff;
}

.video-preview span {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(17, 24, 39, 0.74);
  font-size: 12px;
  line-height: 1.2;
}

.empty-image {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid #aab2bd;
  border-radius: 5px;
  color: #9aa3ae;
  font-size: 25px;
}

.photo-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.upload-zone {
  display: grid;
  place-items: center;
  min-height: 145px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fbfcfe;
  text-align: center;
}

.upload-zone input {
  display: none;
}

.upload-zone p {
  margin: 8px 0 0;
  color: var(--muted);
}

.settings-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-top: 14px;
}

.api-panel .settings-grid {
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
}

.slider-list {
  display: grid;
  gap: 18px;
}

.setting-input {
  display: grid;
  gap: 5px;
}

.setting-input input {
  height: 58px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-size: 18px;
}

.setting-input small {
  color: var(--muted-2);
}

.range-block {
  display: grid;
  gap: 8px;
}

.range-head {
  display: flex;
  justify-content: space-between;
  color: #3f4753;
}

.range {
  width: 100%;
  accent-color: var(--green);
}

.range-scale {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: 8px;
  overflow: hidden;
  border-radius: 5px;
}

.range-scale span:nth-child(1) {
  background: #f99595;
}

.range-scale span:nth-child(2) {
  background: #ffc350;
}

.range-scale span:nth-child(3) {
  background: #83e17d;
}

.range-scale span:nth-child(4) {
  background: #61cf79;
}

.divider {
  height: 1px;
  margin: 18px 0;
  background: var(--line);
}

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

.estimate-item {
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.estimate-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.estimate-item strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.launch-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 18px;
}

.summary-section {
  display: grid;
  gap: 12px;
}

.summary-line {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.summary-line span {
  color: var(--muted);
}

.photos-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mini-photo {
  width: 64px;
  height: 84px;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.mini-photo .pack-visual,
.mini-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.live-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
}

.live-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.live-title {
  display: flex;
  gap: 12px;
  min-width: 0;
}

.current-photo {
  width: 92px;
  height: 122px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 2px solid var(--green);
  border-radius: 7px;
  background: #ffffff;
}

.current-photo .pack-visual,
.current-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

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

.state-box {
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.state-box span {
  color: var(--muted);
  font-size: 12px;
}

.state-box strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.campaign-control-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.campaign-control-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.campaign-control-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.campaign-control-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
}

.campaign-control-status small {
  flex-basis: 100%;
  text-align: right;
}

.funds-line {
  padding: 8px 10px;
  color: #1f579d;
  background: var(--blue-soft);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 650;
}

.top-up-box {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(140px, 180px) minmax(0, 1fr);
  gap: 10px;
  align-items: end;
  padding: 12px;
  background: var(--amber-soft);
  border: 1px solid #ffd28a;
  border-radius: 7px;
}

.top-up-box .button-row {
  align-self: end;
}

.top-up-box p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.winner-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.continue-box {
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding: 14px;
  background: var(--amber-soft);
  border: 1px solid #ffd28a;
  border-radius: var(--radius);
}

.continue-box p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.setting-input.compact input {
  height: 42px;
  font-size: 15px;
}

.winner-photo {
  width: 100%;
  max-width: 170px;
  aspect-ratio: 0.75;
  overflow: hidden;
  border: 2px solid var(--green);
  border-radius: 7px;
  background: #ffffff;
}

.winner-photo .pack-visual,
.winner-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.log {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.log-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1160px) {
  .dashboard-grid,
  .module-grid,
  .repricer-grid,
  .ads-layout,
  .wizard-shell,
  .live-layout,
  .launch-grid {
    grid-template-columns: 1fr;
  }

  .stepper {
    order: -1;
  }

  .campaign-summary {
    min-width: 0;
  }

  .campaign-control-head,
  .top-up-box {
    grid-template-columns: 1fr;
  }

  .campaign-control-status {
    justify-content: flex-start;
  }

  .campaign-control-status small {
    text-align: left;
  }

  .economics-controls {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .ads-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .products-controls,
  .products-stats,
  .price-index-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .price-index-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .price-index-ozon-bands {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .price-index-ozon-band:nth-child(2) {
    border-right: 0;
  }

  .price-index-ozon-band:nth-child(-n + 2) {
    border-bottom: 1px solid #e2e7ee;
  }

  .price-index-search {
    grid-column: span 2;
  }

  .products-glue-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ads-strategy-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ads-strategy-control-actions {
    align-items: start;
  }

  .report-metric-grid,
  .report-focus-grid,
  .report-detail-grid,
  .report-expense-breakdown-grid {
    grid-template-columns: 1fr 1fr;
  }

  .report-comparison-summary {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .ads-detail-stats,
  .ads-stats,
  .repricer-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .report-items-table {
    --report-photo-column-width: 60px;
    --report-name-column-width: 210px;
    --report-article-column-width: 116px;
  }

  .profitability-table-wrap {
    --profitability-product-column-width: 320px;
    --profitability-article-column-width: 120px;
  }

  .profitability-scenario-table-wrap {
    --profitability-product-column-width: 300px;
    --profitability-article-column-width: 122px;
  }

  .topbar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "actions"
      "nav";
    padding: 10px;
  }

  .brand {
    min-width: 0;
  }

  .top-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .shop-select {
    width: 100%;
    max-width: none;
  }

  .nav {
    width: 100%;
    overflow: visible;
  }

  .nav-button {
    min-height: 38px;
    height: auto;
  }

  .page {
    padding: 10px;
  }

  .toolbar,
  .report-head-panel,
  .report-comparison-results-head,
  .wizard-head,
  .live-head {
    align-items: stretch;
    flex-direction: column;
  }

  .report-comparison-backdrop {
    place-items: start center;
    padding: 10px;
  }

  .report-comparison-modal {
    max-height: calc(100vh - 20px);
    padding: 16px;
  }

  .report-comparison-form-actions,
  .report-head-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .report-comparison-form-actions .btn,
  .report-head-actions .btn {
    width: 100%;
  }

  .report-comparison-summary {
    grid-template-columns: 1fr;
  }

  .dashboard-grid,
  .module-grid,
  .repricer-grid,
  .redistribution-grid,
  .redistribution-form,
  .redistribution-limit-grid,
  .stats-row,
  .repricer-stats,
  .filters,
  .economics-controls,
  .products-controls,
  .price-index-controls,
  .price-index-stats,
  .ozon-credentials-grid,
  .ads-controls,
  .form-grid,
  .settings-grid,
  .estimate,
  .state-grid,
  .confidence-grid {
    grid-template-columns: 1fr;
  }

  .api-panel .settings-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .price-index-search {
    grid-column: auto;
  }

  .price-index-ozon-widget-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .price-index-ozon-widget-head > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .price-index-ozon-bands {
    grid-template-columns: 1fr;
  }

  .price-index-ozon-band,
  .price-index-ozon-band:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid #e2e7ee;
  }

  .price-index-ozon-band:last-child {
    border-bottom: 0;
  }

  .price-index-job-head,
  .price-index-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .price-index-table-wrap {
    max-height: 65vh;
  }

  .products-full-index-panel {
    grid-template-columns: 1fr;
  }

  .products-glue-job-head,
  .products-glue-metrics,
  .products-glue-log {
    grid-template-columns: 1fr;
  }

  .products-glue-metrics > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .products-glue-metrics > div:last-child {
    border-bottom: 0;
  }

  .products-glue-log {
    gap: 3px;
  }

  .compact-field,
  .report-period-select,
  .report-period-trigger {
    min-width: 0;
    width: 100%;
  }

  .report-period-field {
    width: 100%;
  }

  .report-period-menu {
    left: 0;
    right: 0;
    width: 100%;
    max-height: min(360px, 58vh);
  }

  .report-metric-grid,
  .report-focus-grid,
  .report-detail-grid,
  .report-donut-row,
  .report-logistics-context-grid,
  .report-logistics-warehouses > div,
  .report-expense-breakdown-grid {
    grid-template-columns: 1fr;
  }

  .report-focus-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .report-focus-row strong {
    text-align: left;
  }

  .user-row {
    grid-template-columns: 1fr;
  }

  .codex-status-line {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .user-actions {
    justify-content: flex-start;
  }

  .report-legend-row {
    grid-template-columns: 10px minmax(100px, 1fr) auto;
  }

  .report-legend-row em {
    grid-column: 2 / -1;
  }

  .ads-strategy-controls,
  .ads-strategy-pool-grid {
    grid-template-columns: 1fr;
  }

  .ads-strategy-pool-card,
  .ads-strategy-pool-actions,
  .ads-strategy-history-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .ai-content-head,
  .ai-content-presets {
    grid-template-columns: 1fr;
  }

  .form-grid.three {
    grid-template-columns: 1fr;
  }

  .ai-content-head {
    display: grid;
  }

  .campaign-summary {
    justify-content: flex-start;
    padding-left: 0;
    border-left: 0;
  }

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

  .ads-keyword-head,
  .ads-keyword-actions,
  .ads-keyword-subbar {
    min-width: 0;
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .ads-detail-stats,
  .ads-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .source-row {
    justify-content: flex-start;
  }

  .redistribution-search {
    grid-column: auto;
  }

  .redistribution-results,
  .redistribution-request {
    grid-template-columns: 1fr;
  }

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

  .summary-title h2 {
    white-space: normal;
  }

  .api-panel {
    width: 100%;
    min-width: 0;
    padding: 12px;
  }

  .api-panel > *,
  .marketplace-api-panel,
  .settings-card,
  .api-form,
  .field,
  .shop-summary,
  .shop-summary-actions {
    min-width: 0;
    max-width: 100%;
  }

  .summary-line,
  .form-grid.two {
    grid-template-columns: minmax(0, 1fr);
  }

  .summary-line > *,
  .marketplace-credential-input {
    min-width: 0;
    max-width: 100%;
  }

  .process-panel {
    min-width: 0;
    overflow: hidden;
  }

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

  .worker-grid,
  .process-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .process-actions .btn {
    width: 100%;
  }
}


.repricer-table .status {
  max-width: 100%;
  padding: 4px 8px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.credential-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  min-height: 44px;
  padding: 8px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid #dce2e8;
  color: #4a5565;
  font-size: 13px;
  line-height: 20px;
}

.credential-caption {
  font-weight: 600;
}

.credential-items {
  display: flex;
  flex: 1 1 380px;
  flex-wrap: wrap;
  gap: 6px 20px;
  min-width: 0;
}

.credential-item {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 6px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.credential-item.valid { color: #22653b; }
.credential-item.expiring { color: #925b08; }
.credential-item.critical,
.credential-item.expired { color: #b42318; font-weight: 600; }
.credential-item.unknown,
.credential-item.missing,
.credential-pending { color: #616d7d; }

.credential-dot {
  display: inline-block;
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  margin-right: 1px;
  border-radius: 50%;
  background: currentColor;
  align-self: center;
}

.credential-strip .link-button {
  flex-shrink: 0;
  font-size: 13px;
}

/* Profitability keeps the same shell height before and after shop metadata.
   Every key/rejection remains in the horizontally scrollable expiry rail. */
.profitability-credential-slot {
  display: flow-root;
  block-size: 84px;
}

.profitability-credential-slot .credential-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 20px 28px;
  gap: 6px 12px;
  block-size: 72px;
  min-block-size: 72px;
  margin-block-end: 12px;
}

.profitability-credential-slot .credential-caption {
  grid-area: 1 / 1;
}

.profitability-credential-slot .credential-strip .link-button {
  grid-area: 1 / 2;
  margin: 0;
  block-size: 20px;
  padding-block: 0;
  white-space: nowrap;
}

.profitability-credential-slot .credential-items {
  grid-area: 2 / 1 / 3 / -1;
  flex-basis: auto;
  flex-wrap: nowrap;
  gap: 20px;
  align-items: start;
  block-size: 28px;
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-width: thin;
}

.profitability-credential-slot .credential-items::-webkit-scrollbar {
  height: 6px;
}

.profitability-credential-slot .credential-item,
.profitability-credential-slot .credential-pending {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .credential-strip { column-gap: 12px; }
  .credential-items { flex-basis: 100%; order: 2; }
  .credential-strip .link-button { margin-left: auto; }
}

/* Keep the table region's footprint while its contents settle.  The table's
   own scroll viewport, row count and max-height remain unchanged. */
.profitability-table-frame [data-profitability-table-region] {
  --profitability-region-min-block-size: max(520px, calc(max(320px, calc(100vh - 430px)) + 144px));
  min-block-size: var(--profitability-region-min-block-size);
}

.profitability-table-frame [data-profitability-table-region] > .profitability-table-placeholder {
  block-size: var(--profitability-region-min-block-size);
  min-block-size: var(--profitability-region-min-block-size);
  max-block-size: var(--profitability-region-min-block-size);
  overflow: auto;
  scrollbar-width: thin;
}
