:root {
  --bg: #f6efe5;
  --panel: #fffaf1;
  --ink: #191715;
  --muted: #6f645b;
  --line: #decfc0;
  --accent: #bd1f3a;
  --accent-dark: #87152a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--accent); text-decoration: none; }
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: #171714;
  color: #fff4dd;
}
.topbar span { margin-left: 12px; color: #d9c9b6; }
.container { max-width: 1180px; margin: 0 auto; padding: 28px; }
.page-title { margin-bottom: 20px; }
.page-title h1, .card h1, .card h2 { margin-top: 0; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(25, 23, 21, .08);
}
.narrow { max-width: 460px; margin: 48px auto; }
.grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
label { display: block; margin-bottom: 14px; color: var(--muted); font-weight: 700; }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
textarea { resize: vertical; }
button, .button {
  display: inline-block;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}
.button.secondary { background: #2c2925; }
.messages {
  background: #fff0c9;
  border: 1px solid #e5bc57;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 18px;
}
.messages p { margin: 6px 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; vertical-align: top; }
th { color: var(--muted); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions form { display: flex; gap: 8px; align-items: center; margin: 0; }
.actions input, .actions select { width: auto; min-width: 92px; margin: 0; }
.project-start-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}
.project-start-grid button { align-self: end; }

@media (max-width: 800px) {
  .grid.two { grid-template-columns: 1fr; }
  .container { padding: 16px; }
  .topbar { padding: 0 16px; }
}

.studio-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.studio-sidebar {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #121211;
  color: #fff4dd;
  border-radius: 8px;
  padding: 14px;
  border: 1px solid #2b2725;
}
.studio-logo {
  background: #f7efe3;
  border-radius: 4px;
  text-align: center;
  padding: 10px;
  margin-bottom: 10px;
}
.studio-logo img { max-width: 160px; max-height: 110px; }
.project-chip {
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  font-weight: 800;
  margin-bottom: 10px;
}
.progress-wrap {
  position: relative;
  height: 24px;
  background: #fffaf1;
  color: #191715;
  border-radius: 6px;
  overflow: hidden;
  text-align: center;
  margin-bottom: 10px;
}
.progress-bar { height: 100%; background: var(--accent); }
.progress-wrap span { position: absolute; inset: 3px 0 0; font-weight: 700; }
.studio-filters select,
.studio-filters input,
.studio-filters button {
  width: 100%;
  margin: 0 0 10px;
}
.section-tree h3 {
  margin: 18px 0 8px;
  color: #fff4dd;
  font-size: 15px;
}
.section-tree a {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #fff4dd;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 6px;
}
.section-tree a.active {
  background: var(--accent);
  color: #191715;
}
.section-tree small { opacity: .72; }
.studio-main { min-width: 0; }
.studio-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.studio-actions form { margin: 0; }
.studio-actions button,
.studio-actions .button {
  border-radius: 4px;
  padding: 14px 20px;
}
.studio-title h1 {
  margin: 0 0 8px;
  font-size: 34px;
}
.studio-title p { margin-top: 0; color: var(--muted); }
.question-card,
.studio-panel {
  background: #fffaf1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 6px 18px rgba(25, 23, 21, .06);
}
.question-tags { display: flex; gap: 8px; margin-bottom: 8px; }
.question-tags span {
  background: #f0d3c7;
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}
.question-card strong {
  display: block;
  color: var(--ink);
  font-size: 19px;
  margin-bottom: 4px;
}
.question-card small,
.question-card em {
  display: block;
  margin: 4px 0;
  color: var(--muted);
  font-weight: 400;
}
.question-card .prompts {
  white-space: normal;
  background: #fff3df;
  border: 1px solid #ead6bf;
  border-radius: 6px;
  padding: 10px;
  margin: 8px 0;
}
.question-card textarea { min-height: 170px; }
.question-state,
.studio-bottom-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.question-state .status-select {
  width: auto;
  min-width: 150px;
  margin: 0;
}
.important-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
}
.important-check input {
  width: auto;
  margin: 0;
}
.preview-row {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.export-preview {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.7;
}
.export-preview h1 { font-size: 36px; }
.export-preview h2 {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
@media (max-width: 980px) {
  .studio-shell { grid-template-columns: 1fr; }
  .studio-sidebar { position: static; max-height: none; }
  .project-start-grid { grid-template-columns: 1fr; }
}
