:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --sidebar-bg: #fbfaf8;
  --ink: #1f2430;
  --ink-muted: #5b6270;
  --border: #e2e0da;
  --primary: #2f5d50;
  --primary-hover: #24483e;
  --primary-contrast: #ffffff;
  --primary-tint: #eaf1ee;
  --error: #b3261e;
  --error-bg: #fdecea;
  --radius: 10px;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

/* ---------- App shell: sidebar / main / info panel ---------- */

.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 280px;
  height: 100vh;
}

.app-shell[hidden],
.gate-screen[hidden] {
  display: none;
}

.sidebar,
.info-panel {
  overflow-y: auto;
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0.9rem;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.15rem;
  padding: 0.4rem 0.5rem 1.25rem;
}

.sidebar-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--primary-contrast);
  font-size: 0.95rem;
}

.step-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.step-nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 0.6rem 0.6rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.step-nav-item:hover:not(:disabled) {
  background: #efece5;
}

.step-nav-item.active {
  background: var(--primary-tint);
  color: var(--primary-hover);
  font-weight: 700;
}

.step-nav-item:disabled {
  color: #b7bcc4;
  cursor: not-allowed;
}

.step-nav-icon {
  width: 1.4em;
  text-align: center;
}

.funnel-group-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.7rem 0.6rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 8px;
}

.funnel-group-label:hover {
  background: #eef3f1;
}

.funnel-group-chevron {
  display: inline-block;
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}

.fe-steps-container,
.oto1-steps-container {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.fe-steps-container[hidden],
.oto1-steps-container[hidden] {
  display: none;
}

.funnel-divider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.9rem 0.2rem 0.3rem;
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.funnel-divider::before,
.funnel-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.funnel-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.funnel-item {
  opacity: 0.75;
}

.funnel-item .step-nav-icon {
  filter: grayscale(1);
}

.funnel-item.unlocked {
  opacity: 1;
}

.funnel-item.unlocked .step-nav-icon {
  filter: none;
}

.lock-icon {
  margin-left: auto;
  font-size: 0.8rem;
}

.oto-modal-note {
  color: var(--ink-muted);
  font-size: 0.85rem;
}

.history-limit-note {
  color: var(--ink-muted);
  font-size: 0.85rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 45vh;
  overflow-y: auto;
  margin: 0.75rem 0;
}

.history-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.history-item-title {
  font-weight: 700;
}

.history-item-meta {
  color: var(--ink-muted);
  font-size: 0.82rem;
  margin: 0.2rem 0 0.6rem;
}

.history-item-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.sidebar-footer {
  margin-top: auto;
  padding: 0.6rem 0.5rem 0.2rem;
  border-top: 1px solid var(--border);
}

.settings-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  text-align: left;
}

.settings-btn:hover {
  background: #f0efe9;
}

.settings-btn-icon {
  font-size: 1.1rem;
}

.settings-btn-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.settings-btn-label {
  font-size: 0.85rem;
  font-weight: 700;
}

.settings-btn-status {
  font-size: 0.75rem;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-btn-status.is-connected {
  color: var(--primary);
}

.sidebar-usage {
  font-weight: 600;
  font-size: 0.85rem;
  margin: 0.75rem 0 0.4rem;
}

.sidebar-privacy {
  color: var(--ink-muted);
  font-size: 0.78rem;
  margin: 0;
}

.main-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-topbar {
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.5rem;
  flex-shrink: 0;
}

.breadcrumb {
  color: var(--ink-muted);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.resume-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--primary-tint);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
}

.resume-banner[hidden] {
  display: none;
}

.resume-banner p {
  margin: 0;
  color: var(--primary-hover);
  font-weight: 600;
  font-size: 0.9rem;
}

.resume-banner-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.info-panel {
  border-left: 1px solid var(--border);
  background: var(--surface);
  padding: 1.25rem 1.1rem;
}

.info-panel h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin: 1.4rem 0 0.6rem;
}

.info-panel h3:first-child {
  margin-top: 0;
}

.info-list {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 0.75rem;
}

.info-list dt {
  color: var(--ink-muted);
  font-size: 0.85rem;
}

