:root {
  color-scheme: light;
  --ink: #202427;
  --muted: #687076;
  --line: #d9dddf;
  --surface: #ffffff;
  --canvas: #f3f5f4;
  --accent: #087f5b;
  --accent-hover: #066b4d;
  --danger: #c92a2a;
  --warning: #b35c00;
  --shadow: 0 8px 24px rgba(23, 31, 28, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.topbar {
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.topbar-inner, .page {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}
.topbar-inner {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { font-size: 17px; font-weight: 700; }
.status { color: var(--muted); font-size: 13px; }
.status.online { color: var(--accent); }
.status.error { color: var(--danger); }
.page { padding: 28px 0 48px; }
.section {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.section:last-child { border-bottom: 0; }
h1, h2 { margin: 0; font-weight: 700; }
h1 { font-size: 22px; }
h2 { font-size: 16px; margin-bottom: 14px; }
.subtle { color: var(--muted); margin: 6px 0 0; }
.form-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.field { display: grid; gap: 6px; min-width: 0; }
.field label { color: var(--muted); font-size: 12px; }
input, select {
  width: 100%;
  height: 40px;
  border: 1px solid #bfc5c7;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 11px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8, 127, 91, 0.12); }
.button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--accent);
  color: white;
  font-weight: 700;
}
.button:hover { background: var(--accent-hover); }
.button:disabled { cursor: not-allowed; opacity: 0.55; }
.button.secondary { background: var(--surface); color: var(--ink); border-color: #bfc5c7; }
.button.compact { min-height: 34px; padding: 0 12px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.toolbar h2 { margin-bottom: 0; }
.toolbar-actions, .row-actions { display: flex; align-items: center; gap: 8px; }
.message { min-height: 20px; color: var(--muted); }
.message.error { color: var(--danger); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; overflow-wrap: anywhere; }
th { color: var(--muted); font-size: 12px; font-weight: 600; background: #fafbfa; }
tr:last-child td { border-bottom: 0; }
.cell-note { margin-top: 3px; color: var(--muted); font-size: 12px; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f7f8f8;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.badge.active { border-color: #9fd7c5; background: #eef9f5; color: var(--accent); }
.badge.expired { border-color: #edb9b9; background: #fff5f5; color: var(--danger); }
.badge.disabled { border-color: #ddd2bd; background: #fff9ee; color: var(--warning); }
.text-button {
  min-height: 30px;
  border: 0;
  padding: 0 4px;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}
.text-button:hover { color: var(--accent-hover); text-decoration: underline; }
.credential-result { border-left: 3px solid var(--accent); padding-left: 16px; }
.credential-line { display: flex; align-items: stretch; gap: 8px; }
.credential-line code {
  display: block;
  min-width: 0;
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  overflow-wrap: anywhere;
  font-family: Consolas, monospace;
  font-size: 14px;
}
dialog {
  width: min(620px, calc(100% - 24px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(23, 31, 28, 0.2);
}
dialog::backdrop { background: rgba(20, 26, 24, 0.42); }
.dialog-header, .dialog-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
}
.dialog-header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; }
.dialog-footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.dialog-footer .message { flex: 1; margin: 0; }
.dialog-body { padding: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .check-row, .form-grid .subtle { grid-column: 1 / -1; }
.check-row { display: flex; align-items: center; gap: 9px; min-height: 32px; }
.check-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}
.icon-button:hover { color: var(--ink); }
.code { color: var(--danger); font-size: 18px; font-weight: 800; }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }
.nav { display: flex; gap: 14px; }
.nav a { color: var(--ink); text-decoration: none; }
.nav a:hover { color: var(--accent); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric { border-left: 3px solid var(--accent); padding: 10px 12px; background: var(--surface); }
.metric strong { display: block; font-size: 22px; }
.metric span { color: var(--muted); font-size: 12px; }
@media (max-width: 720px) {
  .topbar-inner, .page { width: min(100% - 20px, 1080px); }
  .page { padding-top: 18px; }
  .form-row { grid-template-columns: 1fr; }
  .button { width: 100%; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .button { flex: 1; }
  .credential-line { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .check-row, .form-grid .subtle { grid-column: auto; }
  .dialog-footer { flex-wrap: wrap; }
  .dialog-footer .message { flex-basis: 100%; }
  .dialog-footer .button { width: auto; flex: 1; }
  table { min-width: 760px; }
  td.empty { text-align: left; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-table, .result-table tbody, .result-table tr, .result-table td { display: block; width: 100%; }
  .result-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .result-table tr { padding: 8px 12px; border-bottom: 1px solid var(--line); }
  .result-table tr:last-child { border-bottom: 0; }
  .result-table td {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
    min-width: 0;
    padding: 7px 0;
    border: 0;
  }
  .result-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; }
  .result-table td.empty { display: block; padding: 28px 10px; }
  .result-table td.empty::before { display: none; }
}
