:root {
  color-scheme: dark;
  --bg: #090e1a;
  --bg-soft: #0e1629;
  --panel: #121b31;
  --panel-2: #0f172a;
  --border: #273553;
  --border-soft: rgba(148, 163, 184, 0.18);
  --text: #eef4ff;
  --muted: #9fb0d0;
  --muted-2: #7483a3;
  --accent: #7da2ff;
  --accent-2: #9cc2ff;
  --danger: #ff9aaa;
  --danger-bg: rgba(127, 29, 45, 0.28);
  --notice: #c7ddff;
  --notice-bg: rgba(37, 99, 235, 0.18);
  --radius: 18px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 30% -20%, rgba(77, 111, 255, 0.22), transparent 34rem),
    linear-gradient(180deg, #111936 0%, var(--bg) 42rem);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

a {
  color: var(--accent-2);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

.page-loader {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 50;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: opacity 160ms ease, transform 160ms ease;
}

.page-loader.is-active {
  opacity: 1;
  transform: scaleX(1);
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 28px;
}

.page-header-main {
  max-width: 780px;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  margin: 0 0 16px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent-2);
  background: rgba(18, 27, 49, 0.74);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.25rem, 5vw, 4.75rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 6px;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.03rem;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.7vw, 1.2rem);
  line-height: 1.7;
}

.muted,
.field-hint,
small {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 18px;
}

.page-grid {
  display: grid;
  gap: 18px;
}

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

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

.grid.sidebar {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
}

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

.page-grid.sidebar {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
}

.section {
  margin-top: 18px;
}

.section-spacer {
  margin-top: 18px;
}

.card,
.subcard,
.auth-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(18, 27, 49, 0.92);
  box-shadow: var(--shadow);
}

.card {
  padding: 22px;
}

.subcard {
  padding: 18px;
  background: rgba(15, 23, 42, 0.74);
}

.card-header,
.section-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.card-header.flush {
  margin-bottom: 0;
}

.card-title p,
.section-title p,
.panel-copy {
  margin: 4px 0 0;
  color: var(--muted);
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin: 0;
}

.stats > div,
.kv > div {
  min-width: 0;
}

.stats dt,
.kv dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.stats dd,
.kv dd {
  margin: 0;
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.stats dd {
  font-size: 1.05rem;
}

.kv {
  display: grid;
  gap: 13px;
  margin: 0;
}

.mono,
.code,
.inline-code {
  font-family:
    ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, "Liberation Mono",
    monospace;
}

.inline-code {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  font-size: 0.92em;
}

.help {
  position: relative;
  flex: 0 0 auto;
}

.help summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.72);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.help summary::before {
  content: "?";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  color: #09111f;
  background: var(--accent);
  font-size: 0.75rem;
}

.help summary::-webkit-details-marker {
  display: none;
}

.help-body {
  position: absolute;
  right: 0;
  z-index: 20;
  width: min(420px, calc(100vw - 48px));
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #0c1428;
  box-shadow: var(--shadow);
}

.help-body p:last-child {
  margin-bottom: 0;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.field label,
legend {
  color: var(--text);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  background: rgba(9, 14, 26, 0.82);
  color: var(--text);
  font: inherit;
}

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

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(125, 162, 255, 0.18);
}

fieldset {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.48);
}

legend {
  padding: 0 6px;
}

.checkbox {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.checkbox input {
  width: 18px;
  height: 18px;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--accent);
  color: #08111f;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button-link:hover {
  filter: brightness(1.04);
}

button:disabled,
.button-link[aria-disabled="true"] {
  opacity: 0.7;
  cursor: progress;
  filter: none;
}

button.secondary,
.button-link.secondary {
  border-color: var(--border);
  background: rgba(30, 41, 59, 0.82);
  color: var(--text);
}

button.danger,
.button-link.danger {
  border-color: rgba(255, 154, 170, 0.36);
  background: var(--danger-bg);
  color: #ffe2e6;
}

.actions,
.toolbar,
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

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

.actions form,
.inline-form {
  margin: 0;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.grow {
  flex: 1 1 280px;
}

.full-width {
  width: 100%;
}

.alert,
.notice {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 14px;
}

.alert {
  border: 1px solid rgba(255, 154, 170, 0.35);
  background: var(--danger-bg);
  color: #ffd8de;
}

.flash-card {
  display: grid;
  gap: 14px;
}

.flash-card h2 {
  margin: 0;
  font-size: 1.05rem;
}

.flash-card p {
  margin: 4px 0 0;
}

.hint-list {
  display: grid;
  gap: 8px;
}

.hint-list p {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.45);
  color: var(--text);
}

.notice {
  border: 1px solid rgba(156, 194, 255, 0.28);
  background: var(--notice-bg);
  color: var(--notice);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 10px;
  border-top: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: capitalize;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.42);
}

.empty-state p:last-child {
  margin-bottom: 0;
}

.auth-shell {
  width: min(1100px, calc(100% - 32px));
}

.auth-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(460px, 1.15fr);
  gap: 18px;
  align-items: start;
}

.auth-panel {
  padding: 28px;
}