.info-list dd {
  margin: 0;
  font-size: 0.9rem;
  text-align: right;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-block;
  background: var(--primary-tint);
  color: var(--primary-hover);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.info-empty {
  color: var(--ink-muted);
  font-size: 0.85rem;
  margin: 0;
}

.info-chapter-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.info-chapter-list li {
  font-size: 0.85rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  gap: 0.4rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-pill {
  background: var(--primary-tint);
  color: var(--primary-hover);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
}

/* ---------- Settings modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 36, 48, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 100;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  max-width: 480px;
  width: 100%;
  margin: 0;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.modal-header h2 {
  margin: 0;
}

.modal-close {
  font-size: 1.1rem;
}

/* ---------- Access gate (full page, shown instead of the shell) ---------- */

.gate-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.gate-card {
  max-width: 420px;
  width: 100%;
}

/* ---------- Shared card / form controls (used inside main-pane and gate) ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 0 auto 1.5rem;
  max-width: 720px;
  width: 100%;
}

.card h2 {
  margin-top: 0;
}

.field-label {
  display: block;
  font-weight: 600;
  margin: 1rem 0 0.35rem;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 1rem 0 0.35rem;
}

.label-row .field-label {
  margin: 0;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  text-decoration: underline;
}

.suggestion-chips {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.suggestion-chips[hidden] {
  display: none;
}

.suggestion-chip {
  text-align: left;
  background: var(--primary-tint);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
}

.suggestion-chip:hover {
  border-color: var(--primary);
}

.suggestion-regen-row {
  margin-top: 0.3rem;
}

.suggestion-regen-row .usage-counter,
.suggestion-regen-row .error-text {
  margin-top: 0.5rem;
}

/* ---------- Writing mode selection (length / tone) ---------- */

.mode-card-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.mode-card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.7rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.mode-card:hover {
  border-color: var(--primary);
}

.mode-card.selected {
  background: var(--primary-tint);
  border-color: var(--primary);
}

.mode-card-title {
  font-weight: 700;
  font-size: 0.92rem;
}

.mode-card-meta {
  color: var(--ink-muted);
  font-size: 0.78rem;
}

.mode-card-calls {
  color: var(--primary-hover);
  font-size: 0.76rem;
  font-weight: 600;
}

/* ---------- Metadata: regenerate/edit fields (section 5e) ---------- */

.field-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 1rem 0 0.35rem;
}

.field-with-action[hidden] {
  display: none;
}

.field-with-action .field-label {
  margin: 0;
}

.char-counter {
  margin: 0.3rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-muted);
  text-align: right;
}

.char-counter.over-limit {
  color: #9a6400;
  font-weight: 600;
}

.keyword-slot-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.keyword-slot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.keyword-slot input {
  flex: 1;
}

.keyword-slot-counter {
  font-size: 0.75rem;
  color: var(--ink-muted);
  white-space: nowrap;
  min-width: 3.2em;
  text-align: right;
}

.keyword-slot-counter.over-limit {
  color: #9a6400;
  font-weight: 600;
}

.keyword-slot .link-btn {
  white-space: nowrap;
}

@media (max-width: 480px) {
  .mode-card-group {
    grid-template-columns: 1fr;
  }
}

input[type='text'],
input[type='password'],
input[type='number'],
textarea,
select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.field-row {
  display: flex;
  gap: 0.5rem;
}

.field-row input {
  flex: 1;
}

.help-details {
  margin: 0.75rem 0 1rem;
  background: #f2f6f4;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
}

.help-details summary {
  cursor: pointer;
  font-weight: 600;
}

.help-details ol {
  margin: 0.6rem 0 0.2rem;
  padding-left: 1.2rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-contrast);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  background: #9fb3ae;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: #f0efe9;
}

.error-text {
  color: var(--error);
  background: var(--error-bg);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-top: 1rem;
}

/* A soft, non-blocking notice (e.g. a narrow spine warning) — same shape as
   .error-text but amber instead of red, since it isn't an error. */
.notice-warning {
  color: #9a6b00;
  background: #fff6e0;
}

.notice-recommend {
  color: #1a5c4a;
  background: #e4f5ee;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-top: 1rem;
  font-weight: 600;
}

.notice-recommend[hidden] {
  display: none;
}

