/* PortBeacon — 端口信标 UI */
/* 1. Foundations */
:root {
  --font-sans: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --transition: 180ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #060b14;
  --bg-soft: #08101d;
  --panel: rgba(13, 22, 38, 0.84);
  --panel-solid: #0d1626;
  --panel-raised: #111d33;
  --well: rgba(5, 11, 22, 0.5);
  --line: rgba(148, 163, 184, 0.13);
  --line-strong: rgba(148, 163, 184, 0.26);
  --text: #e9f1fb;
  --muted: #93a4bd;
  --faint: #64748b;
  --accent: #2dd4bf;
  --accent-bright: #5eead4;
  --accent-ink: #042f2e;
  --blue: #38bdf8;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  --gradient: linear-gradient(118deg, #5eead4 0%, #38bdf8 100%);
  --gradient-soft: linear-gradient(135deg, rgba(45, 212, 191, 0.16), rgba(56, 189, 248, 0.08));
  --shadow-lg: 0 28px 80px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 14px 40px rgba(0, 0, 0, 0.28);
  --grid-line: rgba(148, 163, 184, 0.055);
  --glow-1: rgba(45, 212, 191, 0.14);
  --glow-2: rgba(56, 189, 248, 0.1);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f6fb;
  --bg-soft: #eaf1f8;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-solid: #ffffff;
  --panel-raised: #f6f9fc;
  --well: rgba(241, 245, 249, 0.85);
  --line: rgba(15, 23, 42, 0.09);
  --line-strong: rgba(15, 23, 42, 0.18);
  --text: #101b2d;
  --muted: #5a6b81;
  --faint: #7c8ba1;
  --accent: #0d9488;
  --accent-bright: #0f766e;
  --accent-ink: #ecfeff;
  --blue: #0284c7;
  --green: #059669;
  --amber: #b45309;
  --red: #e11d48;
  --gradient: linear-gradient(118deg, #0d9488 0%, #0284c7 100%);
  --gradient-soft: linear-gradient(135deg, rgba(13, 148, 136, 0.1), rgba(2, 132, 199, 0.06));
  --shadow-lg: 0 28px 80px rgba(15, 23, 42, 0.14);
  --shadow-md: 0 14px 40px rgba(15, 23, 42, 0.08);
  --grid-line: rgba(15, 23, 42, 0.04);
  --glow-1: rgba(13, 148, 136, 0.1);
  --glow-2: rgba(2, 132, 199, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 620px at 6% -12%, var(--glow-1), transparent 62%),
    radial-gradient(980px 680px at 102% -6%, var(--glow-2), transparent 58%),
    var(--bg);
  transition: background-color var(--transition), color var(--transition);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 10%, transparent 78%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.08));
}

[data-theme="light"] body::after {
  background: linear-gradient(180deg, transparent 65%, rgba(15, 23, 42, 0.03));
}

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

button {
  cursor: pointer;
}

a {
  color: var(--accent-bright);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}

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

svg {
  display: block;
}

::selection {
  background: rgba(45, 212, 191, 0.3);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.app-root {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* 2. Shared primitives */
.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse-dot 2.4s ease-out infinite;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  transition:
    transform var(--transition),
    background-color var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    color var(--transition);
}

.btn svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.btn-primary {
  background: var(--gradient);
  color: var(--accent-ink);
  box-shadow: 0 10px 30px rgba(45, 212, 191, 0.18);
}

.btn-primary:hover {
  box-shadow: 0 14px 36px rgba(45, 212, 191, 0.28);
}

[data-theme="light"] .btn-primary {
  background: linear-gradient(118deg, #0f766e, #0369a1);
  color: #f0fdfa;
  box-shadow: 0 10px 26px rgba(13, 148, 136, 0.2);
}

.btn-ghost {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--line-strong);
  background: var(--panel-raised);
}

.btn-danger {
  background: rgba(251, 113, 133, 0.12);
  border-color: rgba(251, 113, 133, 0.3);
  color: var(--red);
}

.btn-danger:hover {
  background: rgba(251, 113, 133, 0.2);
}

.btn-block {
  width: 100%;
  min-height: 50px;
  font-size: 15px;
}

.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 12.5px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  color: var(--muted);
  transition:
    color var(--transition),
    border-color var(--transition),
    background-color var(--transition);
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--panel-raised);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

