/* Rewriter app styles. Builds on colors_and_type.css from the design system. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }

/* ============ Topbar ============ */
.suite-topbar {
  display: flex; align-items: center; gap: var(--s-4);
  padding: 14px 28px; border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky; top: 0; z-index: 5;
}
.suite-mark { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); }
.suite-mark-glyph {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px;
  border: 1px solid var(--ink); border-radius: 2px;
  font-size: 14px; letter-spacing: 0.02em;
}
.suite-mark-name { font-size: 14px; letter-spacing: 0.04em; }
.suite-nav { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-muted); }
.suite-nav-item.is-current { color: var(--ink); font-weight: 500; }
.suite-nav-item.is-past, .suite-nav-item.is-future { color: var(--ink-faint); }
.suite-nav-sep { color: var(--ink-faint); }
.topbar-spacer { flex: 1; }
.back-link {
  background: none; border: 0; color: var(--ink-muted);
  font-size: 13px; padding: 4px 8px; border-radius: 3px;
  display: inline-flex; align-items: center; gap: 6px;
}
.back-link:hover { color: var(--ink); }

.gear { font-size: 16px; }

/* ============ Stepper ============ */
.stepper {
  display: flex; align-items: center; gap: 18px; flex: 1; justify-content: center;
  list-style: none; margin: 0; padding: 0;
}
.stepper-stop { display: flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; }
.stepper-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: transparent; border: 1px solid var(--ink-faint);
}
.stepper-stop.is-current { color: var(--ink); }
.stepper-stop.is-current .stepper-dot { background: var(--ink); border-color: var(--ink); }
.stepper-stop.is-past { color: var(--ink-muted); }
.stepper-stop.is-past .stepper-dot { background: var(--ink-muted); border-color: var(--ink-muted); }

/* ============ Buttons & inputs ============ */
.btn-primary {
  background: var(--ink); color: var(--paper);
  border: 0; padding: 10px 18px; border-radius: 3px;
  font-size: 14px; letter-spacing: 0.01em;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary:hover { background: #1a1a1a; }
.btn-primary[disabled], .btn-primary.is-disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary.large { padding: 14px 26px; font-size: 15px; }
.btn-primary.full { width: 100%; justify-content: center; }
.btn-ghost {
  background: transparent; border: 1px solid transparent; color: var(--ink-muted);
  padding: 8px 14px; border-radius: 3px; font-size: 13px;
}
.btn-ghost:hover { color: var(--ink); border-color: var(--rule); }
.btn-ghost.small { padding: 6px 10px; font-size: 12px; }
.btn-ghost.icon { padding: 4px 10px; font-size: 18px; line-height: 1; }
.btn-link {
  background: none; border: 0; color: var(--ink-muted); padding: 0; font-size: 13px;
  display: inline-flex; align-items: center; gap: 4px;
}
.btn-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.dialog-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 3px;
  background: var(--paper); color: var(--ink); font-family: inherit; font-size: 14px;
}
.dialog-input:focus { outline: none; border-color: var(--ink); }
.dialog-textarea { resize: vertical; min-height: 160px; font-family: var(--font-body); line-height: 1.55; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }
.field-label.small { font-size: 10px; }

.muted { color: var(--ink-muted); }
.small { font-size: 12px; }
.italic { font-style: italic; }
.center { text-align: center; }
.eyebrow { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 8px; }
.eyebrow.small { font-size: 10px; letter-spacing: 0.12em; }

/* ============ Landing ============ */
.landing-view { min-height: 100vh; }
.landing-main { max-width: 760px; margin: 0 auto; padding: 80px 32px 120px; }
.landing-hero { margin-bottom: 88px; }
.landing-title { font-family: var(--font-display); font-size: 56px; line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 18px; font-weight: 400; }
.landing-sub { font-size: 17px; line-height: 1.6; color: var(--ink-muted); max-width: 56ch; margin: 0 0 32px; }
.landing-cta-row { display: flex; align-items: center; gap: 18px; }

.paste-card {
  border: 1px solid var(--rule); border-radius: 4px; padding: 22px;
  background: var(--paper); margin-top: 12px;
}
.paste-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.dialog-actions { display: flex; gap: 8px; }

.landing-recents .recents-list { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-direction: column; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 3px; }
.recent-item { background: var(--paper); padding: 18px 20px; cursor: pointer; position: relative; }
.recent-item:hover { background: var(--paper-tinted); }
.recent-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.recent-title { font-family: var(--font-display); font-size: 22px; margin: 0; font-weight: 400; }
.recent-meta { display: flex; align-items: center; gap: 10px; }
.recent-excerpt { font-size: 13px; line-height: 1.55; margin: 6px 0 12px; max-width: 78ch; }
.recent-foot { display: flex; align-items: center; gap: 14px; }
.recent-progress { display: inline-block; width: 100px; height: 2px; background: var(--rule); border-radius: 2px; overflow: hidden; }
.recent-progress-fill { display: block; height: 100%; background: var(--ink); }
.recent-remove { margin-left: auto; background: none; border: 0; color: var(--ink-faint); font-size: 18px; line-height: 1; padding: 2px 8px; border-radius: 2px; }
.recent-remove:hover { color: var(--ink); background: var(--rule); }

/* ============ Reading column (vision, outline, export) ============ */
.reading-main { padding: 64px 32px 120px; }
.reading-column { max-width: 680px; margin: 0 auto; }
.reading-column.wider { max-width: 820px; }
.reading-head { margin-bottom: 36px; }
.reading-title { font-family: var(--font-display); font-size: 44px; line-height: 1.1; letter-spacing: -0.015em; margin: 0 0 10px; font-weight: 400; }
.reading-byline { font-size: 14px; }
.reading-foot { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--rule); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reading-actions-left { display: flex; gap: 18px; }

/* Vision */
.vision-status { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.vision-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 0.35; } 50% { opacity: 1; } }
.vision-body .vision-para { font-family: var(--font-display); font-size: 19px; line-height: 1.65; margin: 0 0 22px; color: var(--ink); text-wrap: pretty; }
.vision-edit { width: 100%; min-height: 60vh; padding: 16px; border: 1px solid var(--rule); border-radius: 3px; font-family: var(--font-display); font-size: 19px; line-height: 1.65; color: var(--ink); background: var(--paper); resize: vertical; }
.caret { display: inline-block; width: 2px; height: 1em; background: var(--ink); margin-left: 2px; vertical-align: -2px; animation: caret 0.8s steps(2, end) infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* Voice-source picker (shown before the first vision read) */
.voice-picker { padding: 0 0 24px; }
.voice-picker-title { font-family: var(--font-display); font-size: 28px; margin: 0 0 8px; font-weight: 400; line-height: 1.2; }
.voice-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.voice-option { display: grid; grid-template-columns: 18px 1fr; gap: 14px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: 3px; cursor: pointer; align-items: start; }
.voice-option:hover { background: var(--paper-tinted); }
.voice-option.is-on { border-color: var(--ink); background: var(--paper-tinted); }
.voice-option input { margin-top: 4px; accent-color: var(--ink); }
.voice-option-body { display: flex; flex-direction: column; gap: 4px; }
.voice-option-label { font-size: 15px; color: var(--ink); }
.voice-option-sub { line-height: 1.5; }
.voice-inputs { padding: 4px 0 0; border-top: 1px solid var(--rule); margin-top: 4px; padding-top: 18px; }
.voice-blend-slider { width: 100%; accent-color: var(--ink); }
.voice-actions { display: flex; justify-content: flex-end; }

/* Ripple (continuity notes from elsewhere in the manuscript) */
.ripple-pip { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); opacity: 0.55; margin-left: -4px; margin-right: 4px; }
.ripple-panel { margin: 0 36px 18px; padding: 14px 18px; background: var(--paper-tinted); border: 1px solid var(--rule); border-radius: 3px; }
.ripple-panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.ripple-notes { display: flex; flex-direction: column; gap: 12px; }
.ripple-note { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
.ripple-note:last-child { border-bottom: 0; padding-bottom: 0; }
.ripple-note-meta { display: flex; align-items: center; gap: 10px; }
.ripple-note-text { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink); }
.ripple-sev { font-size: 10px; letter-spacing: 0.1em; padding: 2px 6px; border-radius: 2px; font-weight: 500; }
.ripple-sev-P1 { background: var(--ink); color: var(--paper); }
.ripple-sev-P2 { background: var(--rule); color: var(--ink); }
.ripple-sev-P3 { background: var(--paper); color: var(--ink-muted); border: 1px solid var(--rule); }

