/*
 * HPCXS app shell: left nav, top bar, content area, user menu, login.
 * Uses only tokens from hpcxs-tokens.css. Loaded after AdminLTE so it wins without !important
 * except where AdminLTE itself uses !important.
 */

/* ---------- Base ---------- */
.xs-body *,
.xs-body *::before,
.xs-body *::after {
  box-sizing: border-box;
}

html,
body.xs-body {
  background: var(--bg);
  color: var(--text);
}

body.xs-body {
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  margin: 0;
}

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

.xs-skip {
  position: absolute;
  inset-inline-start: var(--space-2);
  inset-block-start: -100px;
  z-index: 1100;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
}

.xs-skip:focus {
  inset-block-start: var(--space-2);
  color: var(--accent-contrast);
}

/* Visually hidden (Bootstrap's .sr-only is not loaded on the login page) */
.xs-body .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Wordmark ---------- */
.xs-wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-16);
  letter-spacing: 0.08em;
  text-decoration: none;
  white-space: nowrap;
}

.xs-wordmark:hover {
  color: var(--text);
  text-decoration: none;
}

.xs-wordmark-mark {
  width: 28px;
  height: 28px;
  flex: none;
  color: var(--accent);
}

.xs-wordmark-x {
  color: var(--accent);
}

/* ---------- Shell grid ---------- */
.xs-shell {
  min-height: 100vh;
}

.xs-nav {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: 1040;
  width: var(--nav-w);
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border-inline-end: 1px solid var(--border);
  transition: width var(--dur-panel) var(--ease), transform var(--dur-panel) var(--ease);
}

.xs-frame {
  margin-inline-start: var(--nav-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin var(--dur-panel) var(--ease);
  min-width: 0;
}

/* ---------- Left nav ---------- */
.xs-nav-head {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-inline: var(--space-4) var(--space-2);
  border-block-end: 1px solid var(--border);
}

.xs-nav-head .xs-wordmark {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.xs-nav-scroll {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) var(--space-2);
}

.xs-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.xs-nav-section {
  font-size: var(--fs-12);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-4) var(--space-3) var(--space-2);
  white-space: nowrap;
  overflow: hidden;
}

.xs-nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--hit);
  padding-inline: var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.xs-nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.xs-nav-link.is-active {
  background: var(--accent-soft);
  color: var(--text);
}

.xs-nav-link.is-active::before {
  content: '';
  position: absolute;
  inset-inline-start: calc(-1 * var(--space-2));
  inset-block: var(--space-2);
  width: 3px;
  border-radius: var(--radius-pill);
  background: var(--accent);
}

.xs-nav-link.is-active .xs-nav-icon {
  color: var(--accent);
}

.xs-nav-icon {
  width: 20px;
  flex: none;
  text-align: center;
  font-size: var(--fs-16);
}

.xs-nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.xs-nav-foot {
  flex: none;
  padding: var(--space-2);
  border-block-start: 1px solid var(--border);
}

/* Collapsed (icons only) */
.xs-nav-collapsed .xs-nav {
  width: var(--nav-w-collapsed);
}

.xs-nav-collapsed .xs-frame {
  margin-inline-start: var(--nav-w-collapsed);
}

.xs-nav-collapsed .xs-nav-label,
.xs-nav-collapsed .xs-nav-head .xs-wordmark-text {
  display: none;
}

.xs-nav-collapsed .xs-nav-head {
  padding-inline: var(--space-2);
  justify-content: center;
}

.xs-nav-collapsed .xs-nav-head .xs-wordmark {
  display: none;
}

.xs-nav-collapsed .xs-nav-section {
  height: 1px;
  padding: 0;
  margin: var(--space-3) var(--space-2);
  background: var(--border);
  color: transparent;
}

.xs-nav-collapsed .xs-nav-link {
  justify-content: center;
  padding-inline: 0;
}

