:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1d2430;
  --muted: #667085;
  --line: #dde2ea;
  --accent: #1677ff;
  --accent-soft: #e8f2ff;
  --ok: #168a4a;
  --warn: #b76e00;
  --danger: #c03535;
  --shadow: 0 14px 40px rgba(26, 38, 62, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #111827;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  font-weight: 800;
}

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

.brand span {
  margin-top: 4px;
  color: #b7c0ce;
  font-size: 13px;
}

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

.nav-item {
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d5dbe6;
  text-align: left;
  cursor: pointer;
  font-size: 15px;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.side-note {
  margin-top: auto;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #cdd5e2;
  line-height: 1.6;
  font-size: 13px;
}

.side-note span {
  display: block;
  margin-bottom: 6px;
  color: #fff;
  font-weight: 700;
}

.app {
  min-width: 0;
  padding: 28px;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.api-link,
.primary,
.secondary {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
}

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

.secondary {
  background: var(--accent-soft);
  border-color: #bad6ff;
  color: #0b5dcc;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid,
.platform-grid,
.split,
.endpoint-grid {
  display: grid;
  gap: 16px;
}

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

.metric,
.panel,
.platform-card,
.content-card,
.lead-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

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

.metric strong {
  font-size: 26px;
}

.panel {
  padding: 20px;
  margin-bottom: 16px;
}

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

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

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

.platform-card {
  padding: 16px;
}

.platform-card h3,
.content-card h3,
.lead-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.platform-card p,
.content-card p,
.lead-card p {
  color: var(--muted);
  line-height: 1.55;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef2f6;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.badge.ok {
  background: #e9f8ef;
  color: var(--ok);
}

.badge.warn {
  background: #fff4df;
  color: var(--warn);
}

.badge.danger {
  background: #ffeded;
  color: var(--danger);
}

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

.event {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 160px;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.event:last-child {
  border-bottom: 0;
}

.split {
  grid-template-columns: minmax(0, 1.4fr) minmax(340px, 0.6fr);
}

.content-card,
.lead-card {
  padding: 16px;
}

.content-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

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

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

.table {
  overflow: auto;
}

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

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

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

.code-box {
  min-height: 240px;
  overflow: auto;
  padding: 16px;
  border-radius: 8px;
  background: #0f172a;
  color: #d8e4ff;
  line-height: 1.6;
  white-space: pre-wrap;
}

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

.endpoint-grid code {
  display: block;
  padding: 12px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #12305a;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

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

  .metric-grid,
  .platform-grid,
  .split,
  .endpoint-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-head,
  .event {
    grid-template-columns: 1fr;
    align-items: start;
  }
}
