:root {
  --bg: #ffffff;
  --ink: #0e1b2b;
  --muted: #52627a;
  --line: #cfdae8;
  --panel: #ffffff;
  --blue: #087b50;
  --blue-strong: #066540;
  --green: #138a56;
  --red: #c43d42;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  min-height: 100vh;
}

.nav-shell {
  height: 74px;
  padding: 16px 10px;
  border-bottom: 1px solid #d6dfda;
  background: #fff;
}

.global-nav {
  display: grid;
  grid-template-columns: repeat(16, minmax(0, 1fr));
  width: 100%;
  height: 40px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.global-nav a {
  display: grid;
  place-items: center;
  min-width: 0;
  height: 38px;
  padding: 0 6px;
  border-right: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.global-nav a:last-child { border-right: 0; }
.global-nav a[aria-current="page"] { color: #fff; background: var(--blue); }

.page {
  width: min(1288px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 26px 0 40px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 48px;
  line-height: 1;
  margin-top: 6px;
}

.topbar p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.session-url-copy {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto;
  gap: 8px;
  width: min(420px, 100%);
}

.session-url-copy input {
  min-width: 0;
  height: 40px;
  padding: 8px 12px;
  background: #f8fafc;
}

.ghost-link,
button,
.button-like {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: #183154;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.ghost-link:hover,
button:hover,
.button-like:hover {
  transform: translateY(-1px);
  border-color: #9fb2cf;
  box-shadow: 0 8px 22px rgba(25, 47, 83, 0.12);
}

.ghost-link.strong,
button.primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

button.primary:hover {
  background: var(--blue-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-top: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.index {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e8eeff;
  color: var(--blue);
  border-radius: 8px;
  font-weight: 800;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

small {
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field span {
  color: #41506a;
  font-size: 13px;
  font-weight: 700;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #071323;
  font: 600 14px/1.48 "JetBrains Mono", Consolas, monospace;
  outline: none;
  padding: 12px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

textarea:focus,
input:focus {
  border-color: #7f9ee8;
  box-shadow: 0 0 0 3px rgba(36, 86, 222, 0.13);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

#accessToken {
  min-height: 150px;
}

.grid-2,
.grid-4,
.result-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.backend-proxy-note {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #b7d8ca;
  border-radius: 8px;
  background: #eff8f4;
  color: #155c43;
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.result-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.check-field label {
  min-height: 45px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  padding: 0 12px;
  font-weight: 700;
  color: #40526d;
}

.check-field input {
  width: auto;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  padding: 12px 14px;
}

.status-card label {
  color: var(--muted);
  font-weight: 700;
}

.status-card b {
  color: var(--green);
}

.log-box {
  min-height: 150px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #071323;
  color: #d8e6f7;
  padding: 14px;
  font: 600 13px/1.5 "JetBrains Mono", Consolas, monospace;
}

.toast-host {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 10px;
  z-index: 20;
}

.toast {
  min-width: 220px;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  background: #10213a;
  color: #fff;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
  padding: 12px 14px;
  font-weight: 700;
}

.toast.err {
  background: var(--red);
}

@media (max-width: 860px) {
  .nav-shell { height: 252px; padding: 12px; }
  .global-nav { height: 228px; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 38px; }
  .global-nav a { height: 38px; border-bottom: 1px solid var(--line); }
  .backend-proxy-note { flex-direction: column; gap: 4px; }
  .page {
    width: min(100vw - 24px, 720px);
    padding-top: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions,
  .session-url-copy {
    width: 100%;
  }

  .session-url-copy {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  h1 {
    font-size: 34px;
  }

  .grid-2,
  .grid-4,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .button-row button {
    flex: 1 1 180px;
  }
}
