:root {
  color-scheme: light;
  --bg: #f6f8fc;
  --panel: #ffffff;
  --line: #d7dcef;
  --text: #172033;
  --muted: #5d6884;
  --primary: #3256ff;
  --primary-strong: #1937cb;
  --secondary: #eef2ff;
  --success: #177245;
  --warning: #a55a00;
  --danger: #b42318;
  --shadow: 0 14px 40px rgba(21, 39, 84, 0.08);
  font-family: Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f8faff 0%, #eef2ff 100%);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
a { color: inherit; }
.hidden { display: none !important; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid rgba(50, 86, 255, 0.08);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1, .login-panel h2, .sidebar-panel h2, .editor-panel h2 { margin: 0.2rem 0 0; }
.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-strong);
  font-weight: 700;
}
.page-shell {
  padding: 2rem;
}
.panel {
  background: var(--panel);
  border: 1px solid rgba(23, 32, 51, 0.08);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.login-panel {
  max-width: 640px;
  margin: 8vh auto;
  padding: 2rem;
  display: grid;
  gap: 1.5rem;
}
.login-form {
  display: grid;
  gap: 1rem;
}
.workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 1.5rem;
}
.sidebar-panel, .editor-panel {
  padding: 1.5rem;
}
.sidebar-head, .editor-head, .topbar-actions, .sidebar-actions, .editor-actions, .form-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}
.helper-text {
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}
.offer-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}
.offer-item {
  width: 100%;
  text-align: left;
  background: #f8faff;
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 0.95rem 1rem;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.offer-item:hover, .offer-item.is-active {
  border-color: rgba(50, 86, 255, 0.4);
  box-shadow: 0 10px 24px rgba(50, 86, 255, 0.12);
  transform: translateY(-1px);
}
.offer-item-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}
.offer-item-title { font-size: 0.95rem; }
.offer-item-status {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--primary-strong);
}
.offer-item-meta {
  margin: 0.45rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.45;
}
.editor-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  color: var(--muted);
  font-size: 0.86rem;
  margin: 1rem 0 1.25rem;
}
.editor-form { display: grid; gap: 1rem; }
.grid {
  display: grid;
  gap: 1rem;
}
.two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.four-cols { grid-template-columns: repeat(4, minmax(0, 1fr)); }
label, .fieldset {
  display: grid;
  gap: 0.4rem;
}
label > span, legend {
  font-size: 0.88rem;
  font-weight: 600;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.78rem 0.9rem;
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; }
.fieldset {
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
}
.checkbox-grid, .checkbox-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.checkbox-grid label, .checkbox-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #f8faff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 0.8rem;
}
.checkbox-grid input, .checkbox-row input { width: auto; margin: 0; }
.primary-btn, .secondary-btn, .ghost-link {
  border: none;
  border-radius: 999px;
  padding: 0.78rem 1.1rem;
  cursor: pointer;
  text-decoration: none;
}
.primary-btn {
  background: linear-gradient(135deg, var(--primary) 0%, #5b7cff 100%);
  color: #fff;
}
.secondary-btn {
  background: var(--secondary);
  color: var(--primary-strong);
}
.ghost-link {
  background: transparent;
  color: var(--muted);
  padding-left: 0;
  padding-right: 0;
}
.message {
  border-radius: 16px;
  padding: 0.85rem 1rem;
  font-size: 0.92rem;
}
.message.info { background: #eef4ff; color: var(--primary-strong); }
.message.success { background: #edf9f0; color: var(--success); }
.message.error { background: #fff1f1; color: var(--danger); }
.panels-grid {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.subpanel {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  background: #fafcff;
}
.subpanel h3 { margin-top: 0; }
.stack-list {
  display: grid;
  gap: 0.7rem;
}
.stack-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem 0.85rem;
  background: #fff;
}
.empty-copy { color: var(--muted); }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .two-cols, .three-cols, .four-cols, .panels-grid { grid-template-columns: 1fr; }
  .page-shell { padding: 1rem; }
  .topbar { padding: 1rem; }
}


.config-panel {
  margin-top: 1.25rem;
}

#config-json {
  min-height: 380px;
  font-family: ui-monospace, SFMono-Regular, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.55;
}
