:root {
  --ink: #1c1916;
  --ink-soft: #4a453e;
  --label: #2e2a26;
  --paper: #f4efe6;
  --panel: #fbf8f2;
  --rule: rgba(28, 25, 22, 0.1);
  --seal: #7c2f24;
  --seal-deep: #5c221b;
  --gold: #a07838;
  --human: #2f5d45;
  --mixed: #8a6a2a;
  --uncertain: #5c5a56;
  --machine: #7c2f24;
  --shadow: none;
  --radius: 2px;
  --font-display: "Plus Jakarta Sans", "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  height: auto;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16.5px;
  background: var(--paper);
}

body {
  display: flex;
  flex-direction: column;
}

.top {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1.75rem;
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  text-decoration: none;
  color: inherit;
}

.seal {
  display: grid;
  place-items: center;
  color: var(--seal);
  flex-shrink: 0;
}

.seal svg {
  width: 42px;
  height: 42px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 2.05rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1;
}

.brand-sub {
  color: var(--ink-soft);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  border: 1px solid var(--rule);
  background: transparent;
  padding: 0.32rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--label);
}

.header-link {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--rule);
}

.header-link:hover { border-color: var(--ink); }

.workspace {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  /* Leave room for header + studio intro; do not fight marketing sections below */
  min-height: calc(100vh - 11rem);
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
}

.composer,
.results-pane {
  min-height: 0;
  overflow: auto;
  padding: 1.35rem 1.5rem 2rem;
}

.composer {
  background: var(--panel);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
}

.mode-rail {
  position: fixed;
  left: 10px;
  top: 22rem;
  z-index: 30;
  background: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.mode-rail-btn {
  border: 0;
  background: transparent;
  color: var(--ink);
  width: 84px;
  min-height: 74px;
  padding: 0.2rem 0.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mode-rail-btn.is-active {
  color: var(--seal);
}

.mode-rail-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1.5px solid currentColor;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  background: #fff;
}

.mode-rail-icon svg {
  display: block;
}

.mode-rail-label {
  text-align: center;
  line-height: 1.2;
  font-size: 0.66rem;
}

.mode-rail-btn.is-active .mode-rail-icon {
  border-color: var(--seal);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--seal) 45%, transparent);
}

.mode-rail-btn.is-active .mode-rail-label::after {
  content: "";
  display: block;
  width: 22px;
  height: 2px;
  margin: 0.24rem auto 0;
  background: var(--seal);
}

.results-pane {
  background: var(--paper);
  position: relative;
}

.pane-kicker {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pane-label {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--seal);
}

.pane-note {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
  text-align: right;
  line-height: 1.4;
}

.results-empty {
  min-height: calc(100% - 2rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--ink-soft);
}

.results-empty[hidden] { display: none; }

.empty-seal {
  color: color-mix(in srgb, var(--seal) 45%, var(--gold));
  margin-bottom: 1.1rem;
}

.empty-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.empty-copy {
  margin: 0.55rem 0 0;
  max-width: 22rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.55rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--label);
}

label.check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  text-transform: none;
  letter-spacing: 0;
}

select, textarea {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0;
  padding: 0.6rem 0.7rem;
}

select:focus, textarea:focus {
  outline: 1px solid var(--ink);
  outline-offset: 0;
}

#textInput {
  flex: 1;
  resize: vertical;
  min-height: 280px;
  line-height: 1.6;
  font-size: 1.05rem;
}

.draft-focus {
  margin: 0 0 0.55rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--seal) 35%, var(--rule));
  background: color-mix(in srgb, var(--seal) 6%, #fff);
}

.draft-focus[hidden] { display: none; }

.draft-focus-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
}

.draft-focus-label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--seal);
}

.draft-focus-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.draft-focus-btn {
  border-radius: var(--radius);
  padding: 0.28rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--seal);
  color: #fbf8f2;
  border: 0;
}

