:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #62708a;
  --line: #dbe3ef;
  --accent: #1e6fd9;
  --accent-dark: #174f9b;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 20px 32px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

.topbar nav {
  display: flex;
  gap: 16px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 24px auto 48px;
}

.intro-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr);
  gap: 24px;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 16px;
}

.intro-panel h2 {
  margin: 0 0 10px;
  font-size: 28px;
  line-height: 1.25;
}

.intro-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.eyebrow {
  margin-bottom: 8px !important;
  color: var(--accent) !important;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.intro-facts {
  display: grid;
  gap: 10px;
}

.intro-facts span {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7faff;
  padding: 12px;
  color: #21314d;
  font-weight: 600;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.panel h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.panel p {
  margin: 0 0 12px;
  color: var(--muted);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.filters {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.button-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filters label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none;
}

.inline-form {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.stack-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  max-width: 420px;
}

.wrap-form {
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}

.segmented label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  color: var(--ink);
  background: #f7faff;
  cursor: pointer;
}

.segmented label + label {
  border-left: 1px solid var(--line);
}

.segmented input {
  min-width: auto;
  height: auto;
}

input {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  min-width: 260px;
}

select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 36px 0 12px;
  background: #ffffff;
  color: var(--ink);
}

.manual-collect-form {
  display: grid;
  grid-template-columns: 150px minmax(280px, 1fr) 120px auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.manual-collect-form label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.manual-collect-form input,
.manual-collect-form select {
  width: 100%;
  min-width: 0;
}

.manual-collect-form button {
  white-space: nowrap;
}

#manualProfile {
  margin-top: 14px;
}

#manualProfile .metric-card strong {
  overflow-wrap: anywhere;
  font-size: 19px;
}

.compact-input {
  min-width: 140px;
  width: 100%;
}

.filters input {
  min-width: 150px;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
}

button:hover,
.button-link:hover {
  background: var(--accent-dark);
  color: #ffffff;
}

.small-button {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.danger-button {
  background: var(--danger);
}

.danger-button:hover {
  background: #8a1f17;
}

code {
  padding: 2px 6px;
  border-radius: 4px;
  background: #eef2f7;
  color: #21314d;
}

.status {
  color: var(--muted);
}

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

.page-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.user-table {
  margin-top: 14px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.metric-grid,
.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.metric-card,
.platform-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faff;
  padding: 14px;
}

.metric-card strong {
  display: block;
  font-size: 24px;
  color: var(--ink);
}

.metric-card span,
.platform-card p {
  color: var(--muted);
}

.platform-card div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.platform-card p {
  margin: 8px 0 0;
  line-height: 1.4;
}

.platform-status {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  color: #ffffff;
  background: #7a869a;
  white-space: nowrap;
}

.platform-status.available {
  background: #15803d;
}

.platform-status.planned {
  background: #64748b;
}

.page-button {
  height: auto;
  min-height: 72px;
  align-items: flex-start;
  flex-direction: column;
  background: #f7faff;
  color: var(--ink);
  border: 1px solid var(--line);
  text-align: left;
}

.page-button:hover {
  background: #eef5ff;
  color: var(--ink);
}

.page-button span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

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

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

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

th {
  font-size: 13px;
  color: #33415c;
  background: #f1f5fb;
}

td:not(:nth-child(2)) {
  white-space: nowrap;
}

.post-message {
  max-width: 460px;
  max-height: 72px;
  overflow: hidden;
  color: var(--ink);
}

.policy-page {
  background: #ffffff;
}

.policy-shell {
  max-width: 760px;
  margin: 48px auto;
  padding: 0 24px;
  line-height: 1.6;
}

@media (max-width: 760px) {
  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .intro-panel {
    grid-template-columns: 1fr;
  }

  .button-group {
    justify-content: flex-start;
  }

  .manual-collect-form {
    grid-template-columns: 1fr;
  }
}
