:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  background: #07111f;
  color: #e5eefb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(74, 144, 226, 0.25), transparent 35%),
    #07111f;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.card {
  background: rgba(8, 18, 33, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  margin-bottom: 20px;
}

.hero,
.controls,
.worker-header,
.section-title,
.buttons,
.auth-panel {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.hero,
.controls {
  align-items: flex-start;
}

.auth-panel {
  flex-direction: column;
  align-items: stretch;
  min-width: 320px;
}

.pat-form {
  display: grid;
  gap: 10px;
  width: 100%;
}

.pat-input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: #020817;
  color: #e5eefb;
  padding: 11px 14px;
  font: inherit;
}

.or-divider {
  color: #93a4bc;
  text-align: center;
  font-size: 12px;
  text-transform: uppercase;
}

.eyebrow,
.muted,
dt {
  color: #93a4bc;
}

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

.buttons {
  flex-wrap: wrap;
  justify-content: flex-start;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.primary {
  background: #4f8cff;
  color: white;
}

button.primary.busy {
  background: #2d66d4;
}

button.secondary {
  background: #17283f;
  color: #e5eefb;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

button.danger {
  background: #7f1d1d;
  color: white;
  border: 1px solid rgba(248, 113, 113, 0.35);
}

button.danger.busy {
  background: #991b1b;
}

.output {
  margin-top: 16px;
  background: #020817;
  border-radius: 12px;
  padding: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: #17283f;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

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

.deploy-panel {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  padding: 12px;
  background: rgba(2, 8, 23, 0.5);
  margin-top: 12px;
}

.workers.empty {
  display: block;
  color: #93a4bc;
}

.worker-card {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  padding: 16px;
  background: rgba(2, 8, 23, 0.5);
}

dl {
  margin: 16px 0;
  display: grid;
  gap: 10px;
}

dl div {
  display: grid;
  gap: 4px;
}

dd {
  margin: 0;
}

code {
  font-size: 12px;
}

a {
  color: #8dc3ff;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}

@media (max-width: 700px) {
  .hero,
  .controls,
  .auth-panel {
    flex-direction: column;
    align-items: stretch;
  }
}

.mode-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  background: rgba(8, 18, 33, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 30px;
  overflow: hidden;
  width: fit-content;
}

.mode-pill {
  padding: 8px 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #93a4bc;
  transition: all 0.2s;
  user-select: none;
  border: none;
  background: transparent;
  font-family: inherit;
}

.mode-pill.mode-active {
  background: #4f8cff;
  color: white;
  border-radius: 30px;
}

#simple-root {
  margin-top: 0;
}

.simple-hero {
  text-align: center;
  margin-bottom: 32px;
}

.simple-hero h2 {
  font-size: 28px;
  margin-top: 4px;
}

.simple-auth {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  max-width: 380px;
  margin: 0 auto;
}

.simple-btn {
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
  border-radius: 12px;
  text-align: center;
}

.simple-user-card {
  max-width: 380px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.setup-error {
  width: 100%;
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 12px;
  background: rgba(127, 29, 29, 0.22);
  color: #fecaca;
  padding: 12px;
  overflow-wrap: anywhere;
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: rgba(8, 18, 33, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 20px;
  padding: 32px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal h3 {
  font-size: 20px;
  margin-bottom: 16px;
}

.modal p {
  color: #93a4bc;
  line-height: 1.6;
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.modal-actions button {
  flex: 1;
}

/* Init view */
.init-view {
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
}

.init-view h3 {
  font-size: 20px;
  margin-bottom: 4px;
}

.progress-bar {
  height: 8px;
  background: rgba(148, 163, 184, 0.15);
  border-radius: 4px;
  overflow: hidden;
  margin: 24px 0 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f8cff, #7bafff);
  border-radius: 4px;
  transition: width 1s ease;
}

.progress-label {
  font-size: 13px;
  color: #93a4bc;
  margin-bottom: 20px;
}

.init-log-panel {
  background: #020817;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 12px;
  padding: 14px;
  text-align: left;
  max-height: 240px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 12px;
  line-height: 1.5;
}

.init-log-panel .log-line {
  display: block;
  color: #93a4bc;
  white-space: pre-wrap;
}

[hidden] {
  display: none !important;
}