.draft-focus-btn.ghostish {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
}

.draft-focus-btn:hover { transform: none; }

.draft-focus-quote {
  margin: 0.55rem 0 0;
  padding: 0.55rem 0.65rem;
  background: #fff6d6;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 7.5rem;
  overflow: auto;
}

.draft-focus-hint {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.4;
  text-transform: none;
  letter-spacing: 0;
}

textarea.has-draft-focus {
  border-color: var(--seal);
  box-shadow: 0 0 0 1px var(--seal);
}

.word-meter {
  margin-top: 0.55rem;
  display: grid;
  gap: 0.3rem;
}

.word-meter-bar {
  height: 2px;
  background: var(--rule);
  overflow: hidden;
}

.word-meter-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--ink);
  transition: width 0.15s ease, background 0.15s ease;
}

.word-meter.warn .word-meter-bar span { background: var(--gold); }
.word-meter.short .word-meter-bar span { background: var(--gold); }
.word-meter.over .word-meter-bar span { background: var(--seal); }
.word-meter.under .word-count { color: var(--ink-soft); }
.word-meter.short .word-count { color: var(--gold); font-weight: 500; }
.word-meter.over .word-count { color: var(--seal); font-weight: 600; }

.word-count {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
  text-align: right;
  text-transform: none;
  letter-spacing: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.45rem;
}

.actions-note {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

body.mode-plagiarism .ai-only { display: none !important; }
body.mode-ai .plag-only { display: none !important; }

.plagiarism-box {
  margin-top: 0.7rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--rule);
  background: var(--panel);
}

.plagiarism-box[hidden] { display: none; }

.plagiarism-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--label);
}

.plagiarism-summary {
  margin: 0.45rem 0 0;
  font-size: 0.93rem;
  color: var(--ink);
  line-height: 1.45;
}

.plagiarism-sources {
  margin: 0.45rem 0 0;
  padding-left: 1.1rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

button, .file-btn {
  border: 0;
  border-radius: var(--radius);
  padding: 0.75rem 1.05rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

button:hover, .file-btn:hover { transform: none; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.primary {
  background: var(--seal);
  color: #fbf8f2;
  margin-left: auto;
}
.primary:hover { background: var(--seal-deep); }
.primary.is-busy {
  opacity: 1;
  cursor: wait;
}
.primary.is-busy:hover { background: var(--seal); }

.btn-spinner {
  display: none;
  width: 0.85rem;
  height: 0.85rem;
  border: 1.5px solid rgba(251, 248, 242, 0.35);
  border-top-color: #fbf8f2;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.primary.is-busy .btn-spinner { display: inline-block; }

.ghost, .file-btn {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}

.ghost:hover, .file-btn:hover { border-color: var(--ink); }

.scan-progress {
  margin-top: 0.85rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--rule);
}
.scan-progress[hidden] { display: none; }

.scan-progress-track {
  height: 2px;
  background: var(--rule);
  overflow: hidden;
}

.scan-progress-bar {
  width: 40%;
  height: 100%;
  background: var(--seal);
  animation: scan-indeterminate 1.35s ease-in-out infinite;
}

.scan-progress-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.55rem 0 0;
  font-size: 0.8rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-soft);
}

.scan-progress-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--seal);
  animation: pulse-dot 1.1s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes scan-indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.file-note, .status {
  min-height: 1.1rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin: 0.45rem 0 0;
  letter-spacing: 0;
  text-transform: none;
}