body.modal-open {
  overflow: hidden;
}

.mini-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge,
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.status {
  padding: 4px 9px;
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.08);
  color: var(--muted);
}

.status-online,
.status-live {
  border-color: rgba(52, 211, 153, 0.28);
  background: rgba(52, 211, 153, 0.1);
  color: var(--green);
}

.status-pending {
  border-color: rgba(251, 191, 36, 0.26);
  background: rgba(251, 191, 36, 0.08);
  color: var(--amber);
}

.status-offline {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(148, 163, 184, 0.08);
  color: var(--muted);
}

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

.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.field-hint {
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 500;
}

.input-wrap {
  position: relative;
  display: block;
}

.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--well);
  color: var(--text);
  font-size: 14px;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background-color var(--transition);
}

.input::placeholder {
  color: var(--faint);
}

.input:hover {
  border-color: rgba(148, 163, 184, 0.4);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.12);
}

.input-icon + .input {
  padding-left: 43px;
}

.input-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--faint);
  transform: translateY(-50%);
  pointer-events: none;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  padding: 4px 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  transform: translateY(-50%);
}

.password-toggle:hover {
  color: var(--text);
  background: var(--panel-raised);
}

select.input {
  appearance: none;
  padding-right: 38px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 13px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

textarea.input {
  height: auto;
  min-height: 82px;
  padding: 12px 14px;
  resize: vertical;
}

.form-error {
  padding: 10px 12px;
  border: 1px solid rgba(251, 113, 133, 0.25);
  border-radius: 10px;
  background: rgba(251, 113, 133, 0.08);
  color: var(--red);
  font-size: 12.5px;
  line-height: 1.45;
}

.form-hint {
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.5;
}

.verify-panel {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(45, 212, 191, 0.22);
  border-radius: 13px;
  background: var(--gradient-soft);
}

.verify-panel-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid rgba(45, 212, 191, 0.24);
  border-radius: 11px;
  background: var(--panel);
  color: var(--accent);
}

.verify-panel-icon svg {
  width: 19px;
  height: 19px;
}

.verify-panel p {
  color: var(--faint);
  font-size: 11px;
}

.verify-panel strong {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 650;
}

.verify-panel small {
  display: block;
  margin-top: 4px;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.5;
}

.code-input {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.28em;
}

.code-input::placeholder {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.verify-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
}

.text-button {
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.text-button:hover {
  color: var(--accent);
  text-decoration: underline;
}

.text-button:disabled {
  cursor: not-allowed;
  color: var(--faint);
  text-decoration: none;
}

.mono {
  font-family: var(--font-mono);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  color: var(--text);
  text-decoration: none;
}

.wordmark:hover {
  text-decoration: none;
}

.wordmark-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--accent);
}

.wordmark-mark svg {
  width: 100%;
  height: 100%;
}

.wordmark-text {
  font-size: 19px;
  font-weight: 760;
  letter-spacing: -0.025em;
}

.wordmark-text span {
  color: var(--accent);
}

/* 3. Boot screen */
.boot {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: var(--bg);
  transition: opacity 280ms ease, visibility 280ms ease;
}

.boot.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-beacon {
  position: relative;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
}

.boot-ring {
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(45, 212, 191, 0.4);
  border-radius: 50%;
  animation: boot-ring 2s ease-out infinite;
}

.boot-ring-2 {
  animation-delay: 1s;
}

.boot-core {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 24px rgba(45, 212, 191, 0.75);
}

.boot-text {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}

/* 4. Auth */
.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(410px, 0.9fr);
  min-height: 100vh;
}

.brand-panel {
  position: relative;
  overflow: auto;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(680px 520px at 24% 10%, var(--gradient-soft), transparent 68%),
    linear-gradient(180deg, rgba(13, 22, 38, 0.26), transparent 60%);
}

[data-theme="light"] .brand-panel {
  background:
    radial-gradient(680px 520px at 24% 10%, var(--gradient-soft), transparent 68%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent 60%);
}

