:root {
  --ink: #171717;
  --text: #404040;
  --muted: #737373;
  --line: #e5e5e5;
  --bg: #f5f5f5;
  --white: #ffffff;
  --primary: #2a85ff;
  --primary-deep: #0069f6;
  --primary-soft: #2a85ff1a;
  --ok: #047857;
  --ok-bg: #ecfdf5;
  --bad: #dc2626;
  --wait: #b45309;
  --wait-bg: #fffbeb;
  color-scheme: light;
  font-family: Inter, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; color: var(--ink); font-weight: 700; letter-spacing: -0.02em; }
p { margin: 0; }
img { display: block; }

.top {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 24px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.logo { height: 32px; width: auto; }
.tabs { display: flex; gap: 20px; height: 100%; flex: 1; }
.tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  padding: 0 2px;
  border-radius: 0;
}
.tab.is-on { color: var(--ink); border-bottom-color: var(--primary); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.primary, .ghost, .tiny {
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 600;
}
.primary { background: var(--primary); color: white; padding: 8px 14px; }
.primary:hover { background: var(--primary-deep); }
.ghost { background: white; border-color: var(--line); color: var(--ink); padding: 8px 14px; }
.tiny { background: white; border-color: var(--line); color: var(--text); padding: 6px 10px; font-size: 13px; font-weight: 500; }
.tiny.primary { background: var(--primary); border-color: var(--primary); color: white; }
.readiness { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; }
.readiness li { font-size: 13px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); }
.readiness li.ok { background: var(--ok-bg); color: var(--ok); }
.readiness li.off { background: #fffbeb; color: #92400e; }
.pill {
  background: var(--bg);
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
}
.pill.is-open { background: var(--ok-bg); color: var(--ok); }
.pill.is-bad { background: #fef2f2; color: var(--bad); }

.local-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  padding: 10px 20px;
  background: #eff6ff;
  border-bottom: 1px solid #bfdbfe;
  font-size: 13px;
}
.local-banner code { font-size: 12px; background: white; padding: 2px 6px; border-radius: 4px; }
.board { display: grid; grid-template-columns: 320px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.queue {
  background: var(--white);
  border-right: 1px solid var(--line);
  padding: 20px 16px 40px;
}
.queue h2 { font-size: 18px; margin-bottom: 6px; }
.hint { color: var(--muted); line-height: 1.45; margin-bottom: 16px; }
.job {
  width: 100%;
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.job strong { display: block; color: var(--ink); font-weight: 600; }
.job small { display: block; color: var(--muted); margin-top: 4px; }
.job.is-on { border-color: var(--primary); background: var(--primary-soft); }
.job.is-live { border-color: #bfdbfe; background: #f8fbff; display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; }
.job.is-live .job-pct { font-size: 11px; font-weight: 700; color: var(--primary-deep); }
.job.is-live .progress-wrap { grid-column: 1 / -1; }
.job.is-live small { grid-column: 1 / -1; }
.empty-queue { color: var(--muted); line-height: 1.5; }
.btn-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  margin-right: 6px;
  vertical-align: -2px;
}
.tiny.is-busy { opacity: 0.85; }
#composer-form.is-submitting [type="submit"]::after {
  content: "…";
}
#composer-form.is-submitting [type="submit"] { pointer-events: none; opacity: 0.7; }

.detail { padding: 24px; }
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}
.detail-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 16px; }
.detail-head h2 { font-size: 22px; }
.muted { color: var(--muted); line-height: 1.5; }
.domains { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.domains a { color: var(--primary-deep); font-weight: 600; text-decoration: none; }
.domains a:hover { text-decoration: underline; }
.meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.meta div { background: var(--bg); border-radius: 8px; padding: 10px 12px; }
.meta span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.meta strong { color: var(--ink); font-weight: 600; }
.progress-wrap { width: 100%; }
.progress-wrap.sm .progress-track { height: 6px; }
.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 99px;
  background: #e5e5e5;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary-deep), var(--primary));
  transition: width 0.35s ease;
}
.progress-fill.is-busy {
  width: 40% !important;
  animation: progress-slide 1.1s ease-in-out infinite;
}
@keyframes progress-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.run-progress {
  background: var(--bg);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.run-progress.is-live .progress-pct { color: var(--primary-deep); }
.run-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}
.progress-pct { font-size: 18px; color: var(--ink); }
.run-progress-status { margin-top: 8px; font-size: 13px; font-weight: 500; color: var(--text); }
.run-hint { margin: -8px 0 16px; font-size: 13px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.steps-wizard { position: relative; padding-left: 4px; }
.timeline-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0 14px 0;
  position: relative;
}
.timeline-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 36px;
  bottom: -4px;
  width: 2px;
  background: var(--line);
}
.timeline-step.is-done:not(:last-child)::before,
.timeline-step.is-skipped:not(:last-child)::before { background: #86efac; }
.step-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: white;
  margin-top: 2px;
  position: relative;
  z-index: 1;
}
.timeline-step.is-done .step-marker {
  border-color: var(--ok);
  background: var(--ok-bg);
}
.timeline-step.is-done .step-marker::after {
  content: "";
  position: absolute;
  inset: 7px 9px 9px 7px;
  border: solid var(--ok);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.timeline-step.is-running .step-marker {
  border-color: var(--primary);
  border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}
.timeline-step.is-failed .step-marker {
  border-color: var(--bad);
  background: #fef2f2;
}
.timeline-step.is-failed .step-marker::before,
.timeline-step.is-failed .step-marker::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 6px;
  width: 2px;
  height: 14px;
  background: var(--bad);
  border-radius: 1px;
}
.timeline-step.is-failed .step-marker::before { transform: rotate(45deg); }
.timeline-step.is-failed .step-marker::after { transform: rotate(-45deg); }
.timeline-step.is-planned .step-marker { border-color: #fcd34d; background: var(--wait-bg); }
@keyframes spin { to { transform: rotate(360deg); } }
.step-content { min-width: 0; }
.step-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.step-title { color: var(--ink); font-weight: 600; }
.step-detail { color: var(--text); line-height: 1.45; margin: 0 0 8px; font-size: 13px; }
.sub-progress { margin-top: 6px; display: grid; gap: 6px; }
.badge {
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  padding: 2px 8px;
  background: var(--bg);
  color: var(--muted);
}
.badge.done { background: var(--ok-bg); color: var(--ok); }
.badge.failed { background: #fef2f2; color: var(--bad); }
.badge.running { background: var(--primary-soft); color: var(--primary-deep); }
.badge.planned { background: var(--wait-bg); color: var(--wait); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; align-items: center; }
.actions label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.pages { margin-top: 16px; }
.pages table, .sheet table { width: 100%; border-collapse: collapse; }
.pages th, .pages td, .sheet th, .sheet td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.pages th, .sheet th { color: var(--muted); font-size: 12px; font-weight: 600; }
.logs { margin-top: 16px; background: var(--bg); border-radius: 8px; padding: 12px 14px; }
.logs p { font-size: 12px; line-height: 1.55; color: var(--text); }
.logs .error { color: var(--bad); }
.logs .warn { color: var(--wait); }
.file-view {
  margin-top: 12px;
  background: var(--bg);
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
  max-height: 320px;
}
.file-view pre { margin: 0; white-space: pre-wrap; font-size: 12px; line-height: 1.5; color: var(--ink); }
.blank { max-width: 520px; padding: 48px 8px; }
.blank h2 { font-size: 28px; margin-bottom: 8px; }
.banner {
  background: var(--wait-bg);
  color: #78350f;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
  line-height: 1.45;
}

.sheet { padding: 28px 32px 64px; max-width: 960px; }
.sheet h2 { font-size: 28px; margin-bottom: 8px; }
.env-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.env-card { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.env-card h3 { font-size: 18px; margin-bottom: 8px; }
.env-card code { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.auth-gate[hidden],
#app-shell[hidden] { display: none; }
.auth-split {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.08);
  background: white;
}
.auth-form {
  padding: 40px 36px;
  display: grid;
  gap: 14px;
  align-content: start;
}
.auth-form h1 { font-size: 26px; margin: 8px 0 4px; }
.auth-brand-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.auth-connector {
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
}
.auth-mark { height: 40px; width: auto; justify-self: start; }
.auth-submit { width: 100%; margin-top: 8px; padding: 11px 16px; }
.auth-visual {
  background: linear-gradient(160deg, var(--primary-deep) 0%, var(--primary) 55%, #60a5fa 100%);
  color: white;
  display: grid;
  place-items: center;
  padding: 32px;
}
.auth-visual-inner {
  max-width: 280px;
  text-align: center;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 500;
}
.auth-visual-logo {
  height: 36px;
  width: auto;
  margin: 0 auto 20px;
  filter: brightness(0) invert(1);
}
.user-pill { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 768px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
}
dialog {
  width: min(840px, calc(100vw - 32px));
  background: white;
  color: var(--text);
  border: 0;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}
dialog h2 { font-size: 20px; margin: 12px 0 6px; }
dialog { max-height: calc(100vh - 48px); overflow: auto; }
dialog::backdrop { background: rgba(23, 23, 23, 0.45); }
.form-hint { color: var(--primary-deep); font-size: 13px; margin: 0; min-height: 1.2em; }
.dialog-head { margin-bottom: 18px; }
label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
label.field span { font-weight: 400; color: var(--muted); }
input:not([type="radio"]):not([type="checkbox"]) {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
}
input:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.address {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding-right: 12px;
}
.address:focus-within { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.address input {
  border: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
}
.address input:focus { outline: none; border-color: transparent; }
.address span { color: var(--muted); font-weight: 500; white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span-2 { grid-column: span 2; }
.choice-label { font-size: 13px; font-weight: 600; color: var(--ink); margin: 16px 0 8px; }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.choice, .theme-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
}
.choice input, .theme-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.choice:has(input:checked), .theme-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.choice strong, .theme-card strong { display: block; color: var(--ink); font-weight: 600; }
.choice small, .theme-card small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.theme-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: contain;
  background: white;
  border: 1px solid var(--line);
  flex: none;
  padding: 4px;
}
.files { margin-top: 12px; }
.files summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
.files .actions { margin-top: 8px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.form-error { color: var(--bad); min-height: 1.2em; margin-top: 10px; }

@media (max-width: 900px) {
  .top { height: auto; flex-wrap: wrap; padding: 12px 16px; gap: 12px; }
  .tabs { order: 3; width: 100%; height: 40px; }
  .board, .meta, .env-grid, .form-grid, .choice-grid, .theme-grid { display: block; }
  .detail { padding: 16px; }
  .domains { align-items: flex-start; margin-top: 10px; }
  .meta div, .env-card, .choice, .theme-card { margin-bottom: 8px; }
  .timeline li { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .sheet { padding: 20px 16px 48px; }
}