.xs-nav-collapsed #nav-collapse-btn .fa-angles-left,
.xs-nav-collapsed #nav-collapse-btn .fa-angle-double-left {
  transform: scaleX(-1);
}

/* ---------- Icon buttons ---------- */
.xs-icon-btn {
  width: var(--hit);
  height: var(--hit);
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.xs-icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ---------- Top bar ---------- */
.xs-topbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 1030;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-inline: var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-block-end: 1px solid var(--border);
}

.xs-topbar .xs-wordmark {
  display: none;
}

#nav-open-btn {
  display: none;
}

.xs-copilot {
  flex: 1;
  max-width: 560px;
  position: relative;
  display: flex;
  align-items: center;
  cursor: not-allowed;
}

.xs-copilot-icon {
  position: absolute;
  inset-inline-start: var(--space-3);
  color: var(--accent);
  pointer-events: none;
}

.xs-copilot input {
  width: 100%;
  height: var(--hit);
  padding-inline: calc(var(--space-3) + 24px) 112px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font: inherit;
  cursor: not-allowed;
  pointer-events: none;
}

.xs-copilot input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.xs-copilot-soon {
  position: absolute;
  inset-inline-end: var(--space-2);
  font-size: var(--fs-12);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px var(--space-2);
  pointer-events: none;
  white-space: nowrap;
}

.xs-topbar-spacer {
  flex: 1;
}

.xs-topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-inline-start: auto;
}

/* Chips and pills in the top bar */
.xs-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 32px;
  padding-inline: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-1);
  color: var(--text);
  font-size: var(--fs-13);
  font-weight: var(--fw-medium);
  white-space: nowrap;
}

.xs-chip-muted {
  color: var(--text-muted);
  font-weight: var(--fw-regular);
}

.xs-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--idle);
}

.xs-dot[data-state="ok"] {
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
}

.xs-dot[data-state="wait"] {
  background: var(--wait);
  box-shadow: 0 0 0 3px var(--wait-soft);
}

.xs-dot[data-state="fail"] {
  background: var(--fail);
  box-shadow: 0 0 0 3px var(--fail-soft);
}

.xs-dot.is-pulsing {
  animation: xs-pulse var(--dur-pulse) var(--ease) 1;
}

@keyframes xs-pulse {
  50% {
    transform: scale(1.15);
    opacity: 0.6;
  }
}

/* Session pill (Driver.js anchor: .nav-session-pill) */
.nav-session-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 32px;
  padding-inline: var(--space-3) var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-1);
}

.session-id-text {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  color: var(--text-muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.copy-btn:hover {
  color: var(--accent);
  background: var(--surface-2);
}

.copy-btn .is-copied {
  color: var(--accent);
}

/* Page guide button (Driver.js anchor: #btn-start-tour) */
.xs-guide-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 32px;
  padding-inline: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--fs-13);
  font-weight: var(--fw-medium);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.xs-guide-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.xs-guide-btn i {
  color: var(--accent);
}

/* ---------- User menu ---------- */
.xs-usermenu {
  position: relative;
}

.xs-user-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--hit);
  padding-inline: var(--space-1) var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease);
}

.xs-user-btn:hover,
.xs-user-btn[aria-expanded="true"] {
  background: var(--surface-2);
}

.xs-avatar {
  width: 32px;
  height: 32px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-13);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
}

.xs-user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--fw-medium);
}

.xs-role {
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 2px var(--space-2);
}

.xs-menu {
  position: absolute;
  inset-inline-end: 0;
  inset-block-start: calc(100% + var(--space-2));
  min-width: 240px;
  padding: var(--space-2);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-overlay);
  z-index: 1060;
  opacity: 0;
  transform: translateY(-4px);
  visibility: hidden;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), visibility var(--dur-fast);
}

.xs-menu.is-open {
  opacity: 1;
  transform: none;
  visibility: visible;
}

.xs-menu-head {
  padding: var(--space-2) var(--space-3) var(--space-3);
  border-block-end: 1px solid var(--border);
  margin-block-end: var(--space-2);
}

