:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-soft: #fafafa;
  --line: #e5e7eb;
  --line-soft: #eef0f3;
  --text: #111827;
  --muted: #667085;
  --muted-2: #98a2b3;
  --accent: #ff002f;
  --accent-strong: #e6002a;
  --accent-soft: rgba(255, 0, 47, 0.08);
  --green: #0f9f6e;
  --amber: #b7791f;
  --shadow: 0 16px 50px rgba(17, 24, 39, 0.08);
}

html.dark {
  --bg: #0f0f0f;
  --panel: #141414;
  --panel-soft: #1a1a1a;
  --line: rgba(255, 255, 255, 0.12);
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f9fafb;
  --muted: #a3a3a3;
  --muted-2: #737373;
  --accent-soft: rgba(255, 0, 47, 0.16);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 68px;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0;
}
.title h1 { margin: 0; font-size: 18px; line-height: 1.15; letter-spacing: 0; }
.title p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 650;
}
.btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.btn.primary { border-color: var(--accent); background: var(--accent); color: white; }
.btn.danger { color: #e11d48; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon { width: 16px; height: 16px; display: inline-grid; place-items: center; font-size: 14px; line-height: 1; }

.workspace {
  width: 100%;
  padding: 18px 24px 28px;
  display: grid;
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  gap: 16px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none;
  overflow: hidden;
}
.panel-head {
  min-height: 54px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-head h2 { margin: 0; font-size: 15px; letter-spacing: 0; }
.panel-head small { color: var(--muted); font-size: 12px; }
.panel-body { padding: 14px 16px; }
.stack { display: grid; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { color: var(--muted); font-size: 12px; font-weight: 650; }
.input, .textarea, .select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}
.textarea { min-height: 78px; resize: vertical; line-height: 1.45; }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.project-list { display: grid; gap: 8px; }
.project-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
  color: var(--text);
}
.project-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--panel); }
.project-card h3 { margin: 0 0 5px; font-size: 14px; letter-spacing: 0; }
.meta { color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.chip {
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}
.chip.live { color: var(--green); border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.chip.draft { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 35%, var(--line)); }

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.tab {
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.site-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}
.site-row + .site-row { margin-top: 8px; }
.site-row.active { border-color: var(--accent); background: var(--panel); }
.site-row h3 { margin: 0; font-size: 14px; }
.site-row p { margin: 3px 0 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel-soft);
}
.stat b { display: block; font-size: 18px; }
.stat span { color: var(--muted); font-size: 12px; }

.question {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow: hidden;
}
.question + .question { margin-top: 10px; }
.question-head {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.question-title { display: flex; gap: 8px; align-items: center; min-width: 0; }
.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.question-body { padding: 12px; display: grid; gap: 10px; }
.answers { display: grid; gap: 8px; }
.answer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: var(--panel-soft);
}
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: grid;
  gap: 8px;
}
.toast-item {
  max-width: 340px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  font-size: 13px;
}
.error { color: #e11d48; font-size: 13px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 36%); gap: 12px; }
.preview-frame {
  min-height: 480px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow: hidden;
}
.preview-frame iframe { width: 100%; height: 620px; border: 0; display: block; background: white; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; padding: 14px; }
  .topbar { padding: 12px 14px; align-items: flex-start; }
  .grid-2, .grid-3, .split { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
}

