:root {
  --ink: #16181d;
  --ink-soft: #4a4d55;
  --accent: #0f5c52;
  --accent-tint: rgba(15, 92, 82, 0.08);
  --page: #f4f5f7;
  --panel: #ffffff;
  --line: #e4e6ea;
  --line-soft: #eef0f3;
  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { font-family: var(--serif); font-weight: 600; font-size: 1.34rem; letter-spacing: 0.01em; color: var(--accent); }
.topbar .brand span { color: var(--ink-soft); font-family: var(--sans); font-weight: 400; font-size: 0.92rem; }
.topbar nav { display: flex; align-items: center; gap: 18px; font-size: 0.92rem; }
.topbar nav a { text-decoration: none; color: var(--ink-soft); }
.topbar nav a.active, .topbar nav a:hover { color: var(--ink); }
.topbar .who { color: var(--ink-soft); font-size: 0.86rem; }

.container { max-width: 940px; margin: 0 auto; padding: 32px 28px 64px; }
.narrow { max-width: 720px; }

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #0c4d44; border-color: #0c4d44; }
.btn.secondary { background: #fff; color: var(--accent); }
.btn.secondary:hover { background: var(--accent-tint); }
.btn:disabled { opacity: 0.5; cursor: default; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px 32px;
}
.muted { color: var(--ink-soft); }
.lead { font-size: 1.12rem; }

/* Journey: phase stepper + topic chips (replaces the old contradictory percent meter) */
.journey { margin: 18px 0 18px; }
.stepper { display: flex; flex-wrap: wrap; align-items: center; list-style: none; padding: 0; margin: 0 0 16px; gap: 4px; font-size: 0.85rem; }
.stepper li { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-soft); }
.stepper li:not(:last-child)::after { content: ""; width: 20px; height: 1px; background: var(--line); margin: 0 4px; }
.stepper .sdot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; }
.stepper li.active { color: var(--ink); font-weight: 600; }
.stepper li.active .sdot, .stepper li.done .sdot { border-color: var(--accent); background: var(--accent); }
.areas-head { font-size: 0.8rem; color: var(--ink-soft); margin-bottom: 8px; }
.areas { display: flex; flex-wrap: wrap; gap: 6px; }
.area { font-size: 0.8rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-soft); background: #fff; }
.area.thin { border-color: var(--accent); color: var(--accent); background: var(--accent-tint); }
.area.real { border-color: var(--accent); color: #fff; background: var(--accent); }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 14px; margin: 8px 0 20px; }
.msg { max-width: 76%; padding: 12px 16px; border-radius: 10px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.msg.user { align-self: flex-end; background: var(--accent-tint); }
.msg.skip { align-self: flex-end; background: none; border: 1px dashed var(--line); color: var(--ink-soft); font-size: 0.8rem; padding: 4px 12px; }
.composer { display: flex; gap: 10px; align-items: stretch; }
.composer textarea {
  flex: 1;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: vertical;
  min-height: 64px;
}
.composer-actions { display: flex; flex-direction: column; gap: 8px; }
.composer-actions .btn { text-align: center; }
.composer-hint { font-size: 0.82rem; margin: 8px 2px 0; }
.composer-hint kbd {
  font-family: var(--sans);
  font-size: 0.78rem;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink-soft);
}
.thinking { color: var(--ink-soft); font-size: 0.9rem; padding: 4px 2px; }

/* Login + admin forms */
.loginform { display: flex; flex-direction: column; gap: 14px; max-width: 360px; margin-top: 8px; }
.loginform label { display: flex; flex-direction: column; gap: 5px; font-size: 0.9rem; color: var(--ink-soft); }
.loginform input, .composer input[type=email] {
  font-family: var(--sans); font-size: 1rem; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.composer input[type=email] { flex: 1; }
.form-error { color: #8a3b14; font-size: 0.92rem; }
.form-alt { font-size: 0.9rem; color: var(--ink-soft); margin: 16px 0 0; }
.inline { display: inline; }
.toolbar .spacer { flex: 1; }

/* Split view (interview + draft preview) */
.split { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 28px; align-items: start; }
.split iframe { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.split-pane { min-width: 0; }
.preview { position: sticky; top: 16px; }
.preview-head { font-family: var(--serif); font-size: 0.95rem; color: var(--ink-soft); margin: 0 0 8px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } .preview { position: static; } }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; margin: 8px 0; }
thead th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-soft);
  background: #f2f4f6;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
.pill { display: inline-block; font-size: 0.78rem; padding: 2px 9px; border-radius: 999px; background: var(--accent-tint); color: var(--accent); }
.flag { color: #8a3b14; font-weight: 500; }

.frame { width: 100%; height: 80vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.exports { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