/* Voice notes: writer-curated voice signals (More / Less like this).
   Threads into tactician + artisan + supervisor prompts the same way
   the holds panel does. */
.voice-notes-panel { margin: 0 36px 18px; padding: 12px 18px; border: 1px solid var(--rule); border-radius: 3px; }
.voice-notes-panel.is-empty { padding: 10px 18px; }
.voice-notes-panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.voice-notes-panel.is-empty .voice-notes-panel-head { margin-bottom: 0; }
.voice-notes-list { display: flex; flex-direction: column; gap: 8px; }
.voice-note-row { display: grid; grid-template-columns: 56px 1fr 32px; gap: 10px; align-items: start; padding: 8px 0; border-top: 1px solid var(--rule); }
.voice-note-row:first-child { border-top: 0; padding-top: 0; }
.voice-note-tag { font-size: 10px; letter-spacing: 0.1em; padding: 2px 6px; border-radius: 2px; text-transform: uppercase; text-align: center; align-self: start; margin-top: 4px; }
.voice-note-tag-voice { background: var(--ink); color: var(--paper); }
.voice-note-tag-avoid { background: var(--paper); color: var(--ink); border: 1px solid var(--rule); }
.voice-note-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.voice-note-excerpt { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink); }
.voice-note-input { padding: 6px 10px; font-size: 12px; }
.voice-note-input:placeholder-shown { color: var(--ink-muted); }
.voice-note-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.voice-note-remove { padding: 2px 8px; font-size: 16px; line-height: 1; }

/* Selection toolbar: floating two-button pill that appears when the writer
   selects text in either prose pane. Position is set by JS via top/left. */
.selection-toolbar {
  position: fixed;
  z-index: 60;
  display: inline-flex;
  align-items: stretch;
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  font-size: 12px;
  user-select: none;
  animation: selectionToolbarIn 0.12s ease-out;
}
.selection-toolbar[hidden] { display: none; }
.selection-toolbar-btn {
  background: transparent;
  color: inherit;
  border: 0;
  padding: 8px 14px;
  font-size: inherit;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.02em;
}
.selection-toolbar-btn:hover { background: rgba(255,255,255,0.08); }
.selection-toolbar-btn:first-child { border-top-left-radius: 4px; border-bottom-left-radius: 4px; }
.selection-toolbar-btn:last-child { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }
.selection-toolbar-divider { width: 1px; background: rgba(255,255,255,0.14); }
@keyframes selectionToolbarIn { from { transform: translateY(2px); opacity: 0; } }

/* "Hold to" panel: per-manuscript character facts the rewrite must respect */
.holds-panel { margin: 0 36px 18px; padding: 12px 18px; border: 1px solid var(--rule); border-radius: 3px; }
.holds-panel.is-empty { padding: 10px 18px; }
.holds-panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.holds-panel.is-empty .holds-panel-head { margin-bottom: 0; }
.holds-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.hold-row { display: grid; grid-template-columns: 160px 1fr 32px; gap: 8px; align-items: center; }
.hold-row .dialog-input { padding: 6px 10px; font-size: 13px; }
.hold-character { font-weight: 500; }
.hold-remove { padding: 2px 8px; font-size: 16px; line-height: 1; }
.holds-add { align-self: flex-start; }

