:root {
  --ink: #172322;
  --muted: #66736f;
  --paper: #f2efe6;
  --paper-strong: #fffdf7;
  --line: #c9d0c9;
  --teal: #0f7168;
  --teal-bright: #15a090;
  --orange: #e06b37;
  --red: #a93e32;
  --shadow: 0 24px 60px rgba(34, 50, 47, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, rgba(21, 160, 144, 0.16), transparent 30rem),
    linear-gradient(115deg, transparent 0 49.5%, rgba(23, 35, 34, 0.035) 49.5% 50%, transparent 50%),
    var(--paper);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.42;
  background-image: repeating-linear-gradient(0deg, rgba(23, 35, 34, 0.035) 0 1px, transparent 1px 5px);
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 52px 0 30px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 28px;
  align-items: start;
  padding-bottom: 42px;
}

.brand-mark {
  width: 62px;
  height: 62px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  transform: rotate(-4deg);
}

.brand-mark span { background: var(--teal); }
.brand-mark span:nth-child(2) { background: var(--orange); transform: translateY(12px); }
.brand-mark span:nth-child(3) { transform: translateY(24px); }

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font: 700 0.72rem/1.2 Consolas, monospace;
  letter-spacing: 0.17em;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 710px;
  margin-bottom: 18px;
  font: 700 clamp(2.7rem, 7vw, 5.7rem)/0.92 Georgia, "Songti SC", serif;
  letter-spacing: -0.055em;
}

h1 em { color: var(--teal); font-style: italic; }

.lede {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.75;
}

.status-card {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 210px;
  margin-top: 18px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.74);
  backdrop-filter: blur(10px);
}

.status-card strong, .status-card small { display: block; }
.status-card strong { font-size: 0.9rem; }
.status-card small { margin-top: 3px; color: var(--muted); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #aa9e87; box-shadow: 0 0 0 5px rgba(170, 158, 135, 0.13); }
.status-dot.online { background: var(--teal-bright); box-shadow: 0 0 0 5px rgba(21, 160, 144, 0.13); }

.workspace { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr); gap: 22px; }
.panel { position: relative; overflow: hidden; padding: 36px; border: 1px solid var(--line); background: rgba(255, 253, 247, 0.9); box-shadow: var(--shadow); }
.panel-number { position: absolute; top: -17px; right: 16px; color: rgba(15, 113, 104, 0.09); font: 700 6.2rem/1 Georgia, serif; }
.panel-heading { position: relative; margin-bottom: 30px; }
.panel-heading h2 { margin-bottom: 10px; font: 700 2rem/1.05 Georgia, "Songti SC", serif; }
.panel-heading > p:last-child { margin-bottom: 0; color: var(--muted); line-height: 1.65; }

label { display: block; margin-bottom: 9px; font-weight: 700; font-size: 0.86rem; }
.input-row { display: grid; grid-template-columns: 1fr auto; }
input { min-width: 0; width: 100%; border: 1px solid var(--line); border-right: 0; border-radius: 0; padding: 15px 16px; background: var(--paper-strong); color: var(--ink); font: inherit; outline: none; }
input:focus { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
button, .primary-link { border: 0; border-radius: 0; font: 700 0.9rem/1 inherit; cursor: pointer; }
#enroll-button, .primary-link { padding: 15px 22px; color: white; background: var(--teal); transition: background 160ms ease, transform 160ms ease; }
#enroll-button:hover, .primary-link:hover { background: #095b54; }
#enroll-button:active, .primary-link:active { transform: translateY(1px); }
button:disabled { cursor: wait; opacity: 0.56; }

.result { position: relative; margin-top: 30px; padding: 26px 24px 24px 28px; background: #e5f3ef; border: 1px solid #b9d8d0; }
.result-stripe { position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--teal); }
.result h3 { margin-bottom: 4px; font: 700 1.45rem/1.2 Georgia, "Songti SC", serif; }
.address { margin-bottom: 16px; color: var(--teal); font: 700 0.9rem/1.2 Consolas, monospace; }
.result-copy { color: #475b56; line-height: 1.65; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 19px 0 13px; }
.primary-link { display: inline-flex; align-items: center; text-decoration: none; }
.secondary-button { padding: 13px 16px; color: var(--teal); border: 1px solid var(--teal); background: transparent; }
.result small { color: var(--muted); }

.device-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.device-heading h2 { margin-bottom: 0; }
.text-button { padding: 8px 0; color: var(--teal); background: transparent; border-bottom: 1px solid var(--teal); }
.device-list { display: grid; gap: 12px; }
.device-item { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 18px; border: 1px solid var(--line); background: var(--paper-strong); animation: reveal 250ms ease both; }
.device-item h3 { margin-bottom: 6px; font-size: 1rem; }
.device-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); font: 0.78rem/1.4 Consolas, monospace; }
.device-health { color: var(--teal); }
.device-health.stale { color: var(--orange); }
.revoke-button { align-self: center; padding: 9px 11px; color: var(--red); border: 1px solid #d7aaa4; background: transparent; }
.empty-state { margin: 10px 0 0; padding: 34px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); }

.notice { margin-bottom: 24px; padding: 16px 18px; border-left: 5px solid var(--orange); background: #fff3e6; }
.notice-error { border-color: var(--red); color: #712c24; }
.toast { position: fixed; z-index: 20; right: 22px; bottom: 22px; max-width: min(420px, calc(100% - 44px)); padding: 14px 18px; color: white; background: var(--ink); box-shadow: var(--shadow); animation: reveal 180ms ease both; }
.hidden { display: none !important; }

footer { display: flex; justify-content: space-between; gap: 18px; margin-top: 24px; color: var(--muted); font: 0.7rem/1.4 Consolas, monospace; text-transform: uppercase; letter-spacing: 0.08em; }

@keyframes reveal { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 820px) {
  .shell { padding-top: 30px; }
  .hero { grid-template-columns: 54px 1fr; gap: 18px; }
  .brand-mark { width: 48px; height: 48px; }
  .status-card { grid-column: 1 / -1; width: 100%; margin-top: 0; }
  .workspace { grid-template-columns: 1fr; }
  .panel { padding: 28px 22px; }
}

@media (max-width: 520px) {
  .shell { width: min(100% - 20px, 1120px); }
  .hero { padding-bottom: 28px; }
  h1 { font-size: 2.8rem; }
  .input-row { grid-template-columns: 1fr; gap: 9px; }
  input { border-right: 1px solid var(--line); }
  #enroll-button { width: 100%; }
  .device-item { grid-template-columns: 1fr; }
  .revoke-button { justify-self: start; }
  footer { flex-direction: column; }
}
