* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --page-bg: #eef1f5;
  --surface: #ffffff;
  --surface-soft: #fbfbfd;
  --line: #e5e5ea;
  --line-strong: #d1d1d6;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --muted-strong: #3a3a3c;
  --success: #168447;
  --warning: #9a6700;
  --danger: #b4232f;
  --shadow-soft: 0 14px 38px rgba(35, 43, 58, .08);
  --shadow-card: 0 1px 2px rgba(16, 24, 40, .04), 0 18px 48px rgba(16, 24, 40, .06);
}

body {
  min-height: 100vh;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .75) 0%, rgba(255, 255, 255, 0) 240px),
    var(--page-bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

body.theme-ozon {
  --brand: #0066cc;
  --brand2: #007aff;
  --soft: #f3f8ff;
  --panel: #f7fbff;
}

body.theme-wildberries {
  --brand: #8e24aa;
  --brand2: #af52de;
  --soft: #fbf5ff;
  --panel: #fff8ff;
}

body.theme-yandex {
  --brand: #d33a2c;
  --brand2: #ffcc00;
  --soft: #fff8ed;
  --panel: #fffdf7;
}

.container,
.app-shell {
  width: 100%;
  min-height: 100vh;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 82px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, .86);
  border-bottom: 1px solid rgba(209, 213, 219, .72);
  backdrop-filter: blur(18px);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-block {
  min-width: 260px;
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.app-navigation {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: #eef0f4;
  border: 1px solid rgba(209, 213, 219, .86);
  border-radius: 999px;
}

.app-nav-button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: transparent;
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.app-nav-button.is-active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: 0 1px 7px rgba(16, 24, 40, .12);
}

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}

.app-main {
  width: min(1500px, 100%);
  min-height: calc(100vh - 82px);
  margin: 0 auto;
  padding: 18px 24px 28px;
}

.app-view {
  display: none;
}

.app-view.is-active {
  display: block;
}

.app-view[hidden] {
  display: none !important;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

h1 {
  margin-bottom: 3px;
  font-size: 26px;
  line-height: 1.12;
  letter-spacing: 0;
}

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

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  width: min(520px, 100%);
  margin-bottom: 16px;
  padding: 4px;
  background: rgba(232, 234, 238, .9);
  border: 1px solid rgba(209, 213, 219, .72);
  border-radius: 999px;
}

.tab {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 12px;
  background: transparent;
  color: var(--muted-strong);
  box-shadow: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
}

.tab.active {
  background: var(--surface);
  border-color: rgba(0, 0, 0, .04);
  color: var(--brand);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.top {
  display: grid;
  grid-template-columns: minmax(390px, 460px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 18px;
}

.summary,
.fee-panel,
.subsidy-panel,
.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  color: var(--text);
  box-shadow: var(--shadow-card);
}

.subsidy-panel,
.future-panel {
  margin-top: 16px;
}

.summary > .big,
.summary > .metrics,
.summary > .grid,
.fee-panel .fee-metrics:nth-of-type(2) {
  margin-bottom: 14px;
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid #ededf0;
  border-radius: 12px;
}

.title {
  margin: 18px 0 10px;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}

.summary > .title:first-of-type,
.fee-panel > .title:first-child,
.subsidy-panel > .title:first-child,
.section > .view-title-row:first-child .title {
  margin-top: 0;
}

.panel-intro {
  margin: -2px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.view-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ai-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.ai-summary-grid > div,
.result-summary-card {
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.ai-summary-grid span,
.api-placeholder-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.ai-summary-grid strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: break-word;
}

#aiAnalysisMount {
  margin-top: 18px;
}

.analysis-notes-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

textarea {
  width: 100%;
  min-height: 118px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 11px 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.55;
}

textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}

.auto-selection-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 10px;
  padding: 14px;
  border: 1px solid #ededf0;
  border-radius: 8px;
  background: var(--surface-soft);
}

.auto-analysis-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.auto-analysis-button:disabled {
  background: #d1d1d6;
  color: #515154;
  cursor: wait;
}

.auto-selection-note {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.analysis-status {
  margin-bottom: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.5;
}

.analysis-status.is-loading {
  border-color: color-mix(in srgb, var(--brand) 28%, var(--line));
  background: var(--soft);
  color: var(--brand);
}

.analysis-status.is-error {
  border-color: #ffd1d1;
  background: #fff5f5;
  color: var(--danger);
}

.analysis-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.analysis-progress span {
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.analysis-progress span.is-active {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  background: var(--soft);
  color: var(--brand);
}

.analysis-progress span.is-done {
  border-color: #ccebd9;
  background: #f5fbf7;
  color: #1f6b43;
}

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

.analysis-connection-grid > div {
  min-height: 76px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.analysis-connection-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.analysis-connection-grid strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.3;
}

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

.analysis-insight-grid > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .75);
}