.brand-panel-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 680px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 48px clamp(32px, 5vw, 76px) 40px;
}

.brand-copy {
  margin-top: clamp(48px, 8vh, 92px);
}

.brand-copy h1 {
  max-width: 620px;
  font-size: clamp(40px, 4.4vw, 62px);
  font-weight: 760;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.brand-lead {
  max-width: 480px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.beacon-visual {
  position: relative;
  width: min(100%, 360px);
  aspect-ratio: 1;
  margin: clamp(28px, 5vh, 52px) auto 0;
  display: grid;
  place-items: center;
}

.beacon-grid {
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  background-image:
    linear-gradient(rgba(45, 212, 191, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 212, 191, 0.14) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(circle, #000 15%, transparent 70%);
  opacity: 0.65;
}

.beacon-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(45, 212, 191, 0.24);
}

.beacon-ring-1 {
  inset: 18%;
  animation: beacon-pulse 5s ease-out infinite;
}

.beacon-ring-2 {
  inset: 8%;
  animation: beacon-pulse 5s 1.4s ease-out infinite;
}

.beacon-ring-3 {
  inset: 0;
  border-style: dashed;
  border-color: rgba(56, 189, 248, 0.16);
  animation: spin 48s linear infinite;
}

.beacon-sweep {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(45, 212, 191, 0.16) 38deg, transparent 78deg);
  mask-image: radial-gradient(circle, transparent 36%, #000 52%, transparent 73%);
  animation: spin 12s linear infinite;
}

.beacon-core {
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border: 1px solid rgba(45, 212, 191, 0.4);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, rgba(94, 234, 212, 0.24), rgba(8, 20, 34, 0.9) 72%);
  color: var(--accent-bright);
  box-shadow:
    0 0 0 12px rgba(45, 212, 191, 0.035),
    0 18px 60px rgba(45, 212, 191, 0.16);
}

[data-theme="light"] .beacon-core {
  background: radial-gradient(circle at 40% 30%, rgba(13, 148, 136, 0.2), rgba(255, 255, 255, 0.95) 74%);
}

.beacon-core svg {
  width: 48px;
  height: 48px;
}

.beacon-orbit {
  position: absolute;
  inset: 3%;
  border-radius: 50%;
  animation: spin 20s linear infinite;
}

.orbit-dot {
  position: absolute;
  top: 4%;
  left: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.85);
}

.beacon-caption {
  position: absolute;
  bottom: -10px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  white-space: nowrap;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
}

.beacon-caption .pulse-dot {
  color: var(--green);
}

.caption-divider {
  width: 1px;
  height: 10px;
  background: var(--line-strong);
}

.feature-list {
  display: grid;
  gap: 2px;
  margin: 38px 0 0;
  padding: 0;
  list-style: none;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.feature-list li:last-child {
  border-bottom: 1px solid var(--line);
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--accent);
}

.feature-icon svg {
  width: 18px;
  height: 18px;
}

.feature-list strong {
  display: block;
  font-size: 13.5px;
  font-weight: 650;
}

.feature-list small {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 12px;
}

.brand-footnote {
  margin-top: auto;
  padding-top: 36px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
}

.auth-main {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 64px 36px 36px;
}

.auth-topbar {
  position: absolute;
  top: 26px;
  right: 30px;
  left: 30px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.auth-mobile-brand {
  display: none;
  margin-right: auto;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -0.03em;
}

.auth-mobile-brand span {
  color: var(--accent);
}

.auth-card {
  width: min(100%, 432px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 34%),
    var(--panel);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
}

[data-theme="light"] .auth-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), transparent 34%),
    var(--panel);
}

.auth-heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  padding: 4px 9px;
  border: 1px solid rgba(52, 211, 153, 0.24);
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.08);
  color: var(--green);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.auth-heading h2 {
  font-size: 28px;
  font-weight: 740;
  letter-spacing: -0.035em;
}

.auth-heading p {
  color: var(--muted);
  font-size: 13.5px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 24px 0 22px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--well);
}

.auth-tab {
  height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition:
    background-color var(--transition),
    color var(--transition),
    box-shadow var(--transition);
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab.is-active {
  background: var(--panel-raised);
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form .btn-primary {
  margin-top: 4px;
}

.auth-secure-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 11px;
}

.auth-secure-note svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--accent);
}

