:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #141922;
  --muted: #5f6b7a;
  --line: #dbe2ea;
  --accent: #176b87;
  --accent-strong: #10536a;
  --mint: #2fbf88;
  --yellow: #fff7da;
  --yellow-line: #e5c75c;
  --shadow: 0 18px 45px rgba(24, 38, 55, 0.1);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(23, 107, 135, 0.12), transparent 32%),
    linear-gradient(315deg, rgba(47, 191, 136, 0.12), transparent 35%),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 14px;
  background: #ffffff;
  color: #1f2937;
  font-weight: 800;
  cursor: pointer;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 14px;
  background: #ffffff;
  color: #1f2937;
  font-weight: 800;
  text-decoration: none;
}

.button-link.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-strong);
}

h1,
h2,
p {
  margin: 0;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 48px;
}

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

.eyebrow,
.section-label {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin-top: 5px;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1.02;
  letter-spacing: 0;
}

.subtitle {
  max-width: 650px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.78);
}

.status-strip div {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.status-strip span:last-child {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #a9b4c2;
  box-shadow: 0 0 0 4px rgba(169, 180, 194, 0.2);
}

.dot.connected {
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(47, 191, 136, 0.18);
}

.workspace {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
}

.single-workspace {
  display: block;
}

.sidebar {
  align-self: start;
  position: sticky;
  top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  margin-bottom: 18px;
  background: #182635;
  color: white;
  font-weight: 900;
}

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

nav a {
  border-radius: 7px;
  padding: 10px 11px;
  color: #263241;
  font-weight: 800;
  text-decoration: none;
}

nav a.active,
nav a:hover {
  background: #eaf4f7;
  color: var(--accent-strong);
}

.content {
  display: grid;
  gap: 16px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

h2 {
  margin-top: 4px;
  font-size: 24px;
  line-height: 1.2;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.toggle input {
  width: 18px;
  height: 18px;
}

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

.wide-field {
  grid-column: 1 / -1;
}

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

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--ink);
  background: #fbfcfe;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.16);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.price-tag {
  flex: 0 0 auto;
  border: 1px solid #bee6d5;
  border-radius: 7px;
  padding: 9px 12px;
  background: #edfbf5;
  color: #106b4b;
  font-weight: 900;
}

.result,
.output {
  width: 100%;
  margin-top: 16px;
  border: 1px solid #dce4ec;
  border-radius: 7px;
  padding: 12px;
  background: #f8fafc;
  color: #263241;
  line-height: 1.55;
  overflow: auto;
}

.output {
  min-height: 170px;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.metric-row div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.metric-row span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metric-row strong {
  display: block;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.qr-panel {
  scroll-margin-top: 18px;
}

.qr-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.qr-box {
  display: grid;
  place-items: center;
  width: 240px;
  max-width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.qr-box img {
  display: block;
  width: 220px;
  max-width: calc(100% - 20px);
  aspect-ratio: 1;
}

.qr-copy {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.qr-copy strong {
  font-size: 18px;
}

.qr-copy p {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #f8fafc;
  color: #263241;
  overflow-wrap: anywhere;
}

.qr-copy span {
  color: var(--muted);
  line-height: 1.55;
}

.fine-print {
  margin-top: 14px;
  border: 1px solid var(--yellow-line);
  border-radius: 8px;
  padding: 12px;
  background: var(--yellow);
  color: #5b4a12;
  line-height: 1.65;
}

.flow-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.flow-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.flow-card span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: #182635;
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
}

.flow-card strong {
  display: block;
  margin-bottom: 7px;
  font-size: 16px;
}

.flow-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.flow-arrow {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 24px;
  font-weight: 900;
}

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

.backend-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.backend-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.backend-grid strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 16px;
}

.charge-box {
  margin-top: 16px;
  border: 1px solid #cbdde6;
  border-radius: 8px;
  padding: 16px;
  background: #f3f8fb;
}

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

.subscriber-row {
  display: grid;
  gap: 6px;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 12px;
  text-align: left;
  border-radius: 8px;
  background: #fbfcfe;
}

.subscriber-row strong,
.subscriber-row span {
  overflow-wrap: anywhere;
}

.subscriber-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 22px;
  }

  .topbar,
  .status-strip,
  .workspace,
  .form-grid,
  .metric-row,
  .qr-layout,
  .backend-grid {
    grid-template-columns: 1fr;
  }

  .flow-board {
    grid-template-columns: 1fr;
  }

  .flow-arrow {
    min-height: 22px;
    transform: rotate(90deg);
  }

  .topbar,
  .status-strip {
    display: grid;
    align-items: start;
  }

  .sidebar {
    position: static;
    display: flex;
    align-items: center;
    gap: 14px;
  }

  nav {
    display: flex;
    flex-wrap: wrap;
  }

  .brand-mark {
    margin-bottom: 0;
  }

  .panel-head {
    display: grid;
  }

  h1 {
    font-size: 38px;
  }
}