/* Outline */
.outline-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1px; background: var(--rule); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.outline-item { display: grid; grid-template-columns: 90px 1fr; gap: 22px; padding: 22px 4px; background: var(--paper); }
.outline-item.is-streaming { background: var(--paper-tinted); }
.outline-num { font-family: var(--font-display); font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); padding-top: 4px; }
.outline-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.outline-title { font-family: var(--font-display); font-size: 22px; margin: 0 0 8px; font-weight: 400; }
.outline-remove { background: none; border: 0; color: var(--ink-faint); font-size: 18px; line-height: 1; padding: 2px 8px; border-radius: 2px; cursor: pointer; opacity: 0; transition: opacity 0.12s ease; }
.outline-item:hover .outline-remove { opacity: 1; }
.outline-remove:hover { color: var(--ink); background: var(--rule); }
.outline-remove:focus-visible { opacity: 1; outline: 1px solid var(--rule); outline-offset: 1px; }
.outline-intent { font-size: 15px; line-height: 1.6; color: var(--ink); margin: 0; cursor: text; min-height: 1.6em; text-wrap: pretty; }
.outline-intent:hover { color: var(--ink); }
.outline-edit { width: 100%; padding: 10px 12px; border: 1px solid var(--ink); border-radius: 3px; font-family: inherit; font-size: 15px; line-height: 1.5; resize: vertical; }

/* Sticky foot for the outline view: keeps Back-to-vision and Begin reachable
   from any scroll position when the intent list runs long. */
.reading-foot-sticky {
  position: sticky;
  bottom: 0;
  background: var(--paper);
  margin-top: 24px;
  padding: 16px 0;
  z-index: 5;
  /* Soft fade so the sticky foot doesn't look pasted over content. */
  box-shadow: 0 -8px 16px -8px rgba(0,0,0,0.08);
}

/* ============ Rewrite shell ============ */
.rewrite-view { min-height: 100vh; display: flex; flex-direction: column; }
.rewrite-shell { flex: 1; display: grid; grid-template-columns: 280px 1fr; min-height: 0; }

/* Chapter rail */
.chapter-rail { border-right: 1px solid var(--rule); display: flex; flex-direction: column; padding: 22px 18px; background: var(--paper); }
.rail-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.rail-list { list-style: none; padding: 0; margin: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.rail-item {
  width: 100%; display: grid; grid-template-columns: 14px 50px 1fr; gap: 10px;
  align-items: center;
  padding: 10px 10px; background: transparent; border: 0; border-radius: 3px;
  text-align: left; color: var(--ink-muted); font-size: 13px; line-height: 1.35;
}
.rail-item:hover { background: var(--paper-tinted); color: var(--ink); }
.rail-item.is-active { background: var(--ink); color: var(--paper); }
.rail-item.is-active .rail-num { color: var(--paper); opacity: 0.7; }
.rail-num { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.rail-title { font-family: var(--font-display); font-size: 14px; }
.rail-foot { padding-top: 14px; border-top: 1px solid var(--rule); margin-top: 14px; }

.status-pip { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.pip-untouched { background: transparent; border: 1px solid var(--ink-faint); }
.pip-streaming { background: var(--ink); animation: pulse 1.4s ease-in-out infinite; }
.pip-review { background: transparent; border: 1px solid var(--ink); position: relative; }
.pip-review::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: var(--ink); }
.pip-kept { background: var(--ink); }
.rail-item.is-active .pip-untouched { border-color: rgba(255,255,255,0.4); }
.rail-item.is-active .pip-kept, .rail-item.is-active .pip-streaming { background: var(--paper); }
.rail-item.is-active .pip-review { border-color: var(--paper); }
.rail-item.is-active .pip-review::after { background: var(--paper); }

/* Rewrite main */
.rewrite-main { display: flex; flex-direction: column; min-width: 0; }
.chapter-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 28px 36px 14px; border-bottom: 1px solid var(--rule); }
.chapter-title { font-family: var(--font-display); font-size: 30px; margin: 0; font-weight: 400; line-height: 1.15; }
.toggle-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-muted); cursor: pointer; }
.toggle-inline input { accent-color: var(--ink); }
.toggle-inline.compact { font-size: 12px; }

/* Rewrite surface (panes) */
.rewrite-surface { flex: 1; display: grid; min-height: 0; padding: 0; overflow: hidden; }
.rewrite-surface.layout-two-col { grid-template-columns: 1fr 1fr; }
.rewrite-pane { padding: 26px 36px 40px; overflow-y: auto; min-width: 0; min-height: 0; }
.rewrite-pane.original-pane { border-right: 1px solid var(--rule); background: var(--paper-tinted); }
.rewrite-pane.rewrite-pane-right { background: var(--paper); }
.pane-label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 18px; }
.pane-label-stream { display: inline-flex; align-items: center; gap: 8px; }

.prose .prose-para {
  display: grid; grid-template-columns: 36px 1fr; gap: 10px;
  font-family: var(--font-display); font-size: 17px; line-height: 1.7;
  margin: 0 0 18px; color: var(--ink); text-wrap: pretty;
}
.density-compact .prose .prose-para { font-size: 15px; line-height: 1.6; margin-bottom: 14px; }
.line-num { font-family: var(--font-mono, ui-monospace, monospace); font-size: 11px; color: var(--ink-faint); padding-top: 6px; user-select: none; }
.prose-text { display: block; }
.prose-empty { font-size: 14px; color: var(--ink-muted); }
.prose-para.is-current .prose-text { color: var(--ink); }
.prose-para.is-pending .prose-text { color: var(--ink-faint); }
.prose-para.is-pending .prose-text::before { content: "·  ·  ·"; letter-spacing: 0.4em; color: var(--ink-faint); }

/* Chapter actions */
/* Chapter actions row: lightly attached to the bottom of the rewrite main.
   Translucent paper + soft fade shadow so the prose underneath stays
   visible through it rather than getting capped by a hard rule. The
   sticky positioning kicks in if the rewrite main ever overflows; in
   the normal case the row sits at the bottom and the visual treatment
   is what makes it feel "floating, lightly attached" instead of solid. */