.auth-legal {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  text-align: center;
}

/* 5. Dashboard chrome */
.dashboard-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 11, 20, 0.82);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(18px);
}

[data-theme="light"] .topbar {
  background: rgba(242, 246, 251, 0.84);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1180px;
  height: 72px;
  margin: 0 auto;
  padding: 0 24px;
}

.wordmark-compact .wordmark-mark {
  width: 30px;
  height: 30px;
}

.wordmark-compact .wordmark-text {
  font-size: 17.5px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 31px;
  padding: 0 11px;
  border: 1px solid rgba(52, 211, 153, 0.18);
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.06);
  color: var(--green);
  font-size: 11.5px;
  font-weight: 600;
}

.connection-pill.is-offline {
  border-color: rgba(251, 113, 133, 0.24);
  background: rgba(251, 113, 133, 0.07);
  color: var(--red);
}

.connection-pill.is-offline .pulse-dot {
  color: var(--red);
  animation: none;
}

.user-menu {
  position: relative;
}

.user-button {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 9px 0 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  transition:
    border-color var(--transition),
    background-color var(--transition);
}

.user-button:hover {
  border-color: var(--line-strong);
  background: var(--panel-raised);
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: var(--gradient);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

[data-theme="light"] .avatar {
  background: linear-gradient(135deg, #0f766e, #0369a1);
  color: #f0fdfa;
}

.avatar-large {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: 12px;
}

.user-name {
  max-width: 130px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  width: 15px;
  height: 15px;
  color: var(--faint);
}

.menu-panel {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  width: 248px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: var(--panel-solid);
  box-shadow: var(--shadow-lg);
  animation: menu-in 140ms ease-out;
}

.menu-profile {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 9px 10px;
}

.menu-profile strong {
  display: block;
  max-width: 160px;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-profile small {
  display: block;
  margin-top: 1px;
  color: var(--faint);
  font-size: 10.5px;
}

.menu-profile #menu-email {
  max-width: 170px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-divider {
  height: 1px;
  margin: 4px 2px;
  background: var(--line);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  text-align: left;
  transition:
    color var(--transition),
    background-color var(--transition);
}

.menu-item svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.menu-item:hover {
  background: var(--panel-raised);
  color: var(--text);
}

.menu-item-danger:hover {
  background: rgba(251, 113, 133, 0.08);
  color: var(--red);
}

.dashboard-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 54px 24px 34px;
}

/* 6. Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: clamp(32px, 6vw, 84px);
  align-items: center;
}

.hero-copy h1 {
  font-size: clamp(40px, 5vw, 62px);
  font-weight: 760;
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.hero-copy h1 em {
  font-style: normal;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lead {
  max-width: 560px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.refresh-icon {
  transition: transform 500ms ease;
}

.is-loading .refresh-icon {
  animation: spin 900ms linear infinite;
}

.relay-card {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(320px 200px at 90% 0%, rgba(45, 212, 191, 0.11), transparent 70%),
    var(--panel);
  box-shadow: var(--shadow-md);
}

.relay-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.55;
}

.relay-card-head,
.relay-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.relay-card-head .status {
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
}

.relay-clock {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.relay-domain {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 26px 0 18px;
}

.relay-domain-label {
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.relay-domain strong {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 600;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relay-wave {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 44px;
  padding: 0 2px;
}

.relay-wave span {
  flex: 1;
  height: 18%;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), rgba(56, 189, 248, 0.28));
  animation: wave 2.6s ease-in-out infinite;
  opacity: 0.55;
}

.relay-wave span:nth-child(2n) { animation-delay: 0.18s; }
.relay-wave span:nth-child(3n) { animation-delay: 0.36s; }
.relay-wave span:nth-child(4n) { animation-delay: 0.54s; }
.relay-wave span:nth-child(5n) { animation-delay: 0.72s; }
.relay-wave span:nth-child(7n) { animation-delay: 0.9s; }

.relay-card-foot {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10.5px;
}

.relay-card-foot span:last-child {
  color: var(--muted);
  font-family: var(--font-mono);
}

/* 7. Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 46px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  transition:
    border-color var(--transition),
    transform var(--transition);
}

.stat-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.stat-icon svg {
  width: 19px;
  height: 19px;
}

.stat-icon-cyan {
  background: rgba(56, 189, 248, 0.08);
  color: var(--blue);
}

.stat-icon-green {
  background: rgba(52, 211, 153, 0.08);
  color: var(--green);
}

.stat-icon-amber {
  background: rgba(251, 191, 36, 0.08);
  color: var(--amber);
}

.stat-label {
  display: block;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.stat-value {
  display: block;
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.stat-value-sm {
  font-size: 16px;
  line-height: 1.6;
}

.stat-note {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: var(--faint);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 8. Services */
.services-section {
  margin-top: 46px;
}

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

.section-head h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.section-head p {
  margin-top: 3px;
  color: var(--faint);
  font-size: 12.5px;
}

.section-tag {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
}

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

.service-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 30%),
    var(--panel);
  transition:
    transform var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

.service-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 1px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity var(--transition);
}