.analysis-insight-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.analysis-insight-grid p {
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.6;
}

.demo-analysis-button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff;
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.manual-fallback-panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.manual-fallback-panel summary {
  padding: 12px 14px;
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.manual-fallback-panel .product-selection-grid {
  padding: 0 14px 14px;
}

.store-plan-row,
.store-backend-row,
.store-api-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.store-api-form {
  grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr) auto;
}

.store-capacity,
.store-api-status {
  min-height: 42px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.field-helper {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.store-api-status {
  margin-top: 10px;
  font-weight: 700;
}

.store-api-status.is-error {
  border-color: #ffd1d1;
  background: #fff5f5;
  color: var(--danger);
}

.store-api-status.is-ok {
  border-color: #ccebd9;
  background: #f5fbf7;
  color: #1f6b43;
}

.store-platform-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.store-platform-summary span {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.store-api-add-button,
.store-api-save-button,
.store-api-sync-button,
.store-api-test-button,
.store-api-remove-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.store-api-sync-button {
  margin-bottom: 12px;
}

.store-api-save-button {
  min-width: 108px;
}

.store-api-remove-button,
.store-api-test-button {
  min-height: 34px;
  background: #f1f3f5;
  color: var(--muted-strong);
}

.store-api-test-button:disabled {
  cursor: not-allowed;
  opacity: .58;
}

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

.store-api-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.store-api-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.store-api-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.store-api-card-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.store-api-card-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.analysis-store-row {
  margin-bottom: 10px;
  padding: 14px;
  border: 1px solid #ededf0;
  border-radius: 12px;
  background: var(--surface-soft);
}

.settings-dashboard {
  display: grid;
  gap: 18px;
}

.integration-center {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.integration-hero,
.integration-card,
.marketplace-section {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

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

.integration-hero .title {
  margin: 0 0 6px;
}

.integration-hero .panel-intro {
  margin: 0;
}

.integration-card,
.marketplace-section {
  padding: 18px;
}

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

.integration-card-head p,
.integration-section-head p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.backend-endpoint-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.backend-action-stack {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding-top: 24px;
}

.ozon-connection-panel {
  background: var(--surface);
}

.settings-subtitle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.settings-subtitle {
  margin-bottom: 4px;
  color: var(--text);
  font-size: 17px;
  font-weight: 900;
}

.settings-subtitle-row p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.connection-pill {
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.connection-pill.is-ok {
  border-color: #b9e4ca;
  background: #f4fbf7;
  color: var(--success);
}

.connection-pill.is-error {
  border-color: #ffd1d1;
  background: #fff5f5;
  color: var(--danger);
}

.connection-pill.is-testing {
  border-color: #fee5a5;
  background: #fffaf0;
  color: var(--warning);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #fff;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-active,
.status-badge.is-ok {
  border-color: #b9e4ca;
  background: #f4fbf7;
  color: var(--success);
}

.status-muted {
  background: #f5f6f8;
  color: var(--muted);
}

.status-neutral {
  background: var(--surface-soft);
  color: var(--muted-strong);
}

.marketplace-card-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.marketplace-card {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: linear-gradient(180deg, #fff 0%, var(--surface-soft) 100%);
}

.marketplace-card.is-active-marketplace {
  border-color: color-mix(in srgb, var(--brand) 24%, var(--line));
}

.marketplace-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.marketplace-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.marketplace-wb {
  background: #8e24aa;
}

.marketplace-ya {
  background: #d33a2c;
}

.marketplace-card h3,
.integration-step h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.3;
}

.marketplace-card p,
.integration-step p,
.security-notes-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.marketplace-action {
  align-self: flex-start;
  margin-top: auto;
}

.integration-steps {
  display: grid;
  gap: 12px;
}

.integration-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface-soft);
}

.step-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.step-summary {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 800;
}

.compact-plan-row,
.integration-profile-form {
  margin-top: 12px;
}

.integration-profile-form {
  grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1.2fr) auto;
}

.store-profile-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-top: 12px;
}

.credential-security-note {
  min-height: 44px;
  border: 1px solid #dbe7f3;
  border-radius: 10px;
  padding: 10px 11px;
  background: #f8fbff;
}

.credential-security-note span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.credential-security-note strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 14px;
}

.primary-action {
  background: var(--brand);
  color: #fff;
}

.security-notes-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.security-note-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.security-note-grid span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.ozon-connection-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.ozon-connection-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-top: 12px;
}

.api-placeholder-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.api-placeholder-card {
  min-height: 150px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff 0%, var(--surface-soft) 100%);
}