.xs-menu-head strong {
  display: block;
  font-weight: var(--fw-semibold);
  overflow: hidden;
  text-overflow: ellipsis;
}

.xs-menu-head span {
  color: var(--text-muted);
  font-size: var(--fs-13);
}

.xs-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--hit);
  padding-inline: var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}

.xs-menu-item:hover,
.xs-menu-item:focus-visible {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.xs-menu-item i {
  width: 18px;
  text-align: center;
  color: var(--text-muted);
}

.xs-menu-item-meta {
  margin-inline-start: auto;
  color: var(--text-muted);
  font-size: var(--fs-12);
}

.xs-menu-item.is-danger,
.xs-menu-item.is-danger i {
  color: var(--fail);
}

.xs-menu-sep {
  height: 1px;
  margin: var(--space-2) 0;
  background: var(--border);
}

/* ---------- Content ---------- */
.xs-main {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding: var(--space-5) var(--gutter) var(--space-6);
  min-width: 0;
}

.xs-main > .container-fluid {
  padding-inline: 0;
}

/* Legacy pages that still wrap themselves in AdminLTE's .content-wrapper (xray.html): neutralize the
   offset AdminLTE computes for its own sidebar. */
.xs-main .content-wrapper {
  margin-inline-start: 0 !important;
  min-height: 0 !important;
  background: transparent !important;
  transition: none;
}

.xs-main .content-wrapper > .content-header,
.xs-main .content-wrapper > .content {
  padding-inline: 0;
}

.xs-main .content-wrapper .container-fluid {
  padding-inline: 0;
}

/* Flash messages */
.xs-flash {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  margin-block-end: var(--space-4);
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  color: var(--text);
}

.xs-flash i {
  margin-block-start: 2px;
  color: var(--accent);
}

.xs-flash[data-kind="danger"],
.xs-flash[data-kind="error"] {
  border-inline-start-color: var(--fail);
}

.xs-flash[data-kind="danger"] i,
.xs-flash[data-kind="error"] i {
  color: var(--fail);
}

.xs-flash[data-kind="warning"] {
  border-inline-start-color: var(--wait);
}

.xs-flash[data-kind="warning"] i {
  color: var(--wait);
}

.xs-flash[data-kind="success"] {
  border-inline-start-color: var(--ok);
}

.xs-flash[data-kind="success"] i {
  color: var(--ok);
}

/* Nav overlay (mobile drawer) */
.xs-scrim {
  position: fixed;
  inset: 0;
  z-index: 1035;
  background: var(--scrim);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-panel) var(--ease), visibility var(--dur-panel);
}

/* ---------- Responsive ---------- */
@media (max-width: 1279.98px) {
  .xs-cluster-meta {
    display: none;
  }
}

@media (max-width: 1023.98px) {
  .xs-user-name,
  .xs-guide-label {
    display: none;
  }
}

