:root {
  --ink: #17202a;
  --muted: #667085;
  --line: #e4e7ec;
  --surface: #ffffff;
  --soft: #f6f7fb;
  --brand: #5b35d5;
  --brand-dark: #4323aa;
  --success: #067647;
  --success-bg: #ecfdf3;
  --error: #b42318;
  --shadow: 0 12px 32px rgba(24, 30, 42, .07);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; }
button, input { font: inherit; }

.topbar {
  min-height: 66px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #19152b;
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 730; }
.brand-mark {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 10px; background: #fff; color: var(--brand); font-weight: 850;
}
.user-menu { display: flex; align-items: center; gap: 18px; color: #d6d1e8; font-size: 14px; }
.user-menu form { margin: 0; }
.link-button { border: 0; padding: 0; background: transparent; color: #fff; cursor: pointer; }

.nav-shell {
  display: flex; gap: 24px; padding: 0 28px; background: #fff; border-bottom: 1px solid var(--line);
}
.nav-shell a { padding: 15px 2px 12px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; }
.nav-shell a[aria-current="page"] { color: var(--brand); border-color: var(--brand); font-weight: 700; }
.page-shell { max-width: 1180px; margin: 0 auto; padding: 34px 28px 64px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 26px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 4vw, 40px); line-height: 1.1; letter-spacing: -.035em; }
h2 { margin-bottom: 3px; font-size: 20px; }
.eyebrow { margin-bottom: 7px; color: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.muted { margin-bottom: 0; color: var(--muted); }

.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 10px 18px; border: 1px solid transparent; border-radius: 10px; text-decoration: none; font-weight: 720; cursor: pointer; }
.button.primary { background: var(--brand); color: #fff; box-shadow: 0 5px 15px rgba(91,53,213,.22); }
.button.primary:hover { background: var(--brand-dark); }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 24px; }
.metric-card, .panel, .integration-card, .auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.metric-card { min-height: 150px; padding: 22px; display: flex; flex-direction: column; }
.metric-card span { color: var(--muted); }
.metric-card strong { margin: auto 0 4px; font-size: 28px; letter-spacing: -.025em; }
.metric-card small { color: var(--muted); }
.metric-card.placeholder strong { font-size: 20px; color: #344054; }
.panel { padding: 24px; }
.panel-heading { margin-bottom: 18px; }

.launch-list { margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; list-style: none; }
.launch-list li { display: flex; gap: 10px; padding: 14px; border-radius: 12px; background: var(--soft); color: var(--muted); }
.launch-list li > span { width: 27px; height: 27px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: #e9e7f2; font-weight: 800; }
.launch-list strong, .launch-list small { display: block; }
.launch-list small { margin-top: 3px; }
.launch-list .active { background: #f0edff; color: var(--ink); }
.launch-list .active > span { background: var(--brand); color: #fff; }

.integration-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.integration-card { padding: 24px; }
.integration-head { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; margin-bottom: 22px; }
.integration-head h2, .integration-head p { margin: 0; }
.integration-head p { color: var(--muted); font-size: 13px; }
.market-logo { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; color: #fff; font-weight: 850; }
.market-logo.wb { background: linear-gradient(135deg, #cb11ab, #6611c9); }
.market-logo.ozon { background: #1469ff; }
.status { padding: 5px 9px; border-radius: 999px; background: #f2f4f7; color: var(--muted); font-size: 12px; font-weight: 760; }
.status.success { background: var(--success-bg); color: var(--success); }
.connection-summary { display: flex; justify-content: space-between; gap: 10px; margin: -8px 0 18px; padding: 10px 12px; border-radius: 9px; background: var(--success-bg); color: var(--success); font-size: 13px; }
.stack-form { display: grid; gap: 9px; }
.stack-form label { margin-top: 4px; font-weight: 680; }
.stack-form input { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid #cfd4dc; border-radius: 9px; background: #fff; }
.stack-form input:focus { outline: 3px solid rgba(91,53,213,.13); border-color: var(--brand); }
.stack-form .button { margin-top: 7px; }
.field-help, .notice { margin: 0; color: var(--muted); font-size: 13px; }
.errorlist { margin: 0; padding: 8px 11px; border-radius: 8px; background: #fef3f2; color: var(--error); list-style: none; }
.security-note { margin-top: 20px; padding: 16px 18px; border: 1px solid #d9d5ef; border-radius: 12px; background: #f6f3ff; color: #41377a; }

.messages { margin-bottom: 18px; }
.message { padding: 12px 14px; border-radius: 10px; background: #eef1f5; }
.message.success { background: var(--success-bg); color: var(--success); }
.message.error { background: #fef3f2; color: var(--error); }
.auth-card { max-width: 430px; margin: 8vh auto 0; padding: 30px; }

@media (max-width: 800px) {
  .metric-grid, .integration-grid { grid-template-columns: 1fr; }
  .launch-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-heading { align-items: start; flex-direction: column; }
}
@media (max-width: 520px) {
  .topbar { padding: 0 16px; }
  .brand > span:last-child { display: none; }
  .user-menu > span { display: none; }
  .nav-shell { padding: 0 16px; }
  .page-shell { padding: 24px 16px 48px; }
  .launch-list { grid-template-columns: 1fr; }
  .integration-head { grid-template-columns: auto 1fr; }
  .integration-head .status { grid-column: 1 / -1; justify-self: start; }
  .connection-summary { flex-direction: column; }
}
