:root {
  color-scheme: dark;
  --bg: #101413;
  --surface: rgba(25, 31, 29, .92);
  --surface-2: #202724;
  --line: rgba(238, 226, 204, .1);
  --line-strong: rgba(238, 226, 204, .19);
  --text: #eeeae0;
  --muted: #929a93;
  --amber: #e5ad5d;
  --amber-soft: rgba(229, 173, 93, .12);
  --mint: #80c0a8;
  --red: #e0958b;
  --blue: #99bad5;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(ellipse at 75% -10%, rgba(229, 173, 93, .1), transparent 42%),
    radial-gradient(ellipse at -10% 80%, rgba(89, 132, 116, .12), transparent 38%),
    var(--bg);
}
button, input, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.ambient { position: fixed; pointer-events: none; filter: blur(1px); opacity: .25; }
.ambient-a { width: 360px; height: 360px; right: 6%; top: -180px; border: 1px solid var(--amber); border-radius: 50%; }
.ambient-b { width: 220px; height: 220px; left: -130px; bottom: 4%; border: 1px solid var(--mint); transform: rotate(32deg); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(18px, 4vw, 52px);
  border-bottom: 1px solid var(--line);
  background: rgba(16, 20, 19, .88);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.brand strong { font-size: 16px; letter-spacing: .08em; }
.brand small { color: var(--muted); font-size: 10px; letter-spacing: .14em; }
.brand-mark { width: 37px; height: 34px; display: flex; gap: 4px; align-items: flex-end; padding: 7px; border: 1px solid rgba(229, 173, 93, .42); border-radius: 9px; background: rgba(229, 173, 93, .07); transform: skew(-7deg); }
.brand-mark i { width: 5px; border-radius: 2px 2px 0 0; background: var(--amber); }
.brand-mark i:nth-child(1) { height: 9px; opacity: .72; }
.brand-mark i:nth-child(2) { height: 18px; }
.brand-mark i:nth-child(3) { height: 13px; opacity: .86; }

.shell { width: min(1260px, calc(100% - 34px)); margin: 0 auto; padding: 34px 0 64px; }
.center-card {
  position: relative;
  width: min(520px, 100%);
  margin: 8vh auto 0;
  padding: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: linear-gradient(150deg, rgba(31, 38, 35, .98), rgba(20, 25, 23, .98));
  box-shadow: 0 28px 80px rgba(0, 0, 0, .34);
}
.center-card h1, .hero h1 { margin: 10px 0 8px; font-size: clamp(27px, 4vw, 40px); letter-spacing: -.04em; }
.lead, .hero p { margin: 0 0 24px; color: var(--muted); line-height: 1.75; }
.eyebrow { color: var(--muted); font-family: Consolas, "SFMono-Regular", monospace; font-size: 10px; letter-spacing: .17em; }
.loader { display: block; width: 28px; height: 28px; margin-bottom: 20px; border: 2px solid var(--line-strong); border-top-color: var(--amber); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.stack { display: flex; flex-direction: column; gap: 16px; }
label { display: flex; flex-direction: column; gap: 7px; color: #c7c9c2; font-size: 12px; }
label small { color: var(--muted); font-size: 10px; line-height: 1.55; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: #121715;
  outline: none;
}
textarea { resize: vertical; line-height: 1.65; }
input:focus, textarea:focus { border-color: rgba(229, 173, 93, .66); box-shadow: 0 0 0 3px rgba(229, 173, 93, .08); }
input:disabled { opacity: .45; }
code { color: #d9c39d; }
.button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 14px;
  background: #232a27;
  cursor: pointer;
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}
.button:hover { transform: translateY(-1px); border-color: rgba(229, 173, 93, .35); }
.button.primary { border-color: transparent; color: #261e14; font-weight: 700; background: var(--amber); }
.button.ghost { background: transparent; }
.button.small { min-height: 30px; padding: 0 10px; font-size: 11px; }
.button.danger { color: var(--red); border-color: rgba(224, 149, 139, .25); background: rgba(224, 149, 139, .07); }
.error { min-height: 18px; margin: 14px 0 0; color: var(--red); font-size: 11px; }
.muted { color: var(--muted); font-size: 10px; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 20px 2px 28px; }
.hero h1 { margin-bottom: 5px; }
.hero p { margin-bottom: 0; }
.operator { min-width: 190px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, .025); }
.operator span, .operator strong { display: block; }
.operator span { color: var(--muted); font-size: 9px; }
.operator strong { margin-top: 5px; font-size: 14px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.metrics article { position: relative; overflow: hidden; padding: 17px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.metrics article:after { content: ""; position: absolute; width: 80px; height: 80px; right: -40px; bottom: -50px; border: 1px solid rgba(229, 173, 93, .14); border-radius: 50%; }
.metrics span { color: var(--muted); font-size: 10px; }
.metrics strong { display: block; margin-top: 9px; font-family: Consolas, monospace; font-size: 28px; font-weight: 500; }
.dashboard-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; margin-bottom: 14px; }
.panel { min-width: 0; padding: 21px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: 0 14px 40px rgba(0, 0, 0, .12); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.panel h2, .panel h3 { margin: 5px 0 0; font-size: 16px; }
.pill { padding: 5px 8px; border-radius: 99px; font-size: 9px; }
.pill.amber { color: var(--amber); background: var(--amber-soft); border: 1px solid rgba(229, 173, 93, .16); }
.two-column { display: grid; grid-template-columns: 1fr 1.3fr; gap: 12px; }
.check-row { flex-direction: row; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, .018); }
.check-row input { width: auto; margin-top: 2px; accent-color: var(--amber); }
.check-row span { display: flex; flex-direction: column; gap: 4px; }
.issued-result { margin-top: 18px; padding: 15px; border: 1px solid rgba(128, 192, 168, .24); border-radius: 9px; background: rgba(128, 192, 168, .045); }
.issued-result pre, .diagnostic-report { max-height: 270px; overflow: auto; white-space: pre-wrap; word-break: break-all; color: #d9e9df; font: 11px/1.65 Consolas, monospace; }
.issued-result p { margin-bottom: 0; color: var(--muted); font-size: 9px; }

.table-panel { margin-bottom: 14px; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th, td { padding: 11px 10px; border-top: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 9px; font-weight: 500; letter-spacing: .08em; }
td { color: #cfd1ca; }
.status { display: inline-flex; padding: 4px 7px; border-radius: 99px; font-size: 9px; }
.status.active { color: var(--mint); background: rgba(128, 192, 168, .1); }
.status.disabled { color: var(--red); background: rgba(224, 149, 139, .1); }
.row-actions { display: flex; gap: 5px; }
.row-actions button { border: 0; padding: 4px 6px; color: #b9afa0; background: transparent; cursor: pointer; font-size: 10px; }
.row-actions button:hover { color: var(--amber); }
.empty-row { padding: 30px !important; color: var(--muted); text-align: center; }
.diagnostics-list { display: flex; flex-direction: column; gap: 10px; }
.diagnostic { padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, .016); }
.diagnostic header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.diagnostic header strong { font-family: Consolas, monospace; font-size: 11px; }
.diagnostic footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 9px; color: var(--muted); font-size: 9px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 30; max-width: min(380px, calc(100% - 40px)); padding: 13px 15px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--text); background: #252d29; box-shadow: 0 18px 50px rgba(0, 0, 0, .4); font-size: 11px; }
.toast.error { border-color: rgba(224, 149, 139, .3); color: #f1c1bb; }

@media (max-width: 820px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .hero { align-items: flex-start; flex-direction: column; }
  .operator { width: 100%; }
}
@media (max-width: 520px) {
  .shell { width: min(100% - 22px, 1260px); padding-top: 18px; }
  .center-card, .panel { padding: 18px; }
  .two-column { grid-template-columns: 1fr; }
  .metrics { gap: 8px; }
  .metrics article { padding: 13px; }
  .metrics strong { font-size: 23px; }
}
