:root {
  --bg:#0f1419; --card:#1a222c; --text:#e7ecf1; --muted:#9aa7b5; --line:#2a3542;
  --accent:#5b8def; --ok:#3d9a6a; --warn:#c4a035; --track:#243040;
}
* { box-sizing:border-box; }
body { margin:0; font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif; background:var(--bg); color:var(--text); line-height:1.45; }
main, .wrap { max-width:980px; margin:0 auto; padding:1.25rem 1.15rem 3rem; }
h1 { font-size:1.3rem; margin:0 0 .25rem; }
.sub { color:var(--muted); margin:0 0 1rem; font-size:.95rem; }
.progress-wrap { background:var(--track); border-radius:999px; height:12px; overflow:hidden; border:1px solid var(--line); }
.progress-bar { height:100%; background:linear-gradient(90deg,#2f6fed,#3d9a6a); width:0%; transition:width .25s ease; }
.progress-meta { display:flex; justify-content:space-between; gap:1rem; margin:.45rem 0 1.25rem; color:var(--muted); font-size:.88rem; }
.phase { background:var(--card); border:1px solid var(--line); border-radius:14px; padding:1rem 1.05rem; margin-bottom:1rem; }
.phase header { display:flex; justify-content:space-between; gap:1rem; align-items:baseline; margin-bottom:.65rem; flex-wrap:wrap; }
.phase h2 { font-size:1.05rem; margin:0; }
.phase .when { color:var(--muted); font-size:.85rem; }
.phase .pct { font-size:.85rem; color:#9fd4b5; font-weight:600; }
.step { display:grid; grid-template-columns:auto 1fr auto; gap:.75rem; align-items:start; padding:.65rem 0; border-top:1px solid var(--line); }
.step:first-of-type { border-top:0; }
.step input { width:1.15rem; height:1.15rem; margin-top:.2rem; accent-color:var(--ok); }
.step.done label { color:var(--muted); text-decoration:line-through; }
.step label { cursor:pointer; font-weight:500; }
.step .actions { display:flex; gap:.4rem; flex-wrap:wrap; }
.step a.btn {
  display:inline-block; padding:.3rem .55rem; border-radius:7px; font-size:.8rem; font-weight:600;
  background:#24344a; color:#d7e4f7; text-decoration:none; border:1px solid #334860;
}
.step a.btn:hover { border-color:var(--accent); color:#fff; }
.toolbar { display:flex; flex-wrap:wrap; gap:.5rem; margin:0 0 1.25rem; }
.toolbar button, .toolbar a.btn {
  background:#24344a; color:var(--text); border:1px solid var(--line); border-radius:8px;
  padding:.45rem .7rem; font-size:.85rem; font-weight:600; cursor:pointer; text-decoration:none;
}
.toolbar button.danger { background:#3a2428; border-color:#5a343a; }
.layout { display:grid; gap:1rem; grid-template-columns:1.35fr .9fr; }
@media (max-width:860px){ .layout { grid-template-columns:1fr; } }
.tree { background:var(--card); border:1px solid var(--line); border-radius:14px; padding:.9rem 1rem; font-size:.9rem; }
.tree h2 { font-size:1rem; margin:0 0 .6rem; }
.tree details { margin:.12rem 0; }
.tree summary { cursor:pointer; color:#c5d0db; }
.tree a { color:var(--accent); text-decoration:none; }
.tree a:hover { text-decoration:underline; }
.note { margin-top:1rem; color:var(--muted); font-size:.88rem; }
footer { margin-top:1.5rem; color:var(--muted); font-size:.8rem; }
code { font-family:ui-monospace,monospace; font-size:.85em; }

/* viewer */
.viewer-header { display:flex; gap:1rem; align-items:center; flex-wrap:wrap; padding:1rem 1.15rem; border-bottom:1px solid var(--line); }
.viewer-header a { color:var(--accent); text-decoration:none; }
#meta { color:var(--muted); font-size:.85rem; flex:1; min-width:140px; }
.markdown-body {
  max-width:860px; margin:0 auto; padding:1.25rem 1.15rem 3rem;
  font-size:1rem; line-height:1.6;
}
.markdown-body h1,.markdown-body h2,.markdown-body h3 { line-height:1.25; margin:1.2em 0 .5em; }
.markdown-body h1 { font-size:1.5rem; border-bottom:1px solid var(--line); padding-bottom:.35rem; }
.markdown-body h2 { font-size:1.25rem; }
.markdown-body h3 { font-size:1.05rem; }
.markdown-body p, .markdown-body ul, .markdown-body ol, .markdown-body table { margin:.7em 0; }
.markdown-body ul, .markdown-body ol { padding-left:1.3rem; }
.markdown-body code { background:#243040; padding:.1rem .35rem; border-radius:4px; font-size:.9em; }
.markdown-body pre { background:#1a222c; border:1px solid var(--line); border-radius:10px; padding:.9rem 1rem; overflow:auto; }
.markdown-body pre code { background:transparent; padding:0; }
.markdown-body blockquote { margin:1em 0; padding:.2rem .9rem; border-left:3px solid var(--accent); color:#c5d0db; }
.markdown-body table { border-collapse:collapse; width:100%; display:block; overflow-x:auto; }
.markdown-body th, .markdown-body td { border:1px solid var(--line); padding:.45rem .55rem; text-align:left; }
.markdown-body th { background:#243040; }
.markdown-body a { color:var(--accent); }
.markdown-body hr { border:0; border-top:1px solid var(--line); margin:1.5rem 0; }
.err { color:#f0a8a8; padding:1.25rem; }

/* editors */
.form-card { background:var(--card); border:1px solid var(--line); border-radius:14px; padding:1.1rem 1.15rem; margin-bottom:1rem; }
.form-card h2 { font-size:1.05rem; margin:0 0 .75rem; }
.field {
  display:flex; flex-direction:column; align-items:stretch; gap:.35rem;
  margin-bottom:1.1rem; width:100%;
}
.field label {
  display:block; float:none; width:100%; max-width:100%;
  font-size:.88rem; font-weight:600; color:#b8c4d1; letter-spacing:.01em;
  margin:0; padding:0; line-height:1.35;
}
.field input, .field textarea, .field select {
  display:block; float:none; width:100%; max-width:100%;
  box-sizing:border-box; appearance:none; -webkit-appearance:none;
  color-scheme:dark;
  background:#121820; color:#e7ecf1; caret-color:#e7ecf1;
  border:1px solid #3a4656; border-radius:10px;
  padding:.7rem .85rem; font:inherit; line-height:1.45;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
}
.field input::placeholder, .field textarea::placeholder { color:#7a8796; opacity:1; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline:none; border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(91,141,239,.22);
}
.field input:disabled, .field textarea:disabled, .field select:disabled {
  opacity:.72; cursor:not-allowed;
}
.field textarea { min-height:110px; resize:vertical; }
.field textarea.tall { min-height:180px; }
.field-grid {
  display:grid; grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:.85rem 1rem; margin-bottom:1.1rem; width:100%;
}
.field-grid > .field { margin-bottom:0; }
@media (max-width:800px){
  .field-grid { grid-template-columns:1fr; }
}
.preview {
  background:#121820; border:1px solid var(--line); border-radius:12px; padding:1rem;
  white-space:pre-wrap; font-family:ui-monospace,monospace; font-size:.82rem; max-height:340px; overflow:auto;
  color:var(--text); color-scheme:dark;
}
.form-actions { display:flex; flex-wrap:wrap; gap:.5rem; margin-top:1rem; }
.form-actions button, .form-actions a.btn {
  background:#2a4a72; color:#fff; border:0; border-radius:8px; padding:.55rem .85rem;
  font-weight:600; cursor:pointer; text-decoration:none; font-size:.9rem;
}
.form-actions button.secondary { background:#24344a; border:1px solid var(--line); color:var(--text); }
.banner { background:#1e3a5f; border:1px solid #3a5a8a; border-radius:10px; padding:.75rem .9rem; margin-bottom:1rem; font-size:.9rem; color:#d7e4f7; }

/* —— GRC-achtige editor —— */
.editor-shell { max-width:1200px; margin:0 auto; padding:1.15rem 1.25rem 3rem; }
.editor-top {
  display:flex; flex-wrap:wrap; gap:.75rem 1.25rem; align-items:center;
  margin-bottom:1.15rem; padding-bottom:.95rem; border-bottom:1px solid var(--line);
}
.editor-top h1 { font-size:1.2rem; margin:0; flex:1; min-width:200px; }
.save-pill {
  display:inline-flex; align-items:center; gap:.4rem; font-size:.8rem; font-weight:600;
  padding:.35rem .65rem; border-radius:999px; border:1px solid var(--line); color:var(--muted);
}
.save-pill.ok { color:#9fd4b5; border-color:#2f5a45; background:#15261e; }
.save-pill.saving { color:#e8d18a; border-color:#5a4a20; background:#261e10; }
.save-pill.final { color:#a8c6ff; border-color:#2a4570; background:#152030; }
.editor-layout { display:grid; grid-template-columns:230px minmax(0, 1fr); gap:1.15rem; align-items:start; }
.editor-nav {
  background:var(--card); border:1px solid var(--line); border-radius:12px; padding:.65rem;
  height:fit-content; position:sticky; top:.75rem;
  display:flex; flex-direction:column; gap:.2rem;
}
.editor-nav button {
  display:block; width:100%; text-align:left;
  background:#162029; color:#9aa7b5;
  border:1px solid #2a3542; border-radius:9px;
  padding:.55rem .7rem; cursor:pointer; font:inherit; font-size:.88rem; font-weight:600;
  box-shadow:none;
}
.editor-nav button:hover {
  background:#1e2c3a; color:var(--text); border-color:#3a4a5c;
}
.editor-nav button.active {
  background:#24344a; color:#fff; border-color:#5b8def;
  box-shadow:inset 3px 0 0 var(--accent);
}
.editor-nav .nav-done::before { content:"✓ "; color:var(--ok); }
.editor-main { display:flex; flex-direction:column; gap:1.1rem; min-width:0; }
.editor-section {
  background:var(--card); border:1px solid var(--line); border-radius:14px;
  padding:1.35rem 1.35rem 1.15rem;
}
.editor-section h2 {
  font-size:1.05rem; margin:0 0 1.1rem; font-weight:700; color:#dfe7ef;
  padding-bottom:.55rem; border-bottom:1px solid var(--line);
}
.editor-section.hidden { display:none; }
.editor-actions {
  display:flex; flex-wrap:wrap; gap:.5rem; position:sticky; bottom:0;
  background:color-mix(in srgb, var(--bg) 92%, transparent); padding:.75rem 0; backdrop-filter:blur(6px);
}
.editor-actions button, .editor-actions a {
  border-radius:8px; padding:.55rem .9rem; font-weight:650; font-size:.9rem; cursor:pointer;
  border:1px solid var(--line); text-decoration:none; color:var(--text); background:#24344a;
}
.editor-actions .primary { background:#2f6fed; border-color:#2f6fed; color:#fff; }
.editor-actions .success { background:#2f6a4a; border-color:#2f6a4a; color:#fff; }
.locked-banner {
  background:#152030; border:1px solid #2a4570; color:#a8c6ff; border-radius:10px;
  padding:.7rem .85rem; font-size:.9rem; margin-bottom:.5rem;
}

/* Narrow: horizontal scrollable section tabs above content */
@media (max-width:800px){
  .editor-layout {
    grid-template-columns:1fr;
    gap:.85rem;
  }
  .editor-nav {
    position:static; top:auto;
    flex-direction:row; flex-wrap:nowrap;
    overflow-x:auto; overflow-y:hidden;
    -webkit-overflow-scrolling:touch;
    gap:.4rem; padding:.55rem;
    scrollbar-width:thin;
  }
  .editor-nav button {
    width:auto; flex:0 0 auto; white-space:nowrap;
    margin:0;
  }
}

/* —— Wizard shell —— */
.wizard { max-width:720px; }
.wizard-phases { margin-top:1.25rem; }
.toolbar-slim { margin-top:.5rem; opacity:.9; }
.toolbar-slim button { font-size:.8rem; padding:.35rem .55rem; font-weight:500; }

.next-card {
  background:linear-gradient(145deg, #1a2a3e 0%, #152030 100%);
  border:1px solid #2f4a6e;
  border-radius:16px;
  padding:1.25rem 1.35rem 1.35rem;
  margin:0 0 1rem;
  box-shadow:0 8px 28px rgba(0,0,0,.25);
}
.next-card.done-all {
  border-color:#2f5a45;
  background:linear-gradient(145deg, #15261e 0%, #121820 100%);
}
.next-kicker {
  margin:0 0 .35rem; font-size:.75rem; font-weight:700;
  text-transform:uppercase; letter-spacing:.06em; color:#8eb4ef;
}
.next-card h2 { margin:0 0 .35rem; font-size:1.25rem; line-height:1.3; }
.next-phase { margin:0 0 1rem; color:var(--muted); font-size:.9rem; }
.next-actions { display:flex; flex-wrap:wrap; gap:.55rem; align-items:center; }
a.cta, button.cta {
  display:inline-flex; align-items:center; justify-content:center;
  background:#2f6fed; color:#fff; border:0; border-radius:10px;
  padding:.7rem 1.15rem; font-weight:700; font-size:1rem;
  text-decoration:none; cursor:pointer;
}
a.cta:hover, button.cta:hover { filter:brightness(1.08); }
button.cta-secondary, a.cta-secondary {
  display:inline-flex; align-items:center;
  background:#24344a; color:var(--text); border:1px solid var(--line);
  border-radius:10px; padding:.6rem .95rem; font-weight:600; font-size:.9rem;
  cursor:pointer; text-decoration:none;
}
a.cta-ghost {
  color:var(--muted); font-size:.88rem; font-weight:600; text-decoration:none;
  padding:.4rem .5rem;
}
a.cta-ghost:hover { color:var(--accent); }

/* —— Document editor (markdown-first) —— */
.doc-editor {
  max-width:1400px; margin:0 auto; padding:1rem 1.15rem 2.5rem;
  display:flex; flex-direction:column; gap:.85rem; min-height:100vh;
}
.doc-split {
  display:grid; grid-template-columns:1fr 1fr; gap:1rem;
  flex:1; min-height:0; align-items:stretch;
}
.doc-pane {
  display:flex; flex-direction:column; gap:.4rem; min-width:0; min-height:0;
}
.doc-pane-label {
  font-size:.75rem; font-weight:700; text-transform:uppercase;
  letter-spacing:.05em; color:var(--muted);
}
.doc-textarea {
  flex:1; width:100%; min-height:70vh;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:.9rem; line-height:1.55;
  background:#121820; color:#e7ecf1; caret-color:#e7ecf1;
  border:1px solid #3a4656; border-radius:12px;
  padding:1rem 1.1rem; resize:vertical;
  color-scheme:dark; tab-size:2;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
}
.doc-textarea:focus {
  outline:none; border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(91,141,239,.22);
}
.doc-textarea.is-locked {
  opacity:.78; cursor:not-allowed; background:#0e141b;
}
.doc-preview {
  flex:1; min-height:70vh; overflow:auto;
  background:var(--card); border:1px solid var(--line); border-radius:12px;
  padding:1.1rem 1.25rem 2rem;
  font-size:.95rem; line-height:1.55;
}
.doc-preview.markdown-body { max-width:none; margin:0; }
.editor-actions .btn-link {
  display:inline-flex; align-items:center;
  background:#2f6a4a; color:#fff; border-radius:8px;
  padding:.55rem .9rem; font-weight:650; font-size:.9rem;
  text-decoration:none; border:1px solid #2f6a4a;
}
@media (max-width:900px) {
  .doc-split { grid-template-columns:1fr; }
  .doc-textarea, .doc-preview { min-height:45vh; }
}