@media (max-width: 767.98px) {
  .xs-nav {
    width: var(--nav-w);
    transform: translateX(-100%);
    box-shadow: none;
  }

  .xs-frame,
  .xs-nav-collapsed .xs-frame {
    margin-inline-start: 0;
  }

  /* The drawer always shows labels, even if the desktop nav was collapsed */
  .xs-nav-collapsed .xs-nav {
    width: var(--nav-w);
  }

  .xs-nav-collapsed .xs-nav-label,
  .xs-nav-collapsed .xs-nav-head .xs-wordmark {
    display: revert;
  }

  .xs-nav-collapsed .xs-nav-head .xs-wordmark {
    display: inline-flex;
  }

  .xs-nav-collapsed .xs-nav-head .xs-wordmark-text {
    display: inline;
  }

  .xs-nav-collapsed .xs-nav-head {
    justify-content: flex-start;
    padding-inline: var(--space-4) var(--space-2);
  }

  .xs-nav-collapsed .xs-nav-link {
    justify-content: flex-start;
    padding-inline: var(--space-3);
  }

  .xs-nav-collapsed .xs-nav-section {
    height: auto;
    margin: 0;
    padding: var(--space-4) var(--space-3) var(--space-2);
    background: none;
    color: var(--text-muted);
  }

  #nav-collapse-btn {
    display: none;
  }

  .xs-nav-open .xs-nav {
    transform: none;
    box-shadow: var(--shadow-overlay);
  }

  .xs-nav-open .xs-scrim {
    opacity: 1;
    visibility: visible;
  }

  #nav-open-btn {
    display: inline-flex;
  }

  .xs-topbar {
    gap: var(--space-2);
  }

  .xs-topbar .xs-wordmark {
    display: inline-flex;
  }

  .xs-topbar .xs-wordmark-text {
    font-size: var(--fs-14);
  }

  .xs-copilot,
  .nav-session-pill {
    display: none;
  }

  /* Keep the status text for screen readers; show only the dot. */
  .xs-cluster-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .xs-chip.xs-cluster {
    padding-inline: var(--space-3);
  }

  .xs-role,
  .xs-user-btn .fa-chevron-down {
    display: none;
  }

  .xs-main {
    padding-block-start: var(--space-4);
  }
}

@media (min-width: 768px) {
  .xs-topbar-spacer {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .xs-nav,
  .xs-frame,
  .xs-menu,
  .xs-scrim {
    transition: none;
  }

  .xs-dot.is-pulsing {
    animation: none;
  }
}

/* ---------- Driver.js theme ---------- */
.driver-popover.xs-tour,
.driver-popover {
  background-color: var(--surface-1);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-overlay);
  padding: var(--space-5);
  font-family: var(--font-sans);
}

.driver-popover-title {
  font-size: var(--fs-16);
  font-weight: var(--fw-semibold);
  color: var(--text);
  margin-bottom: var(--space-2);
}

.driver-popover-description {
  font-size: var(--fs-14);
  color: var(--text-muted);
  line-height: 1.5;
}

.driver-popover-progress-text {
  color: var(--text-muted);
  font-size: var(--fs-13);
}

.driver-popover-footer button {
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-4);
  font-weight: var(--fw-medium);
  text-shadow: none;
  font-family: var(--font-sans);
}

.driver-popover .driver-popover-prev-btn,
.driver-popover .driver-popover-prev-btn:hover,
.driver-popover .driver-popover-prev-btn:focus {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.driver-popover .driver-popover-next-btn,
.driver-popover .driver-popover-next-btn:hover,
.driver-popover .driver-popover-next-btn:focus {
  background: var(--accent);
  color: var(--accent-contrast);
  border: 1px solid var(--accent);
}

.driver-popover .driver-popover-footer button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.driver-popover-close-btn {
  color: var(--text-muted);
}

.driver-popover-close-btn:hover {
  color: var(--text);
}

.driver-popover-arrow {
  display: none;
}

/* ---------- Login ---------- */
.xs-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5) var(--space-4);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.xs-login-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* Soft dot grid that fades out toward the edges */
.xs-login-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(color-mix(in srgb, var(--text-muted) 22%, transparent) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%);
  mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%);
}

/* Slow drifting accent glow */
.xs-login-bg::after {
  content: '';
  position: absolute;
  width: 720px;
  height: 720px;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  margin: -360px 0 0 -360px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent) 0%, transparent 60%);
  animation: xs-drift 18s var(--ease) infinite alternate;
}

@keyframes xs-drift {
  from {
    transform: translate(-12%, -8%) scale(1);
  }

  to {
    transform: translate(12%, 8%) scale(1.1);
  }
}

.xs-login-nodes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--accent);
  opacity: 0.5;
}

.xs-login-nodes circle {
  fill: currentColor;
  animation: xs-blink 4s ease-in-out infinite;
}

