:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --surface: #fffdfa;
  --surface-soft: #f1eee7;
  --ink: #24211d;
  --muted: #756f66;
  --line: #ded7cb;
  --brand: #bf6840;
  --brand-deep: #8f4b2d;
  --green: #267257;
  --blue: #3b67b5;
  --red: #b94d47;
  --shadow: 0 12px 30px rgba(80, 64, 48, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 18px 20px 32px;
}

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

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

.brand-button {
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
}

.brand-button:hover .brand-mark,
.brand-button.is-active .brand-mark {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(191, 104, 64, 0.24);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(180deg, #d98a5c 0%, var(--brand) 100%);
  color: #fff6ef;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(191, 104, 64, 0.22);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

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

.topnav-button,
.primary-button,
.ghost-button,
.wide-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 14px;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.topnav-button {
  background: rgba(255, 248, 240, 0.82);
  border-color: rgba(164, 125, 94, 0.12);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.topnav-button.is-active {
  background: rgba(255, 239, 226, 0.96);
  color: var(--ink);
  border-color: rgba(214, 131, 84, 0.24);
}

.topnav-button:hover,
.primary-button:hover,
.ghost-button:hover,
.wide-button:hover,
.metric-card:hover,
.list-row:hover {
  transform: translateY(-1px);
}

.app-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.page-head h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.18;
  letter-spacing: 0;
}

.page-head p {
  max-width: 720px;
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 900;
}

.primary-button {
  border-color: var(--brand);
  background: var(--brand);
  color: #fffaf5;
  font-weight: 800;
}

.ghost-button,
.wide-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 750;
}

.wide-button {
  width: 100%;
}

.wide-button:disabled {
  cursor: default;
  opacity: 0.72;
}

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

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

.metric-card {
  min-height: 118px;
  padding: 18px;
}

.metric-card span,
.metric-card strong,
.metric-card em {
  display: block;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metric-card strong {
  margin-top: 11px;
  font-size: 30px;
  line-height: 1;
}

.metric-card em {
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

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

.panel {
  padding: 18px;
}

.panel-title {
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 900;
}

.list-row,
.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  border-top: 1px solid var(--line);
}

.list-row:first-of-type,
.detail-row:first-of-type {
  border-top: 0;
}

.list-row strong,
.list-row span,
.row-meta em,
.detail-row span,
.detail-row strong {
  display: block;
}

.list-row strong,
.detail-row strong {
  font-size: 14px;
}

.list-row span,
.detail-row span,
.row-meta em {
  color: var(--muted);
  font-size: 12px;
}

.row-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 128px;
  text-align: right;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
}

.status-dot.ok {
  background: var(--green);
}

.pair-code {
  display: grid;
  place-items: center;
  min-height: 58px;
  margin-top: 14px;
  border: 1px dashed rgba(59, 103, 181, 0.38);
  border-radius: 8px;
  background: rgba(59, 103, 181, 0.08);
  color: var(--blue);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px;
  font-weight: 900;
}

.detail-list,
.action-list,
.doc-links {
  display: grid;
  gap: 10px;
}

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

.doc-links a {
  display: flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface-soft);
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 130px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .topbar,
  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topnav {
    justify-content: flex-start;
  }

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

@media (max-width: 640px) {
  .shell {
    padding: 14px 14px 28px;
  }

  .topnav {
    gap: 8px;
  }

  .topnav-button {
    padding: 8px 11px;
  }

  .page-head h1 {
    font-size: 24px;
  }

  .metric-grid,
  .split-grid,
  .doc-links {
    grid-template-columns: 1fr;
  }

  .list-row,
  .detail-row {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 12px 0;
  }

  .row-meta {
    justify-content: flex-start;
    min-width: 0;
    text-align: left;
  }
}
