:root {
  --bg: #ffffff;
  --bg-soft: #f6f7fb;
  --card: #ffffff;
  --text: #131925;
  --muted: #697182;
  --accent: #131925;
  --accent-2: #2d3647;
  --border: #e4e8ef;
  --danger: #d63e52;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg-soft);
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-exit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-soft) 100%);
  box-shadow: 0 1px 2px rgba(19, 25, 37, 0.05);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease,
    color 0.2s ease;
}

.topbar-exit:hover {
  border-color: #d0d6e0;
  color: var(--accent);
  box-shadow: 0 3px 10px rgba(19, 25, 37, 0.09);
  transform: translateY(-1px);
}

.topbar-exit:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(19, 25, 37, 0.06);
}

.topbar-exit__text {
  color: var(--muted);
  font-weight: 600;
  transition: color 0.2s ease;
}

.topbar-exit:hover .topbar-exit__text {
  color: var(--accent);
}

.topbar-exit__ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 10px;
  line-height: 1;
  border-radius: 6px;
  background: rgba(255, 127, 87, 0.12);
  color: #e85a32;
  transition: transform 0.22s ease, background 0.2s ease;
}

.topbar-exit:hover .topbar-exit__ico {
  transform: translate(2px, -2px);
  background: rgba(255, 127, 87, 0.22);
}

.login-exit-wrap {
  margin: 16px 0 0;
}

.login-card .topbar-exit {
  width: 100%;
  justify-content: center;
}