.chapter-actions {
  padding: 16px 36px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 -10px 18px -10px rgba(0,0,0,0.10);
}
.chapter-actions .grow { flex: 1; }
.kept-mark { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; }
.kept-tick { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 11px; }

/* ============ Export ============ */
.export-card { border: 1px solid var(--rule); border-radius: 3px; padding: 4px 22px; }
.export-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--rule); }
.export-row:last-child { border-bottom: 0; }
.export-label { font-size: 13px; color: var(--ink-muted); }
.seg { display: inline-flex; gap: 1px; background: var(--rule); border-radius: 3px; padding: 1px; }
.seg-btn { background: var(--paper); border: 0; padding: 7px 14px; font-size: 13px; color: var(--ink-muted); border-radius: 2px; }
.seg-btn.is-on { background: var(--ink); color: var(--paper); }
.seg.compact .seg-btn { padding: 5px 10px; font-size: 12px; }

/* ============ Settings ============ */
.dialog-scrim { position: fixed; inset: 0; background: rgba(20, 18, 14, 0.32); z-index: 50; display: grid; place-items: center; }
.dialog { background: var(--paper); border-radius: 4px; max-width: 560px; width: calc(100vw - 32px); max-height: 86vh; overflow: auto; box-shadow: 0 22px 48px rgba(0,0,0,0.16); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--rule); }
.dialog-title { font-family: var(--font-display); font-size: 20px; margin: 0; font-weight: 400; }
.dialog-body { padding: 20px 24px 24px; }
.settings-section { margin-bottom: 26px; }
.settings-section-head { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 12px; }
.provider-fields { margin-top: 16px; }

/* ============ Tweaks panel ============ */
.tweaks-panel {
  position: fixed; bottom: 18px; right: 18px; z-index: 30;
  width: 260px;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  box-shadow: 0 14px 36px rgba(0,0,0,0.12);
}
.tweaks-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--rule); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); }
.tweaks-body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.tweak { display: flex; flex-direction: column; gap: 6px; }
.tweak-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 3px;
  font-size: 13px; z-index: 100; box-shadow: 0 8px 22px rgba(0,0,0,0.18);
  animation: toastIn 0.18s ease-out;
}
@keyframes toastIn { from { transform: translate(-50%, 8px); opacity: 0; } }

/* small screens */
@media (max-width: 900px) {
  .rewrite-shell { grid-template-columns: 1fr; }
  .chapter-rail { border-right: 0; border-bottom: 1px solid var(--rule); }
  .rewrite-surface.layout-two-col { grid-template-columns: 1fr; }
  .rewrite-pane.original-pane { border-right: 0; border-bottom: 1px solid var(--rule); }
}

/* Kept-original (Phase 9). Pip variant for chapters the engine judged were
   already at voice; rendered as a hollow ring instead of a filled dot to
   distinguish from a normal kept chapter. The kept-original banner sits
   above the rewrite pane prose to name what happened. */
.status-pip.pip-kept.pip-kept-original {
  background: transparent;
  border: 1.5px solid var(--mark-continuity);
}
.kept-original-banner {
  margin: 0 0 18px;
  padding: 8px 12px;
  border-left: 2px solid var(--mark-continuity);
  background: color-mix(in oklch, var(--mark-continuity) 5%, transparent);
  border-radius: 0 3px 3px 0;
}
.rail-tag {
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--ink-muted);
}

/* Diff view (Phase 7). Shown in the rewrite pane when the writer toggles
   "Show what changed" on a kept chapter. Reuses the suite's mark tokens
   so additions and removals match the colour language the reader app uses
   for continuity and repetition. The diff layout drops the line-number
   column since paragraph alignment is preserved by structure. */
.prose-diff .prose-para { grid-template-columns: 1fr; }
.prose-diff .prose-para.is-diff-added {
  background: color-mix(in oklch, var(--mark-continuity) 14%, transparent);
  padding: 4px 8px; border-radius: 3px;
}
.prose-diff .prose-para.is-diff-removed {
  color: var(--ink-faint); text-decoration: line-through;
  text-decoration-color: var(--mark-repetition);
}
.diff-added {
  background: color-mix(in oklch, var(--mark-continuity) 22%, transparent);
  padding: 0 2px; border-radius: 2px;
}
.diff-removed {
  color: var(--ink-faint);
  text-decoration: line-through;
  text-decoration-color: var(--mark-repetition);
  text-decoration-thickness: 1.5px;
}


/* ============================================================
   Kaizen Suite cross-app navigation strip (canonical, v2).
   Mirrors suite/components.jsx ProductMark + suite/colors_and_type.css
   accent system. K is rendered in the product accent; the trailing
   lowercase letter(s) sit in default ink. Same palette across all sites.
   ============================================================ */