.service-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.service-card:hover::before {
  opacity: 0.6;
}

.service-card.is-pending {
  background:
    linear-gradient(180deg, rgba(251, 191, 36, 0.025), transparent 30%),
    var(--panel);
}

.service-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.service-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.service-icon svg {
  width: 20px;
  height: 20px;
}

.protocol-rdp { background: rgba(56, 189, 248, 0.09); color: var(--blue); }
.protocol-ssh { background: rgba(52, 211, 153, 0.09); color: var(--green); }
.protocol-http { background: rgba(251, 191, 36, 0.08); color: var(--amber); }
.protocol-https { background: rgba(45, 212, 191, 0.09); color: var(--accent); }
.protocol-vnc { background: rgba(167, 139, 250, 0.1); color: #a78bfa; }
.protocol-other { background: rgba(148, 163, 184, 0.1); color: var(--muted); }

.service-title {
  min-width: 0;
  flex: 1;
}

.service-title h3 {
  overflow: hidden;
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-title p {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  overflow: hidden;
  color: var(--faint);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-title p .dot-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--faint);
}

.service-card .status {
  flex: 0 0 auto;
  margin-top: 2px;
  font-size: 10.5px;
}

.service-address {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 13px;
  background: var(--well);
}

.service-address-label {
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.address-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.service-address code {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: clamp(16px, 1.8vw, 19px);
  font-weight: 550;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-address.is-pending code {
  color: var(--faint);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
}

.copy-mini {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  transition:
    color var(--transition),
    border-color var(--transition);
}

.copy-mini:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.copy-mini:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.copy-mini:disabled:hover {
  border-color: var(--line);
  color: var(--muted);
}

.copy-mini svg {
  width: 14px;
  height: 14px;
}

.service-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--faint);
  font-size: 10.5px;
}

.service-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.service-meta svg {
  width: 12px;
  height: 12px;
  opacity: 0.8;
}

.service-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding-top: 2px;
}

.service-actions .btn {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 11.5px;
}

.service-menu-wrap {
  position: relative;
  margin-left: auto;
}

.service-menu-button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.service-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 12;
  width: 146px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--panel-solid);
  box-shadow: var(--shadow-md);
  animation: menu-in 120ms ease-out;
}

.service-menu-panel .menu-item {
  padding: 8px 9px;
  font-size: 11.5px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 54px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--panel);
  text-align: center;
}

.empty-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  margin-bottom: 20px;
}

.empty-ring {
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(45, 212, 191, 0.26);
  border-radius: 50%;
  animation: beacon-pulse 4s ease-out infinite;
}

.empty-ring-2 {
  inset: 0;
  animation-delay: 1.2s;
}

.empty-core {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--panel-raised);
  color: var(--accent);
}

.empty-core svg {
  width: 26px;
  height: 26px;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.empty-state p {
  max-width: 390px;
  margin: 8px 0 20px;
  color: var(--faint);
  font-size: 12.5px;
  line-height: 1.65;
}

/* 9. Guide & footer */
.guide-card {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-top: 46px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(420px 240px at 92% 0%, rgba(56, 189, 248, 0.08), transparent 70%),
    var(--panel);
}

.guide-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--well);
  color: var(--blue);
}