.brand {
  font-size: 22px;
  font-weight: 700;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

nav a {
  text-decoration: none;
  color: var(--text);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

nav a.active {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
  font-weight: 700;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

.grid--kpi3 {
  margin-top: 16px;
}

.kpi {
  grid-column: span 4;
}

.kpi h3 {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.kpi p {
  margin: 8px 0 0;
  font-size: 28px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .kpi {
    grid-column: span 6;
  }
}

@media (max-width: 560px) {
  .kpi--third {
    grid-column: span 12;
  }
}

.section {
  margin-top: 16px;
}

label {
  display: block;
  margin: 10px 0 6px;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

button {
  margin-top: 14px;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  cursor: pointer;
}

.btn-muted {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}

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

.status-error {
  color: var(--danger);
}

.landing-hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  align-items: center;
  margin-top: 18px;
}

@media (max-width: 720px) {
  .landing-hero {
    grid-template-columns: 1fr;
  }
}

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

.hidden {
  display: none !important;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.status-dot--on {
  background: #ff7f57;
  border-color: #ff7f57;
}

.status-dot--off {
  background: #e4e8ef;
}

.strategy-code {
  display: inline-block;
  padding: 8px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  word-break: break-all;
}

.strategy-code.block {
  display: block;
  width: 100%;
}

.strategy-cell {
  font-size: 11px;
  max-width: 220px;
  word-break: break-word;
}

.dash-hero {
  margin-top: 0;
}

.dash-statuses {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-sync-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin: 8px 0;
}

.status-sync-block__head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-at {
  display: block;
  margin-left: 22px;
  font-size: 12px;
  font-style: italic;
  font-weight: 400;
  color: #9aa3b2;
}

.dash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.dash-btn {
  margin-top: 0;
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  background: #131925;
  color: #fff;
}

.dash-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.dash-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.dash-btn--repricer.dash-btn--repricer-on {
  background: #ff7f57;
  color: #fff;
}

.dash-btn--repricer.dash-btn--repricer-on:hover:not(:disabled) {
  filter: brightness(1.05);
}

.dash-msg {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--danger);
}

.metrics-note {
  font-size: 12px;
  margin-top: 0;
  margin-bottom: 14px;
}

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

@media (max-width: 640px) {
  .metrics-deltas {
    grid-template-columns: 1fr;
  }
}

.metrics-delta-card {
  padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.metrics-delta-card h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.metrics-delta-main {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.metrics-delta-sub {
  margin: 6px 0 0;
  font-size: 12px;
}

.table--nowrap th,
.table--nowrap td {
  white-space: nowrap;
}

.table--history {
  font-size: 12px;
}

.table--history .td-ellipsis {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table--history .strategy-cell {
  max-width: 180px;
}

.scenario-card .scenario-steps {
  margin: 0;
  padding-left: 1.2rem;
}

.scenario-step {
  margin-bottom: 14px;
}

.scenario-step:last-child {
  margin-bottom: 0;
}

.scenario-bullets {
  margin: 6px 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 14px;
}

.scenario-step-body {
  margin: 6px 0 0;
  font-size: 14px;
}

.sync-result-line {
  margin-top: 8px;
  font-size: 13px;
}

.table-products {
  font-size: 13px;
}

.table-products .td-clip {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.price-flat {
  color: var(--muted);
}

.price-delta {
  font-weight: 600;
}

.price-delta--up {
  color: #1a7f37;
}

.price-delta--down {
  color: #b42318;
}

.price-delta-pct {
  font-weight: 500;
  color: var(--muted);
}

.repricer-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
}

.repricer-badge--hold {
  color: var(--muted);
  background: var(--bg-soft);
}

.repricer-badge--increase {
  color: #1a7f37;
  border-color: #b7dfc4;
  background: #f0fdf4;
}

.repricer-badge--decrease {
  color: #b42318;
  border-color: #f5c4c0;
  background: #fff5f5;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.strategy-page-form {
  display: block;
}

.strategy-tab {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}

.strategy-status-panel {
  margin-bottom: 4px;
}

.strategy-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.strategy-tab .strategy-status-label,
.strategy-tab .strategy-form .strategy-main-label,
.strategy-tab .strategy-checkbox-row {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
}

.strategy-tab .strategy-number-line {
  margin: 2px 0 8px 22px;
  padding: 0;
  font-size: 12px;
  font-style: italic;
  font-weight: 400;
  line-height: 1.4;
  color: var(--muted);
  word-break: break-all;
}

.strategy-major-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0 16px;
}

.strategy-tab .strategy-params-title,
.strategy-tab .strategy-test-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.strategy-tab .strategy-field-label {
  margin: 8px 0 4px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.strategy-tab .strategy-field-hint {
  font-weight: 400;
  font-style: italic;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0;
  max-width: 42rem;
}

.strategy-form {
  display: grid;
  gap: 8px 24px;
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

.strategy-form .strategy-test-embed {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.strategy-form .strategy-form-actions {
  grid-column: 1 / -1;
  margin-top: 8px;
}

.strategy-form .strategy-form-actions button {
  margin-top: 0;
}

.strategy-form label.strategy-field-label {
  margin: 8px 0 4px;
  cursor: pointer;
}

.strategy-form input,
.strategy-form select {
  margin-top: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 15px;
}

.strategy-tab .strategy-test-block-hint {
  margin-top: 8px;
  max-width: 42rem;
}

.strategy-tab .strategy-save-status {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

.strategy-tab .sku-chip {
  font-size: 15px;
}

@media (max-width: 720px) {
  .strategy-form {
    grid-template-columns: 1fr;
  }
}

.strategy-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  cursor: pointer;
}

.strategy-checkbox-row input {
  width: auto;
  margin: 0;
}

.sku-test-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.sku-test-add-row input {
  flex: 1;
  min-width: 160px;
  margin-top: 0;
}

.sku-test-add-row .btn-muted {
  margin-top: 0;
}

.sku-chip-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sku-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.sku-chip__remove {
  margin: 0;
  padding: 0 6px;
  min-width: 28px;
  height: 28px;
  line-height: 1;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.sku-chip__remove:hover {
  background: var(--border);
  color: var(--danger);
}

.api-tab {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}

.api-tab .api-section-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.api-tab .api-connect-section .api-token-form {
  max-width: 28rem;
}

.api-tab .api-token-field {
  margin-bottom: 12px;
}

.api-tab .api-token-form input {
  margin-top: 0;
  font-size: 14px;
}

.api-tab .api-token-form input::placeholder {
  font-size: 12px;
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
  opacity: 0.55;
}

.api-tab .api-token-form input::-webkit-input-placeholder {
  font-size: 12px;
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
  opacity: 0.55;
}

.api-tab .api-token-form button[type="submit"] {
  margin-top: 6px;
}

.api-tab .api-token-feedback {
  margin: 12px 0 0;
  font-size: 15px;
  line-height: 1.45;
}

.api-tab .api-token-feedback--ok {
  color: #1a7f37;
}

.api-tab .api-forget-token-btn {
  display: block;
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(105, 113, 130, 0.12);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.75;
}

.api-tab .api-forget-token-btn:hover {
  opacity: 1;
  background: rgba(105, 113, 130, 0.2);
}
