:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --text: rgb(1, 5, 33);
  --muted: #6b7280;
  --faint: #9aa0ab;
  --line: rgba(1, 5, 33, 0.1);
  --shadow: 0 0 0 1px rgba(1, 5, 33, 0.15);
  --cyan: rgb(151, 230, 255);
  --ink: rgb(16, 22, 56);
  --danger: #9f2d2d;
  --sans: Geist, "Segoe UI Variable", "Segoe UI", sans-serif;
  --mono: "Geist Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body, #app {
  height: 100%;
  margin: 0;
}

body {
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  background:
    radial-gradient(520px 320px at 100% -10%, rgba(151, 230, 255, 0.55), transparent 70%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }

:focus-visible {
  outline: 2px solid rgba(1, 5, 33, 0.7);
  outline-offset: 2px;
}

::selection { background: rgba(151, 230, 255, 0.85); }

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.titlebar {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 8px 0 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: inherit;
  text-decoration: none;
}

.brand svg { width: 22px; height: 22px; display: block; }
.title-gap { flex: 1; }

.workspace {
  display: flex;
  gap: 16px;
  min-height: 0;
  flex: 1;
  padding: 0 16px 16px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  width: 232px;
  flex: none;
  padding: 14px;
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow);
}

.side-nav { display: grid; gap: 4px; }

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: left;
  transition: background 0.2s ease, color 0.2s ease;
}
.side-link.active, .side-link:hover { color: var(--text); background: #f3f4f6; }
.side-link small {
  margin-left: auto;
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
}

.side-foot {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}

.chip, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  font-weight: 600;
}

.chip {
  min-height: 28px;
  padding: 0 10px;
  background: #f3f4f6;
  color: var(--muted);
  font-size: 12px;
}
.chip.warn { background: #fff1f1; color: var(--danger); }
.chip.good { background: var(--cyan); color: var(--ink); }
.chip.wait { background: #fff6df; color: #8a5a12; }

.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  padding: 8px 8px 0;
}

.page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  animation: fade 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.page-head h1, .setup h1 {
  margin: 0;
  font-size: 42px;
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.95;
}

.lede { margin: 8px 0 0; max-width: 560px; color: var(--muted); line-height: 1.5; }

.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.search, .select, .field, textarea.field {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
}
.search, .select, .field { height: 40px; padding: 0 14px; }
.search { width: min(280px, 100%); }
.select { min-width: 160px; background: #fff; }
textarea.field {
  width: 100%;
  min-height: 180px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.5;
}

.btn {
  min-height: 38px;
  padding: 0 16px;
  background: #fff;
  box-shadow: var(--shadow);
}
.btn.primary { background: var(--cyan); color: var(--ink); box-shadow: none; }
.btn.primary:hover:not(:disabled) { background: #b7efff; }
.btn.quiet { background: transparent; box-shadow: none; color: var(--muted); }
.btn.danger { background: #fff1f1; color: var(--danger); box-shadow: none; }

.scroll {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 2px 6px 20px 2px;
}

.stack { display: grid; gap: 10px; align-content: start; }

.row, .panel, .dialog, .setup-card {
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 0 0 1px rgba(1, 5, 33, 0.08);
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 15px 16px;
  border: 0;
  text-align: left;
}
.row b { display: block; letter-spacing: -0.02em; }
.row p, .hint { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

.panel { padding: 18px; }
.form { display: grid; gap: 12px; max-width: 720px; }
label.lbl { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field.block, .select.block { width: 100%; }

.switch-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
}
.switch {
  width: 44px;
  height: 26px;
  padding: 3px;
  border: 0;
  border-radius: 999px;
  background: #e5e7eb;
}
.switch i {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}
.switch.on { background: var(--cyan); }
.switch.on i { transform: translateX(18px); }

.note {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
}

.alert {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #fff1f1;
  color: var(--danger);
  font-weight: 600;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(243, 244, 246, 0.72);
  animation: fade 0.18s ease both;
}
.dialog { width: min(460px, 100%); padding: 22px; animation: pop 0.28s cubic-bezier(0.22, 1, 0.36, 1) both; }
.dialog h2 { margin: 0 0 8px; font-size: 28px; font-weight: 500; letter-spacing: -0.04em; }
.dialog p { margin: 0 0 18px; color: var(--muted); line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 50;
  translate: -50% 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  animation: rise 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.setup {
  display: grid;
  place-items: center;
  flex: 1;
  padding: 24px;
}
.setup-card { width: min(560px, 100%); padding: 28px; }
.setup-card h1 { font-size: 64px; }
.addr-prefix {
  display: flex;
  align-items: center;
  gap: 8px;
}
.addr-prefix .field { flex: 1; min-width: 0; }
.addr-prefix span { color: var(--muted); font-weight: 600; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .page, .overlay, .dialog, .toast { animation: none; }
  .side-link, .switch i { transition: none; }
}

@media (max-width: 800px) {
  .workspace { flex-direction: column; padding: 0 12px 12px; gap: 12px; }
  .sidebar { width: 100%; padding: 8px; border-radius: 22px; }
  .side-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .side-link { width: auto; white-space: nowrap; }
  .side-foot { display: none; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head h1 { font-size: 34px; }
  .setup-card h1 { font-size: 48px; }
  .row { grid-template-columns: 1fr; }
  .row-actions { justify-content: flex-start; }
}