.guide-icon svg {
  width: 20px;
  height: 20px;
}

.guide-copy {
  min-width: 0;
  flex: 1;
}

.guide-copy h2 {
  font-size: 16.5px;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.guide-copy > p {
  margin-top: 5px;
  color: var(--faint);
  font-size: 12px;
}

.code-block {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--well);
}

.code-block code {
  overflow: hidden;
  flex: 1;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.code-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.code-copy svg {
  width: 12px;
  height: 12px;
}

.guide-hint {
  margin-top: 10px !important;
  font-size: 11px !important;
  line-height: 1.6;
}

.guide-hint code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--well);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.dashboard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 38px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10.5px;
}

.footer-meta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
}

.footer-meta .pulse-dot {
  color: var(--green);
}

/* 10. Modals, menus, toasts */
.modal {
  width: min(560px, calc(100vw - 28px));
  max-height: min(88vh, 760px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow: visible;
}

.modal::backdrop {
  background: rgba(2, 7, 14, 0.72);
  backdrop-filter: blur(5px);
}

[data-theme="light"] .modal::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.modal[open] .modal-card {
  animation: modal-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-card {
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 760px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  background: var(--panel-solid);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-wide {
  width: min(720px, calc(100vw - 28px));
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 26px 0;
}

.modal-head h2 {
  font-size: 20px;
  font-weight: 720;
  letter-spacing: -0.03em;
}

.modal-head p {
  margin-top: 4px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.5;
}

.modal-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--muted);
}

.modal-close:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-body {
  overflow-y: auto;
  padding: 22px 26px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 0 26px 24px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.modal-actions .btn {
  min-height: 42px;
}

.token-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 6px 0 18px;
  text-align: center;
}

.token-hero-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.08);
  color: var(--green);
}

.token-hero-icon svg {
  width: 25px;
  height: 25px;
}

.token-hero h3 {
  font-size: 16px;
  font-weight: 650;
}

.token-hero p {
  color: var(--faint);
  font-size: 12px;
}

.token-warning {
  display: flex;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid rgba(251, 191, 36, 0.24);
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.07);
  color: var(--amber);
  font-size: 11.5px;
  line-height: 1.5;
}

.token-warning svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.token-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 14px;
}

.token-field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.token-value {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--well);
}

.token-value code {
  flex: 1;
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
}

.token-value .copy-mini {
  width: 34px;
  height: 34px;
}

.token-example-label {
  margin-top: 14px;
}

.webhook-config {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--well);
  overflow: hidden;
}

.webhook-config-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
}

.webhook-config-row + .webhook-config-row {
  border-top: 1px solid var(--line);
}

.webhook-config-row > span {
  padding-top: 1px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.webhook-config-row code,
.webhook-config-row pre {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.snippet {
  position: relative;
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--well);
  overflow-x: auto;
}

.snippet code {
  display: block;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.65;
  white-space: pre;
}

.history-list {
  display: flex;
  flex-direction: column;
}

.history-item {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px 0;
}

.history-item:not(:last-child) {
  border-bottom: 1px solid var(--line);
}

.history-marker {
  position: relative;
  display: flex;
  justify-content: center;
}

.history-marker::before {
  content: "";
  position: absolute;
  top: 16px;
  bottom: -22px;
  width: 1px;
  background: var(--line);
}

.history-item:last-child .history-marker::before {
  display: none;
}

.history-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.1);
}

.history-main strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 550;
}

.history-main strong .arrow {
  margin: 0 5px;
  color: var(--faint);
}

.history-main small {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 10.5px;
}

.history-time {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10.5px;
  white-space: nowrap;
}

.empty-inline {
  padding: 26px 0;
  color: var(--faint);
  font-size: 12.5px;
  text-align: center;
}

.confirm-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.confirm-copy strong {
  color: var(--text);
}

.toast-region {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: min(340px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel-solid);
  box-shadow: var(--shadow-md);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.45;
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

.toast.is-leaving {
  animation: toast-out 160ms ease-in forwards;
}

.toast-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}

