:root {
  color-scheme: dark;
  --bg: #020617;
  --panel: rgba(15, 23, 42, 0.94);
  --panel-soft: rgba(2, 6, 23, 0.55);
  --line: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #0f172a 0%, #020617 62%);
  color: var(--text);
}

code,
pre,
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.card,
.inner-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

.inner-card {
  background: var(--panel-soft);
  padding: 16px;
}

.auth-page {
  min-height: calc(100vh - 76px);
  display: grid;
  place-items: center;
}

.auth-card {
  max-width: 720px;
  width: 100%;
  text-align: center;
}

.auth-summary {
  margin-top: 18px;
}

.app-header {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .78rem;
  color: var(--accent);
}

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

.lede {
  color: var(--muted);
  line-height: 1.6;
}

.lede.small {
  font-size: .98rem;
}

.page {
  margin-top: 20px;
}

.section-head,
.page-head,
.tight {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-grid,
.mini-grid,
.stats-grid,
.detail-grid,
.preview-strip {
  display: grid;
  gap: 14px;
}

.status-grid.two-col,
.mini-grid,
.preview-strip,
.detail-grid.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.status-card,
.stat-card,
.info-card {
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 14px;
  background: var(--panel-soft);
  padding: 14px;
}

.status-card span,
.stat-card span,
.info-card span {
  display: block;
  color: var(--muted);
  font-size: 0.83rem;
  margin-bottom: 6px;
}

.status-card strong,
.stat-card strong,
.info-card strong {
  font-size: 1.05rem;
}

.info-card code {
  color: #7dd3fc;
  word-break: break-word;
}

.preview-strip {
  padding: 14px;
  border-radius: 14px;
  background: var(--panel-soft);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.preview-strip strong {
  display: block;
  margin-bottom: 8px;
}

.preview-strip code {
  display: block;
  color: #7dd3fc;
  word-break: break-word;
}

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

.action-grid.four-up {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.action-card {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: rgba(2, 6, 23, 0.45);
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.action-card:hover,
.action-card.active {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.16);
  transform: translateY(-1px);
}

.action-card strong {
  display: block;
  font-size: 1.02rem;
  margin-bottom: 8px;
}

.action-card p {
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.12);
  margin-bottom: 14px;
  font-size: 1.2rem;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.step-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.45);
}

.step-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  font-weight: 700;
}

.step-chip.good {
  border-color: rgba(34, 197, 94, .35);
  color: #86efac;
}

.step-chip.good span {
  background: rgba(34, 197, 94, .18);
}

.step-chip.info {
  border-color: rgba(56, 189, 248, .35);
  color: #7dd3fc;
}

.step-chip.info span {
  background: rgba(56, 189, 248, .18);
}

.step-chip.muted {
  color: var(--muted);
}

.notice {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(2, 6, 23, .4);
}

.notice.good { border-color: rgba(34, 197, 94, .35); color: #86efac; }
.notice.warn { border-color: rgba(245, 158, 11, .35); color: #fcd34d; }
.notice.bad { border-color: rgba(239, 68, 68, .35); color: #fca5a5; }
.notice.info { border-color: rgba(56, 189, 248, .35); color: #7dd3fc; }

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge.good { background: rgba(34, 197, 94, .16); color: #86efac; }
.badge.warn { background: rgba(245, 158, 11, .16); color: #fcd34d; }
.badge.bad { background: rgba(239, 68, 68, .16); color: #fca5a5; }
.badge.info { background: rgba(56, 189, 248, .16); color: #7dd3fc; }

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.image-grid label {
  min-width: 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button-row.center {
  justify-content: center;
}

.button-row.right {
  justify-content: flex-end;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
}

.button.large {
  padding: 14px 20px;
  font-size: 1rem;
}

.button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #082f49;
  border-color: transparent;
}

.button.secondary:hover,
.button.secondary:focus-visible {
  border-color: var(--accent);
}

.button.danger {
  border-color: rgba(239, 68, 68, .45);
  color: #fecaca;
}

button:disabled,
.button:disabled,
.button.disabled {
  cursor: not-allowed;
  opacity: .45;
}

.button.disabled {
  pointer-events: none;
}

label {
  display: block;
}

label span {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.helper {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #020617;
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.checkbox input {
  width: auto;
  margin: 0;
}

.checkbox span {
  margin: 0;
}

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

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

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, .12);
  vertical-align: top;
}

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

pre {
  min-height: 220px;
  margin: 0;
  padding: 16px;
  background: #020617;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.empty-state {
  color: var(--muted);
}

.danger-card {
  border-color: rgba(239, 68, 68, .35);
}

.hidden {
  display: none !important;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  background: #020617;
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 24px;
}

.busy-card {
  width: min(460px, 100%);
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 18px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
}

.busy-card h2 {
  margin-bottom: 10px;
}

.busy-card p {
  color: var(--muted);
  margin-bottom: 0;
}

.busy-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto 16px;
  padding: 8px 14px;
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
}

.busy-indicator-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  flex: 0 0 auto;
}

.busy-progress {
  width: min(280px, 100%);
  height: 10px;
  margin: 0 auto 18px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.busy-progress-fill {
  display: block;
  width: 68%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

@media (max-width: 980px) {
  .app-header,
  .mini-grid,
  .preview-strip,
  .status-grid.two-col,
  .detail-grid.two-up {
    grid-template-columns: 1fr;
  }

  .button-row.right {
    justify-content: flex-start;
  }
}