.parse-toast {
  position: sticky;
  top: 0.45rem;
  z-index: 5;
  margin: 0.35rem 0 0;
  padding: 0.42rem 0.6rem;
  border: 1px solid color-mix(in srgb, var(--human) 40%, var(--rule));
  background: color-mix(in srgb, var(--human) 10%, #fff);
  color: var(--human);
  font-size: 0.88rem;
  line-height: 1.35;
}

.parse-toast[hidden] { display: none; }

.check-context {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.45;
}

.scoreboard {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.score-hero,
.score-tile {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 0.95rem 1rem;
}

.score-hero {
  animation: none;
  box-shadow: inset 3px 0 0 transparent;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.score-hero.band-human {
  border-color: color-mix(in srgb, var(--human) 42%, var(--rule));
  background: color-mix(in srgb, var(--human) 10%, var(--panel));
  box-shadow: inset 3px 0 0 var(--human);
}

.score-hero.band-mixed,
.score-hero.band-uncertain {
  border-color: color-mix(in srgb, var(--mixed) 45%, var(--rule));
  background: color-mix(in srgb, var(--mixed) 11%, var(--panel));
  box-shadow: inset 3px 0 0 var(--mixed);
}

.score-hero.band-machine {
  border-color: color-mix(in srgb, var(--machine) 42%, var(--rule));
  background: color-mix(in srgb, var(--machine) 9%, var(--panel));
  box-shadow: inset 3px 0 0 var(--machine);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--label);
}

.score-hero-num {
  margin: 0.15rem 0 0;
  font-family: var(--font-body);
  font-size: clamp(2.1rem, 4vw, 2.7rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.score-hero-unit {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.score-hero-band {
  margin: 0.25rem 0 0;
  font-family: var(--font-body);
  font-size: clamp(1.35rem, 2.8vw, 1.65rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1.15;
  color: var(--ink);
}

.score-hero-band.band-human,
.score-pct.band-human { color: var(--human); }

.score-hero-band.band-mixed,
.score-hero-band.band-uncertain,
.score-pct.band-mixed,
.score-pct.band-uncertain { color: var(--mixed); }

.score-hero-band.band-machine,
.score-pct.band-machine { color: var(--machine); }

.ai-metric {
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--rule);
}

.band-plain {
  margin: 0.3rem 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.45;
}

.score-bar {
  margin-top: 0.75rem;
  height: 3px;
  background: var(--rule);
  overflow: hidden;
}

.score-bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  transition: width 0.45s ease;
  background: var(--ink);
}

.score-bar-fill.human { background: var(--human); }
.score-bar-fill.mixed { background: var(--mixed); }
.score-bar-fill.uncertain { background: var(--uncertain); }
.score-bar-fill.machine { background: var(--machine); }

.score-scale {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.4;
}

.passage-counts {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}

.passage-counts li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.passage-counts strong {
  margin-left: auto;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.human { background: var(--human); }
.dot.mixed { background: var(--mixed); }
.dot.machine { background: var(--machine); }

.score-side {
  display: grid;
  gap: 0.55rem;
}

.score-tile { animation: none; }

.score-tile-label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--label);
}

.score-tile-value {
  margin: 0.25rem 0 0;
  font-family: var(--font-body);
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.score-tile-value--text {
  font-size: 1.1rem;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0;
}

.score-tile-value.tone-human { color: var(--human); }
.score-tile-value.tone-mixed { color: var(--mixed); }
.score-tile-value.tone-machine { color: var(--machine); }
.score-tile-value.tone-action-ship { color: var(--human); }
.score-tile-value.tone-action-edit { color: var(--mixed); }
.score-tile-value.tone-action-hold { color: var(--machine); }

.reason-chips {
  list-style: none;
  margin: 0.45rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.reason-chips li {
  margin: 0;
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--rule);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.25;
}

.reason-chips li.sev-alert {
  border-color: color-mix(in srgb, var(--machine) 45%, var(--rule));
  color: var(--machine);
}

.reason-chips li.sev-watch {
  border-color: color-mix(in srgb, var(--mixed) 50%, var(--rule));
  color: var(--mixed);
}

.reason-chips li.is-empty {
  font-weight: 400;
  color: var(--ink-soft);
  border-style: dashed;
}

.score-tile-hint {
  margin: 0.3rem 0 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.score-story {
  margin: 0 0 0.9rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: none;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.55;
}

.score-build {
  margin: 0 0 1rem;
  padding: 0.55rem 0 0.75rem;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
}

.score-build summary {
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--label);
  list-style: none;
}

.score-build summary::-webkit-details-marker { display: none; }
.score-build summary::before { content: "+  "; color: var(--seal); }
.score-build[open] summary::before { content: "–  "; }
.score-build[open] summary { margin-bottom: 0.65rem; }

.score-build-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.55rem;
}

.score-part {
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--rule);
  background: var(--panel);
}

.score-part-label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--label);
}