.toast-success .toast-icon {
  background: rgba(52, 211, 153, 0.14);
  color: var(--green);
}

.toast-error .toast-icon {
  background: rgba(251, 113, 133, 0.14);
  color: var(--red);
}

.toast-info .toast-icon {
  background: rgba(56, 189, 248, 0.14);
  color: var(--blue);
}

.toast svg {
  width: 12px;
  height: 12px;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(4, 47, 46, 0.25);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.btn-ghost .spinner {
  border-color: var(--line-strong);
  border-top-color: var(--accent);
}

/* 11. Responsive */
@media (max-width: 1080px) {
  .auth-shell {
    grid-template-columns: minmax(0, 1fr) minmax(400px, 0.9fr);
  }

  .brand-panel-inner {
    padding-right: 40px;
    padding-left: 40px;
  }

  .brand-copy h1 {
    font-size: clamp(36px, 4.4vw, 50px);
  }

  .hero {
    gap: 40px;
  }
}

@media (max-width: 960px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    display: none;
  }

  .auth-main {
    min-height: 100vh;
    padding: 84px 24px 32px;
  }

  .auth-mobile-brand {
    display: block;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .relay-card {
    max-width: 520px;
  }

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

  .dashboard-main {
    padding-top: 38px;
  }
}

@media (max-width: 760px) {
  .topbar-inner {
    height: 64px;
    padding: 0 16px;
  }

  .connection-pill {
    padding: 0 9px;
  }

  .connection-pill span:last-child {
    display: none;
  }

  .user-name,
  .chevron {
    display: none;
  }

  .user-button {
    padding: 0 5px;
  }

  .dashboard-main {
    padding: 32px 16px 26px;
  }

  .hero-copy h1 {
    font-size: clamp(36px, 9vw, 48px);
  }

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

  .stat-card:last-child {
    grid-column: 1 / -1;
  }

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

  .section-head {
    align-items: flex-start;
  }

  .section-tag {
    display: none;
  }

  .guide-card {
    padding: 20px;
  }

  .guide-icon {
    display: none;
  }

  .dashboard-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

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

@media (max-width: 520px) {
  body {
    font-size: 14px;
  }

  .auth-main {
    padding: 78px 14px 24px;
    justify-content: flex-start;
  }

  .auth-topbar {
    top: 20px;
    right: 16px;
    left: 16px;
  }

  .auth-card {
    padding: 26px 20px;
    border-radius: 20px;
  }

  .auth-heading h2 {
    font-size: 25px;
  }

  .auth-tabs {
    margin-top: 20px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .hero-copy h1 {
    font-size: 36px;
  }

  .hero-lead {
    font-size: 13.5px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stat-card:last-child {
    grid-column: auto;
  }

  .stat-card {
    padding: 14px 16px;
  }

  .service-card {
    padding: 16px;
  }

  .service-address code {
    font-size: 16px;
  }

  .modal-head,
  .modal-body {
    padding-right: 18px;
    padding-left: 18px;
  }

  .modal-head {
    padding-top: 20px;
  }

  .modal-actions {
    padding-right: 18px;
    padding-bottom: 18px;
    padding-left: 18px;
  }

  .modal-actions .btn {
    flex: 1;
  }

  .toast-region {
    top: 12px;
    right: 12px;
    width: calc(100vw - 24px);
  }
}

@media (max-height: 720px) and (min-width: 961px) {
  .brand-copy {
    margin-top: 40px;
  }

  .beacon-visual {
    width: 280px;
    margin-top: 22px;
  }

  .feature-list {
    margin-top: 24px;
  }

  .feature-list li {
    padding: 9px 0;
  }
}

/* 12. Motion */
@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

@keyframes beacon-pulse {
  0% { transform: scale(0.92); opacity: 0.6; }
  70% { transform: scale(1.08); opacity: 0; }
  100% { transform: scale(1.08); opacity: 0; }
}

@keyframes boot-ring {
  0% { transform: scale(0.7); opacity: 0.8; }
  100% { transform: scale(1.5); opacity: 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes wave {
  0%, 100% { height: 16%; opacity: 0.4; }
  50% { height: 92%; opacity: 0.9; }
}

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(12px); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
