:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --ink: #18221d;
  --muted: #647069;
  --line: #dce2dc;
  --green: #176b46;
  --green-dark: #0f4930;
  --red: #a43d3d;
  --amber: #8a6617;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #f8faf7 0, var(--bg) 280px);
  font-family: "Segoe UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
code, pre { font-family: "Cascadia Code", Consolas, monospace; }
.topbar {
  display: flex;
  width: min(1180px, calc(100% - 48px));
  min-height: 76px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 5px;
  color: #fff;
  background: var(--green);
  font-size: 14px;
  font-weight: 900;
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { font-size: 16px; }
.brand-copy span { margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.nav { display: flex; align-items: center; gap: 18px; font-size: 13px; font-weight: 650; }
.nav a { color: var(--ink); text-decoration: none; }
.nav a:hover { color: var(--green); }
.nav form { margin: 0; }
.link-button { border: 0; padding: 0; color: var(--muted); background: transparent; font-size: 13px; }
.link-button:hover { color: var(--red); }
.page { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 48px 0 80px; }
.page-head { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 34px; line-height: 1.15; letter-spacing: -.02em; }
h2 { margin-bottom: 18px; font-size: 18px; line-height: 1.25; }
.eyebrow { margin-bottom: 8px; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.muted { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.panel { margin-bottom: 22px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel-head { display: flex; justify-content: space-between; gap: 20px; }
.inline-form { display: flex; align-items: end; gap: 14px; flex-wrap: wrap; }
.inline-form label { display: flex; min-width: 210px; flex: 1; flex-direction: column; gap: 7px; color: #405047; font-size: 12px; font-weight: 700; }
input {
  width: 100%;
  height: 43px;
  border: 1px solid #cbd4cc;
  border-radius: 4px;
  padding: 0 12px;
  outline: none;
  background: #fcfdfb;
  color: var(--ink);
  font-size: 13px;
}
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,107,70,.1); }
.primary, .secondary {
  display: inline-flex;
  min-height: 41px;
  padding: 0 16px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}
.primary { color: #fff; background: var(--green); }
.primary:hover { background: var(--green-dark); }
.secondary { border-color: var(--line); color: var(--ink); background: #fff; }
.secondary:hover { border-color: var(--green); color: var(--green); }
.button-link { display: inline-flex; }
.grid { display: grid; margin-bottom: 22px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.site-card { margin: 0; }
.site-head { display: flex; justify-content: space-between; gap: 18px; }
.site-head h2 { margin-bottom: 5px; }
.site-head code { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.status { display: inline-flex; min-height: 24px; padding: 2px 8px; align-items: center; border-radius: 3px; font-size: 10px; font-weight: 750; white-space: nowrap; }
.status.ok { color: #125738; background: #e5f2e8; }
.status.off { color: #794126; background: #fbeddf; }
.stack { display: flex; flex-direction: column; gap: 13px; }
.stack label { display: flex; flex-direction: column; gap: 6px; color: #405047; font-size: 12px; font-weight: 700; }
.compact { margin-top: 21px; }
.switch { flex-direction: row !important; align-items: center; }
.switch input { width: 16px; height: 16px; }
.token-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid #edf0ec; }
.new-token-note { margin-top: 14px; padding: 11px; border: 1px solid #ead28e; border-radius: 4px; color: #6f5512; background: #fff8dd; font-size: 12px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 11px 9px; border-bottom: 1px solid #edf0ec; text-align: left; vertical-align: top; }
th { color: #758178; font-size: 10px; font-weight: 800; text-transform: uppercase; }
td small { display: block; margin-top: 3px; color: var(--muted); }
td form { margin: 0; }
.danger-link { border: 0; padding: 0; color: var(--red); background: transparent; font-size: 12px; font-weight: 700; }
.danger-link:hover { text-decoration: underline; }
.danger-link:disabled { color: #98a19a; cursor: not-allowed; text-decoration: none; }
.site-stats {
  display: flex;
  margin-top: 18px;
  padding-top: 14px;
  gap: 9px 16px;
  flex-wrap: wrap;
  border-top: 1px solid #edf0ec;
  color: var(--muted);
  font-size: 11px;
}
.site-stats strong { color: var(--green-dark); font-size: 13px; }
.site-actions {
  display: flex;
  margin-top: 14px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.site-actions form { margin: 0; }
.stat-grid {
  display: grid;
  margin-bottom: 22px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
.stat-card {
  min-height: 122px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.stat-card > span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.stat-card > strong { display: block; margin: 8px 0 7px; color: var(--green-dark); font-size: 28px; line-height: 1; }
.stat-card > .stat-time { font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
.stat-card > small { color: var(--muted); font-size: 10px; }
.table-link { color: var(--green-dark); font-weight: 750; text-decoration: none; white-space: nowrap; }
.table-link:hover { text-decoration: underline; }
.metric-ok { color: var(--green-dark); font-weight: 750; }
.metric-error { color: var(--red); font-weight: 750; }
.activity-table td { white-space: nowrap; }
.activity-table td:last-child { white-space: normal; min-width: 210px; }
.empty-cell, .empty { padding: 25px; color: var(--muted); text-align: center; font-size: 13px; }
.detail { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; }
.api-doc pre { overflow: auto; padding: 14px; border: 1px solid #e9ede8; background: #f7faf7; font-size: 11px; }
.api-doc pre p { margin: 0; }
.endpoints { display: grid; gap: 9px; }
.endpoints div { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.endpoints code { color: var(--green-dark); font-size: 12px; }
.endpoints span { color: var(--muted); font-family: "Cascadia Code", Consolas, monospace; font-size: 11px; }
.auth-card { width: min(450px, 100%); margin: 80px auto; padding: 34px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.auth-card h1 { font-size: 30px; }
.auth-card .stack { margin-top: 25px; }
.auth-card .primary { width: 100%; min-height: 46px; }
.hint { margin: -4px 0 2px; color: var(--muted); font-size: 11px; }
.message { margin: 16px 0 0; font-size: 12px; }
.message.error { color: var(--red); }
.origin-box {
  display: block;
  margin: 18px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #f7faf7;
  color: var(--green-dark);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.warning-note { margin-bottom: 23px; padding: 11px; border: 1px solid #ead28e; border-radius: 4px; color: #6f5512; background: #fff8dd; font-size: 12px; }
.copy-row { display: flex; gap: 8px; margin: 7px 0 25px; }
.copy-row input { flex: 1; font-size: 12px; }
.copy-row button { min-width: 64px; }
.full-button { width: 100%; min-height: 46px; }
.footer { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 17px 0 25px; border-top: 1px solid var(--line); color: #8a958d; font-size: 10px; }
@media (max-width: 760px) {
  .topbar, .page, .footer { width: calc(100% - 28px); }
  .topbar { min-height: 68px; }
  .brand-copy span { display: none; }
  .nav { gap: 11px; font-size: 12px; }
  .page { padding-top: 30px; }
  h1 { font-size: 29px; }
  .grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { padding: 18px; }
  .inline-form { display: block; }
  .inline-form label { margin-bottom: 12px; }
  .inline-form .primary { width: 100%; }
  .auth-card { margin-top: 35px; padding: 25px 20px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
}