.kw-suite-strip {
  margin: 0;
  padding: 8px 24px;
  background: #ede6d9;
  border-bottom: 1px solid rgba(44, 42, 38, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6e6355;
  position: relative;
  z-index: 100;
}
.kw-suite-strip a, .kw-suite-strip .kw-tool {
  color: inherit;
  text-decoration: none;
  transition: color 160ms ease;
}
.kw-suite-strip a:hover, .kw-suite-strip a:focus-visible,
.kw-suite-strip .kw-tool:not(.is-current):hover { color: #2c2a26; }
.kw-suite-home { display: inline-flex; align-items: center; gap: 10px; }
.kw-suite-glyph {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 19px; font-weight: 500; letter-spacing: -0.04em;
  color: #4e473f; line-height: 1; text-transform: none;
}
.kw-suite-text strong { font-weight: 600; color: #4e473f; }
.kw-suite-arrow {
  margin-left: 2px; opacity: 0.5;
  transition: transform 160ms ease, opacity 160ms ease;
}
.kw-suite-home:hover .kw-suite-arrow { transform: translateX(-2px); opacity: 1; }
.kw-suite-sibs { display: inline-flex; align-items: center; gap: 16px; font-size: 10.5px; letter-spacing: 0.12em; }
.kw-tool { display: inline-flex; align-items: baseline; gap: 6px; }
.kw-tool-glyph {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 17px; font-weight: 500; letter-spacing: -0.04em;
  line-height: 1; color: #4e473f; text-transform: none;
}
.kw-tool-glyph .kw-acc { color: var(--kw-tool-accent, #4e473f); }
.kw-is-kw  { --kw-tool-accent: #566a8e; }
.kw-is-kr  { --kw-tool-accent: #7a5290; }
.kw-is-krw { --kw-tool-accent: #b04040; }
.kw-tool.is-current { cursor: default; }
.kw-tool.is-current .kw-tool-name { color: #2c2a26; font-weight: 500; }
.kw-tool.is-current .kw-tool-glyph { color: #2c2a26; }
@media (max-width: 720px) {
  .kw-suite-strip { padding: 7px 16px; font-size: 10px; }
  .kw-tool-name { display: none; }
  .kw-suite-text { display: none; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not(.theme-light) .kw-suite-strip {
    background: #221d1a; border-bottom-color: rgba(245, 242, 236, 0.08); color: #b0a595;
  }
  :root:not([data-theme="light"]):not(.theme-light) .kw-suite-strip a:hover,
  :root:not([data-theme="light"]):not(.theme-light) .kw-suite-strip strong,
  :root:not([data-theme="light"]):not(.theme-light) .kw-tool.is-current .kw-tool-name,
  :root:not([data-theme="light"]):not(.theme-light) .kw-tool.is-current .kw-tool-glyph,
  :root:not([data-theme="light"]):not(.theme-light) .kw-suite-glyph,
  :root:not([data-theme="light"]):not(.theme-light) .kw-tool-glyph { color: #f5f2ec; }
  :root:not([data-theme="light"]):not(.theme-light) .kw-is-kw  { --kw-tool-accent: #b0caf0; }
  :root:not([data-theme="light"]):not(.theme-light) .kw-is-kr  { --kw-tool-accent: #d2ace8; }
  :root:not([data-theme="light"]):not(.theme-light) .kw-is-krw { --kw-tool-accent: #d06050; }
}
[data-theme="dark"] .kw-suite-strip, .theme-dark .kw-suite-strip {
  background: #221d1a; border-bottom-color: rgba(245, 242, 236, 0.08); color: #b0a595;
}
[data-theme="dark"] .kw-suite-strip a:hover, .theme-dark .kw-suite-strip a:hover,
[data-theme="dark"] .kw-suite-strip strong, .theme-dark .kw-suite-strip strong,
[data-theme="dark"] .kw-tool.is-current .kw-tool-name, .theme-dark .kw-tool.is-current .kw-tool-name,
[data-theme="dark"] .kw-tool.is-current .kw-tool-glyph, .theme-dark .kw-tool.is-current .kw-tool-glyph,
[data-theme="dark"] .kw-suite-glyph, .theme-dark .kw-suite-glyph,
[data-theme="dark"] .kw-tool-glyph, .theme-dark .kw-tool-glyph { color: #f5f2ec; }
[data-theme="dark"] .kw-is-kw, .theme-dark .kw-is-kw   { --kw-tool-accent: #b0caf0; }
[data-theme="dark"] .kw-is-kr, .theme-dark .kw-is-kr   { --kw-tool-accent: #d2ace8; }
[data-theme="dark"] .kw-is-krw, .theme-dark .kw-is-krw { --kw-tool-accent: #d06050; }



/* ==========================================================================
   REDESIGN COMPONENT CSS
   Ported from kaizen-rewriter-redesign/src/redesign/{screens,components}/*.css.
   These rules use the .krw-* and per-screen prefixes from the redesign and
   reference tokens already declared in colors_and_type.css. Net-new selectors;
   no overlap with existing styles above.
   ========================================================================== */

/* Landing ,  two columns. Desk on the left, recents on the right. */

.krw-landing {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: var(--s-9);
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s-9) var(--s-7) var(--s-10);
}

@media (max-width: 960px) {
  .krw-landing {
    grid-template-columns: 1fr;
    gap: var(--s-8);
  }
}

.krw-landing__col--left {
  display: flex;
  flex-direction: column;
  gap: var(--s-7);
}

.krw-landing__head h1 {
  font-size: var(--tx-display);
  font-weight: 300;
  margin: var(--s-3) 0 var(--s-5);
}

.krw-landing__lede {
  font-size: 1.1rem;
  color: var(--ink-soft);
  max-width: 56ch;
}

/* ============ Desk ============ */

.krw-desk {
  position: relative;
  border: var(--border-soft);
  border-radius: var(--radius-md);
  padding: var(--s-8) var(--s-7);
  background: var(--paper-warm);
  min-height: 360px;
  cursor: copy;
  transition: border-color 200ms var(--ease), background 200ms var(--ease),
    box-shadow 250ms var(--ease);
  overflow: hidden;
}

.krw-desk:hover,
.krw-desk--hover {
  background: var(--paper-deep);
  border-color: var(--ink-faint);
  box-shadow: var(--shadow-md);
}

.krw-desk--placed {
  cursor: default;
  background: var(--paper-warm);
  border-color: var(--ink-faint);
  box-shadow: var(--shadow-lg);
}

.krw-desk__lamp {
  position: absolute;
  top: -120px;
  right: -120px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 230, 170, 0.45),
    rgba(255, 230, 170, 0) 60%
  );
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] .krw-desk__lamp {
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 200, 120, 0.18),
    rgba(255, 200, 120, 0) 60%
  );
}

.krw-desk__woodgrain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.18;
  background-image: repeating-linear-gradient(
    8deg,
    rgba(120, 80, 40, 0.05) 0,
    rgba(120, 80, 40, 0.05) 1px,
    transparent 1px,
    transparent 12px
  );
}

.krw-desk__placeholder,
.krw-desk__placed {
  position: relative;
  z-index: 1;
}

.krw-desk__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 280px;
  gap: var(--s-3);
}

.krw-desk__cta {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--ink);
  margin: 0;
}

.krw-desk__hint {
  font-family: var(--font-ui);
  font-size: var(--tx-ui-sm);
  color: var(--ink-muted);
  margin: 0;
}

.krw-desk__placed {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.krw-desk__title {
  font-family: var(--font-hand);
  font-size: 2rem;
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--ink-faint);
  color: var(--ink);
  padding: 4px 2px;
  outline: none;
  width: 100%;
}
.krw-desk__title:focus {
  border-bottom-color: var(--red-pen);
}

.krw-desk__detect {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--ink-muted);
  margin: 0;
}

.krw-desk__preview {
  width: 100%;
  background: rgb(var(--hi-rgb) / 0.6);
  border: var(--border-soft);
  border-radius: var(--radius-sm);
  padding: var(--s-3) var(--s-4);
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: var(--lh-body);
  color: var(--ink);
  resize: vertical;
  min-height: 180px;
}
.krw-desk__preview:focus {
  outline: none;
  border-color: var(--ink-faint);
}

.krw-desk__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
}

.krw-desk__stats {
  font-family: var(--font-ui);
  font-size: var(--tx-ui-sm);
}

.krw-desk__actions {
  display: flex;
  gap: var(--s-2);
}

/* ============ Primary CTA ============ */

.krw-primary-btn {
  background: var(--ink);
  color: var(--paper);
  border: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 200ms var(--ease);
}
.krw-primary-btn:hover:not(:disabled) {
  background: #1a1a1a;
}
[data-theme="dark"] .krw-primary-btn:hover:not(:disabled) {
  background: var(--paper-warm);
}
.krw-primary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============ Recents ============ */

.krw-recents__empty {
  border: var(--border-hair);
  border-radius: var(--radius-sm);
  padding: var(--s-6);
  background: rgb(var(--hi-rgb) / 0.3);
}
.krw-recents__empty p {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink-muted);
  margin: 0;
}

.krw-recents {
  list-style: none;
  padding: 0;
  margin: var(--s-3) 0 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
}

.krw-recents__item {
  background: var(--paper);
  padding: var(--s-4) var(--s-5);
  cursor: pointer;
  transition: background 200ms var(--ease);
}
.krw-recents__item:hover {
  background: var(--paper-warm);
}

.krw-recents__title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 400;
  margin: 0 0 var(--s-1);
  color: var(--ink);
}

.krw-recents__byline {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 0 0 var(--s-2);
}

.krw-recents__progress {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: 0 0 var(--s-1);
}

.krw-recents__bar {
  display: inline-block;
  width: 100px;
  height: 2px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
}
.krw-recents__bar-fill {
  display: block;
  height: 100%;
  background: var(--red-pen);
}

.krw-recents__progress-text {
  font-family: var(--font-ui);
  font-size: var(--tx-meta);
  letter-spacing: 0.04em;
}

.krw-recents__source {
  font-family: var(--font-serif);
  font-size: var(--tx-ui-sm);
  margin: 0;
}

.muted {
  color: var(--ink-faint);
}
/* Vision view ,  reading column, streamed prose, voice fingerprint, foot. */

.vision-view {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--s-9) var(--s-7) var(--s-10);
}

.vision-view--missing {
  text-align: center;
}

.vision-head {
  margin-bottom: var(--s-7);
}

.vision-title {
  font-size: var(--tx-display);
  font-weight: 300;
  margin: var(--s-3) 0 var(--s-3);
}

.vision-byline {
  font-family: var(--font-serif);
  color: var(--ink-muted);
  font-size: 1rem;
  margin: 0;
}

/* ----- Streaming dot ----- */

.vision-status {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-serif);
  color: var(--ink-muted);
  font-size: 0.95rem;
  margin: 0 0 var(--s-5);
}

.vision-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-soft);
  animation: krw-vision-pulse 1.4s ease-in-out infinite;
}

@keyframes krw-vision-pulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

/* ----- Vision body (streaming + static both pass through here) ----- */

.vision-body {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

.vision-para {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  line-height: var(--lh-prose);
  color: var(--ink);
  margin: 0;
  max-width: none;
  text-wrap: pretty;
}

.vision-empty {
  font-family: var(--font-serif);
  color: var(--ink-muted);
  margin: 0;
}

.vision-caret {
  display: inline-block;
  width: 1px;
  height: 1.1em;
  background: var(--ink);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: krw-vision-caret 1.06s steps(2) infinite;
}

@keyframes krw-vision-caret {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ----- Edit textarea ----- */

.vision-edit {
  width: 100%;
  min-height: 360px;
  background: rgb(var(--hi-rgb) / 0.6);
  border: var(--border-soft);
  border-radius: var(--radius-md);
  padding: var(--s-5);
  font-family: var(--font-serif);
  font-size: 1.18rem;
  line-height: var(--lh-prose);
  color: var(--ink);
  resize: vertical;
}
.vision-edit:focus {
  outline: none;
  border-color: var(--ink-faint);
}

/* ----- Voice fingerprint ----- */

.voice-print {
  margin-top: var(--s-9);
  padding-top: var(--s-6);
  border-top: var(--border-hair);
}

.voice-print__head {
  margin-bottom: var(--s-4);
}

.voice-print__grid {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin: 0;
}

.voice-print__row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--s-4);
  align-items: baseline;
}

@media (max-width: 600px) {
  .voice-print__row {
    grid-template-columns: 1fr;
    gap: var(--s-1);
  }
}

.voice-print__key {
  font-family: var(--font-ui);
  font-size: var(--tx-meta);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--track-eyebrow);
  color: var(--ink-muted);
  margin: 0;
}

.voice-print__val {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--ink);
  margin: 0;
  line-height: var(--lh-body);
}

/* ----- Foot actions ----- */

.vision-foot {
  margin-top: var(--s-8);
  padding-top: var(--s-5);
  border-top: var(--border-hair);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-4);
  flex-wrap: wrap;
}