.score-part-caption {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.score-part-meta {
  margin: 0.25rem 0 0;
  font-size: 0.7rem;
  color: var(--ink-soft);
  line-height: 1.3;
}

.score-build-note {
  margin: 0.7rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.passages { margin-bottom: 1rem; }

.passages-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
}

.passages-head h3 {
  margin: 0 0 0.2rem;
  font-size: 0.92rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--label);
}

.passages-legend {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.map-filters { display: flex; gap: 0.3rem; }

.map-filter {
  border-radius: var(--radius);
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: transparent;
  color: var(--label);
  border: 1px solid var(--rule);
}

.map-filter.is-active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.map-filter:hover { transform: none; }

.tile-link {
  margin-top: 0.5rem;
  padding: 0.3rem 0;
  border: 0;
  background: none;
  color: var(--seal);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
  border-radius: 0;
}

.tile-link:hover {
  transform: none;
  text-decoration: underline;
}

.tile-link[hidden] { display: none; }

.passages-note {
  margin: 0 0 0.55rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.4;
}

.rewrite-coach {
  margin: 0 0 0.55rem;
  padding: 0.6rem 0;
  border-top: 1px dashed var(--rule);
  border-bottom: 1px dashed var(--rule);
  background: none;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.5;
}

.rewrite-coach[hidden] { display: none; }

.swatch {
  width: 0.55rem;
  height: 0.55rem;
  display: inline-block;
}
.swatch.human { background: var(--human); }
.swatch.mixed { background: var(--mixed); }
.swatch.uncertain { background: var(--uncertain); }
.swatch.machine { background: var(--machine); }

.heatmap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chunk {
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem 0.7rem 0.9rem;
  color: var(--ink);
  transition: border-color 0.15s ease;
  cursor: pointer;
  text-align: left;
  border: 1px solid var(--rule);
  border-left-width: 3px;
  width: 100%;
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
  display: block;
  background: var(--panel);
}
.chunk:hover { transform: none; border-color: var(--ink); }
.chunk:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}
.chunk.is-active {
  border-color: var(--seal);
  box-shadow: inset 0 0 0 1px var(--seal);
}
.chunk.is-done { opacity: 0.55; }
.chunk[hidden] { display: none; }
.chunk.human { border-left-color: var(--human); background: color-mix(in srgb, var(--human) 7%, var(--panel)); }
.chunk.mixed { border-left-color: var(--mixed); background: color-mix(in srgb, var(--mixed) 8%, var(--panel)); }
.chunk.machine { border-left-color: var(--machine); background: color-mix(in srgb, var(--machine) 8%, var(--panel)); }
.chunk.uncertain { border-left-color: var(--uncertain); background: color-mix(in srgb, var(--uncertain) 8%, var(--panel)); }

.chunk header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.chunk-label { opacity: 1; }
.chunk header strong {
  font-size: 0.95rem;
  color: var(--ink);
  letter-spacing: 0;
  text-transform: none;
}

.chunk-snippet {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
}

.chunk-why {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--muted, #5c5c5c);
}

.tech-band {
  margin: 0.15rem 0 0.75rem;
  font-size: 0.78rem;
  color: var(--muted, #5c5c5c);
}

.chunk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.chunk-actions button {
  border-radius: var(--radius);
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}

.chunk-actions button:hover {
  border-color: var(--ink);
  transform: none;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.panel {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.8rem;
  background: var(--panel);
}

.panel h3 {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--label);
}

.panel ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--ink-soft);
  line-height: 1.55;
  font-size: 0.98rem;
}

