:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e3e6ea;
  --text: #1f2430;
  --muted: #6b7280;
  --accent: #1a73e8;
  --ok: #188038;
  --warn: #b06000;
  --err: #c5221f;
  --running: #1a73e8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font: 14px/1.5 -apple-system, "PingFang SC", "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

#titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
#titlebar .logo { font-weight: 700; font-size: 16px; }

#layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: calc(100vh - 44px);
}

#sidebar {
  border-right: 1px solid var(--border);
  background: var(--panel);
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.input-block { display: flex; flex-direction: column; gap: 8px; }
.input-block label { font-weight: 600; font-size: 13px; }
textarea {
  width: 100%;
  resize: vertical;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}
button {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font: inherit;
}
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
a.btn {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  font: inherit;
}

.btn-row { display: flex; gap: 8px; }
.btn-row button { flex: 1; }

.confirm-form {
  background: #f0f6ff;
  border: 1px solid #cfe0fb;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.confirm-form .confirm-title { font-weight: 600; font-size: 13px; }
.confirm-form .field { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.confirm-form .field label { width: 96px; color: var(--muted); }
.confirm-form .field input {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

#steps { list-style: none; margin: 0; padding: 0; }
#steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 13px;
  border: 1px solid transparent;
}
#steps li.done { color: var(--ok); }
#steps li.running { color: var(--running); border-color: var(--accent); background: #eef4fe; }
#steps li.failed { color: var(--err); border-color: var(--err); background: #fdeeee; }
#steps li.pending { color: var(--muted); }
#steps .mark { width: 16px; text-align: center; }

#actions { display: flex; flex-direction: column; gap: 8px; }
#actions .error-msg {
  color: var(--err);
  font-size: 12px;
  white-space: pre-wrap;
  background: #fdeeee;
  border: 1px solid var(--err);
  padding: 8px;
  border-radius: 6px;
}

#viewer {
  padding: 16px;
  overflow: auto;
  background: var(--bg);
}
#viewer .placeholder { color: var(--muted); text-align: center; margin-top: 60px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}
.card h3 { margin: 0 0 8px; font-size: 14px; }
.card img, .card object, .card embed { max-width: 100%; border: 1px solid var(--border); border-radius: 4px; }

.badge { font-weight: 600; }
.badge.ok { color: var(--ok); }
.badge.err { color: var(--err); }
.badge.warn { color: var(--warn); }

.route-note {
  color: var(--err);
  font-size: 12px;
  white-space: pre-wrap;
  background: #fdeeee;
  border: 1px solid var(--err);
  padding: 8px;
  border-radius: 6px;
  margin: 0 0 8px;
}

pre.json {
  background: #0f1419;
  color: #d7e0ea;
  padding: 10px;
  border-radius: 6px;
  overflow: auto;
  max-height: 320px;
  font-size: 12px;
}

.filelist { list-style: none; padding: 0; margin: 0; }
.filelist li { padding: 3px 0; font-size: 13px; }
.filelist a { color: var(--accent); text-decoration: none; }

#logout { margin-left: auto; }

#gate {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
#gate[hidden] { display: none; }
.gate-box {
  width: 300px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}
.gate-logo { font-size: 20px; font-weight: 700; text-align: center; }
.gate-sub { color: var(--muted); text-align: center; font-size: 13px; }
#gate-pass {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}
#gate-err { color: var(--err); font-size: 12px; min-height: 16px; text-align: center; }
#gate-submit { padding: 9px; font-size: 14px; }