.vision-foot__left {
  display: flex;
  gap: var(--s-5);
  flex-wrap: wrap;
}

.krw-link-btn {
  background: transparent;
  border: 0;
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 0;
  transition: color 200ms var(--ease);
  border-bottom: 1px solid transparent;
}
.krw-link-btn:hover:not(:disabled) {
  color: var(--ink);
  border-bottom-color: var(--red-pen);
}
.krw-link-btn:disabled {
  color: var(--ink-faint);
  cursor: not-allowed;
}
/* Outline ,  chapter list with streaming intents, sticky foot. */

.outline-view {
  max-width: 880px;
  margin: 0 auto;
  padding: var(--s-9) var(--s-7) calc(var(--s-9) + 80px);
}

.outline-view--missing {
  text-align: center;
}

.outline-head {
  margin-bottom: var(--s-7);
}

.outline-title {
  font-size: var(--tx-h1);
  font-weight: 400;
  margin: var(--s-3) 0 var(--s-3);
}

.outline-lede {
  font-family: var(--font-serif);
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin: 0;
}

.outline-status {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-serif);
  color: var(--ink-muted);
  font-size: 0.95rem;
  margin: 0 0 var(--s-5);
}

.outline-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: var(--border-hair);
}

.outline-item {
  position: relative;
  display: grid;
  grid-template-columns: 80px 1fr 32px;
  gap: var(--s-5);
  padding: var(--s-5) 0;
  border-bottom: var(--border-hair);
  transition: background 200ms var(--ease);
}