.auth-panel-intro {
  background:
    linear-gradient(135deg, rgba(125, 162, 255, 0.12), rgba(18, 27, 49, 0.94) 45%),
    rgba(18, 27, 49, 0.92);
}

.auth-hero-title {
  max-width: 10ch;
  font-size: clamp(2.7rem, 5.8vw, 5rem);
  line-height: 0.94;
  letter-spacing: -0.04em;
}

.auth-steps {
  display: grid;
  gap: 12px;
}

.auth-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 15px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.54);
}

.auth-step h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.auth-step p {
  margin: 0;
}

.auth-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(125, 162, 255, 0.18);
  color: var(--text);
  font-weight: 800;
}

.auth-setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 20px;
  align-items: start;
}

.auth-totp-card {
  padding: 18px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.54);
}

.auth-totp-card h3 {
  margin-bottom: 6px;
}

.auth-list {
  display: grid;
  gap: 10px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.auth-list li,
.summary-card {
  padding: 13px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.54);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.meter-stack {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

meter {
  width: 100%;
  height: 12px;
}

.warning-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.warning-list p {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(252, 211, 77, 0.35);
  border-radius: 12px;
  background: rgba(120, 53, 15, 0.24);
  color: #fde68a;
}

.wizard-dialog {
  width: min(760px, calc(100% - 24px));
  max-height: min(86vh, 980px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: transparent;
  color: var(--text);
  box-shadow: var(--shadow);
}

.wizard-dialog::backdrop {
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(6px);
}

.dialog-card {
  max-height: min(86vh, 980px);
  margin: 0;
  padding: 24px;
  overflow: auto;
  background: var(--panel);
}

.dialog-card-danger {
  background: linear-gradient(180deg, rgba(60, 14, 22, 0.96), rgba(17, 24, 39, 0.98));
}

.qr-block {
  display: inline-flex;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
}

.qr-image {
  display: block;
  width: min(200px, 100%);
  height: auto;
  border-radius: 8px;
}

.log-output {
  min-height: 300px;
  max-height: 520px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #050914;
  color: #d8e5ff;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}

.page-header.compact h1 {
  font-size: clamp(2rem, 3.4vw, 3.25rem);
}

.hero-card,
.onboarding-checklist-card {
  background:
    linear-gradient(135deg, rgba(125, 162, 255, 0.12), rgba(18, 27, 49, 0.94) 45%),
    rgba(18, 27, 49, 0.92);
}

.hero-summary {
  margin-top: 0;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 16px;
}

.project-card {
  height: 100%;
}

.project-card-header {
  margin-bottom: 14px;
}

.compact-kv {
  gap: 10px;
}

.checklist {
  display: grid;
  gap: 12px;
}

.check-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.52);
}

.check-item h3,
.wizard-step h3 {
  margin-bottom: 6px;
}

.check-item p,
.wizard-step p {
  margin-bottom: 0;
}

.check-item.is-done {
  border-color: rgba(134, 239, 172, 0.28);
  background: rgba(20, 83, 45, 0.18);
}

.check-item-badge {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(125, 162, 255, 0.16);
  color: var(--accent-2);
  font-weight: 800;
}

.wizard-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.wizard-indicator {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.54);
  font-size: 0.88rem;
  font-weight: 700;
}

.wizard-indicator.is-active {
  border-color: rgba(125, 162, 255, 0.36);
  color: var(--text);
  background: rgba(125, 162, 255, 0.18);
}

.input-status {
  min-height: 1.3rem;
  margin: 0;
  font-size: 0.92rem;
}

.input-status.is-loading {
  color: var(--muted);
}

.input-status.is-ok {
  color: #93f0b5;
}

.input-status.is-error {
  color: #ffbec8;
}

.repo-list,
.simple-list {
  display: grid;
  gap: 12px;
}

.simple-list {
  margin: 0;
  padding-left: 18px;
}

.repo-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.52);
}

.repo-item.is-selected {
  border-color: rgba(125, 162, 255, 0.38);
  background: rgba(125, 162, 255, 0.12);
}

.repo-item h3,
.repo-item p {
  margin-bottom: 6px;
}

.code-block {
  min-height: 180px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #050914;
  color: #d8e5ff;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}

.env-editor-list {
  display: grid;
  gap: 12px;
}

.env-editor-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.52);
}

.env-editor-remove {
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

@media (max-width: 940px) {
  .grid.two,
  .grid.three,
  .grid.sidebar,
  .page-grid.two-up,
  .page-grid.sidebar,
  .auth-grid,
  .auth-setup-grid,
  .env-editor-row {
    grid-template-columns: 1fr;
  }

  .page-header,
  .card-header,
  .section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .help-body {
    position: static;
    width: auto;
  }

  .auth-hero-title {
    max-width: none;
    font-size: clamp(2.25rem, 8vw, 3.5rem);
  }
}

@media (max-width: 640px) {
  .shell,
  .auth-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 24px;
  }

  .card,
  .auth-panel {
    padding: 18px;
  }

  h1 {
    font-size: clamp(2rem, 13vw, 3rem);
  }

  button,
  .button-link {
    width: 100%;
  }
}