/* OTO2 vs OTO3 Clarity Gate comparison table (ARCHITECTURE.md §47) — the
   first (and, so far, only) real table in the app; no existing
   table-rendering pattern to reuse, so this is a plain, minimally-styled
   HTML table matching the app's existing card/border look. The wrapper
   scrolls horizontally on narrow screens rather than letting the table
   squeeze/overflow the page. */
.oto3-gate-table-wrap {
  overflow-x: auto;
  margin-top: 1.25rem;
}

.oto3-gate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.oto3-gate-table th,
.oto3-gate-table td {
  border: 1px solid var(--border);
  padding: 0.6rem 0.7rem;
  text-align: left;
  vertical-align: top;
}

.oto3-gate-table th {
  background: var(--bg);
  font-weight: 700;
}

.oto3-gate-table td:first-child {
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
}

.wraparound-diagram {
  display: flex;
  align-items: stretch;
  height: 160px;
  margin: 0.8rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.wraparound-diagram[hidden] {
  display: none;
}

.wraparound-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  line-height: 1.3;
  text-align: center;
  padding: 0.2rem;
  box-sizing: border-box;
  border-right: 1px dashed var(--border);
}

.wraparound-segment:last-child {
  border-right: none;
}

.wraparound-segment.back {
  background: var(--primary-tint);
}

.wraparound-segment.spine {
  background: var(--bg);
}

.wraparound-segment.front {
  background: var(--primary-tint);
}

.wraparound-dims {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 0.8rem;
}

.wraparound-dims p {
  margin: 0.2rem 0;
}

.outline-chapter {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
  margin-top: 0.75rem;
}

.chapter-review-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.chapter-review-list[hidden] {
  display: none;
}

.chapter-review-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
}

.chapter-review-item.chapter-added {
  background: #fff8e6;
  border-color: #f0d896;
}

.chapter-badge-ai {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  background: #f0d896;
  color: #6b4e00;
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  margin-left: 0.4rem;
  white-space: nowrap;
}

.chapter-preview-content {
  white-space: pre-wrap;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  line-height: 1.5;
  max-height: 300px;
  overflow-y: auto;
}

.chapter-review-item textarea {
  font-family: inherit;
  line-height: 1.5;
}

.outline-chapter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.outline-chapter-header span {
  color: var(--ink-muted);
  font-weight: 600;
  white-space: nowrap;
}

.outline-chapter input {
  margin-bottom: 0.5rem;
}

/* OTO4 queue setup (ARCHITECTURE.md §46) — one row per topic: textarea +
   genre select + remove button, laid out like a compact form row rather
   than the taller outline-chapter card style (there can be up to 10 of
   these, so keeping each one short matters more here than elsewhere). */
.oto4-queue-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

.oto4-queue-row textarea {
  flex: 1 1 auto;
  min-width: 0;
}

.oto4-queue-row-genre {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  flex: 0 0 auto;
}

.oto4-queue-row-genre select {
  width: auto;
}

.oto4-queue-row-genre .link-btn {
  font-size: 0.78rem;
  white-space: nowrap;
}

.oto4-outline-body {
  margin-top: 0.6rem;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 1rem;
}

.icon-btn:hover {
  color: var(--error);
}

.progress-bar {
  height: 10px;
  background: #edece6;
  border-radius: 999px;
  overflow: hidden;
  margin: 0.75rem 0 1rem;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.chapter-status-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chapter-status-list[hidden] {
  display: none;
}

.chapter-status-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
}

.chapter-status-list .status {
  color: var(--ink-muted);
  white-space: nowrap;
}

.chapter-status-list li.status-done .status {
  color: var(--primary);
}

.chapter-status-list li.status-error .status {
  color: var(--error);
}

.usage-counter {
  color: var(--ink-muted);
}

