:root {
  --canvas: #eef3f6;
  --paper: #f9fbfc;
  --ink: #17232b;
  --muted: #667681;
  --line: #cfdae1;
  --cobalt: #2d5bff;
  --cobalt-dark: #1742cc;
  --celadon: #28a77a;
  --amber: #d98a18;
  --danger: #c94c55;
  --white: #ffffff;
  --shadow: 0 18px 45px rgba(40, 61, 76, 0.09);
  font-family:
    "Avenir Next", "Noto Sans SC", "PingFang SC", "Microsoft YaHei",
    sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(rgba(45, 91, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 91, 255, 0.035) 1px, transparent 1px),
    var(--canvas);
  background-size: 32px 32px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid rgba(45, 91, 255, 0.32);
  outline-offset: 2px;
}

.shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 34px;
  padding: 28px 24px;
  color: #eaf0ff;
  background: #1c2a36;
  border-right: 1px solid #314250;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--white);
  font-weight: 800;
  background: var(--cobalt);
  border-radius: 14px 4px 14px 14px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 2px;
  color: #9fb1bf;
  font-size: 12px;
}

nav {
  display: grid;
  gap: 3px;
}

nav a {
  padding: 10px 12px;
  color: #adbdc8;
  font-size: 14px;
  text-decoration: none;
  border-left: 2px solid transparent;
}

nav a:hover {
  color: var(--white);
  border-color: var(--cobalt);
  background: rgba(255, 255, 255, 0.05);
}

.credential-panel {
  margin-top: auto;
  padding: 16px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
}

.credential-panel label {
  color: #c8d3db;
}

.credential-panel input {
  margin: 7px 0 10px;
  color: var(--white);
  background: #13202a;
  border-color: #3a4b57;
}

.fine-print {
  margin: 10px 0 0;
  color: #91a4b1;
  font-size: 11px;
  line-height: 1.5;
}

main {
  width: min(1260px, 100%);
  margin: 0 auto;
  padding: 48px clamp(22px, 4vw, 64px) 80px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--cobalt);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(36px, 5.8vw, 76px);
  font-weight: 680;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.lede {
  max-width: 620px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.route-rail {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 54px 0 22px;
  padding: 0 8px;
}

.route-rail::before {
  position: absolute;
  top: 18px;
  right: 10%;
  left: 10%;
  height: 2px;
  content: "";
  background: linear-gradient(
    90deg,
    var(--cobalt),
    var(--celadon),
    var(--line)
  );
}

.route-node {
  position: relative;
  display: grid;
  justify-items: center;
  text-align: center;
}

.route-node > span {
  z-index: 1;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 50%;
}

.route-node.active > span,
.route-node.online > span {
  color: var(--white);
  background: var(--cobalt);
  border-color: var(--cobalt);
  box-shadow: 0 0 0 7px rgba(45, 91, 255, 0.1);
}

.route-node strong {
  margin-top: 12px;
  font-size: 13px;
}

.route-node small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.notice {
  margin: 28px 0;
  padding: 13px 16px;
  color: #304250;
  font-size: 13px;
  background: #dfe8ee;
  border-left: 3px solid var(--cobalt);
  border-radius: 3px 10px 10px 3px;
}

.notice.error {
  color: #6f242a;
  background: #f6e5e6;
  border-color: var(--danger);
}

.notice.success {
  color: #155b44;
  background: #ddf2ea;
  border-color: var(--celadon);
}

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

.panel {
  padding: 24px;
  background: rgba(249, 251, 252, 0.94);
  border: 1px solid var(--line);
  border-radius: 18px 5px 18px 18px;
  box-shadow: var(--shadow);
}

.panel.wide {
  grid-column: 1 / -1;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

h2 {
  margin: 0;
  font-size: 23px;
  font-weight: 680;
  letter-spacing: -0.035em;
}

label {
  color: #475965;
  font-size: 12px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid #bccad3;
  border-radius: 9px 3px 9px 9px;
}

textarea {
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  margin-top: 7px;
}

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

.stack label:not(:first-child) {
  margin-top: 5px;
}

.button {
  min-height: 42px;
  padding: 0 16px;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 9px 3px 9px 9px;
}

.button.primary {
  color: var(--white);
  background: var(--cobalt);
}

.button.primary:hover {
  background: var(--cobalt-dark);
}

.button.secondary {
  color: #1c3f9e;
  background: #e5ebff;
  border-color: #bdcafa;
}

.button.quiet {
  color: var(--ink);
  background: transparent;
  border-color: #adbdc8;
}

.button.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.code-output {
  display: block;
  min-height: 58px;
  margin-top: 18px;
  padding: 16px;
  overflow-wrap: anywhere;
  color: #1d449a;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  background: #edf1ff;
  border: 1px dashed #9db0f6;
  border-radius: 10px;
}

.divider {
  height: 1px;
  margin: 22px 0;
  background: var(--line);
}

.qr-stage {
  display: grid;
  min-height: 118px;
  margin-top: 16px;
  padding: 14px;
  place-items: center;
  color: var(--muted);
  text-align: center;
  background: #edf2f4;
  border-radius: 12px;
}

.qr-stage img {
  width: 200px;
  max-width: 100%;
  image-rendering: pixelated;
  background: var(--white);
  border: 10px solid var(--white);
}

.state,
.count {
  display: inline-grid;
  min-height: 28px;
  padding: 0 9px;
  place-items: center;
  color: #536572;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  background: #e8eef1;
  border-radius: 999px;
}

.count {
  min-width: 28px;
  color: var(--white);
  background: var(--amber);
}

.list {
  display: grid;
  gap: 9px;
}

.list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 15px;
  background: var(--white);
  border: 1px solid #d7e0e5;
  border-left: 3px solid #aab9c2;
  border-radius: 4px 10px 10px 4px;
}

.list-item.pending_approval {
  border-left-color: var(--amber);
}

.list-item.succeeded,
.list-item.completed {
  border-left-color: var(--celadon);
}

.list-item.failed,
.list-item.uncertain {
  border-left-color: var(--danger);
}

.list-item strong,
.list-item small {
  display: block;
}

.list-item strong {
  font-size: 13px;
}

.list-item small {
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.item-copy {
  margin: 8px 0 0;
  color: #455762;
  font-size: 12px;
  line-height: 1.55;
}

.empty {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
  background: #f0f4f6;
  border: 1px dashed #c6d2d9;
  border-radius: 10px;
}

@media (max-width: 900px) {
  .shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: auto;
    height: auto;
    padding: 18px;
  }

  .sidebar nav {
    display: none;
  }

  .credential-panel {
    margin-top: 0;
  }

  main {
    padding-top: 30px;
  }
}

@media (max-width: 660px) {
  .page-header {
    display: block;
  }

  .page-header .button {
    margin-top: 20px;
  }

  .route-rail {
    grid-template-columns: 1fr 1fr;
    gap: 20px 6px;
  }

  .route-rail::before {
    display: none;
  }

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

  .panel.wide {
    grid-column: auto;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .list-item {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
