:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-app: #f3f6fb;
  --surface: #ffffff;
  --surface-muted: #f7f9fc;
  --surface-soft: #eef3fb;
  --border: #d9e1ee;
  --border-strong: #bdd0ec;
  --text: #12243b;
  --text-muted: #62758f;
  --accent: #1d63ed;
  --accent-strong: #0b57d0;
  --success: #138a62;
  --warning: #cc6b00;
  --danger: #d14848;
  --shadow: 0 18px 44px rgba(20, 47, 92, 0.08);
  --code-bg: #eef4fd;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08111d;
  --bg-app: #0b1523;
  --surface: #111d2d;
  --surface-muted: #162336;
  --surface-soft: #0f2038;
  --border: rgba(144, 169, 206, 0.16);
  --border-strong: rgba(144, 169, 206, 0.28);
  --text: #edf4ff;
  --text-muted: #a8b8cf;
  --accent: #4f8cff;
  --accent-strong: #7db0ff;
  --success: #52c49b;
  --warning: #ffb454;
  --danger: #ff8a8a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
  --code-bg: #0d1726;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", "Aptos", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  position: relative;
}

a {
  color: inherit;
  text-decoration: none;
}

code,
pre,
input,
button,
select {
  font: inherit;
}

#particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.auth-layout,
.message-shell {
  position: relative;
  z-index: 1;
}

.auth-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2rem;
  max-width: 1180px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  align-items: center;
}

.auth-copy {
  padding: 2rem;
}

.auth-copy h1,
.message-card h1 {
  margin: 0.35rem 0 1rem;
  font-size: clamp(2.4rem, 4vw, 3.9rem);
  line-height: 1.05;
}

.auth-copy p,
.message-card p,
.muted {
  color: var(--text-muted);
  line-height: 1.65;
}

.feature-list {
  padding-left: 1.2rem;
  color: var(--text-muted);
  line-height: 1.75;
}

.auth-card,
.message-card,
.hub-panel,
.hub-table-card,
.hub-command-card,
.hub-summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.auth-card,
.message-card {
  border-radius: 28px;
  padding: 1.6rem;
}

.auth-card-header,
.stack-form,
.hub-topbar,
.hub-toolbar,
.hub-summary-row,
.hub-panel-head,
.hub-detail-hero,
.hub-detail-grid,
.hub-tabs {
  display: flex;
  gap: 1rem;
}

.auth-card-header,
.hub-topbar,
.hub-toolbar,
.hub-panel-head,
.hub-detail-hero {
  align-items: center;
  justify-content: space-between;
}

.stack-form {
  display: grid;
}

.stack-form label {
  display: grid;
  gap: 0.45rem;
  color: var(--text-muted);
}

.stack-form input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  border-radius: 14px;
  padding: 0.88rem 0.95rem;
}

.primary-button,
.ghost-button,
.copy-button,
.link-button,
.danger-button {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.primary-button,
.link-button {
  background: var(--accent);
  color: white;
  padding: 0.88rem 1.25rem;
  font-weight: 700;
}

.danger-button {
  background: rgba(209, 72, 72, 0.12);
  color: var(--danger);
  border: 1px solid rgba(209, 72, 72, 0.22);
  padding: 0.75rem 1rem;
  font-weight: 700;
}

.ghost-button,
.copy-button {
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 0.75rem 1rem;
}

.ghost-button.compact,
.danger-button.compact {
  padding: 0.62rem 0.9rem;
  border-radius: 10px;
}

.primary-button:hover,
.ghost-button:hover,
.copy-button:hover,
.link-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.ghost-button:disabled,
.copy-button:disabled,
.link-button:disabled,
.danger-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.eyebrow,
.hub-kicker,
.hub-section-label,
.hub-sidebar-label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.77rem;
  color: var(--accent);
}

.qr-panel {
  display: grid;
  gap: 0.85rem;
  place-items: center;
  padding: 1rem;
  margin: 1rem 0 1.3rem;
  border-radius: 22px;
  background: var(--surface-muted);
}

.qr-image {
  width: min(250px, 100%);
  border-radius: 20px;
  background: white;
  padding: 0.75rem;
}

.alert {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  margin-top: 1rem;
}

.alert.error {
  color: white;
  background: var(--danger);
}

.helper-note {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 18px;
  background: var(--surface-muted);
  color: var(--text-muted);
}

.message-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.message-card {
  max-width: 520px;
  text-align: center;
}

.message-card .link-button {
  margin-top: 0.75rem;
}

.hub-app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background: var(--bg-app);
}

.hub-sidebar {
  background: var(--surface-muted);
  border-right: 1px solid var(--border);
  padding: 1.1rem 0.95rem;
  display: grid;
  align-content: start;
  gap: 1rem;
}

.hub-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem;
  border-radius: 14px;
  background: rgba(29, 99, 237, 0.06);
}

