:root {
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #17202a;
  background: #f6f7f9;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid #1f7a8c;
  background: #1f7a8c;
  color: white;
  border-radius: 6px;
  min-height: 36px;
  padding: 0 14px;
  cursor: pointer;
}

button.secondary {
  background: white;
  color: #1f7a8c;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

input,
select {
  min-height: 36px;
  border: 1px solid #c8d0d8;
  border-radius: 6px;
  padding: 0 10px;
  background: white;
  color: #17202a;
}

.shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid #dce2e8;
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  white-space: nowrap;
}

.brand strong {
  font-size: 18px;
}

.brand span {
  color: #5b6673;
  font-size: 13px;
}

.token-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(640px, 100%);
}

.token-row input {
  flex: 1;
  min-width: 180px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.9fr);
  gap: 18px;
  padding: 18px 24px 28px;
}

.qr-login {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 24px 0;
  padding: 12px 14px;
  border: 1px solid #dce2e8;
  border-radius: 8px;
  background: #ffffff;
  width: fit-content;
}

.qr-login div {
  display: grid;
  gap: 4px;
}

.qr-login span {
  color: #697584;
  font-size: 13px;
}

.qr-login img {
  width: 160px;
  height: 160px;
  border: 1px solid #e5e9ee;
  border-radius: 6px;
}

.panel {
  background: #ffffff;
  border: 1px solid #dce2e8;
  border-radius: 8px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e9ee;
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
}

.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #edf0f3;
  vertical-align: top;
}

th {
  background: #f9fafb;
  color: #4d5967;
  font-weight: 600;
  position: sticky;
  top: 0;
}

tr:hover td {
  background: #f7fbfc;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.muted {
  color: #697584;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  background: #eef6f8;
  color: #155d6c;
  font-size: 12px;
  white-space: nowrap;
}

.detail {
  display: grid;
  gap: 14px;
  padding: 14px 16px 18px;
}

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

.metric {
  border: 1px solid #e2e7ec;
  border-radius: 8px;
  padding: 10px;
}

.metric span {
  display: block;
  color: #697584;
  font-size: 12px;
  margin-bottom: 4px;
}

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

.delta-pos {
  color: #0a7a45;
}

.delta-neg {
  color: #b42318;
}

.stack {
  display: grid;
  gap: 12px;
}

.error {
  color: #b42318;
  padding: 10px 16px;
  border-top: 1px solid #f0d5d2;
  background: #fff7f6;
}

.error.inline {
  border: 0;
  border-radius: 6px;
  margin-top: 12px;
  padding: 8px 10px;
}

.web-shell {
  min-height: 100vh;
  background: #f6f7f9;
}

.web-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: #ffffff;
  border-bottom: 1px solid #dce2e8;
}

.admin-link,
.text-button {
  color: #1f7a8c;
  font-weight: 600;
  text-decoration: none;
}

.web-login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 28px;
  align-items: center;
  max-width: 880px;
  margin: 64px auto;
  padding: 0 24px;
}

.login-copy h1 {
  margin: 0;
  font-size: 38px;
}

.login-copy p {
  color: #5b6673;
  line-height: 1.7;
  max-width: 520px;
}

.web-qr {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 16px;
  border: 1px solid #dce2e8;
  border-radius: 8px;
  background: #ffffff;
}

.web-qr img {
  width: 188px;
  height: 188px;
}

.web-qr span {
  color: #697584;
  font-size: 13px;
}

.web-home {
  display: grid;
  gap: 18px;
  max-width: 760px;
  margin: 42px auto;
  padding: 0 24px;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px;
  background: #ffffff;
  border: 1px solid #dce2e8;
  border-radius: 8px;
}

.profile-hero h1 {
  margin: 0 0 6px;
  font-size: 26px;
}

.avatar-large {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #e5e9ee;
  overflow: hidden;
  flex: 0 0 auto;
}

.avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.web-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

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

  .layout {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .web-login {
    grid-template-columns: 1fr;
    margin: 32px auto;
  }

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