.cover-preview-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.cover-preview-img {
  width: 120px;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.print-cover-variants {
  display: flex;
  gap: 1rem;
  margin: 0.6rem 0 1rem;
}

.hardcover-cover-art {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0.6rem 0 1rem;
}

.hardcover-cover-art[hidden] {
  display: none;
}

.hardcover-cover-art figure {
  margin: 0;
  text-align: center;
}

.hardcover-cover-art img {
  max-width: 160px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.hardcover-cover-art figcaption {
  font-size: 0.85rem;
  color: var(--text-muted, #666);
  margin-top: 0.25rem;
}

.print-cover-variants[hidden] {
  display: none;
}

.print-cover-variant {
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  background: none;
}

.print-cover-variant.selected {
  border-color: var(--primary);
}

.print-cover-variant img {
  display: block;
  width: 100px;
  height: 150px;
  object-fit: cover;
  border-radius: 4px;
}

.print-checklist {
  list-style: none;
  margin: 0.6rem 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.print-checklist li label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
}

.print-checklist input[type='checkbox'] {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.print-checklist li:has(input:checked) {
  color: var(--primary-hover);
  text-decoration: line-through;
  text-decoration-color: var(--border);
}

.preflight-results li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.preflight-icon {
  flex-shrink: 0;
}

.preflight-results li.preflight-fail {
  color: var(--error);
}

.preflight-results li.preflight-warn {
  color: #9a6b00;
}

.trim-results {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0.8rem 0;
}

.trim-result-card {
  flex: 1 1 260px;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.trim-result-card.trim-recommended {
  border: 2px solid #1a5c4a;
  box-shadow: 0 0 0 2px #e4f5ee;
}

/* Bleed & Safe Zone Preview (OTO1-Pro bonus) */

.safe-zone-preview {
  margin-top: 0.8rem;
  border-top: 1px solid var(--border);
  padding-top: 0.8rem;
}

.safe-zone-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
}

.safe-zone-toggles label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.safe-zone-zoom-label input[type='range'] {
  vertical-align: middle;
  margin-left: 0.3rem;
}

.safe-zone-viewport {
  overflow: auto;
  max-width: 100%;
  max-height: 420px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 0 0 / 16px 16px;
}

.safe-zone-canvas-wrap {
  min-width: 120px;
}

.safe-zone-legend {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin: 0.5rem 0;
}

.safe-zone-check-result .btn {
  margin-top: 0.4rem;
}

/* OTO2 — Simultaneous Multi-Language Generation */

.switch-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  margin: 0.8rem 0 0.4rem;
}

#oto2-language-checklist.field-row {
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

#oto2-language-checklist label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.oto2-language-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.6rem;
}

.oto2-language-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.oto2-language-row-header span {
  color: var(--ink-muted);
  font-size: 0.9rem;
}

/* OTO4 Fix #6 — status text + its Retry link, grouped so they sit next to
   each other on the right side of the row header. */
.oto4-row-status-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.oto2-spot-check {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin: 0.6rem 0;
}

.oto2-spot-check-caption {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-top: 0.4rem;
}

/* Active Language Indicator — lightweight, sticky, no dismiss. Reuses the
   same calm teal as .notice-recommend so it reads as "informational," not
   a warning or error. */
.oto2-active-language-banner {
  position: sticky;
  top: 0;
  z-index: 5;
  max-width: 720px;
  margin: 0 auto 1rem;
  background: #e4f5ee;
  color: #1a5c4a;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.oto2-active-language-banner[hidden] {
  display: none;
}

/* OTO3 page-level identity banner (ARCHITECTURE.md §44) — deliberately a
   distinct hue (violet) from OTO2's own banner above (teal), a distinct
   border, and centered/bolder text, so the two near-identical
   language-selection flows read as visually different products at a
   glance, not just different copy. */
.oto3-identity-banner {
  position: sticky;
  top: 0;
  z-index: 5;
  max-width: 720px;
  margin: 0 auto 1rem;
  background: #ece6fb;
  color: #4a3b8a;
  border: 1px solid #cabdf0;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
}

.oto3-identity-banner[hidden] {
  display: none;
}

.trim-result-card h4 {
  margin: 0 0 0.4rem;
}

.cover-preview-meta {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.cover-preview-meta p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .info-panel {
    display: none;
  }
}

@media (max-width: 640px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem;
  }

  .sidebar-brand {
    padding-bottom: 0.6rem;
  }

  .step-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 0.3rem;
  }

  .fe-steps-container,
  .oto1-steps-container {
    flex-direction: row;
    gap: 0.3rem;
  }

  .funnel-group-label {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .step-nav-item {
    white-space: nowrap;
  }

  .sidebar-footer {
    display: none;
  }

  .field-row {
    flex-direction: column;
  }

  .actions {
    flex-direction: column;
  }

  .actions .btn {
    width: 100%;
  }
}