.xs-login-nodes line {
  stroke: color-mix(in srgb, var(--accent) 35%, transparent);
  stroke-width: 1;
  stroke-dasharray: 4 6;
  animation: xs-flow 6s linear infinite;
}

/* Staggered so the nodes twinkle independently */
.xs-login-nodes circle:nth-child(1) {
  animation-delay: 0s;
}

.xs-login-nodes circle:nth-child(2) {
  animation-delay: 0.6s;
}

.xs-login-nodes circle:nth-child(3) {
  animation-delay: 1.4s;
}

.xs-login-nodes circle:nth-child(4) {
  animation-delay: 2.1s;
}

.xs-login-nodes circle:nth-child(5) {
  animation-delay: 0.9s;
}

.xs-login-nodes circle:nth-child(6) {
  animation-delay: 2.6s;
}

.xs-login-nodes circle:nth-child(7) {
  animation-delay: 1.1s;
}

.xs-login-nodes circle:nth-child(8) {
  animation-delay: 0.3s;
}

.xs-login-nodes circle:nth-child(9) {
  animation-delay: 1.8s;
}

.xs-login-nodes circle:nth-child(10) {
  animation-delay: 2.9s;
}

.xs-login-nodes circle:nth-child(11) {
  animation-delay: 0.5s;
}

@keyframes xs-blink {
  0%,
  100% {
    opacity: 0.25;
  }

  50% {
    opacity: 1;
  }
}

@keyframes xs-flow {
  to {
    stroke-dashoffset: -100;
  }
}

@media (prefers-reduced-motion: reduce) {
  .xs-login-bg::after,
  .xs-login-nodes circle,
  .xs-login-nodes line {
    animation: none;
  }
}

.xs-login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay);
  padding: var(--space-6);
}

.xs-login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-block-end: var(--space-5);
  text-align: center;
}

.xs-login-brand .xs-wordmark {
  font-size: var(--fs-24);
  letter-spacing: 0.12em;
}

.xs-login-brand .xs-wordmark-mark {
  width: 36px;
  height: 36px;
}

.xs-login-brand p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-14);
}

.xs-login-title {
  font-size: var(--fs-20);
  font-weight: var(--fw-semibold);
  margin: 0 0 var(--space-1);
}

.xs-login-sub {
  margin: 0 0 var(--space-5);
  color: var(--text-muted);
}

.xs-field {
  margin-block-end: var(--space-4);
}

.xs-field + .xs-btn-primary {
  margin-block-start: var(--space-2);
}

.xs-field label {
  display: block;
  margin-block-end: var(--space-2);
  font-size: var(--fs-13);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
}

.xs-input-wrap {
  position: relative;
}

.xs-input {
  width: 100%;
  height: 44px;
  padding-inline: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.xs-input-wrap .xs-input {
  padding-inline-end: calc(var(--hit) + var(--space-1));
}

.xs-input::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

.xs-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.xs-input-wrap .xs-icon-btn {
  position: absolute;
  inset-inline-end: 2px;
  inset-block-start: 2px;
}

.xs-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-contrast);
  font: inherit;
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: filter var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.xs-btn-primary:hover {
  filter: brightness(1.08);
}

.xs-btn-primary:active {
  transform: scale(0.99);
}

.xs-btn-primary[disabled] {
  opacity: 0.7;
  cursor: progress;
}

.xs-alert-error {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  padding: var(--space-3);
  margin-block-end: var(--space-4);
  border: 1px solid color-mix(in srgb, var(--fail) 35%, transparent);
  border-radius: var(--radius-sm);
  background: var(--fail-soft);
  color: var(--text);
  font-size: var(--fs-13);
}

.xs-alert-error i {
  color: var(--fail);
  margin-block-start: 2px;
}

.xs-login-foot {
  margin-block-start: var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: var(--fs-12);
}

.xs-login-foot .xs-icon-btn {
  width: 32px;
  height: 32px;
}

@media (max-width: 479.98px) {
  .xs-login-card {
    padding: var(--space-5);
  }
}
