:root {
  --oak: #6b4a2f;
  --ember: #d9682e;
  --ember-dark: #b8501f;
  --bg: #faf6f1;
  --card: #ffffff;
  --text: #2c211a;
  --muted: #7a6c5f;
  --border: #e4d9cc;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--ember-dark); }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--oak);
  color: #fff;
}
.topbar h1 { font-size: 1.15rem; margin: 0; }
.topbar a { color: #fff; text-decoration: none; margin-right: 0.5rem; }

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  width: 320px;
  text-align: center;
}
.login-card h1 { margin: 0; font-size: 1.3rem; color: var(--oak); }
.login-card .subtitle { color: var(--muted); margin-top: 0.2rem; }
.login-card form { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1.2rem; }
.login-card input { padding: 0.5rem; border: 1px solid var(--border); border-radius: 6px; }

button, .link-button {
  background: var(--ember);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}
button:hover { background: var(--ember-dark); }
button:disabled { background: #ccc; cursor: not-allowed; }
button.primary { background: var(--oak); }
button.primary:hover { background: #543a24; }
.link-button { background: transparent; color: #fff; text-decoration: underline; padding: 0; }

.inline-form { display: inline-flex; gap: 0.5rem; }

.new-episode { margin-bottom: 1.2rem; }
.new-episode input[type=text] {
  padding: 0.5rem; border: 1px solid var(--border); border-radius: 6px; width: 280px;
}

table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 8px; overflow: hidden; }
th, td { padding: 0.6rem 0.8rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f2e9dd; color: var(--oak); }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #fbeee0; }
.empty { text-align: center; color: var(--muted); }

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: #eee;
  color: #444;
}
.status-approved { background: #dcf3df; color: #256a34; }
.status-pending { background: #fdf1d6; color: #8a6412; }
.status-needs_regen { background: #fbe3d6; color: #a24a15; }
.status-rejected { background: #fbdcdc; color: #a32828; }
.stage-done { background: #dcf3df; color: #256a34; }

.status-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.muted { color: var(--muted); font-size: 0.9rem; }

.content-panel, .edit-panel, .history-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem;
  margin-bottom: 1.2rem;
}
.script-block { white-space: pre-wrap; font-family: inherit; }
.prompt-list li { margin-bottom: 0.5rem; }

.actions { display: flex; gap: 0.6rem; margin-bottom: 1.2rem; }

.edit-panel textarea {
  width: 100%; padding: 0.6rem; border: 1px solid var(--border); border-radius: 6px;
  font-family: monospace; margin-bottom: 0.6rem;
}

.history-table td, .history-table th { font-size: 0.85rem; }

.error { color: #a32828; }
.success { color: #256a34; font-weight: 600; }

code { background: #f2ece2; padding: 0.1rem 0.3rem; border-radius: 4px; font-size: 0.85rem; }