.outline-item:hover .outline-item__remove {
  opacity: 1;
}

.outline-item--streaming {
  background: rgb(var(--hi-rgb) / 0.4);
}
.outline-item--editing {
  background: var(--paper-warm);
}

.outline-item__num {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-top: 4px;
}

.outline-item__num-eyebrow {
  font-family: var(--font-ui);
  font-size: var(--tx-meta);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--track-eyebrow);
  color: var(--ink-faint);
}

.outline-item__num-value {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 300;
  color: var(--ink);
  line-height: 1;
  margin-top: 2px;
}

.outline-item__body {
  min-width: 0;
}

.outline-item__title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 400;
  margin: 0 0 var(--s-2);
  color: var(--ink);
}

.outline-item__intent {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: var(--lh-body);
  color: var(--ink-soft);
  margin: 0;
  cursor: text;
  border-radius: var(--radius-sm);
  padding: var(--s-2);
  margin: calc(var(--s-2) * -1);
  transition: background 200ms var(--ease);
  outline: none;
  text-wrap: pretty;
}
.outline-item__intent:hover {
  background: rgb(var(--ink-rgb) / 0.03);
}
.outline-item__intent:focus-visible {
  background: rgb(var(--ink-rgb) / 0.04);
  box-shadow: inset 0 0 0 1px var(--ink-faint);
}

.outline-item__empty {
  color: var(--ink-faint);
}

.outline-item__edit-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.outline-item__edit {
  width: 100%;
  background: rgb(var(--hi-rgb) / 0.6);
  border: var(--border-soft);
  border-radius: var(--radius-sm);
  padding: var(--s-3) var(--s-4);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: var(--lh-body);
  color: var(--ink);
  resize: vertical;
}
.outline-item__edit:focus {
  outline: none;
  border-color: var(--ink-faint);
}

.outline-item__edit-actions {
  display: flex;
  gap: var(--s-4);
  align-items: center;
  justify-content: flex-end;
}

.outline-item__remove {
  background: transparent;
  border: 0;
  color: var(--ink-faint);
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  align-self: start;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 200ms var(--ease), color 200ms var(--ease),
    background 200ms var(--ease);
}
.outline-item__remove:hover,
.outline-item__remove:focus-visible {
  color: var(--red-pen);
  background: var(--red-pen-bg);
  opacity: 1;
}

/* keyboard users see the remove control too */
.outline-item__remove:focus-visible {
  outline: 1px dashed var(--red-pen);
  outline-offset: 2px;
}

/* ----- Sticky foot ----- */

.outline-foot {
  position: sticky;
  bottom: 0;
  margin-top: var(--s-7);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--s-5);
  align-items: center;
  padding: var(--s-4) var(--s-6);
  background: rgb(var(--hi-rgb) / 0.92);
  backdrop-filter: saturate(1.1) blur(8px);
  -webkit-backdrop-filter: saturate(1.1) blur(8px);
  border-top: var(--border-soft);
  border-radius: var(--radius-md);
  margin-left: calc(var(--s-7) * -1);
  margin-right: calc(var(--s-7) * -1);
}

[data-theme="dark"] .outline-foot {
  background: rgba(40, 36, 32, 0.92);
}

.outline-foot__meta {
  justify-self: start;
}

.outline-foot__stats {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s-2);
  font-family: var(--font-serif);
  color: var(--ink-muted);
  font-size: 0.95rem;
  justify-self: center;
}

.outline-foot__count {
  font-style: italic;
}

.outline-foot__sep {
  color: var(--ink-faint);
}

.outline-foot .krw-primary-btn {
  justify-self: end;
}

/* small primary variant for the in-row 'Keep this intent' */
.krw-primary-btn--sm {
  padding: 6px 14px;
  font-size: 13px;
}

@media (max-width: 720px) {
  .outline-item {
    grid-template-columns: 64px 1fr 32px;
    gap: var(--s-3);
  }
  .outline-item__num-value {
    font-size: 1.6rem;
  }
  .outline-foot {
    grid-template-columns: 1fr;
    gap: var(--s-2);
    text-align: center;
  }
  .outline-foot__meta,
  .outline-foot__stats,
  .outline-foot .krw-primary-btn {
    justify-self: stretch;
    text-align: center;
  }
}
.krw-placeholder {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--s-10) var(--s-7);
}

