:root {
  --ink: #151515;
  --muted: #6f726d;
  --line: #e5e0d7;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --red: #e33131;
  --green: #158a5b;
  --blue: #246bfe;
  --amber: #b97712;
  --violet: #7247c5;
  --shadow: 0 18px 55px rgba(30, 25, 15, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(229, 224, 215, 0.42) 1px, transparent 1px),
    linear-gradient(rgba(229, 224, 215, 0.36) 1px, transparent 1px), var(--paper);
  background-size: 34px 34px;
  color: var(--ink);
  font-family: Manrope, ui-sans-serif, system-ui, sans-serif;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(520px, 100%);
  display: grid;
  gap: 22px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 6px 0 0;
  font-family: Newsreader, serif;
  font-size: clamp(38px, 7vw, 62px);
  line-height: 0.95;
}

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

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px;
  border-right: 1px solid var(--line);
  background: rgba(251, 250, 246, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-family: Newsreader, serif;
  font-size: 28px;
}

.brand strong,
.brand small {
  display: block;
}

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

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: transparent;
  color: #373936;
  text-align: left;
  font-weight: 700;
}

.nav-item:hover,
.nav-item.active {
  background: var(--ink);
  color: white;
}

.sidebar-panel {
  margin-top: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8ea;
}

.sidebar-panel p,
.muted {
  color: var(--muted);
  line-height: 1.6;
}

.workspace {
  min-width: 0;
  padding: 30px;
}

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

.topbar h1 {
  max-width: 780px;
  margin: 8px 0 0;
  font-family: Newsreader, serif;
  font-size: clamp(34px, 5vw, 68px);
  line-height: 0.92;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button,
.ghost-button,
.text-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  background: var(--red);
  color: white;
}

.ghost-button {
  background: white;
  border-color: var(--line);
  color: var(--ink);
}

.text-button {
  background: transparent;
  color: var(--blue);
  padding: 0;
}

.hero-strip {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding: 26px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(21, 21, 21, 0.94), rgba(21, 21, 21, 0.74)),
    url('https://images.unsplash.com/photo-1556742049-0cfed4f6a45d?auto=format&fit=crop&w=1400&q=80');
  background-position: center;
  background-size: cover;
  color: white;
  overflow: hidden;
}

.hero-strip h2 {
  max-width: 760px;
  margin: 16px 0 0;
  font-size: clamp(24px, 3vw, 40px);
  line-height: 1.05;
}

.hero-metrics {
  align-self: stretch;
  min-width: 220px;
  display: grid;
  align-content: end;
  justify-items: end;
  gap: 8px;
}

.hero-metrics span {
  color: rgba(255, 255, 255, 0.72);
  font-weight: 700;
}

.hero-metrics strong {
  font-size: 28px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
}

.status-pill.ok {
  background: #def7eb;
  color: #075c3c;
}

.status-pill.ready {
  background: #e9f0ff;
  color: #173e9f;
}

.status-pill.planned {
  background: #f6eee1;
  color: #704708;
}

.status-pill.pending,
.status-pill.retrying {
  background: #fff3d7;
  color: #7c5200;
}

.status-pill.paid,
.status-pill.delivered {
  background: #ddf6e8;
  color: #075c3c;
}

.status-pill.refunded {
  background: #eee8ff;
  color: #4f2f99;
}

.status-pill.canceled {
  background: #f1f1ef;
  color: #5f5a52;
}

.status-pill.processing {
  background: #e9f0ff;
  color: #173e9f;
}

.status-pill.active {
  background: #ddf6e8;
  color: #075c3c;
}

.status-pill.paused {
  background: #fff3d7;
  color: #7c5200;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric,
.panel,
.integration-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span,
.metric small {
  color: var(--muted);
  font-weight: 700;
}

.metric strong {
  display: block;
  margin: 10px 0 4px;
  font-size: 32px;
}

.two-column,
.developer-layout,
.kaspi-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: 14px;
}

.panel {
  padding: 22px;
}

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

.section-title h3,
.panel h3 {
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1.1;
}

.table {
  display: grid;
}