.api-platform-name {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
}

.api-placeholder-card p {
  margin-bottom: 14px;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.6;
}

.api-placeholder-card span {
  display: inline-flex;
  width: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: var(--muted-strong);
}

#profitCalculatorView .future-panel {
  display: none;
}

#aiAnalysisMount .future-panel {
  display: block;
}

label,
.top label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 11px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
}

input[readonly] {
  background: #f5f5f7;
  color: var(--muted-strong);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}

input.input-error {
  border-color: #dc3545;
  background: #fff6f6;
}

input.input-error:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, .14);
}

input.input-warning {
  border-color: #f0ad4e;
  background: #fffaf0;
}

input.input-warning:focus {
  border-color: #f0ad4e;
  box-shadow: 0 0 0 3px rgba(240, 173, 78, .16);
}

.big input {
  border: 1px solid var(--brand);
  font-size: 26px;
  font-weight: 800;
}

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

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

.future-panel .product-selection-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.summary > .metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fee-metrics,
.subsidy-metrics,
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.subsidy-metrics {
  align-items: end;
}

.metric,
.card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  text-align: left;
}

.metric .name,
.card .name {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.metric .num,
.card .num {
  color: var(--text);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: break-word;
  word-break: normal;
}

.summary .metric .num {
  font-size: 22px;
  white-space: nowrap;
}

.green {
  border-left: 4px solid #28a745;
}

.blue {
  border-left: 4px solid #0d6efd;
}

.yellow {
  border-left: 4px solid #ffc107;
}

.orange {
  border-left: 4px solid #fd7e14;
}

.purple {
  border-left: 4px solid #764ba2;
}

.red {
  border-left: 4px solid #dc3545;
}

.notice,
.decision-card,
.next-action-card,
.explanation-panel,
.diagnosis-panel,
.validation-notice {
  border-radius: 8px;
  box-shadow: none;
}

.notice {
  margin-top: 16px;
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted-strong);
  line-height: 1.7;
}

.notice.danger {
  background: #fff5f5;
  border-color: #f1aeb5;
  color: var(--danger);
  font-weight: 800;
}

.product-image-preview {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  overflow: hidden;
}

.product-image-preview.is-empty {
  display: none;
}

.product-image-preview img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  background: #fff;
}

.decision-card,
.next-action-card {
  margin-top: 14px;
  padding: 13px 14px;
  border: 1px solid rgba(0, 0, 0, .08);
  border-left: 4px solid #8a8f98;
  background: var(--surface);
  line-height: 1.6;
}

.decision-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 6px;
}

.decision-label,
.next-action-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.decision-status {
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.decision-text,
.next-action-text,
.explanation-list,
.diagnosis-list {
  color: var(--muted-strong);
}

.decision-text {
  font-size: 14px;
}

.next-action-text {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 800;
}

.decision-waiting,
.next-action-waiting {
  border-left-color: #8a8f98;
}

.decision-waiting .decision-status {
  background: #f1f3f5;
  color: #565b61;
}

.decision-risk,
.next-action-risk {
  border-left-color: #dc3545;
  background: #fff5f5;
}

.decision-risk .decision-status {
  background: #ffe1e1;
  color: var(--danger);
}

.decision-low,
.next-action-warning {
  border-left-color: #f0ad4e;
  background: #fff9ed;
}

.decision-low .decision-status {
  background: #ffe8b8;
  color: var(--warning);
}

.decision-healthy,
.next-action-healthy {
  border-left-color: #20a162;
  background: #f5fbf7;
}

.decision-healthy .decision-status {
  background: #dff4e8;
  color: #1f6b43;
}

.decision-good,
.next-action-good {
  border-left-color: var(--brand);
  background: #f4f8ff;
}

.decision-good .decision-status {
  background: color-mix(in srgb, var(--brand) 14%, #fff);
  color: var(--brand);
}

.selection-report {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(0, 0, 0, .08);
  border-left: 4px solid #8a8f98;
  border-radius: 8px;
  background: var(--surface);
  line-height: 1.6;
}

.selection-waiting {
  border-left-color: #8a8f98;
}

.selection-waiting .decision-status {
  background: #f1f3f5;
  color: #565b61;
}

.selection-risk {
  border-left-color: #dc3545;
  background: #fff5f5;
}

.selection-warning {
  border-left-color: #f0ad4e;
  background: #fff9ed;
}

.selection-test {
  border-left-color: #20a162;
  background: #f5fbf7;
}

.selection-risk .decision-status {
  background: #ffe1e1;
  color: var(--danger);
}

.selection-warning .decision-status {
  background: #ffe8b8;
  color: var(--warning);
}

.selection-test .decision-status {
  background: #dff4e8;
  color: #1f6b43;
}

.selection-summary {
  color: var(--muted-strong);
  font-size: 14px;
}

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

.selection-report-grid > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .75);
}