.krw-placeholder h1 {
  margin: var(--s-3) 0 var(--s-5);
}

.krw-placeholder__body {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--ink-soft);
  max-width: 56ch;
}
/* Topbar ,  paper, ink, hairlines. Sticky. */

.krw-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--s-7);
  align-items: center;
  padding: var(--s-3) var(--s-7);
  background: rgb(var(--hi-rgb) / 0.82);
  backdrop-filter: saturate(1.1) blur(8px);
  -webkit-backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: var(--border-soft);
}

[data-theme="dark"] .krw-topbar {
  background: rgba(40, 36, 32, 0.88);
}

.krw-topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

/* Per-product mark per the Suite design system (suite/components.jsx
   ProductMark): a serifed capital K in red-pen, followed by a smaller
   lowercase tool letter in ink. For Rewriter the tool letter is "r".
   Weaver would be "w"; the Reader app uses "r/w". */
.krw-monogram {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
}

.krw-monogram__acc {
  color: var(--red-pen);
  font-size: 22px;
}

.krw-monogram__tool {
  color: var(--ink);
  font-size: 16px;
  margin-left: 1px;
  font-style: normal;
}

.krw-wordmark {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.krw-wordmark em {
  font-style: italic;
  font-weight: 400;
}

.krw-topbar__spacer {
  /* keeps the grid balanced when the stepper is absent */
}

.krw-topbar__actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.krw-ghost-btn {
  background: transparent;
  border: 1px solid rgb(var(--ink-rgb) / 0.1);
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 12px;
  cursor: pointer;
  transition: background 200ms var(--ease), border-color 200ms var(--ease), color 200ms var(--ease);
}
.krw-ghost-btn em {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 13px;
}
.krw-ghost-btn:hover {
  background: rgb(var(--ink-rgb) / 0.04);
  border-color: rgb(var(--ink-rgb) / 0.2);
  color: var(--ink);
}

.krw-ghost-btn--icon {
  font-size: 16px;
  line-height: 1;
  padding: 4px 10px;
}
/* Stepper ,  hairline-divided cells. Italic serif labels.
   Active stop gets a red-pen underline. */

.krw-stepper {
  display: flex;
  justify-content: center;
  border-left: var(--border-hair);
  border-right: var(--border-hair);
}

.krw-step {
  background: transparent;
  border: 0;
  border-right: var(--border-hair);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  min-width: 110px;
  position: relative;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background 200ms var(--ease);
}
.krw-step:last-child {
  border-right: 0;
}
.krw-step:hover {
  background: rgb(var(--ink-rgb) / 0.03);
}

.krw-step__num {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  margin-bottom: 2px;
}

.krw-step__label {
  font-family: var(--font-serif);
  font-size: 14px;
  font-style: italic;
  color: var(--ink-muted);
}

.krw-step--past .krw-step__label {
  color: var(--ink-soft);
}
.krw-step--past .krw-step__num {
  color: var(--ink-muted);
}

.krw-step--active::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -1px;
  height: 1.5px;
  background: var(--red-pen);
}
.krw-step--active .krw-step__label {
  color: var(--ink);
  font-style: normal;
  font-weight: 400;
}
.krw-step--active .krw-step__num {
  color: var(--red-pen);
}

.krw-step--locked {
  cursor: not-allowed;
  opacity: 0.45;
}
.krw-step--locked:hover {
  background: transparent;
}
/* Voice-source picker ,  four cards, same form, different glyph.
   Selection: 1.5px ink border, paper-warm background, slightly raised. */

.voice-picker {
  max-width: 720px;
}

.voice-picker__head {
  margin: var(--s-3) 0 var(--s-3);
}

.voice-picker__lede {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin: 0 0 var(--s-6);
}

.voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s-3);
}

@media (max-width: 720px) {
  .voice-grid {
    grid-template-columns: 1fr;
  }
}

.voice-card {
  background: rgb(var(--hi-rgb) / 0.55);
  border: var(--border-soft);
  border-radius: var(--radius-md);
  padding: var(--s-5) var(--s-5) var(--s-4);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  transition: border-color 200ms var(--ease), background 200ms var(--ease),
    box-shadow 200ms var(--ease), transform 200ms var(--ease);
  font-family: var(--font-ui);
}
.voice-card:hover {
  background: var(--paper-warm);
  border-color: rgb(var(--ink-rgb) / 0.18);
}
.voice-card--on {
  background: var(--paper-warm);
  border: 1.5px solid var(--ink);
  box-shadow: var(--shadow-md);
}
.voice-card--on .voice-card__glyph {
  color: var(--red-pen);
}
.voice-card:focus-visible {
  outline: 2px solid var(--red-pen);
  outline-offset: 2px;
}

.voice-card__glyph {
  display: inline-flex;
  color: var(--ink-muted);
  height: 48px;
  align-items: center;
  transition: color 200ms var(--ease);
}

.voice-card__label {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.3;
}

.voice-card__sub {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

/* ----- Conditional fields below the grid ----- */

.voice-fields {
  margin-top: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.voice-field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.voice-field__label {
  font-family: var(--font-ui);
  font-size: var(--tx-meta);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--track-eyebrow);
  color: var(--ink-muted);
}

.voice-field__hint {
  font-family: var(--font-ui);
  font-size: var(--tx-ui-sm);
  color: var(--ink-faint);
}

.voice-textarea,
.voice-input {
  width: 100%;
  background: rgb(var(--hi-rgb) / 0.6);
  border: var(--border-soft);
  border-radius: var(--radius-sm);
  padding: var(--s-3) var(--s-4);
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: var(--lh-body);
  color: var(--ink);
  resize: vertical;
}
.voice-textarea:focus,
.voice-input:focus {
  outline: none;
  border-color: var(--ink-faint);
}

.voice-slider {
  width: 100%;
  accent-color: var(--red-pen);
}

.voice-picker__warn {
  margin-top: var(--s-4);
  font-family: var(--font-serif);
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.voice-actions {
  margin-top: var(--s-7);
}