.hub-sidebar-logo {
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(180deg, #2468ef, #154bba);
  color: white;
  font-weight: 800;
  font-size: 1rem;
}

.hub-sidebar-brand strong,
.hub-topbar-copy {
  display: block;
}

.hub-sidebar-brand small,
.hub-endpoint {
  color: var(--text-muted);
}

.hub-sidebar-section {
  display: grid;
  gap: 0.7rem;
}

.hub-nav-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.72rem 0.85rem;
  border-radius: 12px;
  color: var(--text);
}

.hub-nav-link.active {
  background: rgba(29, 99, 237, 0.12);
  color: var(--accent-strong);
  font-weight: 700;
}

.hub-nav-icon {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 999px;
  border: 2px solid currentColor;
}

.hub-nav-icon.activity {
  border-radius: 4px;
}

.hub-sidebar-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  padding: 0.9rem;
}

.hub-sidebar-card.subtle {
  background: transparent;
}

.hub-sidebar-card p {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.hub-sidebar-card-title {
  font-weight: 700;
}

.hub-sidebar-inline-code {
  margin-top: 0.65rem;
  padding: 0.72rem;
  border-radius: 12px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 0.84rem;
  line-height: 1.45;
  word-break: break-word;
}

.hub-main {
  min-width: 0;
}

.hub-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 0.9rem 1.35rem;
  background: rgba(245, 247, 251, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

:root[data-theme="dark"] .hub-topbar {
  background: rgba(11, 21, 35, 0.92);
}

.hub-topbar-copy {
  display: grid;
  gap: 0.25rem;
}

.hub-topbar-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.hub-content {
  max-width: 1240px;
  padding: 1.35rem;
  display: grid;
  gap: 1rem;
}

.hub-page-intro {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
}

.hub-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hub-banner.success {
  border-color: rgba(19, 138, 98, 0.2);
  background: rgba(19, 138, 98, 0.08);
}

.hub-banner.error {
  border-color: rgba(209, 72, 72, 0.24);
  background: rgba(209, 72, 72, 0.08);
}

.hub-banner.warning {
  border-color: rgba(204, 107, 0, 0.24);
  background: rgba(204, 107, 0, 0.08);
}

.hub-page-intro h1,
.hub-detail-copy h1 {
  margin: 0;
  font-size: clamp(1.75rem, 2.6vw, 2.6rem);
}

.hub-page-intro p,
.hub-muted,
.hub-date-sub,
.hub-row-subcopy,
.hub-detail-meta,
.hub-detail-notes,
.hub-panel p {
  color: var(--text-muted);
}

.hub-toolbar {
  flex-wrap: wrap;
}

.hub-search,
.hub-select {
  min-height: 3.05rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0 0.9rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.hub-search {
  flex: 1 1 320px;
}

.hub-search input,
.hub-select select {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
}

.hub-search-icon {
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid var(--text-muted);
  border-radius: 999px;
  position: relative;
  flex: 0 0 auto;
}

.hub-search-icon::after {
  content: "";
  position: absolute;
  right: -0.32rem;
  bottom: -0.32rem;
  width: 0.55rem;
  height: 2px;
  background: var(--text-muted);
  transform: rotate(45deg);
  border-radius: 999px;
}

.hub-select {
  min-width: 220px;
  justify-content: space-between;
}

.hub-summary-row {
  flex-wrap: wrap;
}

.hub-summary-card {
  flex: 1 1 180px;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
}

.hub-summary-card span {
  color: var(--text-muted);
  display: block;
}

.hub-summary-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.2rem;
}

.hub-table-card,
.hub-panel,
.hub-command-card {
  border-radius: 16px;
  padding: 1rem;
  overflow-x: auto;
}

.hub-table,
.hub-table-card table {
  width: 100%;
  border-collapse: collapse;
}

.hub-table th,
.hub-table td {
  text-align: left;
  padding: 0.85rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.hub-table th {
  color: #526884;
  font-size: 0.88rem;
  font-weight: 700;
}

.hub-table td {
  font-size: 0.96rem;
}

.hub-table tbody tr:hover {
  background: rgba(29, 99, 237, 0.03);
}

.hub-repo-link,
.hub-inline-link {
  color: var(--text);
  font-weight: 700;
}

.hub-inline-link,
.hub-breadcrumbs a {
  color: var(--accent);
}

.hub-row-subcopy {
  margin-top: 0.28rem;
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  font-size: 0.86rem;
}

.hub-date-main {
  color: var(--text);
}

.hub-date-sub {
  margin-top: 0.16rem;
  font-size: 0.8rem;
}

.hub-pill,
.hub-status,
.hub-lock-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.3rem 0.72rem;
  font-size: 0.74rem;
  font-weight: 700;
}

.hub-row-actions,
.hub-detail-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.hub-tag-actions {
  display: grid;
  gap: 0.4rem;
}

.hub-inline-warning {
  color: var(--warning);
  font-size: 0.8rem;
}

.hub-pill.neutral,
.hub-lock-badge {
  background: #e6e8ec;
  color: #2f3a49;
}

:root[data-theme="dark"] .hub-pill.neutral,
:root[data-theme="dark"] .hub-lock-badge {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.hub-pill.pull {
  background: rgba(29, 99, 237, 0.12);
  color: var(--accent);
}

.hub-pill.push {
  background: rgba(19, 138, 98, 0.12);
  color: var(--success);
}

.hub-status.active {
  background: rgba(19, 138, 98, 0.12);
  color: var(--success);
}

.hub-status.quiet {
  background: rgba(204, 107, 0, 0.12);
  color: var(--warning);
}

.hub-status.inactive {
  background: rgba(98, 117, 143, 0.14);
  color: var(--text-muted);
}

.hub-detail-grid {
  align-items: start;
}

.hub-detail-column {
  flex: 1 1 320px;
  min-width: 0;
}

.hub-detail-column.wide {
  flex: 1.55 1 640px;
}

.hub-panel-head {
  margin-bottom: 1rem;
}

.hub-panel-head h2,
.hub-command-card h2 {
  margin: 0.15rem 0 0;
  font-size: 1.3rem;
}

.hub-breadcrumbs {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.96rem;
}

.hub-detail-hero {
  align-items: start;
}

.hub-detail-copy {
  flex: 1 1 620px;
}

.hub-command-card {
  flex: 0 0 320px;
}

.hub-detail-title-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.hub-detail-meta,
.hub-detail-notes,
.hub-stat-list {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.hub-detail-actions {
  margin-top: 0.95rem;
}

.hub-tabs {
  align-items: end;
  border-bottom: 1px solid var(--border);
  gap: 1.2rem;
  padding-bottom: 0.4rem;
}

.hub-tabs a {
  padding: 0.7rem 0.2rem;
  color: #546c8a;
  font-weight: 700;
  border-bottom: 3px solid transparent;
}

.hub-tabs a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.hub-stat-list {
  display: grid;
  gap: 0.9rem;
}

.hub-stat-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
}

.hub-stat-list span {
  color: var(--text-muted);
}

.command-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.72rem;
  margin-top: 0.72rem;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--code-bg);
}

.command-block.inline {
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.command-code {
  margin: 0;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Cascadia Code", "Consolas", "SFMono-Regular", monospace;
  font-size: 0.9rem;
  line-height: 1.45;
}

.hub-empty-state {
  padding: 2rem 0.5rem 0.5rem;
}

.hub-empty-state h3 {
  margin: 0 0 0.3rem;
}

.command-side-panel {
  height: fit-content;
}

.danger-dialog {
  width: min(480px, calc(100vw - 2rem));
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--text);
}

.danger-dialog::backdrop {
  background: rgba(7, 16, 29, 0.54);
  backdrop-filter: blur(4px);
}

.danger-dialog-card {
  display: grid;
  gap: 0.95rem;
  padding: 1.15rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.danger-dialog-card h2 {
  margin: 0;
}

.danger-dialog-impact,
.danger-dialog-note {
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  font-size: 0.92rem;
}

.danger-dialog-impact {
  background: rgba(209, 72, 72, 0.08);
  border: 1px solid rgba(209, 72, 72, 0.16);
}

.danger-dialog-note {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.danger-dialog-label {
  display: grid;
  gap: 0.45rem;
  color: var(--text-muted);
}

.danger-dialog-label input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
}

.danger-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
}

@media (max-width: 1440px) {
  .hub-app-shell {
    grid-template-columns: 232px minmax(0, 1fr);
  }

  .hub-content {
    max-width: 1160px;
    padding: 1.1rem;
  }

  .hub-table th,
  .hub-table td {
    padding: 0.75rem 0.42rem;
  }
}

@media (max-width: 1280px) {
  .hub-detail-hero,
  .hub-detail-grid {
    flex-direction: column;
  }

  .hub-command-card {
    width: 100%;
    flex-basis: auto;
  }
}

@media (max-width: 1100px) {
  .hub-app-shell {
    grid-template-columns: 1fr;
  }

  .hub-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }

  .hub-sidebar-brand {
    grid-column: 1 / -1;
  }

  .hub-sidebar-section {
    align-content: start;
  }
}

@media (max-width: 820px) {
  .auth-layout {
    grid-template-columns: 1fr;
    padding-top: 2rem;
  }

  .hub-content,
  .hub-topbar {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .hub-page-intro,
  .hub-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .hub-sidebar {
    grid-template-columns: 1fr;
  }

  .hub-table {
    min-width: 760px;
  }
}

@media (max-width: 640px) {
  .command-block {
    grid-template-columns: 1fr;
  }

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

  .hub-topbar-actions {
    justify-content: flex-end;
  }
}