.row {
  display: grid;
  grid-template-columns: 1.2fr 0.7fr 0.8fr 0.7fr auto;
  gap: 14px;
  align-items: center;
  min-height: 58px;
  border-top: 1px solid #eee9df;
}

.row:first-child {
  border-top: 0;
}

.row strong,
.row small {
  display: block;
}

.row small {
  color: var(--muted);
  margin-top: 3px;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  min-width: 94px;
}

.icon-text-button {
  border: 1px solid #e4d8ca;
  border-radius: 6px;
  background: #fff;
  color: #1a1a1a;
  font-weight: 900;
  padding: 8px 10px;
  cursor: pointer;
}

.icon-text-button:hover {
  border-color: #dc443e;
  color: #dc443e;
}

.icon-text-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

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

.event-list {
  display: grid;
  gap: 12px;
}

.event {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px 0;
  border-top: 1px solid #eee9df;
}

.event:first-child {
  border-top: 0;
}

.event code,
.api-key-box code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.segmented button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 7px 10px;
  font-weight: 800;
}

.segmented button.active {
  background: var(--ink);
  color: white;
}

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

.integration-card {
  padding: 18px;
}

.integration-card h4 {
  margin: 12px 0 8px;
  font-size: 20px;
}

.integration-card p {
  min-height: 78px;
  color: var(--muted);
  line-height: 1.55;
}

.integration-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  background: white;
  color: #4b4d49;
  font-size: 12px;
  font-weight: 800;
}

.search,
input,
select,
textarea {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
  outline: none;
}

.search:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36, 107, 254, 0.12);
}

textarea {
  min-height: 112px;
  padding-top: 12px;
  resize: vertical;
}

.api-key-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 20px 0;
  padding: 12px;
  border: 1px dashed #cbc2b3;
  border-radius: 8px;
  background: #fffaf0;
}

.api-key-box code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.endpoint-list {
  display: grid;
  gap: 10px;
}

.endpoint-list div {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.endpoint-list strong {
  color: var(--green);
}

.code-panel pre {
  max-width: 100%;
  overflow: auto;
  margin: 0;
  padding: 16px;
  border-radius: 8px;
  background: #171717;
  color: #f8f4e9;
  line-height: 1.5;
}

.response-box {
  min-height: 74px;
  margin-top: 12px;
  padding: 14px;
  border-radius: 8px;
  background: #eef7f1;
  color: #12412d;
  white-space: pre-wrap;
  overflow: auto;
}

.response-box.error {
  background: #ffe8e5;
  color: #8d1b16;
}

.response-box.success {
  background: #eef7f1;
  color: #12412d;
}

.webhook-panel {
  margin-top: 14px;
}

.docs-link {
  display: inline-flex;
  margin-top: 18px;
  color: var(--blue);
  font-weight: 900;
  text-decoration: none;
}

.wide-button {
  width: 100%;
  margin-top: 12px;
}

.progress {
  height: 10px;
  margin: 18px 0;
  border-radius: 999px;
  background: #eee9df;
  overflow: hidden;
}

.progress span {
  display: block;
  width: 86%;
  height: 100%;
  background: var(--blue);
}

.upgrade-panel {
  border-color: #f3bd61;
  background: #fff8ea;
}

.webhook-form {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
  align-items: end;
}

.connect-steps {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.account-card {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.account-card strong,
.account-card small {
  display: block;
}

.account-card small {
  color: var(--muted);
  line-height: 1.5;
}

.connect-steps div {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.connect-steps strong {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
}

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

label {
  display: grid;
  gap: 7px;
  color: #333631;
  font-weight: 800;
}

.message {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #fff3d7;
  color: #6d4900;
  font-weight: 700;
}

.message.error {
  background: #ffe1df;
  color: #9b1b17;
}

.hidden {
  display: none !important;
}

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

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

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

  .nav-item {
    text-align: center;
  }

  .metric-grid,
  .integration-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .hero-strip,
  .section-title {
    display: grid;
  }

  .hero-metrics {
    justify-items: start;
  }

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

  .metric-grid,
  .two-column,
  .developer-layout,
  .kaspi-layout,
  .integration-grid {
    grid-template-columns: 1fr;
  }

  .row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 14px 0;
  }
}