.panel-copy {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.55;
}

.composer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.15rem;
}

.composer-head .pane-note {
  text-align: left;
  margin: 0;
}

.composer-head-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.select-compact {
  width: auto;
  padding: 0.25rem 0.4rem;
  font-size: 0.82rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}

.inline-label {
  display: inline;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--label);
  white-space: nowrap;
}

.policy-hint {
  font-size: 0.78rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--label);
}

.advanced-controls {
  margin: 0.4rem 0 0.5rem;
}

.advanced-controls summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.adv-lede {
  margin: 0.35rem 0 0.65rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.adv-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.5rem;
  gap: 0.5rem;
}

.adv-grid label {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  gap: 0.2rem;
}

.adv-grid select {
  padding: 0.25rem 0.4rem;
  font-size: 0.82rem;
}

.adv-grid .adv-span-2 {
  grid-column: 1 / -1;
}

.advanced-controls .policy-hint {
  margin: 0.55rem 0 0;
  white-space: normal;
  line-height: 1.4;
}

.qa-extras {
  margin: 0.7rem 0 0.15rem;
  padding: 0.55rem 0;
  border-top: 1px dashed var(--rule);
  border-bottom: 1px dashed var(--rule);
  background: none;
}

.qa-extras summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.84rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--label);
}

.block-label {
  display: block;
  margin-top: 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--label);
}

.block-label textarea {
  margin-top: 0.3rem;
  width: 100%;
  min-height: 0;
}

.hybrid-summary {
  margin: 0 0 0.75rem;
  font-family: var(--font-body);
  font-size: 1.1rem;
  line-height: 1.4;
  color: var(--ink);
}

.policy-note,
.reliability-note {
  margin: 0 0 0.75rem;
  padding: 0.6rem 0.75rem;
  border-left: 2px solid var(--gold);
  background: color-mix(in srgb, var(--gold) 8%, transparent);
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.45;
}

.evidence-item.sev-alert strong { color: var(--machine); }
.evidence-item.sev-watch strong { color: var(--mixed); }
.evidence-item.sev-info strong { color: var(--human); }

.secondary-grid { margin-top: 0.7rem; }

.disclaimer {
  margin-top: 1.1rem;
  padding: 0.75rem 0 0;
  border-top: 1px solid var(--rule);
  border-left: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.55;
}

.engine-line {
  margin: 0.4rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.foot {
  flex-shrink: 0;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.foot a { color: var(--seal); }

@media (max-width: 960px) {
  .workspace {
    grid-template-columns: 1fr;
    border-left: 0;
    border-right: 0;
    min-height: auto;
  }
  .composer {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    min-height: auto;
  }
  .mode-rail {
    position: static;
    flex-direction: row;
    justify-content: center;
    padding: 0.65rem;
    background: var(--panel);
    border-bottom: 1px solid var(--rule);
  }
  .mode-rail-btn {
    width: auto;
    min-width: 120px;
    flex-direction: row;
    justify-content: center;
    padding: 0.45rem 0.7rem;
    min-height: 44px;
  }
  .mode-rail-icon {
    width: 30px;
    height: 30px;
    font-size: 0.72rem;
    border-width: 1.5px;
  }
  #textInput { min-height: 180px; flex: none; }
  .controls, .grid, .scoreboard { grid-template-columns: 1fr; }
  .top { padding: 0.75rem 1rem; }
  .composer, .results-pane { padding: 1.1rem 1rem 1.5rem; }
  .foot { border-left: 0; border-right: 0; }
  .primary { margin-left: 0; }
  .pane-kicker { flex-direction: column; align-items: flex-start; }
  .pane-note { text-align: left; }
}
