:root {
  --bg: #edf5fb;
  --card: rgba(255,255,255,.88);
  --text: #17243d;
  --muted: #6f7f99;
  --line: #dbe4ef;
  --primary: #526ef5;
  --danger: #ff6f68;
  --ok: #19a66a;
  --warn: #c48700;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 85% 8%, #d9f5f2, transparent 28%),
    radial-gradient(circle at 22% 10%, #dce2ff, transparent 26%),
    var(--bg);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.layout { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
aside {
  background: rgba(255,255,255,.78);
  border-right: 1px solid rgba(255,255,255,.9);
  padding: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex; gap: 14px; align-items: center;
  padding: 20px; border: 1px solid #d6e1f4; border-radius: 22px;
  background: linear-gradient(135deg,#f7f8ff,#e8f7f6);
}
.logo {
  width: 50px; height: 50px; border-radius: 16px;
  display: grid; place-items: center; color: white; background: var(--primary);
  font-size: 24px;
}
small { color: var(--muted); }
.brand small, header small, .section-title small, .quick-create small {
  color: #00a19a; letter-spacing: .22em;
}
.brand h2 { margin: 4px 0 0; line-height: 1.05; font-size: 28px; }
nav { margin-top: 28px; display: grid; gap: 10px; }
nav a {
  text-decoration: none; color: var(--text); padding: 16px 18px;
  border-radius: 12px; font-weight: 800;
}
nav a:hover, nav a.active { background: #e3e8ff; color: #304dbb; }
.note {
  margin-top: 30px; padding: 16px; border: 1px solid var(--line);
  border-radius: 14px; color: var(--muted); font-size: 13px; line-height: 1.7;
}
main { padding: 28px; overflow: hidden; }
header h1 { margin: 4px 0 8px; font-size: 36px; }
header p { margin: 0 0 22px; color: var(--muted); }
.card {
  background: var(--card); border: 1px solid rgba(255,255,255,.9);
  box-shadow: 0 18px 45px rgba(55,83,120,.08);
  border-radius: 24px; padding: 26px; margin-bottom: 24px;
}
.section-title {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 14px;
}
.section-title h2 { margin: 4px 0 0; font-size: 26px; }
.count, .pill { background: #e0f2f2; padding: 8px 14px; border-radius: 999px; font-weight: 800; }
.pill.ok { background: #dff7e9; color: var(--ok); }
.pill.warn { background: #fff3d4; color: var(--warn); }
.stat-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.72);
}
.stat-card b { display: block; margin-top: 8px; font-size: 28px; }
.quick-create {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 18px;
  align-items: start;
  padding: 18px;
  border: 1px dashed #c4cdec;
  border-radius: 18px;
  background: rgba(238,242,255,.55);
}
.quick-create h3 { margin: 6px 0; font-size: 24px; }
.quick-create p { margin: 0; color: var(--muted); line-height: 1.65; }
.quick-form { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; align-items: end; }
.grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
label { display: grid; gap: 8px; font-weight: 800; font-size: 14px; }
input, textarea, select {
  width: 100%; padding: 13px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: rgba(255,255,255,.76); color: var(--text);
  font: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid #cfd7ff; border-color: var(--primary); }
textarea { font-family: "SFMono-Regular", Consolas, monospace; resize: vertical; }
.full { grid-column: 1 / -1; }
.actions { align-items: start; margin-top: 2px; }
button {
  border: 0; border-radius: 12px; padding: 13px 20px; cursor: pointer;
  background: var(--primary); color: white; font-weight: 900; font-size: 15px;
}
button:hover { filter: brightness(.96); }
button.danger { background: var(--danger); }
button.secondary { background: #e5e9f4; color: var(--text); }
.alert { margin-bottom: 18px; padding: 14px 16px; border-radius: 12px; background: #ddf7e8; }
.alert.error { background: #ffe5e4; color: #9e2626; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 980px; }
th, td { border-bottom: 1px solid var(--line); padding: 13px 10px; text-align: left; }
th { color: var(--muted); font-size: 13px; }
td { font-size: 14px; }
td input, th input { width: auto; }
code { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.status {
  display: inline-block; padding: 5px 9px; border-radius: 999px;
  background: #edf0f5; font-size: 12px; font-weight: 900;
}
.status.running { background: #dff7e9; color: #167b48; }
.status.stopped { background: #fff0d7; color: #995e00; }
.status.creating, .status.pending, .status.starting { background: #e1e7ff; color: #3e56ba; }
.delete-bar {
  display: flex; justify-content: flex-end; align-items: end; gap: 12px; margin-top: 18px;
}
.delete-bar label { width: 260px; }
.empty { text-align: center; color: var(--muted); padding: 40px; }
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}
.top-header form {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-box { color: var(--muted); font-size: 13px; }
.split {
  display: grid;
  grid-template-columns: minmax(0,1.4fr) minmax(360px,.8fr);
  gap: 20px;
  align-items: start;
}
.config-form, .script-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.58);
}
.script-panel { display: grid; gap: 14px; }
.sub-title {
  font-size: 18px;
  font-weight: 900;
  color: #17243d;
  margin-top: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(219,228,239,.9);
}
.deploy-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.toggle-line {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}
.toggle-line input { width: auto; }
.built-in-note {
  padding: 14px 16px;
  border-radius: 12px;
  background: #edf2ff;
  color: #40527d;
  font-size: 14px;
  line-height: 1.6;
}
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-shell {
  width: 100%;
  max-width: 460px;
  padding: 20px;
}
.login-card {
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(255,255,255,.95);
  box-shadow: 0 25px 70px rgba(55,83,120,.14);
  border-radius: 26px;
  padding: 34px;
}
.login-logo {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: white;
  font-size: 26px;
  margin-bottom: 18px;
}
.login-card h1 { margin: 6px 0 8px; }
.login-card p { color: var(--muted); margin: 0 0 22px; }
.login-form { display: grid; gap: 16px; }
.login-form button { margin-top: 4px; }

@media (max-width: 1200px) {
  .split { grid-template-columns: 1fr; }
  .quick-create { grid-template-columns: 1fr; }
  .quick-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  aside { display: none; }
  main { padding: 14px; }
  .grid, .quick-form { grid-template-columns: 1fr; }
  .delete-bar { align-items: stretch; flex-direction: column; }
  .delete-bar label { width: 100%; }
}
@media (max-width: 700px) {
  .top-header { flex-direction: column; }
  .top-header form { width: 100%; justify-content: space-between; }
}

/* V5 wizard additions */
.wizard-form {
  display: grid;
  gap: 18px;
}
.wizard-top {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.58);
  display: grid;
  gap: 16px;
}
.wizard-top h3 {
  margin: 4px 0 6px;
  font-size: 21px;
}
.wizard-top p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}
.grid.two {
  grid-template-columns: repeat(2,minmax(0,1fr));
}
.helper-box {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f3f7ff;
  color: #40527d;
  font-size: 14px;
  line-height: 1.65;
}
.action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.primary-strong {
  background: linear-gradient(135deg, #4867ff, #00a19a);
}
.sticky-actions {
  position: sticky;
  bottom: 12px;
  z-index: 2;
  padding: 12px;
  border: 1px solid rgba(219,228,239,.9);
  border-radius: 16px;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 28px rgba(55,83,120,.08);
}
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.script-split {
  margin-top: 20px;
  grid-template-columns: 1fr;
}
.full-width {
  width: 100%;
}
select {
  cursor: pointer;
}
select option {
  color: #17243d;
}
@media (max-width: 900px) {
  .grid.two { grid-template-columns: 1fr; }
  .action-row { justify-content: stretch; }
  .action-row button { width: 100%; }
  .sticky-actions { position: static; }
}