.selection-report-grid span,
.selection-actions-title {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.selection-report-grid p,
.selection-actions {
  color: var(--muted-strong);
  font-size: 14px;
}

.selection-actions-title {
  margin-top: 12px;
}

.selection-actions {
  padding-left: 18px;
}

.selection-actions li + li {
  margin-top: 4px;
}

.explanation-panel,
.diagnosis-panel {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, .08);
  line-height: 1.7;
}

.explanation-title,
.diagnosis-title {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.explanation-list,
.diagnosis-list {
  padding-left: 18px;
  font-size: 14px;
}

.explanation-list li + li,
.diagnosis-list li + li {
  margin-top: 4px;
}

.diagnosis-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.validation-notice {
  margin: -4px 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 0, 0, .08);
  font-size: 14px;
  line-height: 1.6;
}

.validation-notice.is-ok {
  background: #f4fbf7;
  border-color: #b9e4ca;
  color: #23613a;
}

.validation-notice.has-warning {
  background: #fff9ed;
  border-color: #f0c36d;
  color: var(--warning);
}

.validation-notice.has-error {
  background: #fff1f1;
  border-color: #ff8a8a;
  color: #9f2331;
}

.validation-notice strong {
  display: block;
  margin-bottom: 4px;
}

.validation-notice ul {
  padding-left: 18px;
}

.validation-notice li + li {
  margin-top: 2px;
}

.export {
  border: 0;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.rate-helper-status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.rate-helper-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.rate-helper-button {
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--brand);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.rate-helper-button:hover {
  background: color-mix(in srgb, var(--brand) 7%, #fff);
}

.rate-helper-button:disabled {
  cursor: wait;
  opacity: .68;
}

.rate-helper-status {
  min-height: 16px;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
}

.rate-helper-status.is-error {
  color: var(--danger);
  font-weight: 700;
}

.rate-helper-status.is-ok {
  color: var(--success);
  font-weight: 700;
}

.throw-tip {
  display: none;
  margin-top: 12px;
  padding: 14px;
  background: #fff5f5;
  border: 1px solid #f1aeb5;
  border-radius: 8px;
  color: var(--danger);
  font-weight: 800;
  line-height: 1.7;
}

.export {
  width: 100%;
  min-height: 48px;
  padding: 13px 16px;
  font-size: 16px;
}

@media (max-width: 1000px) {
  .app-topbar {
    position: static;
    display: block;
    padding: 14px;
  }

  .page-header {
    display: block;
  }

  .topbar-actions {
    justify-content: flex-start;
    margin-top: 12px;
    overflow-x: auto;
  }

  .app-navigation {
    min-width: max-content;
  }

  .app-main {
    min-height: auto;
    padding: 14px;
  }

  h1 {
    font-size: 30px;
  }

  .top,
  .auto-selection-entry,
  .analysis-progress,
  .analysis-connection-grid,
  .analysis-insight-grid,
  .analysis-notes-grid,
  .ai-summary-grid,
  .api-placeholder-grid,
  .backend-endpoint-row,
  .integration-hero,
  .integration-card-head,
  .integration-section-head,
  .marketplace-card-row,
  .ozon-connection-grid,
  .ozon-connection-actions,
  .security-notes-card,
  .store-plan-row,
  .store-api-form,
  .store-backend-row,
  .store-profile-toolbar,
  .store-platform-summary,
  .store-api-list,
  .summary .grid,
  .future-panel .grid,
  .future-panel .product-selection-grid,
  .summary > .metrics,
  .fee-metrics,
  .subsidy-metrics,
  .cards,
  .selection-report-grid {
    grid-template-columns: 1fr;
  }

  .backend-action-stack,
  .security-note-grid {
    justify-content: flex-start;
    padding-top: 0;
  }

  .summary,
  .fee-panel,
  .subsidy-panel,
  .section {
    padding: 16px;
  }

  .metric .num,
  .card .num {
    font-size: 20px;
  }

  .big input {
    font-size: 22px;
  }
}

@media (max-width: 520px) {
  .app-topbar {
    padding: 12px;
  }

  .app-main {
    padding: 12px;
  }

  .tabs {
    grid-template-columns: 1fr;
    border-radius: 14px;
  }

  .tab {
    min-height: 38px;
    border-radius: 10px;
  }

  h1 {
    font-size: 24px;
  }

  input,
  select {
    font-size: 16px;
  }

  .rate-helper-row {
    grid-template-columns: 1fr;
  }

  .rate-helper-button {
    width: 100%;
  }
}
